create-ailk 0.45.0 → 0.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +6 -3
  2. package/component-catalog.json +217 -4
  3. package/component-catalog.md +10 -7
  4. package/dist/lib/env-catalog.js +1 -1
  5. package/dist/lib/import-mdx.js +10 -2
  6. package/dist/seed-workspace.d.ts +1 -1
  7. package/dist/seed-workspace.js +10 -3
  8. package/dist/surfaces.js +1 -1
  9. package/package.json +3 -3
  10. package/templates/apps/api/.env.example +23 -0
  11. package/templates/apps/api/CLAUDE.md +13 -6
  12. package/templates/apps/api/src/lib/__mocks__/prisma.ts +11 -0
  13. package/templates/apps/mcp/.env.example +8 -0
  14. package/templates/apps/mcp/CLAUDE.md +22 -6
  15. package/templates/apps/web/.env.example +1 -1
  16. package/templates/apps/web/CLAUDE.md +80 -16
  17. package/templates/apps/web/app/.well-known/mcp.json/route.ts +6 -7
  18. package/templates/apps/web/app/[locale]/layout.tsx +10 -7
  19. package/templates/apps/web/app/api/site-status/__tests__/route.test.ts +120 -0
  20. package/templates/apps/web/app/api/site-status/route.ts +62 -0
  21. package/templates/apps/web/app/llms.txt/route.ts +3 -3
  22. package/templates/apps/web/app/openapi.json/__tests__/route.test.ts +21 -4
  23. package/templates/apps/web/app/openapi.json/route.ts +10 -9
  24. package/templates/apps/web/app/sitemap.xml/route.ts +3 -3
  25. package/templates/apps/web/auth.ts +25 -1
  26. package/templates/apps/web/lib/__tests__/fixtures/mcp-stub-server.ts +10 -3
  27. package/templates/apps/web/lib/__tests__/mcp-served-tools.test.ts +61 -0
  28. package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +384 -1
  29. package/templates/apps/web/lib/__tests__/pricing-page.test.ts +675 -0
  30. package/templates/apps/web/lib/__tests__/site-brand.test.ts +5 -6
  31. package/templates/apps/web/lib/__tests__/site-visibility.test.ts +64 -0
  32. package/templates/apps/web/lib/mcp-oauth.ts +64 -0
  33. package/templates/apps/web/lib/mcp-served-tools.ts +51 -9
  34. package/templates/apps/web/lib/offerings-pricing.ts +173 -20
  35. package/templates/apps/web/lib/pricing-page.ts +382 -43
  36. package/templates/apps/web/lib/site-brand.tsx +1 -7
  37. package/templates/apps/web/lib/site-visibility.ts +45 -0
  38. package/templates/apps/web/messages/en.json +9 -0
  39. package/templates/apps/web/middleware.ts +16 -1
  40. package/templates/apps/web/src/lib/routes.ts +3 -3
  41. package/versions.json +51 -51
  42. package/templates/apps/web/app/.well-known/ai-plugin.json/route.ts +0 -93
@@ -7,6 +7,8 @@
7
7
  * anonymous `/mcp` route (#11951 spec AC-1, AC-2, §5.2): the four-step
8
8
  * exchange in both transport modes, `nextCursor` paging, every failed-read
9
9
  * shape resolving `null`, the 60-second shared answer and the user agent.
10
+ * `readMcpServer` (#11978 D3, AC-5 (b)): a refusal told from an outage, and
11
+ * the installed tools the server reports.
10
12
  */
11
13
 
12
14
  import {
@@ -14,6 +16,7 @@ import {
14
16
  MCP_TOOLS_TIMEOUT_MS,
15
17
  MCP_TOOLS_TTL_MS,
16
18
  __resetServedMcpToolsForTests,
19
+ readMcpServer,
17
20
  readServedMcpTools,
18
21
  } from "../mcp-served-tools";
19
22
 
@@ -332,3 +335,61 @@ describe("readServedMcpTools — sharing and the user agent (§5.2)", () => {
332
335
  }
333
336
  });
334
337
  });
338
+
339
+ // #11978 D3, AC-5 (b) — what the site's status report says of its MCP server.
340
+ describe("readMcpServer — the answer the status route reports (#11978 D3)", () => {
341
+ const INSTALLED = ["create_booking", "get_redirect"];
342
+
343
+ it.each(["stateless", "stateful"] as const)(
344
+ "%s: an initialize carrying ailk/installed → answering with the installed names",
345
+ async (mode) => {
346
+ const server = await stub({ mode, experimental: { "ailk/installed": { tools: INSTALLED } } });
347
+ expect(await readMcpServer(server.url)).toEqual({
348
+ state: "answering",
349
+ tools: SERVED,
350
+ installed: INSTALLED,
351
+ });
352
+ __resetServedMcpToolsForTests();
353
+ expect(await readServedMcpTools(server.url)).toEqual(SERVED);
354
+ },
355
+ );
356
+
357
+ it("an initialize without it → installed null", async () => {
358
+ const server = await stub();
359
+ expect(await readMcpServer(server.url)).toEqual({
360
+ state: "answering",
361
+ tools: SERVED,
362
+ installed: null,
363
+ });
364
+ });
365
+
366
+ it.each([
367
+ [{ "ailk/installed": { tools: "create_booking" } }],
368
+ [{ "ailk/installed": { tools: [1] } }],
369
+ [{ "ailk/installed": [] }],
370
+ ])("a malformed capability %j → installed null", async (experimental) => {
371
+ const server = await stub({ experimental });
372
+ expect(await readMcpServer(server.url)).toMatchObject({ installed: null });
373
+ });
374
+
375
+ it("initialize answering 404 → refused, and readServedMcpTools null", async () => {
376
+ const server = await stub({ override: (r) => (r.rpcMethod === "initialize" ? { status: 404 } : undefined) });
377
+ expect(await readMcpServer(server.url)).toEqual({ state: "refused" });
378
+ expect(await readServedMcpTools(server.url)).toBeNull();
379
+ });
380
+
381
+ it("initialize answering 500 → unreachable", async () => {
382
+ const server = await stub({ override: (r) => (r.rpcMethod === "initialize" ? { status: 500 } : undefined) });
383
+ expect(await readMcpServer(server.url)).toEqual({ state: "unreachable" });
384
+ expect(await readServedMcpTools(server.url)).toBeNull();
385
+ });
386
+
387
+ it("a tools/list 404 after an answered initialize → unreachable, not refused", async () => {
388
+ const server = await stub({ override: (r) => (r.rpcMethod === "tools/list" ? { status: 404 } : undefined) });
389
+ expect(await readMcpServer(server.url)).toEqual({ state: "unreachable" });
390
+ });
391
+
392
+ it("a refused connection → unreachable", async () => {
393
+ expect(await readMcpServer(await refusedUrl())).toEqual({ state: "unreachable" });
394
+ });
395
+ });
@@ -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
- expect(growth.price).toEqual({ monthly: "M⟪$49", annual: "Y⟪$490" });
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);
@@ -815,3 +818,383 @@ describe("offeringsPricing — the route's wire shape (#8927 D3, AC-7)", () => {
815
818
  ).toBeNull();
816
819
  });
817
820
  });
821
+
822
+ describe("offeringsPricing — the seller's button label (#12103 D1, AC-1)", () => {
823
+ const monthly = (plan: string) => [price(plan, "monthly", 4900, "usd")];
824
+ function set(offerings: OfferingsProduct[]): WorkspaceShownSet {
825
+ return shownSet((s) => {
826
+ s.offerings = offerings;
827
+ s.productIds = offerings.map((o) => o.productId);
828
+ s.recommended = { plan: null, addon: null };
829
+ });
830
+ }
831
+
832
+ it("labels a card with its own ctaLabel and keeps the translated default on a card without one", () => {
833
+ const result = mapped(
834
+ set([
835
+ product("essentials", "plan", monthly("essentials"), { ctaLabel: "Start Essentials" }),
836
+ product("growth", "plan", monthly("growth")),
837
+ ]),
838
+ );
839
+ expect(card(result, "essentials").cta).toEqual({
840
+ label: "Start Essentials",
841
+ href: "/api/offerings/checkout/essentials_monthly",
842
+ });
843
+ expect(card(result, "growth").cta?.label).toBe(LABELS.cta);
844
+ });
845
+
846
+ it("labels an add-on tile and a bundle card with their own ctaLabel, the bundle href unchanged", () => {
847
+ const result = mapped(
848
+ set([
849
+ product("retainer", "plan", monthly("retainer")),
850
+ product("setup", "plan", [price("setup", "once", 50000, "usd")], {
851
+ requires: "retainer",
852
+ ctaLabel: "Start the bundle",
853
+ }),
854
+ product("seo", "addon", monthly("seo"), { ctaLabel: "Add it" }),
855
+ ]),
856
+ );
857
+ expect(card(result, "setup").cta).toEqual({
858
+ label: "Start the bundle",
859
+ href: offeringsBundleHref("setup_once", "retainer_monthly"),
860
+ });
861
+ expect(tile(result, "seo").cta?.label).toBe("Add it");
862
+ });
863
+
864
+ it("removes a right-to-left override from the label and renders it as the button's text, linking the checkout path", () => {
865
+ const result = mapped(
866
+ set([product("essentials", "plan", monthly("essentials"), { ctaLabel: "Start‮ now" })]),
867
+ );
868
+ expect(card(result, "essentials").cta?.label).toBe("Start now");
869
+ const { container } = render(
870
+ React.createElement(Pricing, { sectionName: "pricing", data: result.plans! }),
871
+ );
872
+ const anchor = Array.from(container.querySelectorAll("a")).find(
873
+ (a) => a.textContent?.includes("Start now"),
874
+ );
875
+ expect(anchor?.getAttribute("href")).toBe(hrefFor("essentials_monthly"));
876
+ });
877
+ });
878
+
879
+ describe("offeringsPricing — the add-on eyebrow and note (#12103 D5, AC-4)", () => {
880
+ const seo = (extra: Partial<OfferingsProduct>) =>
881
+ product("seo", "addon", [price("seo", "monthly", 900, "usd")], {
882
+ eyebrow: "No retainer",
883
+ note: "Per piece.",
884
+ unitLabel: "piece",
885
+ ...extra,
886
+ });
887
+ function set(offerings: OfferingsProduct[]): WorkspaceShownSet {
888
+ return shownSet((s) => {
889
+ s.offerings = offerings;
890
+ s.productIds = offerings.map((o) => o.productId);
891
+ s.recommended = {
892
+ plan: null,
893
+ addon: offerings.find((o) => o.recommended)?.productId ?? null,
894
+ };
895
+ });
896
+ }
897
+
898
+ it("maps the eyebrow, the note and the unit label to their own tile fields", () => {
899
+ expect(tile(mapped(set([seo({})])), "seo")).toMatchObject({
900
+ eyebrow: "No retainer",
901
+ note: "Per piece.",
902
+ qualifier: "piece",
903
+ });
904
+ });
905
+
906
+ it("keeps the Recommended label as the recommended add-on's eyebrow, its note kept", () => {
907
+ expect(tile(mapped(set([seo({ recommended: true })])), "seo")).toMatchObject({
908
+ eyebrow: LABELS.recommended,
909
+ note: "Per piece.",
910
+ });
911
+ });
912
+
913
+ it("still maps a plan's note to its priceSubhead", () => {
914
+ const result = mapped();
915
+ expect(card(result, "growth").priceSubhead).toBe("Billed per active seat");
916
+ expect(card(result, "growth")).not.toHaveProperty("note");
917
+ });
918
+
919
+ it("emits neither field on a tile whose product carries none", () => {
920
+ const t = tile(mapped(), "audit-pack");
921
+ expect(t).not.toHaveProperty("eyebrow");
922
+ expect(t).not.toHaveProperty("note");
923
+ });
924
+ });
925
+
926
+ describe("offeringsPricing — exclude (#12103 D2)", () => {
927
+ it("drops the excluded plans' cards and keeps every add-on tile", () => {
928
+ const result = offeringsPricing(shownSet(), { ...OPTIONS, exclude: ["growth"] })!;
929
+ expect(plansOf(result).map((c) => c.key)).toEqual(["starter", "basic"]);
930
+ expect(addonsOf(result).map((t) => t.key)).toEqual(["seo-audit", "audit-pack"]);
931
+ });
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
+ });