create-ailk 0.37.1 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -0
- package/component-catalog.json +44 -6
- package/component-catalog.md +6 -5
- package/dist/add-module.js +16 -1
- package/dist/add-route.d.ts +2 -2
- package/dist/add-route.js +18 -11
- package/dist/cli.js +52 -0
- package/dist/declined-routes.d.ts +13 -0
- package/dist/declined-routes.js +74 -0
- package/dist/derive-architecture.d.ts +0 -6
- package/dist/derive-architecture.js +9 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/language-import.d.ts +93 -0
- package/dist/language-import.js +270 -43
- package/dist/lib/import-mdx.js +1 -1
- package/dist/lib/scaffold-render-sweep.d.ts +6 -3
- package/dist/lib/scaffold-render-sweep.js +8 -4
- package/dist/migrate-content.d.ts +6 -2
- package/dist/migrate-content.js +62 -5
- package/dist/module-architecture.js +139 -103
- package/dist/paid-sections.d.ts +13 -0
- package/dist/paid-sections.js +35 -5
- package/dist/programmatic.js +6 -16
- package/dist/remove-module.js +67 -0
- package/dist/routes.d.ts +103 -0
- package/dist/routes.js +708 -0
- package/dist/site-manifest.js +1 -1
- package/dist/site-roster.d.ts +2 -1
- package/dist/site-roster.js +30 -8
- package/dist/spoke-checkout.d.ts +28 -27
- package/dist/spoke-checkout.js +71 -102
- package/dist/surfaces.d.ts +18 -0
- package/dist/surfaces.js +47 -282
- package/dist/sync-routes.d.ts +14 -1
- package/dist/sync-routes.js +86 -5
- package/dist/topology.d.ts +15 -1
- package/dist/topology.js +20 -4
- package/dist/update.d.ts +17 -2
- package/dist/update.js +480 -77
- package/package.json +3 -3
- package/templates/README.md +1 -1
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/CLAUDE.md +62 -20
- package/templates/apps/web/account.config.tsx +101 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
- package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
- package/templates/apps/web/app/[locale]/layout.tsx +45 -28
- package/templates/apps/web/app/apple-icon.tsx +72 -0
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
- package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
- package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
- package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
- package/templates/apps/web/app/og/route.tsx +155 -72
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
- package/templates/apps/web/i18n/request.ts +44 -1
- package/templates/apps/web/jest.config.cjs +13 -1
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
- package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
- package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
- package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
- package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
- package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
- package/templates/apps/web/lib/listings.tsx +2 -2
- package/templates/apps/web/lib/nav-label-keys.ts +16 -2
- package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
- package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
- package/templates/apps/web/lib/profile-back-link.ts +105 -32
- package/templates/apps/web/lib/served-pages.ts +95 -0
- package/templates/apps/web/lib/site-brand.tsx +3 -5
- package/templates/apps/web/messages/en.json +8 -684
- package/templates/apps/web/middleware.ts +3 -1
- package/templates/apps/web/next.config.mjs +27 -0
- package/templates/apps/web/package.json +1 -0
- package/templates/customizations.yaml +9 -0
- package/templates/package.json +3 -1
- package/templates/tools/lint-architecture.ts +164 -11
- package/versions.json +48 -47
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
- package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
- package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
- package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
- package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
- package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
- package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
- package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
- package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
- package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
- package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
- package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
- package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
- package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
- package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
- package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
- package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
- package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
- package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
- package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
- package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
- package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
- package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
- package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
- package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
- package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
- package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
- package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
- package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
- package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
- package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
- package/templates/apps/web/lib/account-config.ts +0 -678
- package/templates/apps/web/lib/checkout-config.ts +0 -16
- package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
- package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
|
@@ -1,182 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* supersedes #8234's D3, which rendered the flat Inbox-style list.
|
|
5
|
-
*
|
|
6
|
-
* RSC, inside the account layout's SignedInShell (the rail's Artifacts row,
|
|
7
|
-
* #8231 D1, is selected here). Renders `AccountListFrame` — the Admin Docs
|
|
8
|
-
* page's structure: a second column with an "All Artifacts" count and a
|
|
9
|
-
* Status facet group — the workspace's declared piece stages, every one in
|
|
10
|
-
* declared order and read by its LABEL (#11161; default Requested · In
|
|
11
|
-
* progress · In review · Delivered), each counted over every artifact with
|
|
12
|
-
* zeros kept — and a table of Title · Type · Version · Status in the read's
|
|
13
|
-
* order — newest delivery first. Type is the latest version's file type (the
|
|
14
|
-
* Admin's own labels) or Link; Version its number; Status the piece's stage
|
|
15
|
-
* label as a tag,
|
|
16
|
-
* with the member's review of the latest version (Approved / Changes
|
|
17
|
-
* requested) as a second tag when there is one — stage and review are never
|
|
18
|
-
* combined into one state. The Status column is wide enough for its longest
|
|
19
|
-
* stage label (#8361). Below `md` the column becomes a filter select and the
|
|
20
|
-
* table becomes the phone row list.
|
|
21
|
-
*
|
|
22
|
-
* A 404 read (no tenancy module, or a spoke route the hub does not admit)
|
|
23
|
-
* shows the frame with every count at 0 and the plain empty line; any other
|
|
24
|
-
* failed read renders today's error row with Retry and no frame (spec 7423
|
|
25
|
-
* D12). Nothing here tests the topology: the same file serves a single site
|
|
26
|
-
* and a hub-mode spoke.
|
|
27
|
-
*
|
|
28
|
-
* A proposal (#8516, spec docs/specs/8516-proposals-as-an-artifact-kind-spec.md
|
|
29
|
-
* D19) reads "Proposal · Version <n>" in its caption and Latest cell; a
|
|
30
|
-
* deliverable reads as before.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
import {
|
|
34
|
-
AccountListFrame,
|
|
35
|
-
type AccountListFrameRow,
|
|
36
|
-
} from "@working-theory/templates/account";
|
|
37
|
-
import {
|
|
38
|
-
Heading,
|
|
39
|
-
Text,
|
|
40
|
-
} from "@working-theory/ui/primitives";
|
|
41
|
-
import type { MemberArtifact } from "@working-theory/validation";
|
|
42
|
-
import type { Metadata } from "next";
|
|
43
|
-
import { getTranslations } from "next-intl/server";
|
|
44
|
-
import type { ReactElement } from "react";
|
|
45
|
-
|
|
46
|
-
import { accountSession, logReadFailure } from "../account-data";
|
|
47
|
-
import { ErrorRow } from "../error-row";
|
|
48
|
-
|
|
49
|
-
import {
|
|
50
|
-
artifactHref,
|
|
51
|
-
artifactStageLabel,
|
|
52
|
-
artifactState,
|
|
53
|
-
isProposal,
|
|
54
|
-
loadArtifacts,
|
|
55
|
-
stageGlyph,
|
|
56
|
-
STATE_KEYS,
|
|
57
|
-
versionTypeKey,
|
|
58
|
-
type MemberArtifacts,
|
|
59
|
-
} from "./artifact-data";
|
|
60
|
-
|
|
61
|
-
interface Props {
|
|
62
|
-
params: Promise<{ locale: string }>;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
66
|
-
const { locale } = await params;
|
|
67
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
68
|
-
return { title: t("artifacts.title") };
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export default async function AccountArtifactsPage({
|
|
72
|
-
params,
|
|
73
|
-
}: Props): Promise<ReactElement> {
|
|
74
|
-
const { locale } = await params;
|
|
75
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
76
|
-
const session = await accountSession(locale);
|
|
77
|
-
|
|
78
|
-
const heading = (
|
|
79
|
-
<>
|
|
80
|
-
<Heading level={1} visual={2}>
|
|
81
|
-
{t("artifacts.title")}
|
|
82
|
-
</Heading>
|
|
83
|
-
<Text as="p" variant="body-sm" tone="muted" className="mt-block-tight">
|
|
84
|
-
{t("artifacts.lead")}
|
|
85
|
-
</Text>
|
|
86
|
-
</>
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
// Unreachable behind the (authed) gate — the layout renders the sign-in
|
|
90
|
-
// gate instead — but the page still renders in parallel with it, so a
|
|
91
|
-
// `notFound()` here streams a 404 digest over the gate (the scaffold render
|
|
92
|
-
// sweep's `/account/artifacts -> streamed not-found`). Mirror
|
|
93
|
-
// `../general/page.tsx`: the heading alone.
|
|
94
|
-
if (!session) {
|
|
95
|
-
return (
|
|
96
|
-
<div className="max-w-3xl py-8" data-testid="artifacts">
|
|
97
|
-
{heading}
|
|
98
|
-
</div>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
let artifacts: MemberArtifacts | null;
|
|
103
|
-
try {
|
|
104
|
-
artifacts = await loadArtifacts(session.ctx);
|
|
105
|
-
} catch (err) {
|
|
106
|
-
logReadFailure("artifacts", err);
|
|
107
|
-
artifacts = null;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (artifacts === null) {
|
|
111
|
-
return (
|
|
112
|
-
<div className="max-w-3xl py-8" data-testid="artifacts">
|
|
113
|
-
{heading}
|
|
114
|
-
<ErrorRow
|
|
115
|
-
className="mt-block-loose"
|
|
116
|
-
message={t("artifacts.error")}
|
|
117
|
-
retryLabel={t("artifacts.retry")}
|
|
118
|
-
/>
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const { items, stages } = artifacts;
|
|
124
|
-
const row = (artifact: MemberArtifact): AccountListFrameRow => {
|
|
125
|
-
const state = artifactState(artifact);
|
|
126
|
-
const latest = artifact.versions[0]!;
|
|
127
|
-
// An older hub serves no stage: the row sits under All alone.
|
|
128
|
-
const stageWord = artifactStageLabel(artifact);
|
|
129
|
-
const reviewWord = state === "ready" ? null : t(STATE_KEYS[state]);
|
|
130
|
-
const versionWord = t("artifacts.version", { version: latest.version });
|
|
131
|
-
const latestWord = isProposal(artifact)
|
|
132
|
-
? `${t("artifacts.proposal.caption")} · ${versionWord}`
|
|
133
|
-
: versionWord;
|
|
134
|
-
return {
|
|
135
|
-
id: artifact.id,
|
|
136
|
-
title: artifact.title,
|
|
137
|
-
href: artifactHref(locale, artifact.id),
|
|
138
|
-
// An older hub serves no stage: the empty facet matches no group row,
|
|
139
|
-
// so the artifact sits under All alone.
|
|
140
|
-
facet: artifact.stage ?? "",
|
|
141
|
-
caption: [latestWord, stageWord, reviewWord].filter(Boolean).join(" · "),
|
|
142
|
-
cells: {
|
|
143
|
-
type: t(versionTypeKey(latest)),
|
|
144
|
-
version: latestWord,
|
|
145
|
-
},
|
|
146
|
-
tags: { status: [stageWord, reviewWord].filter((word) => word !== null) },
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<AccountListFrame
|
|
152
|
-
title={t("artifacts.title")}
|
|
153
|
-
lead={t("artifacts.lead")}
|
|
154
|
-
glyph="layers"
|
|
155
|
-
all={{ label: t("artifacts.all") }}
|
|
156
|
-
group={{
|
|
157
|
-
heading: t("artifacts.statusGroup"),
|
|
158
|
-
facets: stages.map((stage, index) => ({
|
|
159
|
-
id: stage.slug,
|
|
160
|
-
label: stage.label,
|
|
161
|
-
glyph: stageGlyph(index, stages.length),
|
|
162
|
-
})),
|
|
163
|
-
}}
|
|
164
|
-
columns={[
|
|
165
|
-
{ key: "title", header: t("artifacts.columns.title") },
|
|
166
|
-
{ key: "type", header: t("artifacts.columns.type"), width: "1/6", minWidth: "24" },
|
|
167
|
-
{ key: "version", header: t("artifacts.columns.version"), width: "1/6", minWidth: "28" },
|
|
168
|
-
// Sized by the frame from the longest stage label (#8361).
|
|
169
|
-
{ key: "status", header: t("artifacts.columns.status"), fit: "facets", kind: "tags" },
|
|
170
|
-
]}
|
|
171
|
-
rows={items.map(row)}
|
|
172
|
-
labels={{
|
|
173
|
-
nav: t("artifacts.facets"),
|
|
174
|
-
table: t("artifacts.title"),
|
|
175
|
-
filter: t("artifacts.filter"),
|
|
176
|
-
empty: t("artifacts.empty"),
|
|
177
|
-
facetEmpty: t("artifacts.facetEmpty"),
|
|
178
|
-
}}
|
|
179
|
-
testIdPrefix="artifacts"
|
|
180
|
-
/>
|
|
181
|
-
);
|
|
182
|
-
}
|
|
1
|
+
// Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
|
|
2
|
+
export { default } from "@working-theory/account/artifacts/page";
|
|
3
|
+
export { generateMetadata } from "@working-theory/account/artifacts/page";
|
|
@@ -1,424 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* the operator's rulings of 2026-11-08 against the organization Billing's
|
|
4
|
-
* card shape).
|
|
5
|
-
*
|
|
6
|
-
* RSC, outside the account layout's SignedInShell (#8430), in the member's
|
|
7
|
-
* settings frame (D7) — since #11167 every group is a card the pane draws.
|
|
8
|
-
* The page, top to bottom, by `loadBilling()` and `loadBillingOfferings()`
|
|
9
|
-
* (`billing-source.ts`, the billing topology seam):
|
|
10
|
-
*
|
|
11
|
-
* (A) the OFFER CARD — the first live Offer product of the shown set
|
|
12
|
-
* (#11166), when the workspace shows one: its Stripe name, description
|
|
13
|
-
* and first image, Claim offer to the Offerings checkout, an x that
|
|
14
|
-
* dismisses it for this person (`OfferCard`, remembered under a key
|
|
15
|
-
* derived from the person's email, never the email itself);
|
|
16
|
-
* (B) the PLAN CARD, one of two (`CurrentPlanCard`): (B1) a current
|
|
17
|
-
* subscription — the plan name with its price beside it, one line
|
|
18
|
-
* ("Renews on December 1 · Visa 4242"; "Payment due"; "Access ends
|
|
19
|
-
* <date>") and Manage plan, which opens Stripe's Customer Portal and
|
|
20
|
-
* returns here; (B2) no subscription — the shown set's lowest-priced
|
|
21
|
-
* live plan, its Stripe description (or the fallback line until the
|
|
22
|
-
* operator sets one) and Upgrade to the Offerings checkout for the
|
|
23
|
-
* next live plan above it by price; a shown set with no live plan
|
|
24
|
-
* renders no plan card. A failed read is the error row with Retry,
|
|
25
|
-
* never a false "no subscription";
|
|
26
|
-
* (C) HISTORY — the member's paid invoices and purchases, newest first,
|
|
27
|
-
* Date (MM/DD/YYYY) · Offering · Amount · Receipt (`BillingHistoryCard`),
|
|
28
|
-
* absent when there are none.
|
|
29
|
-
*
|
|
30
|
-
* Then one plain line when some of the member's billing is on a Stripe
|
|
31
|
-
* account this spoke's key cannot read (#8217 D12), each section a module
|
|
32
|
-
* contributes (`accountBillingSections`, #8231 D4) and each the site adds
|
|
33
|
-
* (`siteBillingSections`, #9401 D7). The old "Current plan" heading, the
|
|
34
|
-
* plain purchases list and "You don't have a subscription." are gone.
|
|
35
|
-
*/
|
|
1
|
+
// Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
|
|
2
|
+
import Page from "@working-theory/account/billing/page";
|
|
36
3
|
|
|
37
|
-
import
|
|
4
|
+
import config from "../../../../../account.config";
|
|
38
5
|
|
|
39
|
-
|
|
40
|
-
AccountSettingsFrame,
|
|
41
|
-
AccountSettingsPane,
|
|
42
|
-
BillingHistoryCard,
|
|
43
|
-
CurrentPlanCard,
|
|
44
|
-
OfferCard,
|
|
45
|
-
type BillingHistoryRowView,
|
|
46
|
-
} from "@working-theory/templates/account";
|
|
47
|
-
import { Button, Link, MoneyAmount, Text } from "@working-theory/ui/primitives";
|
|
48
|
-
import type { Metadata } from "next";
|
|
49
|
-
import { getTranslations } from "next-intl/server";
|
|
50
|
-
import type { ReactElement, ReactNode } from "react";
|
|
6
|
+
export { generateMetadata } from "@working-theory/account/billing/page";
|
|
51
7
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
import { openBillingPortal } from "../actions";
|
|
57
|
-
import {
|
|
58
|
-
type BillingHistoryState,
|
|
59
|
-
type BillingPlanState,
|
|
60
|
-
type BillingState,
|
|
61
|
-
loadBilling,
|
|
62
|
-
loadBillingOfferings,
|
|
63
|
-
} from "../billing-source";
|
|
64
|
-
import { ErrorRow } from "../error-row";
|
|
65
|
-
import {
|
|
66
|
-
memberSettingsFrame,
|
|
67
|
-
SettingsSection,
|
|
68
|
-
type Translate as MemberTranslate,
|
|
69
|
-
} from "../settings-frame";
|
|
70
|
-
|
|
71
|
-
import type { BillingOfferView, BillingPlanView } from "./offerings";
|
|
72
|
-
|
|
73
|
-
interface Props {
|
|
74
|
-
params: Promise<{ locale: string }>;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
78
|
-
const { locale } = await params;
|
|
79
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
80
|
-
return {
|
|
81
|
-
title: t("settings.billing.title"),
|
|
82
|
-
description: t("settings.billing.lead"),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
type Translate = Awaited<ReturnType<typeof getTranslations<"account">>>;
|
|
87
|
-
|
|
88
|
-
// The pill: 44px on a phone (the primary-action floor) and full width there,
|
|
89
|
-
// 36px from md up — the settings cards' one submit style (#11167).
|
|
90
|
-
const PILL_CLASS =
|
|
91
|
-
"max-md:w-full max-md:min-h-11 !rounded-full whitespace-nowrap";
|
|
92
|
-
|
|
93
|
-
/** A day as the mockup writes it — "December 1" — read in UTC, the server's zone. */
|
|
94
|
-
function monthDay(iso: string, locale: string): ReactNode {
|
|
95
|
-
return (
|
|
96
|
-
<time dateTime={iso}>
|
|
97
|
-
{new Intl.DateTimeFormat(locale, {
|
|
98
|
-
month: "long",
|
|
99
|
-
day: "numeric",
|
|
100
|
-
timeZone: "UTC",
|
|
101
|
-
}).format(new Date(iso))}
|
|
102
|
-
</time>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** A History date as MM/DD/YYYY in the page's locale, read in UTC. */
|
|
107
|
-
function numericDate(iso: string, locale: string): string {
|
|
108
|
-
return new Intl.DateTimeFormat(locale, {
|
|
109
|
-
month: "2-digit",
|
|
110
|
-
day: "2-digit",
|
|
111
|
-
year: "numeric",
|
|
112
|
-
timeZone: "UTC",
|
|
113
|
-
}).format(new Date(iso));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/** "Visa 4242" — Stripe's lower-case brand, capitalized. */
|
|
117
|
-
function cardLabel(
|
|
118
|
-
card: BillingPlanState["card"],
|
|
119
|
-
t: Translate,
|
|
120
|
-
): string | null {
|
|
121
|
-
if (card === null) return null;
|
|
122
|
-
const brand = card.brand.charAt(0).toUpperCase() + card.brand.slice(1);
|
|
123
|
-
return t("settings.billing.card", { brand, last4: card.last4 });
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/** "$12,500/mo" — the amount in the price's currency, with its interval word. */
|
|
127
|
-
function priceLabel(
|
|
128
|
-
price: NonNullable<BillingPlanState["price"]>,
|
|
129
|
-
locale: string,
|
|
130
|
-
t: Translate,
|
|
131
|
-
): string {
|
|
132
|
-
const amount = formatMinorUnits(price.amountMinor, price.currency, locale);
|
|
133
|
-
if (price.interval === "month")
|
|
134
|
-
return t("settings.billing.perMonth", { amount });
|
|
135
|
-
if (price.interval === "year")
|
|
136
|
-
return t("settings.billing.perYear", { amount });
|
|
137
|
-
return amount;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function Subscription({
|
|
141
|
-
state,
|
|
142
|
-
locale,
|
|
143
|
-
t,
|
|
144
|
-
}: {
|
|
145
|
-
state: Extract<BillingState, { kind: "subscription" }>;
|
|
146
|
-
locale: string;
|
|
147
|
-
t: Translate;
|
|
148
|
-
}): ReactElement {
|
|
149
|
-
const { plan } = state;
|
|
150
|
-
const { renewsAt, accessEndsAt } = plan;
|
|
151
|
-
// The one line under the name: the renewal while it renews, the access
|
|
152
|
-
// end once it is set to end, else the status word — then the card on file.
|
|
153
|
-
const status: ReactNode =
|
|
154
|
-
renewsAt !== null &&
|
|
155
|
-
(plan.status === "active" || plan.status === "trialing")
|
|
156
|
-
? t.rich("settings.billing.renews", {
|
|
157
|
-
date: () => monthDay(renewsAt, locale),
|
|
158
|
-
})
|
|
159
|
-
: plan.status === "canceled" && accessEndsAt !== null
|
|
160
|
-
? t.rich("settings.billing.accessEnds", {
|
|
161
|
-
date: () => monthDay(accessEndsAt, locale),
|
|
162
|
-
})
|
|
163
|
-
: t(`settings.billing.statuses.${plan.status}`);
|
|
164
|
-
const card = cardLabel(plan.card, t);
|
|
165
|
-
return (
|
|
166
|
-
<CurrentPlanCard
|
|
167
|
-
name={plan.name ?? t("settings.billing.unnamedPlan")}
|
|
168
|
-
price={
|
|
169
|
-
plan.price === null ? undefined : priceLabel(plan.price, locale, t)
|
|
170
|
-
}
|
|
171
|
-
line={
|
|
172
|
-
<span data-testid="account-billing-status">
|
|
173
|
-
{status}
|
|
174
|
-
{card !== null ? (
|
|
175
|
-
<>
|
|
176
|
-
{" · "}
|
|
177
|
-
<span data-testid="account-billing-payment">{card}</span>
|
|
178
|
-
</>
|
|
179
|
-
) : null}
|
|
180
|
-
</span>
|
|
181
|
-
}
|
|
182
|
-
action={
|
|
183
|
-
state.portalAvailable ? (
|
|
184
|
-
<form action={openBillingPortal}>
|
|
185
|
-
<Button
|
|
186
|
-
type="submit"
|
|
187
|
-
className={PILL_CLASS}
|
|
188
|
-
data-testid="account-billing-manage"
|
|
189
|
-
>
|
|
190
|
-
{t("settings.billing.manage")}
|
|
191
|
-
</Button>
|
|
192
|
-
</form>
|
|
193
|
-
) : undefined
|
|
194
|
-
}
|
|
195
|
-
testId="account-billing"
|
|
196
|
-
/>
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/** The base plan a member without a subscription starts on, with Upgrade to the next (#11165 B2). */
|
|
201
|
-
function BasePlan({
|
|
202
|
-
base,
|
|
203
|
-
next,
|
|
204
|
-
locale,
|
|
205
|
-
t,
|
|
206
|
-
}: {
|
|
207
|
-
base: BillingPlanView;
|
|
208
|
-
next: BillingPlanView | null;
|
|
209
|
-
locale: string;
|
|
210
|
-
t: Translate;
|
|
211
|
-
}): ReactElement {
|
|
212
|
-
const upgradeHref = next?.checkoutHref ?? null;
|
|
213
|
-
return (
|
|
214
|
-
<CurrentPlanCard
|
|
215
|
-
name={base.name}
|
|
216
|
-
price={priceLabel(base.price, locale, t)}
|
|
217
|
-
description={base.description ?? t("settings.billing.planFallback")}
|
|
218
|
-
action={
|
|
219
|
-
upgradeHref !== null ? (
|
|
220
|
-
<Button asChild className={PILL_CLASS}>
|
|
221
|
-
<Link
|
|
222
|
-
href={upgradeHref}
|
|
223
|
-
variant="bare"
|
|
224
|
-
data-testid="account-billing-upgrade"
|
|
225
|
-
>
|
|
226
|
-
{t("settings.billing.upgrade")}
|
|
227
|
-
</Link>
|
|
228
|
-
</Button>
|
|
229
|
-
) : undefined
|
|
230
|
-
}
|
|
231
|
-
testId="account-billing"
|
|
232
|
-
/>
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/** The History card (#11165 C): the error row for a failed read, else the rows — the page renders it only when there are any. */
|
|
237
|
-
function History({
|
|
238
|
-
history,
|
|
239
|
-
locale,
|
|
240
|
-
t,
|
|
241
|
-
}: {
|
|
242
|
-
history: BillingHistoryState;
|
|
243
|
-
locale: string;
|
|
244
|
-
t: Translate;
|
|
245
|
-
}): ReactElement {
|
|
246
|
-
if (history.kind === "failed") {
|
|
247
|
-
return (
|
|
248
|
-
<div data-testid="account-billing-history-error">
|
|
249
|
-
<ErrorRow
|
|
250
|
-
message={t("settings.billing.historyUnavailable")}
|
|
251
|
-
retryLabel={t("inbox.retry")}
|
|
252
|
-
/>
|
|
253
|
-
</div>
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
const rows: BillingHistoryRowView[] = history.items.map((item) => ({
|
|
257
|
-
id: item.id,
|
|
258
|
-
date: numericDate(item.paidAt, locale),
|
|
259
|
-
dateTime: item.paidAt,
|
|
260
|
-
offering: item.offering,
|
|
261
|
-
amount:
|
|
262
|
-
item.amountMinor !== null && item.currency !== null ? (
|
|
263
|
-
<MoneyAmount
|
|
264
|
-
amountMinor={item.amountMinor}
|
|
265
|
-
currency={item.currency}
|
|
266
|
-
locale={locale}
|
|
267
|
-
/>
|
|
268
|
-
) : (
|
|
269
|
-
"—"
|
|
270
|
-
),
|
|
271
|
-
receiptHref: item.receiptUrl,
|
|
272
|
-
}));
|
|
273
|
-
return (
|
|
274
|
-
<BillingHistoryCard
|
|
275
|
-
rows={rows}
|
|
276
|
-
labels={{
|
|
277
|
-
title: t("settings.billing.history"),
|
|
278
|
-
date: t("settings.billing.historyDate"),
|
|
279
|
-
offering: t("settings.billing.historyOffering"),
|
|
280
|
-
amount: t("settings.billing.historyAmount"),
|
|
281
|
-
receipt: t("settings.billing.historyReceipt"),
|
|
282
|
-
view: t("settings.billing.historyView"),
|
|
283
|
-
}}
|
|
284
|
-
testIdPrefix="account-billing-history"
|
|
285
|
-
/>
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* The offer dismissal's per-person key: a SHA-256 digest of the person's
|
|
291
|
-
* email under a fixed label, computed on the server, so the browser's store
|
|
292
|
-
* names no address and a shared browser keeps each person's dismissals
|
|
293
|
-
* apart. A pseudonym, not a secret: the stored value is product ids only.
|
|
294
|
-
*/
|
|
295
|
-
function offerPersistKey(email: string): string {
|
|
296
|
-
const digest = createHash("sha256")
|
|
297
|
-
.update(`ailk:billing-offer:${email.trim().toLowerCase()}`)
|
|
298
|
-
.digest("hex");
|
|
299
|
-
return `account:billing-offer:${digest.slice(0, 16)}`;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* The offer card (#11165 A), built as the pane's DIRECT child — the pane
|
|
304
|
-
* reads `ownCard` off the element it is given — so it draws its own card and
|
|
305
|
-
* a dismissal leaves no shell; the page builds it only for a live offer.
|
|
306
|
-
*/
|
|
307
|
-
function offerCard(
|
|
308
|
-
offer: BillingOfferView & { claimHref: string },
|
|
309
|
-
email: string,
|
|
310
|
-
t: Translate,
|
|
311
|
-
): ReactElement {
|
|
312
|
-
return (
|
|
313
|
-
<OfferCard
|
|
314
|
-
id={offer.productId}
|
|
315
|
-
persistKey={offerPersistKey(email)}
|
|
316
|
-
title={offer.name}
|
|
317
|
-
description={offer.description}
|
|
318
|
-
image={
|
|
319
|
-
offer.image === null ? null : { src: offer.image, alt: offer.name }
|
|
320
|
-
}
|
|
321
|
-
claimHref={offer.claimHref}
|
|
322
|
-
claimLabel={t("settings.billing.claimOffer")}
|
|
323
|
-
dismissLabel={t("settings.billing.dismissOffer")}
|
|
324
|
-
testId="account-billing-offer"
|
|
325
|
-
cardTestId="account-settings-billing-card"
|
|
326
|
-
ownCard
|
|
327
|
-
/>
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
export default async function AccountBillingPage({
|
|
332
|
-
params,
|
|
333
|
-
}: Props): Promise<ReactElement> {
|
|
334
|
-
const { locale } = await params;
|
|
335
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
336
|
-
const session = await accountSession(locale);
|
|
337
|
-
const frame = memberSettingsFrame(
|
|
338
|
-
locale,
|
|
339
|
-
t as unknown as MemberTranslate,
|
|
340
|
-
"billing",
|
|
341
|
-
);
|
|
342
|
-
|
|
343
|
-
// Unreachable behind the (authed) gate; a session that expired between
|
|
344
|
-
// the layout and the page renders the pane's title alone.
|
|
345
|
-
if (!session) {
|
|
346
|
-
return (
|
|
347
|
-
<AccountSettingsFrame {...frame} name="">
|
|
348
|
-
<AccountSettingsPane
|
|
349
|
-
id="account-settings-billing"
|
|
350
|
-
title={t("settings.billing.title")}
|
|
351
|
-
lead=""
|
|
352
|
-
>
|
|
353
|
-
{null}
|
|
354
|
-
</AccountSettingsPane>
|
|
355
|
-
</AccountSettingsFrame>
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
const { ctx } = session;
|
|
360
|
-
const [{ state, history }, offerings] = await Promise.all([
|
|
361
|
-
loadBilling(ctx.init),
|
|
362
|
-
loadBillingOfferings(),
|
|
363
|
-
]);
|
|
364
|
-
const name = ctx.user.name || ctx.user.email;
|
|
365
|
-
// Every pane child below is one card, so each slot is decided here and a
|
|
366
|
-
// slot with nothing to show passes nothing — never an empty card (#11165).
|
|
367
|
-
const offer =
|
|
368
|
-
offerings.offer !== null && offerings.offer.claimHref !== null
|
|
369
|
-
? { ...offerings.offer, claimHref: offerings.offer.claimHref }
|
|
370
|
-
: null;
|
|
371
|
-
const hasHistory = history.kind === "failed" || history.items.length > 0;
|
|
372
|
-
|
|
373
|
-
return (
|
|
374
|
-
<AccountSettingsFrame {...frame} name={name}>
|
|
375
|
-
<AccountSettingsPane
|
|
376
|
-
id="account-settings-billing"
|
|
377
|
-
title={t("settings.billing.title")}
|
|
378
|
-
lead={t("settings.billing.lead")}
|
|
379
|
-
>
|
|
380
|
-
{offer !== null ? offerCard(offer, ctx.user.email, t) : null}
|
|
381
|
-
|
|
382
|
-
{state.kind === "subscription" ? (
|
|
383
|
-
<Subscription state={state} locale={locale} t={t} />
|
|
384
|
-
) : state.kind === "none" ? (
|
|
385
|
-
offerings.base !== null ? (
|
|
386
|
-
<BasePlan
|
|
387
|
-
base={offerings.base}
|
|
388
|
-
next={offerings.next}
|
|
389
|
-
locale={locale}
|
|
390
|
-
t={t}
|
|
391
|
-
/>
|
|
392
|
-
) : null
|
|
393
|
-
) : (
|
|
394
|
-
<ErrorRow
|
|
395
|
-
message={t("settings.billing.unavailable")}
|
|
396
|
-
retryLabel={t("inbox.retry")}
|
|
397
|
-
/>
|
|
398
|
-
)}
|
|
399
|
-
|
|
400
|
-
{state.kind !== "failed" && state.unreadable ? (
|
|
401
|
-
<div data-testid="account-billing-unreadable">
|
|
402
|
-
<Text as="p" variant="body-sm" tone="muted">
|
|
403
|
-
{t("settings.billing.unreadable")}
|
|
404
|
-
</Text>
|
|
405
|
-
</div>
|
|
406
|
-
) : null}
|
|
407
|
-
|
|
408
|
-
{hasHistory ? (
|
|
409
|
-
<History history={history} locale={locale} t={t} />
|
|
410
|
-
) : null}
|
|
411
|
-
|
|
412
|
-
{[...accountBillingSections, ...siteBillingSections].map((section) => (
|
|
413
|
-
<SettingsSection
|
|
414
|
-
key={section.id}
|
|
415
|
-
id={section.id}
|
|
416
|
-
title={ctx.t(section.title)}
|
|
417
|
-
>
|
|
418
|
-
{section.render(ctx)}
|
|
419
|
-
</SettingsSection>
|
|
420
|
-
))}
|
|
421
|
-
</AccountSettingsPane>
|
|
422
|
-
</AccountSettingsFrame>
|
|
423
|
-
);
|
|
8
|
+
export default async function Route(
|
|
9
|
+
props: Omit<Parameters<typeof Page>[0], "config">,
|
|
10
|
+
) {
|
|
11
|
+
return Page({ ...props, config });
|
|
424
12
|
}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* Referer while the browser still sends the real `Origin` on Continue.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
+
import { accountSession } from "@working-theory/account/account-data";
|
|
22
23
|
import { hubSignIn } from "@working-theory/api-client";
|
|
23
24
|
import { localeHref } from "@working-theory/ui";
|
|
24
25
|
import { Button, Heading, Input, Link, Text } from "@working-theory/ui/primitives";
|
|
@@ -31,7 +32,6 @@ import type { ReactElement } from "react";
|
|
|
31
32
|
import { resolveSecret } from "../../../../../auth";
|
|
32
33
|
import { TOPOLOGY } from "../../../../../lib/topology.generated";
|
|
33
34
|
import { openContinuation } from "../../../../api/auth/hub/continuation";
|
|
34
|
-
import { accountSession } from "../account-data";
|
|
35
35
|
|
|
36
36
|
/** The authorize route's POST — the one request that says yes. */
|
|
37
37
|
const AUTHORIZE_PATH = "/api/auth/hub/authorize";
|