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,462 +0,0 @@
1
- /**
2
- * Tests for /[locale]/account/privacy — User settings › Privacy (#8438 D14;
3
- * #11164 AC-1, AC-2, AC-3 — the new lead, the expandable data-use row, the
4
- * training switch and the "Your data" table in place of the Cookies section,
5
- * the summary row, the agreements list and the deletion request).
6
- */
7
- import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
8
- import { tmpdir } from "node:os";
9
- import { join } from "node:path";
10
-
11
- import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
12
-
13
- jest.mock("next-intl/server", () => {
14
- const msgs: unknown = require("../../../../../messages/en.json");
15
- const dig = (obj: unknown, path: string): unknown =>
16
- path.split(".").reduce<unknown>(
17
- (acc, k) => (acc !== null && typeof acc === "object" ? (acc as Record<string, unknown>)[k] : undefined),
18
- obj,
19
- );
20
- return {
21
- __esModule: true,
22
- getTranslations: async (arg: string | { namespace?: string; locale?: string }) => {
23
- const ns = typeof arg === "string" ? arg : (arg.namespace ?? "");
24
- const messages = dig(msgs, ns);
25
- const t = (key: string, values?: Record<string, unknown>): string => {
26
- const value = dig(messages, key);
27
- if (typeof value !== "string") return `${ns}.${key}`;
28
- return value.replace(/\{(\w+)\}/g, (m, name: string) =>
29
- values && name in values ? String(values[name]) : m,
30
- );
31
- };
32
- // #11164: the lead is a `t.rich` message with a `<policy>` tag, the
33
- // deletion line an ICU plural.
34
- const { withRich } = require("./rich-translator") as typeof import("./rich-translator");
35
- return withRich(t, (key: string) => dig(messages, key), ns);
36
- },
37
- getLocale: jest.fn().mockResolvedValue("en"),
38
- };
39
- });
40
-
41
- const mockHeaders = jest.fn();
42
- jest.mock("next/headers", () => ({
43
- __esModule: true,
44
- headers: (...args: unknown[]) => mockHeaders(...args),
45
- cookies: jest.fn().mockResolvedValue({
46
- toString: () => "session=abc",
47
- get: () => undefined,
48
- }),
49
- }));
50
-
51
- const mockGetSession = jest.fn();
52
- // 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.
53
- jest.mock("../../../../../auth", () => ({
54
- __esModule: true,
55
- auth: { api: { getSession: (...args: unknown[]) => mockGetSession(...args) } },
56
- }));
57
-
58
- const mockPieces = jest.fn();
59
- const mockConsents = jest.fn();
60
- const mockSetConsent = jest.fn();
61
- const mockDeleteStoredSessions = jest.fn();
62
- jest.mock("@working-theory/api-client", () => ({
63
- __esModule: true,
64
- waitlistSignups: { me: jest.fn() },
65
- flowCheckouts: { me: jest.fn() },
66
- subscription: { me: jest.fn(), portalSession: jest.fn() },
67
- leads: { submit: jest.fn() },
68
- member: {
69
- pieces: (...args: unknown[]) => mockPieces(...args),
70
- consents: (...args: unknown[]) => mockConsents(...args),
71
- setConsent: (...args: unknown[]) => mockSetConsent(...args),
72
- deleteStoredSessions: (...args: unknown[]) => mockDeleteStoredSessions(...args),
73
- },
74
- hubSignIn: { me: jest.fn() },
75
- visitorForwardHeaders: () => null,
76
- }));
77
-
78
- jest.mock("next/navigation", () => ({
79
- __esModule: true,
80
- useRouter: () => ({ push: jest.fn(), refresh: jest.fn(), replace: jest.fn() }),
81
- usePathname: () => "/account/privacy",
82
- redirect: jest.fn(),
83
- }));
84
-
85
- import Page from "../privacy/page";
86
-
87
- const SESSION = {
88
- user: {
89
- id: "user_1",
90
- name: "Ada Lovelace",
91
- email: "ada@example.com",
92
- emailVerified: true,
93
- createdAt: new Date("2026-09-01T00:00:00.000Z"),
94
- },
95
- };
96
- const COOKIE_INIT = { headers: { cookie: "session=abc" } };
97
- const ok = <T,>(body: T) => ({ ok: true, body });
98
- const refusal = (status: number, code: string) => ({
99
- ok: false,
100
- status,
101
- body: { ok: false, error: { code, message: code } },
102
- });
103
-
104
- const LEAD =
105
- "We believe in transparent data practices. Learn how your information is protected when using our products, and view our Privacy Policy for more details.";
106
- const BULLET_1 =
107
- "With your permission, we will use your communications, artifacts, and sessions to train and improve our AI models. This helps us to make AI more helpful and accurate for everyone and to develop more robust safeguards against harmful outputs.";
108
- const BULLET_2 =
109
- "We may conduct aggregated, anonymized analysis of data to understand how people use products and services.";
110
-
111
- /** `ai_training` as `GET /v1/member/consents` serves it from the shipped registry. */
112
- function trainingPurpose(overrides: Partial<{ effective: boolean; state: unknown }> = {}) {
113
- return {
114
- id: "ai_training",
115
- kind: "consent" as const,
116
- area: "data" as const,
117
- required: false,
118
- signUp: false,
119
- description: "Use of your communications, artifacts and sessions to train and improve AI models.",
120
- statement: "I allow the use of my communications, artifacts, and sessions to train and improve AI models.",
121
- policyHref: "/privacy",
122
- policyVersion: 1,
123
- state: overrides.state === undefined ? null : overrides.state,
124
- effective: overrides.effective ?? false,
125
- };
126
- }
127
-
128
- /** A communications purpose, which Privacy never lists. */
129
- function communicationsPurpose() {
130
- return {
131
- ...trainingPurpose(),
132
- id: "newsletter",
133
- area: "communications" as const,
134
- description: "This site's newsletter by email",
135
- statement: "Email me the newsletter.",
136
- };
137
- }
138
-
139
- let contentRoot: string;
140
-
141
- beforeEach(() => {
142
- contentRoot = mkdtempSync(join(tmpdir(), "ailk-privacy-"));
143
- process.env.AILK_CONTENT_ROOT = contentRoot;
144
- writeFileSync(join(contentRoot, "_site.mdx"), '---\nsiteName: "Test"\n---\n');
145
- mockHeaders.mockReset().mockResolvedValue(new Headers());
146
- mockGetSession.mockReset().mockResolvedValue(SESSION);
147
- mockPieces.mockReset().mockResolvedValue(ok([]));
148
- mockConsents.mockReset().mockResolvedValue(ok({ purposes: [trainingPurpose(), communicationsPurpose()] }));
149
- mockSetConsent.mockReset();
150
- mockDeleteStoredSessions.mockReset().mockResolvedValue(ok({ deleted: 2 }));
151
- });
152
-
153
- afterEach(() => {
154
- rmSync(contentRoot, { recursive: true, force: true });
155
- });
156
-
157
- async function renderPage(locale = "en"): Promise<void> {
158
- render(await Page({ params: Promise.resolve({ locale }) }));
159
- }
160
-
161
- /** True when `a` comes before `b` in the document. */
162
- const before = (a: Element, b: Element): boolean =>
163
- (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0;
164
-
165
- describe("the frame", () => {
166
- it("the Settings rail reads General, Security, Notifications, Privacy, Billing, Privacy current", async () => {
167
- await renderPage();
168
- const rail = screen.getByRole("navigation", { name: "Settings" });
169
- const links = within(rail).getAllByRole("link");
170
- expect(links.map((link) => link.textContent)).toEqual([
171
- "General",
172
- "Security",
173
- "Notifications",
174
- "Privacy",
175
- "Billing",
176
- ]);
177
- expect(screen.getByTestId("account-settings-rail-privacy")).toHaveAttribute("aria-current", "page");
178
- });
179
-
180
- it("a non-default locale prefixes the rail and the policy link", async () => {
181
- await renderPage("fr");
182
- expect(screen.getByTestId("account-settings-rail-privacy")).toHaveAttribute("href", "/fr/account/privacy");
183
- expect(screen.getByTestId("account-privacy-policy")).toHaveAttribute("href", "/fr/privacy");
184
- });
185
- });
186
-
187
- describe("AC-1 — the order, the copy and the absences", () => {
188
- it("renders, in order: the title and the new lead, the data-use row collapsed, the training switch row, the Your data table", async () => {
189
- mockConsents.mockResolvedValue(
190
- ok({
191
- purposes: [
192
- trainingPurpose({
193
- effective: true,
194
- state: { granted: true, at: "2026-11-08T12:00:00.000Z", source: "account_settings", policyVersion: 1 },
195
- }),
196
- ],
197
- }),
198
- );
199
- await renderPage();
200
- const pane = screen.getByTestId("account-settings-privacy");
201
-
202
- const title = within(pane).getByRole("heading", { level: 1 });
203
- expect(title).toHaveTextContent("Privacy");
204
- const policy = within(pane).getByTestId("account-privacy-policy");
205
- expect(policy).toHaveTextContent("Privacy Policy");
206
- expect(policy).toHaveAttribute("href", "/privacy");
207
- expect(policy.closest("p")).toHaveTextContent(LEAD);
208
-
209
- const trigger = within(pane).getByTestId("account-privacy-data-use-trigger");
210
- expect(trigger.tagName).toBe("BUTTON");
211
- expect(trigger).toHaveTextContent("How we use your data");
212
- expect(trigger).toHaveAttribute("aria-expanded", "false");
213
- expect(within(pane).queryByText(BULLET_1)).not.toBeInTheDocument();
214
-
215
- const switchRow = within(pane).getByTestId("account-privacy-data-consent-ai_training");
216
- expect(within(switchRow).getByTestId("account-privacy-data-consent-ai_training-label")).toHaveTextContent(
217
- "Help improve our AI models",
218
- );
219
- expect(switchRow).toHaveTextContent(
220
- "Allow the use of your communications, artifacts, and sessions to train and improve AI models.",
221
- );
222
- expect(within(switchRow).getByTestId("account-privacy-data-consent-ai_training-date")).toHaveTextContent(
223
- "Given Nov 8, 2026",
224
- );
225
- expect(within(switchRow).getByRole("switch")).toBeChecked();
226
-
227
- const table = within(pane).getByTestId("account-privacy-your-data");
228
- expect(within(table).getByRole("heading", { level: 2 })).toHaveTextContent("Your data");
229
- const rows = within(table).getAllByRole("row");
230
- expect(rows).toHaveLength(2);
231
- expect(within(table).queryByRole("columnheader")).not.toBeInTheDocument();
232
- expect(rows[0]).toHaveTextContent("Export data");
233
- expect(within(rows[0]!).getByTestId("account-privacy-your-data-export-button")).toHaveTextContent(
234
- "Export data",
235
- );
236
- expect(within(rows[0]!).getByTestId("account-privacy-your-data-export-button").closest("td")).toHaveClass(
237
- "text-end",
238
- );
239
- expect(rows[1]).toHaveTextContent("Delete stored sessions");
240
- expect(rows[1]).toHaveTextContent("Permanently delete server-side copies of your stored sessions.");
241
- expect(within(rows[1]!).getByTestId("account-privacy-your-data-delete-button")).toHaveTextContent("Delete");
242
- expect(within(rows[1]!).getByTestId("account-privacy-your-data-delete-button").closest("td")).toHaveClass(
243
- "text-end",
244
- );
245
-
246
- // The order.
247
- expect(before(title, policy)).toBe(true);
248
- expect(before(policy, trigger)).toBe(true);
249
- expect(before(trigger, switchRow)).toBe(true);
250
- expect(before(switchRow, table)).toBe(true);
251
- // The data-use row and the switch share one card; the table is its own.
252
- const cards = within(pane).getAllByTestId("account-settings-privacy-card");
253
- expect(cards).toHaveLength(2);
254
- expect(cards[0]).toContainElement(trigger);
255
- expect(cards[0]).toContainElement(switchRow);
256
- expect(cards[1]).toContainElement(table);
257
- });
258
-
259
- it("renders no Cookies section, no summary row, no agreements list and no account-deletion line or button", async () => {
260
- await renderPage();
261
- for (const id of [
262
- "account-privacy-summary",
263
- "account-privacy-cookies",
264
- "account-cookie-settings",
265
- "account-privacy-consents",
266
- "account-privacy-agreements",
267
- "account-deletion",
268
- "account-deletion-request",
269
- "account-deletion-support",
270
- ]) {
271
- expect(screen.queryByTestId(id)).not.toBeInTheDocument();
272
- }
273
- for (const text of [
274
- "Cookies",
275
- "Cookies and your data.",
276
- "How we use your data.",
277
- "Read our privacy policy",
278
- "Data use",
279
- "Agreements accepted",
280
- "Request account deletion",
281
- "Ask the site owner to delete your account and its data.",
282
- ]) {
283
- expect(screen.queryByText(text)).not.toBeInTheDocument();
284
- }
285
- // The communications purpose is Notifications', never listed here.
286
- expect(screen.queryByTestId("account-privacy-data-consent-newsletter")).not.toBeInTheDocument();
287
- expect(screen.getAllByRole("switch")).toHaveLength(1);
288
- });
289
-
290
- it("the chevron expands the row in place to the two bullets, in order, and is a disclosure button", async () => {
291
- await renderPage();
292
- const trigger = screen.getByTestId("account-privacy-data-use-trigger");
293
- fireEvent.click(trigger);
294
- expect(trigger).toHaveAttribute("aria-expanded", "true");
295
- const content = screen.getByTestId("account-privacy-data-use-content");
296
- expect(within(content).getAllByRole("listitem").map((li) => li.textContent)).toEqual([BULLET_1, BULLET_2]);
297
- expect(screen.getByTestId("account-privacy-data-use")).toContainElement(content);
298
- expect(before(trigger, content)).toBe(true);
299
- fireEvent.click(trigger);
300
- expect(trigger).toHaveAttribute("aria-expanded", "false");
301
- });
302
-
303
- it("with no data purpose declared, the switch list shows its one line under the data-use row", async () => {
304
- mockConsents.mockResolvedValue(ok({ purposes: [communicationsPurpose()] }));
305
- await renderPage();
306
- expect(screen.getByTestId("account-privacy-data-consent-empty")).toHaveTextContent(
307
- "This site asks for no data-use consents.",
308
- );
309
- expect(screen.getByTestId("account-privacy-your-data")).toBeInTheDocument();
310
- });
311
-
312
- it("a failed consents read keeps the lead, the data-use row and the table, and shows the one line in place of the switch", async () => {
313
- mockConsents.mockResolvedValue(refusal(503, "tenant_unresolved"));
314
- await renderPage();
315
- expect(screen.getByTestId("account-privacy-policy")).toBeInTheDocument();
316
- expect(screen.getByTestId("account-privacy-data-use-trigger")).toBeInTheDocument();
317
- expect(screen.getByTestId("account-privacy-your-data")).toBeInTheDocument();
318
- expect(screen.queryByRole("switch")).not.toBeInTheDocument();
319
- expect(screen.getByTestId("account-privacy-unavailable")).toHaveTextContent(
320
- "Your consent choices can't be shown right now.",
321
- );
322
- });
323
- });
324
-
325
- describe("AC-2 — Help improve our AI models is a registry area: data consent, off until ticked", () => {
326
- it("renders off with no date line when the person has no row, and off is `effective: false`", async () => {
327
- await renderPage();
328
- expect(screen.getByTestId("account-privacy-data-consent-ai_training-switch")).not.toBeChecked();
329
- expect(screen.queryByTestId("account-privacy-data-consent-ai_training-date")).not.toBeInTheDocument();
330
- });
331
-
332
- it("ticking it writes the ledger through setConsentAction and shows the given date the answer carries", async () => {
333
- mockSetConsent.mockResolvedValue(
334
- ok({
335
- purpose: trainingPurpose({
336
- effective: true,
337
- state: { granted: true, at: "2026-11-08T12:00:00.000Z", source: "account_settings", policyVersion: 1 },
338
- }),
339
- }),
340
- );
341
- await renderPage();
342
- fireEvent.click(screen.getByTestId("account-privacy-data-consent-ai_training-switch"));
343
- await waitFor(() => expect(mockSetConsent).toHaveBeenCalledTimes(1));
344
- expect(mockSetConsent).toHaveBeenCalledWith({ purposeId: "ai_training", granted: true, locale: "en" }, COOKIE_INIT);
345
- expect(await screen.findByTestId("account-privacy-data-consent-ai_training-date")).toHaveTextContent(
346
- "Given Nov 8, 2026",
347
- );
348
- expect(screen.getByTestId("account-privacy-data-consent-ai_training-switch")).toBeChecked();
349
- });
350
-
351
- it("a failed answer reverts the switch with its message", async () => {
352
- mockSetConsent.mockResolvedValue(refusal(500, "internal"));
353
- await renderPage();
354
- fireEvent.click(screen.getByTestId("account-privacy-data-consent-ai_training-switch"));
355
- await waitFor(() =>
356
- expect(screen.getByTestId("account-privacy-data-consent-ai_training-error")).toBeInTheDocument(),
357
- );
358
- expect(screen.getByTestId("account-privacy-data-consent-ai_training-switch")).not.toBeChecked();
359
- });
360
-
361
- it("a data purpose a site adds is labelled by its statement and described by its description", async () => {
362
- mockConsents.mockResolvedValue(
363
- ok({
364
- purposes: [
365
- {
366
- ...trainingPurpose(),
367
- id: "data_sharing",
368
- description: "Product-usage data.",
369
- statement: "Share product-usage data with us.",
370
- },
371
- ],
372
- }),
373
- );
374
- await renderPage();
375
- const row = screen.getByTestId("account-privacy-data-consent-data_sharing");
376
- expect(within(row).getByTestId("account-privacy-data-consent-data_sharing-label")).toHaveTextContent(
377
- "Share product-usage data with us.",
378
- );
379
- expect(row).toHaveTextContent("Product-usage data.");
380
- });
381
- });
382
-
383
- describe("AC-3 — Export data", () => {
384
- it("the Export data button links this site's own download route for the person's records", async () => {
385
- await renderPage("fr");
386
- const button = screen.getByTestId("account-privacy-your-data-export-button");
387
- expect(button).toHaveAttribute("href", "/fr/account/privacy/export");
388
- expect(button).toHaveAttribute("download");
389
- });
390
- });
391
-
392
- describe("AC-3 — Delete stored sessions", () => {
393
- async function confirmDelete(): Promise<void> {
394
- fireEvent.click(screen.getByTestId("account-privacy-your-data-delete-button"));
395
- const dialog = await screen.findByRole("alertdialog");
396
- await act(async () => {
397
- fireEvent.click(within(dialog).getByTestId("account-privacy-your-data-delete-confirm-action"));
398
- });
399
- }
400
-
401
- it("asks for confirmation, names where an account-deletion request lives, and calls nothing until confirmed", async () => {
402
- await renderPage();
403
- fireEvent.click(screen.getByTestId("account-privacy-your-data-delete-button"));
404
- const dialog = await screen.findByRole("alertdialog");
405
- expect(dialog).toHaveTextContent("Delete stored sessions?");
406
- expect(dialog).toHaveTextContent("To ask for your account and its data to be deleted, contact support.");
407
- expect(within(dialog).getByTestId("account-privacy-your-data-account-deletion")).toHaveAttribute(
408
- "href",
409
- "/account/support",
410
- );
411
- expect(mockDeleteStoredSessions).not.toHaveBeenCalled();
412
- });
413
-
414
- it.each([
415
- [2, "Deleted 2 stored sessions."],
416
- [1, "Deleted 1 stored session."],
417
- [0, "There were no stored sessions to delete."],
418
- ])("confirming deletes through the member route and reports %i as %s", async (deleted, line) => {
419
- mockDeleteStoredSessions.mockResolvedValue(ok({ deleted }));
420
- await renderPage();
421
- await confirmDelete();
422
- expect(mockDeleteStoredSessions).toHaveBeenCalledWith(COOKIE_INIT);
423
- await waitFor(() => expect(screen.getByRole("status")).toHaveTextContent(line));
424
- });
425
-
426
- it("a refusal shows the failure line as an alert", async () => {
427
- mockDeleteStoredSessions.mockResolvedValue(refusal(429, "rate_limited"));
428
- await renderPage();
429
- await confirmDelete();
430
- await waitFor(() =>
431
- expect(screen.getByRole("alert")).toHaveTextContent("We couldn't delete your stored sessions. Try again in a moment."),
432
- );
433
- });
434
-
435
- // A single site whose build answers no member route (a 404 from the pieces
436
- // read) still files Support into its own operator inbox, so the pointer
437
- // stays; the hub-mode spoke that must show none (`via: "none"`,
438
- // SEC-7894-11) is `AccountDataTable`'s `supportHref: null` case.
439
- it("a single site with no member API still points an account-deletion request at Support", async () => {
440
- mockPieces.mockResolvedValue(refusal(404, "not_found"));
441
- await renderPage();
442
- fireEvent.click(screen.getByTestId("account-privacy-your-data-delete-button"));
443
- const dialog = await screen.findByRole("alertdialog");
444
- expect(within(dialog).getByTestId("account-privacy-your-data-account-deletion")).toHaveAttribute(
445
- "href",
446
- "/account/support",
447
- );
448
- });
449
- });
450
-
451
- describe("the standalone shape (#8430)", () => {
452
- it("takes the screen as the Admin's settings do: the rail column and the pane are the page's own landmarks", async () => {
453
- await renderPage();
454
- const settings = screen.getByTestId("account-settings");
455
- expect(settings).toHaveClass("min-h-screen");
456
- const column = within(settings).getByRole("complementary");
457
- expect(column.firstElementChild).toBe(screen.getByTestId("account-settings-back"));
458
- expect(within(settings).getByRole("main")).toContainElement(
459
- screen.getByRole("heading", { level: 1 }),
460
- );
461
- });
462
- });
@@ -1,63 +0,0 @@
1
- /**
2
- * `t.rich` the way next-intl renders it, for the inline `next-intl/server`
3
- * mocks of this area's suites (#11175): a `<tag>chunks</tag>` in the message
4
- * renders the node the tag's function returns for those chunks; `{name}` its
5
- * value; an ICU `{name, plural, …}` block its matching case with `#` the
6
- * count (#11164's deletion line). `t.markup` renders the same message as a
7
- * string, each tag's function given the chunks. `require`d inside a
8
- * `jest.mock` factory, so it holds no test-file state.
9
- */
10
- import { createElement, Fragment, type ReactNode } from "react";
11
-
12
- type Translate = (key: string, values?: Record<string, unknown>) => string;
13
- type Rich = (key: string, values?: Record<string, unknown>) => ReactNode;
14
- type Markup = (key: string, values?: Record<string, unknown>) => string;
15
-
16
- /** Resolve every `{name, plural, =0 {…} one {…} other {…}}` block in `value`. */
17
- function plural(value: string, values?: Record<string, unknown>): string {
18
- return value.replace(
19
- /\{(\w+), plural,((?:\s*(?:=\d+|zero|one|two|few|many|other)\s*\{[^{}]*\})+)\s*\}/g,
20
- (_match, name: string, options: string) => {
21
- const count = Number(values?.[name]);
22
- const cases = new Map<string, string>();
23
- for (const [, selector, text] of options.matchAll(/(=\d+|\w+)\s*\{([^{}]*)\}/g)) {
24
- cases.set(selector!, text!);
25
- }
26
- const text =
27
- cases.get(`=${count}`) ?? (count === 1 ? cases.get("one") : undefined) ?? cases.get("other") ?? "";
28
- return text.replace(/#/g, String(count));
29
- },
30
- );
31
- }
32
-
33
- export function withRich(
34
- t: Translate,
35
- lookup: (key: string) => unknown,
36
- ns: string,
37
- ): Translate & { rich: Rich; markup: Markup } {
38
- const translate: Translate = (key, values) => plural(t(key, values), values);
39
- const rich: Rich = (key, values) => {
40
- const value = lookup(key);
41
- if (typeof value !== "string") return `${ns}.${key}`;
42
- return plural(value, values)
43
- .split(/(<\w+>[^<]*<\/\w+>|\{\w+\})/)
44
- .map((part, i) => {
45
- const tag = /^<(\w+)>([^<]*)<\/\1>$/.exec(part);
46
- const fn = tag ? values?.[tag[1]!] : undefined;
47
- if (typeof fn === "function") {
48
- return createElement(Fragment, { key: i }, fn(tag![2] === "" ? [] : [tag![2]]));
49
- }
50
- const name = /^\{(\w+)\}$/.exec(part)?.[1];
51
- return name && values && name in values ? String(values[name]) : part;
52
- });
53
- };
54
- const markup: Markup = (key, values) => {
55
- const value = lookup(key);
56
- if (typeof value !== "string") return `${ns}.${key}`;
57
- return plural(value, values).replace(/<(\w+)>([^<]*)<\/\1>/g, (_match, tag: string, inner: string) => {
58
- const fn = values?.[tag];
59
- return typeof fn === "function" ? String(fn(inner)) : inner;
60
- });
61
- };
62
- return Object.assign(translate, { rich, markup });
63
- }