create-ailk 0.46.1 → 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 +289 -2
- package/component-catalog.md +6 -5
- package/package.json +3 -3
- package/templates/apps/web/CLAUDE.md +23 -1
- package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +118 -0
- package/templates/apps/web/lib/__tests__/pricing-page.test.ts +107 -0
- package/templates/apps/web/lib/offerings-pricing.ts +93 -17
- package/templates/apps/web/lib/pricing-page.ts +88 -10
- package/versions.json +50 -50
package/component-catalog.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"importPath": "@working-theory/ui/blocks",
|
|
18
18
|
"rootBarrel": "@working-theory/ui",
|
|
19
19
|
"sourceRoot": "packages/ui/src/blocks",
|
|
20
|
-
"count":
|
|
20
|
+
"count": 112
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"name": "chrome",
|
|
@@ -1651,6 +1651,17 @@
|
|
|
1651
1651
|
"descriptionGrade": "strong",
|
|
1652
1652
|
"sectionType": null
|
|
1653
1653
|
},
|
|
1654
|
+
{
|
|
1655
|
+
"name": "PricingTierCardLevelSwitch",
|
|
1656
|
+
"tier": "blocks",
|
|
1657
|
+
"sourcePath": "packages/ui/src/blocks/PricingTierCardLevelSwitch.tsx",
|
|
1658
|
+
"importPath": "@working-theory/ui/blocks",
|
|
1659
|
+
"exported": true,
|
|
1660
|
+
"description": "The level switch of a pricing card that sells one tier at several levels. It owns the chosen level and renders a fragment of direct grid children of the card: the track-1 cell (the card's title row, then the switch) and the chosen level's cells, which the parent PricingTierCard builds server-side and passes in as ReactNodes.",
|
|
1661
|
+
"descriptionSource": "doc-comment",
|
|
1662
|
+
"descriptionGrade": "strong",
|
|
1663
|
+
"sectionType": null
|
|
1664
|
+
},
|
|
1654
1665
|
{
|
|
1655
1666
|
"name": "PricingTierCardSeatControl",
|
|
1656
1667
|
"tier": "blocks",
|
|
@@ -7345,6 +7356,97 @@
|
|
|
7345
7356
|
},
|
|
7346
7357
|
"priceFootnoteAnnualOnly": {
|
|
7347
7358
|
"type": "boolean"
|
|
7359
|
+
},
|
|
7360
|
+
"levels": {
|
|
7361
|
+
"minItems": 1,
|
|
7362
|
+
"maxItems": 4,
|
|
7363
|
+
"type": "array",
|
|
7364
|
+
"items": {
|
|
7365
|
+
"type": "object",
|
|
7366
|
+
"properties": {
|
|
7367
|
+
"label": {
|
|
7368
|
+
"type": "string",
|
|
7369
|
+
"minLength": 1,
|
|
7370
|
+
"maxLength": 24
|
|
7371
|
+
},
|
|
7372
|
+
"key": {
|
|
7373
|
+
"type": "string"
|
|
7374
|
+
},
|
|
7375
|
+
"price": {
|
|
7376
|
+
"type": "object",
|
|
7377
|
+
"properties": {
|
|
7378
|
+
"monthly": {
|
|
7379
|
+
"type": "string"
|
|
7380
|
+
},
|
|
7381
|
+
"annual": {
|
|
7382
|
+
"type": "string"
|
|
7383
|
+
},
|
|
7384
|
+
"custom": {
|
|
7385
|
+
"type": "string"
|
|
7386
|
+
}
|
|
7387
|
+
}
|
|
7388
|
+
},
|
|
7389
|
+
"priceUnit": {
|
|
7390
|
+
"type": "string"
|
|
7391
|
+
},
|
|
7392
|
+
"priceSubhead": {
|
|
7393
|
+
"type": "string"
|
|
7394
|
+
},
|
|
7395
|
+
"annualPriceNote": {
|
|
7396
|
+
"type": "string"
|
|
7397
|
+
},
|
|
7398
|
+
"priceFootnote": {
|
|
7399
|
+
"type": "string"
|
|
7400
|
+
},
|
|
7401
|
+
"priceFootnoteAnnualOnly": {
|
|
7402
|
+
"type": "boolean"
|
|
7403
|
+
},
|
|
7404
|
+
"features": {
|
|
7405
|
+
"type": "array",
|
|
7406
|
+
"items": {
|
|
7407
|
+
"type": "string"
|
|
7408
|
+
}
|
|
7409
|
+
},
|
|
7410
|
+
"cta": {
|
|
7411
|
+
"type": "object",
|
|
7412
|
+
"properties": {
|
|
7413
|
+
"label": {
|
|
7414
|
+
"type": "string"
|
|
7415
|
+
},
|
|
7416
|
+
"href": {
|
|
7417
|
+
"type": "string"
|
|
7418
|
+
},
|
|
7419
|
+
"variant": {
|
|
7420
|
+
"type": "string",
|
|
7421
|
+
"enum": [
|
|
7422
|
+
"default",
|
|
7423
|
+
"outline",
|
|
7424
|
+
"secondary",
|
|
7425
|
+
"ghost",
|
|
7426
|
+
"link",
|
|
7427
|
+
"gradient"
|
|
7428
|
+
]
|
|
7429
|
+
},
|
|
7430
|
+
"external": {
|
|
7431
|
+
"type": "boolean"
|
|
7432
|
+
}
|
|
7433
|
+
},
|
|
7434
|
+
"required": [
|
|
7435
|
+
"label",
|
|
7436
|
+
"href"
|
|
7437
|
+
]
|
|
7438
|
+
},
|
|
7439
|
+
"annualCtaHref": {
|
|
7440
|
+
"type": "string"
|
|
7441
|
+
}
|
|
7442
|
+
},
|
|
7443
|
+
"required": [
|
|
7444
|
+
"label",
|
|
7445
|
+
"price",
|
|
7446
|
+
"features",
|
|
7447
|
+
"cta"
|
|
7448
|
+
]
|
|
7449
|
+
}
|
|
7348
7450
|
}
|
|
7349
7451
|
},
|
|
7350
7452
|
"required": [
|
|
@@ -7939,6 +8041,190 @@
|
|
|
7939
8041
|
"pickerLabel"
|
|
7940
8042
|
],
|
|
7941
8043
|
"additionalProperties": false
|
|
8044
|
+
},
|
|
8045
|
+
"levelSwitchPlacement": {
|
|
8046
|
+
"type": "string",
|
|
8047
|
+
"enum": [
|
|
8048
|
+
"own-row",
|
|
8049
|
+
"title-row"
|
|
8050
|
+
]
|
|
8051
|
+
},
|
|
8052
|
+
"offeringGroups": {
|
|
8053
|
+
"minItems": 1,
|
|
8054
|
+
"maxItems": 4,
|
|
8055
|
+
"type": "array",
|
|
8056
|
+
"items": {
|
|
8057
|
+
"type": "object",
|
|
8058
|
+
"properties": {
|
|
8059
|
+
"key": {
|
|
8060
|
+
"type": "string",
|
|
8061
|
+
"pattern": "^[a-z0-9][a-z0-9-]{0,39}$"
|
|
8062
|
+
},
|
|
8063
|
+
"name": {
|
|
8064
|
+
"type": "string",
|
|
8065
|
+
"minLength": 1,
|
|
8066
|
+
"maxLength": 60
|
|
8067
|
+
},
|
|
8068
|
+
"description": {
|
|
8069
|
+
"type": "string"
|
|
8070
|
+
},
|
|
8071
|
+
"levels": {
|
|
8072
|
+
"minItems": 2,
|
|
8073
|
+
"maxItems": 4,
|
|
8074
|
+
"type": "array",
|
|
8075
|
+
"items": {
|
|
8076
|
+
"type": "object",
|
|
8077
|
+
"properties": {
|
|
8078
|
+
"label": {
|
|
8079
|
+
"type": "string",
|
|
8080
|
+
"minLength": 1,
|
|
8081
|
+
"maxLength": 24
|
|
8082
|
+
},
|
|
8083
|
+
"plan": {
|
|
8084
|
+
"type": "string",
|
|
8085
|
+
"pattern": "^[a-z0-9][a-z0-9-]{0,39}$"
|
|
8086
|
+
}
|
|
8087
|
+
},
|
|
8088
|
+
"required": [
|
|
8089
|
+
"label",
|
|
8090
|
+
"plan"
|
|
8091
|
+
]
|
|
8092
|
+
}
|
|
8093
|
+
}
|
|
8094
|
+
},
|
|
8095
|
+
"required": [
|
|
8096
|
+
"key",
|
|
8097
|
+
"name",
|
|
8098
|
+
"levels"
|
|
8099
|
+
]
|
|
8100
|
+
}
|
|
8101
|
+
},
|
|
8102
|
+
"writtenPlans": {
|
|
8103
|
+
"minItems": 1,
|
|
8104
|
+
"maxItems": 3,
|
|
8105
|
+
"type": "array",
|
|
8106
|
+
"items": {
|
|
8107
|
+
"type": "object",
|
|
8108
|
+
"properties": {
|
|
8109
|
+
"name": {
|
|
8110
|
+
"type": "string"
|
|
8111
|
+
},
|
|
8112
|
+
"description": {
|
|
8113
|
+
"type": "string"
|
|
8114
|
+
},
|
|
8115
|
+
"price": {
|
|
8116
|
+
"type": "object",
|
|
8117
|
+
"properties": {
|
|
8118
|
+
"monthly": {
|
|
8119
|
+
"type": "string"
|
|
8120
|
+
},
|
|
8121
|
+
"annual": {
|
|
8122
|
+
"type": "string"
|
|
8123
|
+
},
|
|
8124
|
+
"custom": {
|
|
8125
|
+
"type": "string"
|
|
8126
|
+
}
|
|
8127
|
+
}
|
|
8128
|
+
},
|
|
8129
|
+
"priceUnit": {
|
|
8130
|
+
"type": "string"
|
|
8131
|
+
},
|
|
8132
|
+
"features": {
|
|
8133
|
+
"type": "array",
|
|
8134
|
+
"items": {
|
|
8135
|
+
"type": "string"
|
|
8136
|
+
}
|
|
8137
|
+
},
|
|
8138
|
+
"cta": {
|
|
8139
|
+
"type": "object",
|
|
8140
|
+
"properties": {
|
|
8141
|
+
"label": {
|
|
8142
|
+
"type": "string"
|
|
8143
|
+
},
|
|
8144
|
+
"href": {
|
|
8145
|
+
"type": "string"
|
|
8146
|
+
},
|
|
8147
|
+
"variant": {
|
|
8148
|
+
"type": "string",
|
|
8149
|
+
"enum": [
|
|
8150
|
+
"default",
|
|
8151
|
+
"outline",
|
|
8152
|
+
"secondary",
|
|
8153
|
+
"ghost",
|
|
8154
|
+
"link",
|
|
8155
|
+
"gradient"
|
|
8156
|
+
]
|
|
8157
|
+
},
|
|
8158
|
+
"external": {
|
|
8159
|
+
"type": "boolean"
|
|
8160
|
+
}
|
|
8161
|
+
},
|
|
8162
|
+
"required": [
|
|
8163
|
+
"label",
|
|
8164
|
+
"href"
|
|
8165
|
+
]
|
|
8166
|
+
},
|
|
8167
|
+
"highlighted": {
|
|
8168
|
+
"type": "boolean"
|
|
8169
|
+
},
|
|
8170
|
+
"highlightStyle": {
|
|
8171
|
+
"type": "string",
|
|
8172
|
+
"enum": [
|
|
8173
|
+
"outline",
|
|
8174
|
+
"backdrop",
|
|
8175
|
+
"glow",
|
|
8176
|
+
"pill"
|
|
8177
|
+
]
|
|
8178
|
+
},
|
|
8179
|
+
"highlightLabel": {
|
|
8180
|
+
"type": "string"
|
|
8181
|
+
},
|
|
8182
|
+
"badge": {
|
|
8183
|
+
"type": "string"
|
|
8184
|
+
},
|
|
8185
|
+
"key": {
|
|
8186
|
+
"type": "string"
|
|
8187
|
+
},
|
|
8188
|
+
"priceSubhead": {
|
|
8189
|
+
"type": "string"
|
|
8190
|
+
},
|
|
8191
|
+
"priceFootnote": {
|
|
8192
|
+
"type": "string"
|
|
8193
|
+
},
|
|
8194
|
+
"annualBadge": {
|
|
8195
|
+
"type": "string"
|
|
8196
|
+
},
|
|
8197
|
+
"annualCtaHref": {
|
|
8198
|
+
"type": "string"
|
|
8199
|
+
},
|
|
8200
|
+
"priceSubheadAccent": {
|
|
8201
|
+
"type": "string"
|
|
8202
|
+
},
|
|
8203
|
+
"priceSubheadAccentTone": {
|
|
8204
|
+
"type": "string",
|
|
8205
|
+
"enum": [
|
|
8206
|
+
"default",
|
|
8207
|
+
"muted",
|
|
8208
|
+
"brand",
|
|
8209
|
+
"success",
|
|
8210
|
+
"danger",
|
|
8211
|
+
"warning"
|
|
8212
|
+
]
|
|
8213
|
+
},
|
|
8214
|
+
"annualPriceNote": {
|
|
8215
|
+
"type": "string"
|
|
8216
|
+
},
|
|
8217
|
+
"priceFootnoteAnnualOnly": {
|
|
8218
|
+
"type": "boolean"
|
|
8219
|
+
}
|
|
8220
|
+
},
|
|
8221
|
+
"required": [
|
|
8222
|
+
"name",
|
|
8223
|
+
"price",
|
|
8224
|
+
"features",
|
|
8225
|
+
"cta"
|
|
8226
|
+
]
|
|
8227
|
+
}
|
|
7942
8228
|
}
|
|
7943
8229
|
},
|
|
7944
8230
|
"required": [
|
|
@@ -7958,7 +8244,8 @@
|
|
|
7958
8244
|
"gap",
|
|
7959
8245
|
"surface",
|
|
7960
8246
|
"bandSurface",
|
|
7961
|
-
"collapseFeaturesOnMobile"
|
|
8247
|
+
"collapseFeaturesOnMobile",
|
|
8248
|
+
"levelSwitchPlacement"
|
|
7962
8249
|
]
|
|
7963
8250
|
},
|
|
7964
8251
|
{
|
package/component-catalog.md
CHANGED
|
@@ -15,13 +15,13 @@ The component inventory of `@working-theory/ui` and the shells of `@working-theo
|
|
|
15
15
|
3. Check the Primitives, Panels and Shells tables too — a low-level control, a collapsible layout container, or a route-level frame lives there, not under Sections or Blocks.
|
|
16
16
|
4. Only then build. If you do build, you are declaring the capability is genuinely absent.
|
|
17
17
|
|
|
18
|
-
Inventory: **
|
|
18
|
+
Inventory: **334 component files** across 16 tiers — 60 sections, 112 blocks, 20 chrome, 82 primitives, 6 panels, 8 shells, 5 docs-blog-blocks, 1 docs-blog-chrome, 2 docs-blog-shells, 2 scheduling-sections, 6 scheduling-blocks, 5 signal-collectors-sections, 9 signal-collectors-blocks, 2 commerce-sections, 13 commerce-blocks, 1 commerce-panels. 331 distinct names: `SchedulerEmbed`, `Separator`, `Tabs` exist in more than one tier as genuinely different components, listed once per tier with its own source path.
|
|
19
19
|
|
|
20
|
-
Description coverage: **
|
|
20
|
+
Description coverage: **330/334** components carry a capability description derived from source — 45 from the section registry's hand-authored when-to-use text, 250 from the component's own doc-comment header, 35 from its tier barrel's roster line. **4** have none; they are listed under [Undescribed components](#undescribed-components) rather than given a sentence invented from their name.
|
|
21
21
|
|
|
22
|
-
Of those, **
|
|
22
|
+
Of those, **296** are *strong* — a capability sentence you could match a requirement against — and **34** are *weak*: either one short clause, or a long one that spends itself on wiring (client boundaries, class names, which primitives it composes) instead of on what the thing is for. Weak rows are marked `(weak)` and listed in full under [Weak descriptions](#weak-descriptions). Coverage is 99%, but **findable-without-luck coverage is 89%**.
|
|
23
23
|
|
|
24
|
-
Per tier, strong out of total: **Sections** 59/60 · **Blocks**
|
|
24
|
+
Per tier, strong out of total: **Sections** 59/60 · **Blocks** 103/112 · **Chrome** 11/20 · **Primitives** 67/82 (4 undescribed) · **Panels** 6/6 · **Shells** 7/8 · **Docs + Blog Blocks** 5/5 · **Docs + Blog Chrome** 1/1 · **Docs + Blog Shells** 0/2 · **Scheduling Sections** 2/2 · **Scheduling Blocks** 6/6 · **Signal-Collectors Sections** 5/5 · **Signal-Collectors Blocks** 8/9 · **Commerce Sections** 2/2 · **Commerce Blocks** 13/13 · **Commerce Panels** 1/1. A tier low on this line is a tier where a capability search is most likely to come up empty on something that exists.
|
|
25
25
|
|
|
26
26
|
That grade is **mechanical**. It counts what it can measure — how much a description adds beyond the component's own name, how much of it is spent on wiring, whether the extraction came out damaged — and it cannot tell a fluent paragraph about the wrong subject from a useful one. A person reading these tables will find more rows unusable than the weak count admits. Treat it as a floor on the problem, not a measurement of it, and read the source before concluding a capability is absent.
|
|
27
27
|
|
|
@@ -124,7 +124,7 @@ Import: `import { X } from "@working-theory/ui/sections";` (or from the `@workin
|
|
|
124
124
|
|
|
125
125
|
---
|
|
126
126
|
|
|
127
|
-
## Blocks (
|
|
127
|
+
## Blocks (112)
|
|
128
128
|
|
|
129
129
|
Intermediate composition tiles — the pieces sections are built from. Compose primitives and panels; never import a section.
|
|
130
130
|
|
|
@@ -211,6 +211,7 @@ Import: `import { X } from "@working-theory/ui/blocks";` (or from the `@working-
|
|
|
211
211
|
| `PricingExtraTierRow` | Compact horizontal extra-tier row for the Pricing 'two-tiers-with-extra-tier' variant. Renders plan name + description on the left and a CTA on the right. Structurally different from PricingTierCard (no price display in this variant). | `import { PricingExtraTierRow } from "@working-theory/ui/blocks"` |
|
|
212
212
|
| `PricingTierCard` | Single pricing tier card (all 4 Pricing variants). Renders a single pricing tier: plan name + optional badge, description, price display, CTA button, and feature checklist. | `import { PricingTierCard } from "@working-theory/ui/blocks"` |
|
|
213
213
|
| `PricingTierCardFeaturesDisclosure` | Phone-breakpoint (<md, 768px — the same phone/tablet step CardGrid's own mobile-stacking ramp uses) presentation of a tier card's feature list: collapsed behind a disclosure button so price + CTA (which render ABOVE this row, see PricingTierCard's row-slot ordering) fit the first card view on a phone — the wisprflow.ai/pricing pattern. `md` and up renders the SAME feature list, always expanded, in a second, non-interactive tree — desktop/tablet is unaffected by the collapse. | `import { PricingTierCardFeaturesDisclosure } from "@working-theory/ui/blocks"` |
|
|
214
|
+
| `PricingTierCardLevelSwitch` | The level switch of a pricing card that sells one tier at several levels. It owns the chosen level and renders a fragment of direct grid children of the card: the track-1 cell (the card's title row, then the switch) and the chosen level's cells, which the parent PricingTierCard builds server-side and passes in as ReactNodes. | `import { PricingTierCardLevelSwitch } from "@working-theory/ui/blocks"` |
|
|
214
215
|
| `PricingTierCardSeatControl` | Seat-count range picker for the Team tier card. Renders a Select primitive that lets the user choose an "Up to N seats" option from a caller-supplied list of numbers. The parent PricingTierCard stays a pure RSC; only this tiny island is hydrated. Pattern mirrors PageHeaderSwitcher.tsx: small "use client" island imported by an otherwise-server-rendered parent, keeping the client bundle minimal. *(weak)* | `import { PricingTierCardSeatControl } from "@working-theory/ui/blocks"` |
|
|
215
216
|
| `PromptCaptureCard` | The chat-style prompt card: a multiline field carrying the authored placeholder, with a circular arrow submit control pinned bottom-right that stays muted (disabled) until the visitor has typed something. Enter submits; Shift+Enter inserts a newline — the chat-composer convention. | `import { PromptCaptureCard } from "@working-theory/ui/blocks"` |
|
|
216
217
|
| `Prose` | The single typography wrapper both the docs route and blog render their compiled-MDX body inside. It styles every RAW markdown element a compiled document emits — h2–h6, p, ul/ol/li, blockquote, table parts, hr, a, inline code, pre, img, kbd, strong/em — via `@working-theory/theme` semantic tokens and type roles. No raw color or spacing literals; dark mode rides the semantic tokens (no `dark:` variants needed). | `import { Prose } from "@working-theory/ui/blocks"` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ailk",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.2",
|
|
4
4
|
"description": "Scaffolder for AI Launch Kit — `pnpm create ailk@latest <dir>` produces a starter repo consuming @working-theory/* from npm (per ADR 0007).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"tar": "^7.5.21"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@working-theory/schema": "0.
|
|
32
|
-
"@working-theory/templates": "0.
|
|
31
|
+
"@working-theory/schema": "0.76.0",
|
|
32
|
+
"@working-theory/templates": "0.76.0"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
|
@@ -673,6 +673,26 @@ key), so the page names none. It renders one of three pages:
|
|
|
673
673
|
path written sections give way with the rest. A site whose
|
|
674
674
|
`@working-theory/validation` predates the field strips it and renders the
|
|
675
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`.
|
|
676
696
|
- **Rollout of the two keys (#12103 D8).** A site's strict shown-set readers
|
|
677
697
|
refuse a product carrying `ctaLabel` or `eyebrow` until they take this
|
|
678
698
|
release, and such a site then shows the contact email in place of its
|
|
@@ -878,7 +898,9 @@ A list page whose frontmatter sets `navOnly: true` (valid on a registry list typ
|
|
|
878
898
|
- Don't reach into `apps/api` or `apps/mcp` from `apps/web`. They're peer apps — talk via HTTP/MCP.
|
|
879
899
|
- Don't commit images to `screenshots/` — only the `.gitkeep` is tracked.
|
|
880
900
|
|
|
881
|
-
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`.
|
|
882
904
|
|
|
883
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`.
|
|
884
906
|
|
|
@@ -1198,3 +1198,121 @@ describe("offeringsPricing — no layout names a vendor; every link is ours (#12
|
|
|
1198
1198
|
for (const href of links) expect(href.startsWith(OFFERINGS_CHECKOUT_PATH)).toBe(true);
|
|
1199
1199
|
});
|
|
1200
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
|
+
});
|
|
@@ -815,3 +815,110 @@ describe("the plan bar options survive the Stripe path (#12141 D9, AC-1)", () =>
|
|
|
815
815
|
expect(dataOf(placed, "p").comparisonPlanBar).toEqual(REC_GRID);
|
|
816
816
|
});
|
|
817
817
|
});
|
|
818
|
+
|
|
819
|
+
// ─── #12174 — level cards and written cards on a bound section ──────────────
|
|
820
|
+
|
|
821
|
+
describe("a bound section's offeringGroups and writtenPlans (#12174 AC-5, AC-7)", () => {
|
|
822
|
+
const ENTERPRISE = {
|
|
823
|
+
key: "enterprise",
|
|
824
|
+
name: "Enterprise",
|
|
825
|
+
price: { custom: "Book a call" },
|
|
826
|
+
features: ["Everything in Team"],
|
|
827
|
+
cta: { label: "Book a call", href: "/meet" },
|
|
828
|
+
};
|
|
829
|
+
const level = (label: string, plan: string) => ({ label, plan });
|
|
830
|
+
const GROUPS = [
|
|
831
|
+
{ key: "individual", name: "Individual", levels: [level("Lite", "essentials"), level("Full", "writing")] },
|
|
832
|
+
{ key: "team", name: "Team", levels: [level("Lite", "growth"), level("Full", "team-pro")] },
|
|
833
|
+
];
|
|
834
|
+
/** `stripeSet()` plus one more plan product, `team-pro` (monthly 5000). */
|
|
835
|
+
const withTeamPro = (base: WorkspaceShownSet = stripeSet()) => {
|
|
836
|
+
const offerings = [...base.offerings, stripeProduct("team-pro", "plan", [stripePrice("team-pro", "monthly", 5000)])];
|
|
837
|
+
return workspaceShownSetSchema.parse({ ...base, offerings, productIds: offerings.map((o) => o.productId) });
|
|
838
|
+
};
|
|
839
|
+
const bound = (extra: Record<string, unknown> = {}) =>
|
|
840
|
+
pricingSection("p", { source: "offerings", offeringGroups: GROUPS, writtenPlans: [ENTERPRISE], ...extra });
|
|
841
|
+
|
|
842
|
+
it("groups the plans into one card per group, and leaves them out of the unbound slot (AC-5)", () => {
|
|
843
|
+
const { placed } = render([
|
|
844
|
+
HERO,
|
|
845
|
+
pricingSection("p", { source: "offerings", offeringGroups: [{ key: "team", name: "Team", levels: [level("Lite", "essentials"), level("Full", "writing")] }] }),
|
|
846
|
+
pricingSection("rest"),
|
|
847
|
+
]);
|
|
848
|
+
expect(keysOf(placed, "p")).toEqual(["team"]);
|
|
849
|
+
expect(dataOf(placed, "p").plans[0]!.levels!.map((l) => l.key)).toEqual(["essentials", "writing"]);
|
|
850
|
+
expect(dataOf(placed, "p").billingToggle).toBe(true);
|
|
851
|
+
expect(keysOf(placed, "rest")).toEqual(["growth"]);
|
|
852
|
+
});
|
|
853
|
+
|
|
854
|
+
it("places the written card after the Offerings cards, in one grid: three columns (AC-7)", () => {
|
|
855
|
+
const { placed } = render([HERO, bound()], { set: withTeamPro() });
|
|
856
|
+
expect(keysOf(placed, "p")).toEqual(["individual", "team", "enterprise"]);
|
|
857
|
+
expect(dataOf(placed, "p").plans[2]).toEqual(ENTERPRISE);
|
|
858
|
+
expect(dataOf(placed, "p")).not.toHaveProperty("offeringGroups");
|
|
859
|
+
expect(dataOf(placed, "p")).not.toHaveProperty("writtenPlans");
|
|
860
|
+
});
|
|
861
|
+
|
|
862
|
+
it.each(["single-price-with-details", "two-tiers-with-extra-tier"])(
|
|
863
|
+
"appends no written card where %s hides cards",
|
|
864
|
+
(variant) => {
|
|
865
|
+
const { placed } = render([bound({ variant })], { set: withTeamPro() });
|
|
866
|
+
expect(keysOf(placed, "p")).not.toContain("enterprise");
|
|
867
|
+
},
|
|
868
|
+
);
|
|
869
|
+
|
|
870
|
+
it("drops a written card that links the Offerings checkout", () => {
|
|
871
|
+
const sneak = { ...ENTERPRISE, key: "sneak", cta: { label: "Buy", href: "/api/offerings/checkout/essentials_monthly" } };
|
|
872
|
+
const { placed } = render([bound({ writtenPlans: [ENTERPRISE, sneak] })], { set: withTeamPro() });
|
|
873
|
+
expect(keysOf(placed, "p")).toEqual(["individual", "team", "enterprise"]);
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
it("drops a written section's level card that links the checkout through any level", () => {
|
|
877
|
+
const levelled = {
|
|
878
|
+
...ENTERPRISE,
|
|
879
|
+
key: "levelled",
|
|
880
|
+
levels: [
|
|
881
|
+
{ label: "A", price: { custom: "$1" }, features: [], cta: { label: "Go", href: "/a" } },
|
|
882
|
+
{ label: "B", price: { custom: "$2" }, features: [], cta: { label: "Go", href: "/b" }, annualCtaHref: "/API/offerings/checkout/x_yearly" },
|
|
883
|
+
],
|
|
884
|
+
};
|
|
885
|
+
const written = pricingSection("w", { source: "written", plans: [ENTERPRISE, levelled] });
|
|
886
|
+
const { placed } = render([written, pricingSection("p")]);
|
|
887
|
+
expect(keysOf(placed, "w")).toEqual(["enterprise"]);
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
it("keeps the written cards when no group yields a card (decision 6)", () => {
|
|
891
|
+
const base = stripeSet();
|
|
892
|
+
const set = workspaceShownSetSchema.parse({
|
|
893
|
+
...base,
|
|
894
|
+
offerings: base.offerings.filter((o) => o.plan === "seo"),
|
|
895
|
+
productIds: ["prod_seo"],
|
|
896
|
+
});
|
|
897
|
+
const { placed } = render([HERO, bound()], { set });
|
|
898
|
+
expect(keysOf(placed, "p")).toEqual(["enterprise"]);
|
|
899
|
+
expect(dataOf(placed, "p").plans[0]).toEqual(ENTERPRISE);
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
it("?plan= naming a level's plan highlights the card that sells it (decision 9)", () => {
|
|
903
|
+
const { placed } = render([bound()], { set: withTeamPro(), plan: "writing" });
|
|
904
|
+
expect(dataOf(placed, "p").recommended).toBe("individual");
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
it("an unconnected page renders the bound section's authored plans, no written card", async () => {
|
|
908
|
+
jest.spyOn(Date, "now").mockReturnValue(Date.now() + 10_000_000);
|
|
909
|
+
fetchMock.mockImplementation(async () => ({
|
|
910
|
+
ok: true,
|
|
911
|
+
status: 200,
|
|
912
|
+
json: async () => ({ ok: true, data: { status: "unconnected" } }),
|
|
913
|
+
}));
|
|
914
|
+
const fallback = { ...ENTERPRISE, key: "fallback" };
|
|
915
|
+
const sections = await pricingSections([bound({ plans: [fallback] })], {
|
|
916
|
+
plans: undefined,
|
|
917
|
+
plan: undefined,
|
|
918
|
+
locale: "en",
|
|
919
|
+
});
|
|
920
|
+
jest.restoreAllMocks();
|
|
921
|
+
const p = sections.find((s) => s.id === "p");
|
|
922
|
+
expect(p?.type === "pricing" && p.data.plans.map((c) => c.key)).toEqual(["fallback"]);
|
|
923
|
+
});
|
|
924
|
+
});
|
|
@@ -42,6 +42,9 @@ const PERIOD = lookupKeyPeriodSchema.enum;
|
|
|
42
42
|
|
|
43
43
|
type PricingSectionData = Extract<PageSection, { type: "pricing" }>["data"];
|
|
44
44
|
type PricingPlanCard = PricingSectionData["plans"][number];
|
|
45
|
+
type PricingPlanLevel = NonNullable<PricingPlanCard["levels"]>[number];
|
|
46
|
+
/** A bound section's level card, as the page writes it (#12174 D6). */
|
|
47
|
+
export type OfferingsLevelGroup = NonNullable<PricingSectionData["offeringGroups"]>[number];
|
|
45
48
|
/** `AddonCard` ignores `key`; it is carried so a tile names its `{plan}` too. */
|
|
46
49
|
type PricingAddonTile = NonNullable<PricingSectionData["addons"]>[number] & {
|
|
47
50
|
key: string;
|
|
@@ -431,10 +434,13 @@ function plansFragment(
|
|
|
431
434
|
return {
|
|
432
435
|
variant: "three-tiers-with-toggle",
|
|
433
436
|
cardLayout: "centered",
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
437
|
+
// #12174 D6 — a level priced both ways turns it on too.
|
|
438
|
+
billingToggle: cards.some((card) =>
|
|
439
|
+
[card, ...(card.levels ?? [])].some(
|
|
440
|
+
(shown) =>
|
|
441
|
+
shown.price.monthly !== undefined &&
|
|
442
|
+
shown.price.annual !== undefined,
|
|
443
|
+
),
|
|
438
444
|
),
|
|
439
445
|
plans: cards,
|
|
440
446
|
};
|
|
@@ -447,6 +453,7 @@ function plansFragment(
|
|
|
447
453
|
case "single-price-with-details":
|
|
448
454
|
return { variant: layout, plans: cards.slice(0, 1) };
|
|
449
455
|
case "features-and-plans": {
|
|
456
|
+
// A level card (#12174 D6) is never split: `product` is undefined then.
|
|
450
457
|
const split =
|
|
451
458
|
product && splitBlocks(product, cards[0]!, locale, labels);
|
|
452
459
|
const rows = product ? features(product) : [];
|
|
@@ -461,6 +468,67 @@ function plansFragment(
|
|
|
461
468
|
}
|
|
462
469
|
}
|
|
463
470
|
|
|
471
|
+
/** The card fields that change with the level (#12174 D3), as `card` has them. */
|
|
472
|
+
function levelOf(card: PricingPlanCard): Omit<PricingPlanLevel, "label" | "key"> {
|
|
473
|
+
const level: Omit<PricingPlanLevel, "label" | "key"> = {
|
|
474
|
+
price: card.price,
|
|
475
|
+
features: card.features,
|
|
476
|
+
cta: card.cta,
|
|
477
|
+
};
|
|
478
|
+
if (card.priceUnit !== undefined) level.priceUnit = card.priceUnit;
|
|
479
|
+
if (card.priceSubhead !== undefined) level.priceSubhead = card.priceSubhead;
|
|
480
|
+
if (card.annualPriceNote !== undefined)
|
|
481
|
+
level.annualPriceNote = card.annualPriceNote;
|
|
482
|
+
if (card.priceFootnote !== undefined) level.priceFootnote = card.priceFootnote;
|
|
483
|
+
if (card.priceFootnoteAnnualOnly !== undefined)
|
|
484
|
+
level.priceFootnoteAnnualOnly = card.priceFootnoteAnnualOnly;
|
|
485
|
+
if (card.annualCtaHref !== undefined) level.annualCtaHref = card.annualCtaHref;
|
|
486
|
+
return level;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* The level cards of a bound section's `offeringGroups` (#12174 D6), in the
|
|
491
|
+
* groups' order. Each level is its plan product's card as `planCard` builds
|
|
492
|
+
* it, trimmed to the level fields, labelled by the page; a level whose plan
|
|
493
|
+
* is not a shown plain plan (not shown, not a `plan`, a required product or a
|
|
494
|
+
* bundle) is dropped, and a group with no level left gives no card. The card
|
|
495
|
+
* takes the group's key, title and description — never a product's name or
|
|
496
|
+
* description — and the first level's fields as its own. It is highlighted
|
|
497
|
+
* when one of its levels sells the first recommended plan among the groups'.
|
|
498
|
+
*/
|
|
499
|
+
function levelCards(
|
|
500
|
+
groups: readonly OfferingsLevelGroup[],
|
|
501
|
+
planProducts: OfferingsProduct[],
|
|
502
|
+
locale: string,
|
|
503
|
+
labels: OfferingsPricingLabels,
|
|
504
|
+
): PricingPlanCard[] {
|
|
505
|
+
const byPlan = new Map(
|
|
506
|
+
planProducts.filter((p) => p.requires === undefined).map((p) => [p.plan, p]),
|
|
507
|
+
);
|
|
508
|
+
const grouped = groups.flatMap((group) =>
|
|
509
|
+
group.levels.flatMap((level) => byPlan.get(level.plan) ?? []),
|
|
510
|
+
);
|
|
511
|
+
const recommendedPlan = firstRecommended(grouped);
|
|
512
|
+
return groups.flatMap((group) => {
|
|
513
|
+
const levels: PricingPlanLevel[] = group.levels.flatMap((level) => {
|
|
514
|
+
const product = byPlan.get(level.plan);
|
|
515
|
+
const card = product && planCard(product, false, locale, labels);
|
|
516
|
+
return card ? [{ label: level.label, key: product.plan, ...levelOf(card) }] : [];
|
|
517
|
+
});
|
|
518
|
+
const first = levels[0];
|
|
519
|
+
if (!first) return [];
|
|
520
|
+
const { label: _label, key: _key, ...shown } = first;
|
|
521
|
+
const card: PricingPlanCard = { key: group.key, name: group.name, ...shown, levels };
|
|
522
|
+
if (group.description !== undefined) card.description = group.description;
|
|
523
|
+
if (group.levels.some((level) => level.plan === recommendedPlan)) {
|
|
524
|
+
card.highlighted = true;
|
|
525
|
+
card.highlightStyle = "pill";
|
|
526
|
+
card.highlightLabel = labels.recommended;
|
|
527
|
+
}
|
|
528
|
+
return [card];
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
|
|
464
532
|
function addonTile(
|
|
465
533
|
product: OfferingsProduct,
|
|
466
534
|
highlighted: boolean,
|
|
@@ -544,6 +612,10 @@ function narrowToPlans(
|
|
|
544
612
|
* `layout` (#12140 D3) frames the plans fragment for the variant a bound
|
|
545
613
|
* section names; the cards are built the same either way. Absent, the plans
|
|
546
614
|
* fragment is the toggle layout, exactly as before. Add-ons are unaffected.
|
|
615
|
+
*
|
|
616
|
+
* `levelGroups` (#12174 D6) makes the plan cards a bound section's level
|
|
617
|
+
* cards, one per group (`levelCards`), in place of one card per plan. Absent,
|
|
618
|
+
* the cards are built exactly as before.
|
|
547
619
|
*/
|
|
548
620
|
export function offeringsPricing(
|
|
549
621
|
shownSet: unknown,
|
|
@@ -553,6 +625,7 @@ export function offeringsPricing(
|
|
|
553
625
|
plans?: readonly string[] | undefined;
|
|
554
626
|
exclude?: readonly string[] | undefined;
|
|
555
627
|
layout?: OfferingsLayout | undefined;
|
|
628
|
+
levelGroups?: readonly OfferingsLevelGroup[] | undefined;
|
|
556
629
|
},
|
|
557
630
|
): OfferingsPricing | null {
|
|
558
631
|
const parsed = shownSetSchema.safeParse(shownSet);
|
|
@@ -580,25 +653,28 @@ export function offeringsPricing(
|
|
|
580
653
|
const recommendedPlan = firstRecommended(planProducts);
|
|
581
654
|
const recommendedAddon = firstRecommended(addonProducts);
|
|
582
655
|
|
|
583
|
-
const plans =
|
|
584
|
-
.
|
|
585
|
-
|
|
586
|
-
p
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
656
|
+
const plans = options.levelGroups
|
|
657
|
+
? levelCards(options.levelGroups, planProducts, locale, labels)
|
|
658
|
+
: planProducts
|
|
659
|
+
.map((p) => {
|
|
660
|
+
const required =
|
|
661
|
+
p.requires === undefined
|
|
662
|
+
? undefined
|
|
663
|
+
: offerings.find((o) => o.plan === p.requires);
|
|
664
|
+
if (p.requires !== undefined) {
|
|
665
|
+
return required ? bundleCard(p, required, p.plan === recommendedPlan, locale, labels) : null;
|
|
666
|
+
}
|
|
667
|
+
return planCard(p, p.plan === recommendedPlan, locale, labels);
|
|
668
|
+
})
|
|
669
|
+
.filter(isPresent);
|
|
595
670
|
const addons = addonProducts
|
|
596
671
|
.map((p) => addonTile(p, p.plan === recommendedAddon, locale, labels))
|
|
597
672
|
.filter(isPresent);
|
|
598
673
|
|
|
599
674
|
// Each card is keyed by its product's `{plan}`, so a lone card names its product.
|
|
675
|
+
// A level card's key is the group's, so it names no product (#12174 D6).
|
|
600
676
|
const product =
|
|
601
|
-
plans.length === 1
|
|
677
|
+
plans.length === 1 && !options.levelGroups
|
|
602
678
|
? planProducts.find((p) => p.plan === plans[0]!.key)
|
|
603
679
|
: undefined;
|
|
604
680
|
return {
|
|
@@ -222,6 +222,8 @@ const AUTHORED_COPY_FIELDS = [
|
|
|
222
222
|
// #12141 D9 — the plan bar's options, so a connected section keeps them.
|
|
223
223
|
"planBar",
|
|
224
224
|
"comparisonPlanBar",
|
|
225
|
+
// #12174 D2 — where a level card's switch sits.
|
|
226
|
+
"levelSwitchPlacement",
|
|
225
227
|
] as const satisfies readonly (keyof PricingData)[];
|
|
226
228
|
|
|
227
229
|
function authoredCopy(
|
|
@@ -283,10 +285,12 @@ function linksOfferingsCheckout(href: string | undefined): boolean {
|
|
|
283
285
|
|
|
284
286
|
type PricingPlan = PricingData["plans"][number];
|
|
285
287
|
|
|
288
|
+
/** Whether a card, or any of its levels (#12174 D7), links the Offerings checkout. */
|
|
286
289
|
function sellsOfferings(plan: PricingPlan): boolean {
|
|
287
|
-
return (
|
|
288
|
-
|
|
289
|
-
|
|
290
|
+
return [plan, ...(plan.levels ?? [])].some(
|
|
291
|
+
(shown) =>
|
|
292
|
+
linksOfferingsCheckout(shown.cta.href) ||
|
|
293
|
+
linksOfferingsCheckout(shown.annualCtaHref),
|
|
290
294
|
);
|
|
291
295
|
}
|
|
292
296
|
|
|
@@ -376,6 +380,18 @@ function isPlansSection(section: PageSection): section is PricingSection {
|
|
|
376
380
|
return isPricing(section) && section.data.variant !== "addons";
|
|
377
381
|
}
|
|
378
382
|
|
|
383
|
+
/**
|
|
384
|
+
* The Offerings plans a section names: its `offeringPlans`, else the plans of
|
|
385
|
+
* its `offeringGroups`' levels (#12174 D6), else none.
|
|
386
|
+
*/
|
|
387
|
+
function namedPlans(section: PricingSection): string[] | undefined {
|
|
388
|
+
const { offeringPlans, offeringGroups } = section.data;
|
|
389
|
+
return (
|
|
390
|
+
offeringPlans ??
|
|
391
|
+
offeringGroups?.flatMap((group) => group.levels.map((level) => level.plan))
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
|
|
379
395
|
/**
|
|
380
396
|
* Each plan group's Stripe plans fragment (#12103 D2), keyed by its section:
|
|
381
397
|
* `null` when none of the group's plans is shown.
|
|
@@ -394,6 +410,10 @@ export type OfferingsGroups = ReadonlyMap<PricingSection, PricingData | null>;
|
|
|
394
410
|
* its own `offeringPlans` else the page's `plans`: a plans section in the
|
|
395
411
|
* layout its `variant` names, an `addons` section to its add-on tiles. The
|
|
396
412
|
* plans a bound section lists are excluded from the page-level mapping.
|
|
413
|
+
*
|
|
414
|
+
* A bound section's `offeringGroups` (#12174 D6) narrow it to its levels'
|
|
415
|
+
* plans and map them as level cards (`offeringsPricing`'s `levelGroups`);
|
|
416
|
+
* those plans are excluded from the page-level mapping too.
|
|
397
417
|
*/
|
|
398
418
|
export function offeringsFragments(
|
|
399
419
|
declared: PageSection[],
|
|
@@ -410,9 +430,7 @@ export function offeringsFragments(
|
|
|
410
430
|
isUnbound(s) && isPlansSection(s) && s.data.offeringPlans !== undefined,
|
|
411
431
|
);
|
|
412
432
|
const bound = declared.filter(isBound);
|
|
413
|
-
const exclude = [...listed, ...bound].flatMap(
|
|
414
|
-
(s) => s.data.offeringPlans ?? [],
|
|
415
|
-
);
|
|
433
|
+
const exclude = [...listed, ...bound].flatMap((s) => namedPlans(s) ?? []);
|
|
416
434
|
const groups = new Map<PricingSection, PricingData | null>(
|
|
417
435
|
listed.map((section) => [
|
|
418
436
|
section,
|
|
@@ -424,12 +442,13 @@ export function offeringsFragments(
|
|
|
424
442
|
]),
|
|
425
443
|
);
|
|
426
444
|
for (const section of bound) {
|
|
427
|
-
const { variant,
|
|
445
|
+
const { variant, offeringGroups } = section.data;
|
|
428
446
|
const addons = variant === "addons";
|
|
429
447
|
const mapped = offeringsPricing(shownSet, {
|
|
430
448
|
locale,
|
|
431
449
|
labels,
|
|
432
|
-
plans:
|
|
450
|
+
plans: namedPlans(section) ?? plans,
|
|
451
|
+
...(offeringGroups ? { levelGroups: offeringGroups } : {}),
|
|
433
452
|
...(variant === "addons"
|
|
434
453
|
? {}
|
|
435
454
|
: { layout: variant ?? "three-tiers-with-toggle" }),
|
|
@@ -445,6 +464,63 @@ export function offeringsFragments(
|
|
|
445
464
|
return { pricing, groups };
|
|
446
465
|
}
|
|
447
466
|
|
|
467
|
+
/** The layouts that render every plan they are given (#12174 D7). */
|
|
468
|
+
const EVERY_PLAN_LAYOUTS: ReadonlySet<PricingData["variant"]> = new Set([
|
|
469
|
+
"three-tiers-with-toggle",
|
|
470
|
+
"with-comparison-table",
|
|
471
|
+
"band-hero",
|
|
472
|
+
] as const);
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* A bound section's `writtenPlans` that go in its grid (#12174 D7): none when
|
|
476
|
+
* its layout renders fewer plans than it is given (a hidden card would still
|
|
477
|
+
* publish an `Offer`), and never one that links the Offerings checkout.
|
|
478
|
+
*/
|
|
479
|
+
function writtenCards(section: PricingSection): PricingPlan[] {
|
|
480
|
+
const { writtenPlans, variant } = section.data;
|
|
481
|
+
if (!writtenPlans || !EVERY_PLAN_LAYOUTS.has(variant ?? "three-tiers-with-toggle"))
|
|
482
|
+
return [];
|
|
483
|
+
return writtenPlans.filter((plan) => !sellsOfferings(plan));
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* `fragment` with `section`'s written cards after its Offerings cards
|
|
488
|
+
* (#12174 D7). With no Offerings card (`fragment` null) the written cards
|
|
489
|
+
* stand alone in the section's layout, so it is not removed while one
|
|
490
|
+
* remains (#12174 decision 6); `null` when there is neither.
|
|
491
|
+
*/
|
|
492
|
+
function withWrittenCards(
|
|
493
|
+
section: PricingSection,
|
|
494
|
+
fragment: PricingData | null,
|
|
495
|
+
): PricingData | null {
|
|
496
|
+
const written = writtenCards(section);
|
|
497
|
+
if (written.length === 0) return fragment;
|
|
498
|
+
const variant = section.data.variant ?? "three-tiers-with-toggle";
|
|
499
|
+
const base: PricingData = fragment ?? {
|
|
500
|
+
variant,
|
|
501
|
+
cardLayout: "centered",
|
|
502
|
+
...(variant === "three-tiers-with-toggle" ? { billingToggle: false } : {}),
|
|
503
|
+
plans: [],
|
|
504
|
+
};
|
|
505
|
+
return { ...base, plans: [...base.plans, ...written] };
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* The key of the card `recommend` names: a card's own key, else the key of
|
|
510
|
+
* the level card one of whose levels sells that plan (#12174 decision 9, the
|
|
511
|
+
* recommender's landing `?plan=<plan>`); `recommend` itself when neither.
|
|
512
|
+
* Only an Offerings section's cards are mapped: a written section and the
|
|
513
|
+
* "as written" states keep #8842's match on a card's own key.
|
|
514
|
+
*/
|
|
515
|
+
function recommendedCard(plans: PricingPlan[], recommend: string): string {
|
|
516
|
+
const wanted = recommend.toLowerCase();
|
|
517
|
+
if (plans.some((card) => card.key?.toLowerCase() === wanted)) return recommend;
|
|
518
|
+
const seller = plans.find((card) =>
|
|
519
|
+
card.levels?.some((level) => level.key?.toLowerCase() === wanted),
|
|
520
|
+
);
|
|
521
|
+
return seller?.key ?? recommend;
|
|
522
|
+
}
|
|
523
|
+
|
|
448
524
|
/** What a bound section keeps from the page beside its copy (#12140 D6). */
|
|
449
525
|
const BOUND_KEPT_FIELDS = [
|
|
450
526
|
"source",
|
|
@@ -466,9 +542,11 @@ const BOUND_KEPT_FIELDS = [
|
|
|
466
542
|
function stripePlansSection(
|
|
467
543
|
slot: PricingSection | undefined,
|
|
468
544
|
fragment: PricingData,
|
|
469
|
-
|
|
545
|
+
named: string | undefined,
|
|
470
546
|
recommendedLabel: string,
|
|
471
547
|
): PricingSection {
|
|
548
|
+
const recommend =
|
|
549
|
+
named === undefined ? undefined : recommendedCard(fragment.plans, named);
|
|
472
550
|
const bound = slot !== undefined && isBound(slot);
|
|
473
551
|
const cardLayout = slot?.data.cardLayout ?? fragment.cardLayout;
|
|
474
552
|
const features = bound
|
|
@@ -595,7 +673,7 @@ export function withOfferings(
|
|
|
595
673
|
} as PricingData,
|
|
596
674
|
});
|
|
597
675
|
} else if (groups?.has(section)) {
|
|
598
|
-
const fragment = groups.get(section);
|
|
676
|
+
const fragment = withWrittenCards(section, groups.get(section) ?? null);
|
|
599
677
|
if (fragment) {
|
|
600
678
|
const group = stripePlansSection(
|
|
601
679
|
section,
|
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.76.0",
|
|
3
|
+
"@working-theory/admin-ui": "0.76.0",
|
|
4
|
+
"@working-theory/aeo": "0.76.0",
|
|
5
|
+
"@working-theory/agent-context": "0.76.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.76.0",
|
|
10
|
+
"@working-theory/api": "0.76.0",
|
|
11
|
+
"@working-theory/api-client": "0.76.0",
|
|
12
|
+
"@working-theory/auth": "0.76.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.76.0",
|
|
15
|
+
"@working-theory/common": "0.76.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.76.0",
|
|
18
|
+
"@working-theory/content-projection": "0.76.0",
|
|
19
|
+
"@working-theory/email": "0.76.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.76.0",
|
|
22
|
+
"@working-theory/fumadocs-schema": "0.76.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.76.0",
|
|
25
|
+
"@working-theory/license": "0.76.0",
|
|
26
|
+
"@working-theory/mcp-server": "0.76.0",
|
|
27
|
+
"@working-theory/metadata": "0.76.0",
|
|
28
|
+
"@working-theory/observability": "0.76.0",
|
|
29
|
+
"@working-theory/page-renderer": "0.76.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.16.
|
|
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.7.
|
|
51
|
-
"@working-theory/api-workspace": "0.18.
|
|
31
|
+
"@working-theory/schema": "0.76.0",
|
|
32
|
+
"@working-theory/schema-pack-registry": "0.76.0",
|
|
33
|
+
"@working-theory/schema-validator": "0.76.0",
|
|
34
|
+
"@working-theory/sections-registry": "0.76.0",
|
|
35
|
+
"@working-theory/site-config": "0.76.0",
|
|
36
|
+
"@working-theory/site-pages": "0.76.0",
|
|
37
|
+
"@working-theory/spoke-checkout": "0.7.32",
|
|
38
|
+
"@working-theory/stripe-client": "0.76.0",
|
|
39
|
+
"@working-theory/templates": "0.76.0",
|
|
40
|
+
"@working-theory/theme": "0.76.0",
|
|
41
|
+
"@working-theory/ui": "0.76.0",
|
|
42
|
+
"@working-theory/validation": "0.76.0",
|
|
43
|
+
"@working-theory/web-i18n": "0.76.0",
|
|
44
|
+
"@working-theory/admin": "0.26.0",
|
|
45
|
+
"@working-theory/api-commerce": "0.2.10",
|
|
46
|
+
"@working-theory/api-content-write": "0.16.2",
|
|
47
|
+
"@working-theory/api-hub": "0.9.0",
|
|
48
|
+
"@working-theory/api-multi-tenant": "0.5.2",
|
|
49
|
+
"@working-theory/api-scheduling": "0.6.15",
|
|
50
|
+
"@working-theory/api-signal-collectors": "0.7.5",
|
|
51
|
+
"@working-theory/api-workspace": "0.18.2",
|
|
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.17",
|
|
57
|
+
"@working-theory/mcp-signal-collectors": "0.2.30",
|
|
58
|
+
"@working-theory/mcp-workspace": "0.16.2",
|
|
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.76.0",
|
|
62
|
+
"@working-theory/ui-docs-blog": "0.76.0",
|
|
63
|
+
"@working-theory/ui-scheduling": "0.76.0",
|
|
64
|
+
"@working-theory/ui-signal-collectors": "0.76.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.76.0"
|
|
69
69
|
}
|