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,277 +0,0 @@
1
- /**
2
- * SpokeSignIn — the signed-out account page of a spoke that signs in through
3
- * its hub (#11096 D1, D9, D10; spec docs/specs/11096-the-spoke-hosts-the-sign-spec.md).
4
- *
5
- * A Server Component, rendered by the `(authed)` layout through the generated
6
- * gate seam (`signed-out-gate.generated.tsx`, its `signIn: "hub"` render) for
7
- * every signed-out account path. The person never sees the hub's brand here:
8
- *
9
- * - **The form.** One email field, the hub's sign-up agreements under a
10
- * "New here?" line (unticked; ticking them makes the request a sign-up),
11
- * and Continue with Google. It is a native `<form method="post">` to this
12
- * site's `/api/hub-session/email`, inside `AuthCard`'s `body` (#9662), so
13
- * it works without JavaScript. No password field, ever (D5), and no link
14
- * to a hub page: Google goes to this site's own sign-in route with
15
- * `provider=google`, which the hub's authorize step turns into Google.
16
- * The agreements' policy links are the hub's (D3).
17
- * - **Its states**, read from the middleware's `x-search` (a layout gets no
18
- * `searchParams`): `?sent=1` (check your email), `?error=agreements |
19
- * unavailable | exists | claim`.
20
- * - **The purchase link** (`?claim=`, D9): "Open your account", the
21
- * agreements' statements and one "Open my account" button whose form
22
- * POSTs the claim to `/api/hub-session/open`. No checkbox: the click is the
23
- * acceptance. Rendering it changes nothing (SEC-11096-3).
24
- * - **One Tap** (D10): the `OneTap` island, only when the spoke sets
25
- * `AILK_HUB_ONE_TAP=on` and its hub reports a client id.
26
- *
27
- * Not configured (`hubSessionConfig()` is `null`), it says sign-in isn't
28
- * available yet and links back to the site. Nothing here logs a claim or
29
- * anything `x-search` carries.
30
- */
31
- import { localeHref } from "@working-theory/ui";
32
- import { AuthCard, ConsentStatement } from "@working-theory/ui/blocks";
33
- import { NavBackLink } from "@working-theory/ui/chrome";
34
- import {
35
- Button,
36
- Checkbox,
37
- Field,
38
- InlineMessage,
39
- Input,
40
- Link,
41
- Text,
42
- } from "@working-theory/ui/primitives";
43
- import { type HubSignUpAgreement, hubPurchaseClaimSchema } from "@working-theory/validation";
44
- import { getTranslations } from "next-intl/server";
45
- import type { ReactElement, ReactNode } from "react";
46
-
47
- import { SITE_NAME } from "../site-brand";
48
- import { siteLogo } from "../site-logo";
49
-
50
- import { hubSessionConfig } from "./config";
51
- import { readHubSignUp, readOneTapClientId } from "./entry";
52
- import { OneTap } from "./one-tap";
53
- import { HUB_SESSION_FALLBACK_PATH, hubNextPath } from "./session";
54
-
55
- /** The spoke's own routes the page posts or links to. */
56
- const EMAIL_ROUTE = "/api/hub-session/email";
57
- const OPEN_ROUTE = "/api/hub-session/open";
58
- const SIGN_IN_ROUTE = "/api/hub-session/sign-in";
59
-
60
- export interface SpokeSignInProps {
61
- locale: string;
62
- /** The incoming request's headers: `x-pathname` and `x-search` (middleware). */
63
- requestHeaders: Headers;
64
- }
65
-
66
- type Translate = Awaited<ReturnType<typeof getTranslations>>;
67
-
68
- /** The one value of `name` in `search`, or `null` (absent or repeated). */
69
- function single(search: URLSearchParams, name: string): string | null {
70
- const values = search.getAll(name);
71
- return values.length === 1 ? (values[0] ?? null) : null;
72
- }
73
-
74
- /** The page's frame: the back arrow, then the card (the account gate's own shape, #8790). */
75
- function Frame({
76
- locale,
77
- backLabel,
78
- card,
79
- }: {
80
- locale: string;
81
- backLabel: string;
82
- card: ReactNode;
83
- }): ReactElement {
84
- return (
85
- <div className="flex min-h-screen flex-col" data-testid="account-sign-in-gate">
86
- <header className="flex h-16 items-center px-5 md:px-8" data-testid="account-sign-in-gate-header">
87
- <NavBackLink href={localeHref(locale, "/")} label={backLabel} />
88
- </header>
89
- <div className="flex flex-1 flex-col items-center md:justify-center md:py-section">
90
- {/* AuthShell's 400px column: the cap sits on the wrapper, never on the card. */}
91
- <div className="w-full max-w-100">{card}</div>
92
- </div>
93
- </div>
94
- );
95
- }
96
-
97
- /** One agreement's checkbox and statement; posts its purpose id under `agreements`. */
98
- function AgreementRow({ agreement }: { agreement: HubSignUpAgreement }): ReactElement {
99
- const id = `spoke-sign-in-agreement-${agreement.purposeId}`;
100
- return (
101
- <div className="flex items-start gap-3">
102
- <Checkbox
103
- id={id}
104
- name="agreements"
105
- value={agreement.purposeId}
106
- aria-labelledby={`${id}-statement`}
107
- className="mt-0.5"
108
- data-testid={id}
109
- />
110
- <ConsentStatement id={`${id}-statement`} statement={agreement.statement} policies={agreement.policies} />
111
- </div>
112
- );
113
- }
114
-
115
- /** The line a `?error=` state puts above the form, or `null`. */
116
- function errorLine(error: string | null, t: Translate): ReactNode {
117
- const lines: Record<string, [string, string]> = {
118
- unavailable: ["spoke-sign-in-unavailable", t("unavailable")],
119
- exists: ["spoke-sign-in-exists", t("exists")],
120
- claim: ["spoke-sign-in-claim-error", t("claimInvalid")],
121
- };
122
- const line = error === null ? undefined : lines[error];
123
- if (line === undefined) return null;
124
- return (
125
- <InlineMessage variant={error === "exists" ? "default" : "error"} role="alert" data-testid={line[0]}>
126
- {line[1]}
127
- </InlineMessage>
128
- );
129
- }
130
-
131
- export async function SpokeSignIn({ locale, requestHeaders }: SpokeSignInProps): Promise<ReactElement> {
132
- const t = await getTranslations({ locale, namespace: "account.spokeSignIn" });
133
- const gate = await getTranslations({ locale, namespace: "account.gate" });
134
- const config = hubSessionConfig();
135
-
136
- if (config === null) {
137
- return (
138
- <Frame
139
- locale={locale}
140
- backLabel={gate("homeLink")}
141
- card={
142
- <AuthCard
143
- intent="sign-in"
144
- footer="none"
145
- headingLevel={1}
146
- logo={siteLogo()}
147
- labels={{ signInHeading: gate("emptyHeadline") }}
148
- subhead={gate("emptyDescription")}
149
- body={
150
- <Button asChild variant="secondary" size="big" className="w-full">
151
- <Link href={localeHref(locale, "/")} variant="bare" data-testid="account-sign-in-gate-home">
152
- {gate("homeLink")}
153
- </Link>
154
- </Button>
155
- }
156
- />
157
- }
158
- />
159
- );
160
- }
161
-
162
- const search = new URLSearchParams(requestHeaders.get("x-search") ?? "");
163
- const next = hubNextPath(
164
- requestHeaders.get("x-pathname") ?? localeHref(locale, HUB_SESSION_FALLBACK_PATH),
165
- );
166
- const info = await readHubSignUp(config, locale);
167
- const agreements = info?.signUpOpen ? info.agreements : [];
168
- const error = single(search, "error");
169
- const rawClaim = single(search, "claim");
170
- const claim = rawClaim !== null && hubPurchaseClaimSchema.safeParse(rawClaim).success ? rawClaim : null;
171
- const card = (heading: string, subhead: string, body: ReactNode): ReactElement => (
172
- <Frame
173
- locale={locale}
174
- backLabel={gate("homeLink")}
175
- card={
176
- <AuthCard
177
- intent="sign-in"
178
- footer="none"
179
- headingLevel={1}
180
- logo={siteLogo()}
181
- labels={{ signInHeading: heading }}
182
- subhead={subhead}
183
- body={body}
184
- />
185
- }
186
- />
187
- );
188
-
189
- // D9 — the purchase link. Without the hub's agreements to show, there is
190
- // nothing to accept, so no button: the form takes over.
191
- if (claim !== null && agreements.length > 0) {
192
- return card(
193
- t("openHeading"),
194
- t("openLead"),
195
- <form method="post" action={OPEN_ROUTE} className="flex flex-col gap-4" data-testid="spoke-sign-in-open-form">
196
- <Input type="hidden" name="claim" value={claim} />
197
- <div className="flex flex-col gap-2" data-testid="spoke-sign-in-open-terms">
198
- {agreements.map((agreement) => (
199
- <ConsentStatement
200
- key={agreement.purposeId}
201
- statement={agreement.statement}
202
- policies={agreement.policies}
203
- />
204
- ))}
205
- </div>
206
- <Button type="submit" size="big" className="w-full" data-testid="spoke-sign-in-open">
207
- {t("open")}
208
- </Button>
209
- </form>,
210
- );
211
- }
212
-
213
- if (single(search, "sent") === "1") {
214
- return card(
215
- t("sent"),
216
- t("sentBody"),
217
- <div className="flex flex-col gap-4" data-testid="spoke-sign-in-sent">
218
- <Button asChild variant="secondary" size="big" className="w-full">
219
- <Link href={next} variant="bare" data-testid="spoke-sign-in-back">
220
- {t("back")}
221
- </Link>
222
- </Button>
223
- </div>,
224
- );
225
- }
226
-
227
- const oneTapClientId = config.oneTap ? await readOneTapClientId(config) : null;
228
- const googleHref = `${SIGN_IN_ROUTE}?${new URLSearchParams({ next, provider: "google" }).toString()}`;
229
- return card(
230
- t("heading", { site: SITE_NAME }),
231
- t("subhead"),
232
- <div className="flex flex-col gap-4">
233
- {errorLine(claim !== null ? "unavailable" : error, t)}
234
- <form method="post" action={EMAIL_ROUTE} className="flex flex-col gap-4" data-testid="spoke-sign-in-form">
235
- <Input type="hidden" name="next" value={next} />
236
- <Field label={t("emailLabel")} htmlFor="spoke-sign-in-email">
237
- <Input
238
- type="email"
239
- name="email"
240
- required
241
- autoComplete="email"
242
- size="big"
243
- data-testid="auth-email"
244
- />
245
- </Field>
246
- {agreements.length > 0 ? (
247
- <fieldset className="flex flex-col gap-3" data-testid="spoke-sign-in-agreements">
248
- <legend className="mb-2">
249
- <Text as="span" variant="body-sm" tone="muted">
250
- {t("newHere")}
251
- </Text>
252
- </legend>
253
- {error === "agreements" ? (
254
- <InlineMessage variant="error" role="alert" data-testid="spoke-sign-in-agreements-error">
255
- {t("agreementsError")}
256
- </InlineMessage>
257
- ) : null}
258
- {agreements.map((agreement) => (
259
- <AgreementRow key={agreement.purposeId} agreement={agreement} />
260
- ))}
261
- </fieldset>
262
- ) : null}
263
- <Button type="submit" size="big" className="w-full" data-testid="spoke-sign-in-submit">
264
- {t("submit")}
265
- </Button>
266
- </form>
267
- {info?.google ? (
268
- <Button asChild variant="secondary" size="big" className="w-full">
269
- <Link href={googleHref} variant="bare" data-testid="spoke-sign-in-google">
270
- {t("google")}
271
- </Link>
272
- </Button>
273
- ) : null}
274
- {oneTapClientId !== null ? <OneTap clientId={oneTapClientId} next={next} /> : null}
275
- </div>,
276
- );
277
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * `?next=` sanitizer for the /sign-in page (#4984) and the hub-session
3
- * callback (#7894 D7 — moved here from `app/[locale]/(auth)/sign-in/`, which
4
- * re-exports it, so a spoke that drops the `(auth)` group keeps it).
5
- *
6
- * The post-sign-in `callbackURL` handed to Better Auth is caller-controlled
7
- * via the `next` search param, so it must be a SAME-ORIGIN, SAME-APP path —
8
- * never a foreign origin (open redirect), a protocol-relative URL, a
9
- * backslash trick browsers normalise to `//`, or a control character that
10
- * could split a header. Anything that fails falls back to `fallback`.
11
- */
12
-
13
- // U+0000–U+001F and U+007F — the header-splitting / URL-mangling range.
14
- // eslint-disable-next-line no-control-regex -- the control range is the thing being rejected
15
- const CONTROL_CHARS = /[\x00-\x1f\x7f]/;
16
-
17
- /**
18
- * Returns `raw` when it is a safe in-app path, else `fallback`.
19
- *
20
- * Accepts: a string starting with a single "/" (e.g. `/account`,
21
- * `/en/account?tab=x`, `/waitlist#a`).
22
- * Rejects: non-strings (incl. Next's `string[]` for a repeated param), "",
23
- * `//host` (protocol-relative), `/\host` (backslash normalised to `//`),
24
- * any backslash anywhere, whitespace, control characters, and anything not
25
- * starting with "/" (`https://…`, `host.tld`).
26
- */
27
- export function resolveNextPath(raw: unknown, fallback: string): string {
28
- if (typeof raw !== "string") return fallback;
29
- if (!raw.startsWith("/")) return fallback;
30
- if (raw.startsWith("//")) return fallback;
31
- if (raw.includes("\\")) return fallback;
32
- if (/\s/.test(raw)) return fallback;
33
- if (CONTROL_CHARS.test(raw)) return fallback;
34
- return raw;
35
- }
@@ -1,57 +0,0 @@
1
- // oss: false
2
- /**
3
- * #7536 AC-4 — `ensureCommerceSectionsRegistered()` loads the paid package
4
- * through the generated registry and fails loud: absence (a stub's `null`)
5
- * answers `false`, a present package whose import rejects propagates, and one
6
- * process registers at most once. Each case isolates the module so its
7
- * memoised `registration` starts fresh.
8
- */
9
- const REGISTRY = "../../../lib/paid-sections.generated";
10
-
11
- type Ensure = () => Promise<boolean>;
12
-
13
- function load(loadUiCommerce: jest.Mock): Ensure {
14
- let ensure: Ensure | undefined;
15
- jest.isolateModules(() => {
16
- jest.doMock(REGISTRY, () => ({ loadUiCommerce }));
17
- ensure = (
18
- require("../commerce-sections") as { ensureCommerceSectionsRegistered: Ensure }
19
- ).ensureCommerceSectionsRegistered;
20
- });
21
- if (!ensure) throw new Error("commerce-sections did not load");
22
- return ensure;
23
- }
24
-
25
- afterEach(() => {
26
- jest.dontMock(REGISTRY);
27
- });
28
-
29
- describe("ensureCommerceSectionsRegistered", () => {
30
- it("registers once and answers true when the registry loads the package", async () => {
31
- const spy = jest.fn();
32
- const loader = jest.fn().mockResolvedValue({ registerCommerceSections: spy });
33
- const ensure = load(loader);
34
-
35
- await expect(ensure()).resolves.toBe(true);
36
- await expect(ensure()).resolves.toBe(true);
37
- expect(spy).toHaveBeenCalledTimes(1);
38
- expect(loader).toHaveBeenCalledTimes(1);
39
- });
40
-
41
- it("answers false and registers nothing when the registry answers null (package not carried)", async () => {
42
- const loader = jest.fn().mockResolvedValue(null);
43
- const ensure = load(loader);
44
-
45
- await expect(ensure()).resolves.toBe(false);
46
- expect(loader).toHaveBeenCalledTimes(1);
47
- });
48
-
49
- it("lets a rejected import reject — never degrades to false — and stays memoised", async () => {
50
- const loader = jest.fn().mockRejectedValue(new Error("chunk"));
51
- const ensure = load(loader);
52
-
53
- await expect(ensure()).rejects.toThrow("chunk");
54
- await expect(ensure()).rejects.toThrow("chunk");
55
- expect(loader).toHaveBeenCalledTimes(1);
56
- });
57
- });
@@ -1,55 +0,0 @@
1
- // oss: false
2
- import { loadUiCommerce } from "../../lib/paid-sections.generated";
3
-
4
- /**
5
- * Registers the paid `@working-theory/ui-commerce` slice's sections
6
- * (`payment-receipt`) once per process, through the generated paid-sections
7
- * registry (#6084, #7536).
8
- *
9
- * `/purchase/success` and `/purchase/cancel` ship in the BASE TREE
10
- * (`surfaces.ts` `CORE_ROUTE_DIRS`, D12) so a site that buys the `commerce`
11
- * add-on after its last deploy gets working return pages without a redeploy.
12
- * This file stays in the base tree for the same reason (#6084 D12, disposed
13
- * again on #6440): slicing it out would take the return pages with it.
14
- *
15
- * Whether the paid package is carried is decided at SCAFFOLD time, not here.
16
- * `create-ailk` writes `apps/web/lib/paid-sections.generated.ts` from this
17
- * app's `package.json`: a carried package is a plain `import()` that webpack
18
- * bundles, and an absent one is a stub that answers `null`. So a KEYLESS build
19
- * type-checks and builds with no paid package anywhere in its import graph, and
20
- * `loadUiCommerce()` answers `null` there. The earlier runtime-loaded import
21
- * handed resolution to Node's ESM loader, which cannot read our `dist` and
22
- * answered `false` in production (#7536).
23
- *
24
- * On success, the real `payment-receipt` renderer is registered and the
25
- * caller may build a `payment-receipt` section as usual. On `false` (the
26
- * package is not carried), the caller MUST NOT construct a bare
27
- * `payment-receipt` section anyway — `SectionRenderer`'s dispatch table falls
28
- * back to `ModuleAbsent`, which renders `null` in production
29
- * (`packages/ui/src/sections/ModuleAbsent.tsx`) — silently dropping the
30
- * title/message/status that is this page's entire point. The caller must
31
- * build an OSS `content-block` fallback carrying the same copy instead.
32
- *
33
- * A package that IS carried but whose import rejects is a broken deploy: the
34
- * rejection propagates and the page errors, never degrading to `false`. Only
35
- * absence degrades, and only a stub produces it.
36
- *
37
- * Registered (or found absent) once per process — memoised, so a concurrent
38
- * request never double-registers. A rejected registration stays memoised: a
39
- * process cannot recover from a bundled chunk that fails. This is a
40
- * build-presence fact, not the license claim itself (which
41
- * `resolveCommerceClaim()` deliberately re-checks every request).
42
- */
43
- let registration: Promise<boolean> | undefined;
44
-
45
- export function ensureCommerceSectionsRegistered(): Promise<boolean> {
46
- if (!registration) {
47
- registration = (async () => {
48
- const mod = await loadUiCommerce();
49
- if (mod === null) return false;
50
- mod.registerCommerceSections();
51
- return true;
52
- })();
53
- }
54
- return registration;
55
- }