create-ailk 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -2
- package/component-catalog.json +44 -6
- package/component-catalog.md +6 -5
- package/dist/add-module.js +16 -1
- package/dist/add-route.d.ts +7 -2
- package/dist/add-route.js +28 -13
- package/dist/cli.js +52 -0
- package/dist/declined-routes.d.ts +13 -0
- package/dist/declined-routes.js +74 -0
- package/dist/derive-architecture.d.ts +0 -6
- package/dist/derive-architecture.js +9 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/language-import.d.ts +93 -0
- package/dist/language-import.js +270 -43
- package/dist/lib/import-mdx.js +1 -1
- package/dist/lib/scaffold-render-sweep.d.ts +6 -3
- package/dist/lib/scaffold-render-sweep.js +8 -4
- package/dist/migrate-content.d.ts +6 -2
- package/dist/migrate-content.js +62 -5
- package/dist/module-architecture.js +139 -103
- package/dist/paid-sections.d.ts +13 -0
- package/dist/paid-sections.js +35 -5
- package/dist/programmatic.js +6 -16
- package/dist/remove-module.js +67 -0
- package/dist/routes.d.ts +103 -0
- package/dist/routes.js +708 -0
- package/dist/site-manifest.js +1 -1
- package/dist/site-roster.d.ts +2 -1
- package/dist/site-roster.js +30 -8
- package/dist/spoke-checkout.d.ts +28 -27
- package/dist/spoke-checkout.js +71 -102
- package/dist/surfaces.d.ts +18 -0
- package/dist/surfaces.js +47 -282
- package/dist/sync-routes.d.ts +28 -1
- package/dist/sync-routes.js +144 -11
- package/dist/template-record.d.ts +11 -0
- package/dist/template-record.js +18 -0
- package/dist/topology.d.ts +15 -1
- package/dist/topology.js +20 -4
- package/dist/update.d.ts +31 -2
- package/dist/update.js +627 -99
- package/package.json +3 -3
- package/templates/README.md +1 -1
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/CLAUDE.md +62 -20
- package/templates/apps/web/account.config.tsx +101 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
- package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
- package/templates/apps/web/app/[locale]/layout.tsx +45 -28
- package/templates/apps/web/app/apple-icon.tsx +72 -0
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
- package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
- package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
- package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
- package/templates/apps/web/app/og/route.tsx +155 -72
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
- package/templates/apps/web/i18n/request.ts +44 -1
- package/templates/apps/web/jest.config.cjs +13 -1
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
- package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
- package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
- package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
- package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
- package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
- package/templates/apps/web/lib/listings.tsx +2 -2
- package/templates/apps/web/lib/nav-label-keys.ts +16 -2
- package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
- package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
- package/templates/apps/web/lib/profile-back-link.ts +105 -32
- package/templates/apps/web/lib/served-pages.ts +95 -0
- package/templates/apps/web/lib/site-brand.tsx +3 -5
- package/templates/apps/web/messages/en.json +8 -684
- package/templates/apps/web/middleware.ts +3 -1
- package/templates/apps/web/next.config.mjs +27 -0
- package/templates/apps/web/package.json +1 -0
- package/templates/customizations.yaml +9 -0
- package/templates/package.json +3 -1
- package/templates/tools/lint-architecture.ts +164 -11
- package/versions.json +48 -47
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
- package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
- package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
- package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
- package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
- package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
- package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
- package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
- package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
- package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
- package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
- package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
- package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
- package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
- package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
- package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
- package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
- package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
- package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
- package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
- package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
- package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
- package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
- package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
- package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
- package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
- package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
- package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
- package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
- package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
- package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
- package/templates/apps/web/lib/account-config.ts +0 -678
- package/templates/apps/web/lib/checkout-config.ts +0 -16
- package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
- package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
|
@@ -1,95 +1,182 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tests for the
|
|
2
|
+
* Tests for the bare header's back arrow (operator handoff 2026-11-09,
|
|
3
|
+
* superseding #7744 D7's people-slide rule).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* The arrow goes to the page's served parent, walking up past any ancestor
|
|
6
|
+
* the site does not serve, and home past the top; its label names the
|
|
7
|
+
* destination. Covers parent, skip-to-grandparent, top-level, locale prefix,
|
|
8
|
+
* the absent-header fail-safe, the label sources and the nav walk. The slide
|
|
9
|
+
* return itself is `@working-theory/ui`'s deck-return.ts (its own suite);
|
|
10
|
+
* the last block here pins how the two compose.
|
|
8
11
|
*/
|
|
9
12
|
|
|
13
|
+
import { deckReturnHref } from "@working-theory/ui/chrome";
|
|
14
|
+
|
|
10
15
|
import {
|
|
11
16
|
backLinkHref,
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
backLinkName,
|
|
18
|
+
navLabelsByPath,
|
|
19
|
+
servedParent,
|
|
14
20
|
} from "../profile-back-link";
|
|
15
21
|
|
|
16
|
-
const LOCALES = ["en", "
|
|
22
|
+
const LOCALES = ["en", "es"];
|
|
23
|
+
const SERVED = new Set(["/meet", "/about", "/blog", "/blog/series", "/team"]);
|
|
24
|
+
const served = (path: string): boolean => SERVED.has(path);
|
|
25
|
+
|
|
26
|
+
function href(pathname: string | null | undefined, homePath = "/"): string {
|
|
27
|
+
return backLinkHref({ pathname, homePath, locales: LOCALES, served });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe("backLinkHref — the served parent", () => {
|
|
31
|
+
it.each([
|
|
32
|
+
["/meet/discovery", "/meet"],
|
|
33
|
+
["/blog/series/post", "/blog/series"],
|
|
34
|
+
["/about/wendi-henry", "/about"],
|
|
35
|
+
["/team/first-member", "/team"],
|
|
36
|
+
["/meet/discovery/", "/meet"],
|
|
37
|
+
["/meet/discovery?ref=x#top", "/meet"],
|
|
38
|
+
])("%s → %s", (pathname, expected) => {
|
|
39
|
+
expect(href(pathname)).toBe(expected);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("keeps the locale prefix: /es/meet/discovery → /es/meet", () => {
|
|
43
|
+
expect(href("/es/meet/discovery", "/es")).toBe("/es/meet");
|
|
44
|
+
});
|
|
17
45
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
46
|
+
it("skips a parent the site does not serve and walks up to the grandparent", () => {
|
|
47
|
+
expect(href("/blog/archive/2026/post")).toBe("/blog");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("goes home when no ancestor below the home is served", () => {
|
|
51
|
+
expect(href("/case-studies/acme/details")).toBe("/");
|
|
52
|
+
expect(href("/es/case-studies/acme/details", "/es")).toBe("/es");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it.each(["/about", "/meet", "/privacy", "/es/about"])(
|
|
56
|
+
"a top-level page (%s) still goes home",
|
|
21
57
|
(pathname) => {
|
|
22
|
-
expect(
|
|
58
|
+
expect(href(pathname, pathname.startsWith("/es") ? "/es" : "/")).toBe(
|
|
59
|
+
pathname.startsWith("/es") ? "/es" : "/",
|
|
60
|
+
);
|
|
23
61
|
},
|
|
24
62
|
);
|
|
25
63
|
|
|
26
|
-
it
|
|
27
|
-
"/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"/team/a/b",
|
|
31
|
-
"/teams/x",
|
|
32
|
-
"/about",
|
|
33
|
-
"/",
|
|
34
|
-
"",
|
|
35
|
-
])("is false for %s", (pathname) => {
|
|
36
|
-
expect(isTeamProfilePath(pathname, LOCALES)).toBe(false);
|
|
64
|
+
it("treats a prefix that is not an enabled locale as the first segment", () => {
|
|
65
|
+
expect(backLinkHref({ pathname: "/xx/meet", homePath: "/", locales: ["en"], served })).toBe(
|
|
66
|
+
"/",
|
|
67
|
+
);
|
|
37
68
|
});
|
|
38
69
|
|
|
39
|
-
it("
|
|
40
|
-
expect(
|
|
70
|
+
it("goes home for an absent pathname", () => {
|
|
71
|
+
expect(href(null)).toBe("/");
|
|
72
|
+
expect(href(undefined)).toBe("/");
|
|
73
|
+
expect(href("")).toBe("/");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("never asks about the home itself", () => {
|
|
77
|
+
const asked: string[] = [];
|
|
78
|
+
servedParent({
|
|
79
|
+
pathname: "/a/b/c",
|
|
80
|
+
locales: LOCALES,
|
|
81
|
+
served: (p) => {
|
|
82
|
+
asked.push(p);
|
|
83
|
+
return false;
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
expect(asked).toEqual(["/a/b", "/a"]);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe("backLinkName — the destination named in the label", () => {
|
|
91
|
+
const titles = new Map([
|
|
92
|
+
["/meet", "Book a meeting with Sam"],
|
|
93
|
+
["/blog/series", "The series"],
|
|
94
|
+
["/about", ""],
|
|
95
|
+
]);
|
|
96
|
+
const navLabels = new Map([["/meet", "Meet"]]);
|
|
97
|
+
|
|
98
|
+
it("prefers the parent's nav label: /meet → Meet", () => {
|
|
99
|
+
expect(backLinkName("/meet", { navLabels, titles })).toBe("Meet");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("falls back to the parent page's title", () => {
|
|
103
|
+
expect(backLinkName("/blog/series", { navLabels, titles })).toBe("The series");
|
|
41
104
|
});
|
|
42
105
|
|
|
43
|
-
it("
|
|
44
|
-
expect(
|
|
45
|
-
expect(
|
|
106
|
+
it("falls back to the last segment in words when neither names it", () => {
|
|
107
|
+
expect(backLinkName("/about", { navLabels, titles })).toBe("About");
|
|
108
|
+
expect(backLinkName("/case-studies", { navLabels: new Map(), titles: new Map() })).toBe(
|
|
109
|
+
"Case studies",
|
|
110
|
+
);
|
|
46
111
|
});
|
|
47
112
|
});
|
|
48
113
|
|
|
49
|
-
describe("
|
|
50
|
-
it("
|
|
51
|
-
|
|
114
|
+
describe("navLabelsByPath", () => {
|
|
115
|
+
it("collects every { labelKey, path } at any depth, first entry winning", () => {
|
|
116
|
+
const labels = navLabelsByPath(
|
|
117
|
+
[
|
|
118
|
+
[
|
|
119
|
+
{ labelKey: "product", flyout: { groups: [{ items: [{ labelKey: "f1", path: "/features/one" }] }] } },
|
|
120
|
+
{ labelKey: "meet", path: "/meet" },
|
|
121
|
+
],
|
|
122
|
+
[{ headingKey: "h", items: [{ labelKey: "other", path: "/meet" }, { labelKey: "faq", path: "/faq" }] }],
|
|
123
|
+
],
|
|
124
|
+
(key) => key.toUpperCase(),
|
|
125
|
+
);
|
|
126
|
+
expect([...labels]).toEqual([
|
|
127
|
+
["/features/one", "F1"],
|
|
128
|
+
["/meet", "MEET"],
|
|
129
|
+
["/faq", "FAQ"],
|
|
130
|
+
]);
|
|
52
131
|
});
|
|
132
|
+
});
|
|
53
133
|
|
|
54
|
-
|
|
134
|
+
// The done-when, end to end: the server href computed here, then the
|
|
135
|
+
// client-side slide return NavBackLink applies on top of it.
|
|
136
|
+
describe("the arrow a visitor gets", () => {
|
|
137
|
+
function arrow(input: { pathname: string; referrer: string; record: object | null }): string {
|
|
138
|
+
const serverHref = href(input.pathname);
|
|
139
|
+
return (
|
|
140
|
+
deckReturnHref({
|
|
141
|
+
backHref: serverHref,
|
|
142
|
+
record: input.record ? JSON.stringify(input.record) : null,
|
|
143
|
+
referrer: input.referrer,
|
|
144
|
+
href: `http://localhost${input.pathname}`,
|
|
145
|
+
}) ?? serverHref
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
it("/about/wendi-henry opened from the human-ai-team slide → /#slide-human-ai-team", () => {
|
|
55
150
|
expect(
|
|
56
|
-
|
|
57
|
-
pathname: "/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
locales: LOCALES,
|
|
151
|
+
arrow({
|
|
152
|
+
pathname: "/about/wendi-henry",
|
|
153
|
+
referrer: "http://localhost/",
|
|
154
|
+
record: { anchor: "slide-human-ai-team", from: "/", to: "/about/wendi-henry" },
|
|
61
155
|
}),
|
|
62
|
-
).toBe("/#slide-
|
|
156
|
+
).toBe("/#slide-human-ai-team");
|
|
63
157
|
});
|
|
64
158
|
|
|
65
|
-
it("
|
|
159
|
+
it("a post opened from the principles slide → /#slide-principles", () => {
|
|
66
160
|
expect(
|
|
67
|
-
|
|
68
|
-
pathname: "/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
locales: LOCALES,
|
|
161
|
+
arrow({
|
|
162
|
+
pathname: "/blog/a-post",
|
|
163
|
+
referrer: "http://localhost/",
|
|
164
|
+
record: { anchor: "slide-principles", from: "/", to: "/blog/a-post" },
|
|
72
165
|
}),
|
|
73
|
-
).toBe("
|
|
166
|
+
).toBe("/#slide-principles");
|
|
74
167
|
});
|
|
75
168
|
|
|
76
|
-
it
|
|
77
|
-
"returns the home for %s on a deck home",
|
|
78
|
-
(pathname) => {
|
|
79
|
-
expect(
|
|
80
|
-
backLinkHref({ pathname, homePath: "/", home: "deck", locales: LOCALES }),
|
|
81
|
-
).toBe("/");
|
|
82
|
-
},
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
it("returns the home for a profile when the home is not a deck", () => {
|
|
169
|
+
it("the same post opened from /blog → its parent /blog", () => {
|
|
86
170
|
expect(
|
|
87
|
-
|
|
88
|
-
pathname: "/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
locales: LOCALES,
|
|
171
|
+
arrow({
|
|
172
|
+
pathname: "/blog/a-post",
|
|
173
|
+
referrer: "http://localhost/blog",
|
|
174
|
+
record: { anchor: "slide-principles", from: "/", to: "/blog/a-post" },
|
|
92
175
|
}),
|
|
93
|
-
).toBe("/");
|
|
176
|
+
).toBe("/blog");
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it("a direct arrival at /meet/discovery → /meet", () => {
|
|
180
|
+
expect(arrow({ pathname: "/meet/discovery", referrer: "", record: null })).toBe("/meet");
|
|
94
181
|
});
|
|
95
182
|
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the served-pages source the bare back arrow walks up through
|
|
3
|
+
* (operator handoff 2026-11-09): listed content pages with their titles,
|
|
4
|
+
* fixed code-rendered routes of the modules this site carries, and a
|
|
5
|
+
* fail-safe when the adapter throws.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// A module, not a script: its helpers stay out of the global scope.
|
|
9
|
+
export {};
|
|
10
|
+
// Whether this site carries the scheduling module is the site's own generated
|
|
11
|
+
// flag, so the suite asserts against it: the monorepo serves /meet, a
|
|
12
|
+
// scaffold without scheduling does not (release-check matrix rows, 2026-11-10).
|
|
13
|
+
import { SCHEDULING_PAGES } from "../modules.generated";
|
|
14
|
+
|
|
15
|
+
const mockListPages = jest.fn();
|
|
16
|
+
let mockAdapterThrows = false;
|
|
17
|
+
|
|
18
|
+
jest.mock("@working-theory/page-renderer", () => ({
|
|
19
|
+
...jest.requireActual("@working-theory/page-renderer"),
|
|
20
|
+
getContentAdapter: () => {
|
|
21
|
+
if (mockAdapterThrows) throw new Error("no adapter");
|
|
22
|
+
return { listPages: mockListPages };
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
function page(type: string, slug: string, title: string) {
|
|
27
|
+
return { type, slug, title };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function loadServed(locale: string) {
|
|
31
|
+
let servedPages!: typeof import("../served-pages").servedPages;
|
|
32
|
+
jest.isolateModules(() => {
|
|
33
|
+
({ servedPages } = jest.requireActual("../served-pages"));
|
|
34
|
+
});
|
|
35
|
+
return servedPages(locale);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
mockAdapterThrows = false;
|
|
40
|
+
mockListPages.mockReset();
|
|
41
|
+
mockListPages.mockImplementation((type: string) => {
|
|
42
|
+
if (type === "AboutPage")
|
|
43
|
+
return Promise.resolve([page("AboutPage", "about", "About us")]);
|
|
44
|
+
if (type === "ThankYouPage")
|
|
45
|
+
return Promise.resolve([page("ThankYouPage", "contact", "Thanks")]);
|
|
46
|
+
return Promise.resolve([]);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe("servedPages", () => {
|
|
51
|
+
it("lists a content page at its served path with its title", async () => {
|
|
52
|
+
const pages = await loadServed("en");
|
|
53
|
+
expect(pages.get("/about")).toBe("About us");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("leaves out a ThankYouPage, which the sitemap never lists", async () => {
|
|
57
|
+
const pages = await loadServed("en");
|
|
58
|
+
expect([...pages.values()]).not.toContain("Thanks");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("includes /meet, the scheduling module's code-rendered index, with no title", async () => {
|
|
62
|
+
const pages = await loadServed("en");
|
|
63
|
+
expect(pages.get("/meet")).toBe(SCHEDULING_PAGES ? "" : undefined);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("reads the locale it is asked for", async () => {
|
|
67
|
+
await loadServed("es");
|
|
68
|
+
expect(mockListPages).toHaveBeenCalledWith("AboutPage", "es");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("keeps the code-rendered routes when the adapter throws", async () => {
|
|
72
|
+
mockAdapterThrows = true;
|
|
73
|
+
const pages = await loadServed("en");
|
|
74
|
+
expect(pages.has("/meet")).toBe(SCHEDULING_PAGES);
|
|
75
|
+
expect(pages.has("/about")).toBe(false);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -9,9 +9,28 @@
|
|
|
9
9
|
* namespace pass `apps/api`'s same-origin CSRF check (`isOriginAllowed`),
|
|
10
10
|
* which Node's server-side `fetch` cannot satisfy on its own since it never
|
|
11
11
|
* sets `Origin`.
|
|
12
|
+
*
|
|
13
|
+
* On a spoke that signs in through its hub (`SIGN_IN_PROVIDER === "hub"`) it
|
|
14
|
+
* returns the hub credential instead. The provider is the seam's, mocked to
|
|
15
|
+
* the one each case tests — never the site's generated value (#11246).
|
|
12
16
|
*/
|
|
13
17
|
import { forwardedCookieInit } from "../server-api";
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
const mockSeam: { SIGN_IN_PROVIDER: "site" | "hub" } = { SIGN_IN_PROVIDER: "site" };
|
|
20
|
+
// eslint-disable-next-line no-restricted-syntax -- #507: the generated topology seam is per-site; this suite pins the topology it tests (#11246)
|
|
21
|
+
jest.mock("../topology.generated", () => ({
|
|
22
|
+
__esModule: true,
|
|
23
|
+
get SIGN_IN_PROVIDER() {
|
|
24
|
+
return mockSeam.SIGN_IN_PROVIDER;
|
|
25
|
+
},
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
const mockHubSessionInit = jest.fn();
|
|
29
|
+
// eslint-disable-next-line no-restricted-syntax -- #507: hubSessionInit is mocked so the hub branch is asserted without a sealed cookie (#11246)
|
|
30
|
+
jest.mock("../hub-session/session", () => ({
|
|
31
|
+
__esModule: true,
|
|
32
|
+
hubSessionInit: () => mockHubSessionInit(),
|
|
33
|
+
}));
|
|
15
34
|
|
|
16
35
|
const mockCookies = jest.fn();
|
|
17
36
|
const mockHeaders = jest.fn();
|
|
@@ -24,12 +43,13 @@ jest.mock("next/headers", () => ({
|
|
|
24
43
|
|
|
25
44
|
describe("forwardedCookieInit", () => {
|
|
26
45
|
beforeEach(() => {
|
|
46
|
+
mockSeam.SIGN_IN_PROVIDER = "site";
|
|
47
|
+
mockHubSessionInit.mockReset();
|
|
27
48
|
mockCookies.mockReset();
|
|
28
49
|
mockHeaders.mockReset();
|
|
29
50
|
});
|
|
30
51
|
|
|
31
|
-
|
|
32
|
-
(TOPOLOGY === "hub" ? it : it.skip)(
|
|
52
|
+
it(
|
|
33
53
|
"forwards cookie + origin when the incoming request carries an Origin header",
|
|
34
54
|
async () => {
|
|
35
55
|
mockCookies.mockResolvedValue({
|
|
@@ -50,8 +70,7 @@ describe("forwardedCookieInit", () => {
|
|
|
50
70
|
},
|
|
51
71
|
);
|
|
52
72
|
|
|
53
|
-
|
|
54
|
-
(TOPOLOGY === "hub" ? it : it.skip)(
|
|
73
|
+
it(
|
|
55
74
|
"forwards cookie alone — no origin key at all — when Origin is absent",
|
|
56
75
|
async () => {
|
|
57
76
|
mockCookies.mockResolvedValue({
|
|
@@ -67,4 +86,17 @@ describe("forwardedCookieInit", () => {
|
|
|
67
86
|
expect(init.headers).not.toHaveProperty("origin");
|
|
68
87
|
},
|
|
69
88
|
);
|
|
89
|
+
|
|
90
|
+
it("on a spoke that signs in through its hub, returns the hub credential and reads no cookie", async () => {
|
|
91
|
+
mockSeam.SIGN_IN_PROVIDER = "hub";
|
|
92
|
+
mockHubSessionInit.mockResolvedValue({
|
|
93
|
+
headers: { authorization: "Bearer hub-token" },
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const init = await forwardedCookieInit();
|
|
97
|
+
|
|
98
|
+
expect(init).toEqual({ headers: { authorization: "Bearer hub-token" } });
|
|
99
|
+
expect(mockCookies).not.toHaveBeenCalled();
|
|
100
|
+
expect(mockHeaders).not.toHaveBeenCalled();
|
|
101
|
+
});
|
|
70
102
|
});
|
|
@@ -438,8 +438,13 @@ const CHECKOUT_PAGE_MARKER = "Standard spoke checkout page (#8748)";
|
|
|
438
438
|
// record), so its updated copy of this test must still exempt them.
|
|
439
439
|
const LEGACY_CHECKOUT_PAGE_MARKER = "GENERATED by create-ailk (#7838)";
|
|
440
440
|
const CHECKOUT_PAGE_NOINDEX_LINE = "robots: { index: false, follow: false }";
|
|
441
|
+
// #11253 — the two pages ship in `@working-theory/ui-commerce`, and a site's
|
|
442
|
+
// route file is the one `create-ailk routes` generates: it carries neither the
|
|
443
|
+
// marker nor the noindex line (the package's `pages.test.tsx` pins the
|
|
444
|
+
// noindex), so each requirement also accepts the generator's header.
|
|
445
|
+
const GENERATED_CHECKOUT_ROUTE = "// Generated by create-ailk routes from @working-theory/ui-commerce";
|
|
441
446
|
// #8840 D13 — the marker every standard magnet page carries in its header
|
|
442
|
-
// comment (`
|
|
447
|
+
// comment (`packages-paid/ui-signal-collectors/src/pages/flows/[slug]/magnet-page.tsx`), and the
|
|
443
448
|
// renderer it must import. A magnet page renders no `renderPage` call this
|
|
444
449
|
// harness can read, and its landing's JSON-LD comes from the hub's record, so
|
|
445
450
|
// a page carrying both is exempt at ANY route: `create-ailk add-route magnet`
|
|
@@ -515,11 +520,12 @@ const NO_STRUCTURED_DATA_ROUTES: ReadonlyArray<{
|
|
|
515
520
|
reason: "interactive flow engine, API-backed",
|
|
516
521
|
subtree: true,
|
|
517
522
|
},
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
+
{
|
|
524
|
+
route: "meet",
|
|
525
|
+
reason:
|
|
526
|
+
"booking pages ship in @working-theory/ui-scheduling (#11252); its suites check the JSON-LD",
|
|
527
|
+
subtree: true,
|
|
528
|
+
},
|
|
523
529
|
{ route: "private", reason: "private booking index, API-backed and noindex (#8843 D8)" },
|
|
524
530
|
{
|
|
525
531
|
route: "unsubscribe",
|
|
@@ -560,8 +566,8 @@ const NO_STRUCTURED_DATA_ROUTES: ReadonlyArray<{
|
|
|
560
566
|
reason:
|
|
561
567
|
"spoke checkout return page (#8748) — noindex, renders sections only, no JSON-LD",
|
|
562
568
|
requires: [
|
|
563
|
-
[CHECKOUT_PAGE_MARKER, LEGACY_CHECKOUT_PAGE_MARKER],
|
|
564
|
-
CHECKOUT_PAGE_NOINDEX_LINE,
|
|
569
|
+
[CHECKOUT_PAGE_MARKER, LEGACY_CHECKOUT_PAGE_MARKER, GENERATED_CHECKOUT_ROUTE],
|
|
570
|
+
[CHECKOUT_PAGE_NOINDEX_LINE, GENERATED_CHECKOUT_ROUTE],
|
|
565
571
|
],
|
|
566
572
|
},
|
|
567
573
|
{
|
|
@@ -569,8 +575,8 @@ const NO_STRUCTURED_DATA_ROUTES: ReadonlyArray<{
|
|
|
569
575
|
reason:
|
|
570
576
|
"spoke checkout return page (#8748) — noindex, renders sections only, no JSON-LD",
|
|
571
577
|
requires: [
|
|
572
|
-
[CHECKOUT_PAGE_MARKER, LEGACY_CHECKOUT_PAGE_MARKER],
|
|
573
|
-
CHECKOUT_PAGE_NOINDEX_LINE,
|
|
578
|
+
[CHECKOUT_PAGE_MARKER, LEGACY_CHECKOUT_PAGE_MARKER, GENERATED_CHECKOUT_ROUTE],
|
|
579
|
+
[CHECKOUT_PAGE_NOINDEX_LINE, GENERATED_CHECKOUT_ROUTE],
|
|
574
580
|
],
|
|
575
581
|
},
|
|
576
582
|
];
|
|
@@ -941,9 +947,9 @@ describe("structured data — a hub's own page is not rendered at its detail rou
|
|
|
941
947
|
//
|
|
942
948
|
// Proof that the two conditional entries above key on the FILE, not the
|
|
943
949
|
// route alone, and that every pre-existing entry is unaffected. The
|
|
944
|
-
// monorepo's own
|
|
945
|
-
//
|
|
946
|
-
// every PR.
|
|
950
|
+
// monorepo's own checkout routes are generated route files (#11253), so the
|
|
951
|
+
// route walk above meets only that shape — these cases are what exercise D1's
|
|
952
|
+
// marker and noindex requirements on every PR.
|
|
947
953
|
|
|
948
954
|
describe("structured data — exemption(route, src) keys the generated checkout routes on the file (#8513)", () => {
|
|
949
955
|
const GENERATED_SRC = `// The checkout thank-you page — ${CHECKOUT_PAGE_MARKER}.\nexport async function generateMetadata() {\n return { ${CHECKOUT_PAGE_NOINDEX_LINE} };\n}\n`;
|
|
@@ -972,6 +978,13 @@ describe("structured data — exemption(route, src) keys the generated checkout
|
|
|
972
978
|
expect(exemption("checkout/unavailable", legacy)).toContain("noindex");
|
|
973
979
|
});
|
|
974
980
|
|
|
981
|
+
it("exempts the route file create-ailk routes generates from @working-theory/ui-commerce (#11253)", () => {
|
|
982
|
+
const generated = `// oss: false\n${GENERATED_CHECKOUT_ROUTE} 0.24.0 — do not edit.\nexport default async function Route() {}\n`;
|
|
983
|
+
expect(exemption("checkout/thank-you", generated)).toContain("noindex");
|
|
984
|
+
expect(exemption("checkout/unavailable", generated)).toContain("noindex");
|
|
985
|
+
expect(exemption("checkout/thank-you", generated.replace("ui-commerce", "ui-scheduling"))).toBeUndefined();
|
|
986
|
+
});
|
|
987
|
+
|
|
975
988
|
it("does not exempt a neighboring checkout route or an unrelated route", () => {
|
|
976
989
|
expect(exemption("checkout/other", GENERATED_SRC)).toBeUndefined();
|
|
977
990
|
expect(exemption("about", GENERATED_SRC)).toBeUndefined();
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
* switch: `./listings-config.ts` is its one reader
|
|
26
26
|
* (`NEXT_PUBLIC_AILK_LISTING_SITE_KEY`, falling back to
|
|
27
27
|
* `AILK_LISTING_PUBLIC_KEY`, #7872 D8). The package is
|
|
28
|
-
* reached the way `
|
|
29
|
-
* `loadUiSignalCollectors()` in the generated paid-sections registry (#7536),
|
|
28
|
+
* reached the way `i18n/request.ts` reaches each page package's catalog:
|
|
29
|
+
* through `loadUiSignalCollectors()` in the generated paid-sections registry (#7536),
|
|
30
30
|
* a bundled `import()` where the site carries the package and a stub that
|
|
31
31
|
* answers `null` where it does not, so a keyless build resolves no paid
|
|
32
32
|
* package.
|
|
@@ -62,13 +62,27 @@ export function collectNavLabelKeys(
|
|
|
62
62
|
return keys;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Whether an ICU message has an argument: a `{` outside a quoted literal. ICU
|
|
67
|
+
* quotes only from an apostrophe that comes before a special character
|
|
68
|
+
* (`{ } # |`), and `''` is a literal apostrophe — so `Don't miss {name}` has
|
|
69
|
+
* an argument and `'{Feature 1}'` does not.
|
|
70
|
+
*/
|
|
71
|
+
function hasIcuArgument(message: string): boolean {
|
|
72
|
+
return message.replace(/''/g, "").replace(/'[{}#|][^']*'?/g, "").includes("{");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The string keys of a message catalog's `nav` namespace — labels only: a
|
|
77
|
+
* message with an ICU argument (`"Back to {name}"`) needs values, so it is
|
|
78
|
+
* never resolved bare as a label.
|
|
79
|
+
*/
|
|
66
80
|
export function navMessageKeys(catalog: unknown): string[] {
|
|
67
81
|
if (typeof catalog !== "object" || catalog === null) return [];
|
|
68
82
|
const nav = (catalog as Record<string, unknown>)["nav"];
|
|
69
83
|
if (typeof nav !== "object" || nav === null) return [];
|
|
70
84
|
return Object.entries(nav)
|
|
71
|
-
.filter(([, value]) => typeof value === "string")
|
|
85
|
+
.filter(([, value]) => typeof value === "string" && !hasIcuArgument(value))
|
|
72
86
|
.map(([key]) => key);
|
|
73
87
|
}
|
|
74
88
|
|
|
@@ -9,14 +9,43 @@
|
|
|
9
9
|
* package is a type error here.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* `@working-theory/ui-commerce`: the checkout and purchase pages' message
|
|
14
|
+
* catalog (`checkoutThankYou`, `checkoutUnavailable`, `purchase`), merged
|
|
15
|
+
* under the site's own by `i18n/request.ts` (#11253 D4), and the flows
|
|
16
|
+
* results page's price card `signal-collectors.config.tsx` loads into its
|
|
17
|
+
* `checkout` slot (#11251 D4). The card's props are left open: this base file
|
|
18
|
+
* can name no signal-collectors type, and the card restates the slot's props
|
|
19
|
+
* structurally (`FlowResultsPriceCard.tsx`).
|
|
20
|
+
*/
|
|
13
21
|
export interface UiCommerceContract {
|
|
14
|
-
|
|
22
|
+
commerceMessages(locale: string): Record<string, unknown> | undefined;
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a React component of the slot's props; this file imports nothing, React's types included
|
|
24
|
+
FlowResultsPriceCard: (props: any) => any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* `@working-theory/ui-signal-collectors`: the flows pages' message catalog
|
|
29
|
+
* (`flow`, `flowVerify`), merged under the site's own by `i18n/request.ts`
|
|
30
|
+
* (#11251 D6).
|
|
31
|
+
*/
|
|
32
|
+
export interface UiSignalCollectorsContract {
|
|
33
|
+
flowsMessages(locale: string): Record<string, unknown> | undefined;
|
|
15
34
|
}
|
|
16
35
|
|
|
17
36
|
/**
|
|
18
|
-
* `@working-theory/ui-
|
|
19
|
-
*
|
|
20
|
-
* `ListingDetail`.
|
|
37
|
+
* `@working-theory/ui-scheduling`: the booking pages' message catalog
|
|
38
|
+
* (`schedule`), merged under the site's own by `i18n/request.ts` (#11252 D4).
|
|
21
39
|
*/
|
|
22
|
-
export
|
|
40
|
+
export interface UiSchedulingContract {
|
|
41
|
+
schedulingMessages(locale: string): Record<string, unknown> | undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* `@working-theory/ui-docs-blog`: the docs and blog pages' message catalog
|
|
46
|
+
* (`docs`, `blog`), merged under the site's own by `i18n/request.ts`
|
|
47
|
+
* (#11254 D4).
|
|
48
|
+
*/
|
|
49
|
+
export interface UiDocsBlogContract {
|
|
50
|
+
docsBlogMessages(locale: string): Record<string, unknown> | undefined;
|
|
51
|
+
}
|
|
@@ -6,9 +6,17 @@
|
|
|
6
6
|
// dynamic import; one this site does not carry is a stub that answers null.
|
|
7
7
|
import type {
|
|
8
8
|
UiCommerceContract,
|
|
9
|
+
UiDocsBlogContract,
|
|
10
|
+
UiSchedulingContract,
|
|
9
11
|
UiSignalCollectorsContract,
|
|
10
12
|
} from "./paid-section-contracts";
|
|
11
13
|
|
|
14
|
+
export const loadUiDocsBlog = async (): Promise<UiDocsBlogContract | null> =>
|
|
15
|
+
null;
|
|
16
|
+
|
|
17
|
+
export const loadUiScheduling =
|
|
18
|
+
async (): Promise<UiSchedulingContract | null> => null;
|
|
19
|
+
|
|
12
20
|
export const loadUiSignalCollectors =
|
|
13
21
|
async (): Promise<UiSignalCollectorsContract | null> => null;
|
|
14
22
|
|