create-ailk 0.39.0 → 0.40.1

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 (203) hide show
  1. package/component-catalog.json +1 -1
  2. package/component-catalog.md +1 -1
  3. package/dist/add-route.js +15 -0
  4. package/dist/body-heading.d.ts +2 -1
  5. package/dist/body-heading.js +31 -3
  6. package/dist/module-architecture.js +0 -3
  7. package/dist/remove-module.js +13 -4
  8. package/dist/routes.d.ts +7 -0
  9. package/dist/routes.js +1 -1
  10. package/dist/site-roster.js +7 -1
  11. package/dist/surfaces.d.ts +2 -0
  12. package/dist/surfaces.js +59 -172
  13. package/package.json +3 -3
  14. package/templates/apps/web/CLAUDE.md +19 -2
  15. package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +3 -2
  16. package/templates/apps/web/__tests__/__mocks__/next-intl.ts +3 -2
  17. package/templates/apps/web/app/[locale]/layout.tsx +42 -25
  18. package/templates/apps/web/app/api/revalidate/__tests__/route.test.ts +56 -1
  19. package/templates/apps/web/app/api/revalidate/route.ts +45 -4
  20. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +53 -0
  21. package/templates/apps/web/app/llms.txt/route.ts +5 -2
  22. package/templates/apps/web/i18n/request.ts +5 -1
  23. package/templates/apps/web/jest.config.cjs +6 -0
  24. package/templates/apps/web/lib/__tests__/deck-page.test.ts +9 -0
  25. package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +239 -0
  26. package/templates/apps/web/lib/__tests__/in-page-magnet-self-request.test.ts +1 -1
  27. package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +2 -2
  28. package/templates/apps/web/lib/__tests__/pricing-page.test.ts +1 -1
  29. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +58 -0
  30. package/templates/apps/web/lib/__tests__/served-pages.test.ts +163 -20
  31. package/templates/apps/web/lib/__tests__/site-brand.test.ts +77 -0
  32. package/templates/apps/web/{app/[locale]/contact → lib}/__tests__/site-contact-lines.test.ts +64 -0
  33. package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +115 -3
  34. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +17 -4
  35. package/templates/apps/web/lib/hub-site-config.ts +151 -0
  36. package/templates/apps/web/lib/in-page-magnet.ts +2 -2
  37. package/templates/apps/web/lib/pricing-page.ts +3 -3
  38. package/templates/apps/web/lib/profile-back-link.ts +49 -12
  39. package/templates/apps/web/lib/served-pages.ts +144 -39
  40. package/templates/apps/web/lib/site-brand.tsx +66 -0
  41. package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-email.ts +25 -5
  42. package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-lines.ts +21 -5
  43. package/templates/apps/web/lib/site-header.ts +1 -1
  44. package/templates/apps/web/lib/site-identity.ts +38 -2
  45. package/templates/apps/web/messages/en.json +3 -119
  46. package/templates/apps/web/next.config.mjs +7 -0
  47. package/templates/apps/web/package.json +1 -0
  48. package/templates/apps/web/site-pages.config.tsx +85 -0
  49. package/templates/tools/body-heading.ts +30 -3
  50. package/versions.json +50 -49
  51. package/templates/apps/web/app/[locale]/(authed)/leads/__tests__/page.test.tsx +0 -205
  52. package/templates/apps/web/app/[locale]/(authed)/leads/components/LeadsTable.tsx +0 -137
  53. package/templates/apps/web/app/[locale]/(authed)/leads/page.tsx +0 -122
  54. package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ForbiddenState.tsx +0 -24
  55. package/templates/apps/web/app/[locale]/(authed)/waitlist/format.ts +0 -111
  56. package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +0 -402
  57. package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +0 -143
  58. package/templates/apps/web/app/[locale]/[slug]/__tests__/page.test.tsx +0 -148
  59. package/templates/apps/web/app/[locale]/[slug]/page.tsx +0 -109
  60. package/templates/apps/web/app/[locale]/about/[slug]/page.tsx +0 -46
  61. package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +0 -353
  62. package/templates/apps/web/app/[locale]/about/page.tsx +0 -122
  63. package/templates/apps/web/app/[locale]/alternatives/__tests__/page.test.tsx +0 -161
  64. package/templates/apps/web/app/[locale]/alternatives/page.tsx +0 -112
  65. package/templates/apps/web/app/[locale]/careers/[slug]/[action]/page.tsx +0 -244
  66. package/templates/apps/web/app/[locale]/careers/[slug]/apply.actions.ts +0 -325
  67. package/templates/apps/web/app/[locale]/careers/[slug]/job-application-form.ts +0 -120
  68. package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +0 -73
  69. package/templates/apps/web/app/[locale]/careers/__tests__/apply.actions.test.ts +0 -497
  70. package/templates/apps/web/app/[locale]/careers/__tests__/careers-hub.test.tsx +0 -172
  71. package/templates/apps/web/app/[locale]/careers/__tests__/careers-set.test.tsx +0 -153
  72. package/templates/apps/web/app/[locale]/careers/__tests__/job-application-form.test.ts +0 -141
  73. package/templates/apps/web/app/[locale]/careers/__tests__/job-apply-page.test.tsx +0 -546
  74. package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +0 -189
  75. package/templates/apps/web/app/[locale]/careers/page.tsx +0 -165
  76. package/templates/apps/web/app/[locale]/case-studies/[slug]/page.tsx +0 -49
  77. package/templates/apps/web/app/[locale]/case-studies/__tests__/hub-children.test.tsx +0 -65
  78. package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +0 -125
  79. package/templates/apps/web/app/[locale]/case-studies/page.tsx +0 -49
  80. package/templates/apps/web/app/[locale]/clients/__tests__/page-renderer-migration.test.tsx +0 -85
  81. package/templates/apps/web/app/[locale]/clients/page.tsx +0 -47
  82. package/templates/apps/web/app/[locale]/contact/ConversationalIntakeWrapper.tsx +0 -249
  83. package/templates/apps/web/app/[locale]/contact/__tests__/ConversationalIntakeWrapper.test.tsx +0 -400
  84. package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-magnet.test.ts +0 -138
  85. package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-text.test.ts +0 -49
  86. package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +0 -494
  87. package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +0 -1122
  88. package/templates/apps/web/app/[locale]/contact/__tests__/intake-analytics.test.ts +0 -51
  89. package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +0 -319
  90. package/templates/apps/web/app/[locale]/contact/contact-form-magnet.ts +0 -77
  91. package/templates/apps/web/app/[locale]/contact/contact-form-text.ts +0 -52
  92. package/templates/apps/web/app/[locale]/contact/contact.actions.ts +0 -403
  93. package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +0 -49
  94. package/templates/apps/web/app/[locale]/contact/intake-script.ts +0 -92
  95. package/templates/apps/web/app/[locale]/contact/page.tsx +0 -267
  96. package/templates/apps/web/app/[locale]/courses/[slug]/page.tsx +0 -50
  97. package/templates/apps/web/app/[locale]/courses/__tests__/hub-children.test.tsx +0 -32
  98. package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +0 -123
  99. package/templates/apps/web/app/[locale]/courses/page.tsx +0 -49
  100. package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +0 -57
  101. package/templates/apps/web/app/[locale]/events/__tests__/hub-children.test.tsx +0 -32
  102. package/templates/apps/web/app/[locale]/events/__tests__/page-renderer-migration.test.tsx +0 -164
  103. package/templates/apps/web/app/[locale]/events/__tests__/program-event.test.tsx +0 -120
  104. package/templates/apps/web/app/[locale]/events/page.tsx +0 -60
  105. package/templates/apps/web/app/[locale]/faq/page.tsx +0 -54
  106. package/templates/apps/web/app/[locale]/features/[slug]/page.tsx +0 -54
  107. package/templates/apps/web/app/[locale]/features/__tests__/hub-children.test.tsx +0 -32
  108. package/templates/apps/web/app/[locale]/features/page.tsx +0 -50
  109. package/templates/apps/web/app/[locale]/for/[slug]/page.tsx +0 -54
  110. package/templates/apps/web/app/[locale]/for/__tests__/hub-children.test.tsx +0 -32
  111. package/templates/apps/web/app/[locale]/for/__tests__/page-renderer-migration.test.tsx +0 -90
  112. package/templates/apps/web/app/[locale]/for/page.tsx +0 -51
  113. package/templates/apps/web/app/[locale]/glossary/page.tsx +0 -53
  114. package/templates/apps/web/app/[locale]/how-to/[slug]/page.tsx +0 -50
  115. package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +0 -78
  116. package/templates/apps/web/app/[locale]/how-to/page.tsx +0 -50
  117. package/templates/apps/web/app/[locale]/integrations/[slug]/page.tsx +0 -54
  118. package/templates/apps/web/app/[locale]/integrations/__tests__/hub-children.test.tsx +0 -38
  119. package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +0 -141
  120. package/templates/apps/web/app/[locale]/integrations/page.tsx +0 -49
  121. package/templates/apps/web/app/[locale]/launch-service/page.tsx +0 -44
  122. package/templates/apps/web/app/[locale]/newsletter/__tests__/page.test.tsx +0 -236
  123. package/templates/apps/web/app/[locale]/newsletter/page.tsx +0 -179
  124. package/templates/apps/web/app/[locale]/page.tsx +0 -147
  125. package/templates/apps/web/app/[locale]/partners/[slug]/page.tsx +0 -45
  126. package/templates/apps/web/app/[locale]/partners/__tests__/hub-children.test.tsx +0 -32
  127. package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +0 -125
  128. package/templates/apps/web/app/[locale]/partners/page.tsx +0 -49
  129. package/templates/apps/web/app/[locale]/portfolio/[slug]/page.tsx +0 -46
  130. package/templates/apps/web/app/[locale]/portfolio/__tests__/hub-children.test.tsx +0 -38
  131. package/templates/apps/web/app/[locale]/portfolio/page.tsx +0 -50
  132. package/templates/apps/web/app/[locale]/pricing/[slug]/__tests__/page.test.tsx +0 -324
  133. package/templates/apps/web/app/[locale]/pricing/[slug]/page.tsx +0 -87
  134. package/templates/apps/web/app/[locale]/pricing/__tests__/__snapshots__/unconnected.test.tsx.snap +0 -7
  135. package/templates/apps/web/app/[locale]/pricing/__tests__/offerings.test.tsx +0 -605
  136. package/templates/apps/web/app/[locale]/pricing/__tests__/page.test.tsx +0 -219
  137. package/templates/apps/web/app/[locale]/pricing/__tests__/pricing-pages.test.tsx +0 -215
  138. package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +0 -282
  139. package/templates/apps/web/app/[locale]/pricing/page.tsx +0 -120
  140. package/templates/apps/web/app/[locale]/privacy/page.tsx +0 -40
  141. package/templates/apps/web/app/[locale]/products/[slug]/page.tsx +0 -50
  142. package/templates/apps/web/app/[locale]/products/__tests__/hub-children.test.tsx +0 -32
  143. package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +0 -141
  144. package/templates/apps/web/app/[locale]/products/page.tsx +0 -49
  145. package/templates/apps/web/app/[locale]/projects/[slug]/page.tsx +0 -37
  146. package/templates/apps/web/app/[locale]/projects/__tests__/hub-children.test.tsx +0 -32
  147. package/templates/apps/web/app/[locale]/projects/__tests__/page-renderer-migration.test.tsx +0 -157
  148. package/templates/apps/web/app/[locale]/projects/page.tsx +0 -49
  149. package/templates/apps/web/app/[locale]/purchase-policy/page.tsx +0 -49
  150. package/templates/apps/web/app/[locale]/resources/[slug]/page.tsx +0 -54
  151. package/templates/apps/web/app/[locale]/resources/__tests__/hub-children.test.tsx +0 -38
  152. package/templates/apps/web/app/[locale]/resources/__tests__/page-renderer-migration.test.tsx +0 -151
  153. package/templates/apps/web/app/[locale]/resources/page.tsx +0 -49
  154. package/templates/apps/web/app/[locale]/services/[slug]/[child]/page.tsx +0 -68
  155. package/templates/apps/web/app/[locale]/services/[slug]/page.tsx +0 -88
  156. package/templates/apps/web/app/[locale]/services/__tests__/hub-children.test.tsx +0 -158
  157. package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +0 -187
  158. package/templates/apps/web/app/[locale]/services/__tests__/service-detail-sections.test.tsx +0 -224
  159. package/templates/apps/web/app/[locale]/services/__tests__/service-families.test.tsx +0 -368
  160. package/templates/apps/web/app/[locale]/services/page.tsx +0 -71
  161. package/templates/apps/web/app/[locale]/software/[slug]/page.tsx +0 -49
  162. package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +0 -81
  163. package/templates/apps/web/app/[locale]/software/page.tsx +0 -49
  164. package/templates/apps/web/app/[locale]/team/[slug]/page.tsx +0 -45
  165. package/templates/apps/web/app/[locale]/team/__tests__/hub-children.test.tsx +0 -32
  166. package/templates/apps/web/app/[locale]/team/__tests__/team-routes.test.tsx +0 -161
  167. package/templates/apps/web/app/[locale]/team/page.tsx +0 -50
  168. package/templates/apps/web/app/[locale]/tech-articles/[slug]/page.tsx +0 -54
  169. package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +0 -82
  170. package/templates/apps/web/app/[locale]/tech-articles/page.tsx +0 -49
  171. package/templates/apps/web/app/[locale]/templates/[slug]/__tests__/page.test.tsx +0 -203
  172. package/templates/apps/web/app/[locale]/templates/[slug]/page.tsx +0 -81
  173. package/templates/apps/web/app/[locale]/templates/__tests__/page.test.tsx +0 -237
  174. package/templates/apps/web/app/[locale]/templates/page.tsx +0 -114
  175. package/templates/apps/web/app/[locale]/terms/page.tsx +0 -40
  176. package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx +0 -85
  177. package/templates/apps/web/app/[locale]/testimonials/page.tsx +0 -51
  178. package/templates/apps/web/app/[locale]/thanks/[slug]/__tests__/page.test.tsx +0 -136
  179. package/templates/apps/web/app/[locale]/thanks/[slug]/page.tsx +0 -39
  180. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +0 -226
  181. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +0 -217
  182. package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +0 -106
  183. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +0 -94
  184. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe.actions.ts +0 -55
  185. package/templates/apps/web/app/[locale]/vs/[slug]/__tests__/page.test.tsx +0 -100
  186. package/templates/apps/web/app/[locale]/vs/[slug]/page.tsx +0 -60
  187. package/templates/apps/web/app/[locale]/whitepapers/[slug]/page.tsx +0 -54
  188. package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +0 -82
  189. package/templates/apps/web/app/[locale]/whitepapers/page.tsx +0 -49
  190. package/templates/apps/web/app/[locale]/working-agreement/__tests__/page.test.tsx +0 -63
  191. package/templates/apps/web/app/[locale]/working-agreement/page.tsx +0 -41
  192. package/templates/apps/web/lib/__tests__/hub-children.fixtures.ts +0 -279
  193. package/templates/apps/web/lib/__tests__/route-family.test.ts +0 -57
  194. package/templates/apps/web/lib/__tests__/service-listing.test.ts +0 -111
  195. package/templates/apps/web/lib/__tests__/template-listing.test.ts +0 -158
  196. package/templates/apps/web/lib/hub-children.tsx +0 -351
  197. package/templates/apps/web/lib/meet-placeholder.ts +0 -5
  198. package/templates/apps/web/lib/posting-title.ts +0 -39
  199. package/templates/apps/web/lib/route-family.ts +0 -69
  200. package/templates/apps/web/lib/service-listing.ts +0 -89
  201. package/templates/apps/web/lib/template-listing.ts +0 -169
  202. package/templates/apps/web/src/lib/__tests__/lead-write.test.ts +0 -187
  203. package/templates/apps/web/src/lib/lead-write.ts +0 -90
@@ -1,368 +0,0 @@
1
- /**
2
- * The services routes under a moved base and with categories (#10043 D7/D8,
3
- * AC-6), and unchanged on a site that sets nothing (AC-10).
4
- *
5
- * The moved-base cases load the routes afresh under `jest.isolateModules`
6
- * with `NEXT_PUBLIC_AILK_SERVICES_PATH=/capabilities` (`lib/services-path.ts`
7
- * reads it at module load) and read what each route hands `renderPage`; the
8
- * no-setting cases render the routes as imported and compare their markup
9
- * with a direct `renderPage` call over the same fixture, given today's input
10
- * (the `pricing/__tests__/unconnected.test.tsx` equality-oracle shape).
11
- */
12
- import { render } from "@testing-library/react";
13
- import type { RenderPageInput } from "@working-theory/page-renderer";
14
- import type { ReactElement } from "react";
15
-
16
- jest.mock("next/navigation", () => ({
17
- __esModule: true,
18
- notFound: jest.fn(() => {
19
- throw new Error("NEXT_NOT_FOUND");
20
- }),
21
- permanentRedirect: jest.fn(() => {
22
- throw new Error("NEXT_REDIRECT");
23
- }),
24
- }));
25
-
26
- jest.mock("@working-theory/page-renderer", () => {
27
- const actual = jest.requireActual("@working-theory/page-renderer");
28
- return {
29
- ...actual,
30
- renderPage: jest.fn(actual.renderPage),
31
- getMdxSlugs: jest.fn(actual.getMdxSlugs),
32
- getPageSections: jest.fn(actual.getPageSections),
33
- };
34
- });
35
-
36
- import ServicesPage from "../page";
37
- import ServiceSlugPage from "../[slug]/page";
38
-
39
- const actual = jest.requireActual("@working-theory/page-renderer") as {
40
- renderPage: (input: RenderPageInput) => Promise<ReactElement>;
41
- getMdxSlugs: (...args: unknown[]) => Promise<string[]>;
42
- getPageSections: (...args: unknown[]) => Promise<unknown[]>;
43
- };
44
- const actualRenderPage = actual.renderPage;
45
- const mocked = jest.requireMock("@working-theory/page-renderer") as {
46
- renderPage: jest.Mock;
47
- getMdxSlugs: jest.Mock;
48
- getPageSections: jest.Mock;
49
- };
50
- const nav = jest.requireMock("next/navigation") as {
51
- notFound: jest.Mock;
52
- permanentRedirect: jest.Mock;
53
- };
54
-
55
- // Every case starts from the real collaborators, with fresh call records.
56
- beforeEach(() => {
57
- mocked.renderPage.mockReset().mockImplementation(actual.renderPage);
58
- mocked.getMdxSlugs.mockReset().mockImplementation(actual.getMdxSlugs);
59
- mocked.getPageSections.mockReset().mockImplementation(actual.getPageSections);
60
- nav.notFound.mockClear();
61
- nav.permanentRedirect.mockClear();
62
- });
63
-
64
- type Frontmatter = Record<string, unknown>;
65
- type Source = { frontmatter: Frontmatter; body: string };
66
-
67
- function service(slug: string, extra: Frontmatter = {}): Source {
68
- return {
69
- frontmatter: {
70
- type: "Service",
71
- slug,
72
- title: slug.toUpperCase(),
73
- description: `${slug} description.`,
74
- ...extra,
75
- },
76
- body: `# ${slug}\n\nBody.`,
77
- };
78
- }
79
-
80
- /** A `getMdxSource` over a slug → source table; anything else is null. */
81
- function sources(table: Record<string, Source>) {
82
- return jest.fn(async (_type: string, slug: string) => table[slug] ?? null);
83
- }
84
-
85
- // The moved routes resolve to what the stubbed `renderPage` returns — the
86
- // captured `{ input }` — so they are typed as resolving to `unknown`.
87
- interface Routes {
88
- hub: (props: Parameters<typeof ServicesPage>[0]) => Promise<unknown>;
89
- slugPage: (props: Parameters<typeof ServiceSlugPage>[0]) => Promise<unknown>;
90
- childPage: (props: {
91
- params: Promise<{ locale: string; slug: string; child: string }>;
92
- getMdxSource?: unknown;
93
- }) => Promise<unknown>;
94
- renderPage: jest.Mock;
95
- getMdxSlugs: jest.Mock;
96
- getPageSections: jest.Mock;
97
- notFound: jest.Mock;
98
- permanentRedirect: jest.Mock;
99
- }
100
-
101
- /** The three routes and their mocked collaborators, loaded with a services base. */
102
- function loadMoved(base: string): Routes {
103
- const saved = process.env.NEXT_PUBLIC_AILK_SERVICES_PATH;
104
- process.env.NEXT_PUBLIC_AILK_SERVICES_PATH = base;
105
- let routes: Routes | undefined;
106
- try {
107
- // The mocked collaborators are shared with the top-level registry; only
108
- // the routes and `lib/services-path.ts` load afresh with the base.
109
- mocked.renderPage.mockImplementation(async (input: RenderPageInput) => ({
110
- input,
111
- }));
112
- jest.isolateModules(() => {
113
- routes = {
114
- hub: require("../page").default,
115
- slugPage: require("../[slug]/page").default,
116
- childPage: require("../[slug]/[child]/page").default,
117
- renderPage: mocked.renderPage,
118
- getMdxSlugs: mocked.getMdxSlugs,
119
- getPageSections: mocked.getPageSections,
120
- notFound: nav.notFound,
121
- permanentRedirect: nav.permanentRedirect,
122
- };
123
- });
124
- } finally {
125
- if (saved === undefined) delete process.env.NEXT_PUBLIC_AILK_SERVICES_PATH;
126
- else process.env.NEXT_PUBLIC_AILK_SERVICES_PATH = saved;
127
- }
128
- return routes!;
129
- }
130
-
131
- const params = (locale: string, slug: string) =>
132
- Promise.resolve({ locale, slug });
133
-
134
- describe("services under /capabilities (#10043 AC-6)", () => {
135
- let r: Routes;
136
- beforeEach(() => {
137
- r = loadMoved("/capabilities");
138
- });
139
-
140
- it("redirects a nested service's flat URL to its category URL, per locale", async () => {
141
- const load = sources({ x: service("x", { parent: "ai" }) });
142
- await expect(
143
- r.slugPage({ params: params("en", "x"), getMdxSource: load as never }),
144
- ).rejects.toThrow("NEXT_REDIRECT");
145
- expect(r.permanentRedirect).toHaveBeenLastCalledWith("/capabilities/ai/x");
146
- await expect(
147
- r.slugPage({ params: params("pt-BR", "x"), getMdxSource: load as never }),
148
- ).rejects.toThrow("NEXT_REDIRECT");
149
- expect(r.permanentRedirect).toHaveBeenLastCalledWith(
150
- "/pt-BR/capabilities/ai/x",
151
- );
152
- expect(r.renderPage).not.toHaveBeenCalled();
153
- });
154
-
155
- it("lists a category's services after its body, in slug order", async () => {
156
- const load = sources({
157
- ai: service("ai"),
158
- a: service("a", { parent: "ai", summary: "A summary." }),
159
- b: service("b", { parent: "ai" }),
160
- c: service("c", { parent: "other" }),
161
- });
162
- r.getMdxSlugs.mockResolvedValue(["c", "b", "ai", "a"]);
163
- const out = (await r.slugPage({
164
- params: params("en", "ai"),
165
- getMdxSource: load as never,
166
- })) as {
167
- input: RenderPageInput & {
168
- trailing: ReactElement<{
169
- sections: Array<{ data: { headline: string; items: unknown[] } }>;
170
- }>;
171
- };
172
- };
173
- expect(out.input).toMatchObject({
174
- type: "Service",
175
- slug: "ai",
176
- bodyMode: "mdx-body",
177
- });
178
- const [list] = out.input.trailing.props.sections;
179
- expect(list?.data.headline).toBe("Services in this area");
180
- expect(list?.data.items).toEqual([
181
- {
182
- title: "A",
183
- description: "A summary.",
184
- link: { label: "View service", href: "/capabilities/ai/a" },
185
- },
186
- {
187
- title: "B",
188
- description: "b description.",
189
- link: { label: "View service", href: "/capabilities/ai/b" },
190
- },
191
- ]);
192
- });
193
-
194
- it("renders a service with no children through today's input", async () => {
195
- const load = sources({ solo: service("solo") });
196
- r.getMdxSlugs.mockResolvedValue(["solo"]);
197
- const out = (await r.slugPage({
198
- params: params("en", "solo"),
199
- getMdxSource: load as never,
200
- })) as {
201
- input: Record<string, unknown>;
202
- };
203
- expect(out.input).toEqual({
204
- type: "Service",
205
- slug: "solo",
206
- locale: "en",
207
- bodyMode: "mdx-body",
208
- populatedDescriptionTestId: "service-description",
209
- getMdxSource: load,
210
- });
211
- });
212
-
213
- it("serves a nested service through renderPage at its category", async () => {
214
- const load = sources({
215
- ai: service("ai"),
216
- x: service("x", { parent: "ai" }),
217
- });
218
- const out = (await r.childPage({
219
- params: Promise.resolve({ locale: "en", slug: "ai", child: "x" }),
220
- getMdxSource: load,
221
- })) as { input: Record<string, unknown> };
222
- expect(out.input).toMatchObject({
223
- type: "Service",
224
- slug: "x",
225
- locale: "en",
226
- bodyMode: "mdx-body",
227
- });
228
- });
229
-
230
- it.each<[string, Record<string, Source>]>([
231
- [
232
- "its parent is another category",
233
- { ai: service("ai"), x: service("x", { parent: "other" }) },
234
- ],
235
- ["its category page is missing", { x: service("x", { parent: "ai" }) }],
236
- [
237
- "its category has its own parent",
238
- {
239
- top: service("top"),
240
- ai: service("ai", { parent: "top" }),
241
- x: service("x", { parent: "ai" }),
242
- },
243
- ],
244
- ])("answers 404 for a nested URL when %s", async (_label, table) => {
245
- await expect(
246
- r.childPage({
247
- params: Promise.resolve({ locale: "en", slug: "ai", child: "x" }),
248
- getMdxSource: sources(table),
249
- }),
250
- ).rejects.toThrow("NEXT_NOT_FOUND");
251
- expect(r.renderPage).not.toHaveBeenCalled();
252
- });
253
-
254
- it("hands a missing nested service to renderPage", async () => {
255
- const out = (await r.childPage({
256
- params: Promise.resolve({ locale: "en", slug: "ai", child: "x" }),
257
- getMdxSource: sources({}),
258
- })) as { input: Record<string, unknown> };
259
- expect(out.input).toMatchObject({ type: "Service", slug: "x" });
260
- expect(r.notFound).not.toHaveBeenCalled();
261
- });
262
-
263
- it("re-points the hub's section links onto the base", async () => {
264
- const hubSource = {
265
- frontmatter: {
266
- type: "ServicesList",
267
- slug: "services",
268
- title: "Services",
269
- description: "All.",
270
- sections: [{ type: "hero", id: "h", data: {} }],
271
- },
272
- body: "",
273
- };
274
- // No Service pages: this case pins the remap of the hub's own links;
275
- // the generated child cards are hub-children.test.tsx's (#10121).
276
- r.getMdxSlugs.mockResolvedValue([]);
277
- r.getPageSections.mockResolvedValue([
278
- {
279
- type: "items",
280
- id: "list",
281
- data: {
282
- items: [
283
- { title: "X", link: { label: "Go", href: "/services/x" } },
284
- {
285
- title: "Y",
286
- link: { label: "Go", href: "https://example.com/services" },
287
- },
288
- ],
289
- },
290
- },
291
- ]);
292
- const out = (await r.hub({
293
- params: Promise.resolve({ locale: "en" }),
294
- getMdxSource: jest.fn().mockResolvedValue(hubSource),
295
- })) as { input: RenderPageInput };
296
- const sections = (await out.input.getPageSections!(
297
- hubSource.frontmatter as never,
298
- )) as Array<{
299
- data: { items: Array<{ link: { href: string } }> };
300
- }>;
301
- expect(sections[0]?.data.items.map((item) => item.link.href)).toEqual([
302
- "/capabilities/x",
303
- "https://example.com/services",
304
- ]);
305
- });
306
- });
307
-
308
- describe("a site that sets nothing (#10043 AC-10)", () => {
309
- beforeEach(() => {
310
- mocked.getMdxSlugs.mockResolvedValue(["consulting", "implementation"]);
311
- });
312
-
313
- it("renders the /services hub exactly as a direct renderPage call", async () => {
314
- // No Service pages: the hub's generated child cards (#10121) are pinned in
315
- // hub-children.test.tsx; this case pins "no services.path changes nothing".
316
- mocked.getMdxSlugs.mockResolvedValue([]);
317
- const load = jest.fn().mockResolvedValue({
318
- frontmatter: {
319
- type: "ServicesList",
320
- slug: "services",
321
- title: "Services",
322
- description: "All services.",
323
- },
324
- body: "# Services\n\nBody.",
325
- });
326
- const viaRoute = render(
327
- await ServicesPage({
328
- params: Promise.resolve({ locale: "en" }),
329
- getMdxSource: load,
330
- }),
331
- );
332
- const direct = render(
333
- await actualRenderPage({
334
- type: "ServicesList",
335
- slug: "services",
336
- locale: "en",
337
- translationsNamespace: "services",
338
- bodyMode: "mdx-body",
339
- getMdxSource: load,
340
- }),
341
- );
342
- expect(viaRoute.container.innerHTML).toBe(direct.container.innerHTML);
343
- });
344
-
345
- it("renders /services/consulting exactly as a direct renderPage call", async () => {
346
- const load = sources({
347
- consulting: service("consulting"),
348
- implementation: service("implementation"),
349
- });
350
- const viaRoute = render(
351
- await ServiceSlugPage({
352
- params: params("en", "consulting"),
353
- getMdxSource: load as never,
354
- }),
355
- );
356
- const direct = render(
357
- await actualRenderPage({
358
- type: "Service",
359
- slug: "consulting",
360
- locale: "en",
361
- bodyMode: "mdx-body",
362
- populatedDescriptionTestId: "service-description",
363
- getMdxSource: load as never,
364
- }),
365
- );
366
- expect(viaRoute.container.innerHTML).toBe(direct.container.innerHTML);
367
- });
368
- });
@@ -1,71 +0,0 @@
1
- // Services list page. Reads ServicesList MDX via the content adapter and emits
2
- // a JSON-LD CollectionPage via the dispatcher. The /for composed pattern
3
- // (#7745 D2): sections when the frontmatter carries `sections[]`, MDX prose
4
- // otherwise.
5
- // It lists every top-level Service — a category, or a service with no
6
- // category — through one generated card section (#10121,
7
- // apps/web/lib/hub-children.tsx). A service with a `parent` is listed on its
8
- // category's page instead (#10043 D7). Cards link to the service's public URL
9
- // under the site's services base, and on a site that moved its services the
10
- // hub's own section links name that base too (#10043 D8).
11
- import type {
12
- getMdxSlugs as defaultGetMdxSlugs,
13
- getMdxSource as defaultGetMdxSource,
14
- getPageSections as defaultGetPageSections,
15
- } from "@working-theory/page-renderer";
16
- import { renderPage, renderPageMetadata } from "@working-theory/page-renderer";
17
- import type { Metadata } from "next";
18
- import { getTranslations } from "next-intl/server";
19
- import type { ReactElement } from "react";
20
-
21
- import { type HubConfig, hubPageInput } from "../../../lib/hub-children";
22
- import {
23
- serviceChildrenSection,
24
- withPublicServicesSections,
25
- } from "../../../lib/service-listing";
26
-
27
- interface Props {
28
- params: Promise<{ locale: string }>;
29
- getMdxSource?: typeof defaultGetMdxSource;
30
- getPageSections?: typeof defaultGetPageSections;
31
- getMdxSlugs?: typeof defaultGetMdxSlugs;
32
- }
33
-
34
- export async function generateMetadata({
35
- params,
36
- }: Pick<Props, "params">): Promise<Metadata> {
37
- const { locale } = await params;
38
- return renderPageMetadata({ type: "ServicesList", slug: "services", locale });
39
- }
40
-
41
- export default async function Page({
42
- params,
43
- ...loaders
44
- }: Props): Promise<ReactElement> {
45
- const { locale } = await params;
46
- const t = await getTranslations({ namespace: "services", locale });
47
- const labels = {
48
- childrenHeading: t("childrenHeading"),
49
- viewService: t("viewService"),
50
- };
51
- const hub: HubConfig = {
52
- listType: "ServicesList",
53
- slug: "services",
54
- childType: "Service",
55
- linkLabel: labels.viewService,
56
- sectionId: "service-cards",
57
- body: "composed",
58
- // No category: the same reading the category listing gives `parent`
59
- // (absent, blank or not a string), so every service is listed somewhere.
60
- includeChild: ({ frontmatter: { parent } }) =>
61
- typeof parent !== "string" || parent.length === 0,
62
- // The category page's own card shape, at the service's public URL.
63
- card: (page) => serviceChildrenSection([page], labels).data.items[0]!,
64
- mapSections: withPublicServicesSections,
65
- };
66
- return renderPage({
67
- type: "ServicesList",
68
- slug: "services",
69
- ...(await hubPageInput(hub, locale, loaders)),
70
- });
71
- }
@@ -1,49 +0,0 @@
1
- // SoftwareProduct detail page. Reads the SoftwareProduct MDX for the given slug,
2
- // renders via @working-theory/page-renderer, and emits a JSON-LD <script>. Unknown slugs 404.
3
- // A page that composes `sections[]` (the starter's /software/product, #6658 D3)
4
- // renders them; a prose-only page keeps the MDX-body render.
5
- import type { getMdxSource as defaultGetMdxSource } 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
- interface Props {
15
- params: Promise<{ locale: string; slug: string }>;
16
- getMdxSource?: typeof defaultGetMdxSource;
17
- }
18
-
19
- export async function generateMetadata({
20
- params,
21
- }: Pick<Props, "params">): Promise<Metadata> {
22
- const { locale, slug } = await params;
23
- return renderPageMetadata({ type: "SoftwareProduct", slug, locale });
24
- }
25
-
26
- export default async function Page({
27
- params,
28
- getMdxSource,
29
- }: Props): Promise<ReactElement> {
30
- const { locale, slug } = await params;
31
- const source = await (getMdxSource ?? loadMdxSource)(
32
- "SoftwareProduct",
33
- slug,
34
- locale,
35
- );
36
- const composed =
37
- source !== null &&
38
- Array.isArray((source.frontmatter as { sections?: unknown[] }).sections) &&
39
- ((source.frontmatter as { sections?: unknown[] }).sections?.length ?? 0) >
40
- 0;
41
- return renderPage({
42
- type: "SoftwareProduct",
43
- slug,
44
- locale,
45
- ...(composed ? {} : { bodyMode: "mdx-body" as const }),
46
- populatedDescriptionTestId: "software-description",
47
- ...(getMdxSource !== undefined && { getMdxSource }),
48
- });
49
- }
@@ -1,81 +0,0 @@
1
- /**
2
- * HTML snapshot regression tests for software/[slug] — @working-theory/page-renderer migration.
3
- *
4
- * Node version: captured against Node 22.x (same as CI).
5
- * MDX seed content: DI-injected stub — no fs reads, deterministic.
6
- *
7
- * Two-commit strategy:
8
- * Commit 1: this file added; snapshots captured against pre-migration routes.
9
- * Commit 2: routes migrated; same snapshots verify diff=0.
10
- *
11
- * Routes covered:
12
- * - software/[slug] (populated: populated state)
13
- * - software/[slug] (notFound: unknown slug triggers notFound())
14
- *
15
- * Note: software/page.tsx is a slug-listing route (not MDX-body); only the
16
- * import path changes. No snapshot tests needed for software/page.
17
- *
18
- * Failure = snapshot diff > 0 bytes. DO NOT regenerate snapshots to pass.
19
- * A non-zero diff indicates a behavior regression in the migration. Escalate.
20
- */
21
- import React from "react";
22
- import { render } from "@testing-library/react";
23
-
24
- jest.mock("next-mdx-remote/rsc", () => ({
25
- __esModule: true,
26
- MDXRemote: ({ source }: { source: string }): React.ReactElement =>
27
- React.createElement("div", { "data-testid": "mdx-rendered" }, source),
28
- }));
29
-
30
- jest.mock("next/navigation", () => ({
31
- __esModule: true,
32
- notFound: jest.fn(() => {
33
- throw new Error("NEXT_NOT_FOUND");
34
- }),
35
- }));
36
-
37
- import SoftwareSlugPage from "../[slug]/page";
38
- import { notFound } from "next/navigation";
39
-
40
- const mockNotFound = notFound as jest.MockedFunction<typeof notFound>;
41
-
42
- describe("software/[slug] — snapshot regression", () => {
43
- beforeEach(() => {
44
- mockNotFound.mockClear();
45
- });
46
-
47
- it("populated state renders deterministic HTML", async () => {
48
- const getMdxSource = jest.fn().mockResolvedValue({
49
- frontmatter: {
50
- type: "SoftwareProduct" as const,
51
- slug: "page-renderer",
52
- title: "@working-theory/page-renderer",
53
- description: "Single rendering primitive for MDX-wired routes.",
54
- },
55
- body: "## Overview\n\nBody content.",
56
- });
57
-
58
- const element = await SoftwareSlugPage({
59
- params: Promise.resolve({ locale: "en", slug: "page-renderer" }),
60
- getMdxSource,
61
- });
62
- const { container } = render(element);
63
- expect(container.innerHTML).toMatchInlineSnapshot(`
64
- "<script type="application/ld+json" data-testid="json-ld">{"@context":"https://schema.org","@type":"WebPage","inLanguage":"en","name":"@working-theory/page-renderer","description":"Single rendering primitive for MDX-wired routes.","mainEntity":{"@context":"https://schema.org","@type":"SoftwareApplication","name":"@working-theory/page-renderer","description":"Single rendering primitive for MDX-wired routes."}}</script><main id="main"><div class="mx-auto w-full max-w-container-xl px-4 md:px-6 lg:px-8 py-section"><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 class="ailk-prose max-w-none text-(--color-text-muted) text-body-sm leading-relaxed [&amp;>*:first-child]:mt-0 [&amp;_h2]:mt-block-loose [&amp;_h2]:scroll-mt-24 [&amp;_h2]:text-heading-3 [&amp;_h2]:font-display [&amp;_h2]:text-(--color-fg) [&amp;_h3]:mt-block-loose [&amp;_h3]:scroll-mt-24 [&amp;_h3]:text-heading-4 [&amp;_h3]:font-display [&amp;_h3]:text-(--color-fg) [&amp;_h4]:mt-block-tight [&amp;_h4]:scroll-mt-24 [&amp;_h4]:text-heading-4 [&amp;_h4]:font-display [&amp;_h4]:text-(--color-fg) [&amp;_h5]:mt-block-tight [&amp;_h5]:scroll-mt-24 [&amp;_h5]:text-heading-4 [&amp;_h5]:font-display [&amp;_h5]:text-(--color-fg) [&amp;_h6]:mt-block-tight [&amp;_h6]:scroll-mt-24 [&amp;_h6]:text-heading-4 [&amp;_h6]:font-display [&amp;_h6]:text-(--color-fg) [&amp;_p]:mt-paragraph [&amp;_strong]:font-semibold [&amp;_strong]:text-(--color-fg) [&amp;_em]:italic [&amp;_ul]:mt-paragraph [&amp;_ul]:list-disc [&amp;_ul]:ps-6 [&amp;_ol]:mt-paragraph [&amp;_ol]:list-decimal [&amp;_ol]:ps-6 [&amp;_li]:mt-1 [&amp;_li]:ps-1 [&amp;_li]:marker:text-(--color-text-muted) [&amp;_li>ul]:mt-1 [&amp;_li>ol]:mt-1 [&amp;_blockquote]:mt-paragraph [&amp;_blockquote]:border-s-4 [&amp;_blockquote]:border-(--color-border-strong) [&amp;_blockquote]:ps-4 [&amp;_blockquote]:italic [&amp;_blockquote]:text-(--color-text-muted) [&amp;_hr]:my-block-loose [&amp;_hr]:border-(--color-border) [&amp;_a]:text-(--color-accent) [&amp;_a]:underline [&amp;_a]:underline-offset-4 [&amp;_:not(pre)>code]:rounded [&amp;_:not(pre)>code]:bg-(--color-surface-secondary) [&amp;_:not(pre)>code]:px-1.5 [&amp;_:not(pre)>code]:py-0.5 [&amp;_:not(pre)>code]:text-code [&amp;_:not(pre)>code]:font-mono [&amp;_:not(pre)>code]:text-(--color-fg) [&amp;_pre]:mt-paragraph [&amp;_pre]:overflow-auto [&amp;_pre]:rounded-md [&amp;_pre]:border-hairline [&amp;_pre]:border-(--color-border) [&amp;_pre]:bg-(--color-bg) [&amp;_pre]:p-4 [&amp;_pre]:font-mono [&amp;_pre]:text-body-sm [&amp;_img]:mt-paragraph [&amp;_img]:h-auto [&amp;_img]:max-w-full [&amp;_img]:rounded-lg [&amp;_table]:mt-paragraph [&amp;_table]:w-full [&amp;_table]:border-collapse [&amp;_table]:text-body-sm [&amp;_th]:border-b [&amp;_th]:border-(--color-border) [&amp;_th]:bg-(--color-surface-secondary) [&amp;_th]:px-3 [&amp;_th]:py-2 [&amp;_th]:text-start [&amp;_th]:font-semibold [&amp;_th]:text-(--color-fg) [&amp;_td]:border-b [&amp;_td]:border-(--color-border) [&amp;_td]:px-3 [&amp;_td]:py-2 [&amp;_kbd]:rounded [&amp;_kbd]:border-hairline [&amp;_kbd]:border-(--color-border) [&amp;_kbd]:bg-(--color-surface-secondary) [&amp;_kbd]:px-1.5 [&amp;_kbd]:py-0.5 [&amp;_kbd]:text-caption [&amp;_kbd]:font-mono" data-testid="mdx-content"><div data-testid="mdx-rendered">## Overview
65
-
66
- Body content.</div></div></article></div></div></div></main>"
67
- `);
68
- });
69
-
70
- it("unknown slug triggers notFound()", async () => {
71
- const getMdxSource = jest.fn().mockResolvedValue(null);
72
-
73
- await expect(
74
- SoftwareSlugPage({
75
- params: Promise.resolve({ locale: "en", slug: "unknown-slug" }),
76
- getMdxSource,
77
- }),
78
- ).rejects.toThrow("NEXT_NOT_FOUND");
79
- expect(mockNotFound).toHaveBeenCalled();
80
- });
81
- });
@@ -1,49 +0,0 @@
1
- // Software list page. Enumerates SoftwareProduct slugs via the content adapter
2
- // and renders a directory listing. No dedicated list MDX type exists for SoftwareProduct.
3
- import { getMdxSlugs as defaultGetMdxSlugs } from "@working-theory/page-renderer";
4
- import { LinkListItem, RowGroup } from "@working-theory/ui/blocks";
5
- import { Container, Heading, Text } from "@working-theory/ui/primitives";
6
- import { getTranslations } from "next-intl/server";
7
- import type { ReactElement } from "react";
8
-
9
- interface Props {
10
- params: Promise<{ locale: string }>;
11
- getMdxSlugs?: typeof defaultGetMdxSlugs;
12
- }
13
-
14
- export default async function Page({
15
- params,
16
- getMdxSlugs = defaultGetMdxSlugs,
17
- }: Props): Promise<ReactElement> {
18
- const { locale } = await params;
19
- const t = await getTranslations("software");
20
- const slugs = await getMdxSlugs("SoftwareProduct", locale);
21
-
22
- return (
23
- <main>
24
- <Container className="py-section">
25
- <Heading level={1}>{t("heading")}</Heading>
26
- <div data-testid="software-description">
27
- <Text>{t("description")}</Text>
28
- </div>
29
- {slugs.length === 0 ? (
30
- <div data-testid="section-empty-state">
31
- <Text>{t("emptyState")}</Text>
32
- </div>
33
- ) : (
34
- <RowGroup data-testid="software-list">
35
- {slugs.map((slug) => (
36
- <LinkListItem
37
- key={slug}
38
- href={`/${locale}/software/${slug}`}
39
- label={slug}
40
- className="px-4"
41
- data-testid={`software-list-item-${slug}`}
42
- />
43
- ))}
44
- </RowGroup>
45
- )}
46
- </Container>
47
- </main>
48
- );
49
- }
@@ -1,45 +0,0 @@
1
- // Team member profile page (#7744 D2). Reads the TeamMember MDX for the given slug and emits a
2
- // JSON-LD <script>. Unknown slugs 404 through renderPage. Renders `sections[]` when the
3
- // frontmatter carries them (the /for composed pattern), MDX prose otherwise.
4
- import {
5
- getMdxSource as defaultGetMdxSource,
6
- renderPage,
7
- renderPageMetadata,
8
- } from "@working-theory/page-renderer";
9
- import type { Metadata } from "next";
10
- import type { ReactElement } from "react";
11
-
12
- interface Props {
13
- params: Promise<{ locale: string; slug: string }>;
14
- getMdxSource?: typeof defaultGetMdxSource;
15
- }
16
-
17
- export async function generateMetadata({
18
- params,
19
- }: Pick<Props, "params">): Promise<Metadata> {
20
- const { locale, slug } = await params;
21
- return renderPageMetadata({ type: "TeamMember", slug, locale });
22
- }
23
-
24
- export default async function Page({
25
- params,
26
- getMdxSource = defaultGetMdxSource,
27
- }: Props): Promise<ReactElement> {
28
- const { locale, slug } = await params;
29
- // Read once to pick the body mode. A null source still goes to renderPage,
30
- // which owns the unknown-slug branch (#7537).
31
- const source = await getMdxSource("TeamMember", slug, locale);
32
-
33
- const composed =
34
- source !== null &&
35
- Array.isArray((source.frontmatter as { sections?: unknown[] }).sections) &&
36
- ((source.frontmatter as { sections?: unknown[] }).sections?.length ?? 0) > 0;
37
-
38
- return renderPage({
39
- type: "TeamMember",
40
- slug,
41
- locale,
42
- ...(composed ? {} : { bodyMode: "mdx-body" as const }),
43
- getMdxSource: async () => source,
44
- });
45
- }