create-ailk 0.22.0 → 0.23.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 (238) hide show
  1. package/component-catalog.json +149 -5
  2. package/component-catalog.md +7 -6
  3. package/dist/add-module.js +11 -9
  4. package/dist/add-route.d.ts +55 -1
  5. package/dist/add-route.js +294 -12
  6. package/dist/cli.js +27 -10
  7. package/dist/derive-architecture.d.ts +7 -5
  8. package/dist/derive-architecture.js +9 -32
  9. package/dist/lib/design-checks.js +4 -2
  10. package/dist/lib/env-catalog.js +0 -4
  11. package/dist/lib/npm-auth.d.ts +9 -0
  12. package/dist/lib/npm-auth.js +48 -0
  13. package/dist/lib/scaffold-render-sweep.d.ts +3 -2
  14. package/dist/lib/scaffold-render-sweep.js +5 -8
  15. package/dist/module-architecture.js +98 -10
  16. package/dist/paid-sections.d.ts +21 -2
  17. package/dist/paid-sections.js +69 -7
  18. package/dist/seed-flows.d.ts +4 -1
  19. package/dist/seed-flows.js +50 -4
  20. package/dist/spoke-checkout.d.ts +38 -35
  21. package/dist/spoke-checkout.js +66 -229
  22. package/dist/starter-grid.d.ts +0 -3
  23. package/dist/starter-grid.js +24 -14
  24. package/dist/surfaces.js +33 -12
  25. package/dist/sync-routes.d.ts +38 -1
  26. package/dist/sync-routes.js +184 -11
  27. package/dist/template-record.d.ts +1 -1
  28. package/dist/template-record.js +3 -2
  29. package/dist/update.js +10 -0
  30. package/package.json +3 -3
  31. package/site-templates/_base/content/en/NewsletterSignup/newsletter.mdx +4 -49
  32. package/site-templates/_base/content/en/Pricing/pricing.mdx +3 -21
  33. package/site-templates/marketing-site/TEMPLATE-MANIFEST.json +23 -20
  34. package/site-templates/marketing-site/TEMPLATE-MANIFEST.md +28 -14
  35. package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.json +15 -39
  36. package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.md +38 -34
  37. package/site-templates/marketing-site-free/content/en/NewsletterSignup/newsletter.mdx +6 -43
  38. package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.json +14 -31
  39. package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.md +26 -25
  40. package/site-templates/shapes/local-business-service/content/en/NewsletterSignup/newsletter.mdx +6 -43
  41. package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.json +14 -31
  42. package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.md +26 -25
  43. package/site-templates/shapes/organization-service/content/en/NewsletterSignup/newsletter.mdx +6 -43
  44. package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.json +14 -31
  45. package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.md +26 -25
  46. package/site-templates/shapes/person-service/content/en/NewsletterSignup/newsletter.mdx +6 -43
  47. package/templates/.env.example +9 -7
  48. package/templates/.github/workflows/ci.yml +13 -0
  49. package/templates/README.md +1 -0
  50. package/templates/_gitignore +4 -0
  51. package/templates/apps/api/.env.example +27 -0
  52. package/templates/apps/api/CLAUDE.md +77 -16
  53. package/templates/apps/api/package.json +1 -0
  54. package/templates/apps/api/src/__tests__/factories/in-memory-prisma.ts +2 -0
  55. package/templates/apps/api/src/bin/stripe-connections-rekey.ts +45 -0
  56. package/templates/apps/api/src/config/__tests__/stripe-connection-key.test.ts +185 -0
  57. package/templates/apps/api/src/config/index.ts +109 -0
  58. package/templates/apps/api/src/lib/__mocks__/prisma.ts +3 -0
  59. package/templates/apps/api/src/lib/__tests__/flow-rename-race.db.test.ts +116 -0
  60. package/templates/apps/api/src/lib/error-serializer.ts +74 -7
  61. package/templates/apps/api/src/lib/stripe.ts +74 -4
  62. package/templates/apps/api/src/lib/webhook-idempotency.ts +66 -2
  63. package/templates/apps/api/src/middleware/__tests__/rate-limit.test.ts +218 -0
  64. package/templates/apps/api/src/middleware/__tests__/write-budget.test.ts +174 -0
  65. package/templates/apps/api/src/middleware/rate-limit.ts +226 -4
  66. package/templates/apps/api/src/openapi/spec.ts +10 -7
  67. package/templates/apps/api/src/routes/billing/plan-checkout.ts +325 -0
  68. package/templates/apps/api/src/routes/checkout/__tests__/live-key.test.ts +11 -0
  69. package/templates/apps/api/src/routes/checkout/__tests__/offerings-authorization.test.ts +1300 -0
  70. package/templates/apps/api/src/routes/checkout/__tests__/session.test.ts +11 -0
  71. package/templates/apps/api/src/routes/checkout/__tests__/sessions.test.ts +49 -0
  72. package/templates/apps/api/src/routes/checkout/session.ts +57 -25
  73. package/templates/apps/api/src/routes/checkout/sessions.ts +232 -82
  74. package/templates/apps/api/src/routes/consent/__tests__/account.test.ts +5 -5
  75. package/templates/apps/api/src/routes/consent/__tests__/sign-up-rate-limit.test.ts +160 -0
  76. package/templates/apps/api/src/routes/consent/account.ts +4 -2
  77. package/templates/apps/api/src/routes/content/__tests__/get-page.test.ts +2 -2
  78. package/templates/apps/api/src/routes/content/__tests__/offerings.test.ts +731 -0
  79. package/templates/apps/api/src/routes/content/__tests__/pricing.test.ts +753 -0
  80. package/templates/apps/api/src/routes/content/__tests__/shown-offerings.test.ts +762 -0
  81. package/templates/apps/api/src/routes/content/index.ts +16 -2
  82. package/templates/apps/api/src/routes/content/offerings.ts +184 -0
  83. package/templates/apps/api/src/routes/content/pricing.ts +176 -0
  84. package/templates/apps/api/src/routes/content/shown-offerings.ts +229 -0
  85. package/templates/apps/api/src/routes/leads/index.ts +17 -14
  86. package/templates/apps/api/src/routes/webhooks/README.md +66 -0
  87. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-offerings.test.ts +814 -0
  88. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-org-billing.test.ts +80 -68
  89. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-site-filter.test.ts +5 -5
  90. package/templates/apps/api/src/routes/webhooks/__tests__/stripe.test.ts +8 -2
  91. package/templates/apps/api/src/routes/webhooks/index.ts +23 -0
  92. package/templates/apps/api/src/routes/webhooks/stripe-offerings.ts +384 -0
  93. package/templates/apps/api/src/routes/webhooks/stripe.ts +91 -17
  94. package/templates/apps/api/src/server.ts +140 -51
  95. package/templates/apps/api/src/services/__tests__/checkout-plan.test.ts +313 -0
  96. package/templates/apps/api/src/services/__tests__/deliverable-fulfillment.test.ts +51 -2
  97. package/templates/apps/api/src/services/__tests__/keyless-workspace-predicate.test.ts +234 -0
  98. package/templates/apps/api/src/services/__tests__/lead-routing.test.ts +374 -44
  99. package/templates/apps/api/src/services/__tests__/person.test.ts +232 -1
  100. package/templates/apps/api/src/services/__tests__/plan-offerings.test.ts +444 -0
  101. package/templates/apps/api/src/services/deliverable-fulfillment.ts +13 -5
  102. package/templates/apps/api/src/services/entitlements.ts +157 -1
  103. package/templates/apps/api/src/services/lead-routing.ts +113 -58
  104. package/templates/apps/api/src/services/offerings/__tests__/catalog.test.ts +295 -0
  105. package/templates/apps/api/src/services/offerings/__tests__/checkout-session-record.test.ts +268 -0
  106. package/templates/apps/api/src/services/offerings/__tests__/connection.test.ts +868 -0
  107. package/templates/apps/api/src/services/offerings/__tests__/fixtures.ts +416 -0
  108. package/templates/apps/api/src/services/offerings/__tests__/org-products.test.ts +396 -0
  109. package/templates/apps/api/src/services/offerings/__tests__/readers.test.ts +681 -0
  110. package/templates/apps/api/src/services/offerings/__tests__/source.test.ts +231 -0
  111. package/templates/apps/api/src/services/offerings/catalog.ts +308 -0
  112. package/templates/apps/api/src/services/offerings/checkout-authorization.ts +385 -0
  113. package/templates/apps/api/src/services/offerings/checkout-session-record.ts +192 -0
  114. package/templates/apps/api/src/services/offerings/connection.ts +1003 -0
  115. package/templates/apps/api/src/services/offerings/index.ts +614 -0
  116. package/templates/apps/api/src/services/offerings/source.ts +140 -0
  117. package/templates/apps/api/src/services/offerings/store.ts +150 -0
  118. package/templates/apps/api/src/services/person.ts +124 -9
  119. package/templates/apps/api/src/services/plan-offerings.ts +96 -30
  120. package/templates/apps/api/src/services/public-site-resolver.ts +19 -14
  121. package/templates/apps/mcp/CLAUDE.md +22 -14
  122. package/templates/apps/mcp/__tests__/catalog-drift.test.ts +9 -4
  123. package/templates/apps/mcp/__tests__/get_offerings.test.ts +358 -0
  124. package/templates/apps/mcp/__tests__/get_pricing.test.ts +364 -0
  125. package/templates/apps/mcp/__tests__/http-transport.test.ts +4 -4
  126. package/templates/apps/mcp/__tests__/module-exclusion.test.ts +2 -2
  127. package/templates/apps/mcp/__tests__/server.test.ts +13 -11
  128. package/templates/apps/mcp/__tests__/start_purchase.test.ts +208 -12
  129. package/templates/apps/mcp/__tests__/tools/purchase.test.ts +11 -11
  130. package/templates/apps/mcp/src/lib/shown-offerings.ts +105 -0
  131. package/templates/apps/mcp/src/server.ts +5 -0
  132. package/templates/apps/mcp/src/tools/get_offerings.ts +47 -30
  133. package/templates/apps/mcp/src/tools/get_pricing.ts +40 -40
  134. package/templates/apps/mcp/src/tools/purchase.ts +30 -2
  135. package/templates/apps/mcp/src/workspace-server.ts +15 -0
  136. package/templates/apps/web/.env.example +10 -31
  137. package/templates/apps/web/CLAUDE.md +315 -42
  138. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +3 -3
  139. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +3 -3
  140. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +3 -3
  141. package/templates/apps/web/app/[locale]/careers/[slug]/[action]/page.tsx +189 -0
  142. package/templates/apps/web/app/[locale]/careers/[slug]/apply.actions.ts +4 -2
  143. package/templates/apps/web/app/[locale]/careers/[slug]/job-application-form.ts +8 -3
  144. package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +22 -144
  145. package/templates/apps/web/app/[locale]/careers/__tests__/apply.actions.test.ts +9 -0
  146. package/templates/apps/web/app/[locale]/careers/__tests__/careers-hub.test.tsx +172 -0
  147. package/templates/apps/web/app/[locale]/careers/__tests__/careers-set.test.tsx +149 -0
  148. package/templates/apps/web/app/[locale]/careers/__tests__/job-application-form.test.ts +22 -24
  149. package/templates/apps/web/app/[locale]/careers/__tests__/job-apply-page.test.tsx +140 -66
  150. package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +57 -22
  151. package/templates/apps/web/app/[locale]/careers/page.tsx +129 -5
  152. package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +119 -11
  153. package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +28 -5
  154. package/templates/apps/web/app/[locale]/contact/contact.actions.ts +6 -2
  155. package/templates/apps/web/app/[locale]/contact/page.tsx +99 -92
  156. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +237 -5
  157. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +43 -0
  158. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +200 -0
  159. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +197 -0
  160. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +430 -0
  161. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +21 -9
  162. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +352 -0
  163. package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +12 -73
  164. package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +10 -31
  165. package/templates/apps/web/app/[locale]/layout.tsx +55 -4
  166. package/templates/apps/web/app/[locale]/newsletter/__tests__/page.test.tsx +174 -104
  167. package/templates/apps/web/app/[locale]/newsletter/page.tsx +95 -58
  168. package/templates/apps/web/app/[locale]/pricing/__tests__/__snapshots__/unconnected.test.tsx.snap +7 -0
  169. package/templates/apps/web/app/[locale]/pricing/__tests__/offerings.test.tsx +599 -0
  170. package/templates/apps/web/app/[locale]/pricing/__tests__/page.test.tsx +216 -0
  171. package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +236 -0
  172. package/templates/apps/web/app/[locale]/pricing/page.tsx +367 -6
  173. package/templates/apps/web/app/[locale]/team/__tests__/team-routes.test.tsx +4 -1
  174. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +17 -0
  175. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +62 -3
  176. package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +70 -18
  177. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +30 -9
  178. package/templates/apps/web/app/api/offerings/checkout/[lookupKey]/route.ts +316 -0
  179. package/templates/apps/web/app/api/offerings/checkout/__tests__/route.test.ts +810 -0
  180. package/templates/apps/web/lib/__tests__/auth-routes.test.ts +27 -1
  181. package/templates/apps/web/lib/__tests__/deck-page.test.ts +2 -1
  182. package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +265 -0
  183. package/templates/apps/web/lib/__tests__/magnet-routes.test.ts +57 -0
  184. package/templates/apps/web/lib/__tests__/newsletter.actions.test.ts +293 -0
  185. package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +601 -0
  186. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +67 -8
  187. package/templates/apps/web/lib/auth-routes.ts +36 -2
  188. package/templates/apps/web/lib/checkout-config.ts +9 -20
  189. package/templates/apps/web/lib/deck-page.ts +1 -0
  190. package/templates/apps/web/lib/deliverable-grant.ts +18 -0
  191. package/templates/apps/web/lib/in-page-magnet.ts +416 -0
  192. package/templates/apps/web/lib/magnet-routes.ts +42 -0
  193. package/templates/apps/web/lib/modules.generated.ts +9 -0
  194. package/templates/apps/web/lib/newsletter.actions.ts +202 -0
  195. package/templates/apps/web/lib/offerings-pricing.ts +326 -0
  196. package/templates/apps/web/lib/posting-title.ts +17 -0
  197. package/templates/apps/web/lib/sign-up-agreements.ts +4 -2
  198. package/templates/apps/web/messages/en.json +49 -15
  199. package/templates/apps/web/middleware.ts +12 -2
  200. package/templates/apps/web/security-headers.config.ts +17 -0
  201. package/templates/content/en/BlogList/blog.mdx +4 -71
  202. package/templates/content/en/BookCall/book-a-call.mdx +1 -41
  203. package/templates/content/en/BookCall/onsite-estimate.mdx +1 -17
  204. package/templates/content/en/BookCall/onsite-service.mdx +1 -17
  205. package/templates/content/en/BookCall/start-project.mdx +1 -17
  206. package/templates/content/en/ContactPage/contact.mdx +6 -63
  207. package/templates/content/en/HomePage/home.mdx +3 -21
  208. package/templates/database/CHANGELOG.md +31 -0
  209. package/templates/database/__tests__/in-page-magnets-migration.test.ts +161 -0
  210. package/templates/database/__tests__/offerings-checkout-session.db.test.ts +270 -0
  211. package/templates/database/__tests__/offerings-migration.test.ts +197 -0
  212. package/templates/database/__tests__/offerings-shown-price-ids-migration.test.ts +86 -0
  213. package/templates/database/__tests__/offerings.db.test.ts +303 -0
  214. package/templates/database/__tests__/seed.test.ts +31 -1
  215. package/templates/database/auth/schema.prisma +4 -0
  216. package/templates/database/config/schema.prisma +91 -0
  217. package/templates/database/migrations/20261020120000_offerings_data_model/migration.sql +146 -0
  218. package/templates/database/migrations/20261021120000_offerings_checkout_session/migration.sql +77 -0
  219. package/templates/database/migrations/20261022120000_in_page_magnets/migration.sql +45 -0
  220. package/templates/database/migrations/20261023120000_offerings_shown_price_ids/migration.sql +47 -0
  221. package/templates/database/migrations/20261024120000_organization_plan_checkout_session/migration.sql +16 -0
  222. package/templates/database/package.json +1 -1
  223. package/templates/database/seed.ts +30 -2
  224. package/versions.json +35 -35
  225. package/site-templates/marketing-site-free/content/en/Pricing/pricing.mdx +0 -199
  226. package/templates/apps/web/app/[locale]/downloads/__tests__/page-renderer-migration.test.tsx +0 -93
  227. package/templates/apps/web/app/[locale]/downloads/page.tsx +0 -37
  228. package/templates/apps/web/app/[locale]/newsletter/__tests__/newsletter.actions.test.ts +0 -139
  229. package/templates/apps/web/app/[locale]/newsletter/newsletter.actions.ts +0 -93
  230. package/templates/apps/web/app/api/checkout/[offering]/route.ts +0 -48
  231. package/templates/apps/web/app/api/checkout/__tests__/route.test.ts +0 -120
  232. package/templates/apps/web/app/api/checkout/__tests__/success-path.test.ts +0 -86
  233. package/templates/apps/web/app/api/webhooks/stripe/__tests__/route.test.ts +0 -92
  234. package/templates/apps/web/app/api/webhooks/stripe/route.ts +0 -31
  235. package/templates/apps/web/lib/__tests__/checkout.test.ts +0 -243
  236. package/templates/apps/web/lib/__tests__/meeting-slugs.test.ts +0 -120
  237. package/templates/apps/web/lib/checkout.ts +0 -93
  238. package/templates/apps/web/lib/meeting-slugs.ts +0 -63
@@ -0,0 +1,77 @@
1
+ -- #8930 — the Offerings Checkout session record (spec
2
+ -- docs/specs/8930-the-offerings-checkout-session-record-spec.md D1, D2;
3
+ -- contract docs/specs/8879-the-offerings-security-contract-key-spec.md A11,
4
+ -- W5, A13):
5
+ --
6
+ -- offerings_checkout_sessions (config) — one row per Checkout Session the
7
+ -- hub created: its id, the workspace and Organization it was created for,
8
+ -- the Price and lookup key it sells, and the key's mode. Written once by
9
+ -- apps/api's services/offerings/checkout-session-record.ts before the
10
+ -- checkout route answers; the per-Organization webhook fulfils, and the
11
+ -- session read answers, only a session recorded here.
12
+ --
13
+ -- One new table in the house style of 20261003130000_scheduling_connection
14
+ -- (CreateTable + CreateIndex as `prisma migrate diff` emits them, then the
15
+ -- ADR-0031 rule-3 id-format completion), plus a CHECK on every column. Plain
16
+ -- scalar keys, no foreign key (ADR 0009 invariant 1). The table is new, so no
17
+ -- CHECK needs NOT VALID.
18
+ --
19
+ -- One new table, no backfill, no existing table touched.
20
+ --
21
+ -- Rollout: deploy the migration before the API code that writes the record,
22
+ -- so the checkout route never runs on a database without the table.
23
+ --
24
+ -- Rollback: DROP TABLE "offerings_checkout_sessions". While the table is
25
+ -- absent every read rejects, so the webhook answers non-2xx and Stripe keeps
26
+ -- retrying. Re-creating it empty loses every earlier record: each such session
27
+ -- then reads as unrecorded and a purchase completed after that is never
28
+ -- fulfilled. So roll back only before the checkout route that writes it is
29
+ -- live, and never re-create the table without its old rows unless the seller
30
+ -- is told.
31
+
32
+ -- CreateTable
33
+ CREATE TABLE "offerings_checkout_sessions" (
34
+ "id" TEXT NOT NULL DEFAULT ('ocsess_'::text || (uuidv7())::text),
35
+ "session_id" TEXT NOT NULL,
36
+ "workspace_id" TEXT NOT NULL,
37
+ "organization_id" TEXT NOT NULL,
38
+ "price_id" VARCHAR(255) NOT NULL,
39
+ "lookup_key" VARCHAR(48) NOT NULL,
40
+ "mode" VARCHAR(8) NOT NULL,
41
+ "created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
42
+
43
+ CONSTRAINT "offerings_checkout_sessions_pkey" PRIMARY KEY ("id")
44
+ );
45
+
46
+ -- CreateIndex
47
+ CREATE UNIQUE INDEX "offerings_checkout_sessions_session_id_key" ON "offerings_checkout_sessions"("session_id");
48
+
49
+ -- ADR-0031 rule 3 — offerings_checkout_sessions: ocsess_ (registered in
50
+ -- packages/ids/src/registry.ts ENTITY_PREFIX; this migration's path is added
51
+ -- to migration-sync.test.ts's PK_CHECK_MIGRATIONS).
52
+ ALTER TABLE "offerings_checkout_sessions" ALTER COLUMN "id" TYPE text COLLATE "C";
53
+ ALTER TABLE "offerings_checkout_sessions" ALTER COLUMN "id" SET DEFAULT ('ocsess_'::text || (uuidv7())::text);
54
+ ALTER TABLE "offerings_checkout_sessions" ADD CONSTRAINT "offerings_checkout_sessions_id_format" CHECK ("id" ~ '^ocsess_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$');
55
+
56
+ -- A Checkout Session id: the pieces_checkout_session_format body.
57
+ ALTER TABLE "offerings_checkout_sessions" ADD CONSTRAINT "offerings_checkout_sessions_session_id_format"
58
+ CHECK ("session_id" ~ '^cs_(test|live)_[A-Za-z0-9]{1,250}$');
59
+ -- The workspace the session was created for.
60
+ ALTER TABLE "offerings_checkout_sessions" ADD CONSTRAINT "offerings_checkout_sessions_workspace_id_format"
61
+ CHECK ("workspace_id" ~ '^wksp_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$');
62
+ -- That workspace's own Organization.
63
+ ALTER TABLE "offerings_checkout_sessions" ADD CONSTRAINT "offerings_checkout_sessions_organization_id_format"
64
+ CHECK ("organization_id" ~ '^org_[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$');
65
+ -- A Stripe id: the one bound #8876 D4 puts on every Stripe id.
66
+ ALTER TABLE "offerings_checkout_sessions" ADD CONSTRAINT "offerings_checkout_sessions_price_id_format"
67
+ CHECK ("price_id" ~ '^[A-Za-z0-9_-]{1,255}$');
68
+ -- The contract §3.7 whole-key grammar, <plan>_<period>. A backstop, never a
69
+ -- parser: the store calls parseLookupKey, and the db test proves the two agree.
70
+ ALTER TABLE "offerings_checkout_sessions" ADD CONSTRAINT "offerings_checkout_sessions_lookup_key_format"
71
+ CHECK ("lookup_key" ~ '^[a-z0-9][a-z0-9-]{0,39}_(monthly|yearly|once)$');
72
+ -- The key's mode.
73
+ ALTER TABLE "offerings_checkout_sessions" ADD CONSTRAINT "offerings_checkout_sessions_mode_domain"
74
+ CHECK ("mode" IN ('test', 'live'));
75
+ -- A test key makes a cs_test_ session and a live key a cs_live_ one.
76
+ ALTER TABLE "offerings_checkout_sessions" ADD CONSTRAINT "offerings_checkout_sessions_session_mode_agree"
77
+ CHECK (("mode" = 'live') = ("session_id" ~ '^cs_live_'));
@@ -0,0 +1,45 @@
1
+ -- #8847 — the in-page form shape (spec
2
+ -- docs/specs/8847-the-in-page-form-shape-spec.md D5, C5).
3
+ --
4
+ -- Two marked blocks, each re-runnable and each held to its TypeScript
5
+ -- constant by database/__tests__/in-page-magnets-migration.test.ts, on the
6
+ -- request-quote backfill's footing (20261012120000_member_contract):
7
+ --
8
+ -- newsletter backfill — every existing workspace gets the standard
9
+ -- newsletter magnet (`newsletterFlowConfig`,
10
+ -- `live`, landing page /newsletter, completion
11
+ -- `lead`). Insert-only on `(site_id, slug)`: a row
12
+ -- already at `newsletter` (an owner's own
13
+ -- wizard-built newsletter included) is never
14
+ -- changed. A workspace created after this runs is
15
+ -- seeded by `POST /v1/workspaces`, and the
16
+ -- seed-presets CLI covers one created between this
17
+ -- migration and the route code's deploy.
18
+ --
19
+ -- contact-form upgrade — a stored Contact form whose config is EXACTLY
20
+ -- #8661's shipped default moves to the new default
21
+ -- (`contactFormFlowConfig`). `config` is jsonb, so
22
+ -- `=` compares values, not key order or whitespace:
23
+ -- a row an owner edited in any way, or a
24
+ -- wizard-built Contact form, is not equal and is
25
+ -- left as is. Only `config` and `updated_at` are
26
+ -- written — never title, status, landing page or
27
+ -- completion. A re-run matches nothing.
28
+ --
29
+ -- Rollback: DELETE FROM "flow_definitions" WHERE "slug" = 'newsletter' AND
30
+ -- "config" = <the backfill literal>::jsonb; and the upgrade's UPDATE with its
31
+ -- two literals swapped.
32
+
33
+ -- BEGIN newsletter backfill
34
+ INSERT INTO "flow_definitions" ("site_id", "workspace_id", "slug", "config", "kind", "title", "status", "customers_enabled", "completion", "landing_page", "updated_at")
35
+ SELECT w."id", w."id", 'newsletter',
36
+ '{"slug":"newsletter","defaultLocale":"en","steps":[{"key":"subscribe","type":"field","copy":{"title":{"en":"Get the newsletter"},"body":{"en":"One email when there is something new."},"cta":{"en":"Subscribe"}},"fields":[{"name":"email","inputType":"email","required":true,"mapsTo":"email","copy":{"label":{"en":"Email"},"placeholder":{"en":"you@example.com"}}},{"name":"terms","inputType":"consent","required":true,"purposes":["newsletter"],"copy":{"label":{"en":"I accept the [Terms](terms) and [Privacy Policy](privacy)."},"help":{"en":"No spam. Unsubscribe any time."}}}]}],"ending":{"default":{"kind":"screen","headline":{"en":"Check your inbox"},"body":{"en":"Your welcome email is on its way."}}},"completionEmail":{"subject":{"en":"You''re subscribed"},"body":{"en":"Thanks for subscribing. You''ll get one email when there is something new."}},"unsubscribe":{"title":{"en":"Unsubscribe"},"body":{"en":"Stop getting the newsletter by email?"},"cta":{"en":"Unsubscribe"},"done":{"headline":{"en":"You''re unsubscribed."},"body":{"en":"You won''t get the newsletter any more."}}}}'::jsonb,
37
+ 'newsletter', 'Newsletter', 'live', false, 'lead', '/newsletter', CURRENT_TIMESTAMP
38
+ FROM "workspaces" w
39
+ ON CONFLICT ("site_id", "slug") DO NOTHING;
40
+ -- END newsletter backfill
41
+
42
+ -- BEGIN contact-form upgrade
43
+ UPDATE "flow_definitions" SET "config" = '{"slug":"contact","defaultLocale":"en","steps":[{"key":"contact","type":"field","copy":{"title":{"en":"Get in touch"},"body":{"en":"I reply within one business day."},"cta":{"en":"Send message"}},"fields":[{"name":"name","inputType":"text","required":true,"mapsTo":"name","copy":{"label":{"en":"Name"}}},{"name":"email","inputType":"email","required":true,"mapsTo":"email","copy":{"label":{"en":"Email"}}},{"name":"subject","inputType":"select","required":false,"options":[{"value":"General question","label":{"en":"General question"}},{"value":"Working together","label":{"en":"Working together"}},{"value":"Support","label":{"en":"Support"}},{"value":"Press and partnerships","label":{"en":"Press and partnerships"}},{"value":"Other","label":{"en":"Other"}}],"copy":{"label":{"en":"Subject"},"placeholder":{"en":"Choose a subject"}}},{"name":"message","inputType":"textarea","required":false,"copy":{"label":{"en":"Message"}}},{"name":"terms","inputType":"consent","required":true,"purposes":["service_terms"],"copy":{"label":{"en":"I accept the [Terms](terms) and [Privacy Policy](privacy)."}}}]}],"ending":{"default":{"kind":"screen","headline":{"en":"Message sent."},"body":{"en":"Thanks for getting in touch. I reply within one business day."}}}}'::jsonb, "updated_at" = CURRENT_TIMESTAMP
44
+ WHERE "slug" = 'contact' AND "config" = '{"slug":"contact","defaultLocale":"en","steps":[{"key":"contact","type":"field","copy":{"title":{"en":"Contact form"},"cta":{"en":"Send message"}},"fields":[{"name":"name","inputType":"text","required":true,"mapsTo":"name","copy":{"label":{"en":"Name"}}},{"name":"email","inputType":"email","required":true,"mapsTo":"email","copy":{"label":{"en":"Email"}}},{"name":"subject","inputType":"select","required":false,"options":[{"value":"General question","label":{"en":"General question"}},{"value":"Working together","label":{"en":"Working together"}},{"value":"Support","label":{"en":"Support"}},{"value":"Press and partnerships","label":{"en":"Press and partnerships"}},{"value":"Other","label":{"en":"Other"}}],"copy":{"label":{"en":"Subject"},"placeholder":{"en":"Choose a subject"}}},{"name":"message","inputType":"textarea","required":false,"copy":{"label":{"en":"Message"}}},{"name":"terms","inputType":"consent","required":true,"purposes":["service_terms"],"copy":{"label":{"en":"I accept the [Terms](terms), [Privacy Policy](privacy), and [Working Agreement](working_agreement)."}}}]}]}'::jsonb;
45
+ -- END contact-form upgrade
@@ -0,0 +1,47 @@
1
+ -- #9070 — the workspace shown set becomes per Stripe Price (spec
2
+ -- docs/specs/9070-the-workspace-offerings-page-becomes-spec.md D1, AC-6).
3
+ --
4
+ -- workspace_offerings.shown_price_ids (config) — the Stripe Price ids one
5
+ -- workspace shows on its pricing page. Written only by
6
+ -- apps/api's services/offerings/store.ts
7
+ -- (writeWorkspaceSelection, the PUT
8
+ -- /v1/workspaces/:workspaceId/offerings route), beside
9
+ -- shown_product_ids, which every write sets to the Products
10
+ -- with at least one shown Price. Read through
11
+ -- shownPriceIdsFor (services/offerings/index.ts) by
12
+ -- /pricing, the agent pricing tools, the plan picker and
13
+ -- checkout.
14
+ --
15
+ -- An EMPTY array means "every Price of each shown Product" — the grain every
16
+ -- row had before this migration — so every existing row reads `{}` from the
17
+ -- constant default and shows exactly what it showed before. Postgres stores
18
+ -- the default in the catalog and rewrites no row for it. The store's parse
19
+ -- refuses a new write of Products without Prices, so a row saved after this
20
+ -- migration always carries its Price ids. Each CHECK is added NOT VALID and
21
+ -- then VALIDATEd; every existing row passes both (an empty array).
22
+ --
23
+ -- The migration timestamp follows 20261022120000_in_page_magnets, which took
24
+ -- the spec's named slot first (spec §5.3).
25
+ --
26
+ -- Rollout: deploy this migration BEFORE the API code that reads and writes the
27
+ -- column, and the API before the Admin.
28
+ --
29
+ -- Rollback: roll the API back, then
30
+ -- UPDATE "workspace_offerings" SET "shown_price_ids" = '{}';
31
+ -- so every row reads at the Product grain again and the old route's saves
32
+ -- pass workspace_offerings_shown_prices_need_products, and tell each owner who
33
+ -- saved per Price that every Price of their shown Products is on sale again.
34
+ -- Never drop the column while a per-Price row exists without that notice.
35
+
36
+ -- AlterTable
37
+ ALTER TABLE "workspace_offerings" ADD COLUMN "shown_price_ids" TEXT[] NOT NULL DEFAULT ARRAY[]::TEXT[];
38
+
39
+ -- At most 100 Products × three periods, and no NULL element.
40
+ ALTER TABLE "workspace_offerings" ADD CONSTRAINT "workspace_offerings_shown_price_ids_bound"
41
+ CHECK (cardinality("shown_price_ids") <= 300 AND array_position("shown_price_ids", NULL) IS NULL) NOT VALID;
42
+ ALTER TABLE "workspace_offerings" VALIDATE CONSTRAINT "workspace_offerings_shown_price_ids_bound";
43
+
44
+ -- A shown Price needs a shown Product.
45
+ ALTER TABLE "workspace_offerings" ADD CONSTRAINT "workspace_offerings_shown_prices_need_products"
46
+ CHECK (cardinality("shown_price_ids") = 0 OR cardinality("shown_product_ids") > 0) NOT VALID;
47
+ ALTER TABLE "workspace_offerings" VALIDATE CONSTRAINT "workspace_offerings_shown_prices_need_products";
@@ -0,0 +1,16 @@
1
+ -- #9067 D13 — the Organization binds only the plan Checkout it recorded (spec
2
+ -- docs/specs/9067-the-billing-tab-s-plan-spec.md D13, SEC-9067-1 to -3).
3
+ --
4
+ -- `plan_checkout_session_id` is the one plan Checkout this Organization has
5
+ -- open, written by POST /v1/billing/plan-checkout through a compare-and-set
6
+ -- and cleared by the Stripe webhook when it binds that session's customer.
7
+ -- Nullable, no default and no backfill: every existing row reads "no open
8
+ -- plan session". Unique, so one session id can name at most one
9
+ -- Organization.
10
+ --
11
+ -- Rollback: DROP INDEX "organizations_plan_checkout_session_id_key";
12
+ -- ALTER TABLE "organizations" DROP COLUMN "plan_checkout_session_id";
13
+
14
+ ALTER TABLE "organizations" ADD COLUMN "plan_checkout_session_id" TEXT;
15
+
16
+ CREATE UNIQUE INDEX "organizations_plan_checkout_session_id_key" ON "organizations"("plan_checkout_session_id");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@working-theory/database",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -34,6 +34,10 @@ import {
34
34
  JOB_APPLICATION_FLOW_TITLE,
35
35
  JOB_APPLICATION_LANDING_PAGE,
36
36
  jobApplicationFlowConfig,
37
+ NEWSLETTER_FLOW_SLUG,
38
+ NEWSLETTER_FLOW_TITLE,
39
+ NEWSLETTER_LANDING_PAGE,
40
+ newsletterFlowConfig,
37
41
  REQUEST_QUOTE_FLOW_SLUG,
38
42
  REQUEST_QUOTE_FLOW_TITLE,
39
43
  requestQuoteFlowConfig,
@@ -84,8 +88,9 @@ export type DefaultWorkspacePrismaClient = Pick<
84
88
  * `update`, so an existing `(site_id, slug)` row is never overwritten.
85
89
  *
86
90
  * #8661 D3 — and its live Contact form magnet, the same way, and (#8746 D3)
87
- * its live Job application magnet. An existing deployment (a workspace
88
- * already present) gets its rows from the seed-presets CLI instead.
91
+ * its live Job application magnet, and (#8847 D4) its live newsletter magnet.
92
+ * An existing deployment (a workspace already present) gets its rows from the
93
+ * seed-presets CLI instead.
89
94
  *
90
95
  * #8759 — each names its #8757 D2 completion: the migration's backfill ran
91
96
  * before this seed and found no rows, so the seed writes the value itself.
@@ -189,6 +194,29 @@ export async function provisionDefaultWorkspace(
189
194
  update: {},
190
195
  });
191
196
 
197
+ // #8847 D4 — the standard newsletter magnet, the same way.
198
+ await prisma.flowDefinition.upsert({
199
+ where: {
200
+ siteId_slug: {
201
+ siteId: DEFAULT_WORKSPACE_ID,
202
+ slug: NEWSLETTER_FLOW_SLUG,
203
+ },
204
+ },
205
+ create: {
206
+ siteId: DEFAULT_WORKSPACE_ID,
207
+ workspaceId: DEFAULT_WORKSPACE_ID,
208
+ slug: NEWSLETTER_FLOW_SLUG,
209
+ config: newsletterFlowConfig,
210
+ kind: "newsletter",
211
+ title: NEWSLETTER_FLOW_TITLE,
212
+ status: "live",
213
+ customersEnabled: false,
214
+ completion: "lead",
215
+ landingPage: NEWSLETTER_LANDING_PAGE,
216
+ },
217
+ update: {},
218
+ });
219
+
192
220
  return { created: true };
193
221
  }
194
222
 
package/versions.json CHANGED
@@ -1,53 +1,53 @@
1
1
  {
2
- "@working-theory/admin-ui": "0.43.0",
3
- "@working-theory/aeo": "0.43.0",
4
- "@working-theory/agent-context": "0.43.0",
2
+ "@working-theory/admin-ui": "0.44.0",
3
+ "@working-theory/aeo": "0.44.0",
4
+ "@working-theory/agent-context": "0.44.0",
5
5
  "@working-theory/agent-contract": "0.1.0",
6
6
  "@working-theory/agent-memory": "0.0.0",
7
7
  "@working-theory/ai": "0.1.0",
8
- "@working-theory/analytics": "0.43.0",
9
- "@working-theory/api-client": "0.43.0",
8
+ "@working-theory/analytics": "0.44.0",
9
+ "@working-theory/api-client": "0.44.0",
10
10
  "@working-theory/cda-filesystem": "0.0.0",
11
- "@working-theory/cli": "0.43.0",
12
- "@working-theory/common": "0.43.0",
11
+ "@working-theory/cli": "0.44.0",
12
+ "@working-theory/common": "0.44.0",
13
13
  "@working-theory/consent": "0.1.0",
14
- "@working-theory/content-adapters": "0.43.0",
15
- "@working-theory/content-projection": "0.43.0",
16
- "@working-theory/email": "0.43.0",
14
+ "@working-theory/content-adapters": "0.44.0",
15
+ "@working-theory/content-projection": "0.44.0",
16
+ "@working-theory/email": "0.44.0",
17
17
  "@working-theory/env": "0.0.0",
18
- "@working-theory/eslint-config": "0.43.0",
19
- "@working-theory/fumadocs-schema": "0.43.0",
20
- "@working-theory/ids": "0.14.0",
21
- "@working-theory/jsonld": "0.43.0",
22
- "@working-theory/license": "0.43.0",
23
- "@working-theory/metadata": "0.43.0",
24
- "@working-theory/observability": "0.43.0",
25
- "@working-theory/page-renderer": "0.43.0",
18
+ "@working-theory/eslint-config": "0.44.0",
19
+ "@working-theory/fumadocs-schema": "0.44.0",
20
+ "@working-theory/ids": "0.15.0",
21
+ "@working-theory/jsonld": "0.44.0",
22
+ "@working-theory/license": "0.44.0",
23
+ "@working-theory/metadata": "0.44.0",
24
+ "@working-theory/observability": "0.44.0",
25
+ "@working-theory/page-renderer": "0.44.0",
26
26
  "@working-theory/plugin-mcp": "0.1.3",
27
- "@working-theory/schema": "0.43.0",
28
- "@working-theory/schema-pack-registry": "0.43.0",
29
- "@working-theory/schema-validator": "0.43.0",
30
- "@working-theory/sections-registry": "0.43.0",
31
- "@working-theory/site-config": "0.43.0",
32
- "@working-theory/spoke-checkout": "0.6.0",
33
- "@working-theory/stripe-client": "0.43.0",
34
- "@working-theory/templates": "0.43.0",
35
- "@working-theory/theme": "0.43.0",
36
- "@working-theory/ui": "0.43.0",
37
- "@working-theory/validation": "0.43.0",
38
- "@working-theory/web-i18n": "0.43.0",
27
+ "@working-theory/schema": "0.44.0",
28
+ "@working-theory/schema-pack-registry": "0.44.0",
29
+ "@working-theory/schema-validator": "0.44.0",
30
+ "@working-theory/sections-registry": "0.44.0",
31
+ "@working-theory/site-config": "0.44.0",
32
+ "@working-theory/spoke-checkout": "0.7.0",
33
+ "@working-theory/stripe-client": "0.44.0",
34
+ "@working-theory/templates": "0.44.0",
35
+ "@working-theory/theme": "0.44.0",
36
+ "@working-theory/ui": "0.44.0",
37
+ "@working-theory/validation": "0.44.0",
38
+ "@working-theory/web-i18n": "0.44.0",
39
39
  "@working-theory/billing-client": "0.0.0",
40
40
  "@working-theory/branding": "0.0.0",
41
41
  "@working-theory/license-client": "0.0.0",
42
42
  "@working-theory/license-manifest": "0.0.0",
43
43
  "@working-theory/partner-session": "0.0.0",
44
44
  "@working-theory/preview-protocol": "0.0.0",
45
- "@working-theory/ui-commerce": "0.23.21",
46
- "@working-theory/ui-docs-blog": "0.23.21",
47
- "@working-theory/ui-scheduling": "0.24.1",
48
- "@working-theory/ui-signal-collectors": "0.26.0",
45
+ "@working-theory/ui-commerce": "0.23.22",
46
+ "@working-theory/ui-docs-blog": "0.23.22",
47
+ "@working-theory/ui-scheduling": "0.24.2",
48
+ "@working-theory/ui-signal-collectors": "0.27.0",
49
49
  "@working-theory/web": "0.0.0",
50
50
  "@working-theory/api": "1.0.0",
51
51
  "@working-theory/mcp": "0.0.0",
52
- "@working-theory/database": "0.43.0"
52
+ "@working-theory/database": "0.44.0"
53
53
  }
@@ -1,199 +0,0 @@
1
- ---
2
- type: "Pricing"
3
- slug: "pricing"
4
- title: "{Upgrade to Pro with Commerce}"
5
- description: "{Checkout isn't included on the Free template. Upgrade to Pro with Commerce and take payments on your site with Stripe.}"
6
- sections:
7
- [
8
- {
9
- "id": "hero",
10
- "type": "hero",
11
- "data":
12
- {
13
- "variant": "centered",
14
- "gapBelow": "tight",
15
- "eyebrow": "Pricing",
16
- "headline": "{Upgrade to Pro with Commerce}",
17
- "subheadline": "{Checkout isn't included on the Free template. Upgrade to Pro with Commerce and take payments on your site with Stripe.}",
18
- "primaryCta":
19
- {
20
- "label": "{Add Commerce for SMB}",
21
- "href": "https://ailaunchkit.ai/pricing",
22
- },
23
- "secondaryCta":
24
- {
25
- "label": "{Add Commerce for SaaS}",
26
- "href": "https://ailaunchkit.ai/pricing",
27
- "variant": "outline",
28
- },
29
- },
30
- },
31
- {
32
- "id": "plans",
33
- "type": "pricing",
34
- "data":
35
- {
36
- "variant": "three-tiers-with-toggle",
37
- "billingToggle": true,
38
- "toggleStyle": "switch",
39
- "gapAbove": "tight",
40
- "cardLayout": "centered",
41
- "plans":
42
- [
43
- {
44
- "name": "Basic plan",
45
- "price": { "monthly": "{price}/mo", "annual": "{price}/yr" },
46
- "features":
47
- [
48
- "{A feature this plan includes}",
49
- "{A feature this plan includes}",
50
- "{A feature this plan includes}",
51
- ],
52
- "cta": { "label": "{Primary CTA}", "href": "/contact" },
53
- },
54
- {
55
- "name": "Business plan",
56
- "price": { "monthly": "{price}/mo", "annual": "{price}/yr" },
57
- "features":
58
- [
59
- "{A feature this plan adds}",
60
- "{A feature this plan includes}",
61
- "{A feature this plan includes}",
62
- "{A feature this plan includes}",
63
- ],
64
- "cta": { "label": "{Primary CTA}", "href": "/contact" },
65
- },
66
- {
67
- "name": "Enterprise plan",
68
- "price": { "monthly": "{price}/mo", "annual": "{price}/yr" },
69
- "features":
70
- [
71
- "{A feature this plan adds}",
72
- "{A feature this plan includes}",
73
- "{A feature this plan includes}",
74
- "{A feature this plan includes}",
75
- "{A feature this plan includes}",
76
- ],
77
- "cta": { "label": "{Primary CTA}", "href": "/contact" },
78
- },
79
- ],
80
- },
81
- },
82
- {
83
- "id": "logo-cloud",
84
- "type": "logoCloud",
85
- "data":
86
- {
87
- "headline": "{Don’t just take our word for it}",
88
- "headlineStyle": "label",
89
- "logos":
90
- [
91
- {
92
- "name": "SalesSmyth",
93
- "src": "/logos/salessmyth.svg",
94
- "darkSrc": "/logos/salessmyth-light.svg",
95
- "width": 1118,
96
- "height": 147,
97
- },
98
- {
99
- "name": "AI Launch Kit",
100
- "src": "/logos/ai-launch-kit.svg",
101
- "darkSrc": "/logos/ai-launch-kit-light.svg",
102
- "width": 1248,
103
- "height": 144,
104
- },
105
- {
106
- "name": "Atomic Agent",
107
- "src": "/logos/atomic-agent.svg",
108
- "darkSrc": "/logos/atomic-agent-light.svg",
109
- "width": 1320,
110
- "height": 148,
111
- },
112
- ],
113
- "layout": "inline",
114
- "treatment": "monochrome",
115
- },
116
- },
117
- {
118
- "id": "testimonial",
119
- "type": "testimonials",
120
- "data":
121
- {
122
- "variant": "quote",
123
- "items":
124
- [
125
- {
126
- "quote": "{A customer quote, in their own words, about the result they got}",
127
- "author": "{Customer name}",
128
- "role": "{Their title, their company}",
129
- },
130
- ],
131
- },
132
- },
133
- {
134
- "id": "switch",
135
- "type": "cta",
136
- "data":
137
- {
138
- "variant": "box",
139
- "headline": "{Switch to your product in time amount or less}",
140
- "description": "{You shouldn't have to experience a painful problem. With your product, you can finally achieve a value outcome or get a big improvement.}",
141
- "checklist":
142
- ["No credit card required", "Cancel any time", "Live chat support"],
143
- "primaryCta": { "label": "{Primary CTA}", "href": "/contact" },
144
- "secondaryCta":
145
- {
146
- "label": "{Secondary CTA}",
147
- "href": "/pricing",
148
- "variant": "outline",
149
- },
150
- "closingLine": "{Social Proof goes here}",
151
- },
152
- },
153
- {
154
- "id": "faq",
155
- "type": "faq",
156
- "data":
157
- {
158
- "headline": "{FAQs}",
159
- "description": "{One sentence that invites visitors to ask what this list does not answer}",
160
- "actions":
161
- [
162
- {
163
- "kind": "button",
164
- "label": "Contact",
165
- "href": "/contact",
166
- "variant": "outline",
167
- },
168
- ],
169
- "presentation": "accordion",
170
- "initialOpen": "none",
171
- "items":
172
- [
173
- {
174
- "question": "{A question your customers actually ask}",
175
- "answer": "{Answer the question in two or three plain sentences}",
176
- },
177
- {
178
- "question": "{A question your customers actually ask}",
179
- "answer": "{Answer the question in two or three plain sentences}",
180
- },
181
- {
182
- "question": "{A question your customers actually ask}",
183
- "answer": "{Answer the question in two or three plain sentences}",
184
- },
185
- {
186
- "question": "{A question your customers actually ask}",
187
- "answer": "{Answer the question in two or three plain sentences}",
188
- },
189
- {
190
- "question": "{A question your customers actually ask}",
191
- "answer": "{Answer the question in two or three plain sentences}",
192
- },
193
- ],
194
- },
195
- },
196
- ]
197
- ---
198
-
199
- {/* Rendered from frontmatter `sections[]`. Seed content — replace the plan names, prices and features above with your own before you launch. */}
@@ -1,93 +0,0 @@
1
- /**
2
- * HTML snapshot regression tests for the downloads route →
3
- * @working-theory/page-renderer renderPage({ bodyMode: "mdx-body" }) migration.
4
- *
5
- * Two-commit strategy:
6
- * Commit 1: snapshots captured against pre-migration route (baseline).
7
- * Commit 2: route migrated; same snapshots verify diff=0.
8
- *
9
- * Routes covered:
10
- * - downloads/page.tsx (empty + populated — 2 snapshots)
11
- *
12
- * Failure = snapshot diff > 0 bytes. DO NOT regenerate snapshots to pass.
13
- */
14
- import React from "react";
15
- import { render } from "@testing-library/react";
16
-
17
- // ── next-mdx-remote/rsc mock ──────────────────────────────────────────────────
18
- jest.mock("next-mdx-remote/rsc", () => ({
19
- MDXRemote: ({ source }: { source: string }): React.ReactElement =>
20
- React.createElement("div", { "data-testid": "mdx-rendered" }, source),
21
- }));
22
-
23
- // ── @working-theory/ui mock ─────────────────────────────────────────────────────────────
24
- jest.mock("@working-theory/ui", () => ({
25
- // #7745: renderPage's mdx-body branch frames its head and body in the
26
- // section Container and renders the body through MDXContent + the shared map.
27
- Container: ({
28
- children,
29
- }: {
30
- children?: React.ReactNode;
31
- }): React.ReactElement => React.createElement("div", null, children),
32
- MDXContent: ({
33
- children,
34
- }: {
35
- children?: React.ReactNode;
36
- }): React.ReactElement => React.createElement(React.Fragment, null, children),
37
- getMDXComponents: (overrides?: Record<string, unknown>) => ({ ...overrides }),
38
- // #4446/#4447: renderPage's own fallback/empty-state title now composes
39
- // Heading (mobile type-budget classes, #4417) instead of a bare <h1>.
40
- Heading: ({
41
- children,
42
- level,
43
- }: {
44
- children: React.ReactNode;
45
- level: number;
46
- }): React.ReactElement => React.createElement(`h${level}`, null, children),
47
- SectionRenderer: ({ sections }: { sections: unknown[] }) =>
48
- React.createElement("div", {
49
- "data-testid": "section-renderer",
50
- "data-section-count": String(sections.length),
51
- }),
52
- }));
53
-
54
- import DownloadsPage from "../page";
55
-
56
- const getMdxSourceEmpty = jest.fn().mockResolvedValue(null);
57
-
58
- // ── DownloadsPage ─────────────────────────────────────────────────────────────
59
-
60
- describe("DownloadsPage — snapshot regression", () => {
61
- it("empty state renders deterministic HTML", async () => {
62
- const element = await DownloadsPage({
63
- params: Promise.resolve({ locale: "en" }),
64
- getMdxSource: getMdxSourceEmpty,
65
- });
66
- const { container } = render(element);
67
- expect(container.innerHTML).toMatchInlineSnapshot(
68
- `"<main id="main"><h1>Downloads</h1><p data-testid="section-empty-state">Downloads listing coming soon.</p></main>"`,
69
- );
70
- });
71
-
72
- it("populated state renders deterministic HTML", async () => {
73
- const getMdxSourcePopulated = jest.fn().mockResolvedValue({
74
- frontmatter: {
75
- type: "DownloadsList",
76
- slug: "downloads",
77
- title: "Downloads",
78
- description: "Downloadable assets and templates.",
79
- },
80
- body: "# Downloads\n\nBody.",
81
- });
82
-
83
- const element = await DownloadsPage({
84
- params: Promise.resolve({ locale: "en" }),
85
- getMdxSource: getMdxSourcePopulated,
86
- });
87
- const { container } = render(element);
88
- expect(container.innerHTML).toMatchInlineSnapshot(`
89
- "<script type="application/ld+json" data-testid="json-ld">{"@context":"https://schema.org","@type":"CollectionPage","inLanguage":"en","name":"Downloads","description":"Downloadable assets and templates.","mainEntity":{"@type":"ItemList","itemListElement":[{"@type":"DigitalDocument"}]}}</script><main id="main"><div><h1>Downloads</h1><p data-testid="downloads-description" class="mt-block-tight text-lead">Downloadable assets and templates.</p><div data-testid="markdown-view-toggle" class="ailk-markdown-view-toggle mt-block-loose"><div class="flex justify-end mb-3"><div role="radiogroup" aria-label="Page view" data-testid="markdown-view-toggle" class="inline-flex items-center gap-0.5 rounded-lg p-1 bg-(--color-surface-secondary)"><button class="inline-flex items-center justify-center gap-2 font-medium motion-safe:transition motion-safe:duration-(--button-hover-duration) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 [&amp;>svg]:shrink-0 text-(--color-fg) not-disabled:hover:bg-(--button-hover-quiet-bg) not-disabled:hover:text-(--button-hover-quiet-fg) not-disabled:hover:opacity-(--button-hover-opacity) not-disabled:hover:transform-(--button-hover-transform) not-disabled:hover:shadow-(--button-hover-shadow) not-disabled:active:bg-gray-200 not-disabled:active:text-(--color-fg) rounded-control px-control-x h-(--control-height-thin) text-caption leading-none rounded-md px-3 text-body-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 min-w-(--control-height-thin) min-h-(--control-height-big) bg-(--color-bg) text-(--color-fg) shadow-sm" type="button" role="radio" aria-checked="true" aria-label="Rendered" tabindex="0" data-testid="markdown-view-toggle-rendered">Rendered</button><button class="inline-flex items-center justify-center gap-2 font-medium motion-safe:transition motion-safe:duration-(--button-hover-duration) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 [&amp;>svg]:shrink-0 text-(--color-fg) not-disabled:hover:bg-(--button-hover-quiet-bg) not-disabled:hover:text-(--button-hover-quiet-fg) not-disabled:hover:opacity-(--button-hover-opacity) not-disabled:hover:transform-(--button-hover-transform) not-disabled:hover:shadow-(--button-hover-shadow) not-disabled:active:bg-gray-200 not-disabled:active:text-(--color-fg) rounded-control px-control-x h-(--control-height-thin) text-caption leading-none rounded-md px-3 text-body-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 min-w-(--control-height-thin) min-h-(--control-height-big) text-(--color-text-muted) hover:text-(--color-fg)" type="button" role="radio" aria-checked="false" aria-label="Markdown" tabindex="-1" data-testid="markdown-view-toggle-markdown">Markdown</button></div></div><div role="status" aria-live="polite" aria-atomic="true" class="sr-only" data-testid="markdown-view-toggle-status">Showing Rendered view</div><div data-testid="markdown-view-rendered"><article data-testid="mdx-body"><div data-testid="mdx-rendered">
90
- Body.</div></article></div></div></div></main>"
91
- `);
92
- });
93
- });