create-ailk 0.46.1 → 0.46.3
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/component-catalog.json +389 -4
- package/component-catalog.md +9 -7
- package/dist/surfaces.js +1 -1
- package/package.json +3 -3
- package/templates/apps/web/CLAUDE.md +156 -2
- package/templates/apps/web/app/globals.css +12 -0
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +4 -0
- package/templates/apps/web/app/llms.txt/route.ts +22 -0
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +4 -0
- package/templates/apps/web/app/sitemap.xml/route.ts +43 -0
- package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +170 -1
- package/templates/apps/web/lib/__tests__/magnet-addresses.test.ts +406 -0
- package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +822 -4
- package/templates/apps/web/lib/__tests__/pricing-page.test.ts +383 -0
- package/templates/apps/web/lib/__tests__/served-pages.test.ts +44 -0
- package/templates/apps/web/lib/in-page-magnet.ts +86 -9
- package/templates/apps/web/lib/magnet-addresses.ts +317 -0
- package/templates/apps/web/lib/offerings-pricing.ts +477 -40
- package/templates/apps/web/lib/paid-section-contracts.ts +41 -1
- package/templates/apps/web/lib/pricing-page.ts +248 -13
- package/templates/apps/web/lib/served-pages.ts +38 -1
- package/templates/apps/web/messages/en.json +2 -1
- package/templates/apps/web/site-pages.config.tsx +9 -0
- package/versions.json +50 -50
|
@@ -31,14 +31,54 @@ export interface UiCommerceContract {
|
|
|
31
31
|
*/
|
|
32
32
|
export interface UiSignalCollectorsContract {
|
|
33
33
|
flowsMessages(locale: string): Record<string, unknown> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* #12204 D6 — a magnet at an owner-chosen address: `base` is the address,
|
|
36
|
+
* `rest` the child under it (`[]`, `["start"]`, `["verify"]` or
|
|
37
|
+
* `["results", payload]`), rendered as `/flows/<slug>` renders it. The
|
|
38
|
+
* element is left open, as `FlowResultsPriceCard`'s props are.
|
|
39
|
+
*/
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a React element; this file imports nothing, React's types included
|
|
41
|
+
renderMagnetAt(input: MagnetAtInput): Promise<any>;
|
|
42
|
+
/** #12204 D6, D8 — the metadata at an address; the cover's names `canonical`. */
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Next's `Metadata`; this file imports nothing
|
|
44
|
+
magnetMetadataAt(input: Omit<MagnetAtInput, "searchParams"> & { canonical: string }): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* #12205 D5 — a page's `magnet` section: the magnet's title card, whose
|
|
47
|
+
* Start opens its walk over the host page. Its props are left open, as
|
|
48
|
+
* `FlowResultsPriceCard`'s are.
|
|
49
|
+
*/
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a React component; this file imports nothing, React's types included
|
|
51
|
+
MagnetSectionClient: (props: any) => any;
|
|
52
|
+
/**
|
|
53
|
+
* #12205 D5, #12202 D7 — the booking step's calendar a magnet's own walk
|
|
54
|
+
* shows, built on the server for the section's walk; `undefined` when the
|
|
55
|
+
* config has no booking step or the calendar cannot be built.
|
|
56
|
+
*/
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a served FlowConfig in, a React element out; this file imports nothing
|
|
58
|
+
bookingStepElement(config: any): Promise<any>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** #12204 D6 — what the site passes the package's address dispatcher. */
|
|
62
|
+
export interface MagnetAtInput {
|
|
63
|
+
slug: string;
|
|
64
|
+
base: string;
|
|
65
|
+
rest: string[];
|
|
66
|
+
locale: string;
|
|
67
|
+
searchParams: Record<string, string | string[] | undefined>;
|
|
34
68
|
}
|
|
35
69
|
|
|
36
70
|
/**
|
|
37
71
|
* `@working-theory/ui-scheduling`: the booking pages' message catalog
|
|
38
|
-
* (`schedule`), merged under the site's own by `i18n/request.ts` (#11252 D4)
|
|
72
|
+
* (`schedule`), merged under the site's own by `i18n/request.ts` (#11252 D4),
|
|
73
|
+
* and the booker island `signal-collectors.config.tsx` hands a magnet walk's
|
|
74
|
+
* booking step (#12202 D7). The island's props are left open, as the price
|
|
75
|
+
* card's are: this base file names no signal-collectors type, and the island
|
|
76
|
+
* meets the walk's `FlowBookingStepProps` structurally in the site's config.
|
|
39
77
|
*/
|
|
40
78
|
export interface UiSchedulingContract {
|
|
41
79
|
schedulingMessages(locale: string): Record<string, unknown> | undefined;
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a React component of the step's props; this file imports nothing, React's types included
|
|
81
|
+
BookerIsland: (props: any) => any;
|
|
42
82
|
}
|
|
43
83
|
|
|
44
84
|
/**
|
|
@@ -23,6 +23,12 @@
|
|
|
23
23
|
* own `variant` names; `written` keeps it as authored, never linking the
|
|
24
24
|
* Offerings checkout. A page with no `source` anywhere renders as before.
|
|
25
25
|
*
|
|
26
|
+
* A selecting bound section (#12193 D5) — one naming no plans — builds its
|
|
27
|
+
* cards from Stripe: tier cards, and with `offeringCollection` every shown
|
|
28
|
+
* product of that collection, contacts included. `?plan=` and `?billing=`
|
|
29
|
+
* set two render-time fields every pricing section reads (D11), and no
|
|
30
|
+
* authored copy of a render-time field ever reaches the section (D9).
|
|
31
|
+
*
|
|
26
32
|
* Stripe text reaches markup only as React text through `offeringsPricing`,
|
|
27
33
|
* and JSON-LD only through renderPage's serializer (T4).
|
|
28
34
|
*
|
|
@@ -33,15 +39,19 @@ import type { DetailPage } from "@working-theory/site-pages/lib/route-family";
|
|
|
33
39
|
import { contactFormText } from "@working-theory/site-pages/pages/contact/contact-form-text";
|
|
34
40
|
import { ContactFallback } from "@working-theory/ui";
|
|
35
41
|
import {
|
|
42
|
+
PRICING_SELECT_LEVELS_MAX,
|
|
36
43
|
LOOKUP_KEY_PLAN_PATTERN,
|
|
37
44
|
type PageSection,
|
|
38
45
|
} from "@working-theory/validation";
|
|
39
46
|
import { getTranslations } from "next-intl/server";
|
|
40
47
|
import { createElement, type ReactNode } from "react";
|
|
41
48
|
|
|
49
|
+
import { resolveBaseUrl } from "../src/lib/routes";
|
|
50
|
+
|
|
42
51
|
import { browserApiOrigin } from "./api-origin.generated";
|
|
43
52
|
import {
|
|
44
53
|
OFFERINGS_CHECKOUT_PATH,
|
|
54
|
+
collectionPlans,
|
|
45
55
|
offeringsPricing,
|
|
46
56
|
type OfferingsPricing,
|
|
47
57
|
type OfferingsPricingLabels,
|
|
@@ -193,6 +203,7 @@ export async function offeringsCopy(locale: string): Promise<{
|
|
|
193
203
|
"{deposit}",
|
|
194
204
|
() => deposit,
|
|
195
205
|
),
|
|
206
|
+
custom: t("custom"),
|
|
196
207
|
},
|
|
197
208
|
recommendedLabel: t("recommendedForYou"),
|
|
198
209
|
addonsHeadline: t("addonsHeadline"),
|
|
@@ -222,6 +233,14 @@ const AUTHORED_COPY_FIELDS = [
|
|
|
222
233
|
// #12141 D9 — the plan bar's options, so a connected section keeps them.
|
|
223
234
|
"planBar",
|
|
224
235
|
"comparisonPlanBar",
|
|
236
|
+
// #12174 D2 — where a level card's switch sits.
|
|
237
|
+
"levelSwitchPlacement",
|
|
238
|
+
// #12193 D7 — a page turning the billing toggle off.
|
|
239
|
+
"hideBillingToggle",
|
|
240
|
+
// #12209 D12 — the level switch's control, its derived detail and the level heading.
|
|
241
|
+
"levelSwitchControl",
|
|
242
|
+
"levelSwitchDetail",
|
|
243
|
+
"showLevelHeading",
|
|
225
244
|
] as const satisfies readonly (keyof PricingData)[];
|
|
226
245
|
|
|
227
246
|
function authoredCopy(
|
|
@@ -283,10 +302,12 @@ function linksOfferingsCheckout(href: string | undefined): boolean {
|
|
|
283
302
|
|
|
284
303
|
type PricingPlan = PricingData["plans"][number];
|
|
285
304
|
|
|
305
|
+
/** Whether a card, or any of its levels (#12174 D7), links the Offerings checkout. */
|
|
286
306
|
function sellsOfferings(plan: PricingPlan): boolean {
|
|
287
|
-
return (
|
|
288
|
-
|
|
289
|
-
|
|
307
|
+
return [plan, ...(plan.levels ?? [])].some(
|
|
308
|
+
(shown) =>
|
|
309
|
+
linksOfferingsCheckout(shown.cta.href) ||
|
|
310
|
+
linksOfferingsCheckout(shown.annualCtaHref),
|
|
290
311
|
);
|
|
291
312
|
}
|
|
292
313
|
|
|
@@ -376,6 +397,18 @@ function isPlansSection(section: PageSection): section is PricingSection {
|
|
|
376
397
|
return isPricing(section) && section.data.variant !== "addons";
|
|
377
398
|
}
|
|
378
399
|
|
|
400
|
+
/**
|
|
401
|
+
* The Offerings plans a section names: its `offeringPlans`, else the plans of
|
|
402
|
+
* its `offeringGroups`' levels (#12174 D6), else none.
|
|
403
|
+
*/
|
|
404
|
+
function namedPlans(section: PricingSection): string[] | undefined {
|
|
405
|
+
const { offeringPlans, offeringGroups } = section.data;
|
|
406
|
+
return (
|
|
407
|
+
offeringPlans ??
|
|
408
|
+
offeringGroups?.flatMap((group) => group.levels.map((level) => level.plan))
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
|
|
379
412
|
/**
|
|
380
413
|
* Each plan group's Stripe plans fragment (#12103 D2), keyed by its section:
|
|
381
414
|
* `null` when none of the group's plans is shown.
|
|
@@ -394,6 +427,19 @@ export type OfferingsGroups = ReadonlyMap<PricingSection, PricingData | null>;
|
|
|
394
427
|
* its own `offeringPlans` else the page's `plans`: a plans section in the
|
|
395
428
|
* layout its `variant` names, an `addons` section to its add-on tiles. The
|
|
396
429
|
* plans a bound section lists are excluded from the page-level mapping.
|
|
430
|
+
*
|
|
431
|
+
* A bound section's `offeringGroups` (#12174 D6) narrow it to its levels'
|
|
432
|
+
* plans and map them as level cards (`offeringsPricing`'s `levelGroups`);
|
|
433
|
+
* those plans are excluded from the page-level mapping too.
|
|
434
|
+
*
|
|
435
|
+
* A selecting bound section (#12193 D5) — no `offeringPlans` and no
|
|
436
|
+
* `offeringGroups` — maps with `tiers`, its `offeringCollection` as
|
|
437
|
+
* `collection` and the site's origin for its contacts' links; a collection's
|
|
438
|
+
* plans are excluded from the page-level mapping too.
|
|
439
|
+
*
|
|
440
|
+
* A bound section whose `levelSwitchControl` is `select` maps with a level
|
|
441
|
+
* limit of twenty (#12209 D8), and a selecting one with `separateTiers` maps
|
|
442
|
+
* every plan as its own card (#12209 D11).
|
|
397
443
|
*/
|
|
398
444
|
export function offeringsFragments(
|
|
399
445
|
declared: PageSection[],
|
|
@@ -410,9 +456,19 @@ export function offeringsFragments(
|
|
|
410
456
|
isUnbound(s) && isPlansSection(s) && s.data.offeringPlans !== undefined,
|
|
411
457
|
);
|
|
412
458
|
const bound = declared.filter(isBound);
|
|
413
|
-
const exclude = [
|
|
414
|
-
(s) => s
|
|
415
|
-
|
|
459
|
+
const exclude = [
|
|
460
|
+
...[...listed, ...bound].flatMap((s) => namedPlans(s) ?? []),
|
|
461
|
+
...bound.flatMap(({ data }) =>
|
|
462
|
+
data.offeringCollection === undefined ? [] : collectionPlans(shownSet, data.offeringCollection),
|
|
463
|
+
),
|
|
464
|
+
];
|
|
465
|
+
// An unparseable base URL leaves every contact link external, never a throw.
|
|
466
|
+
let siteOrigin: string | undefined;
|
|
467
|
+
try {
|
|
468
|
+
siteOrigin = new URL(resolveBaseUrl()).origin;
|
|
469
|
+
} catch {
|
|
470
|
+
siteOrigin = undefined;
|
|
471
|
+
}
|
|
416
472
|
const groups = new Map<PricingSection, PricingData | null>(
|
|
417
473
|
listed.map((section) => [
|
|
418
474
|
section,
|
|
@@ -424,12 +480,19 @@ export function offeringsFragments(
|
|
|
424
480
|
]),
|
|
425
481
|
);
|
|
426
482
|
for (const section of bound) {
|
|
427
|
-
const { variant,
|
|
483
|
+
const { variant, offeringGroups, offeringCollection, levelSwitchControl, separateTiers } = section.data;
|
|
428
484
|
const addons = variant === "addons";
|
|
485
|
+
const named = namedPlans(section);
|
|
429
486
|
const mapped = offeringsPricing(shownSet, {
|
|
430
487
|
locale,
|
|
431
488
|
labels,
|
|
432
|
-
plans:
|
|
489
|
+
plans: named ?? plans,
|
|
490
|
+
...(offeringGroups ? { levelGroups: offeringGroups } : {}),
|
|
491
|
+
// #12193 D5 — a section that names no plans builds its cards from Stripe.
|
|
492
|
+
...(named === undefined ? { tiers: true, siteOrigin } : {}),
|
|
493
|
+
...(offeringCollection !== undefined ? { collection: offeringCollection } : {}),
|
|
494
|
+
...(levelSwitchControl === "select" ? { levelLimit: PRICING_SELECT_LEVELS_MAX } : {}),
|
|
495
|
+
...(separateTiers === true ? { groupTiers: false } : {}),
|
|
433
496
|
...(variant === "addons"
|
|
434
497
|
? {}
|
|
435
498
|
: { layout: variant ?? "three-tiers-with-toggle" }),
|
|
@@ -445,6 +508,63 @@ export function offeringsFragments(
|
|
|
445
508
|
return { pricing, groups };
|
|
446
509
|
}
|
|
447
510
|
|
|
511
|
+
/** The layouts that render every plan they are given (#12174 D7). */
|
|
512
|
+
const EVERY_PLAN_LAYOUTS: ReadonlySet<PricingData["variant"]> = new Set([
|
|
513
|
+
"three-tiers-with-toggle",
|
|
514
|
+
"with-comparison-table",
|
|
515
|
+
"band-hero",
|
|
516
|
+
] as const);
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* A bound section's `writtenPlans` that go in its grid (#12174 D7): none when
|
|
520
|
+
* its layout renders fewer plans than it is given (a hidden card would still
|
|
521
|
+
* publish an `Offer`), and never one that links the Offerings checkout.
|
|
522
|
+
*/
|
|
523
|
+
function writtenCards(section: PricingSection): PricingPlan[] {
|
|
524
|
+
const { writtenPlans, variant } = section.data;
|
|
525
|
+
if (!writtenPlans || !EVERY_PLAN_LAYOUTS.has(variant ?? "three-tiers-with-toggle"))
|
|
526
|
+
return [];
|
|
527
|
+
return writtenPlans.filter((plan) => !sellsOfferings(plan));
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* `fragment` with `section`'s written cards after its Offerings cards
|
|
532
|
+
* (#12174 D7). With no Offerings card (`fragment` null) the written cards
|
|
533
|
+
* stand alone in the section's layout, so it is not removed while one
|
|
534
|
+
* remains (#12174 decision 6); `null` when there is neither.
|
|
535
|
+
*/
|
|
536
|
+
function withWrittenCards(
|
|
537
|
+
section: PricingSection,
|
|
538
|
+
fragment: PricingData | null,
|
|
539
|
+
): PricingData | null {
|
|
540
|
+
const written = writtenCards(section);
|
|
541
|
+
if (written.length === 0) return fragment;
|
|
542
|
+
const variant = section.data.variant ?? "three-tiers-with-toggle";
|
|
543
|
+
const base: PricingData = fragment ?? {
|
|
544
|
+
variant,
|
|
545
|
+
cardLayout: "centered",
|
|
546
|
+
...(variant === "three-tiers-with-toggle" ? { billingToggle: false } : {}),
|
|
547
|
+
plans: [],
|
|
548
|
+
};
|
|
549
|
+
return { ...base, plans: [...base.plans, ...written] };
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* The key of the card `recommend` names: a card's own key, else the key of
|
|
554
|
+
* the level card one of whose levels sells that plan (#12174 decision 9, the
|
|
555
|
+
* recommender's landing `?plan=<plan>`); `recommend` itself when neither.
|
|
556
|
+
* Only an Offerings section's cards are mapped: a written section and the
|
|
557
|
+
* "as written" states keep #8842's match on a card's own key.
|
|
558
|
+
*/
|
|
559
|
+
function recommendedCard(plans: PricingPlan[], recommend: string): string {
|
|
560
|
+
const wanted = recommend.toLowerCase();
|
|
561
|
+
if (plans.some((card) => card.key?.toLowerCase() === wanted)) return recommend;
|
|
562
|
+
const seller = plans.find((card) =>
|
|
563
|
+
card.levels?.some((level) => level.key?.toLowerCase() === wanted),
|
|
564
|
+
);
|
|
565
|
+
return seller?.key ?? recommend;
|
|
566
|
+
}
|
|
567
|
+
|
|
448
568
|
/** What a bound section keeps from the page beside its copy (#12140 D6). */
|
|
449
569
|
const BOUND_KEPT_FIELDS = [
|
|
450
570
|
"source",
|
|
@@ -466,9 +586,11 @@ const BOUND_KEPT_FIELDS = [
|
|
|
466
586
|
function stripePlansSection(
|
|
467
587
|
slot: PricingSection | undefined,
|
|
468
588
|
fragment: PricingData,
|
|
469
|
-
|
|
589
|
+
named: string | undefined,
|
|
470
590
|
recommendedLabel: string,
|
|
471
591
|
): PricingSection {
|
|
592
|
+
const recommend =
|
|
593
|
+
named === undefined ? undefined : recommendedCard(fragment.plans, named);
|
|
472
594
|
const bound = slot !== undefined && isBound(slot);
|
|
473
595
|
const cardLayout = slot?.data.cardLayout ?? fragment.cardLayout;
|
|
474
596
|
const features = bound
|
|
@@ -595,7 +717,7 @@ export function withOfferings(
|
|
|
595
717
|
} as PricingData,
|
|
596
718
|
});
|
|
597
719
|
} else if (groups?.has(section)) {
|
|
598
|
-
const fragment = groups.get(section);
|
|
720
|
+
const fragment = withWrittenCards(section, groups.get(section) ?? null);
|
|
599
721
|
if (fragment) {
|
|
600
722
|
const group = stripePlansSection(
|
|
601
723
|
section,
|
|
@@ -681,6 +803,105 @@ export function pagePlans(frontmatter: unknown): string[] | undefined {
|
|
|
681
803
|
return plans.filter((plan): plan is string => typeof plan === "string");
|
|
682
804
|
}
|
|
683
805
|
|
|
806
|
+
/** The render-time fields an authored section must never carry (#12193 D9, D11). */
|
|
807
|
+
const RENDER_TIME_SECTION_FIELDS = ["selectedPlan", "billingPeriod"] as const;
|
|
808
|
+
|
|
809
|
+
/** `card` without an authored `offerPrices`, on it and its levels (#12193 D9). */
|
|
810
|
+
function withoutOfferPrices<T extends object>(card: T): T {
|
|
811
|
+
const { offerPrices: _o, ...rest } = card as T & { offerPrices?: unknown; levels?: object[] };
|
|
812
|
+
const levels = (rest as { levels?: object[] }).levels;
|
|
813
|
+
return (levels ? { ...rest, levels: levels.map((level) => withoutOfferPrices(level)) } : rest) as T;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/** Whether `card`, or a level of it, carries an `offerPrices` key. */
|
|
817
|
+
function carriesOfferPrices(card: object): boolean {
|
|
818
|
+
return "offerPrices" in card || ((card as { levels?: object[] }).levels ?? []).some(carriesOfferPrices);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* The page's sections with every authored render-time field removed (#12193
|
|
823
|
+
* D9, D11): a plan's, level's, written card's or extra tier's `offerPrices`,
|
|
824
|
+
* and a section's `selectedPlan` and `billingPeriod`, so a page author or a
|
|
825
|
+
* content-write agent can never declare a JSON-LD price or a selected level.
|
|
826
|
+
* The input array itself when there is none.
|
|
827
|
+
*/
|
|
828
|
+
function withoutRenderTimeFields(sections: PageSection[]): PageSection[] {
|
|
829
|
+
const authored = (section: PricingSection) => {
|
|
830
|
+
const { plans, writtenPlans, extraTier } = section.data;
|
|
831
|
+
return (
|
|
832
|
+
RENDER_TIME_SECTION_FIELDS.some((field) => field in section.data) ||
|
|
833
|
+
[...plans, ...(writtenPlans ?? []), ...(extraTier ? [extraTier] : [])].some(carriesOfferPrices)
|
|
834
|
+
);
|
|
835
|
+
};
|
|
836
|
+
if (!sections.some((s) => isPricing(s) && authored(s))) return sections;
|
|
837
|
+
return sections.map((section) => {
|
|
838
|
+
if (!isPricing(section) || !authored(section)) return section;
|
|
839
|
+
const { selectedPlan: _p, billingPeriod: _b, ...data } = section.data as PricingData & {
|
|
840
|
+
selectedPlan?: unknown;
|
|
841
|
+
billingPeriod?: unknown;
|
|
842
|
+
};
|
|
843
|
+
return {
|
|
844
|
+
...section,
|
|
845
|
+
data: {
|
|
846
|
+
...data,
|
|
847
|
+
plans: data.plans.map(withoutOfferPrices),
|
|
848
|
+
...(data.writtenPlans ? { writtenPlans: data.writtenPlans.map(withoutOfferPrices) } : {}),
|
|
849
|
+
...(data.extraTier ? { extraTier: withoutOfferPrices(data.extraTier) } : {}),
|
|
850
|
+
},
|
|
851
|
+
};
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/** The billing periods `?billing=` may name (#12193 D11): the toggle's two values. */
|
|
856
|
+
const BILLING_PERIODS = new Set(["monthly", "annual"]);
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* `sections` with the render-time `selectedPlan` and `billingPeriod` on every
|
|
860
|
+
* pricing section (#12193 D11) — `selectedPlan` only for a `{plan}`-grammar
|
|
861
|
+
* `plan`, `billingPeriod` only for `monthly` or `annual` — so the server render
|
|
862
|
+
* opens that level and period. `sections` itself when neither applies.
|
|
863
|
+
*/
|
|
864
|
+
function withSelection(
|
|
865
|
+
sections: PageSection[],
|
|
866
|
+
plan: string | undefined,
|
|
867
|
+
period: string | undefined,
|
|
868
|
+
): PageSection[] {
|
|
869
|
+
const selected = {
|
|
870
|
+
...(plan !== undefined && LOOKUP_KEY_PLAN_PATTERN.test(plan) ? { selectedPlan: plan } : {}),
|
|
871
|
+
...(period !== undefined && BILLING_PERIODS.has(period) ? { billingPeriod: period } : {}),
|
|
872
|
+
};
|
|
873
|
+
if (Object.keys(selected).length === 0) return sections;
|
|
874
|
+
return sections.map((section) =>
|
|
875
|
+
isPricing(section)
|
|
876
|
+
? // Render-time fields the section reads, not authored ones.
|
|
877
|
+
{ ...section, data: { ...section.data, ...selected } as PricingData }
|
|
878
|
+
: section,
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* The hub's `pricingPagesHeading` override (#12213 AC-1): the heading that
|
|
884
|
+
* replaces the `pricingPages.heading` message on the generated `pricing-pages`
|
|
885
|
+
* items section, or `undefined` when unset.
|
|
886
|
+
*/
|
|
887
|
+
export function pricingPagesHeading(frontmatter: unknown): string | undefined {
|
|
888
|
+
if (frontmatter === null || typeof frontmatter !== "object") return undefined;
|
|
889
|
+
const { pricingPagesHeading: value } = frontmatter as {
|
|
890
|
+
pricingPagesHeading?: unknown;
|
|
891
|
+
};
|
|
892
|
+
return typeof value === "string" ? value : undefined;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Whether the hub's generated `pricing-pages` items section is shown (#12213
|
|
897
|
+
* AC-2, AC-3): on by default, off only when `pricingPagesSection` is `false`.
|
|
898
|
+
*/
|
|
899
|
+
export function pricingPagesSectionEnabled(frontmatter: unknown): boolean {
|
|
900
|
+
if (frontmatter === null || typeof frontmatter !== "object") return true;
|
|
901
|
+
const { pricingPagesSection } = frontmatter as { pricingPagesSection?: unknown };
|
|
902
|
+
return pricingPagesSection !== false;
|
|
903
|
+
}
|
|
904
|
+
|
|
684
905
|
/**
|
|
685
906
|
* One Pricing page's sections in its Offerings state (#10044 D5): `/pricing`'s
|
|
686
907
|
* three-state choice with the page's own `plans` passed through.
|
|
@@ -694,17 +915,31 @@ export function pagePlans(frontmatter: unknown): string[] | undefined {
|
|
|
694
915
|
* a page whose only pricing left is written takes the contact email;
|
|
695
916
|
* - anything else → the contact email in their place.
|
|
696
917
|
* On the written states a `source: written` section never links the
|
|
697
|
-
* Offerings checkout (#12140 D2 rule 7).
|
|
918
|
+
* Offerings checkout (#12140 D2 rule 7). On every path the authored
|
|
919
|
+
* render-time fields are removed first and `?plan=` / `?billing=`'s are set
|
|
920
|
+
* last (#12193 D9, D11).
|
|
698
921
|
*/
|
|
699
922
|
export async function pricingSections(
|
|
700
|
-
|
|
923
|
+
authored: PageSection[],
|
|
701
924
|
options: {
|
|
702
925
|
plans: readonly string[] | undefined;
|
|
703
926
|
plan: string | undefined;
|
|
927
|
+
period?: string | undefined;
|
|
704
928
|
locale: string;
|
|
705
929
|
},
|
|
706
930
|
): Promise<PageSection[]> {
|
|
707
|
-
const {
|
|
931
|
+
const { plan, period } = options;
|
|
932
|
+
return withSelection(
|
|
933
|
+
await sectionsFor(withoutRenderTimeFields(authored), options),
|
|
934
|
+
plan,
|
|
935
|
+
period,
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
async function sectionsFor(
|
|
940
|
+
declared: PageSection[],
|
|
941
|
+
{ plans, plan, locale }: { plans: readonly string[] | undefined; plan: string | undefined; locale: string },
|
|
942
|
+
): Promise<PageSection[]> {
|
|
708
943
|
const written = declared.some(isWritten)
|
|
709
944
|
? declared.map((s) => (isWritten(s) ? withoutCheckoutLinks(s) : s))
|
|
710
945
|
: declared;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* title — what the bare header's back arrow walks up through
|
|
4
4
|
* (operator handoff 2026-11-09, `lib/profile-back-link.ts`).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Three sources, each one this app already serves from:
|
|
7
7
|
* 1. Every content page the sitemap lists, at the path it lists it at
|
|
8
8
|
* (`app/sitemap.xml/route.ts`: `listPages` per type, `listedPath` over
|
|
9
9
|
* the site's listing, docs rows and `ThankYouPage` left out). Title =
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
* optional catch-all serves its own index only; a required catch-all,
|
|
18
18
|
* and a route of dynamic segments alone (the content catch-all), serve
|
|
19
19
|
* nothing.
|
|
20
|
+
* 3. Every magnet address the site serves in the locale (#12204 D8,
|
|
21
|
+
* `lib/magnet-addresses.ts`'s `servedAddresses`), at its address. Title =
|
|
22
|
+
* the magnet's title ("" for one the hub does not list).
|
|
20
23
|
* A route with seed content (a `ROUTES` row with a `contentPath`) counts only
|
|
21
24
|
* through source 1, so a scaffold that dropped that surface's content never
|
|
22
25
|
* gets a link to a missing page. The layout adds the nav and footer paths
|
|
@@ -105,6 +108,29 @@ function readSafely(read: () => string[]): string[] {
|
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
|
|
111
|
+
/**
|
|
112
|
+
* The static first segment of every page route the app builds, from the same
|
|
113
|
+
* two sources (#12204 D5 a): what a magnet address may not shadow. No
|
|
114
|
+
* content-shape filter — a seed-content route holds its segment whether or
|
|
115
|
+
* not its content is there. Dynamic and `_private` first segments are left
|
|
116
|
+
* out.
|
|
117
|
+
*/
|
|
118
|
+
export function staticFirstSegments(): string[] {
|
|
119
|
+
const root = process.cwd();
|
|
120
|
+
const routes = new Set([
|
|
121
|
+
...readSafely(() => pageFileRoutes(join(root, "app"))),
|
|
122
|
+
...readSafely(() => manifestRoutes(root)),
|
|
123
|
+
]);
|
|
124
|
+
const firsts = new Set<string>();
|
|
125
|
+
for (const route of routes) {
|
|
126
|
+
const segments = route.split("/").filter(Boolean);
|
|
127
|
+
if (segments[0] === LOCALE_SEGMENT) segments.shift();
|
|
128
|
+
const first = segments[0];
|
|
129
|
+
if (first !== undefined && !isDynamic(first) && !first.startsWith("_")) firsts.add(first);
|
|
130
|
+
}
|
|
131
|
+
return [...firsts];
|
|
132
|
+
}
|
|
133
|
+
|
|
108
134
|
/**
|
|
109
135
|
* The page routes the app builds, as locale-less segments: an optional
|
|
110
136
|
* catch-all's index kept, a required catch-all, a route of dynamic segments
|
|
@@ -171,6 +197,17 @@ async function readServedSet(locale: string): Promise<ServedSet> {
|
|
|
171
197
|
// No adapter: the built page routes alone.
|
|
172
198
|
}
|
|
173
199
|
|
|
200
|
+
try {
|
|
201
|
+
// Loaded on first call: `magnet-addresses` reads this module's
|
|
202
|
+
// `staticFirstSegments`, so a static import would be a cycle.
|
|
203
|
+
const { servedAddresses } = await import("./magnet-addresses");
|
|
204
|
+
for (const item of await servedAddresses(locale)) {
|
|
205
|
+
if (!pages.has(item.path)) pages.set(item.path, item.title);
|
|
206
|
+
}
|
|
207
|
+
} catch {
|
|
208
|
+
// No address table: the other two sources alone.
|
|
209
|
+
}
|
|
210
|
+
|
|
174
211
|
return { pages, dynamic };
|
|
175
212
|
}
|
|
176
213
|
|
|
@@ -142,7 +142,8 @@
|
|
|
142
142
|
"oneTime": "{amount} one-time",
|
|
143
143
|
"billedYearly": "billed {amount} yearly",
|
|
144
144
|
"withRequired": "{plan} + {required}",
|
|
145
|
-
"depositNote": "{deposit} deposit due today; the balance is invoiced."
|
|
145
|
+
"depositNote": "{deposit} deposit due today; the balance is invoiced.",
|
|
146
|
+
"custom": "Custom"
|
|
146
147
|
},
|
|
147
148
|
"purchasePolicy": {
|
|
148
149
|
"heading": "Purchase Policy",
|
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
pagePlans,
|
|
27
27
|
PRICING_HUB_SLUG,
|
|
28
28
|
pricingPageCard,
|
|
29
|
+
pricingPagesHeading,
|
|
30
|
+
pricingPagesSectionEnabled,
|
|
29
31
|
pricingSections,
|
|
30
32
|
pricingSectionSlots,
|
|
31
33
|
} from "./lib/pricing-page";
|
|
@@ -59,6 +61,11 @@ export const site = {
|
|
|
59
61
|
entryAt: async (...args) => (await import("./lib/listings")).listingExtension.entryAt(...args),
|
|
60
62
|
entryMetadataAt: async (...args) => (await import("./lib/listings")).listingExtension.entryMetadataAt(...args),
|
|
61
63
|
},
|
|
64
|
+
// #12204 D6 — loaded on first call, as the listing extension is.
|
|
65
|
+
magnetAddress: {
|
|
66
|
+
pageAt: async (...args) => (await import("./lib/magnet-addresses")).magnetPageAt(...args),
|
|
67
|
+
metadataAt: async (...args) => (await import("./lib/magnet-addresses")).magnetMetadataAt(...args),
|
|
68
|
+
},
|
|
62
69
|
MARKETING_PAGES,
|
|
63
70
|
isShownLookupKey,
|
|
64
71
|
offeringsCheckoutHref,
|
|
@@ -66,6 +73,8 @@ export const site = {
|
|
|
66
73
|
offeringPricingPages,
|
|
67
74
|
pagePlans,
|
|
68
75
|
pricingPageCard,
|
|
76
|
+
pricingPagesHeading,
|
|
77
|
+
pricingPagesSectionEnabled,
|
|
69
78
|
pricingSections,
|
|
70
79
|
pricingSectionSlots,
|
|
71
80
|
PRICING_HUB_SLUG,
|
package/versions.json
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@working-theory/account": "0.
|
|
3
|
-
"@working-theory/admin-ui": "0.
|
|
4
|
-
"@working-theory/aeo": "0.
|
|
5
|
-
"@working-theory/agent-context": "0.
|
|
2
|
+
"@working-theory/account": "0.77.0",
|
|
3
|
+
"@working-theory/admin-ui": "0.77.0",
|
|
4
|
+
"@working-theory/aeo": "0.77.0",
|
|
5
|
+
"@working-theory/agent-context": "0.77.0",
|
|
6
6
|
"@working-theory/agent-contract": "0.1.0",
|
|
7
7
|
"@working-theory/agent-memory": "0.0.0",
|
|
8
8
|
"@working-theory/ai": "0.1.0",
|
|
9
|
-
"@working-theory/analytics": "0.
|
|
10
|
-
"@working-theory/api": "0.
|
|
11
|
-
"@working-theory/api-client": "0.
|
|
12
|
-
"@working-theory/auth": "0.
|
|
9
|
+
"@working-theory/analytics": "0.77.0",
|
|
10
|
+
"@working-theory/api": "0.77.0",
|
|
11
|
+
"@working-theory/api-client": "0.77.0",
|
|
12
|
+
"@working-theory/auth": "0.77.0",
|
|
13
13
|
"@working-theory/cda-filesystem": "0.0.0",
|
|
14
|
-
"@working-theory/cli": "0.
|
|
15
|
-
"@working-theory/common": "0.
|
|
14
|
+
"@working-theory/cli": "0.77.0",
|
|
15
|
+
"@working-theory/common": "0.77.0",
|
|
16
16
|
"@working-theory/consent": "0.1.0",
|
|
17
|
-
"@working-theory/content-adapters": "0.
|
|
18
|
-
"@working-theory/content-projection": "0.
|
|
19
|
-
"@working-theory/email": "0.
|
|
17
|
+
"@working-theory/content-adapters": "0.77.0",
|
|
18
|
+
"@working-theory/content-projection": "0.77.0",
|
|
19
|
+
"@working-theory/email": "0.77.0",
|
|
20
20
|
"@working-theory/env": "0.0.0",
|
|
21
|
-
"@working-theory/eslint-config": "0.
|
|
22
|
-
"@working-theory/fumadocs-schema": "0.
|
|
21
|
+
"@working-theory/eslint-config": "0.77.0",
|
|
22
|
+
"@working-theory/fumadocs-schema": "0.77.0",
|
|
23
23
|
"@working-theory/ids": "0.23.0",
|
|
24
|
-
"@working-theory/jsonld": "0.
|
|
25
|
-
"@working-theory/license": "0.
|
|
26
|
-
"@working-theory/mcp-server": "0.
|
|
27
|
-
"@working-theory/metadata": "0.
|
|
28
|
-
"@working-theory/observability": "0.
|
|
29
|
-
"@working-theory/page-renderer": "0.
|
|
24
|
+
"@working-theory/jsonld": "0.77.0",
|
|
25
|
+
"@working-theory/license": "0.77.0",
|
|
26
|
+
"@working-theory/mcp-server": "0.77.0",
|
|
27
|
+
"@working-theory/metadata": "0.77.0",
|
|
28
|
+
"@working-theory/observability": "0.77.0",
|
|
29
|
+
"@working-theory/page-renderer": "0.77.0",
|
|
30
30
|
"@working-theory/plugin-mcp": "0.1.3",
|
|
31
|
-
"@working-theory/schema": "0.
|
|
32
|
-
"@working-theory/schema-pack-registry": "0.
|
|
33
|
-
"@working-theory/schema-validator": "0.
|
|
34
|
-
"@working-theory/sections-registry": "0.
|
|
35
|
-
"@working-theory/site-config": "0.
|
|
36
|
-
"@working-theory/site-pages": "0.
|
|
37
|
-
"@working-theory/spoke-checkout": "0.7.
|
|
38
|
-
"@working-theory/stripe-client": "0.
|
|
39
|
-
"@working-theory/templates": "0.
|
|
40
|
-
"@working-theory/theme": "0.
|
|
41
|
-
"@working-theory/ui": "0.
|
|
42
|
-
"@working-theory/validation": "0.
|
|
43
|
-
"@working-theory/web-i18n": "0.
|
|
44
|
-
"@working-theory/admin": "0.
|
|
45
|
-
"@working-theory/api-commerce": "0.2.
|
|
46
|
-
"@working-theory/api-content-write": "0.
|
|
47
|
-
"@working-theory/api-hub": "0.
|
|
48
|
-
"@working-theory/api-multi-tenant": "0.5.
|
|
49
|
-
"@working-theory/api-scheduling": "0.6.
|
|
50
|
-
"@working-theory/api-signal-collectors": "0.
|
|
51
|
-
"@working-theory/api-workspace": "0.18.
|
|
31
|
+
"@working-theory/schema": "0.77.0",
|
|
32
|
+
"@working-theory/schema-pack-registry": "0.77.0",
|
|
33
|
+
"@working-theory/schema-validator": "0.77.0",
|
|
34
|
+
"@working-theory/sections-registry": "0.77.0",
|
|
35
|
+
"@working-theory/site-config": "0.77.0",
|
|
36
|
+
"@working-theory/site-pages": "0.77.0",
|
|
37
|
+
"@working-theory/spoke-checkout": "0.7.33",
|
|
38
|
+
"@working-theory/stripe-client": "0.77.0",
|
|
39
|
+
"@working-theory/templates": "0.77.0",
|
|
40
|
+
"@working-theory/theme": "0.77.0",
|
|
41
|
+
"@working-theory/ui": "0.77.0",
|
|
42
|
+
"@working-theory/validation": "0.77.0",
|
|
43
|
+
"@working-theory/web-i18n": "0.77.0",
|
|
44
|
+
"@working-theory/admin": "0.26.1",
|
|
45
|
+
"@working-theory/api-commerce": "0.2.11",
|
|
46
|
+
"@working-theory/api-content-write": "0.17.0",
|
|
47
|
+
"@working-theory/api-hub": "0.9.1",
|
|
48
|
+
"@working-theory/api-multi-tenant": "0.5.3",
|
|
49
|
+
"@working-theory/api-scheduling": "0.6.16",
|
|
50
|
+
"@working-theory/api-signal-collectors": "0.8.0",
|
|
51
|
+
"@working-theory/api-workspace": "0.18.3",
|
|
52
52
|
"@working-theory/billing-client": "0.0.0",
|
|
53
53
|
"@working-theory/branding": "0.0.0",
|
|
54
54
|
"@working-theory/license-client": "0.0.0",
|
|
55
55
|
"@working-theory/license-manifest": "0.0.0",
|
|
56
|
-
"@working-theory/mcp-scheduling": "0.4.
|
|
57
|
-
"@working-theory/mcp-signal-collectors": "0.2.
|
|
58
|
-
"@working-theory/mcp-workspace": "0.16.
|
|
56
|
+
"@working-theory/mcp-scheduling": "0.4.18",
|
|
57
|
+
"@working-theory/mcp-signal-collectors": "0.2.31",
|
|
58
|
+
"@working-theory/mcp-workspace": "0.16.3",
|
|
59
59
|
"@working-theory/partner-session": "0.0.0",
|
|
60
60
|
"@working-theory/preview-protocol": "0.0.0",
|
|
61
|
-
"@working-theory/ui-commerce": "0.
|
|
62
|
-
"@working-theory/ui-docs-blog": "0.
|
|
63
|
-
"@working-theory/ui-scheduling": "0.
|
|
64
|
-
"@working-theory/ui-signal-collectors": "0.
|
|
61
|
+
"@working-theory/ui-commerce": "0.77.0",
|
|
62
|
+
"@working-theory/ui-docs-blog": "0.77.0",
|
|
63
|
+
"@working-theory/ui-scheduling": "0.77.0",
|
|
64
|
+
"@working-theory/ui-signal-collectors": "0.77.0",
|
|
65
65
|
"@working-theory/web": "0.0.0",
|
|
66
66
|
"@working-theory/app-api": "1.0.0",
|
|
67
67
|
"@working-theory/mcp": "0.0.0",
|
|
68
|
-
"@working-theory/database": "0.
|
|
68
|
+
"@working-theory/database": "0.77.0"
|
|
69
69
|
}
|