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,426 +0,0 @@
1
- /**
2
- * The Appointments pages (#11154).
3
- *
4
- * `/account/appointments` and `/account/appointments/[slug]`, rendered as the
5
- * RSCs they are, with the api-client's `member.meetingTypes` (the offer) and
6
- * `schedule.meetings` (the Cal.com link) as the two mocked reads. Covers:
7
- * - the list renders `AccountListFrame`'s table Title · Duration · Price in
8
- * the read's order, a chevron on every row, each row opening the type's
9
- * booking page, the All count, and the phone rows' "<duration> · <price>"
10
- * captions; a priced type reads its price, an unpriced one "Free";
11
- * - an empty offer and a 404 (and a 401/403 while the email is unverified)
12
- * are the empty line; any other failure is the error row with Retry and
13
- * no frame (7423 D12);
14
- * - the booking page is one H1 over the `scheduler-embed` section (provider
15
- * cal, month view, the tight gap) built from the member read's Cal.com
16
- * link with the member's name and verified email as the section's
17
- * `prefill` (the booker opens with both filled), and "← All
18
- * appointments" under it;
19
- * - a slug the member read does not serve answers "This appointment type is
20
- * no longer offered." with no embed and no public read; a type the member read
21
- * gives no link is the error row; a dotted or malformed segment and
22
- * no session are not-found.
23
- */
24
-
25
- import { render, screen, within } from "@testing-library/react";
26
-
27
- jest.mock("next-intl/server", () => {
28
- const msgs: unknown = require("../../../../../../messages/en.json");
29
- const dig = (obj: unknown, path: string): unknown =>
30
- path
31
- .split(".")
32
- .reduce<unknown>(
33
- (acc, k) =>
34
- acc !== null && typeof acc === "object"
35
- ? (acc as Record<string, unknown>)[k]
36
- : undefined,
37
- obj,
38
- );
39
- return {
40
- __esModule: true,
41
- getTranslations: async (
42
- arg: string | { namespace?: string; locale?: string },
43
- ) => {
44
- const ns = typeof arg === "string" ? arg : (arg.namespace ?? "");
45
- const messages = dig(msgs, ns);
46
- return (key: string, values?: Record<string, unknown>): string => {
47
- const value = dig(messages, key);
48
- if (typeof value !== "string") return `${ns}.${key}`;
49
- return value.replace(/\{(\w+)\}/g, (m, name: string) =>
50
- values && name in values ? String(values[name]) : m,
51
- );
52
- };
53
- },
54
- };
55
- });
56
-
57
- jest.mock("next/headers", () => ({
58
- __esModule: true,
59
- headers: jest.fn().mockResolvedValue(new Headers()),
60
- cookies: jest.fn().mockResolvedValue({ toString: () => "session=abc" }),
61
- }));
62
-
63
- const mockGetSession = jest.fn();
64
- // eslint-disable-next-line no-restricted-syntax -- #507: mock-internal rewrite pending; auth.ts's lazy Better-Auth singleton has no HTTP/DB boundary a unit test of the session fields can mock without standing up Prisma.
65
- jest.mock("../../../../../../auth", () => ({
66
- __esModule: true,
67
- auth: {
68
- api: { getSession: (...args: unknown[]) => mockGetSession(...args) },
69
- },
70
- }));
71
-
72
- const mockMeetingTypes = jest.fn();
73
- const mockMeetings = jest.fn();
74
- jest.mock("@working-theory/api-client", () => ({
75
- __esModule: true,
76
- waitlistSignups: { me: jest.fn() },
77
- subscription: { me: jest.fn() },
78
- member: { meetingTypes: (...args: unknown[]) => mockMeetingTypes(...args) },
79
- schedule: { meetings: (...args: unknown[]) => mockMeetings(...args) },
80
- }));
81
-
82
- const mockNotFound = jest.fn(() => {
83
- throw new Error("NEXT_NOT_FOUND");
84
- });
85
- jest.mock("next/navigation", () => ({
86
- __esModule: true,
87
- notFound: () => mockNotFound(),
88
- useRouter: () => ({ push: jest.fn(), refresh: jest.fn() }),
89
- usePathname: () => "/account/appointments",
90
- }));
91
-
92
- // Render the real catalog, keeping the sections the page handed it: the Cal.com
93
- // island mounts its iframe in an effect, so the calLink is read from the data.
94
- const capturedSections: unknown[] = [];
95
- jest.mock("@working-theory/ui/sections", () => {
96
- const actual = jest.requireActual<
97
- typeof import("@working-theory/ui/sections")
98
- >("@working-theory/ui/sections");
99
- return {
100
- __esModule: true,
101
- ...actual,
102
- SectionRenderer: (props: Parameters<typeof actual.SectionRenderer>[0]) => {
103
- capturedSections.splice(0, capturedSections.length, ...props.sections);
104
- return actual.SectionRenderer(props);
105
- },
106
- };
107
- });
108
-
109
- import BookingPage, { memberBookerSection } from "../[slug]/page";
110
- import ListPage from "../page";
111
-
112
- /** The cookie a single site forwards (`forwardedCookieInit()`). */
113
- const INIT = { headers: { cookie: "session=abc" } };
114
-
115
- const VERIFIED = {
116
- user: {
117
- id: "user_1",
118
- name: "Ada",
119
- email: "ada@example.com",
120
- emailVerified: true,
121
- },
122
- };
123
- const UNVERIFIED = { user: { ...VERIFIED.user, emailVerified: false } };
124
-
125
- const TYPES = [
126
- {
127
- slug: "consult",
128
- title: "Consultation",
129
- durationMinutes: 30,
130
- price: { amountMinor: 5000, currency: "usd" },
131
- calLink: "sam/consult",
132
- },
133
- {
134
- slug: "review",
135
- title: "Design review",
136
- durationMinutes: 60,
137
- calLink: "sam/review",
138
- },
139
- {
140
- slug: "free-chat",
141
- title: "Free chat",
142
- durationMinutes: 15,
143
- price: { amountMinor: 0, currency: "usd" },
144
- },
145
- ];
146
-
147
- /** The public read: never consulted by the member pages (#11154); kept to assert it. */
148
- const MEETINGS = [
149
- {
150
- slug: "consult",
151
- visibility: "public",
152
- position: 0,
153
- bookable: true,
154
- calLink: "sam/consult",
155
- title: "Consultation",
156
- durationMinutes: 30,
157
- },
158
- {
159
- slug: "review",
160
- visibility: "public",
161
- position: 1,
162
- bookable: true,
163
- calLink: "sam/review",
164
- title: "Design review",
165
- durationMinutes: 60,
166
- },
167
- { slug: "gone", visibility: "public", position: 2, bookable: false },
168
- ];
169
-
170
- const ok = <T,>(body: T) => ({ ok: true, body });
171
- const refused = (status: number, code = "x") => ({
172
- ok: false,
173
- status,
174
- body: { ok: false, error: { code, message: "x" } },
175
- });
176
-
177
- beforeEach(() => {
178
- mockGetSession.mockReset().mockResolvedValue(VERIFIED);
179
- mockMeetingTypes.mockReset().mockResolvedValue(ok({ items: TYPES }));
180
- mockMeetings.mockReset().mockResolvedValue(ok({ meetings: MEETINGS }));
181
- mockNotFound.mockClear();
182
- capturedSections.length = 0;
183
- jest.spyOn(console, "error").mockImplementation(() => undefined);
184
- });
185
-
186
- afterEach(() => {
187
- jest.restoreAllMocks();
188
- });
189
-
190
- async function renderList(): Promise<void> {
191
- render(await ListPage({ params: Promise.resolve({ locale: "en" }) }));
192
- }
193
-
194
- async function renderBooking(slug: string): Promise<void> {
195
- render(
196
- await BookingPage({ params: Promise.resolve({ locale: "en", slug }) }),
197
- );
198
- }
199
-
200
- describe("/account/appointments — the types the member read serves (AC-1)", () => {
201
- it("renders Title · Duration · Price in the read's order, a chevron per row, each row opening its booking page", async () => {
202
- await renderList();
203
- expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
204
- "Appointments",
205
- );
206
- expect(mockMeetingTypes).toHaveBeenCalledWith(INIT);
207
-
208
- const table = screen.getByTestId("appointments-table");
209
- expect(
210
- within(table)
211
- .getAllByRole("columnheader")
212
- .map((h) => h.textContent),
213
- ).toEqual(["Title", "Duration", "Price", ""]);
214
- const titles = within(table).getAllByTestId(/-title$/);
215
- expect(titles.map((t) => t.textContent)).toEqual([
216
- "Consultation",
217
- "Design review",
218
- "Free chat",
219
- ]);
220
- expect(titles.map((t) => t.getAttribute("href"))).toEqual([
221
- "/account/appointments/consult",
222
- "/account/appointments/review",
223
- "/account/appointments/free-chat",
224
- ]);
225
- for (const slug of ["consult", "review", "free-chat"]) {
226
- expect(
227
- screen.getByTestId(`appointments-table-row-${slug}-chevron`),
228
- ).toBeInTheDocument();
229
- }
230
-
231
- const consult = screen.getByTestId("appointments-table-row-consult");
232
- expect(consult).toHaveTextContent("30 min");
233
- expect(consult).toHaveTextContent("$50");
234
- expect(
235
- screen.getByTestId("appointments-table-row-review"),
236
- ).toHaveTextContent("Free");
237
- expect(
238
- screen.getByTestId("appointments-table-row-free-chat"),
239
- ).toHaveTextContent("Free");
240
-
241
- // The phone rows render the same read: their captions exist in the DOM.
242
- expect(
243
- screen.getAllByTestId("appointments-row").map((r) => r.textContent),
244
- ).toEqual([
245
- expect.stringContaining("30 min · $50"),
246
- expect.stringContaining("60 min · Free"),
247
- expect.stringContaining("15 min · Free"),
248
- ]);
249
-
250
- const nav = screen.getByTestId("appointments-facets");
251
- const items = within(nav).getAllByTestId(/^appointments-facets-item-/);
252
- expect(items.map((i) => i.getAttribute("data-testid"))).toEqual([
253
- "appointments-facets-item-all",
254
- ]);
255
- expect(items[0]).toHaveTextContent("All appointments");
256
- expect(items[0]).toHaveTextContent("3");
257
- // No public read serves the list: the member read alone decides it.
258
- expect(mockMeetings).not.toHaveBeenCalled();
259
- });
260
-
261
- it.each([
262
- ["an empty offer", ok({ items: [] }), VERIFIED],
263
- ["a 404 (no scheduling module)", refused(404, "not_found"), VERIFIED],
264
- [
265
- "a 403 while the email is unverified",
266
- refused(403, "forbidden"),
267
- UNVERIFIED,
268
- ],
269
- ])(
270
- "%s is the empty line, never the error row",
271
- async (_name, answer, session) => {
272
- mockGetSession.mockResolvedValue(session);
273
- mockMeetingTypes.mockResolvedValue(answer);
274
- await renderList();
275
- expect(screen.getByTestId("appointments-empty")).toHaveTextContent(
276
- "No appointment types are offered right now.",
277
- );
278
- expect(
279
- screen.getByTestId("appointments-facets-item-all"),
280
- ).toHaveTextContent("0");
281
- expect(screen.queryByTestId("appointments-table")).toBeNull();
282
- expect(screen.queryByTestId("inbox-error")).toBeNull();
283
- },
284
- );
285
-
286
- it.each([
287
- ["a 500", refused(500, "failed"), VERIFIED],
288
- ["a 403 with a verified email", refused(403, "forbidden"), VERIFIED],
289
- ])(
290
- "%s is the error row with Retry and no frame (7423 D12)",
291
- async (_name, answer, session) => {
292
- mockGetSession.mockResolvedValue(session);
293
- mockMeetingTypes.mockResolvedValue(answer);
294
- await renderList();
295
- expect(screen.getByTestId("inbox-error")).toHaveTextContent(
296
- "We couldn't load your appointment types.",
297
- );
298
- expect(screen.getByRole("button", { name: "Retry" })).toBeInTheDocument();
299
- expect(screen.queryByTestId("appointments-facets")).toBeNull();
300
- expect(screen.queryByTestId("appointments-empty")).toBeNull();
301
- },
302
- );
303
-
304
- it("signed out renders the heading alone and reads nothing", async () => {
305
- mockGetSession.mockResolvedValue(null);
306
- await renderList();
307
- expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
308
- "Appointments",
309
- );
310
- expect(mockMeetingTypes).not.toHaveBeenCalled();
311
- expect(mockNotFound).not.toHaveBeenCalled();
312
- });
313
- });
314
-
315
- describe("/account/appointments/<slug> — the member's booking page (AC-2)", () => {
316
- it("renders one H1, the booker from the member read's Cal.com link pre-bound to the member, and the back link", async () => {
317
- await renderBooking("consult");
318
- const h1s = screen.getAllByRole("heading", { level: 1 });
319
- expect(h1s).toHaveLength(1);
320
- expect(h1s[0]).toHaveTextContent("Schedule a consultation meeting");
321
-
322
- expect(screen.getByTestId("scheduler-embed-section")).toBeInTheDocument();
323
- expect(screen.getByTestId("scheduler-embed-cal")).toHaveAttribute(
324
- "data-provider",
325
- "cal",
326
- );
327
- expect(capturedSections).toEqual([
328
- {
329
- id: "appointment-consult",
330
- type: "scheduler-embed",
331
- data: {
332
- provider: "cal",
333
- calLink: "sam/consult",
334
- prefill: { email: "ada@example.com", name: "Ada" },
335
- layout: "month_view",
336
- gapAbove: "tight",
337
- },
338
- },
339
- ]);
340
- // The member's own credential reads the offer and its link (#11154); the
341
- // public read, whose Live set excludes client-only slugs, is never used.
342
- expect(mockMeetingTypes).toHaveBeenCalledWith(INIT);
343
- expect(mockMeetings).not.toHaveBeenCalled();
344
-
345
- expect(screen.getByTestId("appointment-back")).toHaveTextContent(
346
- "← All appointments",
347
- );
348
- expect(screen.getByTestId("appointment-back")).toHaveAttribute(
349
- "href",
350
- "/account/appointments",
351
- );
352
- expect(screen.queryByTestId("appointment-not-offered")).toBeNull();
353
- expect(mockNotFound).not.toHaveBeenCalled();
354
- });
355
-
356
- it("the booker section carries the email alone when the session has no name", () => {
357
- expect(
358
- memberBookerSection("review", "sam/review", {
359
- name: null,
360
- email: "ada@example.com",
361
- }),
362
- ).toEqual({
363
- id: "appointment-review",
364
- type: "scheduler-embed",
365
- data: {
366
- provider: "cal",
367
- calLink: "sam/review",
368
- prefill: { email: "ada@example.com" },
369
- layout: "month_view",
370
- gapAbove: "tight",
371
- },
372
- });
373
- });
374
-
375
- it("a slug the member read does not serve says the type is no longer offered — no embed, no public read", async () => {
376
- await renderBooking("gone");
377
- expect(screen.getByTestId("appointment-not-offered")).toHaveTextContent(
378
- "This appointment type is no longer offered.",
379
- );
380
- expect(screen.queryByTestId("scheduler-embed-section")).toBeNull();
381
- expect(mockMeetings).not.toHaveBeenCalled();
382
- expect(screen.getByTestId("appointment-back")).toHaveAttribute(
383
- "href",
384
- "/account/appointments",
385
- );
386
- expect(mockNotFound).not.toHaveBeenCalled();
387
- });
388
-
389
- it("an offered type the member read carries no link for is the error row under its heading", async () => {
390
- mockMeetingTypes.mockResolvedValue(
391
- ok({ items: TYPES.map(({ calLink: _link, ...type }) => type) }),
392
- );
393
- await renderBooking("consult");
394
- expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
395
- "Schedule a consultation meeting",
396
- );
397
- expect(screen.getByTestId("inbox-error")).toHaveTextContent(
398
- "We couldn't load this appointment type.",
399
- );
400
- expect(screen.queryByTestId("scheduler-embed-section")).toBeNull();
401
- });
402
-
403
- it("a failed member read is the error row, with no public read", async () => {
404
- mockMeetingTypes.mockResolvedValue(refused(500, "failed"));
405
- await renderBooking("consult");
406
- expect(screen.getByTestId("inbox-error")).toHaveTextContent(
407
- "We couldn't load this appointment type.",
408
- );
409
- expect(mockMeetings).not.toHaveBeenCalled();
410
- });
411
-
412
- it.each(["intro.html", "Bad Slug", ""])(
413
- "the segment %p is not found before any read",
414
- async (slug) => {
415
- await expect(renderBooking(slug)).rejects.toThrow("NEXT_NOT_FOUND");
416
- expect(mockMeetingTypes).not.toHaveBeenCalled();
417
- expect(mockMeetings).not.toHaveBeenCalled();
418
- },
419
- );
420
-
421
- it("no session is not found", async () => {
422
- mockGetSession.mockResolvedValue(null);
423
- await expect(renderBooking("consult")).rejects.toThrow("NEXT_NOT_FOUND");
424
- expect(mockMeetingTypes).not.toHaveBeenCalled();
425
- });
426
- });
@@ -1,76 +0,0 @@
1
- /**
2
- * appointments/appointments-data.ts — the Appointments pages' reads and
3
- * helpers (#11154).
4
- *
5
- * The list and the booking page read the same offer, so the read lives here
6
- * (the `artifacts/artifact-data.ts` shape): `GET /v1/member/meeting-types`,
7
- * the types the provider offers its clients — `customerSlugs` ∩ `enabledSlugs`
8
- * (#11122 D6) — through `member.meetingTypes` with the caller's forwarded
9
- * credential. The account area's read rule is restated: a 404 (no tenancy
10
- * module, or a spoke route the hub does not admit) is "nothing offered"; a
11
- * 401 or 403 is the same while the person's email is unverified; anything
12
- * else throws, so the page shows its error row with Retry (spec 7423 D12),
13
- * never an empty list.
14
- *
15
- * The member read carries each type's Cal.com link (`calLink`, #11154), read
16
- * from the account handle on the server. The public meetings read is never
17
- * used: its Live set excludes the client-only slugs (#11122 D6), so it never
18
- * lists an offered type. A type with no link (the handle could not be read)
19
- * makes the booking page say it could not load.
20
- *
21
- * These are BASE files, like the New menu's (#8233 C1): the reads 404 on a
22
- * build without the scheduling module, so nothing here imports the module's
23
- * own `lib/meetings.tsx`.
24
- */
25
-
26
- import { member } from "@working-theory/api-client";
27
- import type { AccountContext } from "@working-theory/templates/account";
28
- import { localeHref } from "@working-theory/ui";
29
- import {
30
- meetingSlugSchema,
31
- type MemberMeetingType,
32
- } from "@working-theory/validation";
33
- import { formatMoney } from "@working-theory/web-i18n";
34
- import { cache } from "react";
35
-
36
- import { unwrapApiResult } from "../../../../../lib/server-api";
37
-
38
- /** The types the member may book, in the workspace's stored order. One read per request. */
39
- export const loadMeetingTypes = cache(
40
- async (ctx: AccountContext): Promise<MemberMeetingType[]> => {
41
- const res = await member.meetingTypes(ctx.init);
42
- if (!res.ok) {
43
- if (res.status === 404) return [];
44
- if (!ctx.user.emailVerified && (res.status === 401 || res.status === 403))
45
- return [];
46
- }
47
- return (await unwrapApiResult(Promise.resolve(res))).items;
48
- },
49
- );
50
-
51
- /**
52
- * Whether a segment can be a type's page: the one slug grammar, and no `.`
53
- * — a dotted path skips the middleware matcher, so its page would carry no
54
- * security headers (the `/meet/<slug>` rule, SEC-8843-F).
55
- */
56
- export function isTypePath(slug: string): boolean {
57
- return meetingSlugSchema.safeParse(slug).success && !slug.includes(".");
58
- }
59
-
60
- /** The booking page of one type. */
61
- export function appointmentHref(locale: string, slug: string): string {
62
- return localeHref(
63
- locale,
64
- `/account/appointments/${encodeURIComponent(slug)}`,
65
- );
66
- }
67
-
68
- /** A type's price in the reader's locale; none, or none to pay, reads `free`. */
69
- export function formatTypePrice(
70
- price: MemberMeetingType["price"],
71
- locale: string,
72
- free: string,
73
- ): string {
74
- if (price === undefined || price.amountMinor === 0) return free;
75
- return formatMoney(price.amountMinor, price.currency, locale);
76
- }
@@ -1,139 +0,0 @@
1
- /**
2
- * /[locale]/account/appointments — Library › Appointments (#11154).
3
- *
4
- * RSC, inside the account layout's SignedInShell (the rail's Appointments
5
- * row is selected here). Lists exactly the types the member read serves
6
- * (`loadMeetingTypes`) in the Admin Appointments list's layout
7
- * (`AccountListFrame`, the member twin of `MeetingsListPage`): a table of
8
- * Title · Duration · Price with a chevron per row, each row opening the
9
- * type's booking page, `/account/appointments/<slug>`. No facet group: a
10
- * member has nothing to narrow by, so the second column reads the All count
11
- * alone. Below `md` the table becomes the phone row list, each row's caption
12
- * "<duration> · <price>".
13
- *
14
- * A 404 read (no scheduling module, or a spoke route the hub does not admit)
15
- * and an empty offer both show the frame's empty line; any other failed read
16
- * renders the error row with Retry and no frame (spec 7423 D12). Nothing
17
- * here tests the topology: the same file serves a single site and a
18
- * hub-mode spoke.
19
- */
20
-
21
- import {
22
- AccountListFrame,
23
- type AccountListFrameRow,
24
- } from "@working-theory/templates/account";
25
- import { Heading, Text } from "@working-theory/ui/primitives";
26
- import type { MemberMeetingType } from "@working-theory/validation";
27
- import type { Metadata } from "next";
28
- import { getTranslations } from "next-intl/server";
29
- import type { ReactElement } from "react";
30
-
31
- import { accountSession, logReadFailure } from "../account-data";
32
- import { ErrorRow } from "../error-row";
33
-
34
- import {
35
- appointmentHref,
36
- formatTypePrice,
37
- loadMeetingTypes,
38
- } from "./appointments-data";
39
-
40
- interface Props {
41
- params: Promise<{ locale: string }>;
42
- }
43
-
44
- export async function generateMetadata({ params }: Props): Promise<Metadata> {
45
- const { locale } = await params;
46
- const t = await getTranslations({ locale, namespace: "account" });
47
- return { title: t("appointments.title") };
48
- }
49
-
50
- export default async function AccountAppointmentsPage({
51
- params,
52
- }: Props): Promise<ReactElement> {
53
- const { locale } = await params;
54
- const t = await getTranslations({ locale, namespace: "account" });
55
- const session = await accountSession(locale);
56
-
57
- const heading = (
58
- <>
59
- <Heading level={1} visual={2}>
60
- {t("appointments.title")}
61
- </Heading>
62
- <Text as="p" variant="body-sm" tone="muted" className="mt-block-tight">
63
- {t("appointments.lead")}
64
- </Text>
65
- </>
66
- );
67
-
68
- // Unreachable behind the (authed) gate, which renders the sign-in gate in
69
- // this page's place — but the page still renders in parallel with it, so
70
- // no `notFound()` here (the Artifacts page's rule): the heading alone.
71
- if (!session) {
72
- return (
73
- <div className="max-w-3xl py-8" data-testid="appointments">
74
- {heading}
75
- </div>
76
- );
77
- }
78
-
79
- let types: MemberMeetingType[] | null;
80
- try {
81
- types = await loadMeetingTypes(session.ctx);
82
- } catch (err) {
83
- logReadFailure("appointments", err);
84
- types = null;
85
- }
86
-
87
- if (types === null) {
88
- return (
89
- <div className="max-w-3xl py-8" data-testid="appointments">
90
- {heading}
91
- <ErrorRow
92
- className="mt-block-loose"
93
- message={t("appointments.error")}
94
- retryLabel={t("appointments.retry")}
95
- />
96
- </div>
97
- );
98
- }
99
-
100
- const row = (type: MemberMeetingType): AccountListFrameRow => {
101
- const duration = t("appointments.duration", {
102
- minutes: type.durationMinutes,
103
- });
104
- const price = formatTypePrice(type.price, locale, t("appointments.free"));
105
- return {
106
- id: type.slug,
107
- title: type.title,
108
- href: appointmentHref(locale, type.slug),
109
- caption: `${duration} · ${price}`,
110
- cells: { duration, price },
111
- };
112
- };
113
-
114
- return (
115
- <AccountListFrame
116
- title={t("appointments.title")}
117
- lead={t("appointments.lead")}
118
- glyph="calendar-clock"
119
- all={{ label: t("appointments.all") }}
120
- columns={[
121
- { key: "title", header: t("appointments.columns.title") },
122
- {
123
- key: "duration",
124
- header: t("appointments.columns.duration"),
125
- width: "1/6",
126
- },
127
- { key: "price", header: t("appointments.columns.price"), width: "1/6" },
128
- ]}
129
- rows={types.map(row)}
130
- chevron
131
- labels={{
132
- nav: t("appointments.facets"),
133
- table: t("appointments.title"),
134
- empty: t("appointments.empty"),
135
- }}
136
- testIdPrefix="appointments"
137
- />
138
- );
139
- }