create-ailk 0.46.0 → 0.46.2
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 +481 -4
- package/component-catalog.md +9 -6
- package/package.json +3 -3
- package/templates/apps/web/CLAUDE.md +56 -1
- package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +390 -1
- package/templates/apps/web/lib/__tests__/pricing-page.test.ts +503 -1
- package/templates/apps/web/lib/offerings-pricing.ts +231 -26
- package/templates/apps/web/lib/pricing-page.ts +332 -22
- package/templates/apps/web/messages/en.json +1 -0
- package/versions.json +50 -50
|
@@ -642,6 +642,57 @@ key), so the page names none. It renders one of three pages:
|
|
|
642
642
|
eyebrow (the recommended add-on keeps the Recommended label); an add-on's
|
|
643
643
|
`ailk_note` is its tile's note line, as a plan's is its `priceSubhead`. Copy
|
|
644
644
|
comes from the `pricingOfferings` namespace.
|
|
645
|
+
- **A section says where its plans come from (#12140).** A `pricing`
|
|
646
|
+
section may set `source: offerings | written`; with no `source` anywhere
|
|
647
|
+
on the page, everything above holds exactly as before. `offerings` binds
|
|
648
|
+
the section to the shown set: it is mapped alone, for its own
|
|
649
|
+
`offeringPlans` else the page's `plans`, in the layout its own `variant`
|
|
650
|
+
names (`offeringsPricing`'s `layout`, one mapping per layout). The toggle
|
|
651
|
+
layout is the default; `with-comparison-table`, `two-tiers-with-extra-tier`
|
|
652
|
+
and `band-hero` get centred cards and no toggle (they show monthly prices
|
|
653
|
+
only); `single-price-with-details` gets the first card alone; an `addons`
|
|
654
|
+
section gets the add-on tiles. In `features-and-plans`, one product with a
|
|
655
|
+
monthly and a yearly Price (and no `requires`) becomes two blocks — the
|
|
656
|
+
monthly one keyed by the plan slug, the yearly one by its lookup key and
|
|
657
|
+
carrying the terms note — each linking its own Price's checkout, and a
|
|
658
|
+
lone product's marketing features fill the left column as title-only rows
|
|
659
|
+
unless the section writes its own `features`. A bound section keeps its
|
|
660
|
+
copy, `source`, band parts and `comparisonGroups` — values matched to the
|
|
661
|
+
cards by plan slug, each cell's `link` dropped — and never an authored
|
|
662
|
+
plan, `extraTier` or cell link; the plans it lists are left out of the
|
|
663
|
+
unbound plans slot. `written` keeps the section's own plans where it
|
|
664
|
+
sits, minus every card, extra tier, add-on tile and comparison-cell link
|
|
665
|
+
that links `/api/offerings/checkout`
|
|
666
|
+
in any URL form (percent-encoded included), and on a connected page takes
|
|
667
|
+
`?plan=` only for a `{plan}`-grammar value (the "as written" states keep
|
|
668
|
+
#8842's rule). The
|
|
669
|
+
plans and add-ons slots are chosen among sections with no `source`, and a
|
|
670
|
+
page that declares one gets no inserted section. A page whose every
|
|
671
|
+
pricing section is written reads no Offerings; on a shown set a page whose
|
|
672
|
+
only pricing left is written takes the contact email, and on the contact
|
|
673
|
+
path written sections give way with the rest. A site whose
|
|
674
|
+
`@working-theory/validation` predates the field strips it and renders the
|
|
675
|
+
section as before, so a seller sets `source` after the site updates.
|
|
676
|
+
- **Level cards and written cards on a bound section (#12174).** A bound
|
|
677
|
+
plans section may set `offeringGroups` in place of `offeringPlans`: each
|
|
678
|
+
group (`key`, `name`, optional `description`, two to four `levels` of
|
|
679
|
+
`{ label, plan }`) becomes one card with a level switch, titled by `name`
|
|
680
|
+
and with its segments labelled by each level's `label` — page content,
|
|
681
|
+
never the Stripe product name or description. A level shows its plan's
|
|
682
|
+
price, note, features and checkout link, as that plan's own card would;
|
|
683
|
+
the card's own fields are its first level's (what the `Offer` reads), a
|
|
684
|
+
level whose plan is not shown is dropped, and a group with none left gives
|
|
685
|
+
no card. The groups' plans are left out of the unbound plans slot, and a
|
|
686
|
+
`?plan=` naming one of them highlights its card. `writtenPlans` (one to
|
|
687
|
+
three written cards) go after the Offerings cards in the same grid — only
|
|
688
|
+
in the toggle, `with-comparison-table` and `band-hero` layouts, which
|
|
689
|
+
render every card — minus any that links `/api/offerings/checkout`, as a
|
|
690
|
+
written section's cards are; when no group yields a card, the written
|
|
691
|
+
cards stand alone and the section stays. `levelSwitchPlacement:
|
|
692
|
+
title-row` moves the switch onto the title's row (default card layout
|
|
693
|
+
only). An unconnected page renders the authored `plans` and reads neither
|
|
694
|
+
field. The schema refuses both fields on a section that is not
|
|
695
|
+
`source: offerings`.
|
|
645
696
|
- **Rollout of the two keys (#12103 D8).** A site's strict shown-set readers
|
|
646
697
|
refuse a product carrying `ctaLabel` or `eyebrow` until they take this
|
|
647
698
|
release, and such a site then shows the contact email in place of its
|
|
@@ -847,7 +898,11 @@ A list page whose frontmatter sets `navOnly: true` (valid on a registry list typ
|
|
|
847
898
|
- Don't reach into `apps/api` or `apps/mcp` from `apps/web`. They're peer apps — talk via HTTP/MCP.
|
|
848
899
|
- Don't commit images to `screenshots/` — only the `.gitkeep` is tracked.
|
|
849
900
|
|
|
850
|
-
Last updated: 2026-11-
|
|
901
|
+
Last updated: 2026-11-22 — § Pricing page: a bound section's `offeringGroups` level cards, its `writtenPlans` and `levelSwitchPlacement` (#12174) — verified against `lib/pricing-page.ts` and `lib/offerings-pricing.ts`.
|
|
902
|
+
|
|
903
|
+
Prior: 2026-11-21 — § Pricing page: a section's `source` — bound sections in the layout their `variant` names, the `features-and-plans` two-block split, the kept comparison grid, written sections, and the 0.74.0 page with no `source` (#12140) — verified against `lib/pricing-page.ts` and `lib/offerings-pricing.ts`.
|
|
904
|
+
|
|
905
|
+
Prior: 2026-11-21 — § Pricing page: a section's `offeringPlans` plan groups, the kept `cardLayout`, the Admin-set Recommended, the `ailk_cta` button label and the add-on's `ailk_eyebrow` and note, and the two keys' rollout order (#12103) — verified against `lib/pricing-page.ts`, `lib/offerings-pricing.ts`, `packages/api/src/services/offerings/catalog.ts` and `packages-paid/api-multi-tenant/src/routes/workspaces/offerings.ts`.
|
|
851
906
|
|
|
852
907
|
Prior: 2026-11-19 — § Site visibility: one rule for Hidden (`lib/site-visibility.ts`) stamps noindex on every middleware response and page, every discovery file hides under STEALTH, `GET /api/site-status` reports the state, and ai-plugin.json is dropped; § A hub-connected site's identity loses the indexing switch (#11978) — verified against `lib/site-visibility.ts`, `middleware.ts`, `app/[locale]/layout.tsx`, `app/api/site-status/route.ts`, `app/{.well-known/mcp.json,openapi.json}/route.ts` and `lib/{mcp-served-tools,site-brand}.ts`.
|
|
853
908
|
|
|
@@ -37,6 +37,7 @@ const LABELS: OfferingsPricingLabels = {
|
|
|
37
37
|
oneTime: (amount) => "O⟪" + amount,
|
|
38
38
|
withRequired: (plan, required) => "W⟪" + plan + "⟫" + required,
|
|
39
39
|
depositNote: (deposit) => "D⟪" + deposit,
|
|
40
|
+
billedYearly: (amount) => "B⟪" + amount,
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
const OPTIONS = { locale: "en-US", labels: LABELS };
|
|
@@ -278,7 +279,8 @@ describe("offeringsPricing — one card per Product (AC-1)", () => {
|
|
|
278
279
|
describe("offeringsPricing — periods, the switch and the fields (AC-2)", () => {
|
|
279
280
|
it("maps yearly to annual and lands unit, note and terms note in their fields", () => {
|
|
280
281
|
const growth = card(mapped(), "growth");
|
|
281
|
-
|
|
282
|
+
// #12139 D1: annual mode shows the yearly Price per month.
|
|
283
|
+
expect(growth.price).toEqual({ monthly: "M⟪$49", annual: "M⟪$40.83" });
|
|
282
284
|
expect(growth.priceUnit).toBe("per seat");
|
|
283
285
|
expect(growth.priceSubhead).toBe("Billed per active seat");
|
|
284
286
|
expect(growth.priceFootnote).toBe("Cancel any time from your account");
|
|
@@ -701,6 +703,7 @@ describe("offeringsPricing — no copy of its own (AC-7)", () => {
|
|
|
701
703
|
),
|
|
702
704
|
);
|
|
703
705
|
if (plan.highlightLabel) visible.push(plan.highlightLabel);
|
|
706
|
+
if (plan.annualPriceNote) visible.push(plan.annualPriceNote);
|
|
704
707
|
}
|
|
705
708
|
for (const t of addonsOf(result)) {
|
|
706
709
|
visible.push(t.cta!.label, t.price);
|
|
@@ -927,3 +930,389 @@ describe("offeringsPricing — exclude (#12103 D2)", () => {
|
|
|
927
930
|
expect(addonsOf(result).map((t) => t.key)).toEqual(["seo-audit", "audit-pack"]);
|
|
928
931
|
});
|
|
929
932
|
});
|
|
933
|
+
|
|
934
|
+
describe("offeringsPricing — the annual price per month (#12139 D1, AC-2)", () => {
|
|
935
|
+
/** A shown set of the spec's plan fixtures, in this order. */
|
|
936
|
+
function perMonthSet(edit: (set: WorkspaceShownSet) => void = () => {}) {
|
|
937
|
+
return shownSet((set) => {
|
|
938
|
+
set.offerings = [
|
|
939
|
+
product(
|
|
940
|
+
"annual-plan",
|
|
941
|
+
"plan",
|
|
942
|
+
[
|
|
943
|
+
price("annual-plan", "monthly", 9900, "usd"),
|
|
944
|
+
price("annual-plan", "yearly", 96000, "usd"),
|
|
945
|
+
],
|
|
946
|
+
{ termsNote: "Cancel any time" },
|
|
947
|
+
),
|
|
948
|
+
product("monthly-plan", "plan", [price("monthly-plan", "monthly", 4900, "usd")], { termsNote: "Terms" }),
|
|
949
|
+
product("yearly-plan", "plan", [price("yearly-plan", "yearly", 96000, "usd")]),
|
|
950
|
+
product("once-plan", "plan", [price("once-plan", "once", 150000, "usd")]),
|
|
951
|
+
product("odd-plan", "plan", [price("odd-plan", "monthly", 4900, "usd"), price("odd-plan", "yearly", 49000, "usd")]),
|
|
952
|
+
product("yen-plan", "plan", [price("yen-plan", "monthly", 1000, "jpy"), price("yen-plan", "yearly", 10000, "jpy")]),
|
|
953
|
+
product("round-up-plan", "plan", [price("round-up-plan", "monthly", 4900, "usd"), price("round-up-plan", "yearly", 59900, "usd")]),
|
|
954
|
+
product("whole-plan", "plan", [price("whole-plan", "monthly", 900, "usd"), price("whole-plan", "yearly", 12001, "usd")]),
|
|
955
|
+
];
|
|
956
|
+
set.productIds = set.offerings.map((o) => o.productId);
|
|
957
|
+
set.recommended = { plan: null, addon: null };
|
|
958
|
+
edit(set);
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
it("phrases the yearly Price per month, with the yearly total in the note, and keeps the yearly link", () => {
|
|
963
|
+
const annual = card(mapped(perMonthSet()), "annual-plan");
|
|
964
|
+
expect(annual.price).toEqual({ monthly: "M⟪$99", annual: "M⟪$80" });
|
|
965
|
+
expect(annual.annualPriceNote).toBe("B⟪$960");
|
|
966
|
+
expect(annual.annualCtaHref).toBe("/api/offerings/checkout/annual-plan_yearly");
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
it("rounds the per-month amount to the nearest minor unit", () => {
|
|
970
|
+
const result = mapped(perMonthSet());
|
|
971
|
+
expect(card(result, "odd-plan").price.annual).toBe("M⟪$40.83");
|
|
972
|
+
expect(card(result, "round-up-plan").price.annual).toBe("M⟪$49.92");
|
|
973
|
+
expect(card(result, "whole-plan").price.annual).toBe("M⟪$10");
|
|
974
|
+
expect(card(result, "yen-plan").price.annual).toBe("M⟪¥833");
|
|
975
|
+
expect(card(result, "yen-plan").annualPriceNote).toBe("B⟪¥10,000");
|
|
976
|
+
});
|
|
977
|
+
|
|
978
|
+
it("leaves monthly-only, yearly-only and one-time plans as they were, with no note", () => {
|
|
979
|
+
const result = mapped(perMonthSet());
|
|
980
|
+
expect(card(result, "monthly-plan").price).toEqual({ monthly: "M⟪$49" });
|
|
981
|
+
expect(card(result, "yearly-plan").price).toEqual({ annual: "Y⟪$960" });
|
|
982
|
+
expect(card(result, "once-plan").price).toEqual({ custom: "O⟪$1,500" });
|
|
983
|
+
for (const key of ["monthly-plan", "yearly-plan", "once-plan"])
|
|
984
|
+
expect(card(result, key)).not.toHaveProperty("annualPriceNote");
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
it("keeps a bundle card's annual phrase", () => {
|
|
988
|
+
const set = shownSet((s) => {
|
|
989
|
+
s.offerings = [
|
|
990
|
+
product("rebuild", "plan", [price("rebuild", "once", 2500000, "usd")], { requires: "managed" }),
|
|
991
|
+
product("managed", "plan", [price("managed", "monthly", 300000, "usd"), price("managed", "yearly", 3000000, "usd")]),
|
|
992
|
+
];
|
|
993
|
+
s.productIds = ["prod_rebuild", "prod_managed"];
|
|
994
|
+
s.recommended = { plan: null, addon: null };
|
|
995
|
+
});
|
|
996
|
+
const rebuild = card(mapped(set), "rebuild");
|
|
997
|
+
expect(rebuild.price.annual).toBe("W⟪O⟪$25,000⟫Y⟪$30,000");
|
|
998
|
+
expect(rebuild).not.toHaveProperty("annualPriceNote");
|
|
999
|
+
});
|
|
1000
|
+
});
|
|
1001
|
+
|
|
1002
|
+
describe("offeringsPricing — the terms note of a both-prices card is annual-only (#12139 D2, AC-3)", () => {
|
|
1003
|
+
it("flags the terms note on a plan with monthly and yearly Prices, and on no other plan", () => {
|
|
1004
|
+
const set = shownSet((s) => {
|
|
1005
|
+
s.offerings = [
|
|
1006
|
+
product(
|
|
1007
|
+
"annual-plan",
|
|
1008
|
+
"plan",
|
|
1009
|
+
[
|
|
1010
|
+
price("annual-plan", "monthly", 9900, "usd"),
|
|
1011
|
+
price("annual-plan", "yearly", 96000, "usd"),
|
|
1012
|
+
],
|
|
1013
|
+
{ termsNote: "Cancel any time" },
|
|
1014
|
+
),
|
|
1015
|
+
product("monthly-plan", "plan", [price("monthly-plan", "monthly", 4900, "usd")], { termsNote: "Terms" }),
|
|
1016
|
+
];
|
|
1017
|
+
s.productIds = s.offerings.map((o) => o.productId);
|
|
1018
|
+
s.recommended = { plan: null, addon: null };
|
|
1019
|
+
});
|
|
1020
|
+
const result = mapped(set);
|
|
1021
|
+
expect(card(result, "annual-plan").priceFootnote).toBe("Cancel any time");
|
|
1022
|
+
expect(card(result, "annual-plan").priceFootnoteAnnualOnly).toBe(true);
|
|
1023
|
+
expect(card(result, "monthly-plan").priceFootnote).toBe("Terms");
|
|
1024
|
+
expect(card(result, "monthly-plan")).not.toHaveProperty("priceFootnoteAnnualOnly");
|
|
1025
|
+
});
|
|
1026
|
+
|
|
1027
|
+
it("flags a bundle's terms note when its required product has both Prices", () => {
|
|
1028
|
+
const set = shownSet((s) => {
|
|
1029
|
+
s.offerings = [
|
|
1030
|
+
product("rebuild", "plan", [price("rebuild", "once", 2500000, "usd")], { requires: "managed", termsNote: "Cancel any time" }),
|
|
1031
|
+
product("managed", "plan", [price("managed", "monthly", 300000, "usd"), price("managed", "yearly", 3000000, "usd")]),
|
|
1032
|
+
];
|
|
1033
|
+
s.productIds = ["prod_rebuild", "prod_managed"];
|
|
1034
|
+
s.recommended = { plan: null, addon: null };
|
|
1035
|
+
});
|
|
1036
|
+
const rebuild = card(mapped(set), "rebuild");
|
|
1037
|
+
expect(rebuild.priceFootnote).toBe("Cancel any time");
|
|
1038
|
+
expect(rebuild.priceFootnoteAnnualOnly).toBe(true);
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
it("never flags a deposit note", () => {
|
|
1042
|
+
const plan = shownSet((s) => {
|
|
1043
|
+
const basic = offering(s, "basic");
|
|
1044
|
+
basic.prices = basic.prices.filter((p) => p.period === "once");
|
|
1045
|
+
basic.deposit = 50000;
|
|
1046
|
+
basic.termsNote = "Terms";
|
|
1047
|
+
});
|
|
1048
|
+
expect(card(mapped(plan), "basic").priceFootnote).toBe("D⟪$500");
|
|
1049
|
+
expect(card(mapped(plan), "basic")).not.toHaveProperty("priceFootnoteAnnualOnly");
|
|
1050
|
+
|
|
1051
|
+
const bundle = shownSet((s) => {
|
|
1052
|
+
s.offerings = [
|
|
1053
|
+
product("rebuild", "plan", [price("rebuild", "once", 2500000, "jpy")], { requires: "managed", deposit: 500000, termsNote: "Terms" }),
|
|
1054
|
+
product("managed", "plan", [price("managed", "monthly", 300000, "jpy"), price("managed", "yearly", 3000000, "jpy")]),
|
|
1055
|
+
];
|
|
1056
|
+
s.productIds = ["prod_rebuild", "prod_managed"];
|
|
1057
|
+
s.recommended = { plan: null, addon: null };
|
|
1058
|
+
});
|
|
1059
|
+
const rebuild = card(mapped(bundle), "rebuild");
|
|
1060
|
+
expect(rebuild.priceFootnote).toBe("D⟪¥500,000");
|
|
1061
|
+
expect(rebuild).not.toHaveProperty("priceFootnoteAnnualOnly");
|
|
1062
|
+
});
|
|
1063
|
+
});
|
|
1064
|
+
|
|
1065
|
+
// ─── #12140 — the page picks the layout (spec 12140 D3, D4) ────────────────
|
|
1066
|
+
|
|
1067
|
+
const LAYOUTS = [
|
|
1068
|
+
"three-tiers-with-toggle",
|
|
1069
|
+
"with-comparison-table",
|
|
1070
|
+
"two-tiers-with-extra-tier",
|
|
1071
|
+
"single-price-with-details",
|
|
1072
|
+
"features-and-plans",
|
|
1073
|
+
"band-hero",
|
|
1074
|
+
] as const;
|
|
1075
|
+
|
|
1076
|
+
describe("offeringsPricing — one mapping per layout (#12140 D3, AC-1)", () => {
|
|
1077
|
+
it("maps exactly as today without a layout, and the same with three-tiers-with-toggle", () => {
|
|
1078
|
+
expect(offeringsPricing(shownSet(), OPTIONS)).toEqual(
|
|
1079
|
+
offeringsPricing(shownSet(), { ...OPTIONS, layout: "three-tiers-with-toggle" }),
|
|
1080
|
+
);
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
it.each(["with-comparison-table", "two-tiers-with-extra-tier", "band-hero"] as const)(
|
|
1084
|
+
"%s: centred cards, no billing toggle",
|
|
1085
|
+
(layout) => {
|
|
1086
|
+
const result = offeringsPricing(shownSet(), { ...OPTIONS, layout })!;
|
|
1087
|
+
expect(result.plans).toStrictEqual({
|
|
1088
|
+
variant: layout,
|
|
1089
|
+
cardLayout: "centered",
|
|
1090
|
+
plans: plansOf(mapped()),
|
|
1091
|
+
});
|
|
1092
|
+
},
|
|
1093
|
+
);
|
|
1094
|
+
|
|
1095
|
+
it("single-price-with-details: the first card only, no card layout and no toggle", () => {
|
|
1096
|
+
const result = offeringsPricing(shownSet(), { ...OPTIONS, layout: "single-price-with-details" })!;
|
|
1097
|
+
expect(result.plans).toStrictEqual({
|
|
1098
|
+
variant: "single-price-with-details",
|
|
1099
|
+
plans: [plansOf(mapped())[0]],
|
|
1100
|
+
});
|
|
1101
|
+
expect(result.plans!.plans[0]!.key).toBe("starter");
|
|
1102
|
+
});
|
|
1103
|
+
|
|
1104
|
+
it("leaves the add-ons fragment as it is for every layout", () => {
|
|
1105
|
+
for (const layout of LAYOUTS) {
|
|
1106
|
+
expect(offeringsPricing(shownSet(), { ...OPTIONS, layout })!.addons).toEqual(mapped().addons);
|
|
1107
|
+
}
|
|
1108
|
+
});
|
|
1109
|
+
});
|
|
1110
|
+
|
|
1111
|
+
describe("offeringsPricing — features-and-plans splits one product into two blocks (#12140 D4, AC-3)", () => {
|
|
1112
|
+
const FEATURES_AND_PLANS = { ...OPTIONS, layout: "features-and-plans" } as const;
|
|
1113
|
+
|
|
1114
|
+
it("one product with monthly and yearly Prices → a monthly block and a yearly block beside its features", () => {
|
|
1115
|
+
expect(
|
|
1116
|
+
offeringsPricing(shownSet(), { ...FEATURES_AND_PLANS, plans: ["growth"] })!.plans,
|
|
1117
|
+
).toStrictEqual({
|
|
1118
|
+
variant: "features-and-plans",
|
|
1119
|
+
features: [{ title: "Ten sites" }, { title: "Priority support" }],
|
|
1120
|
+
plans: [
|
|
1121
|
+
{
|
|
1122
|
+
key: "growth",
|
|
1123
|
+
name: "Growth",
|
|
1124
|
+
description: "For teams that ship weekly",
|
|
1125
|
+
price: { monthly: "M⟪$49" },
|
|
1126
|
+
features: ["Ten sites", "Priority support"],
|
|
1127
|
+
cta: { label: "CTA⟪", href: hrefFor("growth_monthly") },
|
|
1128
|
+
priceUnit: "per seat",
|
|
1129
|
+
priceSubhead: "Billed per active seat",
|
|
1130
|
+
highlighted: true,
|
|
1131
|
+
highlightStyle: "pill",
|
|
1132
|
+
highlightLabel: "REC⟪",
|
|
1133
|
+
},
|
|
1134
|
+
{
|
|
1135
|
+
key: "growth_yearly",
|
|
1136
|
+
name: "Growth",
|
|
1137
|
+
price: { annual: "Y⟪$490" },
|
|
1138
|
+
features: ["Ten sites", "Priority support"],
|
|
1139
|
+
cta: { label: "CTA⟪", href: hrefFor("growth_yearly") },
|
|
1140
|
+
priceUnit: "per seat",
|
|
1141
|
+
priceSubhead: "Billed per active seat",
|
|
1142
|
+
priceFootnote: "Cancel any time from your account",
|
|
1143
|
+
},
|
|
1144
|
+
],
|
|
1145
|
+
});
|
|
1146
|
+
});
|
|
1147
|
+
|
|
1148
|
+
it("a product with one Price is one card as built, with its features", () => {
|
|
1149
|
+
const only = { ...OPTIONS, plans: ["starter"] };
|
|
1150
|
+
expect(
|
|
1151
|
+
offeringsPricing(shownSet(), { ...FEATURES_AND_PLANS, plans: ["starter"] })!.plans,
|
|
1152
|
+
).toStrictEqual({
|
|
1153
|
+
variant: "features-and-plans",
|
|
1154
|
+
features: [{ title: "One site" }, { title: "Email support" }],
|
|
1155
|
+
plans: plansOf(offeringsPricing(shownSet(), only)!),
|
|
1156
|
+
});
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
it("two products are the cards as built, with no features key", () => {
|
|
1160
|
+
const both = { ...OPTIONS, plans: ["growth", "basic"] };
|
|
1161
|
+
expect(
|
|
1162
|
+
offeringsPricing(shownSet(), { ...FEATURES_AND_PLANS, plans: ["growth", "basic"] })!.plans,
|
|
1163
|
+
).toStrictEqual({
|
|
1164
|
+
variant: "features-and-plans",
|
|
1165
|
+
plans: plansOf(offeringsPricing(shownSet(), both)!),
|
|
1166
|
+
});
|
|
1167
|
+
});
|
|
1168
|
+
|
|
1169
|
+
it("a bundle is never split, though its built card carries both prices", () => {
|
|
1170
|
+
const set = shownSet((s) => {
|
|
1171
|
+
s.offerings = [
|
|
1172
|
+
product("rebuild", "plan", [price("rebuild", "once", 2500000, "usd")], { requires: "managed" }),
|
|
1173
|
+
product("managed", "plan", [price("managed", "monthly", 300000, "usd"), price("managed", "yearly", 3000000, "usd")]),
|
|
1174
|
+
];
|
|
1175
|
+
s.productIds = ["prod_rebuild", "prod_managed"];
|
|
1176
|
+
s.recommended = { plan: null, addon: null };
|
|
1177
|
+
});
|
|
1178
|
+
const built = plansOf(offeringsPricing(set, { ...OPTIONS, plans: ["rebuild"] })!);
|
|
1179
|
+
expect(built[0]!.price).toHaveProperty("monthly");
|
|
1180
|
+
expect(built[0]!.price).toHaveProperty("annual");
|
|
1181
|
+
expect(built[0]!.cta.href.endsWith("rebuild_once?with=managed_monthly")).toBe(true);
|
|
1182
|
+
expect(built[0]!.annualCtaHref!.endsWith("rebuild_once?with=managed_yearly")).toBe(true);
|
|
1183
|
+
expect(
|
|
1184
|
+
offeringsPricing(set, { ...FEATURES_AND_PLANS, plans: ["rebuild"] })!.plans,
|
|
1185
|
+
).toStrictEqual({ variant: "features-and-plans", plans: [built[0]] });
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
|
|
1189
|
+
describe("offeringsPricing — no layout names a vendor; every link is ours (#12140 AC-5)", () => {
|
|
1190
|
+
it.each([undefined, ...LAYOUTS])("layout %s", (layout) => {
|
|
1191
|
+
const result = offeringsPricing(shownSet(), { ...OPTIONS, ...(layout ? { layout } : {}) })!;
|
|
1192
|
+
expect(JSON.stringify(result)).not.toMatch(/stripe/i);
|
|
1193
|
+
const links = [
|
|
1194
|
+
...plansOf(result).flatMap((c) => [c.cta.href, ...(c.annualCtaHref ? [c.annualCtaHref] : [])]),
|
|
1195
|
+
...addonsOf(result).map((t) => t.cta?.href ?? ""),
|
|
1196
|
+
];
|
|
1197
|
+
expect(links.length).toBeGreaterThan(0);
|
|
1198
|
+
for (const href of links) expect(href.startsWith(OFFERINGS_CHECKOUT_PATH)).toBe(true);
|
|
1199
|
+
});
|
|
1200
|
+
});
|
|
1201
|
+
|
|
1202
|
+
// ─── #12174 — Offerings plans grouped into level cards (D6, AC-5) ───────────
|
|
1203
|
+
|
|
1204
|
+
/** Three plan products of one tier, pushed onto the fixture (`productIds` in step). */
|
|
1205
|
+
function levelSet(
|
|
1206
|
+
edit: (offerings: OfferingsProduct[]) => OfferingsProduct[] = (o) => o,
|
|
1207
|
+
): WorkspaceShownSet {
|
|
1208
|
+
return shownSet((set) => {
|
|
1209
|
+
const levels = edit([
|
|
1210
|
+
product(
|
|
1211
|
+
"ind-msg",
|
|
1212
|
+
"plan",
|
|
1213
|
+
[price("ind-msg", "monthly", 24900, "usd"), price("ind-msg", "yearly", 256800, "usd")],
|
|
1214
|
+
{
|
|
1215
|
+
name: "Growth Platform Individual Messaging",
|
|
1216
|
+
marketingFeatures: ["One Messaging seat"],
|
|
1217
|
+
note: "Setup included",
|
|
1218
|
+
},
|
|
1219
|
+
),
|
|
1220
|
+
product(
|
|
1221
|
+
"ind-pb",
|
|
1222
|
+
"plan",
|
|
1223
|
+
[price("ind-pb", "monthly", 29900, "usd"), price("ind-pb", "yearly", 306800, "usd")],
|
|
1224
|
+
{ name: "Growth Platform Individual Playbooks", marketingFeatures: ["One Playbooks seat"] },
|
|
1225
|
+
),
|
|
1226
|
+
product("ind-suite", "plan", [price("ind-suite", "monthly", 38900, "usd")], {
|
|
1227
|
+
name: "Growth Platform Individual Brand Suite",
|
|
1228
|
+
marketingFeatures: ["One Brand Suite seat"],
|
|
1229
|
+
}),
|
|
1230
|
+
]);
|
|
1231
|
+
set.offerings.push(...levels);
|
|
1232
|
+
set.productIds = set.offerings.map((o) => o.productId);
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
const INDIVIDUAL = {
|
|
1237
|
+
key: "individual",
|
|
1238
|
+
name: "Individual",
|
|
1239
|
+
levels: [
|
|
1240
|
+
{ label: "Messaging", plan: "ind-msg" },
|
|
1241
|
+
{ label: "Playbooks", plan: "ind-pb" },
|
|
1242
|
+
{ label: "Suite", plan: "ind-suite" },
|
|
1243
|
+
],
|
|
1244
|
+
};
|
|
1245
|
+
const LEVEL_PLANS = ["ind-msg", "ind-pb", "ind-suite"];
|
|
1246
|
+
|
|
1247
|
+
function grouped(set: WorkspaceShownSet, group = INDIVIDUAL) {
|
|
1248
|
+
return offeringsPricing(set, { ...OPTIONS, plans: LEVEL_PLANS, levelGroups: [group] });
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
describe("offeringsPricing — levelGroups (#12174 D6, AC-5)", () => {
|
|
1252
|
+
it("groups the plans into one card titled and labelled by the page", () => {
|
|
1253
|
+
const result = grouped(levelSet())!;
|
|
1254
|
+
const cards = plansOf(result);
|
|
1255
|
+
expect(cards).toHaveLength(1);
|
|
1256
|
+
const card = cards[0]!;
|
|
1257
|
+
expect(card.key).toBe("individual");
|
|
1258
|
+
expect(card.name).toBe("Individual");
|
|
1259
|
+
const levels = card.levels!;
|
|
1260
|
+
expect(levels.map((l) => l.label)).toEqual(["Messaging", "Playbooks", "Suite"]);
|
|
1261
|
+
expect(levels.map((l) => l.key)).toEqual(LEVEL_PLANS);
|
|
1262
|
+
expect(levels[0]!.price).toEqual({ monthly: "M⟪$249", annual: "M⟪$214" });
|
|
1263
|
+
expect(levels[0]!.annualPriceNote).toBe("B⟪$2,568");
|
|
1264
|
+
expect(levels[0]!.priceSubhead).toBe("Setup included");
|
|
1265
|
+
expect(levels[1]).not.toHaveProperty("priceSubhead");
|
|
1266
|
+
expect(levels[2]!.price).toEqual({ monthly: "M⟪$389" });
|
|
1267
|
+
expect(levels[2]).not.toHaveProperty("annualCtaHref");
|
|
1268
|
+
expect(card.price).toEqual(levels[0]!.price);
|
|
1269
|
+
expect(card.features).toEqual(levels[0]!.features);
|
|
1270
|
+
expect(card.cta).toEqual(levels[0]!.cta);
|
|
1271
|
+
const names = levelSet().offerings.map((o) => o.name);
|
|
1272
|
+
const strings = JSON.stringify(card).match(/"[^"]*"/g)!.map((s) => s.slice(1, -1));
|
|
1273
|
+
for (const name of names) expect(strings).not.toContain(name);
|
|
1274
|
+
expect(result.plans!.billingToggle).toBe(true);
|
|
1275
|
+
});
|
|
1276
|
+
|
|
1277
|
+
it("keeps the authored level order", () => {
|
|
1278
|
+
const group = { ...INDIVIDUAL, levels: [INDIVIDUAL.levels[2]!, INDIVIDUAL.levels[0]!] };
|
|
1279
|
+
expect(plansOf(grouped(levelSet(), group)!)[0]!.levels!.map((l) => l.label)).toEqual(["Suite", "Messaging"]);
|
|
1280
|
+
});
|
|
1281
|
+
|
|
1282
|
+
it("drops a level whose plan is not shown, and the card when none is", () => {
|
|
1283
|
+
const two = grouped(levelSet((o) => o.filter((p) => p.plan !== "ind-pb")))!;
|
|
1284
|
+
expect(plansOf(two)[0]!.levels!.map((l) => l.label)).toEqual(["Messaging", "Suite"]);
|
|
1285
|
+
const none = grouped(levelSet(() => []))!;
|
|
1286
|
+
expect(none.plans).toBeNull();
|
|
1287
|
+
});
|
|
1288
|
+
|
|
1289
|
+
it("highlights the card that sells the first recommended plan", () => {
|
|
1290
|
+
const card = plansOf(
|
|
1291
|
+
grouped(levelSet((o) => o.map((p) => (p.plan === "ind-suite" ? { ...p, recommended: true } : p))))!,
|
|
1292
|
+
)[0]!;
|
|
1293
|
+
expect(card.highlighted).toBe(true);
|
|
1294
|
+
expect(card.highlightStyle).toBe("pill");
|
|
1295
|
+
expect(card.highlightLabel).toBe("REC⟪");
|
|
1296
|
+
});
|
|
1297
|
+
|
|
1298
|
+
it("turns the toggle on for a level priced both ways when the first is not", () => {
|
|
1299
|
+
const set = levelSet((o) =>
|
|
1300
|
+
o.map((p) => (p.plan === "ind-msg" ? { ...p, prices: p.prices.filter((x) => x.period === "monthly") } : p)),
|
|
1301
|
+
);
|
|
1302
|
+
expect(grouped(set)!.plans!.billingToggle).toBe(true);
|
|
1303
|
+
});
|
|
1304
|
+
|
|
1305
|
+
it("changes nothing for a call that passes no levelGroups", () => {
|
|
1306
|
+
expect(offeringsPricing(levelSet(), OPTIONS)).toEqual(
|
|
1307
|
+
offeringsPricing(levelSet(), { ...OPTIONS, levelGroups: undefined }),
|
|
1308
|
+
);
|
|
1309
|
+
expect(plansOf(mapped(levelSet())).map((c) => c.key)).toEqual([
|
|
1310
|
+
"starter",
|
|
1311
|
+
"growth",
|
|
1312
|
+
"basic",
|
|
1313
|
+
"ind-msg",
|
|
1314
|
+
"ind-pb",
|
|
1315
|
+
"ind-suite",
|
|
1316
|
+
]);
|
|
1317
|
+
});
|
|
1318
|
+
});
|