create-ailk 0.37.1 → 0.39.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 (318) 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 +19 -12
  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 +12 -16
  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 +73 -2
  26. package/dist/routes.d.ts +130 -0
  27. package/dist/routes.js +954 -0
  28. package/dist/site-manifest.js +6 -4
  29. package/dist/site-roster.d.ts +11 -2
  30. package/dist/site-roster.js +63 -21
  31. package/dist/spoke-checkout.d.ts +28 -27
  32. package/dist/spoke-checkout.js +71 -102
  33. package/dist/surfaces.d.ts +26 -0
  34. package/dist/surfaces.js +105 -293
  35. package/dist/sync-routes.d.ts +14 -1
  36. package/dist/sync-routes.js +108 -10
  37. package/dist/template-record.js +3 -1
  38. package/dist/topology.d.ts +26 -1
  39. package/dist/topology.js +273 -7
  40. package/dist/update.d.ts +17 -2
  41. package/dist/update.js +480 -77
  42. package/package.json +3 -3
  43. package/templates/README.md +1 -1
  44. package/templates/apps/mcp/CLAUDE.md +5 -3
  45. package/templates/apps/web/CLAUDE.md +87 -23
  46. package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +5 -1
  47. package/templates/apps/web/__tests__/__mocks__/next-intl.ts +5 -1
  48. package/templates/apps/web/__tests__/auth/seam.test.ts +34 -0
  49. package/templates/apps/web/account.config.tsx +100 -0
  50. package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +1 -1
  51. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +2 -2
  52. package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +1 -1
  53. package/templates/apps/web/app/[locale]/layout.tsx +46 -29
  54. package/templates/apps/web/app/apple-icon.tsx +72 -0
  55. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
  56. package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
  57. package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
  58. package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
  59. package/templates/apps/web/app/og/route.tsx +155 -72
  60. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
  61. package/templates/apps/web/auth.config.tsx +107 -0
  62. package/templates/apps/web/auth.ts +2 -1
  63. package/templates/apps/web/i18n/request.ts +51 -1
  64. package/templates/apps/web/jest.config.cjs +17 -1
  65. package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
  66. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +73 -0
  67. package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
  68. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
  69. package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
  70. package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
  71. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
  72. package/templates/apps/web/lib/listings.tsx +2 -2
  73. package/templates/apps/web/lib/nav-label-keys.ts +16 -2
  74. package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
  75. package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
  76. package/templates/apps/web/lib/profile-back-link.ts +105 -32
  77. package/templates/apps/web/lib/served-pages.ts +95 -0
  78. package/templates/apps/web/lib/server-api.ts +1 -1
  79. package/templates/apps/web/lib/site-brand.tsx +3 -5
  80. package/templates/apps/web/lib/topology.generated.ts +5 -0
  81. package/templates/apps/web/messages/en.json +8 -836
  82. package/templates/apps/web/middleware.ts +15 -26
  83. package/templates/apps/web/next.config.mjs +35 -0
  84. package/templates/apps/web/package.json +2 -0
  85. package/templates/apps/web/types/messages.d.ts +6 -1
  86. package/templates/customizations.yaml +9 -0
  87. package/templates/package.json +3 -1
  88. package/templates/tools/lint-architecture.ts +164 -11
  89. package/versions.json +49 -47
  90. package/templates/apps/web/app/[locale]/(auth)/__tests__/auth-pages.test.tsx +0 -322
  91. package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +0 -554
  92. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/consent-actions.test.ts +0 -56
  93. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/page.test.tsx +0 -164
  94. package/templates/apps/web/app/[locale]/(auth)/consent/consent-form.tsx +0 -132
  95. package/templates/apps/web/app/[locale]/(auth)/consent/consent.actions.ts +0 -51
  96. package/templates/apps/web/app/[locale]/(auth)/consent/page.tsx +0 -144
  97. package/templates/apps/web/app/[locale]/(auth)/forgot-password/forgot-password-card.tsx +0 -101
  98. package/templates/apps/web/app/[locale]/(auth)/forgot-password/page.tsx +0 -111
  99. package/templates/apps/web/app/[locale]/(auth)/layout.tsx +0 -81
  100. package/templates/apps/web/app/[locale]/(auth)/legal-footnote.tsx +0 -35
  101. package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +0 -179
  102. package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +0 -157
  103. package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +0 -126
  104. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/next-path.test.ts +0 -54
  105. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +0 -628
  106. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +0 -43
  107. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +0 -266
  108. package/templates/apps/web/app/[locale]/(auth)/sign-in/next-path.ts +0 -20
  109. package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +0 -234
  110. package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +0 -37
  111. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +0 -323
  112. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +0 -93
  113. package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/page.test.tsx +0 -301
  114. package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/sign-up-card.test.tsx +0 -309
  115. package/templates/apps/web/app/[locale]/(auth)/sign-up/page.tsx +0 -201
  116. package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up-card.tsx +0 -366
  117. package/templates/apps/web/app/[locale]/(auth)/use-auth-card-flow.ts +0 -116
  118. package/templates/apps/web/app/[locale]/(auth)/verify-email/__tests__/actions.test.ts +0 -94
  119. package/templates/apps/web/app/[locale]/(auth)/verify-email/actions.ts +0 -77
  120. package/templates/apps/web/app/[locale]/(auth)/verify-email/page.tsx +0 -154
  121. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
  122. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
  123. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
  124. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
  125. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
  126. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
  127. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
  128. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
  129. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
  130. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
  131. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
  132. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
  133. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
  134. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
  135. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
  136. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
  137. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
  138. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
  139. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
  140. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
  141. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
  142. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
  143. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
  144. package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
  145. package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
  146. package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
  147. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +0 -161
  148. package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
  149. package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
  150. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +0 -139
  151. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +0 -406
  152. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
  153. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
  154. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +0 -190
  155. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
  156. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
  157. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
  158. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
  159. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
  160. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
  161. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +0 -182
  162. package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
  163. package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
  164. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +0 -424
  165. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
  166. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
  167. package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
  168. package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
  169. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
  170. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
  171. package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
  172. package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
  173. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
  174. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
  175. package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
  176. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +0 -218
  177. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
  178. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
  179. package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
  180. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
  181. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
  182. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +0 -119
  183. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
  184. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +0 -80
  185. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
  186. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +0 -125
  187. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
  188. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
  189. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
  190. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
  191. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
  192. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
  193. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +0 -154
  194. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +0 -152
  195. package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
  196. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
  197. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
  198. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +0 -143
  199. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
  200. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
  201. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +0 -126
  202. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +0 -306
  203. package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
  204. package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
  205. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +0 -102
  206. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +0 -240
  207. package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
  208. package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
  209. package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
  210. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +0 -131
  211. package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
  212. package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
  213. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -24
  214. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
  215. package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
  216. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +0 -60
  217. package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
  218. package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
  219. package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
  220. package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
  221. package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
  222. package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
  223. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
  224. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
  225. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
  226. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
  227. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
  228. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
  229. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
  230. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
  231. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
  232. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
  233. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
  234. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
  235. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
  236. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
  237. package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
  238. package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
  239. package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
  240. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
  241. package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
  242. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
  243. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
  244. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
  245. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
  246. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
  247. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
  248. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
  249. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
  250. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
  251. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
  252. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
  253. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
  254. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
  255. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
  256. package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
  257. package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
  258. package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
  259. package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
  260. package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
  261. package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
  262. package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
  263. package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
  264. package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
  265. package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
  266. package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
  267. package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
  268. package/templates/apps/web/app/api/auth/[...all]/route.ts +0 -16
  269. package/templates/apps/web/app/api/auth/hub/__tests__/continuation.test.ts +0 -143
  270. package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +0 -749
  271. package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +0 -964
  272. package/templates/apps/web/app/api/auth/hub/authorize/route.ts +0 -390
  273. package/templates/apps/web/app/api/auth/hub/continuation.ts +0 -127
  274. package/templates/apps/web/app/api/auth/hub/continue/[ref]/__tests__/route.test.ts +0 -188
  275. package/templates/apps/web/app/api/auth/hub/continue/[ref]/route.ts +0 -53
  276. package/templates/apps/web/app/api/auth/hub/email/route.ts +0 -111
  277. package/templates/apps/web/app/api/auth/hub/entry-shared.ts +0 -163
  278. package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +0 -86
  279. package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +0 -368
  280. package/templates/apps/web/app/api/auth/hub/password/return.ts +0 -86
  281. package/templates/apps/web/app/api/auth/hub/password/route.ts +0 -171
  282. package/templates/apps/web/app/api/auth/hub/purchase/route.ts +0 -230
  283. package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +0 -174
  284. package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +0 -60
  285. package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +0 -97
  286. package/templates/apps/web/app/api/auth/mcp/__tests__/continuation.test.ts +0 -92
  287. package/templates/apps/web/app/api/auth/mcp/continuation.ts +0 -89
  288. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/__tests__/route.test.ts +0 -59
  289. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/route.ts +0 -41
  290. package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +0 -1166
  291. package/templates/apps/web/app/api/hub-session/callback/route.ts +0 -134
  292. package/templates/apps/web/app/api/hub-session/email/route.ts +0 -125
  293. package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +0 -49
  294. package/templates/apps/web/app/api/hub-session/one-tap/route.ts +0 -106
  295. package/templates/apps/web/app/api/hub-session/open/route.ts +0 -111
  296. package/templates/apps/web/app/api/hub-session/password/return/route.ts +0 -69
  297. package/templates/apps/web/app/api/hub-session/password/route.ts +0 -106
  298. package/templates/apps/web/app/api/hub-session/sign-in/route.ts +0 -91
  299. package/templates/apps/web/app/api/hub-session/sign-out/route.ts +0 -54
  300. package/templates/apps/web/components/sign-out-trigger.tsx +0 -62
  301. package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
  302. package/templates/apps/web/lib/__tests__/auth-routes.test.ts +0 -140
  303. package/templates/apps/web/lib/account-config.ts +0 -678
  304. package/templates/apps/web/lib/auth-routes.ts +0 -125
  305. package/templates/apps/web/lib/checkout-config.ts +0 -16
  306. package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +0 -433
  307. package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +0 -332
  308. package/templates/apps/web/lib/hub-session/config.ts +0 -110
  309. package/templates/apps/web/lib/hub-session/entry.ts +0 -238
  310. package/templates/apps/web/lib/hub-session/index.ts +0 -21
  311. package/templates/apps/web/lib/hub-session/one-tap.tsx +0 -148
  312. package/templates/apps/web/lib/hub-session/reseal.ts +0 -90
  313. package/templates/apps/web/lib/hub-session/seal.ts +0 -86
  314. package/templates/apps/web/lib/hub-session/session.ts +0 -298
  315. package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +0 -277
  316. package/templates/apps/web/lib/next-path.ts +0 -35
  317. package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
  318. package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
@@ -1,485 +0,0 @@
1
- // oss: false
2
- /**
3
- * Tests for the `/[locale]/flows/[slug]/results/[payload]` cold-load route
4
- * (#4770).
5
- *
6
- * AC3 — a payload encoding a known answer set renders exactly the offer
7
- * names and matched reasons `recommend()` returns for those same
8
- * answers — asserted against the SAME fixture (`FIXTURE_CONFIG` +
9
- * `KNOWN_ANSWERS`) `recommend()` itself would score.
10
- * AC4 — four cases `redirect()` to `/[locale]/flows/[slug]` and render no
11
- * results markup: invalid payload, stale-version payload, a
12
- * flowSlug-mismatched payload, and a non-recommending flow.
13
- * #11013 spec E, D-C (AC-3) — the guard widens additively: a recommending
14
- * flow with no offers and no rows renders whenever `hasResultsPage`
15
- * holds (no ending); a cold permalink of a recommending flow with an
16
- * ending and offers still renders, as at the pin.
17
- *
18
- * `next/navigation`'s `redirect` is mocked to throw (mirrors the sibling
19
- * `thanks/[slug]` route's `notFound` test pattern) so a redirect is
20
- * observable via `.rejects.toThrow` without a real Next.js router. `next-intl`
21
- * is mocked to an identity translator — `ResultsClient`'s only string comes
22
- * from the `flow` namespace's `whyThis` key, which this test does not assert
23
- * on by literal text.
24
- */
25
- import { render, screen } from "@testing-library/react";
26
- import userEvent from "@testing-library/user-event";
27
- import type { FlowConfig } from "@working-theory/validation";
28
- import {
29
- encodePermalink,
30
- PERMALINK_VERSION,
31
- recommend,
32
- resolveLocalizedString,
33
- } from "@working-theory/validation";
34
-
35
- const mockGet = jest.fn();
36
- jest.mock("@working-theory/api-client", () => ({
37
- __esModule: true,
38
- flows: { get: (...args: unknown[]) => mockGet(...args) },
39
- }));
40
-
41
- const mockRedirect = jest.fn((url: string) => {
42
- throw new Error(`NEXT_REDIRECT:${url}`);
43
- });
44
- jest.mock("next/navigation", () => ({
45
- __esModule: true,
46
- redirect: (url: string) => mockRedirect(url),
47
- }));
48
-
49
- jest.mock("next-intl", () => ({
50
- __esModule: true,
51
- useTranslations: () => (key: string) => key,
52
- useMessages: () => ({}),
53
- }));
54
-
55
- import Page, { generateMetadata } from "../page";
56
-
57
- const SLUG = "ailk-recommender";
58
-
59
- const KNOWN_ANSWERS = { team_size: "solo", wants_seo: "yes" };
60
-
61
- function fixtureConfig(overrides: Partial<FlowConfig> = {}): FlowConfig {
62
- return {
63
- slug: SLUG,
64
- defaultLocale: "en",
65
- mode: "recommending",
66
- steps: [
67
- {
68
- key: "team",
69
- type: "segmentation",
70
- copy: { title: { en: "Tell us about your team" } },
71
- questions: [
72
- {
73
- name: "team_size",
74
- options: [
75
- { value: "solo", label: { en: "Solo" } },
76
- { value: "agency", label: { en: "Agency" } },
77
- ],
78
- },
79
- {
80
- name: "wants_seo",
81
- options: [
82
- { value: "yes", label: { en: "Yes" } },
83
- { value: "no", label: { en: "No" } },
84
- ],
85
- },
86
- ],
87
- },
88
- ],
89
- offers: [
90
- {
91
- key: "free_oss",
92
- copy: {
93
- name: { en: "Free" },
94
- description: { en: "Self-serve, open source." },
95
- },
96
- price: { kind: "label", label: { en: "Free" } },
97
- rules: [
98
- {
99
- when: { answer: "team_size", eq: "solo" },
100
- reason: { en: "You're a solo builder." },
101
- },
102
- ],
103
- },
104
- {
105
- key: "seo_addon",
106
- copy: {
107
- name: { en: "SEO Add-on" },
108
- description: { en: "AEO + SEO tuning." },
109
- },
110
- price: { kind: "label", label: { en: "Add-on" } },
111
- rules: [
112
- {
113
- when: { answer: "wants_seo", eq: "yes" },
114
- reason: { en: "You want more organic reach." },
115
- },
116
- ],
117
- },
118
- ],
119
- recommendation: {
120
- key: "recommendation",
121
- copy: { title: { en: "Your recommendation" } },
122
- },
123
- ...overrides,
124
- } as FlowConfig;
125
- }
126
-
127
- beforeEach(() => {
128
- mockGet.mockReset();
129
- mockRedirect.mockClear();
130
- });
131
-
132
- async function expectRedirectTo(
133
- payload: string,
134
- expectedUrl: string,
135
- ): Promise<void> {
136
- await expect(
137
- Page({
138
- params: Promise.resolve({ locale: "en", slug: SLUG, payload }),
139
- }),
140
- ).rejects.toThrow(`NEXT_REDIRECT:${expectedUrl}`);
141
- expect(mockRedirect).toHaveBeenCalledWith(expectedUrl);
142
- }
143
-
144
- describe("AC4 — invalid / stale-version / mismatched / non-recommending all redirect to step 1", () => {
145
- it("redirects on an invalid payload", async () => {
146
- await expectRedirectTo("not-a-valid-payload!!!", `/en/flows/${SLUG}`);
147
- // Never fetched the flow config for an undecodable payload.
148
- expect(mockGet).not.toHaveBeenCalled();
149
- });
150
-
151
- it("redirects on a stale-version payload", async () => {
152
- const stalePayload = encodePermalink({
153
- version: PERMALINK_VERSION - 1,
154
- flowSlug: SLUG,
155
- answers: KNOWN_ANSWERS,
156
- });
157
- await expectRedirectTo(stalePayload, `/en/flows/${SLUG}`);
158
- expect(mockGet).not.toHaveBeenCalled();
159
- });
160
-
161
- it("redirects when the payload's own flowSlug differs from the route's [slug]", async () => {
162
- const mismatchedPayload = encodePermalink({
163
- version: PERMALINK_VERSION,
164
- flowSlug: "a-different-flow",
165
- answers: KNOWN_ANSWERS,
166
- });
167
- await expectRedirectTo(mismatchedPayload, `/en/flows/${SLUG}`);
168
- expect(mockGet).not.toHaveBeenCalled();
169
- });
170
-
171
- it("redirects when the served flow is not a recommending flow (no offers)", async () => {
172
- const payload = encodePermalink({
173
- version: PERMALINK_VERSION,
174
- flowSlug: SLUG,
175
- answers: KNOWN_ANSWERS,
176
- });
177
- const {
178
- offers: _offers,
179
- mode: _mode,
180
- ...nonRecommending
181
- } = fixtureConfig();
182
- mockGet.mockResolvedValueOnce({ ok: true, body: nonRecommending });
183
-
184
- await expectRedirectTo(payload, `/en/flows/${SLUG}`);
185
- });
186
-
187
- it("redirects when the served flow declares mode !== 'recommending'", async () => {
188
- const payload = encodePermalink({
189
- version: PERMALINK_VERSION,
190
- flowSlug: SLUG,
191
- answers: KNOWN_ANSWERS,
192
- });
193
- mockGet.mockResolvedValueOnce({
194
- ok: true,
195
- body: fixtureConfig({ mode: "qualifying" }),
196
- });
197
-
198
- await expectRedirectTo(payload, `/en/flows/${SLUG}`);
199
- });
200
-
201
- it("no results markup renders on any redirect path (renders nothing before throwing)", async () => {
202
- await expect(
203
- Page({
204
- params: Promise.resolve({
205
- locale: "en",
206
- slug: SLUG,
207
- payload: "garbage",
208
- }),
209
- }),
210
- ).rejects.toThrow();
211
- expect(screen.queryByTestId("flow-results")).not.toBeInTheDocument();
212
- });
213
- });
214
-
215
- describe("AC3 — a valid payload against a recommending flow renders exactly recommend()'s fits", () => {
216
- it("renders exactly the offer names and matched reasons recommend() itself returns for the same answers", async () => {
217
- const user = userEvent.setup();
218
- const config = fixtureConfig();
219
- const payload = encodePermalink({
220
- version: PERMALINK_VERSION,
221
- flowSlug: SLUG,
222
- answers: KNOWN_ANSWERS,
223
- });
224
- mockGet.mockResolvedValueOnce({ ok: true, body: config });
225
-
226
- // The SAME fixture (`config` + `KNOWN_ANSWERS`) drives BOTH the mocked
227
- // server response AND this expectation — `recommend()` is the one
228
- // source of truth for "which fits, in what order, with which reason,"
229
- // never a second hand-typed list that could silently drift from it.
230
- const expected = recommend(
231
- {
232
- key: SLUG,
233
- offers: config.offers,
234
- pairings: config.pairings,
235
- rateTable: config.rateTable,
236
- scoring: config.scoring,
237
- },
238
- KNOWN_ANSWERS,
239
- );
240
- expect(expected.fits.length).toBeGreaterThan(0);
241
-
242
- const element = await Page({
243
- params: Promise.resolve({ locale: "en", slug: SLUG, payload }),
244
- });
245
- render(element);
246
-
247
- expect(mockRedirect).not.toHaveBeenCalled();
248
- expect(screen.getByTestId("flow-results")).toBeInTheDocument();
249
- expect(
250
- screen.getByRole("heading", {
251
- name: resolveLocalizedString(
252
- config.recommendation!.copy.title,
253
- "en",
254
- config.defaultLocale,
255
- ),
256
- }),
257
- ).toBeInTheDocument();
258
-
259
- for (const fit of expected.fits) {
260
- const offer = config.offers!.find((o) => o.key === fit.offerKey)!;
261
- const name = resolveLocalizedString(
262
- offer.copy.name,
263
- "en",
264
- config.defaultLocale,
265
- );
266
- // #11013 D-G — the top fit alone renders, as one card; the side panel
267
- // and every other fit are gone from the results view.
268
- if (fit.offerKey !== expected.fits[0]!.offerKey) {
269
- expect(screen.queryByText(name)).not.toBeInTheDocument();
270
- expect(screen.queryByTestId(`recommendation-card-${fit.offerKey}`)).not.toBeInTheDocument();
271
- continue;
272
- }
273
- expect(screen.getAllByText(name)).toHaveLength(1);
274
- if (offer.copy.description) {
275
- expect(
276
- screen.getByText(
277
- resolveLocalizedString(
278
- offer.copy.description,
279
- "en",
280
- config.defaultLocale,
281
- ),
282
- ),
283
- ).toBeInTheDocument();
284
- }
285
-
286
- // The matched reason renders inside the "Why this?" Popover
287
- // disclosure — reveal it (mirrors packages/ui/src/blocks/__tests__/
288
- // RecommendationCard.test.tsx's own click-to-reveal pattern).
289
- await user.click(
290
- screen.getByTestId(`recommendation-card-${fit.offerKey}-why-trigger`),
291
- );
292
- expect(
293
- await screen.findByText(
294
- resolveLocalizedString(fit.reason, "en", config.defaultLocale),
295
- ),
296
- ).toBeInTheDocument();
297
- }
298
- });
299
- });
300
-
301
- // ─── #11013 spec E, D-C (AC-3) — the widened guard ─────────────────────────
302
-
303
- describe("#11013 D-C — the results page serves every flow with a results page", () => {
304
- const validPayload = (): string =>
305
- encodePermalink({ version: PERMALINK_VERSION, flowSlug: SLUG, answers: KNOWN_ANSWERS });
306
-
307
- it("a recommending flow with no offers, no by-result rows and no ending renders ResultsClient", async () => {
308
- const { offers: _offers, ...noOffers } = fixtureConfig();
309
- mockGet.mockResolvedValueOnce({ ok: true, body: noOffers });
310
- render(await Page({ params: Promise.resolve({ locale: "en", slug: SLUG, payload: validPayload() }) }));
311
- expect(mockRedirect).not.toHaveBeenCalled();
312
- expect(screen.getByTestId("flow-results")).toBeInTheDocument();
313
- expect(screen.queryAllByTestId(/^recommendation-card-[a-z_]+$/)).toHaveLength(0);
314
- });
315
-
316
- it("a flow that is not recommending still redirects, offers or not", async () => {
317
- mockGet.mockResolvedValueOnce({ ok: true, body: fixtureConfig({ mode: "qualifying" }) });
318
- await expectRedirectTo(validPayload(), `/en/flows/${SLUG}`);
319
- });
320
-
321
- it("a recommending flow with an ending and offers still renders from a cold permalink (today's guard)", async () => {
322
- mockGet.mockResolvedValueOnce({
323
- ok: true,
324
- body: fixtureConfig({ ending: { default: { kind: "screen", headline: { en: "Done" } } } } as Partial<FlowConfig>),
325
- });
326
- render(await Page({ params: Promise.resolve({ locale: "en", slug: SLUG, payload: validPayload() }) }));
327
- expect(mockRedirect).not.toHaveBeenCalled();
328
- expect(screen.getByTestId("flow-results")).toBeInTheDocument();
329
- });
330
-
331
- it("a recommending flow with an ending and no offers or rows redirects (no results page)", async () => {
332
- const { offers: _offers, ...noOffers } = fixtureConfig();
333
- mockGet.mockResolvedValueOnce({
334
- ok: true,
335
- body: { ...noOffers, ending: { default: { kind: "screen", headline: { en: "Done" } } } },
336
- });
337
- await expectRedirectTo(validPayload(), `/en/flows/${SLUG}`);
338
- });
339
-
340
- it("hands ResultsClient the frame's brand and the exit to the flow's landing", async () => {
341
- mockGet.mockResolvedValueOnce({ ok: true, body: fixtureConfig() });
342
- render(await Page({ params: Promise.resolve({ locale: "en", slug: SLUG, payload: validPayload() }) }));
343
- expect(screen.getByTestId("flow-frame-exit-link").getAttribute("href")).toBe(`/en/flows/${SLUG}`);
344
- expect(screen.getByTestId("flow-frame-title")).toHaveTextContent("Tell us about your team");
345
- expect(screen.getByTestId("flow-frame-logomark")).toBeInTheDocument();
346
- expect(screen.getByTestId("flow-frame-wordmark")).toBeInTheDocument();
347
- expect(screen.queryByTestId("flow-frame-bar")).not.toBeInTheDocument();
348
- });
349
- });
350
-
351
- describe("generateMetadata", () => {
352
- it("resolves the page title from the compiled recommendation marker", async () => {
353
- const payload = encodePermalink({
354
- version: PERMALINK_VERSION,
355
- flowSlug: SLUG,
356
- answers: KNOWN_ANSWERS,
357
- });
358
- mockGet.mockResolvedValueOnce({ ok: true, body: fixtureConfig() });
359
-
360
- const metadata = await generateMetadata({
361
- params: Promise.resolve({ locale: "en", slug: SLUG, payload }),
362
- });
363
- expect(metadata.title).toBe("Your recommendation");
364
- });
365
-
366
- it("returns an empty metadata object for an invalid payload", async () => {
367
- const metadata = await generateMetadata({
368
- params: Promise.resolve({
369
- locale: "en",
370
- slug: SLUG,
371
- payload: "garbage",
372
- }),
373
- });
374
- expect(metadata).toEqual({});
375
- expect(mockGet).not.toHaveBeenCalled();
376
- });
377
- });
378
-
379
- describe("#10990 AC-4 — a failed flow read redirects to the landing, never throws", () => {
380
- const validPayload = (): string =>
381
- encodePermalink({ version: PERMALINK_VERSION, flowSlug: SLUG, answers: KNOWN_ANSWERS });
382
-
383
- it.each([
384
- ["a rejected read", () => mockGet.mockRejectedValue(new TypeError("fetch failed"))],
385
- ["a 2xx with no body", () => mockGet.mockResolvedValue({ ok: true, body: undefined })],
386
- ["a 2xx with {}", () => mockGet.mockResolvedValue({ ok: true, body: {} })],
387
- ["a 503", () => mockGet.mockResolvedValue({ ok: false, status: 503, body: null })],
388
- ["a 403", () => mockGet.mockResolvedValue({ ok: false, status: 403, body: null })],
389
- ])("%s: Page redirects to /en/flows/<slug> and generateMetadata is {}", async (_label, arrange) => {
390
- arrange();
391
- const payload = validPayload();
392
- await expectRedirectTo(payload, `/en/flows/${SLUG}`);
393
- await expect(
394
- generateMetadata({ params: Promise.resolve({ locale: "en", slug: SLUG, payload }) }),
395
- ).resolves.toEqual({});
396
- });
397
-
398
- it("a read that never answers redirects after 5 seconds", async () => {
399
- jest.useFakeTimers();
400
- try {
401
- mockGet.mockReturnValue(new Promise(() => undefined));
402
- const rendering = Page({
403
- params: Promise.resolve({ locale: "en", slug: SLUG, payload: validPayload() }),
404
- });
405
- const settled = expect(rendering).rejects.toThrow(`NEXT_REDIRECT:/en/flows/${SLUG}`);
406
- await jest.advanceTimersByTimeAsync(5_000);
407
- await settled;
408
- } finally {
409
- jest.useRealTimers();
410
- }
411
- });
412
- });
413
-
414
- // ─── #4842 AC-5 — the `?checkout=` return states (additive; the cases above
415
- // are the regression floor and stay as they were) ───────────────────────────
416
-
417
- describe("AC-5 (#4842) — ?checkout= return states render over the same recommendation", () => {
418
- function validPayload(): string {
419
- return encodePermalink({
420
- version: PERMALINK_VERSION,
421
- flowSlug: SLUG,
422
- answers: KNOWN_ANSWERS,
423
- });
424
- }
425
-
426
- async function renderWithSearch(
427
- checkout: string | undefined,
428
- ): Promise<ReturnType<typeof recommend>> {
429
- const config = fixtureConfig();
430
- mockGet.mockResolvedValueOnce({ ok: true, body: config });
431
- const expected = recommend(
432
- {
433
- key: SLUG,
434
- offers: config.offers,
435
- pairings: config.pairings,
436
- rateTable: config.rateTable,
437
- scoring: config.scoring,
438
- },
439
- KNOWN_ANSWERS,
440
- );
441
- const element = await Page({
442
- params: Promise.resolve({ locale: "en", slug: SLUG, payload: validPayload() }),
443
- searchParams: Promise.resolve(checkout === undefined ? {} : { checkout }),
444
- });
445
- render(element);
446
- expect(mockRedirect).not.toHaveBeenCalled();
447
- return expected;
448
- }
449
-
450
- function expectIdenticalFits(expected: ReturnType<typeof recommend>): void {
451
- expect(expected.fits.length).toBeGreaterThan(0);
452
- // #11013 D-G — the top fit is the one card.
453
- expect(screen.getByTestId(`recommendation-card-${expected.fits[0]!.offerKey}`)).toBeInTheDocument();
454
- expect(screen.getAllByTestId(/^recommendation-card-[a-z_]+$/)).toHaveLength(1);
455
- }
456
-
457
- it("?checkout=success renders the success status line AND the identical fit cards", async () => {
458
- const expected = await renderWithSearch("success");
459
- expect(screen.getByTestId("flow-results-return-state")).toHaveTextContent("checkoutSuccess");
460
- expect(screen.getByRole("status")).toBeInTheDocument();
461
- expectIdenticalFits(expected);
462
- });
463
-
464
- it("?checkout=cancelled renders the cancelled status line AND the identical fit cards", async () => {
465
- const expected = await renderWithSearch("cancelled");
466
- expect(screen.getByTestId("flow-results-return-state")).toHaveTextContent("checkoutCancelled");
467
- expectIdenticalFits(expected);
468
- });
469
-
470
- it("an unrecognised value renders no status line; the fits are unchanged", async () => {
471
- const expected = await renderWithSearch("bogus");
472
- expect(screen.queryByTestId("flow-results-return-state")).not.toBeInTheDocument();
473
- expectIdenticalFits(expected);
474
- });
475
-
476
- it("a return param never changes which redirect guard fires (invalid payload still redirects to step 1)", async () => {
477
- await expect(
478
- Page({
479
- params: Promise.resolve({ locale: "en", slug: SLUG, payload: "not-a-valid-payload!!!" }),
480
- searchParams: Promise.resolve({ checkout: "success" }),
481
- }),
482
- ).rejects.toThrow(`NEXT_REDIRECT:/en/flows/${SLUG}`);
483
- expect(mockGet).not.toHaveBeenCalled();
484
- });
485
- });