Skip to content

Commit

Permalink
feat(console): Service Plan - Application entitlement assignment (#2451)
Browse files Browse the repository at this point in the history
* feat(console): Service Plan - Application entitlement assignment

* Added outlet context allotance counting

* Added sync payment infra

* Added different entitlement stages per app

* Made a smarter plan button text function

* Added purchase confirmation modal

* Fixed error condition

* Added compare plans icon & href

* Added entitlement button icons

* Added message toasts

* Add assigned app modal

* Removed revalidator

* Updated JWT check

* Added referer check

* Extracted purchase and update methods

* Fixed button sizing

* Removed subtitle for current app

* Updated available entitlement copy
  • Loading branch information
Cosmin-Parvulescu committed Jun 30, 2023
1 parent 75419f4 commit 06b099c
Show file tree
Hide file tree
Showing 20 changed files with 1,083 additions and 222 deletions.
28 changes: 19 additions & 9 deletions apps/console/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ import { generateTraceContextHeaders } from '@proofzero/platform-middleware/trac
import type { AccountURN } from '@proofzero/urns/account'

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

import useTreeshakeHack from '@proofzero/design-system/src/hooks/useTreeshakeHack'
import { getRollupReqFunctionErrorWrapper } from '@proofzero/utils/errors'
import { ServicePlanType } from '@proofzero/types/account'
import { BadRequestError } from '@proofzero/errors'

export const links: LinksFunction = () => {
return [
Expand All @@ -68,27 +69,35 @@ export const meta: MetaFunction = () => ({
viewport: 'width=device-width,initial-scale=1',
})

export type AppLoaderData = {
clientId: string
name?: string
icon?: string
published?: boolean
createdTimestamp?: number
appPlan: ServicePlanType
}

export type LoaderData = {
apps: {
clientId: string
name?: string
icon?: string
published?: boolean
createdTimestamp?: number
}[]
apps: AppLoaderData[]
avatarUrl: string
PASSPORT_URL: string
displayName: string
ENV: {
INTERNAL_GOOGLE_ANALYTICS_TAG: string
REMIX_DEV_SERVER_WS_PORT?: number
WALLET_CONNECT_PROJECT_ID: string,
WALLET_CONNECT_PROJECT_ID: string
}
}

export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
async ({ request, context }) => {
const jwt = await requireJWT(request)
if (!jwt) {
throw new BadRequestError({
message: 'No JWT found in request.',
})
}
const traceHeader = generateTraceContextHeaders(context.traceSpan)
const parsedJwt = parseJwt(jwt)
const accountURN = parsedJwt.sub as AccountURN
Expand All @@ -110,6 +119,7 @@ export const loader: LoaderFunction = getRollupReqFunctionErrorWrapper(
icon: a.app?.icon,
published: a.published,
createdTimestamp: a.createdTimestamp,
appPlan: a.appPlan,
}
})

Expand Down
Loading

0 comments on commit 06b099c

Please sign in to comment.