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,418 +0,0 @@
1
- /**
2
- * Tests for the New menu's popups (#8233, spec
3
- * docs/specs/8233-member-new-menu-the-new-spec.md D5–D10; AC-3, AC-4, AC-5).
4
- *
5
- * The Inbox page renders with every action offered; each case opens a popup
6
- * through the menu, so the popup runs its real server action
7
- * (`new-actions.ts`) against the mocked member reads and writes.
8
- *
9
- * Covers:
10
- * 1. Request quote renders the request-quote magnet's CURRENT steps, read
11
- * on each open — a step the provider adds shows on the next open — and
12
- * posts the typed answers, a blank optional one omitted (AC-3). #11155:
13
- * the date and the budget band are required (the browser refuses a
14
- * submit without them, so nothing is posted), the date is a date input
15
- * floored at today, the link's https refusal shows inline under it.
16
- * 2. Send message (#11152) is a link to the member thread page,
17
- * /account/inbox/thread — the lightbox is retired; the thread's
18
- * composer posts through the same write (`thread.test.tsx`). Schedule
19
- * appointment (#11154) is a link to /account/appointments: the schedule
20
- * popup is retired, so one booking path remains — the member's booking
21
- * page.
22
- * 3. A refusal shows a plain message, keeps every typed value and leaves
23
- * the popup open (AC-5).
24
- * 4. No popup asks for a name or an email.
25
- */
26
- import { fireEvent, render, screen, waitFor, within } from "@testing-library/react";
27
-
28
- jest.mock("next-intl/server", () => {
29
- const msgs: unknown = require("../../../../../messages/en.json");
30
- const dig = (obj: unknown, path: string): unknown =>
31
- path.split(".").reduce<unknown>(
32
- (acc, k) => (acc !== null && typeof acc === "object" ? (acc as Record<string, unknown>)[k] : undefined),
33
- obj,
34
- );
35
- return {
36
- __esModule: true,
37
- getTranslations: async (arg: string | { namespace?: string; locale?: string }) => {
38
- const ns = typeof arg === "string" ? arg : (arg.namespace ?? "");
39
- const messages = dig(msgs, ns);
40
- return (key: string, values?: Record<string, unknown>): string => {
41
- const value = dig(messages, key);
42
- if (typeof value !== "string") return `${ns}.${key}`;
43
- return value.replace(/\{(\w+)\}/g, (m, name: string) =>
44
- values && name in values ? String(values[name]) : m,
45
- );
46
- };
47
- },
48
- };
49
- });
50
-
51
- jest.mock("next/headers", () => ({
52
- __esModule: true,
53
- headers: jest.fn().mockResolvedValue(new Headers()),
54
- cookies: jest.fn().mockResolvedValue({ toString: () => "session=abc" }),
55
- }));
56
-
57
- const mockGetSession = jest.fn();
58
- // 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.
59
- jest.mock("../../../../../auth", () => ({
60
- __esModule: true,
61
- auth: { api: { getSession: (...args: unknown[]) => mockGetSession(...args) } },
62
- }));
63
-
64
- const mockNotFound = jest.fn();
65
- const mockMemberMessages = jest.fn();
66
- const mockMemberMeetingTypes = jest.fn();
67
- const mockMemberRequestForm = jest.fn();
68
- const mockMemberRequestQuote = jest.fn();
69
- jest.mock("@working-theory/api-client", () => ({
70
- __esModule: true,
71
- // #8765 D7 — no agreement outstanding, so the Inbox loads.
72
- consent: {
73
- accountAgreements: () =>
74
- Promise.resolve({ ok: true, body: { agreements: [], complete: true } }),
75
- },
76
- waitlistSignups: { me: jest.fn() },
77
- subscription: { me: (...args: unknown[]) => mockNotFound(...args) },
78
- member: {
79
- pieces: (...args: unknown[]) => mockNotFound(...args),
80
- purchases: (...args: unknown[]) => mockNotFound(...args),
81
- appointments: (...args: unknown[]) => mockNotFound(...args),
82
- welcome: (...args: unknown[]) => mockNotFound(...args),
83
- messages: (...args: unknown[]) => mockMemberMessages(...args),
84
- meetingTypes: (...args: unknown[]) => mockMemberMeetingTypes(...args),
85
- requestForm: (...args: unknown[]) => mockMemberRequestForm(...args),
86
- requestQuote: (...args: unknown[]) => mockMemberRequestQuote(...args),
87
- },
88
- }));
89
-
90
- const mockPush = jest.fn();
91
- const mockRefresh = jest.fn();
92
- jest.mock("next/navigation", () => ({
93
- __esModule: true,
94
- useRouter: () => ({ push: mockPush, refresh: mockRefresh }),
95
- usePathname: () => "/account",
96
- useSearchParams: () => new URLSearchParams(),
97
- }));
98
-
99
- import { PhoneTabProvider } from "@working-theory/templates/account";
100
- import { toIsoDate } from "@working-theory/ui/primitives";
101
- import { requestQuoteFlowConfig } from "@working-theory/validation";
102
-
103
- import Page from "../page";
104
-
105
- const SESSION = {
106
- user: {
107
- id: "user_1",
108
- name: "Ada",
109
- email: "ada@example.com",
110
- emailVerified: true,
111
- createdAt: new Date("2026-09-01T00:00:00.000Z"),
112
- },
113
- };
114
-
115
- /** The cookie a single site forwards (`forwardedCookieInit()`). */
116
- const INIT = { headers: { cookie: "session=abc" } };
117
-
118
- const notFound = {
119
- ok: false,
120
- status: 404,
121
- body: { ok: false, error: { code: "not_found", message: "Not found" } },
122
- };
123
- const refusal = (status: number, code: string) => ({
124
- ok: false,
125
- status,
126
- body: { ok: false, error: { code, message: "x" } },
127
- });
128
- const ok = <T,>(body: T) => ({ ok: true, body });
129
-
130
- const TYPES = [
131
- { slug: "consult", title: "Consultation", durationMinutes: 30 },
132
- { slug: "review", title: "Design review", durationMinutes: 60 },
133
- ];
134
-
135
- const FORM = {
136
- form: { title: "Request a quote", defaultLocale: "en", steps: requestQuoteFlowConfig.steps },
137
- };
138
- const FORM_PLUS_STEP = {
139
- form: {
140
- ...FORM.form,
141
- steps: [
142
- ...requestQuoteFlowConfig.steps,
143
- {
144
- key: "extra",
145
- type: "field",
146
- copy: { title: { en: "A little more" } },
147
- fields: [{ name: "deadline", inputType: "text", copy: { label: { en: "Deadline" } } }],
148
- },
149
- ],
150
- },
151
- };
152
-
153
- const RECEIPT = ok({ id: "intx_1", createdAt: "2026-10-11T10:00:00.000Z" });
154
-
155
- beforeAll(() => {
156
- if (typeof globalThis.PointerEvent === "undefined") {
157
- // eslint-disable-next-line no-restricted-syntax -- a MouseEvent stands in for jsdom's missing PointerEvent
158
- globalThis.PointerEvent = MouseEvent as unknown as typeof PointerEvent;
159
- }
160
- });
161
-
162
- beforeEach(() => {
163
- window.localStorage.clear();
164
- mockPush.mockReset();
165
- mockRefresh.mockReset();
166
- mockGetSession.mockReset().mockResolvedValue(SESSION);
167
- mockNotFound.mockReset().mockResolvedValue(notFound);
168
- mockMemberMessages.mockReset().mockResolvedValue(ok({ items: [] }));
169
- mockMemberMeetingTypes.mockReset().mockResolvedValue(ok({ items: TYPES }));
170
- mockMemberRequestForm.mockReset().mockResolvedValue(ok(FORM));
171
- mockMemberRequestQuote.mockReset().mockResolvedValue(RECEIPT);
172
- });
173
-
174
- async function renderInbox(): Promise<void> {
175
- const element = await Page({ params: Promise.resolve({ locale: "en" }) });
176
- render(<PhoneTabProvider tab="inbox">{element}</PhoneTabProvider>);
177
- }
178
-
179
- /** Opens one New action's popup and returns it. */
180
- async function openPopup(label: string): Promise<HTMLElement> {
181
- fireEvent.pointerDown(screen.getByTestId("account-new-menu-trigger"), {
182
- button: 0,
183
- ctrlKey: false,
184
- pointerType: "mouse",
185
- });
186
- fireEvent.click(screen.getByRole("menuitem", { name: label }));
187
- return screen.findByTestId("account-new-popup");
188
- }
189
-
190
- async function closePopup(popup: HTMLElement): Promise<void> {
191
- fireEvent.click(within(popup).getByRole("button", { name: "Close" }));
192
- await waitFor(() => expect(screen.queryByTestId("account-new-popup")).not.toBeInTheDocument());
193
- }
194
-
195
- function type(control: HTMLElement, value: string): void {
196
- fireEvent.change(control, { target: { value } });
197
- }
198
-
199
- /** A future ISO date the server's "not before today" rule accepts. */
200
- const FUTURE_DATE = "2999-01-01";
201
-
202
- /** Today as the member's own `YYYY-MM-DD` — the date input's `min`. */
203
- const localToday = (): string => toIsoDate(new Date());
204
-
205
- /** Picks a band through the Select's native mirror (Radix bubbles a change on it back into the value). */
206
- function pickBudget(popup: HTMLElement, value: string): void {
207
- const native = popup.querySelector('select[name="answer.budget"]');
208
- if (!(native instanceof HTMLSelectElement)) throw new Error("no budget select");
209
- fireEvent.change(native, { target: { value } });
210
- }
211
-
212
- /** Fills the three required default answers. */
213
- async function fillRequired(popup: HTMLElement): Promise<void> {
214
- type(await within(popup).findByLabelText("What do you need?"), "A logo");
215
- type(within(popup).getByLabelText("When do you need it?"), FUTURE_DATE);
216
- pickBudget(popup, "1k-5k");
217
- }
218
-
219
- function expectNoIdentityFields(popup: HTMLElement): void {
220
- expect(within(popup).queryAllByLabelText(/name|e-?mail/i)).toEqual([]);
221
- expect(popup.querySelector('input[type="email"]')).toBeNull();
222
- }
223
-
224
- // ── Request quote ────────────────────────────────────────────────────────────
225
-
226
- describe("Request quote — the magnet's current steps, read on each open (AC-3)", () => {
227
- it("renders the four default fields — need, a date and a budget band required, the link optional — and no identity field (#11155)", async () => {
228
- await renderInbox();
229
- const popup = await openPopup("Request quote");
230
- await within(popup).findByLabelText("What do you need?");
231
- // Two text boxes: the need and the link. The date and the band are their own controls.
232
- expect(within(popup).getAllByRole("textbox")).toHaveLength(2);
233
- expect(within(popup).getByLabelText("What do you need?")).toBeRequired();
234
-
235
- const timing = within(popup).getByLabelText("When do you need it?");
236
- expect(timing).toHaveAttribute("type", "date");
237
- expect(timing).toBeRequired();
238
- expect(timing).toHaveAttribute("min", localToday());
239
- expect(within(popup).getByRole("button", { name: "Pick a date" })).toBeInTheDocument();
240
-
241
- expect(within(popup).getByRole("combobox", { name: "Budget range" })).toBeInTheDocument();
242
- const native = popup.querySelector('select[name="answer.budget"]');
243
- expect(native).toBeRequired();
244
- expect(Array.from((native as HTMLSelectElement).options).map((o) => o.value).filter(Boolean)).toEqual([
245
- "under-1k",
246
- "1k-5k",
247
- "5k-10k",
248
- "10k-25k",
249
- "25k-plus",
250
- ]);
251
-
252
- const link = within(popup).getByLabelText("Reference folder or document");
253
- expect(link).not.toBeRequired();
254
- expect(link).toHaveAttribute("placeholder", "https://");
255
- expect(within(popup).queryByText("A rough range is fine.")).toBeNull();
256
- expect(within(popup).queryByText(/Must start with https/)).toBeNull();
257
- expectNoIdentityFields(popup);
258
- });
259
-
260
- it("posts nothing while the required date or budget is blank: the browser refuses the submit (#11155)", async () => {
261
- await renderInbox();
262
- const popup = await openPopup("Request quote");
263
- type(await within(popup).findByLabelText("What do you need?"), "A logo");
264
- fireEvent.click(within(popup).getByTestId("new-quote-submit"));
265
- expect(within(popup).getByLabelText("When do you need it?")).toBeInvalid();
266
- expect(popup.querySelector('select[name="answer.budget"]')).toBeInvalid();
267
-
268
- type(within(popup).getByLabelText("When do you need it?"), FUTURE_DATE);
269
- fireEvent.click(within(popup).getByTestId("new-quote-submit"));
270
- expect(within(popup).getByLabelText("When do you need it?")).toBeValid();
271
- expect(popup.querySelector('select[name="answer.budget"]')).toBeInvalid();
272
-
273
- await new Promise((resolve) => setTimeout(resolve, 20));
274
- expect(mockMemberRequestQuote).not.toHaveBeenCalled();
275
- expect(screen.getByTestId("account-new-popup")).toBeInTheDocument();
276
- expect(within(popup).getByLabelText("What do you need?")).toHaveValue("A logo");
277
- });
278
-
279
- it("a date before today is refused by the server as answers_invalid; the message shows and every answer is kept (#11155)", async () => {
280
- mockMemberRequestQuote.mockResolvedValue(refusal(400, "answers_invalid"));
281
- await renderInbox();
282
- const popup = await openPopup("Request quote");
283
- await fillRequired(popup);
284
- // The input's own floor is bypassed the way a stale tab or a hand-built post would.
285
- const timing = within(popup).getByLabelText("When do you need it?");
286
- timing.removeAttribute("min");
287
- type(timing, "2000-01-01");
288
- fireEvent.click(within(popup).getByTestId("new-quote-submit"));
289
- expect(
290
- await within(popup).findByText("Some answers do not fit this form. Check them and try again."),
291
- ).toBeInTheDocument();
292
- expect(mockMemberRequestQuote).toHaveBeenCalledWith(
293
- { answers: { need: "A logo", timing: "2000-01-01", budget: "1k-5k" } },
294
- INIT,
295
- );
296
- expect(within(popup).getByLabelText("When do you need it?")).toHaveValue("2000-01-01");
297
- expect(within(popup).getByLabelText("What do you need?")).toHaveValue("A logo");
298
- expect(screen.getByTestId("account-new-popup")).toBeInTheDocument();
299
- });
300
-
301
- it("shows a step the provider added on the next open, with no page re-render", async () => {
302
- await renderInbox();
303
- let popup = await openPopup("Request quote");
304
- await within(popup).findByLabelText("What do you need?");
305
- expect(within(popup).queryByLabelText("Deadline")).not.toBeInTheDocument();
306
- await closePopup(popup);
307
-
308
- mockMemberRequestForm.mockResolvedValue(ok(FORM_PLUS_STEP));
309
- popup = await openPopup("Request quote");
310
- expect(await within(popup).findByLabelText("Deadline")).toBeInTheDocument();
311
- expect(within(popup).getAllByRole("textbox")).toHaveLength(3);
312
- });
313
-
314
- it("posts the typed answers through member.requestQuote, a blank optional answer omitted", async () => {
315
- await renderInbox();
316
- const popup = await openPopup("Request quote");
317
- await fillRequired(popup);
318
- fireEvent.click(within(popup).getByTestId("new-quote-submit"));
319
- await waitFor(() => expect(mockMemberRequestQuote).toHaveBeenCalledTimes(1));
320
- expect(mockMemberRequestQuote).toHaveBeenCalledWith(
321
- { answers: { need: "A logo", timing: FUTURE_DATE, budget: "1k-5k" } },
322
- INIT,
323
- );
324
- await waitFor(() => expect(screen.queryByTestId("account-new-popup")).not.toBeInTheDocument());
325
- expect(mockRefresh).toHaveBeenCalledTimes(1);
326
- });
327
-
328
- it("with the form switched off since the menu loaded, says Requests are off", async () => {
329
- await renderInbox();
330
- mockMemberRequestForm.mockResolvedValue(ok({ form: null }));
331
- const popup = await openPopup("Request quote");
332
- expect(await within(popup).findByText("Requests are switched off right now.")).toBeInTheDocument();
333
- expect(within(popup).queryAllByRole("textbox")).toEqual([]);
334
- });
335
-
336
- it("a failed read shows the load error, and Try again reads once more", async () => {
337
- await renderInbox();
338
- mockMemberRequestForm.mockResolvedValue(refusal(500, "failed"));
339
- const popup = await openPopup("Request quote");
340
- expect(await within(popup).findByText("This could not load.")).toBeInTheDocument();
341
- mockMemberRequestForm.mockResolvedValue(ok(FORM));
342
- fireEvent.click(within(popup).getByRole("button", { name: "Try again" }));
343
- expect(await within(popup).findByLabelText("What do you need?")).toBeInTheDocument();
344
- });
345
- });
346
-
347
- // ── Send message ─────────────────────────────────────────────────────────────
348
-
349
- describe("Send message — a link to the member thread page, no lightbox (#11152)", () => {
350
- it("navigates to /account/inbox/thread and opens nothing over the Inbox", async () => {
351
- await renderInbox();
352
- fireEvent.pointerDown(screen.getByTestId("account-new-menu-trigger"), {
353
- button: 0,
354
- ctrlKey: false,
355
- pointerType: "mouse",
356
- });
357
- const row = screen.getByRole("menuitem", { name: "Send message" });
358
- expect(row).toHaveAttribute("data-href", "/account/inbox/thread");
359
- fireEvent.click(row);
360
- expect(mockPush).toHaveBeenCalledWith("/account/inbox/thread");
361
- expect(screen.queryByTestId("account-new-popup")).not.toBeInTheDocument();
362
- expect(screen.queryByTestId("new-message-form")).not.toBeInTheDocument();
363
- });
364
- });
365
-
366
- // ── Schedule appointment ─────────────────────────────────────────────────────
367
-
368
- describe("Schedule appointment — a link to the member's Appointments page, no popup (#11154)", () => {
369
- it("navigates to /account/appointments and opens nothing over the Inbox", async () => {
370
- await renderInbox();
371
- fireEvent.pointerDown(screen.getByTestId("account-new-menu-trigger"), {
372
- button: 0,
373
- ctrlKey: false,
374
- pointerType: "mouse",
375
- });
376
- const row = screen.getByRole("menuitem", { name: "Schedule appointment" });
377
- expect(row).toHaveAttribute("data-href", "/account/appointments");
378
- fireEvent.click(row);
379
- expect(mockPush).toHaveBeenCalledWith("/account/appointments");
380
- expect(screen.queryByTestId("account-new-popup")).not.toBeInTheDocument();
381
- expect(screen.queryByRole("menuitem", { name: /service/i })).not.toBeInTheDocument();
382
- });
383
- });
384
-
385
- // ── Refusals ─────────────────────────────────────────────────────────────────
386
-
387
- describe("a refusal shows a plain message and keeps every typed value (AC-5)", () => {
388
- it("Request quote: a bare-domain link is sent as typed, refused INLINE under the link, and all four answers kept (#11155)", async () => {
389
- mockMemberRequestQuote.mockResolvedValue(refusal(400, "link_not_https"));
390
- await renderInbox();
391
- const popup = await openPopup("Request quote");
392
- await fillRequired(popup);
393
- type(within(popup).getByLabelText("Reference folder or document"), "example.com");
394
- fireEvent.click(within(popup).getByTestId("new-quote-submit"));
395
- const error = await within(popup).findByTestId("new-quote-field-link-error");
396
- expect(error).toHaveTextContent("A link must start with https://.");
397
- expect(error).toHaveAttribute("role", "alert");
398
- const link = within(popup).getByLabelText("Reference folder or document");
399
- expect(link).toHaveAttribute("aria-invalid", "true");
400
- expect(link).toHaveAttribute("aria-describedby", error.id);
401
- // Inline, not the form-level refusal.
402
- expect(within(popup).queryByTestId("new-popup-error")).toBeNull();
403
- expect(mockMemberRequestQuote).toHaveBeenCalledWith(
404
- { answers: { need: "A logo", timing: FUTURE_DATE, budget: "1k-5k", link: "example.com" } },
405
- INIT,
406
- );
407
- const values: Record<string, string> = {
408
- "What do you need?": "A logo",
409
- "When do you need it?": FUTURE_DATE,
410
- "Reference folder or document": "example.com",
411
- };
412
- for (const [label, value] of Object.entries(values)) {
413
- expect(within(popup).getByLabelText(label)).toHaveValue(value);
414
- }
415
- expect(screen.getByTestId("account-new-popup")).toBeInTheDocument();
416
- expect(mockRefresh).not.toHaveBeenCalled();
417
- });
418
- });