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,402 +0,0 @@
1
- /**
2
- * Tests for the `[slug]/[detail]` route — the Free `/meet/<slug>` placeholder
3
- * detail pages (#6897 D2).
4
- *
5
- * - `slug !== "meet"` → notFound() immediately, never reaching getMdxSource.
6
- * - `slug === "meet"` and a BookCall source exists at `detail` → renders
7
- * through renderPage sections mode, no notFound() call.
8
- * - `slug === "meet"` and no BookCall source exists at `detail` → renderPage's
9
- * own detail-route branch (no translationsNamespace passed) calls
10
- * notFound().
11
- */
12
- import React from "react";
13
- import { render } from "@testing-library/react";
14
-
15
- jest.mock("next/navigation", () => ({
16
- __esModule: true,
17
- notFound: jest.fn(() => {
18
- throw new Error("NEXT_NOT_FOUND");
19
- }),
20
- }));
21
-
22
- // #7521 — the paid sections reach the listing extension through the generated
23
- // paid-sections registry, which a keyless scaffold renders as a stub answering
24
- // null. This suite supplies stand-ins through the registry itself, so it
25
- // passes in the monorepo and in every scaffold alike; the real sections are
26
- // `listing-directory.test.tsx`'s (ui-signal-collectors).
27
- // eslint-disable-next-line no-restricted-syntax -- the generated registry is the paid-package boundary; a scaffold renders it with or without the package
28
- jest.mock("../../../../../lib/paid-sections.generated", () => {
29
- const { createElement, Fragment } = jest.requireActual<typeof import("react")>("react");
30
- type Entry = { name: string; profile: Array<{ name: string; label: string; value: string }> };
31
- return {
32
- loadUiCommerce: async () => null,
33
- loadUiSignalCollectors: async () => ({
34
- ListingShelves: () => createElement("div", { "data-testid": "listing-shelves" }),
35
- ListingDetail: ({ entry }: { entry: Entry }) =>
36
- createElement(
37
- Fragment,
38
- null,
39
- createElement("h1", null, entry.name),
40
- createElement(
41
- "dl",
42
- null,
43
- ...entry.profile.flatMap((row) => [
44
- createElement("dt", { key: `${row.name}-dt` }, row.label),
45
- createElement("dd", { key: `${row.name}-dd` }, row.value),
46
- ]),
47
- ),
48
- ),
49
- }),
50
- };
51
- });
52
-
53
- // #10552 — an MDX body's `## ` lines render through the page's own component
54
- // map, so a heading's `id` is the real heading adapter's (AC-4).
55
- jest.mock("next-mdx-remote/rsc", () => {
56
- const { createElement, Fragment } = jest.requireActual<typeof import("react")>("react");
57
- return {
58
- MDXRemote: ({
59
- source,
60
- components,
61
- }: {
62
- source: string;
63
- components: Record<string, React.ComponentType<{ children?: React.ReactNode }>>;
64
- }) =>
65
- createElement(
66
- Fragment,
67
- null,
68
- ...source
69
- .split("\n")
70
- .filter((line) => line.trim() !== "")
71
- .map((line, i) =>
72
- line.startsWith("## ")
73
- ? createElement(components["h2"]!, { key: i }, line.slice(3))
74
- : createElement("p", { key: i }, line),
75
- ),
76
- ),
77
- };
78
- });
79
-
80
- jest.mock("@working-theory/ui", () => ({
81
- // #7789: renderPage's fallback page head renders inside the section Container.
82
- Container: ({ children }: { children?: React.ReactNode }) =>
83
- React.createElement("div", null, children),
84
- // #7521 — the rest of the real barrel, so the listing extension finds
85
- // `localeHref`; the two below still override.
86
- ...jest.requireActual("@working-theory/ui"),
87
- Heading: ({
88
- children,
89
- level,
90
- id,
91
- }: {
92
- children: React.ReactNode;
93
- level: number;
94
- id?: string;
95
- }): React.ReactElement => React.createElement(`h${level}`, id ? { id } : null, children),
96
- SectionRenderer: ({ sections }: { sections: unknown[] }) =>
97
- React.createElement("div", {
98
- "data-testid": "section-renderer",
99
- "data-section-count": String(sections.length),
100
- }),
101
- }));
102
-
103
- import { notFound } from "next/navigation";
104
-
105
- import { listingExtension } from "../../../../../lib/listings";
106
- import DetailPage, { generateMetadata } from "../page";
107
-
108
- // #10704 — a fixture suite: its content is shaped for the mdx source, whatever the site serves from.
109
- process.env.CONTENT_ADAPTER = "mdx";
110
-
111
- const mockNotFound = notFound as jest.MockedFunction<typeof notFound>;
112
-
113
- function makeSource(slug: string) {
114
- return {
115
- frontmatter: {
116
- type: "BookCall" as const,
117
- slug,
118
- title: `Title for ${slug}`,
119
- description: `Description for ${slug}`,
120
- sections: [
121
- {
122
- id: "hero",
123
- type: "hero" as const,
124
- data: { headline: `Title for ${slug}` },
125
- },
126
- ],
127
- },
128
- body: "",
129
- };
130
- }
131
-
132
- describe("[slug]/[detail] — the Free /meet/<slug> placeholder route (#6897 D2)", () => {
133
- beforeEach(() => {
134
- mockNotFound.mockClear();
135
- });
136
-
137
- it("renders a BookCall seed at meet/<detail> through renderPage sections mode", async () => {
138
- const getMdxSource = jest.fn().mockResolvedValue(makeSource("book-a-call"));
139
-
140
- const element = await DetailPage({
141
- params: Promise.resolve({ locale: "en", slug: "meet", detail: "book-a-call" }),
142
- getMdxSource,
143
- });
144
- const { container } = render(element);
145
-
146
- expect(getMdxSource).toHaveBeenCalledWith("BookCall", "book-a-call", "en");
147
- expect(
148
- container.querySelector("[data-testid='section-renderer']"),
149
- ).not.toBeNull();
150
- expect(
151
- container.querySelector("script[type='application/ld+json']"),
152
- ).not.toBeNull();
153
- expect(mockNotFound).not.toHaveBeenCalled();
154
- });
155
-
156
- it("404s for another hub — no BookCall source is ever read", async () => {
157
- const getMdxSource = jest.fn().mockResolvedValue(makeSource("book-a-call"));
158
-
159
- await expect(
160
- DetailPage({
161
- params: Promise.resolve({ locale: "en", slug: "not-meet", detail: "book-a-call" }),
162
- getMdxSource,
163
- }),
164
- ).rejects.toThrow("NEXT_NOT_FOUND");
165
- expect(mockNotFound).toHaveBeenCalledTimes(1);
166
- // #10552 — the program-event branch reads the Event source first; the
167
- // meet branch's BookCall read never runs for another hub.
168
- expect(getMdxSource).not.toHaveBeenCalledWith("BookCall", expect.anything(), expect.anything());
169
- });
170
-
171
- it("404s for an unknown detail slug under the meet hub", async () => {
172
- const getMdxSource = jest.fn().mockResolvedValue(null);
173
-
174
- await expect(
175
- DetailPage({
176
- params: Promise.resolve({ locale: "en", slug: "meet", detail: "not-a-page" }),
177
- getMdxSource,
178
- }),
179
- ).rejects.toThrow("NEXT_NOT_FOUND");
180
- expect(mockNotFound).toHaveBeenCalledTimes(1);
181
- });
182
- });
183
-
184
- // ── #7521 — a non-meet hub serves a listicle's accepted entry ──────────────
185
- //
186
- // Through the REAL listing extension: the key is set, the API read is a
187
- // fetch stub, and the paid sections are the registry stand-ins mocked above.
188
- describe("[slug]/[detail] — a listicle entry at /<landingPage>/<slug> (#7521)", () => {
189
- const priorKey = process.env["AILK_LISTING_PUBLIC_KEY"];
190
- const priorLocales = process.env["NEXT_PUBLIC_ENABLED_LOCALES"];
191
- const priorFetch = global.fetch;
192
-
193
- beforeEach(() => {
194
- mockNotFound.mockClear();
195
- process.env["AILK_LISTING_PUBLIC_KEY"] = "pk-detail-test";
196
- process.env["NEXT_PUBLIC_ENABLED_LOCALES"] = "en";
197
- global.fetch = jest.fn(async () => ({
198
- ok: true,
199
- status: 200,
200
- json: async () => ({
201
- ok: true,
202
- data: {
203
- landingPage: "/tools",
204
- entryType: "Organization",
205
- entries: [
206
- {
207
- id: "prjl_acme",
208
- slug: "acme",
209
- name: "Acme Tools",
210
- summary: "Tools for teams.",
211
- url: null,
212
- logoMarkUrl: null,
213
- featured: false,
214
- status: "active",
215
- windowEndsAt: null,
216
- decidedAt: null,
217
- waitlistCount: 0,
218
- profile: [{ name: "stage", label: "Stage", value: "Live", kind: "select" }],
219
- },
220
- ],
221
- },
222
- }),
223
- })) as jest.Mock;
224
- });
225
-
226
- afterEach(() => {
227
- if (priorKey === undefined) delete process.env["AILK_LISTING_PUBLIC_KEY"];
228
- else process.env["AILK_LISTING_PUBLIC_KEY"] = priorKey;
229
- if (priorLocales === undefined) delete process.env["NEXT_PUBLIC_ENABLED_LOCALES"];
230
- else process.env["NEXT_PUBLIC_ENABLED_LOCALES"] = priorLocales;
231
- global.fetch = priorFetch;
232
- });
233
-
234
- it("renders the accepted entry with its profile and entry-type JSON-LD", async () => {
235
- // `/tools` is a LandingPage, so the hub guard lets the directory read run.
236
- const getMdxSource = jest
237
- .fn()
238
- .mockImplementation(async (type: string) =>
239
- type === "LandingPage" ? makeSource("tools") : null,
240
- );
241
-
242
- const element = await DetailPage({
243
- params: Promise.resolve({ locale: "en", slug: "tools", detail: "acme" }),
244
- getMdxSource,
245
- });
246
- const { container } = render(element);
247
-
248
- expect(container.querySelector("h1")?.textContent).toBe("Acme Tools");
249
- expect(container.querySelector("dt")?.textContent).toBe("Stage");
250
- expect(container.querySelector("dd")?.textContent).toBe("Live");
251
- const ld = JSON.parse(
252
- container.querySelector("script[type='application/ld+json']")?.textContent ?? "{}",
253
- ) as Record<string, unknown>;
254
- expect(ld["@type"]).toBe("Organization");
255
- expect(String((global.fetch as jest.Mock).mock.calls[0][0])).toContain(
256
- "/v1/project-listings/directory?siteKey=pk-detail-test&landingPage=%2Ftools&locale=en",
257
- );
258
- expect(mockNotFound).not.toHaveBeenCalled();
259
- expect(getMdxSource).toHaveBeenCalledWith("LandingPage", "tools", "en");
260
- expect(getMdxSource).not.toHaveBeenCalledWith("BookCall", expect.anything(), expect.anything());
261
- });
262
-
263
- it("404s for an entry the directory does not hold", async () => {
264
- await expect(
265
- DetailPage({
266
- params: Promise.resolve({ locale: "en", slug: "tools", detail: "nope" }),
267
- getMdxSource: jest.fn().mockResolvedValue(makeSource("tools")),
268
- }),
269
- ).rejects.toThrow("NEXT_NOT_FOUND");
270
- });
271
-
272
- it("404s with no directory read when the hub is not a page (SEC-7521-D1)", async () => {
273
- const getMdxSource = jest.fn(async () => null);
274
-
275
- await expect(
276
- DetailPage({
277
- params: Promise.resolve({ locale: "en", slug: "made-up-hub", detail: "acme" }),
278
- getMdxSource,
279
- }),
280
- ).rejects.toThrow("NEXT_NOT_FOUND");
281
- expect(getMdxSource).toHaveBeenCalledWith("LandingPage", "made-up-hub", "en");
282
- expect(getMdxSource).toHaveBeenCalledWith("BlogList", "made-up-hub", "en");
283
- expect(global.fetch).not.toHaveBeenCalled();
284
- });
285
- });
286
-
287
- // ── #10552 — an Event under a program at /<program>/<event> ─────────────────
288
- describe("[slug]/[detail] — an Event under a program at /<program>/<event> (#10552)", () => {
289
- const landing = (slug: string, title: string) => ({
290
- frontmatter: { type: "LandingPage" as const, slug, title, description: `${title}.` },
291
- body: "",
292
- });
293
- const golf = (frontmatter: Record<string, unknown> = { parent: "younglife" }) => ({
294
- frontmatter: {
295
- type: "Event" as const,
296
- slug: "golf-tournament",
297
- title: "Golf Tournament 2026",
298
- description: "Our annual golf tournament.",
299
- publishedAt: "2026-06-12",
300
- ...frontmatter,
301
- },
302
- body: "Tee off with us.\n\n## Sponsorship\n\nBecome a hole sponsor.",
303
- });
304
- const loader = (
305
- pages: Record<string, ReturnType<typeof landing> | ReturnType<typeof golf>>,
306
- ) => jest.fn(async (type: string, slug: string) => pages[`${type}/${slug}`] ?? null);
307
- const params = (slug: string, detail = "golf-tournament") =>
308
- Promise.resolve({ locale: "en", slug, detail });
309
-
310
- let entryAt: jest.SpyInstance;
311
- beforeEach(() => {
312
- mockNotFound.mockClear();
313
- entryAt = jest.spyOn(listingExtension, "entryAt");
314
- });
315
- afterEach(() => entryAt.mockRestore());
316
-
317
- it("renders the Event with its Event JSON-LD and the program breadcrumb (AC-3)", async () => {
318
- const getMdxSource = loader({
319
- "LandingPage/younglife": landing("younglife", "Young Life"),
320
- "Event/golf-tournament": golf(),
321
- });
322
-
323
- const { container } = render(await DetailPage({ params: params("younglife"), getMdxSource }));
324
-
325
- expect(mockNotFound).not.toHaveBeenCalled();
326
- const ld = JSON.parse(
327
- container.querySelector("script[type='application/ld+json']")?.textContent ?? "{}",
328
- ) as Record<string, unknown>;
329
- const nodes = (ld["@graph"] ?? [ld]) as Array<Record<string, unknown>>;
330
- const event = nodes
331
- .map((node) => node["mainEntity"] as Record<string, unknown> | undefined)
332
- .find((entity) => entity?.["@type"] === "Event");
333
- expect(event).toMatchObject({ name: "Golf Tournament 2026", startDate: "2026-06-12" });
334
- const crumbs = nodes.find((node) => node["@type"] === "BreadcrumbList")?.[
335
- "itemListElement"
336
- ] as Array<Record<string, unknown>>;
337
- expect(crumbs[1]).toMatchObject({ name: "Young Life" });
338
- expect(crumbs[2]?.["item"]).toMatch(/\/younglife\/golf-tournament$/);
339
- expect(entryAt).not.toHaveBeenCalled();
340
-
341
- const metadata = await generateMetadata({ params: params("younglife"), getMdxSource });
342
- expect(metadata.title).toBe("Golf Tournament 2026");
343
- });
344
-
345
- it("offers add-to-calendar for Google, Outlook and Apple (.ics) at the program URL", async () => {
346
- const getMdxSource = loader({
347
- "LandingPage/younglife": landing("younglife", "Young Life"),
348
- "Event/golf-tournament": golf(),
349
- });
350
-
351
- const { container } = render(await DetailPage({ params: params("younglife"), getMdxSource }));
352
-
353
- const href = (id: string) =>
354
- container.querySelector(`[data-testid='add-to-calendar-${id}']`)?.getAttribute("href") ?? "";
355
- expect(href("google")).toMatch(/^https:\/\/calendar\.google\.com\//);
356
- expect(href("outlook")).toMatch(/^https:\/\/outlook\./);
357
- expect(href("apple")).toMatch(/^data:text\/calendar/);
358
- expect(decodeURIComponent(href("apple"))).toContain("/younglife/golf-tournament");
359
- });
360
-
361
- it("supports a #sponsorship anchor from the body heading (AC-4)", async () => {
362
- const getMdxSource = loader({
363
- "LandingPage/younglife": landing("younglife", "Young Life"),
364
- "Event/golf-tournament": golf(),
365
- });
366
-
367
- const { container } = render(await DetailPage({ params: params("younglife"), getMdxSource }));
368
-
369
- const anchors = container.querySelectorAll("#sponsorship");
370
- expect(anchors).toHaveLength(1);
371
- expect(anchors[0]?.tagName).toBe("H2");
372
- expect(anchors[0]?.textContent).toBe("Sponsorship");
373
- });
374
-
375
- it("serves it only under the program it names (AC-5)", async () => {
376
- const cases: Array<[string, ReturnType<typeof loader>]> = [
377
- [
378
- "other",
379
- loader({
380
- "LandingPage/other": landing("other", "Other"),
381
- "LandingPage/younglife": landing("younglife", "Young Life"),
382
- "Event/golf-tournament": golf(),
383
- }),
384
- ],
385
- ["younglife", loader({ "Event/golf-tournament": golf() })],
386
- [
387
- "younglife",
388
- loader({
389
- "LandingPage/younglife": landing("younglife", "Young Life"),
390
- "Event/golf-tournament": golf({}),
391
- }),
392
- ],
393
- ];
394
- for (const [slug, getMdxSource] of cases) {
395
- mockNotFound.mockClear();
396
- await expect(DetailPage({ params: params(slug), getMdxSource })).rejects.toThrow(
397
- "NEXT_NOT_FOUND",
398
- );
399
- expect(mockNotFound).toHaveBeenCalledTimes(1);
400
- }
401
- });
402
- });
@@ -1,143 +0,0 @@
1
- // Two-segment URLs: the Free /meet/<slug> placeholder detail pages (#6897
2
- // D2), an Event under a program (#10552), and a listicle directory's entry
3
- // pages (#7521).
4
- //
5
- // The meet hub: BookCall content served at /meet/<detail> by Next.js
6
- // static-segment precedence: wherever apps/web/app/[locale]/meet/ exists (the
7
- // scheduling module), that directory resolves every /meet/* URL first and this
8
- // route never runs. On a keyless scaffold, this route serves the four Free
9
- // placeholder detail pages. Unknown detail slug → notFound() (renderPage's own
10
- // detail-route branch: no translationsNamespace is passed, so a null source
11
- // 404s rather than rendering an empty-state placeholder — the same contract
12
- // `[slug]/page.tsx` documents).
13
- //
14
- // A program's event: `/<program>/<event>` serves the Event MDX `<event>` when
15
- // its frontmatter `parent` is `<program>` and `/<program>` is a LandingPage —
16
- // before the listing extension, so an event URL costs no listing read. Any
17
- // other combination falls through. A `parent` that names a static top-level
18
- // route directory (`events`, `services`, …) or `meet` is unreachable here:
19
- // Next.js serves the static directory first (spec 10552 § 5.3).
20
- //
21
- // Every other hub: `/<landingPage>/<entry>` for a listicle whose landing page
22
- // is a generic one-segment page (`/tools` → `[slug]/page.tsx`). The listing
23
- // extension (`lib/listings.tsx`) renders the accepted entry, or the route
24
- // 404s — with no key or no paid package it makes no read at all. The first
25
- // segment is the visitor's to choose, so the extension reads the directory
26
- // only once `/<slug>` is proved a page the `[slug]` route serves (a
27
- // LandingPage or BlogList source); a made-up hub costs no API read
28
- // (SEC-7521-D1). No MDX is read at `/<slug>/<detail>`, so no generic
29
- // two-segment content route exists: BookCall's slug pattern forbids "/", and
30
- // a generic join would also be reachable at a one-segment URL through the
31
- // `[slug]` route — a duplicate-content defect.
32
- //
33
- // Deliberately NO generateStaticParams, for the same reason as `[slug]/page.tsx`:
34
- // the locale layout reads cookies()/headers(), so this segment always renders
35
- // on request.
36
- import type { getMdxSource as defaultGetMdxSource } from "@working-theory/page-renderer";
37
- import {
38
- getMdxSource as loadMdxSource,
39
- renderPage,
40
- renderPageMetadata,
41
- } from "@working-theory/page-renderer";
42
- import type { Metadata } from "next";
43
- import { notFound } from "next/navigation";
44
- import type { ReactElement } from "react";
45
-
46
- import { listingExtension, type HubExists } from "../../../../lib/listings";
47
- import { MEET_PLACEHOLDER_HUB } from "../../../../lib/meet-placeholder";
48
-
49
- /** Whether `/<slug>` is a page the one-segment `[slug]` route would serve. */
50
- function hubPage(
51
- slug: string,
52
- locale: string,
53
- getMdxSource: typeof defaultGetMdxSource = loadMdxSource,
54
- ): HubExists {
55
- return async () =>
56
- (await getMdxSource("LandingPage", slug, locale)) !== null ||
57
- (await getMdxSource("BlogList", slug, locale)) !== null;
58
- }
59
-
60
- /** The Event `detail` when it names `slug` as its program and `/<slug>` is a LandingPage. */
61
- async function programEvent(
62
- slug: string,
63
- detail: string,
64
- locale: string,
65
- getMdxSource: typeof defaultGetMdxSource = loadMdxSource,
66
- ): Promise<Awaited<ReturnType<typeof defaultGetMdxSource>>> {
67
- const source = await getMdxSource("Event", detail, locale);
68
- if (source === null || source.frontmatter.parent !== slug) return null;
69
- return (await getMdxSource("LandingPage", slug, locale)) === null ? null : source;
70
- }
71
-
72
- interface Props {
73
- params: Promise<{ locale: string; slug: string; detail: string }>;
74
- /** Test-only DI override for getMdxSource. Production callers leave undefined. */
75
- getMdxSource?: typeof defaultGetMdxSource;
76
- }
77
-
78
- export async function generateMetadata({
79
- params,
80
- getMdxSource,
81
- }: Pick<Props, "params" | "getMdxSource">): Promise<Metadata> {
82
- const { locale, slug, detail } = await params;
83
- // Mirrors renderPageMetadata's own missing-frontmatter → {} contract: a
84
- // hub with no listing entry is the same "nothing to title" case, not a
85
- // thrown 404 — generateMetadata cannot itself change the response status.
86
- if (slug !== MEET_PLACEHOLDER_HUB) {
87
- if ((await programEvent(slug, detail, locale, getMdxSource)) !== null) {
88
- return renderPageMetadata({
89
- type: "Event",
90
- slug: detail,
91
- locale,
92
- ...(getMdxSource !== undefined && { getMdxSource }),
93
- });
94
- }
95
- return (
96
- (await listingExtension.entryMetadataAt(
97
- `/${slug}/${detail}`,
98
- detail,
99
- locale,
100
- hubPage(slug, locale),
101
- )) ?? {}
102
- );
103
- }
104
- return renderPageMetadata({ type: "BookCall", slug: detail, locale });
105
- }
106
-
107
- export default async function Page({
108
- params,
109
- getMdxSource,
110
- }: Props): Promise<ReactElement> {
111
- const { locale, slug, detail } = await params;
112
- if (slug !== MEET_PLACEHOLDER_HUB) {
113
- const event = await programEvent(slug, detail, locale, getMdxSource);
114
- if (event !== null) {
115
- // A composed Event renders its sections; a prose one its MDX body — the
116
- // rule events/[slug]/page.tsx applies.
117
- const sections = (event.frontmatter as { sections?: unknown[] }).sections;
118
- const composed = Array.isArray(sections) && sections.length > 0;
119
- return renderPage({
120
- type: "Event",
121
- slug: detail,
122
- locale,
123
- ...(composed ? {} : { bodyMode: "mdx-body" as const }),
124
- ...(getMdxSource !== undefined && { getMdxSource }),
125
- });
126
- }
127
- const entry = await listingExtension.entryAt(
128
- `/${slug}/${detail}`,
129
- detail,
130
- locale,
131
- hubPage(slug, locale, getMdxSource),
132
- );
133
- if (entry === null) notFound();
134
- return entry;
135
- }
136
- return renderPage({
137
- type: "BookCall",
138
- slug: detail,
139
- locale,
140
- populatedDescriptionTestId: `${detail}-description`,
141
- ...(getMdxSource !== undefined && { getMdxSource }),
142
- });
143
- }
@@ -1,148 +0,0 @@
1
- /**
2
- * Tests for the generic `[slug]` content route (#5469 D2).
3
- *
4
- * - Populated: getMdxSource returns a LandingPage source → renderPage
5
- * sections mode composes the page (JSON-LD + SectionRenderer), no
6
- * notFound() call, and the frontmatter `schema` override reaches the
7
- * emitted JSON-LD (the escape hatch, proven with a `HowTo` fixture).
8
- * - Unknown slug: getMdxSource returns null → renderPage's own detail-route
9
- * branch (no translationsNamespace passed) calls notFound().
10
- * - Resolution: the route asks the adapter for `LandingPage` first and, only
11
- * when that is null, `BlogList` (the Free /blog teaser — the one list type
12
- * that cannot own a route directory, since the docs-blog module owns
13
- * `blog/`). A BlogList source renders through renderPage with its own type,
14
- * so the JSON-LD is the BlogList builder's `Blog`.
15
- */
16
- import React from "react";
17
- import { render } from "@testing-library/react";
18
-
19
- jest.mock("next/navigation", () => ({
20
- __esModule: true,
21
- notFound: jest.fn(() => {
22
- throw new Error("NEXT_NOT_FOUND");
23
- }),
24
- }));
25
-
26
- jest.mock("@working-theory/ui", () => ({
27
- // #7789: renderPage's fallback page head renders inside the section Container.
28
- Container: ({ children }: { children?: React.ReactNode }) =>
29
- React.createElement("div", null, children),
30
- Heading: ({
31
- children,
32
- level,
33
- }: {
34
- children: React.ReactNode;
35
- level: number;
36
- }): React.ReactElement =>
37
- React.createElement(`h${level}`, null, children),
38
- SectionRenderer: ({ sections }: { sections: unknown[] }) =>
39
- React.createElement("div", {
40
- "data-testid": "section-renderer",
41
- "data-section-count": String(sections.length),
42
- }),
43
- }));
44
-
45
- import { notFound } from "next/navigation";
46
- import SlugPage from "../page";
47
-
48
- // #10704 — a fixture suite: its content is shaped for the mdx source, whatever the site serves from.
49
- process.env.CONTENT_ADAPTER = "mdx";
50
-
51
- const mockNotFound = notFound as jest.MockedFunction<typeof notFound>;
52
-
53
- function makeSource(slug: string, schema?: Record<string, unknown>) {
54
- return {
55
- frontmatter: {
56
- type: "LandingPage" as const,
57
- slug,
58
- title: `Title for ${slug}`,
59
- description: `Description for ${slug}`,
60
- ...(schema !== undefined && { schema }),
61
- sections: [
62
- {
63
- id: "hero",
64
- type: "hero" as const,
65
- data: { headline: `Title for ${slug}` },
66
- },
67
- ],
68
- },
69
- body: "",
70
- };
71
- }
72
-
73
- describe("[slug] — the generic content route (LandingPage, then BlogList)", () => {
74
- beforeEach(() => {
75
- mockNotFound.mockClear();
76
- });
77
-
78
- it("resolves the slug against LandingPage and renders through renderPage sections mode", async () => {
79
- const getMdxSource = jest.fn().mockResolvedValue(makeSource("how-it-works"));
80
-
81
- const element = await SlugPage({
82
- params: Promise.resolve({ locale: "en", slug: "how-it-works" }),
83
- getMdxSource,
84
- });
85
- const { container } = render(element);
86
-
87
- expect(getMdxSource).toHaveBeenCalledWith("LandingPage", "how-it-works", "en");
88
- expect(container.querySelector("[data-testid='section-renderer']")).not.toBeNull();
89
- expect(container.querySelector("script[type='application/ld+json']")).not.toBeNull();
90
- expect(mockNotFound).not.toHaveBeenCalled();
91
- });
92
-
93
- it("emits the frontmatter `schema` override in the JSON-LD (the HowTo escape hatch)", async () => {
94
- const getMdxSource = jest
95
- .fn()
96
- .mockResolvedValue(makeSource("how-it-works", { "@type": "HowTo" }));
97
-
98
- const element = await SlugPage({
99
- params: Promise.resolve({ locale: "en", slug: "how-it-works" }),
100
- getMdxSource,
101
- });
102
- const { container } = render(element);
103
-
104
- const script = container.querySelector("script[type='application/ld+json']");
105
- expect(script).not.toBeNull();
106
- expect(script?.textContent ?? "").toContain('"HowTo"');
107
- });
108
-
109
- it("falls back to BlogList when no LandingPage source exists (the Free /blog teaser)", async () => {
110
- const blog = {
111
- frontmatter: {
112
- type: "BlogList" as const,
113
- slug: "blog",
114
- title: "Blog",
115
- description: "This template does not include a blog.",
116
- sections: [{ id: "hero", type: "hero" as const, data: { headline: "Blog" } }],
117
- },
118
- body: "",
119
- };
120
- const getMdxSource = jest
121
- .fn()
122
- .mockImplementation(async (type: string) => (type === "BlogList" ? blog : null));
123
-
124
- const element = await SlugPage({
125
- params: Promise.resolve({ locale: "en", slug: "blog" }),
126
- getMdxSource,
127
- });
128
- const { container } = render(element);
129
-
130
- expect(getMdxSource).toHaveBeenNthCalledWith(1, "LandingPage", "blog", "en");
131
- expect(getMdxSource).toHaveBeenNthCalledWith(2, "BlogList", "blog", "en");
132
- const script = container.querySelector("script[type='application/ld+json']");
133
- expect(script?.textContent ?? "").toContain('"@type":"Blog"');
134
- expect(mockNotFound).not.toHaveBeenCalled();
135
- });
136
-
137
- it("calls notFound() for a slug with neither a LandingPage nor a BlogList source", async () => {
138
- const getMdxSource = jest.fn().mockResolvedValue(null);
139
-
140
- await expect(
141
- SlugPage({
142
- params: Promise.resolve({ locale: "en", slug: "not-a-page" }),
143
- getMdxSource,
144
- }),
145
- ).rejects.toThrow("NEXT_NOT_FOUND");
146
- expect(mockNotFound).toHaveBeenCalledTimes(1);
147
- });
148
- });