create-ailk 0.37.0 → 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 +149 -2
- 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 +7 -2
- package/dist/add-route.js +28 -13
- 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 +28 -1
- package/dist/sync-routes.js +144 -11
- package/dist/template-record.d.ts +11 -0
- package/dist/template-record.js +18 -0
- package/dist/topology.d.ts +15 -1
- package/dist/topology.js +20 -4
- package/dist/update.d.ts +31 -2
- package/dist/update.js +627 -99
- 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,115 +0,0 @@
|
|
|
1
|
-
// oss: false
|
|
2
|
-
/**
|
|
3
|
-
* /[locale]/purchase/cancel — the checkout-canceled return page (#6084).
|
|
4
|
-
*
|
|
5
|
-
* NOTE on `// oss: false` — see the identical note in
|
|
6
|
-
* `../success/page.tsx`: this page ALSO renders `payment-receipt` via the
|
|
7
|
-
* paid `@working-theory/ui-commerce` package (D5), so it needs the same
|
|
8
|
-
* `paths_excluded` + marker pair the `/meet` precedent uses. `create-ailk`'s
|
|
9
|
-
* scaffold is unaffected — `CORE_ROUTE_DIRS` governs scaffold presence, not
|
|
10
|
-
* this marker.
|
|
11
|
-
*
|
|
12
|
-
* D4 — reads NOTHING. No session id, no API call, no `searchParams` read.
|
|
13
|
-
* States that nothing was charged and links back to `/services`. This is
|
|
14
|
-
* what makes AC-2 trivially true and removes the whole page from D3's PII
|
|
15
|
-
* surface: there is no read to leak.
|
|
16
|
-
*
|
|
17
|
-
* D5 — the SAME chassis as `/purchase/success`, with `outcome: "cancel"`
|
|
18
|
-
* (a distinct, non-forgeable Stripe status — `PaymentResult.tsx`'s
|
|
19
|
-
* `OUTCOME_STATUS.cancel = "canceled"` — that carries no schema.org
|
|
20
|
-
* `PaymentComplete` node), no `items` section, and a `cta` whose primary
|
|
21
|
-
* link is `/services`.
|
|
22
|
-
*
|
|
23
|
-
* D12 — base tree, request-time gate, mirroring `/purchase/success`.
|
|
24
|
-
* `force-dynamic`: a static build without it would prerender the claim
|
|
25
|
-
* check at BUILD time, so a site that buys commerce after its last deploy
|
|
26
|
-
* would keep serving a prerendered 404.
|
|
27
|
-
*
|
|
28
|
-
* The `ui-commerce` package is registered LAZILY
|
|
29
|
-
* (`../../../../src/lib/commerce-sections.ts`), mirroring
|
|
30
|
-
* `/purchase/success` — never a top-level static import, since a keyless
|
|
31
|
-
* scaffold carries no dependency on it by design (#5581 U6/D5). When it is
|
|
32
|
-
* genuinely absent, this page falls back to an OSS `content-block` carrying
|
|
33
|
-
* the same "Checkout canceled" copy.
|
|
34
|
-
*
|
|
35
|
-
* `noindex`: reachable only by cancelling a Checkout, never a page a
|
|
36
|
-
* crawler should list.
|
|
37
|
-
*/
|
|
38
|
-
import { SectionRenderer } from "@working-theory/ui/sections";
|
|
39
|
-
import type { PageSection } from "@working-theory/validation";
|
|
40
|
-
import type { Metadata } from "next";
|
|
41
|
-
import { notFound } from "next/navigation";
|
|
42
|
-
import { getTranslations } from "next-intl/server";
|
|
43
|
-
import type { ReactElement } from "react";
|
|
44
|
-
|
|
45
|
-
import { resolveCommerceClaim } from "../../../../src/lib/commerce-claim";
|
|
46
|
-
import { ensureCommerceSectionsRegistered } from "../../../../src/lib/commerce-sections";
|
|
47
|
-
|
|
48
|
-
// This page reads nothing and would otherwise be static — force it dynamic
|
|
49
|
-
// so the commerce-claim check (D12) is evaluated per request, not baked
|
|
50
|
-
// into a prerendered build.
|
|
51
|
-
export const dynamic = "force-dynamic";
|
|
52
|
-
|
|
53
|
-
interface Props {
|
|
54
|
-
params: Promise<{ locale: string }>;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
58
|
-
const { locale } = await params;
|
|
59
|
-
const t = await getTranslations({ locale, namespace: "purchase" });
|
|
60
|
-
return {
|
|
61
|
-
title: t("cancel.title"),
|
|
62
|
-
description: t("cancel.message"),
|
|
63
|
-
robots: { index: false, follow: true },
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export default async function Page({ params }: Props): Promise<ReactElement> {
|
|
68
|
-
const { locale } = await params;
|
|
69
|
-
const t = await getTranslations({ locale, namespace: "purchase" });
|
|
70
|
-
|
|
71
|
-
// D12 — request-time gate, before any render.
|
|
72
|
-
if (!(await resolveCommerceClaim())) {
|
|
73
|
-
notFound();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const commerceSectionsAvailable = await ensureCommerceSectionsRegistered();
|
|
77
|
-
const receipt: PageSection = commerceSectionsAvailable
|
|
78
|
-
? {
|
|
79
|
-
id: "purchase-cancel-receipt",
|
|
80
|
-
type: "payment-receipt",
|
|
81
|
-
data: {
|
|
82
|
-
outcome: "cancel",
|
|
83
|
-
title: t("cancel.title"),
|
|
84
|
-
message: t("cancel.message"),
|
|
85
|
-
statusLabel: t("cancel.statusLabel"),
|
|
86
|
-
},
|
|
87
|
-
}
|
|
88
|
-
: {
|
|
89
|
-
id: "purchase-cancel-receipt-fallback",
|
|
90
|
-
type: "content-block",
|
|
91
|
-
data: {
|
|
92
|
-
headline: t("cancel.title"),
|
|
93
|
-
body: `${t("cancel.message")} ${t("cancel.statusLabel")}`,
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const sections: PageSection[] = [
|
|
98
|
-
receipt,
|
|
99
|
-
{
|
|
100
|
-
id: "purchase-cancel-cta",
|
|
101
|
-
type: "cta",
|
|
102
|
-
data: {
|
|
103
|
-
headline: t("cancel.ctaHeadline"),
|
|
104
|
-
description: t("cancel.ctaDescription"),
|
|
105
|
-
primaryCta: { label: t("cancel.ctaLabel"), href: "/services" },
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<main>
|
|
112
|
-
<SectionRenderer sections={sections} locale={locale} />
|
|
113
|
-
</main>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
// oss: false
|
|
2
|
-
/**
|
|
3
|
-
* /[locale]/purchase/success — the order-confirmation return page (#6084).
|
|
4
|
-
*
|
|
5
|
-
* NOTE on `// oss: false` — a DELIBERATE correction to the spec's NFR-4,
|
|
6
|
-
* which assumed this page could ship unmarked like the base-tree checkout
|
|
7
|
-
* API primitives (`routes/checkout/sessions.ts`, `tools/purchase.ts`). Those
|
|
8
|
-
* import only OSS `@working-theory/stripe-client`; THIS page renders
|
|
9
|
-
* `payment-receipt` via `registerCommerceSections()` from the PAID
|
|
10
|
-
* `@working-theory/ui-commerce` package (D5) — the same shape `/meet`
|
|
11
|
-
* already has for `@working-theory/ui-scheduling`. The architecture lint's
|
|
12
|
-
* OSS→paid boundary rule (`architecture.yaml` forbidden_patterns) requires
|
|
13
|
-
* either no marker + no paid import, or a `paths_excluded` entry PLUS this
|
|
14
|
-
* marker (the `meet/**` precedent) — never no-marker-with-a-paid-import.
|
|
15
|
-
* `create-ailk`'s scaffold is UNAFFECTED: `CORE_ROUTE_DIRS`
|
|
16
|
-
* (`packages/create-ailk/src/surfaces.ts`) governs what a scaffold carries,
|
|
17
|
-
* not this marker, so AC-4/FR-8 still hold — every scaffold gets this file
|
|
18
|
-
* regardless. Only the ai-launch-kit-internal → ai-launch-kit PUBLIC-REPO
|
|
19
|
-
* split (a different mechanism) reads this marker.
|
|
20
|
-
*
|
|
21
|
-
* READS the Checkout Session the Stripe webhook already granted (spec §1.2)
|
|
22
|
-
* — this page never writes: no Prisma call, no Stripe write, no grant, no
|
|
23
|
-
* stamp (AC-1, FR-3). It is reachable by anyone holding a `cs_…` id, with
|
|
24
|
-
* no credential at all (D8) — the design below is built around that fact.
|
|
25
|
-
*
|
|
26
|
-
* D6 — the paid render is not forgeable. `outcome: "success"` is Stripe's
|
|
27
|
-
* proof-of-payment status (a green chip, `data-outcome="success"`, and a
|
|
28
|
-
* schema.org `PaymentComplete` node — `PaymentResult.tsx`), so the
|
|
29
|
-
* `payment-receipt` section is constructed ONLY on a 2xx read with
|
|
30
|
-
* `paymentStatus === "paid"`. Every other reachable state — no
|
|
31
|
-
* `session_id`, an API failure, or a 2xx read that is not yet paid —
|
|
32
|
-
* renders a DIFFERENT chassis (`content-block` → `cta`, not a
|
|
33
|
-
* `CheckoutDeliveryPage`) with no badge, no `data-outcome` and no
|
|
34
|
-
* `PaymentComplete` string anywhere in the DOM (AC-8).
|
|
35
|
-
*
|
|
36
|
-
* D12 — base tree, request-time gate. This page ships unconditionally in
|
|
37
|
-
* every scaffold; whether it SERVES is decided per request by the
|
|
38
|
-
* `commerce` licence claim (`../../../../src/lib/commerce-claim.ts`,
|
|
39
|
-
* extracted from `.well-known/mcp.json`'s own check). `notFound()` on no
|
|
40
|
-
* claim is indistinguishable from a build without the module — before any
|
|
41
|
-
* API call, before any render.
|
|
42
|
-
*
|
|
43
|
-
* The `ui-commerce` package itself is registered LAZILY
|
|
44
|
-
* (`../../../../src/lib/commerce-sections.ts`), never via a top-level
|
|
45
|
-
* static import — a keyless scaffold carries no dependency on it by design
|
|
46
|
-
* (#5581 U6/D5), and a static import would fail every keyless build
|
|
47
|
-
* regardless of the request-time gate above. When the module genuinely is
|
|
48
|
-
* not installed, `paidSections()` below falls back to an OSS
|
|
49
|
-
* `content-block` carrying the same confirmation copy, rather than the bare
|
|
50
|
-
* `payment-receipt` section `SectionRenderer` would otherwise silently
|
|
51
|
-
* render as nothing (`ModuleAbsent` in production).
|
|
52
|
-
*
|
|
53
|
-
* `noindex`: reachable only by finishing (or trying) a Checkout, never a
|
|
54
|
-
* page a crawler should list.
|
|
55
|
-
*
|
|
56
|
-
* #11095 D9 — "Open your account". A paid read whose answer carries
|
|
57
|
-
* `customerEmail` (the hub serves it only for a paid Offerings session of
|
|
58
|
-
* the caller's own workspace, under 24 h old) adds one link built by
|
|
59
|
-
* `accountInviteHref`. Session Replay records `href`s, so the link sits in a
|
|
60
|
-
* `data-sentry-block` wrapper, and the page sends no referrer (SEC-11095-5).
|
|
61
|
-
*/
|
|
62
|
-
import { checkout } from "@working-theory/api-client";
|
|
63
|
-
import type { CheckoutSessionReadResponse } from "@working-theory/api-client";
|
|
64
|
-
import { Button, Container, Link } from "@working-theory/ui";
|
|
65
|
-
import { SectionRenderer } from "@working-theory/ui/sections";
|
|
66
|
-
import type { PageSection } from "@working-theory/validation";
|
|
67
|
-
import { formatMoney } from "@working-theory/web-i18n";
|
|
68
|
-
import type { Metadata } from "next";
|
|
69
|
-
import { headers } from "next/headers";
|
|
70
|
-
import { notFound } from "next/navigation";
|
|
71
|
-
import { getTranslations } from "next-intl/server";
|
|
72
|
-
import type { ReactElement } from "react";
|
|
73
|
-
|
|
74
|
-
import { accountInviteHref } from "../../../../lib/account-invite";
|
|
75
|
-
import { resolveCommerceClaim } from "../../../../src/lib/commerce-claim";
|
|
76
|
-
import { ensureCommerceSectionsRegistered } from "../../../../src/lib/commerce-sections";
|
|
77
|
-
|
|
78
|
-
// The success page reads `searchParams` (dynamic by construction); paired
|
|
79
|
-
// with the cancel page's explicit `force-dynamic` so a site that buys
|
|
80
|
-
// commerce after its last deploy is not stuck serving a prerendered 404
|
|
81
|
-
// (D12).
|
|
82
|
-
export const dynamic = "force-dynamic";
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* `next-intl`'s `getTranslations()` return type, so it can be passed
|
|
86
|
-
* between the section builders below (this repo has no other precedent
|
|
87
|
-
* typing it explicitly, since no other page passes `t` across functions).
|
|
88
|
-
*/
|
|
89
|
-
type PurchaseT = Awaited<ReturnType<typeof getTranslations>>;
|
|
90
|
-
|
|
91
|
-
interface Props {
|
|
92
|
-
params: Promise<{ locale: string }>;
|
|
93
|
-
searchParams?: Promise<{ session_id?: string | string[] }>;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** First value only — a repeated query param must not become an array here. */
|
|
97
|
-
function firstValue(raw: string | string[] | undefined): string | undefined {
|
|
98
|
-
if (Array.isArray(raw)) return raw[0];
|
|
99
|
-
return raw;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Reads the visitor's real IP from THIS page's own incoming request —
|
|
104
|
-
* never from the query string — preferring `x-forwarded-for` and falling
|
|
105
|
-
* back to `x-real-ip`. Returns `undefined` rather than throwing on any
|
|
106
|
-
* failure. A local copy of `flows/[slug]/checkout.actions.ts`'s identical
|
|
107
|
-
* helper (#4730) — every RSC-to-API caller carries its own copy rather than
|
|
108
|
-
* a shared import, since this one crosses the OSS/paid boundary the other
|
|
109
|
-
* doesn't. Without it, `apps/api`'s rate limiter
|
|
110
|
-
* (`middleware/rate-limit.ts`) sees the Next server's own egress IP for
|
|
111
|
-
* every buyer, collapsing them into one shared bucket (security-review
|
|
112
|
-
* finding on this issue's PR — #6084).
|
|
113
|
-
*/
|
|
114
|
-
async function resolveVisitorIpInit(): Promise<
|
|
115
|
-
{ headers: Record<string, string> } | undefined
|
|
116
|
-
> {
|
|
117
|
-
try {
|
|
118
|
-
const incoming = await headers();
|
|
119
|
-
const visitorIp =
|
|
120
|
-
incoming.get("x-forwarded-for") ?? incoming.get("x-real-ip");
|
|
121
|
-
return visitorIp
|
|
122
|
-
? { headers: { "x-forwarded-for": visitorIp } }
|
|
123
|
-
: undefined;
|
|
124
|
-
} catch {
|
|
125
|
-
return undefined;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/** The onward `cta` section every one of D6's five rows carries (AC-7 — never a dead end). */
|
|
130
|
-
function ctaSection(t: PurchaseT): PageSection {
|
|
131
|
-
return {
|
|
132
|
-
id: "purchase-success-cta",
|
|
133
|
-
type: "cta",
|
|
134
|
-
data: {
|
|
135
|
-
headline: t("success.ctaHeadline"),
|
|
136
|
-
description: t("success.ctaDescription"),
|
|
137
|
-
primaryCta: { label: t("success.ctaLabel"), href: "/services" },
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/** One card per paid line item — the D5 seam: `items`, not `payment-receipt`, carries the lines. */
|
|
143
|
-
function itemsSection(
|
|
144
|
-
lineItems: CheckoutSessionReadResponse["lineItems"],
|
|
145
|
-
t: PurchaseT,
|
|
146
|
-
locale: string,
|
|
147
|
-
): PageSection {
|
|
148
|
-
return {
|
|
149
|
-
id: "purchase-success-items",
|
|
150
|
-
type: "items",
|
|
151
|
-
data: {
|
|
152
|
-
items: lineItems.map((line) => ({
|
|
153
|
-
title: line.description,
|
|
154
|
-
description: t("success.lineItem", {
|
|
155
|
-
quantity: line.quantity,
|
|
156
|
-
amount: formatMoney(line.amountTotal, line.currency, locale),
|
|
157
|
-
}),
|
|
158
|
-
})),
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* D6's degraded-state row: no `session_id`, a shape-gate reject, an API
|
|
165
|
-
* 404/non-2xx, or a session that isn't yet paid — all render honestly
|
|
166
|
-
* rather than claiming a payment. `content-block` → `cta`; no
|
|
167
|
-
* `payment-receipt`, so no badge and no schema.org node exists to be read.
|
|
168
|
-
*/
|
|
169
|
-
function unknownSections(t: PurchaseT): PageSection[] {
|
|
170
|
-
return [
|
|
171
|
-
{
|
|
172
|
-
id: "purchase-success-unknown",
|
|
173
|
-
type: "content-block",
|
|
174
|
-
data: {
|
|
175
|
-
headline: t("success.unknownHeadline"),
|
|
176
|
-
body: t("success.unknownBody"),
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
ctaSection(t),
|
|
180
|
-
];
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/** 2xx, `paymentStatus` is `"unpaid"` or `"no_payment_required"` — D6 row 2. */
|
|
184
|
-
function pendingSections(
|
|
185
|
-
session: CheckoutSessionReadResponse,
|
|
186
|
-
t: PurchaseT,
|
|
187
|
-
locale: string,
|
|
188
|
-
): PageSection[] {
|
|
189
|
-
return [
|
|
190
|
-
{
|
|
191
|
-
id: "purchase-success-pending",
|
|
192
|
-
type: "content-block",
|
|
193
|
-
data: {
|
|
194
|
-
headline: t("success.pendingHeadline"),
|
|
195
|
-
body: t("success.pendingBody"),
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
itemsSection(session.lineItems, t, locale),
|
|
199
|
-
ctaSection(t),
|
|
200
|
-
];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* The OSS degrade for `paidSections()` — carries the same title/message/
|
|
205
|
-
* status copy as `payment-receipt`, minus its badge/schema.org markers, for
|
|
206
|
-
* a deployment where `@working-theory/ui-commerce` is genuinely not
|
|
207
|
-
* installed (a keyless scaffold with a `commerce` licence claim but no
|
|
208
|
-
* redeploy since buying it — `ensureCommerceSectionsRegistered()`'s own
|
|
209
|
-
* doc comment).
|
|
210
|
-
*/
|
|
211
|
-
function paidFallbackSection(t: PurchaseT): PageSection {
|
|
212
|
-
return {
|
|
213
|
-
id: "purchase-success-receipt-fallback",
|
|
214
|
-
type: "content-block",
|
|
215
|
-
data: {
|
|
216
|
-
headline: t("success.title"),
|
|
217
|
-
body: `${t("success.message")} ${t("success.statusLabel")}`,
|
|
218
|
-
},
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/** 2xx AND `paymentStatus === "paid"` — the ONLY row that constructs `payment-receipt` (D6). */
|
|
223
|
-
async function paidSections(
|
|
224
|
-
session: CheckoutSessionReadResponse,
|
|
225
|
-
t: PurchaseT,
|
|
226
|
-
locale: string,
|
|
227
|
-
): Promise<PageSection[]> {
|
|
228
|
-
const commerceSectionsAvailable = await ensureCommerceSectionsRegistered();
|
|
229
|
-
const receipt: PageSection = commerceSectionsAvailable
|
|
230
|
-
? {
|
|
231
|
-
id: "purchase-success-receipt",
|
|
232
|
-
type: "payment-receipt",
|
|
233
|
-
data: {
|
|
234
|
-
outcome: "success",
|
|
235
|
-
title: t("success.title"),
|
|
236
|
-
message: t("success.message"),
|
|
237
|
-
statusLabel: t("success.statusLabel"),
|
|
238
|
-
amount: {
|
|
239
|
-
amountMinor: session.amountTotal ?? 0,
|
|
240
|
-
currency: session.currency,
|
|
241
|
-
},
|
|
242
|
-
locale,
|
|
243
|
-
sessionId: session.id,
|
|
244
|
-
sessionIdLabel: t("success.sessionIdLabel"),
|
|
245
|
-
},
|
|
246
|
-
}
|
|
247
|
-
: paidFallbackSection(t);
|
|
248
|
-
return [receipt, itemsSection(session.lineItems, t, locale), ctaSection(t)];
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/** What the page renders: D6's sections, plus the paid read's account link (#11095 D9). */
|
|
252
|
-
interface SuccessView {
|
|
253
|
-
sections: PageSection[];
|
|
254
|
-
accountHref: string | null;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/** D6's five-row table, collapsed to the three code paths that produce distinct output. */
|
|
258
|
-
async function sectionsFor(
|
|
259
|
-
sessionId: string | undefined,
|
|
260
|
-
t: PurchaseT,
|
|
261
|
-
locale: string,
|
|
262
|
-
): Promise<SuccessView> {
|
|
263
|
-
const none = (sections: PageSection[]): SuccessView => ({
|
|
264
|
-
sections,
|
|
265
|
-
accountHref: null,
|
|
266
|
-
});
|
|
267
|
-
if (!sessionId) return none(unknownSections(t));
|
|
268
|
-
|
|
269
|
-
// A malformed/oversized id (D8's shape gate) or an unknown session both
|
|
270
|
-
// answer non-2xx here — the API's failure is logged server-side and never
|
|
271
|
-
// surfaced to the buyer (spec §3 D6 table). `checkout.getSession()` calls
|
|
272
|
-
// `fetch()` directly with no try/catch of its own
|
|
273
|
-
// (`packages/api-client/src/http.ts`), so a network-level failure (the API
|
|
274
|
-
// unreachable, DNS, a dropped connection) REJECTS rather than resolving
|
|
275
|
-
// `{ ok: false }` — caught here so it degrades identically to a non-2xx
|
|
276
|
-
// response instead of crashing the page (AC-7's "never a dead end",
|
|
277
|
-
// code-review finding on this issue's PR).
|
|
278
|
-
let res: Awaited<ReturnType<typeof checkout.getSession>>;
|
|
279
|
-
try {
|
|
280
|
-
res = await checkout.getSession(sessionId, await resolveVisitorIpInit());
|
|
281
|
-
} catch {
|
|
282
|
-
return none(unknownSections(t));
|
|
283
|
-
}
|
|
284
|
-
if (!res.ok) return none(unknownSections(t));
|
|
285
|
-
|
|
286
|
-
if (res.body.paymentStatus !== "paid") {
|
|
287
|
-
return none(pendingSections(res.body, t, locale));
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const { customerEmail } = res.body;
|
|
291
|
-
return {
|
|
292
|
-
sections: await paidSections(res.body, t, locale),
|
|
293
|
-
accountHref: customerEmail
|
|
294
|
-
? accountInviteHref(locale, customerEmail)
|
|
295
|
-
: null,
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
300
|
-
const { locale } = await params;
|
|
301
|
-
const t = await getTranslations({ locale, namespace: "purchase" });
|
|
302
|
-
return {
|
|
303
|
-
title: t("success.title"),
|
|
304
|
-
description: t("success.message"),
|
|
305
|
-
robots: { index: false, follow: true },
|
|
306
|
-
referrer: "no-referrer",
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export default async function Page({
|
|
311
|
-
params,
|
|
312
|
-
searchParams,
|
|
313
|
-
}: Props): Promise<ReactElement> {
|
|
314
|
-
const { locale } = await params;
|
|
315
|
-
const t: PurchaseT = await getTranslations({ locale, namespace: "purchase" });
|
|
316
|
-
|
|
317
|
-
// D12 — request-time gate, before any API call and before any render.
|
|
318
|
-
if (!(await resolveCommerceClaim())) {
|
|
319
|
-
notFound();
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
const query = searchParams ? await searchParams : {};
|
|
323
|
-
const sessionId = firstValue(query.session_id);
|
|
324
|
-
|
|
325
|
-
const { sections, accountHref } = await sectionsFor(sessionId, t, locale);
|
|
326
|
-
|
|
327
|
-
return (
|
|
328
|
-
<main>
|
|
329
|
-
<SectionRenderer sections={sections} locale={locale} />
|
|
330
|
-
{accountHref !== null && (
|
|
331
|
-
// Session Replay records the DOM, so the link (it carries the email) is blocked from it.
|
|
332
|
-
<Container className="pb-section">
|
|
333
|
-
<div data-sentry-block>
|
|
334
|
-
<Button asChild size="big">
|
|
335
|
-
<Link
|
|
336
|
-
href={accountHref}
|
|
337
|
-
variant="bare"
|
|
338
|
-
data-testid="purchase-success-account"
|
|
339
|
-
>
|
|
340
|
-
{t("success.openAccount")}
|
|
341
|
-
</Link>
|
|
342
|
-
</Button>
|
|
343
|
-
</div>
|
|
344
|
-
</Container>
|
|
345
|
-
)}
|
|
346
|
-
</main>
|
|
347
|
-
);
|
|
348
|
-
}
|