create-ailk 0.37.1 → 0.38.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 (230) 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 +18 -11
  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 +9 -15
  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 +67 -0
  26. package/dist/routes.d.ts +103 -0
  27. package/dist/routes.js +708 -0
  28. package/dist/site-manifest.js +1 -1
  29. package/dist/site-roster.d.ts +2 -1
  30. package/dist/site-roster.js +30 -8
  31. package/dist/spoke-checkout.d.ts +28 -27
  32. package/dist/spoke-checkout.js +71 -102
  33. package/dist/surfaces.d.ts +18 -0
  34. package/dist/surfaces.js +47 -282
  35. package/dist/sync-routes.d.ts +14 -1
  36. package/dist/sync-routes.js +86 -5
  37. package/dist/topology.d.ts +15 -1
  38. package/dist/topology.js +20 -4
  39. package/dist/update.d.ts +17 -2
  40. package/dist/update.js +480 -77
  41. package/package.json +3 -3
  42. package/templates/README.md +1 -1
  43. package/templates/apps/mcp/CLAUDE.md +5 -3
  44. package/templates/apps/web/CLAUDE.md +62 -20
  45. package/templates/apps/web/account.config.tsx +101 -0
  46. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
  47. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
  48. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
  49. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
  50. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
  51. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
  52. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
  53. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
  54. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
  55. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
  56. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
  57. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
  58. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
  59. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
  60. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
  61. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
  62. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
  63. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
  64. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
  65. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
  66. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
  67. package/templates/apps/web/app/[locale]/layout.tsx +45 -28
  68. package/templates/apps/web/app/apple-icon.tsx +72 -0
  69. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
  70. package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
  71. package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
  72. package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
  73. package/templates/apps/web/app/og/route.tsx +155 -72
  74. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
  75. package/templates/apps/web/i18n/request.ts +44 -1
  76. package/templates/apps/web/jest.config.cjs +13 -1
  77. package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
  78. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
  79. package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
  80. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
  81. package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
  82. package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
  83. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
  84. package/templates/apps/web/lib/listings.tsx +2 -2
  85. package/templates/apps/web/lib/nav-label-keys.ts +16 -2
  86. package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
  87. package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
  88. package/templates/apps/web/lib/profile-back-link.ts +105 -32
  89. package/templates/apps/web/lib/served-pages.ts +95 -0
  90. package/templates/apps/web/lib/site-brand.tsx +3 -5
  91. package/templates/apps/web/messages/en.json +8 -684
  92. package/templates/apps/web/middleware.ts +3 -1
  93. package/templates/apps/web/next.config.mjs +27 -0
  94. package/templates/apps/web/package.json +1 -0
  95. package/templates/customizations.yaml +9 -0
  96. package/templates/package.json +3 -1
  97. package/templates/tools/lint-architecture.ts +164 -11
  98. package/versions.json +48 -47
  99. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
  100. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
  101. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
  102. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
  103. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
  104. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
  105. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
  106. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
  107. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
  108. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
  109. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
  110. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
  111. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
  112. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
  113. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
  114. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
  115. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
  116. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
  117. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
  118. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
  119. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
  120. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
  121. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
  122. package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
  123. package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
  124. package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
  125. package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
  126. package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
  127. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
  128. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
  129. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
  130. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
  131. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
  132. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
  133. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
  134. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
  135. package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
  136. package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
  137. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
  138. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
  139. package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
  140. package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
  141. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
  142. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
  143. package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
  144. package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
  145. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
  146. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
  147. package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
  148. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
  149. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
  150. package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
  151. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
  152. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
  153. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
  154. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
  155. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
  156. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
  157. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
  158. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
  159. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
  160. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
  161. package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
  162. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
  163. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
  164. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
  165. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
  166. package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
  167. package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
  168. package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
  169. package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
  170. package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
  171. package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
  172. package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
  173. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
  174. package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
  175. package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
  176. package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
  177. package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
  178. package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
  179. package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
  180. package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
  181. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
  182. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
  183. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
  184. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
  185. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
  186. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
  187. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
  188. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
  189. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
  190. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
  191. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
  192. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
  193. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
  194. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
  195. package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
  196. package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
  197. package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
  198. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
  199. package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
  200. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
  201. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
  202. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
  203. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
  204. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
  205. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
  206. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
  207. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
  208. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
  209. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
  210. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
  211. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
  212. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
  213. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
  214. package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
  215. package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
  216. package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
  217. package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
  218. package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
  219. package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
  220. package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
  221. package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
  222. package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
  223. package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
  224. package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
  225. package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
  226. package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
  227. package/templates/apps/web/lib/account-config.ts +0 -678
  228. package/templates/apps/web/lib/checkout-config.ts +0 -16
  229. package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
  230. package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
@@ -1,402 +0,0 @@
1
- // oss: false
2
- /**
3
- * One card, by decision 15's order, and the primary action that follows it
4
- * (#11013 spec E, D-G, D-H, D-K; AC-5).
5
- *
6
- * The page resolves the Product card for an `offering` link from the shown
7
- * set; `ResultsClient` resolves the Meeting card for an `appointment` link
8
- * from the scheduling seam (`ResultsMeetingContext`), which the scheduling
9
- * layout provides and a scaffold without scheduling never does. A by-result
10
- * card beats a link's card, and with neither the top fit renders as one
11
- * `RecommendationCard` — no second fit, no pairing, no side panel. With a
12
- * card its button is the primary and Send it is an outline button; with none
13
- * Send it is primary.
14
- *
15
- * Page mocks mirror `by-result.test.tsx`; client mocks mirror
16
- * `ResultsClient.no-commerce.test.tsx`.
17
- */
18
- import { readFileSync } from "node:fs";
19
- import { join } from "node:path";
20
-
21
- import { render, screen, within } from "@testing-library/react";
22
- import type { FlowConfig, FlowConversionLink } from "@working-theory/validation";
23
- import {
24
- encodePermalink,
25
- PERMALINK_VERSION,
26
- workspaceShownSetWireSchema,
27
- } from "@working-theory/validation";
28
- import type { ReactElement } from "react";
29
-
30
- const mockGet = jest.fn();
31
- const mockShown = jest.fn();
32
- jest.mock("@working-theory/api-client", () => ({
33
- __esModule: true,
34
- flows: { get: (...args: unknown[]) => mockGet(...args) },
35
- offerings: { shown: (...args: unknown[]) => mockShown(...args) },
36
- }));
37
-
38
- const mockRedirect = jest.fn((url: string) => {
39
- throw new Error(`NEXT_REDIRECT:${url}`);
40
- });
41
- jest.mock("next/navigation", () => ({
42
- __esModule: true,
43
- redirect: (url: string) => mockRedirect(url),
44
- }));
45
-
46
- // eslint-disable-next-line no-restricted-syntax -- the boundary under test is the render, not the action (save.actions.test.ts)
47
- jest.mock("../../../save.actions", () => ({ sendResultsEmailAction: jest.fn() }));
48
-
49
- jest.mock("next-intl", () => ({
50
- __esModule: true,
51
- useTranslations:
52
- () =>
53
- (key: string, values?: Record<string, unknown>): string =>
54
- values === undefined
55
- ? key
56
- : `${key}:${Object.entries(values)
57
- .map(([k, v]) => `${k}=${String(v)}`)
58
- .join(",")}`,
59
- useMessages: () => ({}),
60
- }));
61
-
62
- import Page from "../page";
63
- import type { ResultsMeeting } from "../meeting-seam";
64
- import { ResultsMeetingContext } from "../meeting-seam";
65
- import type { ResultsConversionCard, ResultsOfferingCard } from "../ResultsClient";
66
- import { ResultsClient } from "../ResultsClient";
67
-
68
- const SLUG = "readiness";
69
- const en = (s: string) => ({ en: s });
70
- const ANSWERS = { cadence: "weekly" };
71
-
72
- type ServedConfig = FlowConfig & {
73
- conversion?: "none" | "lead" | "lead-link" | "user";
74
- conversionLink?: FlowConversionLink;
75
- };
76
-
77
- /** A recommending magnet with no rows and no ending; `offers` only when asked. */
78
- function config(extra: Record<string, unknown> = {}, withOffers = false): ServedConfig {
79
- return {
80
- slug: SLUG,
81
- defaultLocale: "en",
82
- mode: "recommending",
83
- steps: [
84
- {
85
- key: "q0",
86
- type: "segmentation",
87
- copy: { title: en("How often do you ship?") },
88
- questions: [
89
- {
90
- name: "cadence",
91
- options: [
92
- { value: "monthly", label: en("Monthly") },
93
- { value: "weekly", label: en("Weekly") },
94
- ],
95
- },
96
- ],
97
- },
98
- ],
99
- ...(withOffers
100
- ? {
101
- offers: [
102
- {
103
- key: "pro",
104
- copy: { name: en("Pro") },
105
- price: { kind: "label", label: en("On request") },
106
- rules: [{ when: { answer: "cadence", eq: "weekly" }, reason: en("You ship weekly.") }],
107
- },
108
- {
109
- key: "consult",
110
- copy: { name: en("Consulting") },
111
- price: { kind: "label", label: en("Ask us") },
112
- rules: [{ when: { answer: "cadence", eq: "weekly" }, reason: en("Weekly shippers ask.") }],
113
- },
114
- ],
115
- pairings: [
116
- {
117
- offers: ["pro", "consult"],
118
- reason: en("Better together."),
119
- when: { answer: "cadence", eq: "weekly" },
120
- },
121
- ],
122
- }
123
- : {}),
124
- recommendation: { key: "result", copy: { title: en("Your result") } },
125
- conversion: "lead-link",
126
- ...extra,
127
- } as ServedConfig;
128
- }
129
-
130
- const SHOWN_SET = workspaceShownSetWireSchema.parse({
131
- productIds: ["prod_growth", "prod_scale"],
132
- recommended: { plan: null, addon: null },
133
- offerings: [
134
- {
135
- productId: "prod_growth",
136
- plan: "growth",
137
- name: "Growth",
138
- description: "Hands-on growth, every month.",
139
- marketingFeatures: ["Up to 40 hours a month", "Growth Hub"],
140
- unitLabel: null,
141
- note: null,
142
- termsNote: null,
143
- ailkGroup: "plan",
144
- ailkOrder: null,
145
- recommended: false,
146
- prices: [
147
- {
148
- priceId: "price_growth_monthly",
149
- lookupKey: "growth_monthly",
150
- plan: "growth",
151
- period: "monthly",
152
- interval: "month",
153
- amount: 120000,
154
- currency: "usd",
155
- },
156
- ],
157
- },
158
- {
159
- productId: "prod_scale",
160
- plan: "scale",
161
- name: "Scale",
162
- description: null,
163
- marketingFeatures: [],
164
- unitLabel: null,
165
- note: null,
166
- termsNote: null,
167
- ailkGroup: "plan",
168
- ailkOrder: null,
169
- recommended: false,
170
- prices: [
171
- {
172
- priceId: "price_scale_monthly",
173
- lookupKey: "scale_monthly",
174
- plan: "scale",
175
- period: "monthly",
176
- interval: "month",
177
- amount: 250000,
178
- currency: "usd",
179
- },
180
- ],
181
- },
182
- ],
183
- state: "current",
184
- snapshotAt: "2026-11-04T12:00:00.000Z",
185
- });
186
-
187
- function page(cfg: ServedConfig): Promise<ReactElement> {
188
- mockGet.mockResolvedValue({ ok: true, status: 200, body: cfg });
189
- return Page({
190
- params: Promise.resolve({
191
- locale: "en",
192
- slug: SLUG,
193
- payload: encodePermalink({ version: PERMALINK_VERSION, flowSlug: SLUG, answers: ANSWERS }),
194
- }),
195
- });
196
- }
197
-
198
- const INTRO: ResultsMeeting = {
199
- slug: "intro",
200
- title: "Intro",
201
- description: "Quick intro meeting",
202
- href: "/en/meet/intro",
203
- bookLabel: "Book 15 min",
204
- };
205
-
206
- function renderClient(
207
- cfg: ServedConfig,
208
- extra: { offeringCard?: ResultsOfferingCard; conversionCard?: ResultsConversionCard } = {},
209
- meeting?: ResultsMeeting,
210
- ): void {
211
- const client = (
212
- <ResultsClient config={cfg} locale="en" answers={ANSWERS} slug={SLUG} payload="v1-abc" {...extra} />
213
- );
214
- render(
215
- meeting !== undefined ? (
216
- <ResultsMeetingContext.Provider value={meeting}>{client}</ResultsMeetingContext.Provider>
217
- ) : (
218
- client
219
- ),
220
- );
221
- }
222
-
223
- const BRAND_FILL = "bg-(--color-brand)";
224
- const OUTLINE_FILL = "bg-transparent";
225
-
226
- beforeAll(() => {
227
- jest.useFakeTimers({ now: new Date("2026-11-04T12:00:00.000Z") });
228
- });
229
-
230
- afterAll(() => {
231
- jest.useRealTimers();
232
- });
233
-
234
- beforeEach(() => {
235
- // The page shares its shown-set read for 15 s; each case starts later.
236
- jest.setSystemTime(Date.now() + 16_000);
237
- mockGet.mockReset();
238
- mockShown.mockReset();
239
- mockRedirect.mockClear();
240
- window.sessionStorage.clear();
241
- mockShown.mockResolvedValue({ ok: true, status: 200, body: { status: "shown", shownSet: SHOWN_SET } });
242
- });
243
-
244
- describe("AC-5 — Email links to an offering: the Product card (decision 14)", () => {
245
- it("renders the shown product's name, price, description, features under What's included, and Get Started to /pricing?plan=", async () => {
246
- render(await page(config({ conversionLink: { kind: "offering", id: "growth" } })));
247
- expect(mockRedirect).not.toHaveBeenCalled();
248
- const card = screen.getByTestId("flow-results-card");
249
- expect(within(card).getByRole("heading", { name: "Growth" })).toBeInTheDocument();
250
- expect(within(card).getByTestId("flow-results-card-price")).toHaveTextContent("monthly:amount=$1,200");
251
- expect(within(card).getByTestId("flow-results-card-description")).toHaveTextContent(
252
- "Hands-on growth, every month.",
253
- );
254
- expect(within(card).getByText("whatsIncluded")).toBeInTheDocument();
255
- const features = within(card).getAllByRole("listitem").map((li) => li.textContent);
256
- expect(features).toEqual(["Up to 40 hours a month", "Growth Hub"]);
257
- const action = within(card).getByTestId("flow-results-card-action");
258
- expect(action.getAttribute("href")).toBe("/en/pricing?plan=growth");
259
- expect(action).toHaveTextContent("getStarted");
260
- expect(within(card).getByText("priceCard.eyebrow")).toBeInTheDocument();
261
- expect(screen.getAllByTestId("flow-results-card")).toHaveLength(1);
262
- });
263
-
264
- it("with a null description no description line renders", async () => {
265
- render(await page(config({ conversionLink: { kind: "offering", id: "scale" } })));
266
- const card = screen.getByTestId("flow-results-card");
267
- expect(within(card).getByRole("heading", { name: "Scale" })).toBeInTheDocument();
268
- expect(within(card).queryByTestId("flow-results-card-description")).not.toBeInTheDocument();
269
- expect(within(card).queryByText("whatsIncluded")).not.toBeInTheDocument();
270
- });
271
-
272
- it("an offering not in the shown set gives no card", async () => {
273
- render(await page(config({ conversionLink: { kind: "offering", id: "draft" } })));
274
- expect(screen.getByTestId("flow-results")).toBeInTheDocument();
275
- expect(screen.queryByTestId("flow-results-card")).not.toBeInTheDocument();
276
- });
277
-
278
- it.each(["results", "magnet"])("a %s link gives no card and no shown read", async (kind) => {
279
- render(await page(config({ conversionLink: { kind, id: kind === "results" ? "flow_12345678-1234-1234-1234-123456789abc" : "other" } })));
280
- expect(screen.queryByTestId("flow-results-card")).not.toBeInTheDocument();
281
- expect(mockShown).not.toHaveBeenCalled();
282
- });
283
- });
284
-
285
- describe("AC-5 — Email links to an appointment: the Meeting card from the scheduling seam (D-K)", () => {
286
- it("under the provider renders the meeting's title, description and a link to its page labelled with its bookLabel", () => {
287
- renderClient(config({ conversionLink: { kind: "appointment", id: "intro" } }), {}, INTRO);
288
- const card = screen.getByTestId("flow-results-card");
289
- expect(within(card).getByRole("heading", { name: "Intro" })).toBeInTheDocument();
290
- expect(within(card).getByTestId("flow-results-card-description")).toHaveTextContent("Quick intro meeting");
291
- const action = within(card).getByTestId("flow-results-card-action");
292
- expect(action.getAttribute("href")).toBe("/en/meet/intro");
293
- expect(action).toHaveTextContent("Book 15 min");
294
- expect(within(card).queryByTestId("flow-results-card-price")).not.toBeInTheDocument();
295
- });
296
-
297
- it("a slug the provider does not hold renders no card", () => {
298
- renderClient(config({ conversionLink: { kind: "appointment", id: "working" } }), {}, INTRO);
299
- expect(screen.queryByTestId("flow-results-card")).not.toBeInTheDocument();
300
- });
301
-
302
- it("a results link renders no card even with a meeting provided", () => {
303
- renderClient(config({ conversionLink: { kind: "results", id: "flow_12345678-1234-1234-1234-123456789abc" } }), {}, INTRO);
304
- expect(screen.queryByTestId("flow-results-card")).not.toBeInTheDocument();
305
- });
306
-
307
- it("no scheduling (no provider): an appointment link renders no Meeting card — the top fit renders instead", () => {
308
- renderClient(config({ conversionLink: { kind: "appointment", id: "intro" } }, true));
309
- expect(screen.queryByTestId("flow-results-card")).not.toBeInTheDocument();
310
- expect(screen.getByTestId("recommendation-card-pro")).toBeInTheDocument();
311
- });
312
- });
313
-
314
- describe("AC-5 — the signal-collectors files name no scheduling file", () => {
315
- const RESULTS_DIR = join(__dirname, "..");
316
- it.each(["page.tsx", "ResultsClient.tsx", "ResultsCard.tsx", "meeting-seam.ts"])(
317
- "%s imports neither lib/meetings nor the results layout",
318
- (file) => {
319
- const source = readFileSync(join(RESULTS_DIR, file), "utf8");
320
- expect(source).not.toMatch(/from "[^"]*lib\/meetings/);
321
- expect(source).not.toMatch(/from "\.\.\/layout"/);
322
- expect(source).not.toMatch(/from "\.\.\/ResultsMeetingsProvider"/);
323
- },
324
- );
325
- });
326
-
327
- describe("AC-5 — one card, by decision 15's order", () => {
328
- const OFFERING_CARD: ResultsOfferingCard = {
329
- offeringKey: "growth",
330
- title: "Growth (by result)",
331
- price: { amount: 120000, currency: "usd", period: "monthly" },
332
- href: "/en/pricing?plan=growth",
333
- };
334
- const PRODUCT_CARD: ResultsConversionCard = {
335
- kind: "product",
336
- name: "Scale (linked)",
337
- features: [],
338
- href: "/en/pricing?plan=scale",
339
- };
340
-
341
- it("a by-result offering row and a conversionLink together render only the by-result card", () => {
342
- renderClient(config({ conversionLink: { kind: "offering", id: "scale" } }, true), {
343
- offeringCard: OFFERING_CARD,
344
- conversionCard: PRODUCT_CARD,
345
- });
346
- const cards = screen.getAllByTestId("flow-results-card");
347
- expect(cards).toHaveLength(1);
348
- expect(within(cards[0]!).getByRole("heading", { name: "Growth (by result)" })).toBeInTheDocument();
349
- expect(screen.queryByText("Scale (linked)")).not.toBeInTheDocument();
350
- expect(screen.queryByTestId("recommendation-card-pro")).not.toBeInTheDocument();
351
- });
352
-
353
- it("a link's card beats the older offer", () => {
354
- renderClient(config({ conversionLink: { kind: "offering", id: "scale" } }, true), {
355
- conversionCard: PRODUCT_CARD,
356
- });
357
- expect(screen.getByTestId("flow-results-card")).toBeInTheDocument();
358
- expect(screen.queryByTestId("recommendation-card-pro")).not.toBeInTheDocument();
359
- });
360
-
361
- it("with neither, the top fit renders as one RecommendationCard and no other fit, pairing or side panel", () => {
362
- renderClient(config({}, true));
363
- expect(screen.getByTestId("recommendation-card-pro")).toBeInTheDocument();
364
- expect(screen.queryByTestId("recommendation-card-consult")).not.toBeInTheDocument();
365
- expect(screen.queryByTestId("recommendation-pairing")).not.toBeInTheDocument();
366
- expect(screen.queryByTestId("flow-side-panel-safe-default")).not.toBeInTheDocument();
367
- expect(screen.queryByTestId("flow-results-card")).not.toBeInTheDocument();
368
- expect(screen.getAllByTestId(/^recommendation-card-[a-z_]+$/)).toHaveLength(1);
369
- });
370
-
371
- it("with no fit and no link, no card renders", () => {
372
- renderClient(config());
373
- expect(screen.queryByTestId("flow-results-card")).not.toBeInTheDocument();
374
- expect(screen.queryAllByTestId(/^recommendation-card-[a-z_]+$/)).toHaveLength(0);
375
- });
376
- });
377
-
378
- describe("AC-5 — the primary action follows the card (decision 16)", () => {
379
- it("with a card, its button is the primary and Send it is an outline button", () => {
380
- renderClient(config({ conversionLink: { kind: "appointment", id: "intro" } }), {}, INTRO);
381
- expect(screen.getByTestId("flow-results-card-action").className).toContain(BRAND_FILL);
382
- // Decision 16 — below `md:` the dock carries the card's button; the card's own shows from `md:`.
383
- expect(screen.getByTestId("flow-results-card-action").parentElement?.className).toContain("hidden md:block");
384
- const send = screen.getByTestId("flow-results-report-send");
385
- expect(send.className).toContain(OUTLINE_FILL);
386
- expect(send.className).not.toContain(BRAND_FILL);
387
- });
388
-
389
- it("with no card, Send it is the primary", () => {
390
- renderClient(config());
391
- const send = screen.getByTestId("flow-results-report-send");
392
- expect(send.className).toContain(BRAND_FILL);
393
- expect(send.className).not.toContain(OUTLINE_FILL);
394
- });
395
-
396
- it("the card comes before the form in DOM order", () => {
397
- renderClient(config({ conversionLink: { kind: "appointment", id: "intro" } }), {}, INTRO);
398
- const card = screen.getByTestId("flow-results-card");
399
- const form = screen.getByTestId("flow-results-report");
400
- expect(card.compareDocumentPosition(form) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
401
- });
402
- });
@@ -1,293 +0,0 @@
1
- // oss: false
2
- /**
3
- * Tests for the recommender's landing on the results permalink (#9071 D3,
4
- * AC-2(a)).
5
- *
6
- * A recommending flow with an offer carrying `lookupKey` is an Offerings
7
- * recommender: its completed walk lands on `/<locale>/pricing?plan=<plan>`
8
- * while the first fit's Price is in the current shown set, else on
9
- * `/<locale>/pricing` with no badge. A flow with no such offer, or whose
10
- * first fit carries none, renders `ResultsClient` exactly as before with no
11
- * shown-set read (AC-3's `page.test.tsx` holds the legacy render unchanged).
12
- *
13
- * `redirect` throws `NEXT_REDIRECT:<url>` as in `page.test.tsx`; the clock is
14
- * jest's modern fake timers, moved 16 s between cases so the page's 15 s
15
- * shown-set read never carries over.
16
- */
17
- import { render, screen } from "@testing-library/react";
18
- import type { FlowConfig, WorkspaceShownSetWire } from "@working-theory/validation";
19
- import {
20
- encodePermalink,
21
- PERMALINK_VERSION,
22
- workspaceShownSetWireSchema,
23
- } from "@working-theory/validation";
24
- import type { ReactElement } from "react";
25
-
26
- const mockGet = jest.fn();
27
- const mockShown = jest.fn();
28
- jest.mock("@working-theory/api-client", () => ({
29
- __esModule: true,
30
- flows: { get: (...args: unknown[]) => mockGet(...args) },
31
- offerings: { shown: (...args: unknown[]) => mockShown(...args) },
32
- }));
33
-
34
- const mockRedirect = jest.fn((url: string) => {
35
- throw new Error(`NEXT_REDIRECT:${url}`);
36
- });
37
- jest.mock("next/navigation", () => ({
38
- __esModule: true,
39
- redirect: (url: string) => mockRedirect(url),
40
- }));
41
-
42
- jest.mock("next-intl", () => ({
43
- __esModule: true,
44
- useTranslations: () => (key: string) => key,
45
- useMessages: () => ({}),
46
- }));
47
-
48
- import Page from "../page";
49
-
50
- const SLUG = "recommender";
51
- const en = (s: string) => ({ en: s });
52
-
53
- type Offer = NonNullable<FlowConfig["offers"]>[number];
54
-
55
- function offer(key: string, eq: string, lookupKey?: string): Offer {
56
- return {
57
- key,
58
- copy: { name: en(key) },
59
- price: { kind: "label", label: en("$29 / month") },
60
- rules: [{ when: { answer: "team", eq }, reason: en(`Because ${eq}.`) }],
61
- ...(lookupKey !== undefined ? { lookupKey } : {}),
62
- };
63
- }
64
-
65
- function config(offers: unknown = [
66
- offer("starter", "solo", "starter_monthly"),
67
- offer("agency", "agency", "agency-pro_yearly"),
68
- ]): FlowConfig {
69
- return {
70
- slug: SLUG,
71
- defaultLocale: "en",
72
- mode: "recommending",
73
- steps: [
74
- {
75
- key: "q0",
76
- type: "segmentation",
77
- copy: { title: en("Who are you?") },
78
- questions: [
79
- {
80
- name: "team",
81
- options: [
82
- { value: "solo", label: en("Solo") },
83
- { value: "agency", label: en("Agency") },
84
- ],
85
- },
86
- ],
87
- },
88
- ],
89
- offers,
90
- } as FlowConfig;
91
- }
92
-
93
- function product(productId: string, plan: string, periods: Array<"monthly" | "yearly">) {
94
- return {
95
- productId,
96
- plan,
97
- name: plan,
98
- description: null,
99
- marketingFeatures: [],
100
- unitLabel: null,
101
- note: null,
102
- termsNote: null,
103
- ailkGroup: "plan" as const,
104
- ailkOrder: null,
105
- recommended: false,
106
- prices: periods.map((period) => ({
107
- priceId: `price_${plan}${period}`,
108
- lookupKey: `${plan}_${period}`,
109
- plan,
110
- period,
111
- interval: period === "monthly" ? ("month" as const) : ("year" as const),
112
- amount: 2900,
113
- currency: "usd",
114
- })),
115
- };
116
- }
117
-
118
- function shownSet(
119
- over: Partial<WorkspaceShownSetWire> = {},
120
- products = [
121
- product("prod_starter", "starter", ["monthly", "yearly"]),
122
- product("prod_agency", "agency-pro", ["yearly"]),
123
- ],
124
- ): WorkspaceShownSetWire {
125
- return workspaceShownSetWireSchema.parse({
126
- productIds: products.map((p) => p.productId),
127
- recommended: { plan: null, addon: null },
128
- offerings: products,
129
- state: "current",
130
- snapshotAt: "2026-10-18T12:00:00.000Z",
131
- ...over,
132
- });
133
- }
134
-
135
- const SHOWN = { ok: true, status: 200, body: { status: "shown", shownSet: shownSet() } };
136
-
137
- function payloadFor(answers: Record<string, string>): string {
138
- return encodePermalink({ version: PERMALINK_VERSION, flowSlug: SLUG, answers });
139
- }
140
-
141
- function page(answers: Record<string, string>, locale = "en"): Promise<ReactElement> {
142
- return Page({
143
- params: Promise.resolve({ locale, slug: SLUG, payload: payloadFor(answers) }),
144
- });
145
- }
146
-
147
- async function landing(answers: Record<string, string>, locale = "en"): Promise<string> {
148
- const err = await page(answers, locale).then(
149
- () => null,
150
- (e: unknown) => e,
151
- );
152
- const message = err instanceof Error ? err.message : "";
153
- if (!message.startsWith("NEXT_REDIRECT:")) throw new Error(`no redirect: ${String(err)}`);
154
- return message.slice("NEXT_REDIRECT:".length);
155
- }
156
-
157
- const originalLocales = process.env.NEXT_PUBLIC_ENABLED_LOCALES;
158
-
159
- beforeAll(() => {
160
- delete process.env.NEXT_PUBLIC_ENABLED_LOCALES;
161
- jest.useFakeTimers({ now: new Date("2026-10-18T12:00:00.000Z") });
162
- });
163
-
164
- afterAll(() => {
165
- jest.useRealTimers();
166
- if (originalLocales !== undefined) process.env.NEXT_PUBLIC_ENABLED_LOCALES = originalLocales;
167
- });
168
-
169
- beforeEach(() => {
170
- // Past the shared read's 15 s window, so no case sees another's read.
171
- jest.setSystemTime(Date.now() + 16_000);
172
- mockGet.mockReset();
173
- mockShown.mockReset();
174
- mockRedirect.mockClear();
175
- mockGet.mockResolvedValue({ ok: true, status: 200, body: config() });
176
- mockShown.mockResolvedValue(SHOWN);
177
- });
178
-
179
- afterEach(() => {
180
- for (const [url] of mockRedirect.mock.calls) {
181
- expect(url).toMatch(/^[a-z0-9/?=-]+$/);
182
- expect(url).not.toContain("_");
183
- expect(url).not.toContain("://");
184
- }
185
- });
186
-
187
- describe("#9071 AC-2(a) — a shown recommendation lands on /pricing?plan=<plan>", () => {
188
- it("solo → the starter plan", async () => {
189
- await expect(landing({ team: "solo" })).resolves.toBe("/en/pricing?plan=starter");
190
- });
191
-
192
- it("agency → the agency-pro plan", async () => {
193
- await expect(landing({ team: "agency" })).resolves.toBe("/en/pricing?plan=agency-pro");
194
- });
195
-
196
- it("a locale that is not enabled lands on the default locale", async () => {
197
- await expect(landing({ team: "solo" }, "fr")).resolves.toBe("/en/pricing?plan=starter");
198
- });
199
- });
200
-
201
- describe("#9071 AC-2(a) — a product no longer shown lands on /pricing with no badge", () => {
202
- it("agency-pro removed from the shown set", async () => {
203
- mockShown.mockResolvedValue({
204
- ok: true,
205
- status: 200,
206
- body: {
207
- status: "shown",
208
- shownSet: shownSet({}, [product("prod_starter", "starter", ["monthly", "yearly"])]),
209
- },
210
- });
211
- await expect(landing({ team: "agency" })).resolves.toBe("/en/pricing");
212
- });
213
-
214
- it.each<[string, () => unknown]>([
215
- ["unconnected", () => Promise.resolve({ ok: true, status: 200, body: { status: "unconnected" } })],
216
- ["empty", () => Promise.resolve({ ok: true, status: 200, body: { status: "empty" } })],
217
- [
218
- "an expired shown set",
219
- () =>
220
- Promise.resolve({
221
- ok: true,
222
- status: 200,
223
- body: { status: "shown", shownSet: shownSet({ state: "expired" }) },
224
- }),
225
- ],
226
- ["a 500", () => Promise.resolve({ ok: false, status: 500, error: { code: "internal_error" } })],
227
- ["a body the schema refuses", () => Promise.resolve({ ok: true, status: 200, body: { status: "shown" } })],
228
- ["a rejecting call", () => Promise.reject(new Error("ECONNREFUSED"))],
229
- ])("%s → /en/pricing", async (_label, answer) => {
230
- mockShown.mockImplementation(answer);
231
- await expect(landing({ team: "solo" })).resolves.toBe("/en/pricing");
232
- });
233
-
234
- it("a read that never settles is given up after 5 s → /en/pricing", async () => {
235
- mockShown.mockImplementation(() => new Promise(() => undefined));
236
- const outcome = landing({ team: "solo" });
237
- await jest.advanceTimersByTimeAsync(5_000);
238
- await expect(outcome).resolves.toBe("/en/pricing");
239
- });
240
-
241
- it("answers matching no rule → /en/pricing with no shown read", async () => {
242
- await expect(landing({ team: "other" })).resolves.toBe("/en/pricing");
243
- expect(mockShown).not.toHaveBeenCalled();
244
- });
245
- });
246
-
247
- describe("#9071 D3a — one shown-set read per instance per 15 seconds", () => {
248
- it("two requests at one clock share one read; one 16 s later reads again", async () => {
249
- await landing({ team: "solo" });
250
- await landing({ team: "agency" });
251
- expect(mockShown).toHaveBeenCalledTimes(1);
252
- jest.setSystemTime(Date.now() + 16_000);
253
- await landing({ team: "solo" });
254
- expect(mockShown).toHaveBeenCalledTimes(2);
255
- });
256
- });
257
-
258
- describe("#9071 C6 — a flow that is not an Offerings recommender renders as before", () => {
259
- it("a mixed flow whose first fit has no lookupKey renders ResultsClient, no redirect, no read", async () => {
260
- mockGet.mockResolvedValue({
261
- ok: true,
262
- status: 200,
263
- body: config([offer("free", "solo"), offer("agency", "agency", "agency-pro_yearly")]),
264
- });
265
- render(await page({ team: "solo" }));
266
- expect(screen.getByTestId("flow-results")).toBeInTheDocument();
267
- expect(mockRedirect).not.toHaveBeenCalled();
268
- expect(mockShown).not.toHaveBeenCalled();
269
- });
270
-
271
- it("an offer with lookupKey: null is no Offerings offer: today's page, no read", async () => {
272
- mockGet.mockResolvedValue({
273
- ok: true,
274
- status: 200,
275
- body: config([{ ...offer("starter", "solo"), lookupKey: null }]),
276
- });
277
- render(await page({ team: "solo" }));
278
- expect(screen.getByTestId("flow-results")).toBeInTheDocument();
279
- expect(mockRedirect).not.toHaveBeenCalled();
280
- expect(mockShown).not.toHaveBeenCalled();
281
- });
282
-
283
- it("offers that are not an array never reach the landing or the read", async () => {
284
- mockGet.mockResolvedValue({
285
- ok: true,
286
- status: 200,
287
- body: config({ starter: offer("starter", "solo", "starter_monthly") }),
288
- });
289
- await page({ team: "solo" }).catch(() => undefined);
290
- expect(mockRedirect).not.toHaveBeenCalled();
291
- expect(mockShown).not.toHaveBeenCalled();
292
- });
293
- });