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.
Files changed (230) hide show
  1. package/README.md +129 -0
  2. package/component-catalog.json +44 -6
  3. package/component-catalog.md +6 -5
  4. package/dist/add-module.js +16 -1
  5. package/dist/add-route.d.ts +2 -2
  6. package/dist/add-route.js +18 -11
  7. package/dist/cli.js +52 -0
  8. package/dist/declined-routes.d.ts +13 -0
  9. package/dist/declined-routes.js +74 -0
  10. package/dist/derive-architecture.d.ts +0 -6
  11. package/dist/derive-architecture.js +9 -15
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +3 -0
  14. package/dist/language-import.d.ts +93 -0
  15. package/dist/language-import.js +270 -43
  16. package/dist/lib/import-mdx.js +1 -1
  17. package/dist/lib/scaffold-render-sweep.d.ts +6 -3
  18. package/dist/lib/scaffold-render-sweep.js +8 -4
  19. package/dist/migrate-content.d.ts +6 -2
  20. package/dist/migrate-content.js +62 -5
  21. package/dist/module-architecture.js +139 -103
  22. package/dist/paid-sections.d.ts +13 -0
  23. package/dist/paid-sections.js +35 -5
  24. package/dist/programmatic.js +6 -16
  25. package/dist/remove-module.js +67 -0
  26. package/dist/routes.d.ts +103 -0
  27. package/dist/routes.js +708 -0
  28. package/dist/site-manifest.js +1 -1
  29. package/dist/site-roster.d.ts +2 -1
  30. package/dist/site-roster.js +30 -8
  31. package/dist/spoke-checkout.d.ts +28 -27
  32. package/dist/spoke-checkout.js +71 -102
  33. package/dist/surfaces.d.ts +18 -0
  34. package/dist/surfaces.js +47 -282
  35. package/dist/sync-routes.d.ts +14 -1
  36. package/dist/sync-routes.js +86 -5
  37. package/dist/topology.d.ts +15 -1
  38. package/dist/topology.js +20 -4
  39. package/dist/update.d.ts +17 -2
  40. package/dist/update.js +480 -77
  41. package/package.json +3 -3
  42. package/templates/README.md +1 -1
  43. package/templates/apps/mcp/CLAUDE.md +5 -3
  44. package/templates/apps/web/CLAUDE.md +62 -20
  45. package/templates/apps/web/account.config.tsx +101 -0
  46. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
  47. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
  48. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
  49. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
  50. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
  51. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
  52. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
  53. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
  54. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
  55. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
  56. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
  57. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
  58. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
  59. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
  60. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
  61. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
  62. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
  63. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
  64. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
  65. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
  66. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
  67. package/templates/apps/web/app/[locale]/layout.tsx +45 -28
  68. package/templates/apps/web/app/apple-icon.tsx +72 -0
  69. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
  70. package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
  71. package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
  72. package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
  73. package/templates/apps/web/app/og/route.tsx +155 -72
  74. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
  75. package/templates/apps/web/i18n/request.ts +44 -1
  76. package/templates/apps/web/jest.config.cjs +13 -1
  77. package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
  78. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
  79. package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
  80. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
  81. package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
  82. package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
  83. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
  84. package/templates/apps/web/lib/listings.tsx +2 -2
  85. package/templates/apps/web/lib/nav-label-keys.ts +16 -2
  86. package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
  87. package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
  88. package/templates/apps/web/lib/profile-back-link.ts +105 -32
  89. package/templates/apps/web/lib/served-pages.ts +95 -0
  90. package/templates/apps/web/lib/site-brand.tsx +3 -5
  91. package/templates/apps/web/messages/en.json +8 -684
  92. package/templates/apps/web/middleware.ts +3 -1
  93. package/templates/apps/web/next.config.mjs +27 -0
  94. package/templates/apps/web/package.json +1 -0
  95. package/templates/customizations.yaml +9 -0
  96. package/templates/package.json +3 -1
  97. package/templates/tools/lint-architecture.ts +164 -11
  98. package/versions.json +48 -47
  99. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
  100. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
  101. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
  102. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
  103. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
  104. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
  105. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
  106. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
  107. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
  108. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
  109. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
  110. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
  111. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
  112. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
  113. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
  114. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
  115. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
  116. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
  117. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
  118. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
  119. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
  120. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
  121. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
  122. package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
  123. package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
  124. package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
  125. package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
  126. package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
  127. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
  128. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
  129. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
  130. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
  131. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
  132. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
  133. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
  134. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
  135. package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
  136. package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
  137. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
  138. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
  139. package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
  140. package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
  141. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
  142. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
  143. package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
  144. package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
  145. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
  146. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
  147. package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
  148. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
  149. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
  150. package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
  151. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
  152. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
  153. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
  154. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
  155. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
  156. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
  157. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
  158. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
  159. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
  160. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
  161. package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
  162. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
  163. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
  164. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
  165. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
  166. package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
  167. package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
  168. package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
  169. package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
  170. package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
  171. package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
  172. package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
  173. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
  174. package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
  175. package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
  176. package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
  177. package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
  178. package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
  179. package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
  180. package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
  181. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
  182. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
  183. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
  184. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
  185. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
  186. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
  187. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
  188. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
  189. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
  190. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
  191. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
  192. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
  193. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
  194. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
  195. package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
  196. package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
  197. package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
  198. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
  199. package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
  200. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
  201. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
  202. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
  203. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
  204. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
  205. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
  206. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
  207. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
  208. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
  209. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
  210. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
  211. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
  212. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
  213. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
  214. package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
  215. package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
  216. package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
  217. package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
  218. package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
  219. package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
  220. package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
  221. package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
  222. package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
  223. package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
  224. package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
  225. package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
  226. package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
  227. package/templates/apps/web/lib/account-config.ts +0 -678
  228. package/templates/apps/web/lib/checkout-config.ts +0 -16
  229. package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
  230. package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
@@ -1,420 +0,0 @@
1
- // oss: false
2
- /**
3
- * /[locale]/flows/[slug]/results/[payload] — the cold-load results route
4
- * (#4770).
5
- *
6
- * Server-fetches the flow config through `served-flow.ts`'s
7
- * `readServedFlow(slug)`, uncached (always dynamically rendered — the config
8
- * is DB-backed live data); any failed read redirects to the landing (#10990
9
- * D3).
10
- * Decodes the versioned, answers-only permalink (`decodePermalink`,
11
- * `@working-theory/validation`) and `redirect()`s to `/[locale]/flows/[slug]`
12
- * — step 1, never an error page — on ANY of: an invalid payload (FR6), a
13
- * stale-version payload (FR6), a payload whose own `flowSlug` does not match
14
- * this route's `[slug]` (D2/FR6), or a served flow that is not a
15
- * recommending register (D8 — `mode !== "recommending"`, or neither `offers`
16
- * nor `recommendation.byResult` (#10827) nor a results page — #11013 D-C:
17
- * spec C's `hasResultsPage`, a recommending flow with no `ending`, widens the
18
- * guard additively, so every flow the page rendered before still renders —
19
- * checked against the field `recommend()` is about to be handed rather than
20
- * inferring the compiler's five-keys-travel-together guarantee).
21
- *
22
- * On a valid payload against a recommending flow, renders `ResultsClient`,
23
- * which runs the already-shipped pure `recommend()` in the browser and
24
- * renders the returned fits through the existing `RecommendationCard`
25
- * (D10 — a minimal render; Epic #4759 recomposes it against the LOCKED
26
- * DESIGN.md).
27
- *
28
- * `?checkout=success|cancelled` (#4842 FR7/D6) is read only after every
29
- * guard above and rendered by `ResultsClient` as a one-line status over the
30
- * identical recommendation.
31
- *
32
- * #9071 D3 — the recommender's landing. A flow with an offer carrying a
33
- * string `lookupKey` (an Offerings recommender) never renders here: after
34
- * the recommending guard the page redirects to `/<locale>/pricing?plan=<plan>`
35
- * when the first fit's lookup key is in the current shown set — read from
36
- * `offerings.shown()`, the endpoint `/pricing` renders from, through this
37
- * page's own read shared per instance for 15 seconds — and to `/<locale>/pricing` with no badge otherwise (no fit, a
38
- * key no longer shown, any failed read). The URL is built only from an
39
- * allowlisted locale and a `parseLookupKey` plan. A flow with no such offer,
40
- * or whose first fit carries none, renders as before with no read.
41
- *
42
- * #10827 — the by-result rows. `recommend()` returns the first matching
43
- * row's `routeTo` (a legacy offer rule read as a row when the flow carries
44
- * no `recommendation.byResult`; the landing above is that row's checkout
45
- * kind for a `{plan}` key). A checkout row with a full lookup key goes
46
- * straight to the Offerings buy route while the key is shown; an offering
47
- * row — or a checkout row whose offering is not shown, a draft — renders
48
- * the results page with one card named from the offering, priced only
49
- * while the offering is shown.
50
- *
51
- * #11013 D-A, D-G — the page builds the frame's brand on the server (the
52
- * site's logomark and wordmark, the landing title) and the exit to the
53
- * flow's landing, and resolves the magnet's Email-links-to offering
54
- * (`conversionLink.kind === "offering"`, spec C) from the same shown set as
55
- * a Product card, only when no by-result card won (decision 15). The
56
- * appointment card is the scheduling layout's (`../layout.tsx`, D-K); this
57
- * file imports nothing from scheduling.
58
- */
59
- import { offerings } from "@working-theory/api-client";
60
- import { Image } from "@working-theory/ui/primitives";
61
- import {
62
- decodePermalink,
63
- type FlowConfig,
64
- type FlowConversionLink,
65
- type FlowResultRouteTo,
66
- flowRecommendRegister,
67
- hasResultsPage,
68
- parseLookupKey,
69
- recommend,
70
- resolveLocalizedString,
71
- shownOfferingsAnswerSchema,
72
- type WaitlistAnswers,
73
- type WorkspaceShownSetWire,
74
- } from "@working-theory/validation";
75
- import type { Metadata } from "next";
76
- import { redirect } from "next/navigation";
77
- import type { ReactElement } from "react";
78
-
79
- import { offeringsCheckoutHref } from "../../../../../../lib/offerings-pricing";
80
- import { siteLogo, siteWordmarkAsset } from "../../../../../../lib/site-logo";
81
- import { apiOriginConfigured, readServedFlow } from "../../served-flow";
82
-
83
- import type {
84
- ResultsConversionCard,
85
- ResultsOfferingCard,
86
- ResultsReturnState,
87
- } from "./ResultsClient";
88
- import { ResultsClient } from "./ResultsClient";
89
-
90
- export const dynamic = "force-dynamic";
91
-
92
- interface Props {
93
- params: Promise<{ locale: string; slug: string; payload: string }>;
94
- /** FR7 (#4842) — `?checkout=success|cancelled` after Stripe's hosted page. */
95
- searchParams?: Promise<Record<string, string | string[] | undefined>>;
96
- }
97
-
98
- /**
99
- * D6 (#4842) — the return micro-state, validated against the two literals;
100
- * anything else (absent, an array, an unknown value) renders no status line.
101
- */
102
- function resolveReturnState(
103
- value: string | string[] | undefined,
104
- ): ResultsReturnState | undefined {
105
- return value === "success" || value === "cancelled" ? value : undefined;
106
- }
107
-
108
- // Mirrors `ResultsClient.tsx` — a path is built only from an enabled locale.
109
- const DEFAULT_LOCALE = "en";
110
- const ENABLED_LOCALES = (
111
- process.env.NEXT_PUBLIC_ENABLED_LOCALES ?? DEFAULT_LOCALE
112
- ).split(",");
113
-
114
- /** #9071 D3a — `/pricing`'s and the buy route's window. */
115
- const SHOWN_READ_TTL_MS = 15_000;
116
- /** #9071 NFR-4 — no landing read holds a visitor longer than this. */
117
- const SHOWN_READ_TIMEOUT_MS = 5_000;
118
-
119
- let shownRead:
120
- | { at: number; read: Promise<WorkspaceShownSetWire | null> }
121
- | undefined;
122
-
123
- /**
124
- * #9071 D3a — the current shown set, or `null` for "nothing shown": no API
125
- * origin in production (no call), `unconnected`, `empty`, an expired set, a
126
- * non-2xx, a body the schema refuses, a throw, or no answer within 5 s.
127
- * Concurrent and failed reads are shared like a good one.
128
- */
129
- function readCurrentShownSet(): Promise<WorkspaceShownSetWire | null> {
130
- if (process.env.NODE_ENV === "production" && !apiOriginConfigured()) {
131
- return Promise.resolve(null);
132
- }
133
- const now = Date.now();
134
- if (shownRead && now - shownRead.at < SHOWN_READ_TTL_MS) return shownRead.read;
135
- const read = (async (): Promise<WorkspaceShownSetWire | null> => {
136
- let timer: ReturnType<typeof setTimeout> | undefined;
137
- try {
138
- const timeout = new Promise<null>((resolve) => {
139
- timer = setTimeout(() => resolve(null), SHOWN_READ_TIMEOUT_MS);
140
- });
141
- const res = await Promise.race([offerings.shown(), timeout]);
142
- if (res === null || !res.ok) return null;
143
- const parsed = shownOfferingsAnswerSchema.safeParse(res.body);
144
- if (!parsed.success || parsed.data.status !== "shown") return null;
145
- return parsed.data.shownSet.state === "current" ? parsed.data.shownSet : null;
146
- } catch {
147
- return null;
148
- } finally {
149
- clearTimeout(timer);
150
- }
151
- })();
152
- shownRead = { at: now, read };
153
- return read;
154
- }
155
-
156
- function isOfferingsOffer(offer: unknown): boolean {
157
- return (
158
- typeof offer === "object" &&
159
- offer !== null &&
160
- typeof (offer as { lookupKey?: unknown }).lookupKey === "string"
161
- );
162
- }
163
-
164
- /** #10827 — a shown set's prices of `offeringKey`: its own key, else its plan's. */
165
- function shownPricesOf(shown: WorkspaceShownSetWire | null, offeringKey: string) {
166
- const exact = parseLookupKey(offeringKey);
167
- const plan = exact?.plan ?? offeringKey;
168
- const product = shown?.offerings.find((o) => o.prices.some((p) => p.plan === plan));
169
- const prices = product?.prices ?? [];
170
- return {
171
- plan,
172
- product,
173
- price:
174
- exact !== null
175
- ? prices.find((p) => p.lookupKey === offeringKey)
176
- : (prices.find((p) => p.period === "monthly") ?? prices[0]),
177
- };
178
- }
179
-
180
- /** `/pricing`'s last guard before markup: no format or control characters. */
181
- function cleanProductText(value: string): string {
182
- return value.replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}\p{Cs}]/gu, "");
183
- }
184
-
185
- /**
186
- * The shown product's Stripe description and marketing features, for the
187
- * Product card (#11013 D-G), cleaned as `/pricing`'s `features()` cleans them:
188
- * a feature that is nothing but format characters is dropped.
189
- */
190
- function productCopy(
191
- product: WorkspaceShownSetWire["offerings"][number] | undefined,
192
- ): Pick<ResultsOfferingCard, "description" | "features"> {
193
- if (product === undefined) return {};
194
- const description = product.description !== null ? cleanProductText(product.description) : "";
195
- return {
196
- ...(description.length > 0 ? { description } : {}),
197
- features: product.marketingFeatures.map(cleanProductText).filter((feature) => feature.length > 0),
198
- };
199
- }
200
-
201
- type ResultLanding =
202
- | { kind: "redirect"; url: string }
203
- | { kind: "render"; card?: ResultsOfferingCard };
204
-
205
- /**
206
- * #9071 D3 / #10827 — where a completed walk lands: a redirect (the
207
- * `/pricing?plan=` landing, or checkout), or the results page with the
208
- * matched row's offering card. The served config is not re-parsed here, so
209
- * every read of it is shape-checked and any throw renders as before.
210
- */
211
- async function resultLanding(
212
- config: FlowConfig,
213
- answers: WaitlistAnswers,
214
- locale: string,
215
- ): Promise<ResultLanding> {
216
- try {
217
- const byResult: unknown = config.recommendation?.byResult;
218
- const authored = Array.isArray(byResult);
219
- const offers: unknown = config.offers;
220
- if (!authored && !(Array.isArray(offers) && offers.some(isOfferingsOffer))) {
221
- return { kind: "render" };
222
- }
223
-
224
- let routeTo: FlowResultRouteTo | undefined;
225
- try {
226
- routeTo = recommend(flowRecommendRegister(config), answers).routeTo;
227
- } catch {
228
- routeTo = undefined;
229
- }
230
-
231
- const safeLocale = ENABLED_LOCALES.includes(locale) ? locale : DEFAULT_LOCALE;
232
- const base = `/${safeLocale}/pricing`;
233
- if (routeTo === undefined || routeTo.kind === "none") {
234
- // An Offerings recommender with no fit lands on /pricing with no badge.
235
- return authored ? { kind: "render" } : { kind: "redirect", url: base };
236
- }
237
- if (!authored && routeTo.kind === "offering") return { kind: "render" };
238
-
239
- const { offeringKey } = routeTo;
240
- const shown = await readCurrentShownSet();
241
- const { plan, product, price } = shownPricesOf(shown, offeringKey);
242
- // Built from the shown set's own grammar-checked Price, never the config key.
243
- let checkoutHref: string | null = null;
244
- if (routeTo.kind === "checkout") {
245
- // A `{plan}` key lands on /pricing?plan=. A full key goes straight to
246
- // the buy route — from the browser (`ResultsClient`), because the walk
247
- // arrives by a client-side navigation and the buy route refuses
248
- // anything but a top-level document load.
249
- if (price !== undefined && parseLookupKey(offeringKey) === null) {
250
- return { kind: "redirect", url: `${base}?plan=${price.plan}` };
251
- }
252
- if (price !== undefined) checkoutHref = offeringsCheckoutHref(price.lookupKey);
253
- if (checkoutHref === null && !authored) return { kind: "redirect", url: base };
254
- }
255
-
256
- // An offering's card — or a checkout row's offering not shown (a draft).
257
- const legacy = Array.isArray(offers)
258
- ? (offers as unknown[]).find(
259
- (o): o is { copy: { name: Parameters<typeof resolveLocalizedString>[0] } } =>
260
- typeof o === "object" &&
261
- o !== null &&
262
- (o as { key?: unknown }).key === offeringKey &&
263
- (o as { copy?: { name?: unknown } }).copy?.name !== undefined,
264
- )
265
- : undefined;
266
- const title =
267
- (product !== undefined ? cleanProductText(product.name) : undefined) ??
268
- (legacy
269
- ? resolveLocalizedString(legacy.copy.name, locale, config.defaultLocale)
270
- : plan.charAt(0).toUpperCase() + plan.slice(1).replace(/-/g, " "));
271
- return {
272
- kind: "render",
273
- card: {
274
- offeringKey,
275
- title,
276
- ...productCopy(product),
277
- ...(price !== undefined
278
- ? {
279
- price: { amount: price.amount, currency: price.currency, period: price.period },
280
- href: checkoutHref ?? `${base}?plan=${price.plan}`,
281
- }
282
- : {}),
283
- ...(checkoutHref !== null ? { checkoutOnLoad: true } : {}),
284
- },
285
- };
286
- } catch {
287
- return { kind: "render" };
288
- }
289
- }
290
-
291
- /**
292
- * #11013 D-G (3) — Email links to an offering: the shown product's Product
293
- * card, with Get Started to its `/pricing?plan=` landing; a product not in
294
- * the shown set (a draft) gives none. Resolved only when no by-result card
295
- * won, so the link never costs a second read.
296
- */
297
- async function offeringConversionCard(
298
- link: FlowConversionLink,
299
- locale: string,
300
- ): Promise<ResultsConversionCard | undefined> {
301
- if (link.kind !== "offering") return undefined;
302
- try {
303
- const shown = await readCurrentShownSet();
304
- const { plan, product, price } = shownPricesOf(shown, link.id);
305
- if (product === undefined) return undefined;
306
- const safeLocale = ENABLED_LOCALES.includes(locale) ? locale : DEFAULT_LOCALE;
307
- return {
308
- kind: "product",
309
- name: cleanProductText(product.name),
310
- ...productCopy(product),
311
- ...(price !== undefined
312
- ? { price: { amount: price.amount, currency: price.currency, period: price.period } }
313
- : {}),
314
- href: `/${safeLocale}/pricing?plan=${price?.plan ?? plan}`,
315
- };
316
- } catch {
317
- return undefined;
318
- }
319
- }
320
-
321
- /** The landing title — the record's `landing.title`, else step 1's (`magnet-page.tsx`'s `landingCopy`). */
322
- function landingTitle(config: FlowConfig, locale: string): string {
323
- const pick = (value: Record<string, string> | undefined): string | undefined =>
324
- value === undefined ? undefined : resolveLocalizedString(value, locale, config.defaultLocale);
325
- return pick(config.landing?.title) ?? pick(config.steps[0]!.copy.title) ?? config.slug;
326
- }
327
-
328
- export async function generateMetadata({ params }: Props): Promise<Metadata> {
329
- const { locale, slug, payload } = await params;
330
-
331
- const decoded = decodePermalink(payload);
332
- if (!decoded.ok || decoded.value.flowSlug !== slug) return {};
333
-
334
- const read = await readServedFlow(slug);
335
- if (read.kind !== "ok") return {};
336
-
337
- const { recommendation } = read.config;
338
- if (!recommendation) return {};
339
-
340
- return {
341
- title: resolveLocalizedString(
342
- recommendation.copy.title,
343
- locale,
344
- read.config.defaultLocale,
345
- ),
346
- };
347
- }
348
-
349
- export default async function Page({
350
- params,
351
- searchParams,
352
- }: Props): Promise<ReactElement> {
353
- const { locale, slug, payload } = await params;
354
-
355
- const decoded = decodePermalink(payload);
356
- if (!decoded.ok) {
357
- redirect(`/${locale}/flows/${slug}`);
358
- }
359
- if (decoded.value.flowSlug !== slug) {
360
- redirect(`/${locale}/flows/${slug}`);
361
- }
362
-
363
- // #10990 D3 — any failed read (refused, non-2xx, a 2xx that is not a
364
- // flow, no answer within 5 s) lands on the flow's page, never a 500.
365
- const read = await readServedFlow(slug);
366
- if (read.kind !== "ok") {
367
- redirect(`/${locale}/flows/${slug}`);
368
- }
369
- const config = read.config as FlowConfig & { conversionLink?: FlowConversionLink };
370
- // #11013 D-C — today's condition, plus spec C's results-page predicate.
371
- if (
372
- config.mode !== "recommending" ||
373
- (config.offers === undefined &&
374
- config.recommendation?.byResult === undefined &&
375
- !hasResultsPage(config))
376
- ) {
377
- redirect(`/${locale}/flows/${slug}`);
378
- }
379
-
380
- const landing = await resultLanding(
381
- config,
382
- decoded.value.answers,
383
- locale,
384
- );
385
- if (landing.kind === "redirect") redirect(landing.url);
386
-
387
- // #11013 decision 15 — Email links to, after a by-result card.
388
- const conversionCard =
389
- landing.card === undefined && config.conversionLink !== undefined
390
- ? await offeringConversionCard(config.conversionLink, locale)
391
- : undefined;
392
-
393
- // FR7 — read AFTER every redirect guard above, so a return param never
394
- // changes which guard fires or where it sends the visitor.
395
- const returnState = resolveReturnState((await searchParams)?.checkout);
396
-
397
- // #11013 D-A — the frame's brand, built here because `site-logo.tsx` reads
398
- // site config on the server; the exit leaves for the flow's landing.
399
- const safeLocale = ENABLED_LOCALES.includes(locale) ? locale : DEFAULT_LOCALE;
400
- const brand = {
401
- logomark: siteLogo(),
402
- wordmark: <Image {...siteWordmarkAsset()} />,
403
- title: landingTitle(config, locale),
404
- };
405
-
406
- return (
407
- <ResultsClient
408
- config={config}
409
- locale={locale}
410
- answers={decoded.value.answers}
411
- slug={slug}
412
- payload={payload}
413
- brand={brand}
414
- exitHref={`/${safeLocale}/flows/${slug}`}
415
- {...(landing.card !== undefined ? { offeringCard: landing.card } : {})}
416
- {...(conversionCard !== undefined ? { conversionCard } : {})}
417
- {...(returnState !== undefined ? { returnState } : {})}
418
- />
419
- );
420
- }
@@ -1,85 +0,0 @@
1
- // oss: false
2
- "use server";
3
-
4
- /**
5
- * save.actions.ts — Get your full report (#11013 spec E, D-F): validates with
6
- * `flowSaveInputSchema`, calls `flows.resultsEmail` — spec C's
7
- * `POST /v1/flows/:slug/results-email`, which writes the Lead, records the
8
- * form's consents and runs the magnet's conversion email — and answers
9
- * `{ ok: true }`, never an id. It replaced "Email me this plan"
10
- * (`saveRecommendationAction` → `flows.save`, #4842 D7), which wrote a Lead
11
- * but ran no conversion. A sibling of `flow.actions.ts` (ADR 0013
12
- * `*.actions.ts`).
13
- *
14
- * A thin forwarder (SEC-E-1): the controls on who may attach an email and
15
- * how often mail is sent — session ownership, dedupe, consent, the
16
- * per-recipient, per-workspace and per-IP limits — are the route's; this
17
- * action adds the same slug and body parse, bot check and visitor-IP
18
- * forwarding its predecessor had, and no trust boundary in the site.
19
- *
20
- * Split out of `checkout.actions.ts` by #6786: the results page's email
21
- * moment ships with the page (the `flows` surface, signal-collectors), while
22
- * `startCheckoutAction` stays commerce's. The shared validation,
23
- * IP-forwarding and status → kind helpers are `email-moment.ts`.
24
- */
25
-
26
- import { flows } from "@working-theory/api-client";
27
- import type { FlowSaveInput } from "@working-theory/validation";
28
- import {
29
- flowSaveInputSchema,
30
- flowSlugSchema,
31
- } from "@working-theory/validation";
32
-
33
- import { runBotCheck } from "../../../../lib/bot-check";
34
-
35
- import type { EmailMomentFailure } from "./email-moment";
36
- import {
37
- emailMomentFields,
38
- errorName,
39
- failureFor,
40
- resolveVisitorIpInit,
41
- } from "./email-moment";
42
-
43
- export type ResultsEmailActionResult = { ok: true } | EmailMomentFailure;
44
-
45
- export async function sendResultsEmailAction(
46
- slug: string,
47
- body: FlowSaveInput,
48
- ): Promise<ResultsEmailActionResult> {
49
- const parsedSlug = flowSlugSchema.safeParse(slug);
50
- if (!parsedSlug.success) return { ok: false, kind: "invalid_input" };
51
-
52
- const parsed = flowSaveInputSchema.safeParse(body);
53
- if (!parsed.success) return { ok: false, kind: "invalid_input" };
54
-
55
- const payload = emailMomentFields(parsed.data);
56
-
57
- // #9255 D4 — the spoke edge's bot check, after the input checks and before
58
- // the write.
59
- const botCheck = await runBotCheck({
60
- source: "bot-check",
61
- target: "sendResultsEmailAction",
62
- scope: "write",
63
- });
64
- if (botCheck !== "pass") return { ok: false, kind: "unavailable" };
65
-
66
- try {
67
- const visitorIpInit = await resolveVisitorIpInit();
68
- const res = visitorIpInit
69
- ? await flows.resultsEmail(parsedSlug.data, payload, visitorIpInit)
70
- : await flows.resultsEmail(parsedSlug.data, payload);
71
- if (!res.ok) {
72
- const failure = failureFor(res);
73
- console.error(
74
- `[sendResultsEmailAction] slug=${parsedSlug.data} kind=${failure.kind} status=${res.status}`,
75
- );
76
- return failure;
77
- }
78
- return { ok: true };
79
- } catch (err) {
80
- console.error(
81
- `[sendResultsEmailAction] slug=${parsedSlug.data} kind=network errName=${errorName(err)}`,
82
- );
83
- return { ok: false, kind: "network" };
84
- }
85
- }
@@ -1,91 +0,0 @@
1
- // oss: false
2
- /**
3
- * served-flow.ts — the one read of a served flow config (#10990 D1).
4
- *
5
- * `readServedFlow(slug)` asks the hub (`flows.get`) and answers one of four
6
- * kinds. It is shared by the magnet pages (`magnet-page.tsx`'s `readMagnet`,
7
- * which adds a 15-second per-instance cache) and the results permalink
8
- * (`results/[payload]/page.tsx`, uncached). It imports nothing of either
9
- * page's render graph, so the results route can load it alone.
10
- *
11
- * - `ok` only for a 2xx whose body is a served flow (`isServedFlow`).
12
- * - `absent` only for a 404 (the hub's `flow_not_found`: no such flow, or a
13
- * draft).
14
- * - `not-configured` for the hub's 503 `flows_not_configured`, or a failed
15
- * read with no API origin configured (#9219).
16
- * - `unavailable` for everything else: a refused connection, any other
17
- * non-2xx (5xx, 401, 403, 429, …), a 2xx that is not a served flow, and no
18
- * answer within 5 seconds. A firewall's 403 or a block page's 2xx therefore
19
- * shows the site's contact email, never a 404 or a 500.
20
- */
21
- import { flows } from "@working-theory/api-client";
22
- import type { FlowConfig } from "@working-theory/validation";
23
-
24
- import { browserApiOrigin } from "../../../../lib/api-origin.generated";
25
-
26
- export type MagnetRead =
27
- | { kind: "ok"; config: FlowConfig }
28
- | { kind: "absent" }
29
- | { kind: "unavailable" }
30
- | { kind: "not-configured" };
31
-
32
- /** No flow read holds a visitor longer than this (the results page's #9071 NFR-4 value). */
33
- export const SERVED_FLOW_TIMEOUT_MS = 5_000;
34
-
35
- /**
36
- * Whether an API origin is configured: the three names `getApiBase()` in
37
- * packages/api-client/src/http.ts reads, in step with it on a hub. Without one
38
- * that function answers `localhost:3001`. The browser-facing origin comes from
39
- * the topology seam (#7874 D12), which a spoke renders with no env read, so a
40
- * spoke passes its own `env:check` (#9480). A spoke diverges on purpose: the
41
- * browser-facing name set on one at runtime counts as no origin here.
42
- */
43
- export function apiOriginConfigured(): boolean {
44
- return Boolean(
45
- process.env.AILK_API_URL ||
46
- browserApiOrigin() ||
47
- process.env.NEXT_PUBLIC_API_URL,
48
- );
49
- }
50
-
51
- /** The flows route's own answer when its hub has no database (apps/api `flows_not_configured`). */
52
- function isFlowsNotConfigured(body: unknown): boolean {
53
- const error = (body as { error?: { code?: unknown } } | null)?.error;
54
- return error?.code === "flows_not_configured";
55
- }
56
-
57
- /** A read that failed: `not-configured` when there is no hub to ask, else `unavailable`. */
58
- function failedRead(): MagnetRead {
59
- return apiOriginConfigured() ? { kind: "unavailable" } : { kind: "not-configured" };
60
- }
61
-
62
- /**
63
- * Whether a 2xx body is a served flow: only what the renderers dereference
64
- * before any schema-checked path. Deliberately not `flowConfigSchema` — the
65
- * hub parses the config before serving it, and a spoke's schema can be older
66
- * than its hub's.
67
- */
68
- export function isServedFlow(body: unknown): body is FlowConfig {
69
- if (typeof body !== "object" || body === null) return false;
70
- const { slug, steps } = body as { slug?: unknown; steps?: unknown };
71
- return typeof slug === "string" && Array.isArray(steps) && steps.length > 0;
72
- }
73
-
74
- /** The served flow config for `slug`, classified (D1). */
75
- export async function readServedFlow(slug: string): Promise<MagnetRead> {
76
- let timer: ReturnType<typeof setTimeout> | undefined;
77
- try {
78
- const timeout = new Promise<null>((resolve) => {
79
- timer = setTimeout(() => resolve(null), SERVED_FLOW_TIMEOUT_MS);
80
- });
81
- const res = await Promise.race([flows.get(slug), timeout]);
82
- if (res === null) return failedRead();
83
- if (res.ok) return isServedFlow(res.body) ? { kind: "ok", config: res.body } : failedRead();
84
- if (res.status === 503 && isFlowsNotConfigured(res.body)) return { kind: "not-configured" };
85
- return res.status === 404 ? { kind: "absent" } : failedRead();
86
- } catch {
87
- return failedRead();
88
- } finally {
89
- clearTimeout(timer);
90
- }
91
- }
@@ -1,32 +0,0 @@
1
- // oss: false
2
- /**
3
- * /[locale]/flows/[slug]/start — the flow half of the two-route tool
4
- * (#5053 D3/D5). Standard magnet page (#8840): rendered by
5
- * `magnet-page.tsx`'s `renderMagnetStart`, chrome-free with the back arrow to
6
- * `/flows/<slug>` (`lib/magnet-routes.ts`).
7
- *
8
- * `flowRouteMetadata` (`@working-theory/metadata`, mounted by the renderer)
9
- * supplies `noindex, follow` — the whole point of D4 is that this route does
10
- * NOT write the robots value, it gets it from what it mounts. `follow`, not
11
- * `nofollow`: the links out of a flow still carry.
12
- */
13
- import type { Metadata } from "next";
14
- import type { ReactElement } from "react";
15
-
16
- import { renderMagnetStart, renderMagnetStartMetadata } from "../magnet-page";
17
-
18
- export const dynamic = "force-dynamic";
19
-
20
- interface Props {
21
- params: Promise<{ locale: string; slug: string }>;
22
- }
23
-
24
- export async function generateMetadata({ params }: Props): Promise<Metadata> {
25
- const { locale, slug } = await params;
26
- return renderMagnetStartMetadata({ slug, locale });
27
- }
28
-
29
- export default async function Page({ params }: Props): Promise<ReactElement> {
30
- const { locale, slug } = await params;
31
- return renderMagnetStart({ slug, locale, backHref: `/flows/${slug}` });
32
- }