create-ailk 0.39.0 → 0.40.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 (187) hide show
  1. package/dist/add-route.js +15 -0
  2. package/dist/body-heading.d.ts +2 -1
  3. package/dist/body-heading.js +31 -3
  4. package/dist/module-architecture.js +0 -3
  5. package/dist/remove-module.js +13 -4
  6. package/dist/routes.d.ts +7 -0
  7. package/dist/routes.js +1 -1
  8. package/dist/site-roster.js +7 -1
  9. package/dist/surfaces.d.ts +2 -0
  10. package/dist/surfaces.js +59 -172
  11. package/package.json +3 -3
  12. package/templates/apps/web/CLAUDE.md +7 -1
  13. package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +3 -2
  14. package/templates/apps/web/__tests__/__mocks__/next-intl.ts +3 -2
  15. package/templates/apps/web/app/[locale]/layout.tsx +1 -1
  16. package/templates/apps/web/i18n/request.ts +5 -1
  17. package/templates/apps/web/jest.config.cjs +6 -0
  18. package/templates/apps/web/lib/__tests__/deck-page.test.ts +9 -0
  19. package/templates/apps/web/lib/__tests__/in-page-magnet-self-request.test.ts +1 -1
  20. package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +2 -2
  21. package/templates/apps/web/lib/__tests__/pricing-page.test.ts +1 -1
  22. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +17 -4
  23. package/templates/apps/web/lib/in-page-magnet.ts +2 -2
  24. package/templates/apps/web/lib/pricing-page.ts +3 -3
  25. package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-email.ts +1 -1
  26. package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-lines.ts +1 -1
  27. package/templates/apps/web/lib/site-header.ts +1 -1
  28. package/templates/apps/web/messages/en.json +0 -119
  29. package/templates/apps/web/next.config.mjs +7 -0
  30. package/templates/apps/web/package.json +1 -0
  31. package/templates/apps/web/site-pages.config.tsx +85 -0
  32. package/templates/tools/body-heading.ts +30 -3
  33. package/versions.json +50 -49
  34. package/templates/apps/web/app/[locale]/(authed)/leads/__tests__/page.test.tsx +0 -205
  35. package/templates/apps/web/app/[locale]/(authed)/leads/components/LeadsTable.tsx +0 -137
  36. package/templates/apps/web/app/[locale]/(authed)/leads/page.tsx +0 -122
  37. package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ForbiddenState.tsx +0 -24
  38. package/templates/apps/web/app/[locale]/(authed)/waitlist/format.ts +0 -111
  39. package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +0 -402
  40. package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +0 -143
  41. package/templates/apps/web/app/[locale]/[slug]/__tests__/page.test.tsx +0 -148
  42. package/templates/apps/web/app/[locale]/[slug]/page.tsx +0 -109
  43. package/templates/apps/web/app/[locale]/about/[slug]/page.tsx +0 -46
  44. package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +0 -353
  45. package/templates/apps/web/app/[locale]/about/page.tsx +0 -122
  46. package/templates/apps/web/app/[locale]/alternatives/__tests__/page.test.tsx +0 -161
  47. package/templates/apps/web/app/[locale]/alternatives/page.tsx +0 -112
  48. package/templates/apps/web/app/[locale]/careers/[slug]/[action]/page.tsx +0 -244
  49. package/templates/apps/web/app/[locale]/careers/[slug]/apply.actions.ts +0 -325
  50. package/templates/apps/web/app/[locale]/careers/[slug]/job-application-form.ts +0 -120
  51. package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +0 -73
  52. package/templates/apps/web/app/[locale]/careers/__tests__/apply.actions.test.ts +0 -497
  53. package/templates/apps/web/app/[locale]/careers/__tests__/careers-hub.test.tsx +0 -172
  54. package/templates/apps/web/app/[locale]/careers/__tests__/careers-set.test.tsx +0 -153
  55. package/templates/apps/web/app/[locale]/careers/__tests__/job-application-form.test.ts +0 -141
  56. package/templates/apps/web/app/[locale]/careers/__tests__/job-apply-page.test.tsx +0 -546
  57. package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +0 -189
  58. package/templates/apps/web/app/[locale]/careers/page.tsx +0 -165
  59. package/templates/apps/web/app/[locale]/case-studies/[slug]/page.tsx +0 -49
  60. package/templates/apps/web/app/[locale]/case-studies/__tests__/hub-children.test.tsx +0 -65
  61. package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +0 -125
  62. package/templates/apps/web/app/[locale]/case-studies/page.tsx +0 -49
  63. package/templates/apps/web/app/[locale]/clients/__tests__/page-renderer-migration.test.tsx +0 -85
  64. package/templates/apps/web/app/[locale]/clients/page.tsx +0 -47
  65. package/templates/apps/web/app/[locale]/contact/ConversationalIntakeWrapper.tsx +0 -249
  66. package/templates/apps/web/app/[locale]/contact/__tests__/ConversationalIntakeWrapper.test.tsx +0 -400
  67. package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-magnet.test.ts +0 -138
  68. package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-text.test.ts +0 -49
  69. package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +0 -494
  70. package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +0 -1122
  71. package/templates/apps/web/app/[locale]/contact/__tests__/intake-analytics.test.ts +0 -51
  72. package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +0 -319
  73. package/templates/apps/web/app/[locale]/contact/contact-form-magnet.ts +0 -77
  74. package/templates/apps/web/app/[locale]/contact/contact-form-text.ts +0 -52
  75. package/templates/apps/web/app/[locale]/contact/contact.actions.ts +0 -403
  76. package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +0 -49
  77. package/templates/apps/web/app/[locale]/contact/intake-script.ts +0 -92
  78. package/templates/apps/web/app/[locale]/contact/page.tsx +0 -267
  79. package/templates/apps/web/app/[locale]/courses/[slug]/page.tsx +0 -50
  80. package/templates/apps/web/app/[locale]/courses/__tests__/hub-children.test.tsx +0 -32
  81. package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +0 -123
  82. package/templates/apps/web/app/[locale]/courses/page.tsx +0 -49
  83. package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +0 -57
  84. package/templates/apps/web/app/[locale]/events/__tests__/hub-children.test.tsx +0 -32
  85. package/templates/apps/web/app/[locale]/events/__tests__/page-renderer-migration.test.tsx +0 -164
  86. package/templates/apps/web/app/[locale]/events/__tests__/program-event.test.tsx +0 -120
  87. package/templates/apps/web/app/[locale]/events/page.tsx +0 -60
  88. package/templates/apps/web/app/[locale]/faq/page.tsx +0 -54
  89. package/templates/apps/web/app/[locale]/features/[slug]/page.tsx +0 -54
  90. package/templates/apps/web/app/[locale]/features/__tests__/hub-children.test.tsx +0 -32
  91. package/templates/apps/web/app/[locale]/features/page.tsx +0 -50
  92. package/templates/apps/web/app/[locale]/for/[slug]/page.tsx +0 -54
  93. package/templates/apps/web/app/[locale]/for/__tests__/hub-children.test.tsx +0 -32
  94. package/templates/apps/web/app/[locale]/for/__tests__/page-renderer-migration.test.tsx +0 -90
  95. package/templates/apps/web/app/[locale]/for/page.tsx +0 -51
  96. package/templates/apps/web/app/[locale]/glossary/page.tsx +0 -53
  97. package/templates/apps/web/app/[locale]/how-to/[slug]/page.tsx +0 -50
  98. package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +0 -78
  99. package/templates/apps/web/app/[locale]/how-to/page.tsx +0 -50
  100. package/templates/apps/web/app/[locale]/integrations/[slug]/page.tsx +0 -54
  101. package/templates/apps/web/app/[locale]/integrations/__tests__/hub-children.test.tsx +0 -38
  102. package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +0 -141
  103. package/templates/apps/web/app/[locale]/integrations/page.tsx +0 -49
  104. package/templates/apps/web/app/[locale]/launch-service/page.tsx +0 -44
  105. package/templates/apps/web/app/[locale]/newsletter/__tests__/page.test.tsx +0 -236
  106. package/templates/apps/web/app/[locale]/newsletter/page.tsx +0 -179
  107. package/templates/apps/web/app/[locale]/page.tsx +0 -147
  108. package/templates/apps/web/app/[locale]/partners/[slug]/page.tsx +0 -45
  109. package/templates/apps/web/app/[locale]/partners/__tests__/hub-children.test.tsx +0 -32
  110. package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +0 -125
  111. package/templates/apps/web/app/[locale]/partners/page.tsx +0 -49
  112. package/templates/apps/web/app/[locale]/portfolio/[slug]/page.tsx +0 -46
  113. package/templates/apps/web/app/[locale]/portfolio/__tests__/hub-children.test.tsx +0 -38
  114. package/templates/apps/web/app/[locale]/portfolio/page.tsx +0 -50
  115. package/templates/apps/web/app/[locale]/pricing/[slug]/__tests__/page.test.tsx +0 -324
  116. package/templates/apps/web/app/[locale]/pricing/[slug]/page.tsx +0 -87
  117. package/templates/apps/web/app/[locale]/pricing/__tests__/__snapshots__/unconnected.test.tsx.snap +0 -7
  118. package/templates/apps/web/app/[locale]/pricing/__tests__/offerings.test.tsx +0 -605
  119. package/templates/apps/web/app/[locale]/pricing/__tests__/page.test.tsx +0 -219
  120. package/templates/apps/web/app/[locale]/pricing/__tests__/pricing-pages.test.tsx +0 -215
  121. package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +0 -282
  122. package/templates/apps/web/app/[locale]/pricing/page.tsx +0 -120
  123. package/templates/apps/web/app/[locale]/privacy/page.tsx +0 -40
  124. package/templates/apps/web/app/[locale]/products/[slug]/page.tsx +0 -50
  125. package/templates/apps/web/app/[locale]/products/__tests__/hub-children.test.tsx +0 -32
  126. package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +0 -141
  127. package/templates/apps/web/app/[locale]/products/page.tsx +0 -49
  128. package/templates/apps/web/app/[locale]/projects/[slug]/page.tsx +0 -37
  129. package/templates/apps/web/app/[locale]/projects/__tests__/hub-children.test.tsx +0 -32
  130. package/templates/apps/web/app/[locale]/projects/__tests__/page-renderer-migration.test.tsx +0 -157
  131. package/templates/apps/web/app/[locale]/projects/page.tsx +0 -49
  132. package/templates/apps/web/app/[locale]/purchase-policy/page.tsx +0 -49
  133. package/templates/apps/web/app/[locale]/resources/[slug]/page.tsx +0 -54
  134. package/templates/apps/web/app/[locale]/resources/__tests__/hub-children.test.tsx +0 -38
  135. package/templates/apps/web/app/[locale]/resources/__tests__/page-renderer-migration.test.tsx +0 -151
  136. package/templates/apps/web/app/[locale]/resources/page.tsx +0 -49
  137. package/templates/apps/web/app/[locale]/services/[slug]/[child]/page.tsx +0 -68
  138. package/templates/apps/web/app/[locale]/services/[slug]/page.tsx +0 -88
  139. package/templates/apps/web/app/[locale]/services/__tests__/hub-children.test.tsx +0 -158
  140. package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +0 -187
  141. package/templates/apps/web/app/[locale]/services/__tests__/service-detail-sections.test.tsx +0 -224
  142. package/templates/apps/web/app/[locale]/services/__tests__/service-families.test.tsx +0 -368
  143. package/templates/apps/web/app/[locale]/services/page.tsx +0 -71
  144. package/templates/apps/web/app/[locale]/software/[slug]/page.tsx +0 -49
  145. package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +0 -81
  146. package/templates/apps/web/app/[locale]/software/page.tsx +0 -49
  147. package/templates/apps/web/app/[locale]/team/[slug]/page.tsx +0 -45
  148. package/templates/apps/web/app/[locale]/team/__tests__/hub-children.test.tsx +0 -32
  149. package/templates/apps/web/app/[locale]/team/__tests__/team-routes.test.tsx +0 -161
  150. package/templates/apps/web/app/[locale]/team/page.tsx +0 -50
  151. package/templates/apps/web/app/[locale]/tech-articles/[slug]/page.tsx +0 -54
  152. package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +0 -82
  153. package/templates/apps/web/app/[locale]/tech-articles/page.tsx +0 -49
  154. package/templates/apps/web/app/[locale]/templates/[slug]/__tests__/page.test.tsx +0 -203
  155. package/templates/apps/web/app/[locale]/templates/[slug]/page.tsx +0 -81
  156. package/templates/apps/web/app/[locale]/templates/__tests__/page.test.tsx +0 -237
  157. package/templates/apps/web/app/[locale]/templates/page.tsx +0 -114
  158. package/templates/apps/web/app/[locale]/terms/page.tsx +0 -40
  159. package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx +0 -85
  160. package/templates/apps/web/app/[locale]/testimonials/page.tsx +0 -51
  161. package/templates/apps/web/app/[locale]/thanks/[slug]/__tests__/page.test.tsx +0 -136
  162. package/templates/apps/web/app/[locale]/thanks/[slug]/page.tsx +0 -39
  163. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +0 -226
  164. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +0 -217
  165. package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +0 -106
  166. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +0 -94
  167. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe.actions.ts +0 -55
  168. package/templates/apps/web/app/[locale]/vs/[slug]/__tests__/page.test.tsx +0 -100
  169. package/templates/apps/web/app/[locale]/vs/[slug]/page.tsx +0 -60
  170. package/templates/apps/web/app/[locale]/whitepapers/[slug]/page.tsx +0 -54
  171. package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +0 -82
  172. package/templates/apps/web/app/[locale]/whitepapers/page.tsx +0 -49
  173. package/templates/apps/web/app/[locale]/working-agreement/__tests__/page.test.tsx +0 -63
  174. package/templates/apps/web/app/[locale]/working-agreement/page.tsx +0 -41
  175. package/templates/apps/web/lib/__tests__/hub-children.fixtures.ts +0 -279
  176. package/templates/apps/web/lib/__tests__/route-family.test.ts +0 -57
  177. package/templates/apps/web/lib/__tests__/service-listing.test.ts +0 -111
  178. package/templates/apps/web/lib/__tests__/template-listing.test.ts +0 -158
  179. package/templates/apps/web/lib/hub-children.tsx +0 -351
  180. package/templates/apps/web/lib/meet-placeholder.ts +0 -5
  181. package/templates/apps/web/lib/posting-title.ts +0 -39
  182. package/templates/apps/web/lib/route-family.ts +0 -69
  183. package/templates/apps/web/lib/service-listing.ts +0 -89
  184. package/templates/apps/web/lib/template-listing.ts +0 -169
  185. package/templates/apps/web/src/lib/__tests__/lead-write.test.ts +0 -187
  186. package/templates/apps/web/src/lib/lead-write.ts +0 -90
  187. /package/templates/apps/web/{app/[locale]/contact → lib}/__tests__/site-contact-lines.test.ts +0 -0
@@ -1,49 +0,0 @@
1
- // Case Studies list page. Reads CaseStudiesList MDX via the content adapter and emits
2
- // a JSON-LD CollectionPage via the dispatcher.
3
- // It lists every CaseStudy page through one generated card section (#10121,
4
- // apps/web/lib/hub-children.tsx — the /alternatives and /templates shape).
5
- import type {
6
- getMdxSlugs as defaultGetMdxSlugs,
7
- getMdxSource as defaultGetMdxSource,
8
- getPageSections as defaultGetPageSections,
9
- } from "@working-theory/page-renderer";
10
- import { renderPage, renderPageMetadata } from "@working-theory/page-renderer";
11
- import type { Metadata } from "next";
12
- import type { ReactElement } from "react";
13
-
14
- import { type HubConfig, hubPageInput } from "../../../lib/hub-children";
15
-
16
- interface Props {
17
- params: Promise<{ locale: string }>;
18
- getMdxSource?: typeof defaultGetMdxSource;
19
- getPageSections?: typeof defaultGetPageSections;
20
- getMdxSlugs?: typeof defaultGetMdxSlugs;
21
- }
22
-
23
- const HUB: HubConfig = {
24
- listType: "CaseStudiesList",
25
- slug: "case-studies",
26
- childType: "CaseStudy",
27
- linkLabel: "Read the case study",
28
- sectionId: "case-study-cards",
29
- body: "mdx-body",
30
- };
31
-
32
- export async function generateMetadata({
33
- params,
34
- }: Pick<Props, "params">): Promise<Metadata> {
35
- const { locale } = await params;
36
- return renderPageMetadata({ type: "CaseStudiesList", slug: "case-studies", locale });
37
- }
38
-
39
- export default async function Page({
40
- params,
41
- ...loaders
42
- }: Props): Promise<ReactElement> {
43
- const { locale } = await params;
44
- return renderPage({
45
- type: "CaseStudiesList",
46
- slug: "case-studies",
47
- ...(await hubPageInput(HUB, locale, loaders)),
48
- });
49
- }
@@ -1,85 +0,0 @@
1
- /**
2
- * HTML snapshot regression tests for clients/page.tsx → @working-theory/page-renderer migration.
3
- *
4
- * Two-commit strategy:
5
- * Commit 1: this file added; snapshots captured against pre-migration route (RED-passing).
6
- * Commit 2: route migrated; same snapshots verify diff=0 (GREEN).
7
- *
8
- * Two states tested:
9
- * - empty: getMdxSource returns null → empty-state branch
10
- * - populated: getMdxSource returns a minimal MdxPageSource → full render
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
- // ── @working-theory/ui mock ─────────────────────────────────────────────────────────────
18
- jest.mock("@working-theory/ui", () => ({
19
- // #7745: renderPage's mdx-body branch frames its head and body in the
20
- // section Container and renders the body through MDXContent + the shared map.
21
- Container: ({
22
- children,
23
- }: {
24
- children?: React.ReactNode;
25
- }): React.ReactElement => React.createElement("div", null, children),
26
- MDXContent: ({
27
- children,
28
- }: {
29
- children?: React.ReactNode;
30
- }): React.ReactElement => React.createElement(React.Fragment, null, children),
31
- getMDXComponents: (overrides?: Record<string, unknown>) => ({ ...overrides }),
32
- // #4446/#4447: renderPage's own fallback/empty-state title now composes
33
- // Heading (mobile type-budget classes, #4417) instead of a bare <h1>.
34
- Heading: ({
35
- children,
36
- level,
37
- }: {
38
- children: React.ReactNode;
39
- level: number;
40
- }): React.ReactElement => React.createElement(`h${level}`, null, children),
41
- SectionRenderer: ({ sections }: { sections: unknown[] }) =>
42
- React.createElement("div", {
43
- "data-testid": "section-renderer",
44
- "data-section-count": String(sections.length),
45
- }),
46
- }));
47
-
48
- import ClientsPage from "../page";
49
-
50
- const getMdxSourceEmpty = jest.fn().mockResolvedValue(null);
51
-
52
- describe("ClientsPage — snapshot regression", () => {
53
- it("empty state renders deterministic HTML", async () => {
54
- const element = await ClientsPage({
55
- params: Promise.resolve({ locale: "en" }),
56
- getMdxSource: getMdxSourceEmpty,
57
- });
58
- const { container } = render(element);
59
- expect(container.innerHTML).toMatchInlineSnapshot(
60
- `"<main id="main"><h1>Clients</h1><p data-testid="section-empty-state">Clients listing coming soon.</p></main>"`,
61
- );
62
- });
63
-
64
- it("populated state renders deterministic HTML", async () => {
65
- const source = {
66
- frontmatter: {
67
- type: "ClientsList" as const,
68
- slug: "clients",
69
- title: "Our Clients",
70
- description: "Companies that trust us.",
71
- },
72
- body: "",
73
- };
74
- const getMdxSourcePopulated = jest.fn().mockResolvedValue(source);
75
-
76
- const element = await ClientsPage({
77
- params: Promise.resolve({ locale: "en" }),
78
- getMdxSource: getMdxSourcePopulated,
79
- });
80
- const { container } = render(element);
81
- expect(container.innerHTML).toMatchInlineSnapshot(
82
- `"<script type="application/ld+json" data-testid="json-ld">{"@context":"https://schema.org","@type":"CollectionPage","inLanguage":"en","name":"Our Clients","description":"Companies that trust us.","mainEntity":{"@type":"ItemList","itemListElement":[{"@type":"Organization"}]}}</script><main id="main"><div><div data-testid="markdown-view-toggle" class="ailk-markdown-view-toggle"><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-remote" data-source=""></div></article></div></div></div></main>"`,
83
- );
84
- });
85
- });
@@ -1,47 +0,0 @@
1
- // Clients list page. Reads ClientsList MDX via the content adapter and emits
2
- // a JSON-LD CollectionPage via the dispatcher.
3
- import type {
4
- getMdxSource as defaultGetMdxSource,
5
- } from "@working-theory/page-renderer";
6
- import {
7
- getMdxSource as loadMdxSource,
8
- renderPage,
9
- renderPageMetadata,
10
- } from "@working-theory/page-renderer";
11
- import type { Metadata } from "next";
12
- import type { ReactElement } from "react";
13
-
14
- import { honourNavOnly } from "../../../lib/hub-children";
15
-
16
- interface Props {
17
- params: Promise<{ locale: string }>;
18
- getMdxSource?: typeof defaultGetMdxSource;
19
- }
20
-
21
- export async function generateMetadata({
22
- params,
23
- }: Pick<Props, "params">): Promise<Metadata> {
24
- const { locale } = await params;
25
- return renderPageMetadata({ type: "ClientsList", slug: "clients", locale });
26
- }
27
-
28
- export default async function Page({
29
- params,
30
- getMdxSource,
31
- }: Props): Promise<ReactElement> {
32
- const { locale } = await params;
33
- const source = await (getMdxSource ?? loadMdxSource)(
34
- "ClientsList",
35
- "clients",
36
- locale,
37
- );
38
- honourNavOnly(source?.frontmatter, locale, []);
39
- return renderPage({
40
- type: "ClientsList",
41
- slug: "clients",
42
- locale,
43
- translationsNamespace: "clients",
44
- bodyMode: "mdx-body",
45
- ...(getMdxSource !== undefined && { getMdxSource }),
46
- });
47
- }
@@ -1,249 +0,0 @@
1
- "use client"; // owns which surface is showing (conversation vs. fallback form) + submission/analytics wiring
2
-
3
- /**
4
- * ConversationalIntakeWrapper — apps/web's host around
5
- * `ConversationalIntake` (#4534, integration leg of epic #4521). Consumes
6
- * the block (#4543) and its engine (#4532) as published from
7
- * `@working-theory/ui`, unmodified — this file owns none of the
8
- * conversation logic, only:
9
- *
10
- * 1. Submission — `onComplete` hands the finished answers to the SAME
11
- * `captureLeadAction` (`./contact.actions.ts`) the shared
12
- * `LeadCaptureForm` on `/contact` already uses, built as a `FormData` (imperatively, not a real
13
- * `<form>` submit — React 19 Server Actions are plain async functions).
14
- * That action posts through the EXISTING `POST /v1/leads/submit` route
15
- * (`apps/api/src/routes/leads`, consumed via `@working-theory/api-client`,
16
- * never modified). Reusing this ONE action — rather than a second
17
- * `*Action`-suffixed export — is deliberate: a second export would trip
18
- * `apps/mcp/__tests__/parity.test.ts`'s Server-Action↔MCP-tool 1:1 count
19
- * for a capability (lead capture) that already has its MCP twin
20
- * (`ailkCaptureLead`); this is the SAME capability, invoked from a
21
- * second web surface, not a new one. `contact.actions.ts`'s own
22
- * doc-comment covers the additive `source` FormData field this file
23
- * sets to distinguish intake-originated leads.
24
- * 2. Skip fallback — `onSkip` swaps to the shared `LeadCaptureForm` block
25
- * (#6730 — the one contact form), bound to the same action,
26
- * carrying over whatever answers were already captured as its
27
- * `initialValues` prefill. A failed auto-submit on `onComplete` falls
28
- * back the same way, so a lead is never silently lost.
29
- * 3. Per-turn analytics — `getThinkingDelayMs` is `ConversationalIntake`'s
30
- * documented override seam (exported prop, used by the block's own
31
- * tests for deterministic timing). Wrapping it — incrementing a turn
32
- * counter and reporting it via `recordIntakeTurn`
33
- * (`./intake-analytics.ts`), then returning an unchanged random delay
34
- * from the exported `THINKING_DELAY_MIN_MS`/`THINKING_DELAY_MAX_MS`
35
- * bounds — taps the ONE seam the block exposes once per turn, without
36
- * touching its production pacing (behavior-contract item 5 stays
37
- * intact: replies are never instant) and without needing the block's
38
- * internal engine (not part of `@working-theory/ui`'s public surface —
39
- * see packages/ui/src/blocks/index.ts).
40
- */
41
-
42
- import {
43
- Container,
44
- ConversationalIntake,
45
- type ConversationalIntakeProps,
46
- InlineMessage,
47
- LeadCaptureForm,
48
- localeHref,
49
- THINKING_DELAY_MAX_MS,
50
- THINKING_DELAY_MIN_MS,
51
- } from "@working-theory/ui";
52
- import { useLocale, useTranslations } from "next-intl";
53
- import { useCallback, useMemo, useRef, useState } from "react";
54
-
55
- import { contactFormText } from "./contact-form-text";
56
- import { captureLeadAction } from "./contact.actions";
57
- import { recordIntakeTurn } from "./intake-analytics";
58
- import { buildContactIntakeScript } from "./intake-script";
59
-
60
- /**
61
- * Uniform-random pause in [THINKING_DELAY_MIN_MS, THINKING_DELAY_MAX_MS] —
62
- * mirrors `ConversationalIntake`'s own default picker (not exported; only
63
- * the bounds are). Reimplemented from those bounds rather than importing
64
- * the block's internals, so wrapping `getThinkingDelayMs` for analytics
65
- * changes nothing about production pacing.
66
- */
67
- function pickThinkingDelayMs(): number {
68
- const span = THINKING_DELAY_MAX_MS - THINKING_DELAY_MIN_MS;
69
- return THINKING_DELAY_MIN_MS + Math.floor(Math.random() * (span + 1));
70
- }
71
-
72
- /**
73
- * Fires `recordIntakeTurn` on a later microtask, swallowing any failure — a
74
- * synchronous throw from the Server Action reference or a rejected promise
75
- * alike — so analytics can never stall a turn, the Skip fallback, or the lead
76
- * submit (#6465).
77
- */
78
- function fireIntakeTurn(input: Parameters<typeof recordIntakeTurn>[0]): void {
79
- Promise.resolve()
80
- .then(() => recordIntakeTurn(input))
81
- .catch(() => {});
82
- }
83
-
84
- /**
85
- * Builds the FormData captureLeadAction expects from the engine's answers.
86
- * Called only once the terms turn was accepted, so it posts consent=true
87
- * (#8730 D2) — the action checks it for every source.
88
- */
89
- function answersToFormData(answers: Record<string, string>): FormData {
90
- const formData = new FormData();
91
- if (answers["name"] !== undefined) formData.set("name", answers["name"]);
92
- if (answers["email"] !== undefined) formData.set("email", answers["email"]);
93
- if (answers["message"] !== undefined)
94
- formData.set("message", answers["message"]);
95
- formData.set("source", "conversational-intake");
96
- formData.set("consent", "true");
97
- return formData;
98
- }
99
-
100
- type Surface = "intake" | "form";
101
-
102
- /** The terminal engine state `ConversationalIntake` hands `onComplete`/`onSkip`. */
103
- type IntakeState = Parameters<
104
- NonNullable<ConversationalIntakeProps["onComplete"]>
105
- >[0];
106
-
107
- // NO_HAND_IMPLEMENT_OK: operator-directed live Free-template reference pass.
108
- // `inline` drops the page-level Container so the intake can sit inside the
109
- // hero's right column (the /contact two-column layout).
110
- export function ConversationalIntakeWrapper({
111
- inline = false,
112
- }: { inline?: boolean } = {}) {
113
- const t = useTranslations("contact");
114
- const locale = useLocale();
115
- const script = useMemo(
116
- () =>
117
- buildContactIntakeScript({
118
- nameAck: t("intake.nameAck"),
119
- namePrompt: t("intake.namePrompt"),
120
- messageAck: t("intake.messageAck"),
121
- messagePrompt: t("intake.messagePrompt"),
122
- emailAck: t("intake.emailAck"),
123
- emailPrompt: t("intake.emailPrompt"),
124
- consentAck: t("intake.consentAck"),
125
- consentPrompt: t("intake.consentPrompt"),
126
- consentAccept: t("intake.consentAccept"),
127
- consentDecline: t("intake.consentDecline"),
128
- skipMessage: t("intake.skipMessage"),
129
- completionMessage: t("intake.completionMessage"),
130
- }),
131
- [t],
132
- );
133
-
134
- const [surface, setSurface] = useState<Surface>("intake");
135
- const [initialValues, setInitialValues] = useState<Record<string, string>>(
136
- {},
137
- );
138
- const [submitError, setSubmitError] = useState<string | undefined>(
139
- undefined,
140
- );
141
- const turnIndexRef = useRef(0);
142
-
143
- const getThinkingDelayMs = useCallback(() => {
144
- turnIndexRef.current += 1;
145
- fireIntakeTurn({
146
- turnIndex: turnIndexRef.current,
147
- status: "in_progress",
148
- locale,
149
- });
150
- return pickThinkingDelayMs();
151
- }, [locale]);
152
-
153
- const fallBackToForm = useCallback((answers: Record<string, string>) => {
154
- // exactOptionalPropertyTypes-safe (mirrors flow.actions.ts's own
155
- // rationale): omit an absent answer's key entirely rather than setting
156
- // it to an explicit `undefined`.
157
- setInitialValues({
158
- ...(answers["name"] !== undefined && { name: answers["name"] }),
159
- ...(answers["email"] !== undefined && { email: answers["email"] }),
160
- ...(answers["message"] !== undefined && {
161
- message: answers["message"],
162
- }),
163
- });
164
- setSurface("form");
165
- }, []);
166
-
167
- const handleComplete = useCallback(
168
- ({ answers }: IntakeState) => {
169
- fireIntakeTurn({
170
- turnIndex: turnIndexRef.current,
171
- status: "completed",
172
- locale,
173
- });
174
- // #8730 D2 — the engine records the tapped pill's label; anything but
175
- // the accept label is not acceptance, so nothing is sent and the form,
176
- // with its own terms box, takes over.
177
- if (answers["consent"] !== t("intake.consentAccept")) {
178
- fallBackToForm(answers);
179
- return;
180
- }
181
- void (async () => {
182
- const result = await captureLeadAction(null, answersToFormData(answers));
183
- if (result?.kind !== "success") {
184
- setSubmitError(t("intake.submitError"));
185
- fallBackToForm(answers);
186
- }
187
- })();
188
- },
189
- [locale, t, fallBackToForm],
190
- );
191
-
192
- const handleSkip = useCallback(
193
- ({ answers }: IntakeState) => {
194
- fireIntakeTurn({
195
- turnIndex: turnIndexRef.current,
196
- status: "skipped",
197
- locale,
198
- });
199
- fallBackToForm(answers);
200
- },
201
- [locale, fallBackToForm],
202
- );
203
-
204
- if (surface === "form") {
205
- return (
206
- <Container className={inline ? "p-0" : "py-section"}>
207
- {submitError ? (
208
- <InlineMessage
209
- variant="error"
210
- data-testid="contact-intake-submit-error"
211
- >
212
- {submitError}
213
- </InlineMessage>
214
- ) : null}
215
- <LeadCaptureForm
216
- action={captureLeadAction}
217
- text={contactFormText(t)}
218
- termsHref={localeHref(locale, "/terms")}
219
- // #8661 D7 — the same three policy links /contact passes, so the
220
- // catalog's three-link statement resolves here too.
221
- policies={{
222
- terms: localeHref(locale, "/terms"),
223
- privacy: localeHref(locale, "/privacy"),
224
- working_agreement: localeHref(locale, "/working-agreement"),
225
- }}
226
- initialValues={initialValues}
227
- />
228
- </Container>
229
- );
230
- }
231
-
232
- return (
233
- <Container className={inline ? "p-0" : "py-section"}>
234
- <ConversationalIntake
235
- script={script}
236
- onComplete={handleComplete}
237
- onSkip={handleSkip}
238
- getThinkingDelayMs={getThinkingDelayMs}
239
- labels={{
240
- guidedBadge: t("intake.guidedBadge"),
241
- skip: t("intake.skip"),
242
- send: t("intake.send"),
243
- freeTextPlaceholder: t("intake.freeTextPlaceholder"),
244
- }}
245
- data-testid="contact-conversational-intake"
246
- />
247
- </Container>
248
- );
249
- }