Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump webpack from 5.75.0 to 5.76.0 in /packages/design-system #2651

Open
wants to merge 178 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
a4e47df
Revert "chore(apps): upgrade connectkit and wagmi (#2319)" (#2346)
maurerbot May 31, 2023
f3dd8b9
feat(passport): custom domain integration (#2330)
szkl Jun 1, 2023
1ebe5dd
chore(platform): Add multi-wallet selection support to authz screen (…
poolsar42 Jun 1, 2023
51dee61
fix(passport): web3 auth lazy load back (#2345)
poolsar42 Jun 1, 2023
f9104a4
chore(passport): add loopback address to default hosts list (#2350)
szkl Jun 1, 2023
2e34ca8
feat(passport): Support Designer-customized authn/authz screens (#2339)
Cosmin-Parvulescu Jun 2, 2023
4b16bc7
hotfix(console): Temp fix for email selection in Team and contacts (#…
betimshahini Jun 2, 2023
a1e7cd6
chore(Design): Modal Cancel Button (#2344)
poolsar42 Jun 5, 2023
8d5ea69
bug(console): Team and contacts email selection doesn't persist (#2356)
poolsar42 Jun 5, 2023
f1cb1d7
feat(console): DNS validation for custom domain CNAME records. (#2357)
betimshahini Jun 5, 2023
e8d4380
fix(starbase): Fix in validation logic of custom domains in getAppPub…
betimshahini Jun 6, 2023
2695540
chore(passport): Improve connection flow toast messages (#2358)
poolsar42 Jun 6, 2023
fe91610
feat(passport): connect oauth proxy (#2364)
szkl Jun 6, 2023
1db1e73
feat(passport): Settings - Add missing scopes to Application page (#2…
poolsar42 Jun 7, 2023
97021b5
chore(console): display loader when the fetcher is submitting (#2372)
szkl Jun 7, 2023
037f1d7
fix(console): make copier a block element to preserve box size (#2371)
szkl Jun 7, 2023
9b25567
feat(console): DKIM, DMARC & SPF records for custom domains (#2347)
Cosmin-Parvulescu Jun 7, 2023
bb22d96
feat(starbase): swap app name in otp email subject (#2380)
Cosmin-Parvulescu Jun 7, 2023
2f3e87c
feat(console): Designer - Login tab tweaks (#2359)
Cosmin-Parvulescu Jun 8, 2023
d9bccb7
chore(console): multiple scopes with fix for app deletion (#2370)
poolsar42 Jun 8, 2023
4a0a3e7
fix(passport): Dark mode fix for create smart contract wallet screen …
poolsar42 Jun 8, 2023
b2a37f5
bug(passport): Connect account button colours regression (#2376)
Cosmin-Parvulescu Jun 8, 2023
f02ddee
chore(passport): Default side image in login page needs to be adjuste…
Cosmin-Parvulescu Jun 8, 2023
6c99b61
fix(passport): Hitting Reject on wallet login prompt leads to unrecov…
poolsar42 Jun 9, 2023
7c71148
feat(console): delete app modal checks custom domain config (#2373)
szkl Jun 12, 2023
270fffd
feat(console): Send preview OTP (#2386)
Cosmin-Parvulescu Jun 12, 2023
21d2ad4
chore(deps): bump @openzeppelin/contracts from 4.8.3 to 4.9.1 (#2385)
dependabot[bot] Jun 12, 2023
ad88012
fix(passport): User able to disconnect the wallet and still sign in u…
poolsar42 Jun 12, 2023
a367741
feat(passport): keep connected account selection between signins (#2363)
poolsar42 Jun 12, 2023
286007d
fix(design-system): type check (#2394)
poolsar42 Jun 12, 2023
7a3b1f0
fix(passport): loading transition not shown when logging in with soci…
poolsar42 Jun 12, 2023
3745d3b
fix(console): do not negate the initial custom domain state (#2398)
szkl Jun 14, 2023
33627a1
fix(passport): Connect with Email-Error message on clicking 'Verify' …
poolsar42 Jun 14, 2023
67abee1
fix(console): merge updated app object properties (#2407)
szkl Jun 14, 2023
a656d46
fix(passport): authz darkscreen orange text (#2412)
poolsar42 Jun 14, 2023
7a95e1e
feat(console): Billing & Invoicing - page frame (#2399)
Cosmin-Parvulescu Jun 15, 2023
6dc5523
fix(passport): check JWT issuer claim (#2378)
szkl Jun 15, 2023
6604eb7
chore(platform): Extend worker interfaces for batch operations (#2419)
betimshahini Jun 16, 2023
f0f7cfb
fix(passport): Refreshing the OTP submission page (with 30 secs inter…
poolsar42 Jun 16, 2023
29c909d
chore(passport): chains (#2426)
maurerbot Jun 16, 2023
cac02e5
chore(platform): Upgrade to wrangler3 (#2423)
betimshahini Jun 16, 2023
8edcb9a
fix(passport): authn screen becomes a dead-end when trying to sing-in…
poolsar42 Jun 16, 2023
fb7cfa2
fix(console): remove aspect ratios in designer (#2427)
poolsar42 Jun 16, 2023
6cbe0d1
fix(passport): displaying app's favicon in custom domain (#2418)
poolsar42 Jun 17, 2023
1e92cf8
fix(passport): set default app name (#2428)
szkl Jun 18, 2023
7af5fd8
fix(passport): remove comment from returned component (#2430)
poolsar42 Jun 18, 2023
f2db579
chore(workspace): auto-update package.json (#2431)
szkl Jun 19, 2023
43feb4b
feat(console): Billing & invoicing - purchasing entitlement frame (#2…
Cosmin-Parvulescu Jun 19, 2023
c3447f8
feat(passport): Revocation of smart contract wallet scope (#2236)
poolsar42 Jun 19, 2023
3cb16c9
chore(deps): bump @openzeppelin/contracts from 4.9.1 to 4.9.2 (#2433)
dependabot[bot] Jun 19, 2023
98a5c65
chore(platform): Leveraging batching interface for erc_4337 claim ret…
betimshahini Jun 21, 2023
e5a9fbd
fix(console): test (#2434)
poolsar42 Jun 21, 2023
d9d234c
chore(address): remove rpcProvider from sc wallets (#2436)
poolsar42 Jun 22, 2023
3ed5128
fix(passport): logging-in is prevented when already logged-in (#2437)
poolsar42 Jun 22, 2023
90f740f
feat(console): Service Plans & Billing - Entitlement purchase integra…
Cosmin-Parvulescu Jun 22, 2023
1c1cff4
fix(passport): set app name with no custom domain (#2440)
poolsar42 Jun 23, 2023
7ef3b8c
chore(access): Parallelizing invocation of authz claim retrieval (#2441)
betimshahini Jun 26, 2023
4dbe6b0
fix(CI): console test limit time up (#2443)
poolsar42 Jun 26, 2023
0d15278
chore(console): Add billing email selection dropdown (#2439)
Cosmin-Parvulescu Jun 26, 2023
66c0cdb
feat(console): Billing & Invoicing - remove entitlements frame (#2445)
poolsar42 Jun 27, 2023
9525653
GITBOOK-82: change request with no subject merged in GitBook
maurerbot Jun 28, 2023
75419f4
GITBOOK-84: change request with no subject merged in GitBook
maurerbot Jun 28, 2023
06b099c
feat(console): Service Plan - Application entitlement assignment (#2451)
Cosmin-Parvulescu Jun 30, 2023
3004a75
feat(console): Billing/payment notifications (#2446)
poolsar42 Jul 4, 2023
64203fa
fix(console): darkmode broken in preview (#2458)
Cosmin-Parvulescu Jul 4, 2023
fc42165
fix(email): subject for notifications (#2460)
poolsar42 Jul 5, 2023
44c3638
feat(platform): Platform Telemetry (#2459)
poolsar42 Jul 7, 2023
7905d22
feat(console): Billing and Invoicing - Invoice and payments integrati…
Cosmin-Parvulescu Jul 10, 2023
fc34f6c
fix(posthog): wrap posthog init in try catch (#2463)
Cosmin-Parvulescu Jul 10, 2023
e3a24a7
fix(billing): reconciliation email subject (#2464)
Cosmin-Parvulescu Jul 10, 2023
5bd9f8d
feat(console): Groups and group user management (#2461)
Cosmin-Parvulescu Jul 10, 2023
1d654cd
feat(passport): rollup id deletion analytics event (#2465)
poolsar42 Jul 10, 2023
04473a6
fix(account): export durable object classes (#2467)
szkl Jul 10, 2023
9266977
fix(account): introduce new durable object class again (#2468)
szkl Jul 10, 2023
8165f54
fix(groups): DO Binding (#2469)
Cosmin-Parvulescu Jul 11, 2023
d2c97bb
fix(various): Email AddressURN and Team Email (#2470)
Cosmin-Parvulescu Jul 11, 2023
b3eb5fc
fix(passport): disable send code button when code sent (#2471)
poolsar42 Jul 11, 2023
55b4890
chore(repo): setup gh dev env (#2473)
maurerbot Jul 11, 2023
8e53834
chore(repo): setup gh next env (#2475)
maurerbot Jul 11, 2023
59564f0
chore(repo): setup gh dev prod (#2476)
maurerbot Jul 11, 2023
1d168ce
chore(deps): bump semver from 5.7.1 to 5.7.2 (#2474)
dependabot[bot] Jul 11, 2023
cdf3f32
fix(passport): Style Fixes (#2479)
Cosmin-Parvulescu Jul 12, 2023
d5481c5
chore(groups): empty state and hide menu item (#2478)
Cosmin-Parvulescu Jul 12, 2023
cbe6ef5
feat(workers): posthog env vars and additional events capture (#2466)
poolsar42 Jul 12, 2023
a618240
Removing the v2 DO migration for IdentityGroup (#2482)
betimshahini Jul 12, 2023
7479ea6
fix(console): Small screen layout broken for billing pages (#2489)
poolsar42 Jul 13, 2023
022cbf8
chore(console): Enable custom domains and designer after paid plans i…
Cosmin-Parvulescu Jul 13, 2023
3f0eaf5
fix(passport): Context menu in Account page not displaying (#2493)
poolsar42 Jul 13, 2023
2a7ced0
chore(platform): Upgrade wrangler and apps to module syntax (#2501)
betimshahini Jul 14, 2023
ca81a5f
chore(console): Service Plan Page Improvement (#2500)
Cosmin-Parvulescu Jul 14, 2023
60a72ce
chore(repo): Tweak Posthog and Stripe Secrets (#2488)
poolsar42 Jul 14, 2023
be15c61
fix(console): Entitlements gauge not shown when none assigned (#2496)
Cosmin-Parvulescu Jul 14, 2023
1a5b38f
chore(edges): Updated config file pointing to new upgraded D1 backend…
betimshahini Jul 17, 2023
07bbb37
chore(edges): Update GHA with new DB name (#2515)
betimshahini Jul 18, 2023
a19708e
feat(console): Removing purchased entitlements needs guard rails (#2495)
Cosmin-Parvulescu Jul 18, 2023
99d6329
fix(console): purchase/remove entitelments modal view (#2509)
poolsar42 Jul 18, 2023
e3aeafb
feat(console): typeform and early access upgrade CTA (#2516)
Cosmin-Parvulescu Jul 18, 2023
b83b2ca
fix(passport): otp generation (#2518)
poolsar42 Jul 18, 2023
3d22ebd
feat(console): Emails for purchase and failed payments (#2508)
poolsar42 Jul 18, 2023
30300ce
fix(console): Billing email assignment (#2512)
Cosmin-Parvulescu Jul 19, 2023
e2a8d54
feat(console): failed payment toast (#2519)
poolsar42 Jul 19, 2023
eec0586
fix(infra): Adds `kid` to Apple OAuth JWT header. (#2521)
betimshahini Jul 19, 2023
3118c73
chore(infra): Analytics infra rename and GHA workflow (#2522)
poolsar42 Jul 19, 2023
36af6b4
chore(analytics): add routes to wrangler (#2524)
poolsar42 Jul 19, 2023
44bc283
chore(deps): bump word-wrap from 1.2.3 to 1.2.4 (#2523)
dependabot[bot] Jul 19, 2023
a05b13c
fix(console): domain upgrade button (#2526)
Cosmin-Parvulescu Jul 20, 2023
b18d69d
fix(console): Screen side image gets downscaled (#2528)
Cosmin-Parvulescu Jul 21, 2023
6fe794b
chore(console): Add Indicators to Sidebar Navigation (#2511)
Cosmin-Parvulescu Jul 21, 2023
eae2f7a
chore(workers): merge access, account, address, edges, starbase (#2442)
szkl Jul 24, 2023
ace2b32
fix(all): worker environments (#2538)
szkl Jul 24, 2023
2ca7e42
fix(all): set wrangler version in GHA workflows (#2539)
szkl Jul 24, 2023
1ab5a7e
fix(all): pass `--env` option in wrangler GHA action (#2540)
szkl Jul 24, 2023
a126622
fix(core): fix next `d1_databases` section name (#2541)
szkl Jul 24, 2023
16ccd49
chore(domains): SSL cert removal when downgrading apps (#2527)
Cosmin-Parvulescu Jul 25, 2023
653bcad
chore(console): cleanup designer settings (#2544)
Cosmin-Parvulescu Jul 25, 2023
2960e0d
Update README.md (#2546)
maurerbot Jul 25, 2023
dca9e25
fix(billing): reconciliation email parallelization (#2530)
Cosmin-Parvulescu Jul 26, 2023
ac81e8e
fix(passport): twitter oauth2 v2 upgrade (#2548)
szkl Jul 26, 2023
7a0c000
fix(passport): fallback twitter account profile (#2550)
szkl Jul 26, 2023
e6958e4
chore(passport): Collapse to mobile view earlier and new GHA caching …
Cosmin-Parvulescu Jul 27, 2023
b66e6d3
chore(billing): update plan feature colors (#2545)
Cosmin-Parvulescu Jul 27, 2023
6d50119
fix(pricing): align pricing table (#2554)
Cosmin-Parvulescu Jul 27, 2023
30dec8d
chore(console): Handle 3D Secure Events (#2529)
poolsar42 Jul 27, 2023
e85dff9
GITBOOK-85: change request with no subject merged in GitBook
maurerbot Jul 28, 2023
1be643b
GITBOOK-86: change request with no subject merged in GitBook
maurerbot Jul 28, 2023
277d4b6
GITBOOK-87: change request with no subject merged in GitBook
maurerbot Jul 28, 2023
0f5c5cd
fix(console): Service plan entitlement assignment during 3DS (#2556)
poolsar42 Jul 28, 2023
f4032ce
GITBOOK-88: change request with no subject merged in GitBook
maurerbot Jul 28, 2023
9708b57
fix(address): Await edge removal properly (#2560)
betimshahini Jul 28, 2023
5d044af
GITBOOK-89: change request with no subject merged in GitBook
maurerbot Jul 29, 2023
b103eeb
chore(console): adds google conversion tag (#2559)
poolsar42 Jul 29, 2023
12451eb
fix(console): duplicate tag
maurerbot Jul 29, 2023
8332a61
fix(edges): Remove now-broken validation check (#2566)
betimshahini Jul 31, 2023
4b3385f
chore(console): CTA for purchased entitlements (#2561)
poolsar42 Aug 1, 2023
4b4782e
GITBOOK-90: change request with no subject merged in GitBook
maurerbot Aug 1, 2023
116eb3d
GITBOOK-91: change request with no subject merged in GitBook
maurerbot Aug 2, 2023
fa17bd0
GITBOOK-92: change request with no subject merged in GitBook
maurerbot Aug 2, 2023
62b17a8
GITBOOK-93: change request with no subject merged in GitBook
maurerbot Aug 2, 2023
62e1846
GITBOOK-94: change request with no subject merged in GitBook
maurerbot Aug 2, 2023
6193d74
GITBOOK-95: change request with no subject merged in GitBook
maurerbot Aug 2, 2023
f097850
GITBOOK-96: change request with no subject merged in GitBook
maurerbot Aug 2, 2023
8d1c4a0
GITBOOK-97: change request with no subject merged in GitBook
maurerbot Aug 2, 2023
5002e0f
fix(console): Can't reach app delete prompt from dashboard (#2569)
Cosmin-Parvulescu Aug 2, 2023
89b9960
fix(console): Remove reference edges before removing app node (#2572)
betimshahini Aug 2, 2023
dc779bb
chore(billing): After 5 invoices show a link to redirect users to str…
poolsar42 Aug 3, 2023
57b5694
chore(console): UI Cleanup (#2570)
poolsar42 Aug 3, 2023
6e155ab
fix(passport): Connect with Wallet with no internet (#2576)
poolsar42 Aug 3, 2023
003cac8
feat(console): Group invites and invite confirmation (#2551)
Cosmin-Parvulescu Aug 4, 2023
5fdab37
fix(apps): email OTP logo+email OTP overflow (#2579)
poolsar42 Aug 4, 2023
40c46de
chore(modal): make the close button inline with the modal heading (#2…
poolsar42 Aug 4, 2023
d08ae93
chore(console): pro indicators (#2582)
poolsar42 Aug 4, 2023
49864fe
feat(platform): User journey dashboard (#2568)
poolsar42 Aug 4, 2023
edda632
fix(Console): Typeform loading blocked (#2588)
Cosmin-Parvulescu Aug 9, 2023
4de0ef1
fix(console): Remove certs when subscription fails and entitlement is…
Cosmin-Parvulescu Aug 9, 2023
763bf25
chore(console): Delete unused Domain field in OAuth page (#2593)
poolsar42 Aug 10, 2023
7b8ef26
fix(core): Fix multi-node query method and rare billing email assignm…
betimshahini Aug 11, 2023
5573296
chore(console): Revise IdentityGroups to map to Identities (Accounts)…
Cosmin-Parvulescu Aug 11, 2023
9e86438
chore(deps): bump @openzeppelin/contracts from 4.9.2 to 4.9.3 (#2600)
dependabot[bot] Aug 11, 2023
be759a0
fix(profile): add missing KV `preview_id` key (#2602)
szkl Aug 14, 2023
e58997a
chore(console|passport): Update OG Tag image and description (#2592)
poolsar42 Aug 14, 2023
e5d0a43
fix(passport): removes nested <html> tag (#2604)
poolsar42 Aug 14, 2023
d0da01e
feat(console): Designer OG data (#2594)
poolsar42 Aug 14, 2023
ace4ca9
feat(console|passport): Delete group, delete member and identity of g…
Cosmin-Parvulescu Aug 15, 2023
186d677
fix(passport): fixes issue when data is undefined (#2607)
poolsar42 Aug 15, 2023
84026e5
chore(all): rename identifier tokens and break everything (#2596)
szkl Aug 16, 2023
286ced3
chore(docs): rename identifier tokens (#2615)
szkl Aug 17, 2023
8c25519
GITBOOK-98: change request with no subject merged in GitBook
maurerbot Aug 17, 2023
a5e5c5b
GITBOOK-99: change request with no subject merged in GitBook
maurerbot Aug 17, 2023
e2dfab0
chore(profile): update `KV` id (#2619)
szkl Aug 17, 2023
3671c90
fix(repo): sc wallet (#2623)
poolsar42 Aug 18, 2023
5bb4fc0
fix(core): Remove legacy non-account urns from getAppData. (#2624)
betimshahini Aug 19, 2023
3f15d98
fix(core): Fixes urn format for authorization objects
betimshahini Aug 21, 2023
71aca00
feat(analytics): track metrics for apps and groups as for users (#2627)
poolsar42 Aug 22, 2023
ff44cf8
chore(apps): fix gtag converson (#2639)
maurerbot Aug 23, 2023
c3f0924
fix(console): conversion id
maurerbot Aug 23, 2023
46809b3
fix(repo): UI issues (#2638)
poolsar42 Aug 24, 2023
57f855a
feat(console): Connected group email accounts & group billing (#2614)
Cosmin-Parvulescu Aug 25, 2023
23adbf6
chore(deps-dev): bump webpack in /packages/design-system
dependabot[bot] Aug 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(passport): keep connected account selection between signins (#2363)
poolsar42 authored Jun 12, 2023
commit a36774122a95c72f5383de03dbdaf13e8365f880
184 changes: 126 additions & 58 deletions apps/passport/app/routes/authorize.tsx
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ import { validatePersonaData } from '@proofzero/security/persona'
import {
authzParamsMatch,
createAuthzParamCookieAndCreate,
createNewSCWallet,
getDataForScopes,
} from '~/utils/authorize.server'
import { useContext, useEffect, useState } from 'react'
@@ -41,12 +42,13 @@ import type { PersonaData } from '@proofzero/types/application'

import Authorization from '@proofzero/design-system/src/templates/authorization/Authorization'
import { getRollupReqFunctionErrorWrapper } from '@proofzero/utils/errors'
import { DropdownSelectListItem } from '@proofzero/design-system/src/atoms/dropdown/DropdownSelectList'
import { getEmailIcon } from '@proofzero/utils/getNormalisedConnectedAccounts'
import { ThemeContext } from '@proofzero/design-system/src/contexts/theme'
import { AuthenticationScreenDefaults } from '@proofzero/design-system/src/templates/authentication/Authentication'
import { Helmet } from 'react-helmet'
import { getRGBColor, getTextColor } from '@proofzero/design-system/src/helpers'
import { AddressURNSpace } from '@proofzero/urns/address'
import type { DropdownSelectListItem } from '@proofzero/design-system/src/atoms/dropdown/DropdownSelectList'

export type UserProfile = {
displayName: string
@@ -117,7 +119,7 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
!(
context.authzQueryParams.clientId === 'passport' &&
context.authzQueryParams.redirectUri ===
`${new URL(request.url).origin}/settings`
`${new URL(request.url).origin}/settings`
) &&
connectResult !== 'CANCEL'
) {
@@ -167,6 +169,7 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
context.env,
context.traceSpan
)
const accessClient = getAccessClient(context.env, context.traceSpan, jwt)

//Special case for console and passport - we just redirect
if (['console', 'passport'].includes(clientId)) {
@@ -231,7 +234,6 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
)
) {
const responseType = ResponseType.Code
const accessClient = getAccessClient(context.env, context.traceSpan)
const preauthorizeRes = await accessClient.preauthorize.mutate({
account: accountUrn,
responseType,
@@ -258,17 +260,21 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
} //else we present the authz screen below
}
const accountClient = getAccountClient(jwt, context.env, context.traceSpan)
const profile = await accountClient.getProfile.query({
account: accountUrn,
})

const dataForScopes = await getDataForScopes(
scope,
accountUrn,
jwt,
context.env,
context.traceSpan
)
const [profile, personaData, dataForScopes] = await Promise.all([
accountClient.getProfile.query({
account: accountUrn,
}),
accessClient.getPersonaData.query({
accountUrn,
clientId,
}),
getDataForScopes(scope, accountUrn, jwt, context.env, context.traceSpan),
])

if (personaData) {
dataForScopes.personaData = personaData
}

if (!profile) {
throw new InternalServerError({
@@ -297,7 +303,7 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
)

export const action: ActionFunction = async ({ request, context }) => {
const { accountUrn } = await getValidatedSessionContext(
const { jwt, accountUrn } = await getValidatedSessionContext(
request,
context.authzQueryParams,
context.env,
@@ -333,6 +339,25 @@ export const action: ActionFunction = async ({ request, context }) => {
throw json({ message: 'Missing required fields' }, 400)
}

const createSCWallet = form.get('createSCWallet') as string

if (createSCWallet?.length) {
const nickname = JSON.parse(createSCWallet).nickname
const accountClient = getAccountClient(jwt, context.env, context.traceSpan)
const profile = await accountClient.getProfile.query({
account: accountUrn,
})

const { addressURN } = await createNewSCWallet({
nickname,
primaryAddressURN: profile?.primaryAddressURN!,
env: context.env,
traceSpan: context.traceSpan,
})

personaData.erc_4337 = [AddressURNSpace.getBaseURN(addressURN)]
}

await validatePersonaData(
accountUrn,
personaData,
@@ -396,16 +421,47 @@ export default function Authorize() {

const [persona] = useState<PersonaData>(personaData!)

const [selectedEmail, setSelectedEmail] = useState<DropdownSelectListItem>()
const [selectedEmail, setSelectedEmail] = useState<
DropdownSelectListItem | undefined
>(() => {
let selected
if (connectedEmails && connectedEmails.length && persona?.email) {
selected = connectedEmails.find((email) => email.value === persona.email)
} else {
// sorted in edges in by date descending order
selected = connectedEmails?.[connectedEmails.length - 1]
}
return selected
})
const [selectedConnectedAccounts, setSelectedConnectedAccounts] = useState<
Array<DropdownSelectListItem | AuthorizationControlSelection>
>([])
Array<DropdownSelectListItem> | Array<AuthorizationControlSelection>
>(() => {
if (persona.connected_accounts === AuthorizationControlSelection.ALL) {
return [AuthorizationControlSelection.ALL]
} else {
return connectedAccounts?.length
? connectedAccounts.filter((acc) =>
persona.connected_accounts?.includes(acc.value)
)
: []
}
})
const [selectedSCWallets, setSelectedSCWallets] = useState<
Array<DropdownSelectListItem | AuthorizationControlSelection>
>([])
Array<DropdownSelectListItem> | Array<AuthorizationControlSelection>
>(() => {
if (persona.erc_4337 === AuthorizationControlSelection.ALL) {
return [AuthorizationControlSelection.ALL]
} else {
return connectedSmartContractWallets?.length
? connectedSmartContractWallets.filter((acc) =>
persona.erc_4337?.includes(acc.value)
)
: []
}
})

// Re-render the component every time persona gets updated
useEffect(() => { }, [persona])
useEffect(() => {}, [persona])

const submit = useSubmit()
const navigate = useNavigate()
@@ -447,17 +503,29 @@ export default function Authorize() {
if (selectedConnectedAccounts[0] === AuthorizationControlSelection.ALL) {
personaData.connected_accounts = AuthorizationControlSelection.ALL
} else {
personaData.connected_accounts = selectedConnectedAccounts
.map((account) => (account as DropdownSelectListItem).value)
personaData.connected_accounts = selectedConnectedAccounts.map(
(account) => (account as DropdownSelectListItem).value
)
}
}

if (requestedScope.includes('erc_4337') && selectedSCWallets.length > 0) {
if (selectedSCWallets[0] === AuthorizationControlSelection.ALL) {
personaData.erc_4337 = AuthorizationControlSelection.ALL
if (requestedScope.includes('erc_4337')) {
if (selectedSCWallets?.length > 0) {
if (selectedSCWallets[0] === AuthorizationControlSelection.ALL) {
personaData.erc_4337 = AuthorizationControlSelection.ALL
} else {
personaData.erc_4337 = selectedSCWallets.map(
(wallet) => (wallet as DropdownSelectListItem).value
)
}
} else {
personaData.erc_4337 = selectedSCWallets
.map((wallet) => (wallet as DropdownSelectListItem).value)
form.append(
'createSCWallet',
JSON.stringify({
check: true,
nickname: appProfile.name,
})
)
}
}

@@ -478,36 +546,41 @@ export default function Authorize() {
<style type="text/css">{`
:root {
${getRGBColor(
dark
? appProfile?.appTheme?.color?.dark ??
AuthenticationScreenDefaults.color.dark
: appProfile?.appTheme?.color?.light ??
AuthenticationScreenDefaults.color.light,
'primary'
)}
dark
? appProfile?.appTheme?.color?.dark ??
AuthenticationScreenDefaults.color.dark
: appProfile?.appTheme?.color?.light ??
AuthenticationScreenDefaults.color.light,
'primary'
)}
${getRGBColor(
getTextColor(
dark
? appProfile?.appTheme?.color?.dark ??
AuthenticationScreenDefaults.color.dark
: appProfile?.appTheme?.color?.light ??
AuthenticationScreenDefaults.color.light
),
'primary-contrast-text'
)}
getTextColor(
dark
? appProfile?.appTheme?.color?.dark ??
AuthenticationScreenDefaults.color.dark
: appProfile?.appTheme?.color?.light ??
AuthenticationScreenDefaults.color.light
),
'primary-contrast-text'
)}
{
`}</style>
</Helmet>

<div className={`${dark ? 'dark' : ''}`}>
<div className={'flex flex-row h-[100dvh] justify-center items-center bg-[#F9FAFB] dark:bg-gray-900'}>
<div
className={
'flex flex-row h-[100dvh] justify-center items-center bg-[#F9FAFB] dark:bg-gray-900'
}
>
<div
className={
'basis-2/5 h-[100dvh] w-full hidden lg:flex justify-center items-center bg-indigo-50 dark:bg-[#1F2937] overflow-hidden'
}
style={{
backgroundImage: `url(${appProfile?.appTheme?.graphicURL ?? sideGraphics
})`,
backgroundImage: `url(${
appProfile?.appTheme?.graphicURL ?? sideGraphics
})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
backgroundRepeat: 'no-repeat',
@@ -530,6 +603,7 @@ export default function Authorize() {
connectedSmartContractWallets={
connectedSmartContractWallets ?? []
}
selectedSCWallets={selectedSCWallets}
addNewSmartWalletCallback={() => {
const qp = new URLSearchParams()
qp.append('scope', requestedScope.join(' '))
@@ -543,9 +617,7 @@ export default function Authorize() {
return navigate(`/authorize?${qp.toString()}`)
}}
selectSmartWalletsCallback={setSelectedSCWallets}
selectAllSmartWalletsCallback={() => {
setSelectedSCWallets([AuthorizationControlSelection.ALL])
}}
selectAllSmartWalletsCallback={setSelectedSCWallets}
connectedEmails={
connectedEmails.map((email) => {
// Substituting subtitle with icon
@@ -571,7 +643,9 @@ export default function Authorize() {
return navigate(`/authorize?${qp.toString()}`)
}}
selectEmailCallback={setSelectedEmail}
selectedEmail={selectedEmail}
connectedAccounts={connectedAccounts ?? []}
selectedConnectedAccounts={selectedConnectedAccounts}
addNewAccountCallback={() => {
const qp = new URLSearchParams()
qp.append('scope', requestedScope.join(' '))
@@ -584,21 +658,15 @@ export default function Authorize() {
return navigate(`/authorize?${qp.toString()}`)
}}
selectAccountsCallback={setSelectedConnectedAccounts}
selectAllAccountsCallback={() => {
setSelectedConnectedAccounts([
AuthorizationControlSelection.ALL,
])
}}
selectAllAccountsCallback={setSelectedConnectedAccounts}
cancelCallback={cancelCallback}
authorizeCallback={authorizeCallback}
disableAuthorize={
// TODO: make generic!
(requestedScope.includes('email') &&
(!connectedEmails?.length || !selectedEmail)) ||
(!connectedEmails?.length || !selectedEmail?.value)) ||
(requestedScope.includes('connected_accounts') &&
!selectedConnectedAccounts?.length) ||
(requestedScope.includes('erc_4337') &&
!selectedSCWallets.length)
!selectedConnectedAccounts?.length)
}
radius={appProfile.appTheme?.radius}
/>
59 changes: 30 additions & 29 deletions apps/passport/app/routes/create/wallet.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import { useContext, useState } from 'react'

import { useLoaderData, useSubmit } from '@remix-run/react'
import { redirect } from '@remix-run/cloudflare'
import { getAccountClient, getAddressClient, getStarbaseClient } from '~/platform.server'
import { getAccountClient, getStarbaseClient } from '~/platform.server'
import {
getAuthzCookieParams,
getValidatedSessionContext,
@@ -19,9 +19,10 @@ import type { ActionFunction, LoaderFunction } from '@remix-run/cloudflare'
import { getRollupReqFunctionErrorWrapper } from '@proofzero/utils/errors'
import { ThemeContext } from '@proofzero/design-system/src/contexts/theme'
import { Helmet } from 'react-helmet'
import { GetAppPublicPropsResult } from '@proofzero/platform/starbase/src/jsonrpc/methods/getAppPublicProps'
import type { GetAppPublicPropsResult } from '@proofzero/platform/starbase/src/jsonrpc/methods/getAppPublicProps'
import { getRGBColor, getTextColor } from '@proofzero/design-system/src/helpers'
import { AuthenticationScreenDefaults } from '@proofzero/design-system/src/templates/authentication/Authentication'
import { createNewSCWallet } from '~/utils/authorize.server'

export const action: ActionFunction = getRollupReqFunctionErrorWrapper(
async ({ request, context, params }) => {
@@ -37,17 +38,14 @@ export const action: ActionFunction = getRollupReqFunctionErrorWrapper(
account: accountUrn,
})

const addressClient = getAddressClient(
profile?.primaryAddressURN!,
context.env,
context.traceSpan
)

const formData = await request.formData()
const nickname = formData.get('nickname') as string

await addressClient.initSmartContractWallet.query({
await createNewSCWallet({
nickname,
primaryAddressURN: profile?.primaryAddressURN!,
env: context.env,
traceSpan: context.traceSpan,
})

const { redirectUri, state, scope, clientId, prompt, login_hint } =
@@ -86,7 +84,7 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
}

return {
appProps
appProps,
}
}
)
@@ -110,36 +108,39 @@ export default () => {
<style type="text/css">{`
:root {
${getRGBColor(
dark
? appProps?.appTheme?.color?.dark ??
AuthenticationScreenDefaults.color.dark
: appProps?.appTheme?.color?.light ??
AuthenticationScreenDefaults.color.light,
'primary'
)}
dark
? appProps?.appTheme?.color?.dark ??
AuthenticationScreenDefaults.color.dark
: appProps?.appTheme?.color?.light ??
AuthenticationScreenDefaults.color.light,
'primary'
)}
${getRGBColor(
getTextColor(
dark
? appProps?.appTheme?.color?.dark ??
AuthenticationScreenDefaults.color.dark
: appProps?.appTheme?.color?.light ??
AuthenticationScreenDefaults.color.light
),
'primary-contrast-text'
)}
getTextColor(
dark
? appProps?.appTheme?.color?.dark ??
AuthenticationScreenDefaults.color.dark
: appProps?.appTheme?.color?.light ??
AuthenticationScreenDefaults.color.light
),
'primary-contrast-text'
)}
{
`}</style>
</Helmet>

<div className={`${dark ? 'dark' : ''}`}>
<div className={`flex flex-row h-screen justify-center items-center bg-[#F9FAFB] dark:bg-gray-900`}>
<div
className={`flex flex-row h-screen justify-center items-center bg-[#F9FAFB] dark:bg-gray-900`}
>
<div
className={
'basis-2/5 h-[100dvh] w-full hidden lg:flex justify-center items-center bg-indigo-50 dark:bg-[#1F2937] overflow-hidden'
}
style={{
backgroundImage: `url(${appProps?.appTheme?.graphicURL ?? sideGraphics
})`,
backgroundImage: `url(${
appProps?.appTheme?.graphicURL ?? sideGraphics
})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
backgroundRepeat: 'no-repeat',
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { LoaderFunction } from '@remix-run/cloudflare'
import type { LoaderFunction } from '@remix-run/cloudflare'
import { useLoaderData, useOutletContext } from '@remix-run/react'

import { loader as scopesLoader } from './scopes'
import { AuthorizedAppsModel } from '~/routes/settings'
import type { AuthorizedAppsModel } from '~/routes/settings'
import { Button, Text } from '@proofzero/design-system'
import { FaChevronRight } from 'react-icons/fa'

@@ -15,7 +15,7 @@ import {
ClaimsWideView,
ConfirmRevocationModal,
} from '~/components/applications/claims'
import { GetAuthorizedAppScopesMethodResult } from '@proofzero/platform/access/src/jsonrpc/methods/getAuthorizedAppScopes'
import type { GetAuthorizedAppScopesMethodResult } from '@proofzero/platform/access/src/jsonrpc/methods/getAuthorizedAppScopes'
import { getRollupReqFunctionErrorWrapper } from '@proofzero/utils/errors'
import { getStarbaseClient } from '~/platform.server'
import { getValidatedSessionContext } from '~/session.server'
@@ -130,7 +130,7 @@ export default () => {
return (
<>
<ConfirmRevocationModal
title={app.title}
title={app.title!}
clientId={app.clientId}
isOpen={confirmationModalOpen}
setIsOpen={setConfirmationModalOpen}
@@ -149,7 +149,11 @@ export default () => {
</nav>

<section className="bg-white gap-5 flex flex-row items-center my-6 lg:py-4 lg:px-5 lg:border lg:shadow lg:rounded-lg">
<img src={app.icon} className="w-12 h-12 lg:w-16 lg:h-16 rounded-lg" />
<img
src={app.icon}
className="w-12 h-12 lg:w-16 lg:h-16 rounded-lg"
alt="app icon"
/>

<div className="flex-1">
<Text
2 changes: 1 addition & 1 deletion apps/passport/app/routes/settings/applications/index.tsx
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ import {
} from '~/session.server'

import type { LoaderFunction } from '@remix-run/cloudflare'
import { AuthorizedAppsModel } from '~/routes/settings'
import type { AuthorizedAppsModel } from '~/routes/settings'
import { WarningCTA } from '@proofzero/design-system/src/molecules/cta/warning'
import { getRollupReqFunctionErrorWrapper } from '@proofzero/utils/errors'

35 changes: 28 additions & 7 deletions apps/passport/app/utils/authorize.server.ts
Original file line number Diff line number Diff line change
@@ -17,7 +17,8 @@ import type { AccountURN } from '@proofzero/urns/account'
import type { PersonaData } from '@proofzero/types/application'
import { redirect } from '@remix-run/cloudflare'
import { CryptoAddressType, NodeType } from '@proofzero/types/address'
import { DropdownSelectListItem } from '@proofzero/design-system/src/atoms/dropdown/DropdownSelectList'
import type { DropdownSelectListItem } from '@proofzero/design-system/src/atoms/dropdown/DropdownSelectList'
import type { AddressURN } from '@proofzero/urns/address'

export type DataForScopes = {
connectedEmails: DropdownSelectListItem[]
@@ -49,7 +50,6 @@ export const reorderScope = (scopes: string[]): string[] => {
}
// -----------------------------------------------------------------------------


export const getDataForScopes = async (
requestedScope: string[],
accountURN: AccountURN,
@@ -75,18 +75,21 @@ export const getDataForScopes = async (
connectedEmails = getEmailDropdownItems(connectedAccounts)
}
if (requestedScope.includes(Symbol.keyFor(SCOPE_CONNECTED_ACCOUNTS)!)) {
const addresses = (await Promise.all(
const addresses = await Promise.all(
connectedAccounts
.filter((ca) => {
return (ca.rc.node_type === NodeType.OAuth ||
ca.rc.node_type === NodeType.Crypto) &&
return (
(ca.rc.node_type === NodeType.OAuth ||
ca.rc.node_type === NodeType.Email ||
ca.rc.node_type === NodeType.Crypto) &&
ca.rc.addr_type !== CryptoAddressType.Wallet
)
})
.map((ca) => {
const addressClient = getAddressClient(ca.baseUrn, env, traceSpan)
return addressClient.getAddressProfile.query()
})
))
)
connectedAddresses = getAddressDropdownItems(addresses)
}
if (requestedScope.includes(Symbol.keyFor(SCOPE_SMART_CONTRACT_WALLETS)!)) {
@@ -142,7 +145,7 @@ export function authzParamsMatch(
scopesMatch &&
authzCookieParams.clientId === authzQueryParams.clientId &&
`${authzReqRedirectURL?.origin}${authzReqRedirectURL?.pathname}` ===
`${authzReqCookieRedirectURL?.origin}${authzReqCookieRedirectURL?.pathname}` &&
`${authzReqCookieRedirectURL?.origin}${authzReqCookieRedirectURL?.pathname}` &&
authzCookieParams.state === authzQueryParams.state
)
}
@@ -167,3 +170,21 @@ export async function createAuthzParamCookieAndCreate(
),
})
}

export async function createNewSCWallet({
nickname,
primaryAddressURN,
env,
traceSpan,
}: {
nickname: string
primaryAddressURN: AddressURN
env: Env
traceSpan?: any
}) {
const addressClient = getAddressClient(primaryAddressURN, env, traceSpan)
const { addressURN } = await addressClient.initSmartContractWallet.query({
nickname,
})
return { addressURN }
}
680 changes: 384 additions & 296 deletions packages/design-system/src/atoms/dropdown/DropdownSelectList.tsx

Large diffs are not rendered by default.

292 changes: 215 additions & 77 deletions packages/design-system/src/templates/authorization/Authorization.tsx

Large diffs are not rendered by default.

58 changes: 9 additions & 49 deletions packages/design-system/src/templates/authorization/ScopeIcon.tsx
Original file line number Diff line number Diff line change
@@ -11,27 +11,9 @@ const connectedAccountsSVG = (
<path
d="M3 21L5.5 18.5M18.5 5.5L21 3M10 11L8 13M13 14L11 16M7 12L12 17L10.5 18.5C10.1737 18.8371 9.78351 19.1059 9.35225 19.2907C8.921 19.4755 8.45728 19.5727 7.98811 19.5765C7.51894 19.5803 7.0537 19.4907 6.61951 19.3129C6.18531 19.1351 5.79084 18.8727 5.45908 18.5409C5.12731 18.2092 4.86489 17.8147 4.6871 17.3805C4.50931 16.9463 4.41971 16.4811 4.42352 16.0119C4.42733 15.5427 4.52447 15.079 4.70929 14.6477C4.8941 14.2165 5.16289 13.8263 5.5 13.5L7 12ZM17 12L12 7L13.5 5.5C13.8263 5.16289 14.2165 4.8941 14.6477 4.70929C15.079 4.52447 15.5427 4.42733 16.0119 4.42352C16.4811 4.41971 16.9463 4.50931 17.3805 4.6871C17.8147 4.86489 18.2092 5.12731 18.5409 5.45908C18.8727 5.79084 19.1351 6.18531 19.3129 6.61951C19.4907 7.0537 19.5803 7.51894 19.5765 7.98811C19.5727 8.45728 19.4755 8.921 19.2907 9.35225C19.1059 9.78351 18.8371 10.1737 18.5 10.5L17 12Z"
stroke="CurrentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
)

const profileSVG = (
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M6 21V19C6 17.9391 6.42143 16.9217 7.17157 16.1716C7.92172 15.4214 8.93913 15 10 15H14C15.0609 15 16.0783 15.4214 16.8284 16.1716C17.5786 16.9217 18 17.9391 18 19V21M8 7C8 8.06087 8.42143 9.07828 9.17157 9.82843C9.92172 10.5786 10.9391 11 12 11C13.0609 11 14.0783 10.5786 14.8284 9.82843C15.5786 9.07828 16 8.06087 16 7C16 5.93913 15.5786 4.92172 14.8284 4.17157C14.0783 3.42143 13.0609 3 12 3C10.9391 3 9.92172 3.42143 9.17157 4.17157C8.42143 4.92172 8 5.93913 8 7Z"
stroke="CurrentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)
@@ -47,9 +29,9 @@ const emailSVG = (
<path
d="M3 7C3 6.46957 3.21071 5.96086 3.58579 5.58579C3.96086 5.21071 4.46957 5 5 5H19C19.5304 5 20.0391 5.21071 20.4142 5.58579C20.7893 5.96086 21 6.46957 21 7M3 7V17C3 17.5304 3.21071 18.0391 3.58579 18.4142C3.96086 18.7893 4.46957 19 5 19H19C19.5304 19 20.0391 18.7893 20.4142 18.4142C20.7893 18.0391 21 17.5304 21 17V7M3 7L12 13L21 7"
stroke="CurrentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)
@@ -63,8 +45,8 @@ const smartContractsSVG = (
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
fillRule="evenodd"
clipRule="evenodd"
d="M3.87868 3.87868C4.44129 3.31607 5.20435 3 6 3H16C16.5304 3 17.0391 3.21071 17.4142 3.58579C17.7893 3.96086 18 4.46957 18 5V7C18.5304 7 19.0391 7.21071 19.4142 7.58579C19.7893 7.96086 20 8.46957 20 9V10.5C20 11.0523 19.5523 11.5 19 11.5C18.4477 11.5 18 11.0523 18 10.5V9H6C5.65606 9 5.3182 8.94094 5 8.82843V18C5 18.2652 5.10536 18.5196 5.29289 18.7071C5.48043 18.8946 5.73478 19 6 19H13.5C14.0523 19 14.5 19.4477 14.5 20C14.5 20.5523 14.0523 21 13.5 21H6C5.20435 21 4.44129 20.6839 3.87868 20.1213C3.31607 19.5587 3 18.7956 3 18V6C3 5.20435 3.31607 4.44129 3.87868 3.87868ZM5 6C5 6.26522 5.10536 6.51957 5.29289 6.70711C5.48043 6.89464 5.73478 7 6 7H16L16 5L6 5C5.73478 5 5.48043 5.10536 5.29289 5.29289C5.10536 5.48043 5 5.73478 5 6Z"
fill="CurrentColor"
/>
@@ -75,42 +57,20 @@ const smartContractsSVG = (
</svg>
)

const systemIdentifiersSVG = (
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M21 12C21 10.2192 20.4717 8.4785 19.482 6.99809C18.4924 5.51768 17.0857 4.36414 15.4402 3.68346C13.7947 3.00277 11.9842 2.82554 10.2379 3.17418C8.49164 3.52283 6.88802 4.38169 5.63003 5.64206C4.37204 6.90244 3.51621 8.50767 3.17087 10.2546C2.82552 12.0016 3.00618 13.8117 3.68998 15.4559C4.37377 17.1002 5.52997 18.5046 7.01225 19.4915C8.49453 20.4784 10.2363 21.0034 12.017 21M18.001 20C17.4706 20 16.9619 19.7893 16.5868 19.4142C16.2117 19.0391 16.001 18.5304 16.001 18C16.001 17.4696 16.2117 16.9608 16.5868 16.5858C16.9619 16.2107 17.4706 16 18.001 16M18.001 20C18.5314 20 19.0401 19.7893 19.4152 19.4142C19.7903 19.0391 20.001 18.5304 20.001 18C20.001 17.4696 19.7903 16.9608 19.4152 16.5858C19.0401 16.2107 18.5314 16 18.001 16M18.001 20V21.5M18.001 16V14.5M21.032 16.25L19.733 17M16.27 19L14.97 19.75M14.97 16.25L16.27 17M19.733 19L21.033 19.75M9 9.99999H9.01M15 9.99999H15.01M9.5 15C10.158 15.64 11.06 16 12 16"
stroke="CurrentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
)

// eslint-disable-next-line react/display-name
export default ({ scope }: { scope: string }) => {
let svg
switch (scope) {
case 'connected_accounts':
svg = connectedAccountsSVG
break
case 'profile':
svg = profileSVG
break
case 'email':
svg = emailSVG
break
case 'erc_4337':
svg = smartContractsSVG
break
case 'system_identifiers':
svg = systemIdentifiersSVG
break
}
return (
<div className="w-[38px] h-[38px] rounded-lg bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-200 flex justify-center items-center">
1 change: 1 addition & 0 deletions packages/types/application.ts
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ export const ClaimName = z.union([
z.literal('openid'),
z.literal('connected_accounts'),
z.literal('erc_4337'),
z.literal('profile'),
])
export type ClaimName = z.infer<typeof ClaimName>

84 changes: 44 additions & 40 deletions packages/utils/getNormalisedConnectedAccounts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react"
import React from 'react'

import {
NodeType,
@@ -13,7 +13,6 @@ import googleIcon from '@proofzero/design-system/src/atoms/providers/Google'
import microsoftIcon from '@proofzero/design-system/src/atoms/providers/Microsoft'
import appleIcon from '@proofzero/design-system/src/atoms/providers/Apple'


import type { Addresses } from '@proofzero/platform.account/src/types'
import type { AddressURN } from '@proofzero/urns/address'
import type { DropdownSelectListItem } from '@proofzero/design-system/src/atoms/dropdown/DropdownSelectList'
@@ -37,25 +36,23 @@ export type SCWalletSelectListItem = {
cryptoAddress?: string
}

export const getEmailIcon = (
type: string
): JSX.Element => {
return type === OAuthAddressType.Microsoft
? <img src={microsoftIcon} className="w-4 h-4 mr-3" />
: type === OAuthAddressType.Apple
? <img src={appleIcon} className="w-4 h-4 mr-3" />
: type === OAuthAddressType.Google
? <img src={googleIcon} className="w-4 h-4 mr-3" />
: <HiOutlineEnvelope className="w-4 h-4 mr-3" />

export const getEmailIcon = (type: string): JSX.Element => {
return type === OAuthAddressType.Microsoft ? (
<img src={microsoftIcon} className="w-4 h-4 mr-3" />
) : type === OAuthAddressType.Apple ? (
<img src={appleIcon} className="w-4 h-4 mr-3" />
) : type === OAuthAddressType.Google ? (
<img src={googleIcon} className="w-4 h-4 mr-3" />
) : (
<HiOutlineEnvelope className="w-4 h-4 mr-3" />
)
}

export const adjustAddressTypeToDisplay = (addressType:
OAuthAddressType |
EmailAddressType |
CryptoAddressType) => {
export const adjustAddressTypeToDisplay = (
addressType: OAuthAddressType | EmailAddressType | CryptoAddressType
) => {
if (addressType === CryptoAddressType.Wallet) {
return "SC Wallet"
return 'SC Wallet'
}
return addressType.charAt(0).toUpperCase() + addressType.slice(1)
}
@@ -64,8 +61,9 @@ export const getEmailDropdownItems = (
connectedAddresses?: Addresses | null
): Array<DropdownSelectListItem> => {
if (!connectedAddresses) return []
return connectedAddresses
.filter((address) => {

const filteredEmailsFromConnectedAddresses = connectedAddresses.filter(
(address) => {
return (
(address.rc.node_type === NodeType.OAuth &&
(address.rc.addr_type === OAuthAddressType.Google ||
@@ -74,31 +72,37 @@ export const getEmailDropdownItems = (
(address.rc.node_type === NodeType.Email &&
address.rc.addr_type === EmailAddressType.Email)
)
})
.map((address) => {
return {
// There's a problem when passing icon down to client (since icon is a JSX.Element)
// My guess is that it should be rendered on the client side only.
// that's why I'm passing type (as subtitle) instead of icon and then substitute it
// with icon on the client side
subtitle: address.rc.addr_type as OAuthAddressType | EmailAddressType | CryptoAddressType,
title: address.qc.alias,
value: address.baseUrn as AddressURN,
}
})
}
)

return filteredEmailsFromConnectedAddresses.map((address, i) => {
return {
// There's a problem when passing icon down to client (since icon is a JSX.Element)
// My guess is that it should be rendered on the client side only.
// that's why I'm passing type (as subtitle) instead of icon and then substitute it
// with icon on the client side
subtitle: address.rc.addr_type as
| OAuthAddressType
| EmailAddressType
| CryptoAddressType,
title: address.qc.alias,
value: address.baseUrn as AddressURN,
}
})
}

//addressDropdownItems
export const getAddressDropdownItems = (
addressProfiles?: Array<GetAddressProfileResult> | null
): Array<DropdownSelectListItem> => {
if (!addressProfiles) return []
return addressProfiles
.map((address) => {
return {
title: address.title,
value: address.id as AddressURN,
subtitle: `${adjustAddressTypeToDisplay(address.type)} - ${address.address}`,
}
})
return addressProfiles.map((address) => {
return {
title: address.title,
value: address.id as AddressURN,
subtitle: `${adjustAddressTypeToDisplay(address.type)} - ${
address.address
}`,
}
})
}