create-ailk 0.46.3 → 0.46.4

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.
@@ -18,7 +18,8 @@
18
18
  * `parseLookupKey` accepts — plus, for a bundled plan, `?with=` and the
19
19
  * required product's key (#10028 D9); no href is built from any other
20
20
  * field (D5) — except a contact's Stripe URL (#12193 D2, the contract's
21
- * one stated exception), by `contactLink`'s rule.
21
+ * one stated exception) and a plan's footnote link (#12243, the same
22
+ * exception extended), both by `contactLink`'s rule.
22
23
  * - §3.7 — `yearly` reads as annual and `once` as one-time at render, never
23
24
  * in the key (D2).
24
25
  *
@@ -39,6 +40,14 @@
39
40
  * point) is one level card whose levels are its points: each level's amount,
40
41
  * label and checkout link come from its Price, everything else from the
41
42
  * product (`offeringPointProducts`). A product is named by any of its slugs.
43
+ *
44
+ * #12243 — a plan's `footnote` and its link ride its card, and a level card
45
+ * takes its first level's (a card field, never a level's). `siteOrigin` makes a
46
+ * same-origin link an internal path; without it every link is external.
47
+ *
48
+ * #12246 — `offeringsPlanColumns` resolves a comparison table's plan columns
49
+ * from the same shown set: each slug's name, price, checkout link and
50
+ * Recommended flag, from the card `planCard` / `bundleCard` builds for it.
42
51
  */
43
52
  import {
44
53
  PRICING_SEGMENT_LEVELS_MAX,
@@ -48,7 +57,9 @@ import {
48
57
  offeringPointProducts,
49
58
  offeringPricePoints,
50
59
  parseLookupKey,
60
+ planColumnSlugs,
51
61
  lookupKeyPeriodSchema,
62
+ type PlanColumnOffering,
52
63
  workspaceShownSetSchema,
53
64
  type LookupKeyPeriod,
54
65
  type OfferPrice,
@@ -56,6 +67,7 @@ import {
56
67
  type OfferingsPrice,
57
68
  type OfferingsProduct,
58
69
  type PageSection,
70
+ type PriceParts,
59
71
  } from "@working-theory/validation";
60
72
 
61
73
  /** The period words, read by name from their one home (#8876 AC-9). */
@@ -66,23 +78,33 @@ type PricingSectionData = Extract<PageSection, { type: "pricing" }>["data"];
66
78
  // #12193 D9 — `offerPrices` (`OfferPrice`, the contribution's shape) is a
67
79
  // render-time field, never in the stored section schema, so no author or agent
68
80
  // can declare one.
81
+ // #12242 D1 — `priceParts` (`PriceParts`) is render-time too: a side's amount
82
+ // and unit as two elements, beside the unchanged `price` phrases.
69
83
  type PricingPlanLevel = NonNullable<PricingSectionData["plans"][number]["levels"]>[number] & {
70
84
  offerPrices?: OfferPrice[];
85
+ priceParts?: PriceParts;
71
86
  };
72
- /** The schema's plan card plus the render-time `offerPrices`, on it and its levels. */
87
+ /**
88
+ * The schema's plan card plus the render-time `offerPrices` and `priceParts`,
89
+ * on it and its levels, and the render-time `images` (#12241 D8): the
90
+ * product's Stripe images, the wide layout's side slot when the page types none.
91
+ */
73
92
  type PricingPlanCard = Omit<PricingSectionData["plans"][number], "levels"> & {
74
93
  levels?: PricingPlanLevel[];
75
94
  offerPrices?: OfferPrice[];
95
+ priceParts?: PriceParts;
96
+ images?: Array<{ src: string; alt: string }>;
76
97
  };
98
+ /** A bound section's yearly-line and strike choices (#12242 D4, D5). */
99
+ interface CardOptions {
100
+ annualLine?: "billed" | "savings" | "none" | undefined;
101
+ strikeMonthly?: boolean | undefined;
102
+ }
77
103
  /** A bound section's level card, as the page writes it (#12174 D6). */
78
104
  export type OfferingsLevelGroup = NonNullable<PricingSectionData["offeringGroups"]>[number];
79
- /** `AddonCard` ignores `key`; it is carried so a tile names its `{plan}` too. */
80
- type PricingAddonTile = NonNullable<PricingSectionData["addons"]>[number] & {
81
- key: string;
82
- };
83
105
 
84
106
  export interface OfferingsPricingLabels {
85
- /** The CTA label on every card and tile whose product sets none of its own. */
107
+ /** The CTA label on every card whose product sets none of its own. */
86
108
  cta: string;
87
109
  /** The recommended plan's pill and the recommended add-on's eyebrow. */
88
110
  recommended: string;
@@ -98,6 +120,15 @@ export interface OfferingsPricingLabels {
98
120
  billedYearly(amount: string): string;
99
121
  /** A contact card's price when it has no display price (#12193 D5 rule 7). */
100
122
  custom: string;
123
+ /** The period words inside a card's unit (#12242 D2): "/mo", "/yr". */
124
+ perMonth: string;
125
+ perYear: string;
126
+ /** The one site pattern joining a period word and a unit label (#12242 AC-9). */
127
+ unitWithLabel(period: string, label: string): string;
128
+ /** The yearly line as a savings percentage (#12242 D4). */
129
+ savings(percent: string): string;
130
+ /** The screen-reader sentence beside a struck monthly price (#12242 D5). */
131
+ regularPrice(regular: string, current: string): string;
101
132
  }
102
133
 
103
134
  export interface OfferingsPricing {
@@ -315,6 +346,7 @@ function bundleCard(
315
346
  highlighted: boolean,
316
347
  locale: string,
317
348
  labels: OfferingsPricingLabels,
349
+ siteOrigin: string | undefined,
318
350
  ): PricingPlanCard | null {
319
351
  const once = priceFor(product, PERIOD.once);
320
352
  const monthly = priceFor(required, PERIOD.monthly);
@@ -353,6 +385,7 @@ function bundleCard(
353
385
  const annualHref =
354
386
  monthly && yearly && offeringsBundleHref(once.lookupKey, yearly.lookupKey);
355
387
  if (annualHref) card.annualCtaHref = annualHref;
388
+ Object.assign(card, footnoteOf(product, siteOrigin));
356
389
  if (highlighted) {
357
390
  card.highlighted = true;
358
391
  card.highlightStyle = "pill";
@@ -361,11 +394,38 @@ function bundleCard(
361
394
  return card;
362
395
  }
363
396
 
397
+ /**
398
+ * One product's own card: its bundle card when it `requires` a product of
399
+ * `offerings` (none when that product is missing or has several price points,
400
+ * its recurring Price being ambiguous — #12210 D6 rule 8), else `planCard`.
401
+ * The plans fragment and a comparison table's plan columns (#12246 D3) both
402
+ * build a card here.
403
+ */
404
+ function ownCard(
405
+ product: OfferingsProduct,
406
+ offerings: readonly OfferingsProduct[],
407
+ highlighted: boolean,
408
+ locale: string,
409
+ labels: OfferingsPricingLabels,
410
+ siteOrigin: string | undefined,
411
+ cardOptions: CardOptions = {},
412
+ ): PricingPlanCard | null {
413
+ if (product.requires === undefined)
414
+ return planCard(product, highlighted, locale, labels, siteOrigin, cardOptions);
415
+ const named = new Set([product.requires]);
416
+ const required = offerings.find((o) => namedIn(o, named));
417
+ return required && offeringPointProducts(required).length === 1
418
+ ? bundleCard(product, required, highlighted, locale, labels, siteOrigin)
419
+ : null;
420
+ }
421
+
364
422
  function planCard(
365
423
  product: OfferingsProduct,
366
424
  highlighted: boolean,
367
425
  locale: string,
368
426
  labels: OfferingsPricingLabels,
427
+ siteOrigin: string | undefined,
428
+ options: CardOptions = {},
369
429
  ): PricingPlanCard | null {
370
430
  const shown = shownPrice(product);
371
431
  const href = shown ? offeringsCheckoutHref(shown.lookupKey) : null;
@@ -379,17 +439,34 @@ function planCard(
379
439
  // Beside a monthly Price, annual mode shows the yearly Price per month, so
380
440
  // the two modes compare in one unit (#12139 D1), in whole currency units
381
441
  // (#12193 D8); its exact total goes in a note.
442
+ // #12242 D1 — the same amounts as two elements: the amount, and the period
443
+ // word joined to the Stripe unit label by the site's one pattern.
444
+ const noun = product.unitLabel ? stripFormatCharacters(product.unitLabel) : "";
445
+ const unitOf = (period: string) => (noun ? labels.unitWithLabel(period, noun) : period);
446
+ const priceParts: PriceParts = {};
447
+ const monthlyAmount = monthly && formatMinorUnits(monthly.amount, monthly.currency, locale);
448
+ if (monthlyAmount) priceParts.monthly = { amount: monthlyAmount, unit: unitOf(labels.perMonth) };
382
449
  if (yearly) {
383
450
  const unit = 10 ** currencyExponent(yearly.currency);
451
+ const perMonth = Math.round(yearly.amount / 12 / unit) * unit;
452
+ const perMonthAmount = formatMinorUnits(perMonth, yearly.currency, locale);
384
453
  price.annual = monthly
385
- ? labels.monthly(
386
- formatMinorUnits(
387
- Math.round(yearly.amount / 12 / unit) * unit,
388
- yearly.currency,
389
- locale,
390
- ),
391
- )
454
+ ? labels.monthly(perMonthAmount)
392
455
  : phrase(yearly, locale, labels);
456
+ priceParts.annual = monthly
457
+ ? { amount: perMonthAmount, unit: unitOf(labels.perMonth) }
458
+ : { amount: formatMinorUnits(yearly.amount, yearly.currency, locale), unit: unitOf(labels.perYear) };
459
+ // #12242 D5 — the standard monthly price struck beside a lower per-month one.
460
+ if (
461
+ options.strikeMonthly === true &&
462
+ monthly &&
463
+ monthlyAmount &&
464
+ monthly.currency === yearly.currency &&
465
+ perMonth < monthly.amount
466
+ ) {
467
+ priceParts.annual.was = monthlyAmount;
468
+ priceParts.annual.wasLabel = labels.regularPrice(monthlyAmount, perMonthAmount);
469
+ }
393
470
  }
394
471
  if (once && !monthly && !yearly) price.custom = phrase(once, locale, labels);
395
472
 
@@ -401,16 +478,26 @@ function planCard(
401
478
  cta: { label: ctaLabel(product, labels), href },
402
479
  offerPrices: offerPricesOf([monthly, yearly, once]),
403
480
  };
481
+ if (priceParts.monthly || priceParts.annual) card.priceParts = priceParts;
404
482
  const description =
405
483
  product.description && stripFormatCharacters(product.description, true);
406
484
  if (description) card.description = description;
407
485
  if (product.unitLabel)
408
486
  card.priceUnit = stripFormatCharacters(product.unitLabel);
409
487
  if (product.note) card.priceSubhead = stripFormatCharacters(product.note);
410
- if (monthly && yearly)
411
- card.annualPriceNote = labels.billedYearly(
412
- formatMinorUnits(yearly.amount, yearly.currency, locale),
413
- );
488
+ // #12242 D4 — the yearly line: billed (the default), a savings percentage
489
+ // worked out from the two Stripe prices, or none.
490
+ if (monthly && yearly) {
491
+ if (options.annualLine === "savings") {
492
+ const percent = Math.round((1 - yearly.amount / (12 * monthly.amount)) * 100);
493
+ if (monthly.currency === yearly.currency && percent >= 1)
494
+ card.annualPriceNote = labels.savings(String(percent));
495
+ } else if (options.annualLine !== "none") {
496
+ card.annualPriceNote = labels.billedYearly(
497
+ formatMinorUnits(yearly.amount, yearly.currency, locale),
498
+ );
499
+ }
500
+ }
414
501
  // A deposit plan's footnote (#10030 D10), in its one-time Price's currency;
415
502
  // it takes the footnote over a terms note (the rarer field).
416
503
  if (product.deposit !== undefined && once)
@@ -425,6 +512,10 @@ function planCard(
425
512
  const annualHref =
426
513
  monthly && yearly && offeringsCheckoutHref(yearly.lookupKey);
427
514
  if (annualHref) card.annualCtaHref = annualHref;
515
+ Object.assign(card, footnoteOf(product, siteOrigin));
516
+ // #12241 D8 — the product's Stripe images (the normalizer keeps them only
517
+ // under `ailk_images: on`), each described by the card's title.
518
+ if (product.images) card.images = product.images.map((src) => ({ src, alt: card.name }));
428
519
  if (highlighted) {
429
520
  card.highlighted = true;
430
521
  card.highlightStyle = "pill";
@@ -461,6 +552,7 @@ function splitBlocks(
461
552
  priceFootnote: _priceFootnote,
462
553
  priceFootnoteAnnualOnly: _priceFootnoteAnnualOnly,
463
554
  offerPrices: _offerPrices,
555
+ priceParts: _priceParts,
464
556
  ...shared
465
557
  } = card;
466
558
  // Each block publishes only the Price it sells (#12193 D9).
@@ -488,6 +580,15 @@ function splitBlocks(
488
580
  ];
489
581
  }
490
582
 
583
+ /** Whether `cards` need the billing toggle: a card or level priced both monthly and annually (#12174 D6). */
584
+ function needsToggle(cards: PricingPlanCard[]): boolean {
585
+ return cards.some((card) =>
586
+ [card, ...(card.levels ?? [])].some(
587
+ (shown) => shown.price.monthly !== undefined && shown.price.annual !== undefined,
588
+ ),
589
+ );
590
+ }
591
+
491
592
  /**
492
593
  * The plans fragment in `layout` (#12140 D3): the cards as built, framed for
493
594
  * the layout that renders them. Absent, today's toggle fragment. `product` is
@@ -507,23 +608,17 @@ function plansFragment(
507
608
  variant: "three-tiers-with-toggle",
508
609
  cardLayout: "centered",
509
610
  // #12174 D6 — a level priced both ways turns it on too.
510
- billingToggle: cards.some((card) =>
511
- [card, ...(card.levels ?? [])].some(
512
- (shown) =>
513
- shown.price.monthly !== undefined &&
514
- shown.price.annual !== undefined,
515
- ),
516
- ),
611
+ billingToggle: needsToggle(cards),
517
612
  plans: cards,
518
613
  };
519
614
  // These variants show monthly prices only, so they take no toggle.
520
- case "with-comparison-table":
521
615
  case "two-tiers-with-extra-tier":
522
616
  case "band-hero":
523
617
  return { variant: layout, cardLayout: "centered", plans: cards };
524
- // The variant renders one plan and has no card layout.
618
+ // The variant renders one plan and has no card layout; since #12241 D5
619
+ // its card follows the toggle, as the toggle layout's do.
525
620
  case "single-price-with-details":
526
- return { variant: layout, plans: cards.slice(0, 1) };
621
+ return { variant: layout, billingToggle: needsToggle(cards.slice(0, 1)), plans: cards.slice(0, 1) };
527
622
  case "features-and-plans": {
528
623
  // A level card (#12174 D6) is never split: `product` is undefined then.
529
624
  const split =
@@ -552,6 +647,7 @@ function levelOf(card: PricingPlanCard): Omit<PricingPlanLevel, "label" | "key">
552
647
  };
553
648
  if (card.description !== undefined) level.description = card.description;
554
649
  if (card.offerPrices !== undefined) level.offerPrices = card.offerPrices;
650
+ if (card.priceParts !== undefined) level.priceParts = card.priceParts;
555
651
  if (card.priceUnit !== undefined) level.priceUnit = card.priceUnit;
556
652
  if (card.priceSubhead !== undefined) level.priceSubhead = card.priceSubhead;
557
653
  if (card.annualPriceNote !== undefined)
@@ -585,6 +681,8 @@ function levelCards(
585
681
  planProducts: OfferingsProduct[],
586
682
  locale: string,
587
683
  labels: OfferingsPricingLabels,
684
+ siteOrigin: string | undefined,
685
+ cardOptions: CardOptions,
588
686
  ): PricingPlanCard[] {
589
687
  // #12210 D6 rule 5 — a level names one slug, so one price point.
590
688
  const byPlan = new Map(
@@ -600,18 +698,27 @@ function levelCards(
600
698
  // is highlighted (#12210 D12).
601
699
  const recommendedId = grouped.find((p) => p.recommended)?.productId;
602
700
  return groups.flatMap((group) => {
603
- const levels: PricingPlanLevel[] = group.levels.flatMap((level) => {
701
+ const built = group.levels.flatMap((level) => {
604
702
  const product = byPlan.get(level.plan);
605
- const card = product && planCard(product, false, locale, labels);
703
+ const card = product && planCard(product, false, locale, labels, siteOrigin, cardOptions);
606
704
  if (!card) return [];
607
705
  const { description: _description, ...fields } = levelOf(card);
608
- return [{ label: level.label, key: product.plan, ...fields, ...helperOf(product) }];
706
+ return [{ card, level: { label: level.label, key: product.plan, ...fields, ...helperOf(product) } }];
609
707
  });
708
+ const levels: PricingPlanLevel[] = built.map((entry) => entry.level);
610
709
  const first = levels[0];
611
710
  if (!first) return [];
612
711
  // #12209 D5 — `helper` is level-only, so the card's own fields leave it out.
613
712
  const { label: _label, key: _key, helper: _helper, ...shown } = first;
614
- const card: PricingPlanCard = { key: group.key, name: group.name, ...shown, levels };
713
+ // #12243 — the footnote is a card field: the first level's product's.
714
+ const card: PricingPlanCard = {
715
+ key: group.key,
716
+ name: group.name,
717
+ ...shown,
718
+ ...cardFootnote(built[0]?.card),
719
+ ...cardImages(built[0]?.card, group.name),
720
+ levels,
721
+ };
615
722
  if (group.description !== undefined) card.description = group.description;
616
723
  // #12209 D2 — the group's control rides its card to the section.
617
724
  if (group.levelSwitchControl !== undefined) card.levelSwitchControl = group.levelSwitchControl;
@@ -624,36 +731,27 @@ function levelCards(
624
731
  });
625
732
  }
626
733
 
627
- function addonTile(
734
+ /**
735
+ * An add-on's card (#12241 D3): its plan card — description, both prices,
736
+ * unit, note and checkout links — plus its eyebrow, the seller's
737
+ * `ailk_eyebrow`, which on the recommended add-on is the Recommended label.
738
+ * Never highlighted, so the pill, the filled button and `?plan=` stay
739
+ * plans-only.
740
+ */
741
+ function addonCard(
628
742
  product: OfferingsProduct,
629
- highlighted: boolean,
743
+ recommended: boolean,
630
744
  locale: string,
631
745
  labels: OfferingsPricingLabels,
632
- ): PricingAddonTile | null {
633
- const shown = shownPrice(product);
634
- const href = shown && offeringsCheckoutHref(shown.lookupKey);
635
- if (!shown || !href) return null;
636
-
637
- const tile: PricingAddonTile = {
638
- key: product.plan,
639
- name: titleOf(product),
640
- price: phrase(shown, locale, labels),
641
- features: features(product),
642
- cta: { label: ctaLabel(product, labels), href },
643
- };
644
- if (product.unitLabel)
645
- tile.qualifier = stripFormatCharacters(product.unitLabel);
646
- // #12103 D5 — the seller's eyebrow and note; the recommended add-on's
647
- // eyebrow stays the Recommended label, the one place a tile shows it.
648
- const eyebrow = product.eyebrow && stripFormatCharacters(product.eyebrow);
649
- if (eyebrow) tile.eyebrow = eyebrow;
650
- const note = product.note && stripFormatCharacters(product.note);
651
- if (note) tile.note = note;
652
- if (highlighted) {
653
- tile.eyebrow = labels.recommended;
654
- tile.checkTone = "primary";
655
- }
656
- return tile;
746
+ siteOrigin: string | undefined,
747
+ ): PricingPlanCard | null {
748
+ const card = planCard(product, false, locale, labels, siteOrigin);
749
+ if (!card) return null;
750
+ const eyebrow = recommended
751
+ ? labels.recommended
752
+ : product.eyebrow && stripFormatCharacters(product.eyebrow);
753
+ if (eyebrow) card.eyebrow = eyebrow;
754
+ return card;
657
755
  }
658
756
 
659
757
  /**
@@ -684,6 +782,38 @@ function contactLink(
684
782
  return { href: url.href, external: true };
685
783
  }
686
784
 
785
+ /**
786
+ * A plan's card footnote (#12243), its format characters stripped, and its
787
+ * link through `contactLink` — the contact URL's rule, so a same-origin URL is
788
+ * an internal path, another origin's the full URL; a link `contactLink` gives
789
+ * none for is dropped and the footnote kept as text alone.
790
+ */
791
+ function footnoteOf(
792
+ product: Pick<OfferingsProduct, "footnote" | "footnoteLink">,
793
+ siteOrigin: string | undefined,
794
+ ): Pick<PricingPlanCard, "footnote" | "footnoteLink"> {
795
+ if (product.footnote === undefined) return {};
796
+ const footnote = stripFormatCharacters(product.footnote);
797
+ const { footnoteLink } = product;
798
+ const link = footnoteLink && contactLink(footnoteLink.url, siteOrigin);
799
+ return footnoteLink && link
800
+ ? { footnote, footnoteLink: { label: stripFormatCharacters(footnoteLink.label), href: link.href } }
801
+ : { footnote };
802
+ }
803
+
804
+ /** `card`'s footnote and its link, for the level card it leads (#12243 — a card field, never a level's). */
805
+ function cardFootnote(card: PricingPlanCard | undefined): Pick<PricingPlanCard, "footnote" | "footnoteLink"> {
806
+ return {
807
+ ...(card?.footnote !== undefined && { footnote: card.footnote }),
808
+ ...(card?.footnoteLink !== undefined && { footnoteLink: card.footnoteLink }),
809
+ };
810
+ }
811
+
812
+ /** `card`'s Stripe images for the level card it leads, described by that card's `title` (#12241 D8 — a card field, never a level's). */
813
+ function cardImages(card: PricingPlanCard | undefined, title: string): Pick<PricingPlanCard, "images"> {
814
+ return card?.images ? { images: card.images.map(({ src }) => ({ src, alt: title })) } : {};
815
+ }
816
+
687
817
  /** A plan contact's card (#12193 D5 rule 7): no Price, so no `Offer` and never highlighted. */
688
818
  function contactCard(
689
819
  contact: OfferingsContactProduct,
@@ -702,24 +832,7 @@ function contactCard(
702
832
  };
703
833
  const description = contact.description && stripFormatCharacters(contact.description, true);
704
834
  if (description) card.description = description;
705
- return card;
706
- }
707
-
708
- /** An add-on contact's tile (#12193 AC-7): its display price, label and link. */
709
- function contactTile(
710
- contact: OfferingsContactProduct,
711
- siteOrigin: string | undefined,
712
- labels: OfferingsPricingLabels,
713
- ): PricingAddonTile | null {
714
- const link = contactLink(contact.url, siteOrigin);
715
- if (!link) return null;
716
- return {
717
- key: contact.plan,
718
- name: titleOf(contact),
719
- price: contact.priceText ? stripFormatCharacters(contact.priceText) : labels.custom,
720
- features: features(contact),
721
- cta: { label: ctaLabel(contact, labels), ...link },
722
- };
835
+ return Object.assign(card, footnoteOf(contact, siteOrigin));
723
836
  }
724
837
 
725
838
  /** `ailkOrder`, null last. */
@@ -764,9 +877,13 @@ function tierCard(
764
877
  locale: string,
765
878
  labels: OfferingsPricingLabels,
766
879
  levelLimit: number,
880
+ siteOrigin: string | undefined,
881
+ cardOptions: CardOptions,
767
882
  ): PricingPlanCard | null {
768
883
  const title = stripFormatCharacters(name);
769
884
  const levels: PricingPlanLevel[] = [];
885
+ // #12243 — the footnote is a card field: the first level's product's.
886
+ let firstCard: PricingPlanCard | undefined;
770
887
  // A member with price points sends the card to the select, so the tier keeps
771
888
  // up to the select's 20 levels rather than cutting its members at four.
772
889
  const memberLimit = members.some((m) => offeringPointProducts(m).length > 1) ? PRICING_SELECT_LEVELS_MAX : levelLimit;
@@ -777,7 +894,7 @@ function tierCard(
777
894
  .slice(0, PRICING_SELECT_LEVELS_MAX);
778
895
  const hasPoints = entries.some(({ product, point }) => point !== product);
779
896
  for (const { product, point } of entries) {
780
- const card = planCard(point, false, locale, labels);
897
+ const card = planCard(point, false, locale, labels, siteOrigin, cardOptions);
781
898
  const shown = shownPrice(point);
782
899
  if (!card || !shown) continue;
783
900
  const taken = new Set(levels.map((level) => level.label));
@@ -793,17 +910,31 @@ function tierCard(
793
910
  (text): text is string => text !== undefined && text.length > 0 && !taken.has(text),
794
911
  );
795
912
  if (label === undefined) continue;
796
- const detail =
797
- isPoint && label !== pricePhrase && [...pricePhrase].length <= LEVEL_DETAIL_MAX
913
+ // #12241 D6 — a level's detail is its Price's `ailk_detail`: a point's
914
+ // own Price's, a tier level's first of monthly, yearly, once to carry
915
+ // one. Without one a point keeps its price phrase, as before.
916
+ const priceDetail = isPoint
917
+ ? shown.detail
918
+ : [PERIOD.monthly, PERIOD.yearly, PERIOD.once].map((period) => priceFor(point, period)?.detail).find(Boolean);
919
+ const detail = priceDetail
920
+ ? { detail: priceDetail }
921
+ : isPoint && label !== pricePhrase && [...pricePhrase].length <= LEVEL_DETAIL_MAX
798
922
  ? { detail: pricePhrase }
799
923
  : {};
800
924
  levels.push({ label, key: point.plan, ...levelOf(card), ...helperOf(product), ...detail });
925
+ firstCard ??= card;
801
926
  }
802
927
  const first = levels[0];
803
928
  if (!first) return null;
804
929
  // #12209 D3, D5 — `helper` and `detail` are level-only, so the card's own fields leave them out.
805
930
  const { label: _label, helper: _helper, detail: _detail, ...shown } = first;
806
- const card: PricingPlanCard = { ...shown, name: title, ...(levels.length > 1 ? { levels } : {}) };
931
+ const card: PricingPlanCard = {
932
+ ...shown,
933
+ name: title,
934
+ ...cardFootnote(firstCard),
935
+ ...cardImages(firstCard, title),
936
+ ...(levels.length > 1 ? { levels } : {}),
937
+ };
807
938
  // #12210 D6 rule 6 — segments keep four levels (#12209 AC 8).
808
939
  if (hasPoints && levels.length > PRICING_SEGMENT_LEVELS_MAX) card.levelSwitchControl = "select";
809
940
  if (highlighted) {
@@ -912,13 +1043,19 @@ function narrowToPlans(
912
1043
  * `tiers` (#12193 D5, a selecting bound section) groups plain plans sharing a
913
1044
  * Stripe `tier` into one card each (`tierCard`). `collection` maps every shown
914
1045
  * product of that collection in place of `plans`, with its contacts as
915
- * contact cards and tiles, linked by `contactLink` against `siteOrigin`.
1046
+ * contact cards and tiles, linked by `contactLink` against `siteOrigin`, as
1047
+ * every footnote link is (#12243).
916
1048
  * Cards and tiles are ordered by `ailkOrder`. Absent, the cards are built
917
1049
  * exactly as before, and no contact is shown.
918
1050
  *
919
1051
  * With `tiers`, `levelLimit` (#12209 D8) caps a tier card's levels — four
920
1052
  * (the default, segments) or twenty (a select) — and `groupTiers: false`
921
1053
  * (#12209 D11) makes every plan its own card, whatever its tier.
1054
+ *
1055
+ * `contactPlans` (#12238, operator 2026-11-23) is a section's own
1056
+ * `offeringPlans`: a shown contact it names by slug becomes a contact card or
1057
+ * tile, as a collection's does. Read only without `collection`; the page's
1058
+ * `plans` never shows a contact.
922
1059
  */
923
1060
  export function offeringsPricing(
924
1061
  shownSet: unknown,
@@ -934,16 +1071,20 @@ export function offeringsPricing(
934
1071
  levelLimit?: number | undefined;
935
1072
  groupTiers?: boolean | undefined;
936
1073
  siteOrigin?: string | undefined;
1074
+ contactPlans?: readonly string[] | undefined;
1075
+ annualLine?: CardOptions["annualLine"];
1076
+ strikeMonthly?: boolean | undefined;
937
1077
  },
938
1078
  ): OfferingsPricing | null {
939
1079
  const parsed = shownSetSchema.safeParse(shownSet);
940
1080
  if (!parsed.success) return null;
941
1081
  const { state, offerings: shown } = parsed.data;
942
1082
  const { collection, siteOrigin, locale, labels } = options;
943
- const contacts =
944
- collection === undefined
945
- ? []
946
- : (parsed.data.contacts ?? []).filter((c) => inCollection(c.collection, collection));
1083
+ const cardOptions: CardOptions = { annualLine: options.annualLine, strikeMonthly: options.strikeMonthly };
1084
+ const named = new Set(options.contactPlans);
1085
+ const contacts = (parsed.data.contacts ?? []).filter((c) =>
1086
+ collection === undefined ? named.has(c.plan) : inCollection(c.collection, collection),
1087
+ );
947
1088
  if (state !== "current" || (shown.length === 0 && contacts.length === 0)) return null;
948
1089
 
949
1090
  // #10028 D9 — a product some shown plan requires is sold only inside that
@@ -990,25 +1131,20 @@ export function offeringsPricing(
990
1131
  locale,
991
1132
  labels,
992
1133
  options.levelLimit ?? PRICING_SEGMENT_LEVELS_MAX,
1134
+ siteOrigin,
1135
+ cardOptions,
993
1136
  ),
994
1137
  order: p.ailkOrder,
995
1138
  contact: false,
996
1139
  });
997
1140
  continue;
998
1141
  }
999
- const named = p.requires === undefined ? undefined : new Set([p.requires]);
1000
- const required = named && offerings.find((o) => namedIn(o, named));
1001
1142
  // #12210 D6 rules 3, 8 — a multi-point product is one level card of its
1002
- // points; a bundle whose required product has points gives no card, its
1003
- // recurring Price being ambiguous.
1143
+ // points; anything else is its own card (`ownCard`).
1004
1144
  const item =
1005
- p.requires !== undefined
1006
- ? required && offeringPointProducts(required).length === 1
1007
- ? bundleCard(p, required, p.plan === recommendedPlan, locale, labels)
1008
- : null
1009
- : offeringPointProducts(p).length > 1
1010
- ? tierCard(titleOf(p), [p], p.plan === recommendedPlan, locale, labels, 1)
1011
- : planCard(p, p.plan === recommendedPlan, locale, labels);
1145
+ p.requires === undefined && offeringPointProducts(p).length > 1
1146
+ ? tierCard(titleOf(p), [p], p.plan === recommendedPlan, locale, labels, 1, siteOrigin, cardOptions)
1147
+ : ownCard(p, offerings, p.plan === recommendedPlan, locale, labels, siteOrigin, cardOptions);
1012
1148
  placedPlans.push({ item, order: p.ailkOrder, contact: false });
1013
1149
  }
1014
1150
  for (const c of contacts.filter((c) => c.ailkGroup === "plan")) {
@@ -1018,17 +1154,18 @@ export function offeringsPricing(
1018
1154
  const ordered = <T>(placed: Placed<T>[]) =>
1019
1155
  options.tiers ? inOrder(placed) : placed.map((entry) => entry.item);
1020
1156
  const plans = options.levelGroups
1021
- ? levelCards(options.levelGroups, planProducts, locale, labels)
1157
+ ? levelCards(options.levelGroups, planProducts, locale, labels, siteOrigin, cardOptions)
1022
1158
  : ordered(placedPlans).filter(isPresent);
1023
- const addons = ordered<PricingAddonTile | null>([
1159
+ // #12241 D3 — add-ons are cards, an add-on contact a contact card.
1160
+ const addons = ordered<PricingPlanCard | null>([
1024
1161
  ...addonProducts.map((p) => ({
1025
- item: addonTile(p, p.plan === recommendedAddon, locale, labels),
1162
+ item: addonCard(p, p.plan === recommendedAddon, locale, labels, siteOrigin),
1026
1163
  order: p.ailkOrder,
1027
1164
  contact: false,
1028
1165
  })),
1029
1166
  ...contacts
1030
1167
  .filter((c) => c.ailkGroup === "addon")
1031
- .map((c) => ({ item: contactTile(c, siteOrigin, labels), order: c.ailkOrder, contact: true })),
1168
+ .map((c) => ({ item: contactCard(c, siteOrigin, labels), order: c.ailkOrder, contact: true })),
1032
1169
  ]).filter(isPresent);
1033
1170
 
1034
1171
  // Each card is keyed by its product's `{plan}`, so a lone card names its product.
@@ -1043,6 +1180,56 @@ export function offeringsPricing(
1043
1180
  plans.length > 0
1044
1181
  ? plansFragment(plans, options.layout, product, locale, labels)
1045
1182
  : null,
1046
- addons: addons.length > 0 ? { variant: "addons", plans: [], addons } : null,
1183
+ addons:
1184
+ addons.length > 0
1185
+ ? { variant: "addons", billingToggle: needsToggle(addons), plans: addons }
1186
+ : null,
1047
1187
  };
1048
1188
  }
1189
+
1190
+ /**
1191
+ * Each of `slugs` the shown set shows as a plan column (#12246 D3), by slug:
1192
+ * a slug `planColumnSlugs` holds, as the card its point product would get —
1193
+ * `bundleCard` for a product that `requires` one (no column when that bundle
1194
+ * gives no card), else `planCard` (`ownCard`). One column per slug, so a
1195
+ * price point shows its own price. Every string is a card's, so it reaches
1196
+ * markup as React text only (T2), and every link is a card's own checkout
1197
+ * link (T3). Empty for a set that does not parse or is not `current`; never
1198
+ * reads the page's `plans`.
1199
+ */
1200
+ export function offeringsPlanColumns(
1201
+ shownSet: unknown,
1202
+ slugs: Iterable<string>,
1203
+ options: { locale: string; labels: OfferingsPricingLabels },
1204
+ ): Map<string, PlanColumnOffering> {
1205
+ const columns = new Map<string, PlanColumnOffering>();
1206
+ const parsed = shownSetSchema.safeParse(shownSet);
1207
+ if (!parsed.success || parsed.data.state !== "current") return columns;
1208
+ const shown = parsed.data.offerings;
1209
+ const shownSlugs = planColumnSlugs(shown);
1210
+ const products = shown.filter((o) => o.ailkGroup === "plan" && namedIn(o, shownSlugs));
1211
+ const recommendedPlan = firstRecommended(products);
1212
+ const { locale, labels } = options;
1213
+ for (const slug of new Set(slugs)) {
1214
+ if (!shownSlugs.has(slug)) continue;
1215
+ const product = products.find((o) => offeringPlanSlugs(o).includes(slug));
1216
+ const point = product && offeringPointProducts(product).find((p) => p.plan === slug);
1217
+ // A column shows the card's name, price and checkout link only, so the
1218
+ // card's footnote link (`siteOrigin`) and display options never matter here.
1219
+ const card = point && ownCard(point, shown, false, locale, labels, undefined);
1220
+ if (!product || !card) continue;
1221
+ const { monthly, annual, custom } = card.price;
1222
+ columns.set(slug, {
1223
+ name: card.name,
1224
+ price: {
1225
+ ...(monthly !== undefined ? { monthly } : {}),
1226
+ ...(annual !== undefined ? { annual } : {}),
1227
+ ...(custom !== undefined ? { custom } : {}),
1228
+ },
1229
+ cta: { label: card.cta.label, href: card.cta.href },
1230
+ ...(card.annualCtaHref !== undefined ? { annualCtaHref: card.annualCtaHref } : {}),
1231
+ ...(product.plan === recommendedPlan ? { recommended: true as const } : {}),
1232
+ });
1233
+ }
1234
+ return columns;
1235
+ }