Skip to content

Commit

Permalink
chore(all): rename identifier tokens and break everything (#2596)
Browse files Browse the repository at this point in the history
  • Loading branch information
szkl authored Aug 16, 2023
1 parent 186d677 commit 84026e5
Show file tree
Hide file tree
Showing 326 changed files with 5,050 additions and 4,845 deletions.
2 changes: 1 addition & 1 deletion apps/console/app/components/AppBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

// TODO migrate to FolderPlusIcon and remove bespoke version
import { type ServicePlanType } from '@proofzero/types/account'
import { type ServicePlanType } from '@proofzero/types/identity'
import { ApplicationList } from '../Applications/ApplicationList'

// AppBox
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Menu, Transition } from '@headlessui/react'
import { Pill } from '@proofzero/design-system/src/atoms/pills/Pill'
import { Text } from '@proofzero/design-system/src/atoms/text/Text'
import { ServicePlanType } from '@proofzero/types/account'
import { ServicePlanType } from '@proofzero/types/identity'
import { Fragment } from 'react'
import { HiDotsVertical, HiOutlineCog } from 'react-icons/hi'
import { HiOutlineTrash } from 'react-icons/hi2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ export default {
const Template = () => (
<LoginsPanel
authorizedProfiles={[
{ name: 'Eve', timestamp: 1672549200000, accountURN: '' },
{ name: 'Eve',
timestamp: 1672549200000,
identityURN: 'urn:rollupid:identity/Eve',
},
{
name: 'Bob',
timestamp: 1672549200000 + 1000,
accountURN: '',
identityURN: 'urn:rollupid:identity/Bob',
},
{
name: 'Sam',
timestamp: 1672549200000 + 2000,
accountURN: '',
identityURN: 'urn:rollupid:identity/Sam',
},
]}
/>
Expand Down
4 changes: 2 additions & 2 deletions apps/console/app/components/ContactUs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Button } from '@proofzero/design-system'
import { AccountURN } from '@proofzero/urns/account'
import { IdentityURN } from '@proofzero/urns/identity'
import { Text } from '@proofzero/design-system/src/atoms/text/Text'
import { useRef } from 'react'
import { PopupButton } from '@typeform/embed-react'

export default ({ urn, type }: { urn: AccountURN; type: 'btn' | 'text' }) => {
export default ({ urn, type }: { urn: IdentityURN; type: 'btn' | 'text' }) => {
const ref = useRef<any>(null)
const openPopup = () => ref.current?.open()

Expand Down
10 changes: 5 additions & 5 deletions apps/console/app/components/EarlyAccess/EarlyAccessPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Text } from '@proofzero/design-system/src/atoms/text/Text'
import { FeaturePill } from '@proofzero/design-system/src/atoms/pills/FeaturePill'
import { DocumentationBadge } from '../DocumentationBadge'
import { AccountURN } from '@proofzero/urns/account'
import type { IdentityURN } from '@proofzero/urns/identity'
import ContactUs from '../ContactUs'
import { ServicePlanType } from '@proofzero/types/account'
import { ServicePlanType } from '@proofzero/types/identity'
import { isPlanGuarded } from '~/utils/planGate'
import plans from '~/routes/__layout/billing/plans'
import _ from 'lodash'
Expand All @@ -21,7 +21,7 @@ type EarlyAccessPanelProps = {
imgClassName?: string
currentPlan: ServicePlanType
featurePlan?: ServicePlanType
accountURN: AccountURN
identityURN: IdentityURN
earlyAccess: boolean
}

Expand All @@ -35,7 +35,7 @@ const EarlyAccessPanel = ({
imgClassName,
currentPlan,
featurePlan,
accountURN,
identityURN,
earlyAccess,
}: EarlyAccessPanelProps) => {
return (
Expand Down Expand Up @@ -81,7 +81,7 @@ const EarlyAccessPanel = ({
)}

<ContactUs
urn={accountURN}
urn={identityURN}
type={
featurePlan
? isPlanGuarded(currentPlan, featurePlan)
Expand Down
2 changes: 1 addition & 1 deletion apps/console/app/components/SiteMenu/appSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { TbWorld } from 'react-icons/tb'
import { Button, Text } from '@proofzero/design-system'

import { useNavigate } from '@remix-run/react'
import { ServicePlanType } from '@proofzero/types/account'
import { ServicePlanType } from '@proofzero/types/identity'
import { Pill } from '@proofzero/design-system/src/atoms/pills/Pill'

// Utility
Expand Down
2 changes: 1 addition & 1 deletion apps/console/app/components/SiteMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import type { IconType } from 'react-icons'
import { Avatar } from '@proofzero/design-system'

import { usePostHog } from 'posthog-js/react'
import { ServicePlanType } from '@proofzero/types/account'
import { ServicePlanType } from '@proofzero/types/identity'
import _ from 'lodash'
import { isPlanGuarded } from '~/utils/planGate'

Expand Down
26 changes: 13 additions & 13 deletions apps/console/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ import createCoreClient from '@proofzero/platform-clients/core'
import { getAuthzHeaderConditionallyFromToken } from '@proofzero/utils'
import { generateTraceContextHeaders } from '@proofzero/platform-middleware/trace'

import type { AccountURN } from '@proofzero/urns/account'
import type { IdentityURN } from '@proofzero/urns/identity'

import { NonceContext } from '@proofzero/design-system/src/atoms/contexts/nonce-context'

import useTreeshakeHack from '@proofzero/design-system/src/hooks/useTreeshakeHack'
import { getRollupReqFunctionErrorWrapper } from '@proofzero/utils/errors'
import { type ServicePlanType } from '@proofzero/types/account'
import { type ServicePlanType } from '@proofzero/types/identity'
import { BadRequestError } from '@proofzero/errors'
import posthog from 'posthog-js'
import { PostHogProvider } from 'posthog-js/react'
Expand Down Expand Up @@ -90,7 +90,7 @@ export type LoaderData = {
REMIX_DEV_SERVER_WS_PORT?: number
WALLET_CONNECT_PROJECT_ID: string
}
accountURN: AccountURN
identityURN: IdentityURN
}

export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
Expand All @@ -109,7 +109,7 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
}
const traceHeader = generateTraceContextHeaders(context.traceSpan)
const parsedJwt = parseJwt(jwt)
const accountURN = parsedJwt.sub as AccountURN
const identityURN = parsedJwt.sub as IdentityURN

try {
const coreClient = createCoreClient(context.env.Core, {
Expand All @@ -132,8 +132,8 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
let avatarUrl = ''
let displayName = ''
try {
const profile = await coreClient.account.getProfile.query({
account: accountURN,
const profile = await coreClient.identity.getProfile.query({
identity: identityURN,
})
avatarUrl = profile?.pfp?.image || ''
displayName = profile?.displayName || ''
Expand All @@ -149,8 +149,8 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
WALLET_CONNECT_PROJECT_ID,
} = context.env

const spd = await coreClient.account.getStripePaymentData.query({
accountURN,
const spd = await coreClient.identity.getStripePaymentData.query({
identityURN,
})

// might be quite heavy object
Expand Down Expand Up @@ -188,7 +188,7 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
WALLET_CONNECT_PROJECT_ID,
},
displayName,
accountURN,
identityURN,
})
} catch (error) {
console.error({ error })
Expand Down Expand Up @@ -235,7 +235,7 @@ export default function App() {
avatarUrl,
PASSPORT_URL,
displayName,
accountURN,
identityURN,
hasUnpaidInvoices,
unpaidInvoiceURL,
} = loaderData ?? {}
Expand All @@ -256,7 +256,7 @@ export default function App() {
autocapture: false,
})

posthog?.identify(accountURN)
posthog?.identify(identityURN)
} catch (ex) {
console.error(ex)
}
Expand Down Expand Up @@ -305,7 +305,7 @@ export default function App() {
avatarUrl,
PASSPORT_URL,
displayName,
accountURN,
identityURN,
hasUnpaidInvoices,
unpaidInvoiceURL,
}}
Expand All @@ -319,7 +319,7 @@ export default function App() {
avatarUrl,
PASSPORT_URL,
displayName,
accountURN,
identityURN,
hasUnpaidInvoices,
unpaidInvoiceURL,
}}
Expand Down
22 changes: 11 additions & 11 deletions apps/console/app/routes/__layout/billing/details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import {
parseJwt,
} from '@proofzero/utils'
import { createCustomer, updateCustomer } from '~/services/billing/stripe'
import { IdentityURN } from '@proofzero/urns/identity'
import { AccountURN } from '@proofzero/urns/account'
import { AddressURN } from '@proofzero/urns/address'
import { ToastType } from '@proofzero/design-system/src/atoms/toast'

export const action: ActionFunction = getRollupReqFunctionErrorWrapper(
async ({ request, context }) => {
const jwt = await requireJWT(request, context.env)
const parsedJwt = parseJwt(jwt!)
const accountURN = parsedJwt.sub as AccountURN
const identityURN = parsedJwt.sub as IdentityURN

const traceHeader = generateTraceContextHeaders(context.traceSpan)

Expand All @@ -30,23 +30,23 @@ export const action: ActionFunction = getRollupReqFunctionErrorWrapper(
})

const fd = await request.formData()
const { email, addressURN, name } = JSON.parse(
const { email, accountURN, name } = JSON.parse(
fd.get('payload') as string
) as {
email: string
addressURN: AddressURN
accountURN: AccountURN
name: string
}

let paymentData = await coreClient.account.getStripePaymentData.query({
accountURN,
let paymentData = await coreClient.identity.getStripePaymentData.query({
identityURN,
})
if (!paymentData) {
const customer = await createCustomer(
{
email,
name,
accountURN,
identityURN,
},
context.env
)
Expand All @@ -55,14 +55,14 @@ export const action: ActionFunction = getRollupReqFunctionErrorWrapper(
customerID: customer.id,
email,
name,
addressURN,
accountURN,
}
} else {
paymentData = {
...paymentData,
email,
name,
addressURN,
accountURN,
}

await updateCustomer(
Expand All @@ -75,10 +75,10 @@ export const action: ActionFunction = getRollupReqFunctionErrorWrapper(
)
}

await coreClient.account.setStripePaymentData.mutate({
await coreClient.identity.setStripePaymentData.mutate({
...paymentData,
identityURN,
accountURN,
addressURN,
})

const flashSession = await getFlashSession(request, context.env)
Expand Down
Loading

0 comments on commit 84026e5

Please sign in to comment.