@owlmeans/web-payment 0.1.18-rc.2 → 0.1.18-rc.21
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/README.md +30 -1
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/web-payment/SKILL.md +287 -20
- package/build/@/components/ui/card.d.ts +10 -0
- package/build/@/components/ui/card.d.ts.map +1 -0
- package/build/@/components/ui/card.js +25 -0
- package/build/@/components/ui/card.js.map +1 -0
- package/build/@/components/ui/checkbox.d.ts +5 -0
- package/build/@/components/ui/checkbox.d.ts.map +1 -0
- package/build/@/components/ui/checkbox.js +6 -0
- package/build/@/components/ui/checkbox.js.map +1 -0
- package/build/@/components/ui/progress.d.ts +5 -0
- package/build/@/components/ui/progress.d.ts.map +1 -0
- package/build/@/components/ui/progress.js +11 -0
- package/build/@/components/ui/progress.js.map +1 -0
- package/build/@/components/ui/select.d.ts +8 -0
- package/build/@/components/ui/select.d.ts.map +1 -0
- package/build/@/components/ui/select.js +9 -0
- package/build/@/components/ui/select.js.map +1 -0
- package/build/capability-list.d.ts +7 -0
- package/build/capability-list.d.ts.map +1 -0
- package/build/capability-list.js +24 -0
- package/build/capability-list.js.map +1 -0
- package/build/checkout-limit.d.ts +11 -0
- package/build/checkout-limit.d.ts.map +1 -0
- package/build/checkout-limit.js +34 -0
- package/build/checkout-limit.js.map +1 -0
- package/build/consumer/cancellation.d.ts +20 -0
- package/build/consumer/cancellation.d.ts.map +1 -0
- package/build/consumer/cancellation.js +115 -0
- package/build/consumer/cancellation.js.map +1 -0
- package/build/consumer/copy.d.ts +23 -0
- package/build/consumer/copy.d.ts.map +1 -0
- package/build/consumer/copy.js +75 -0
- package/build/consumer/copy.js.map +1 -0
- package/build/consumer/ensure.d.ts +56 -0
- package/build/consumer/ensure.d.ts.map +1 -0
- package/build/consumer/ensure.js +71 -0
- package/build/consumer/ensure.js.map +1 -0
- package/build/consumer/fields.d.ts +43 -0
- package/build/consumer/fields.d.ts.map +1 -0
- package/build/consumer/fields.js +19 -0
- package/build/consumer/fields.js.map +1 -0
- package/build/consumer/hooks.d.ts +113 -0
- package/build/consumer/hooks.d.ts.map +1 -0
- package/build/consumer/hooks.js +225 -0
- package/build/consumer/hooks.js.map +1 -0
- package/build/consumer/index.d.ts +14 -0
- package/build/consumer/index.d.ts.map +1 -0
- package/build/consumer/index.js +12 -0
- package/build/consumer/index.js.map +1 -0
- package/build/consumer/legal.d.ts +53 -0
- package/build/consumer/legal.d.ts.map +1 -0
- package/build/consumer/legal.js +77 -0
- package/build/consumer/legal.js.map +1 -0
- package/build/consumer/performance-consent-dialog.d.ts +18 -0
- package/build/consumer/performance-consent-dialog.d.ts.map +1 -0
- package/build/consumer/performance-consent-dialog.js +71 -0
- package/build/consumer/performance-consent-dialog.js.map +1 -0
- package/build/consumer/provider.d.ts +33 -0
- package/build/consumer/provider.d.ts.map +1 -0
- package/build/consumer/provider.js +26 -0
- package/build/consumer/provider.js.map +1 -0
- package/build/consumer/refusal.d.ts +35 -0
- package/build/consumer/refusal.d.ts.map +1 -0
- package/build/consumer/refusal.js +98 -0
- package/build/consumer/refusal.js.map +1 -0
- package/build/consumer/subscription-start-dialog.d.ts +16 -0
- package/build/consumer/subscription-start-dialog.d.ts.map +1 -0
- package/build/consumer/subscription-start-dialog.js +43 -0
- package/build/consumer/subscription-start-dialog.js.map +1 -0
- package/build/consumer/types.d.ts +114 -0
- package/build/consumer/types.d.ts.map +1 -0
- package/build/consumer/types.js +2 -0
- package/build/consumer/types.js.map +1 -0
- package/build/consumer/withdrawal.d.ts +29 -0
- package/build/consumer/withdrawal.d.ts.map +1 -0
- package/build/consumer/withdrawal.js +140 -0
- package/build/consumer/withdrawal.js.map +1 -0
- package/build/copy.d.ts +14 -0
- package/build/copy.d.ts.map +1 -0
- package/build/copy.js +51 -0
- package/build/copy.js.map +1 -0
- package/build/dialog.d.ts +1 -1
- package/build/dialog.d.ts.map +1 -1
- package/build/dialog.js +46 -17
- package/build/dialog.js.map +1 -1
- package/build/entitlement.d.ts +26 -0
- package/build/entitlement.d.ts.map +1 -0
- package/build/entitlement.js +42 -0
- package/build/entitlement.js.map +1 -0
- package/build/estimate-cache.d.ts +14 -0
- package/build/estimate-cache.d.ts.map +1 -0
- package/build/estimate-cache.js +39 -0
- package/build/estimate-cache.js.map +1 -0
- package/build/estimate-summary.d.ts +64 -0
- package/build/estimate-summary.d.ts.map +1 -0
- package/build/estimate-summary.js +94 -0
- package/build/estimate-summary.js.map +1 -0
- package/build/estimate.d.ts +34 -0
- package/build/estimate.d.ts.map +1 -0
- package/build/estimate.js +92 -0
- package/build/estimate.js.map +1 -0
- package/build/format.d.ts +15 -0
- package/build/format.d.ts.map +1 -0
- package/build/format.js +68 -0
- package/build/format.js.map +1 -0
- package/build/hooks.d.ts +0 -4
- package/build/hooks.d.ts.map +1 -1
- package/build/hooks.js +3 -30
- package/build/hooks.js.map +1 -1
- package/build/i18n/be.json +1 -1
- package/build/i18n/de.json +1 -1
- package/build/i18n/en.json +1 -1
- package/build/i18n/es.json +1 -1
- package/build/i18n/fr.json +145 -0
- package/build/i18n/pl.json +1 -1
- package/build/i18n/ru.json +1 -1
- package/build/i18n/uk.json +1 -1
- package/build/i18n.d.ts +2 -1
- package/build/i18n.d.ts.map +1 -1
- package/build/i18n.js +11 -7
- package/build/i18n.js.map +1 -1
- package/build/index.d.ts +9 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +9 -0
- package/build/index.js.map +1 -1
- package/build/limit-meter.d.ts +7 -0
- package/build/limit-meter.d.ts.map +1 -0
- package/build/limit-meter.js +26 -0
- package/build/limit-meter.js.map +1 -0
- package/build/plan-card.d.ts +7 -0
- package/build/plan-card.d.ts.map +1 -0
- package/build/plan-card.js +29 -0
- package/build/plan-card.js.map +1 -0
- package/build/poll.d.ts +7 -0
- package/build/poll.d.ts.map +1 -0
- package/build/poll.js +28 -0
- package/build/poll.js.map +1 -0
- package/build/selectors.d.ts +18 -0
- package/build/selectors.d.ts.map +1 -0
- package/build/selectors.js +78 -0
- package/build/selectors.js.map +1 -0
- package/build/types.d.ts +120 -2
- package/build/types.d.ts.map +1 -1
- package/package.json +22 -7
- package/src/@/components/ui/card.tsx +93 -0
- package/src/@/components/ui/checkbox.tsx +23 -0
- package/src/@/components/ui/progress.tsx +44 -0
- package/src/@/components/ui/select.tsx +62 -0
- package/src/@/globals.css +10 -0
- package/src/capability-list.tsx +50 -0
- package/src/checkout-limit.tsx +48 -0
- package/src/consumer/cancellation.tsx +214 -0
- package/src/consumer/copy.ts +93 -0
- package/src/consumer/ensure.ts +124 -0
- package/src/consumer/fields.tsx +89 -0
- package/src/consumer/hooks.ts +358 -0
- package/src/consumer/index.ts +13 -0
- package/src/consumer/legal.tsx +129 -0
- package/src/consumer/performance-consent-dialog.tsx +132 -0
- package/src/consumer/provider.tsx +49 -0
- package/src/consumer/refusal.ts +110 -0
- package/src/consumer/subscription-start-dialog.tsx +87 -0
- package/src/consumer/types.ts +121 -0
- package/src/consumer/withdrawal.tsx +279 -0
- package/src/copy.tsx +62 -0
- package/src/dialog.tsx +58 -25
- package/src/entitlement.ts +56 -0
- package/src/estimate-cache.ts +40 -0
- package/src/estimate-summary.tsx +172 -0
- package/src/estimate.ts +119 -0
- package/src/format.ts +71 -0
- package/src/hooks.ts +3 -35
- package/src/i18n/be.json +1 -1
- package/src/i18n/de.json +1 -1
- package/src/i18n/en.json +1 -1
- package/src/i18n/es.json +1 -1
- package/src/i18n/fr.json +145 -0
- package/src/i18n/pl.json +1 -1
- package/src/i18n/ru.json +1 -1
- package/src/i18n/uk.json +1 -1
- package/src/i18n.ts +12 -7
- package/src/index.ts +9 -0
- package/src/limit-meter.tsx +55 -0
- package/src/plan-card.tsx +67 -0
- package/src/poll.ts +27 -0
- package/src/selectors.ts +93 -0
- package/src/types.ts +142 -2
- package/tests/consent-refusal.spec.ts +83 -0
- package/tests/consumer-hooks.spec.ts +205 -0
- package/tests/consumer.spec.ts +343 -0
- package/tests/context.ts +9 -0
- package/tests/dialog.spec.ts +49 -0
- package/tests/entitlement.spec.ts +117 -0
- package/tests/estimate-cache.spec.ts +46 -0
- package/tests/harness/consumer-fixtures.ts +105 -0
- package/tests/harness/consumer.tsx +197 -0
- package/tests/harness/entitlement.tsx +159 -0
- package/tests/harness/estimate-fixtures.ts +48 -0
- package/tests/harness/mount.tsx +19 -3
- package/tests/i18n.spec.ts +78 -8
- package/tests/pieces.spec.ts +134 -0
package/README.md
CHANGED
|
@@ -28,6 +28,35 @@ Checkout redirects the current window by default; pass `useCheckout('_blank')` o
|
|
|
28
28
|
is intentional. The dialog uses the consumer's `@/components/ui/*` primitives, semantic theme
|
|
29
29
|
tokens, integer minor units, and the packaged seven-language `web-payment` resource.
|
|
30
30
|
|
|
31
|
+
## Entitlements
|
|
32
|
+
|
|
33
|
+
`useEntitlementView(ctx.entrypoint(account.entitlements))` polls a served `EntitlementView` and
|
|
34
|
+
revives its ISO dates; `null` means "not known yet", so render paid controls disabled until it
|
|
35
|
+
answers. Read it with `useCapability(view, param)` (`boolean | null`) and `useLimit(view, key)`
|
|
36
|
+
(the limit row plus `exhausted` and a `ratio` clamped to `[0, 1]`). An application that keeps the
|
|
37
|
+
view in its own store uses the pure selectors instead — `capabilityStateOf`, `limitStatusOf`,
|
|
38
|
+
`planStatusLineOf`, `promoInscriptionOf` — and never polls a second time.
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
const view = useEntitlementView(ctx.entrypoint(account.entitlements))
|
|
42
|
+
const seats = useLimit(view, 'seats')
|
|
43
|
+
const { portal, pending } = usePortal(PortalFlow.Change)
|
|
44
|
+
|
|
45
|
+
{view != null && <>
|
|
46
|
+
<PlanCard plan={view.plan} offer={{ sku: 'pro-monthly', title: 'Pro', priceLabel: '$20 / month' }}
|
|
47
|
+
actionLabel="Change plan" pending={pending}
|
|
48
|
+
onAction={planSku => portal(ctx.entrypoint(account.portal), { body: { planSku } })} />
|
|
49
|
+
{seats != null && <LimitMeter limit={seats} label="Seats" />}
|
|
50
|
+
<CapabilityList capabilities={view.capabilities} labels={{ 'feature:whitelabel': 'White label' }} />
|
|
51
|
+
</>}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`usePortal(flow)` sets `body.flow` on a protocol whose body is a `PortalLinkBody` and sends the
|
|
55
|
+
browser to the returned URL. The pieces take data and callbacks only: titles, prices, labels and
|
|
56
|
+
action copy come from the application; status lines, "N of M", reset dates and promo inscriptions
|
|
57
|
+
come from the packaged `entitlement` strings. They import `@/components/ui/{card,progress,button}`,
|
|
58
|
+
so the consumer provides those primitives and `@radix-ui/react-progress`.
|
|
59
|
+
|
|
31
60
|
<!-- owlmeans:agent-guidance:start -->
|
|
32
61
|
## Agent guidance
|
|
33
62
|
|
|
@@ -36,7 +65,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
36
65
|
your project's skill store (`.agents/skills/`):
|
|
37
66
|
|
|
38
67
|
```sh
|
|
39
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
68
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.38
|
|
40
69
|
```
|
|
41
70
|
|
|
42
71
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/web-payment",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-09-
|
|
4
|
+
"version": "0.1.18-rc.21",
|
|
5
|
+
"generatedAt": "2026-09-23T19:57:40.696Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: web-payment
|
|
3
|
-
description: Public React payment UI for OwlMeans web apps — protocol-bound checkout/balance hooks, same-window redirects, entitlement helpers and the
|
|
3
|
+
description: Public React payment UI for OwlMeans web apps — protocol-bound checkout/balance hooks, same-window redirects, entitlement helpers, the themed AmountCheckoutDialog with its per-entity checkout limit, the locked-country price estimate, and the EU consumer-rights pieces of the ./consumer subpath (spend consent, subscription start, withdrawal and cancellation functions, the consent gate). Use when building payment UI with @owlmeans/web-payment.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
7
7
|
|
|
8
8
|
# @owlmeans/web-payment
|
|
9
9
|
|
|
10
|
+
**Install:** `bun add @owlmeans/web-payment@^0.1.18-rc.21`
|
|
11
|
+
|
|
10
12
|
Public MIT web package paired with `@owlmeans/server-payment`. It incorporates checkout, balance,
|
|
11
|
-
entitlement and shallow-auth helpers over the underlying `@owlmeans/client-payment` service
|
|
13
|
+
entitlement and shallow-auth helpers over the underlying `@owlmeans/client-payment` service, plus
|
|
14
|
+
presentational pieces over the entitlement view of `@owlmeans/payment` (the model itself is the
|
|
15
|
+
`entitlements` skill), and — on the `./consumer` subpath — the consumer-rights pieces over
|
|
16
|
+
`@owlmeans/payment`'s consumer-rights contracts and legal copy (the `payment` skill).
|
|
17
|
+
|
|
18
|
+
## Protocol-bound hooks
|
|
12
19
|
|
|
13
20
|
Hooks accept `RegisteredEntrypoint<Request, Response>` values. Pass `ctx.entrypoint(protocol)`;
|
|
14
|
-
never weaken a protocol to a home-grown callable type or recover its I/O with a generic.
|
|
21
|
+
never weaken a protocol to a home-grown callable type or recover its I/O with a generic. Call
|
|
15
22
|
arguments use the protocol's `CallArguments`, so a required body cannot be omitted by the hook.
|
|
16
23
|
|
|
17
24
|
```typescript
|
|
@@ -19,30 +26,290 @@ const { checkout, pending } = useCheckout() // same-window by default
|
|
|
19
26
|
await checkout(ctx.entrypoint(account.topUp), { body: { amountMinor } })
|
|
20
27
|
```
|
|
21
28
|
|
|
22
|
-
`useCheckout('_blank')` is the explicit new-tab variant. `openCheckout(url)` defaults to
|
|
23
|
-
`window.location.assign`; both are inert when no DOM exists.
|
|
24
|
-
`
|
|
25
|
-
|
|
29
|
+
- `useCheckout('_blank')` is the explicit new-tab variant. `openCheckout(url)` defaults to
|
|
30
|
+
`window.location.assign`; both are inert when no DOM exists.
|
|
31
|
+
- `usePaymentBalance(entry, intervalMs?, deps?)` polls one protocol and keeps the last good answer;
|
|
32
|
+
a failed poll is swallowed, because explicit actions own their errors.
|
|
33
|
+
|
|
34
|
+
## Entitlement hooks — `null` means unknown
|
|
35
|
+
|
|
36
|
+
| Hook | Answers |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `useEntitlementView(entry, intervalMs = 60_000, deps = [], ...request)` | The polled `EntitlementView`, revived (`reviveEntitlementView`) so every date is a `Date`; `null` until the first answer. Trailing `request` arguments are the protocol's `CallArguments`. |
|
|
39
|
+
| `useCapability(view, param)` | `boolean \| null` — the capability predicate over granted rows; `null` for a null view. |
|
|
40
|
+
| `useLimit(view, key)` | `LimitStatus \| null` — the `LimitView` plus `exhausted` and `ratio`; `null` for a null view or an undeclared key. |
|
|
41
|
+
| `usePortal(flow, target = '_self')` | `{ portal(entry, request?), pending }` — calls a protocol whose body is a `PortalLinkBody` with `body.flow = flow`, then `openCheckout(url, target)`. The caller's arguments omit `flow` (a compile error otherwise); navigation is inert without a DOM. |
|
|
42
|
+
|
|
43
|
+
- **`null` renders paid controls disabled**, never enabled-then-refused. A `false` is an answer;
|
|
44
|
+
`null` is the absence of one.
|
|
45
|
+
- **One poller per view.** An application that keeps the view in its own store (fed once, refreshed
|
|
46
|
+
after the actions that change it) reads it through the pure selectors, not a second
|
|
47
|
+
`useEntitlementView`.
|
|
48
|
+
- Anything read off a view fetched some other way must be revived before a date is used.
|
|
49
|
+
|
|
50
|
+
## Pure selectors
|
|
51
|
+
|
|
52
|
+
| Selector | Returns |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `capabilityStateOf(view, param)` | `boolean \| null` — what `useCapability` memoizes |
|
|
55
|
+
| `limitStatusOf(limitView)` | `LimitStatus \| null` — `exhausted = remaining < 1` (a `limit: 0` row is exhausted); `ratio = used / limit` clamped to `[0, 1]`, and for a `0` ceiling `1` once anything is used, else `0` |
|
|
56
|
+
| `planStatusLineOf(planView)` | `{ kind, tone, date? }` — first match: `created`/`canceled`/`expired`/`ended` (inactive), `blocked` (critical), `paused` (a `pausedAt`, warning), `suspended` (critical), `trial` (`trialEnd`), `past-due` (warning), `cancel-scheduled` (`periodEnd`, warning), `free`, `renews` (`periodEnd`), `active` |
|
|
57
|
+
| `promoInscriptionOf(promoView)` | `'free-until'` (active, not grandfathered) · `'grandfathered'` (active, grandfathered) · `'ended'` (inactive) · `null` |
|
|
58
|
+
|
|
59
|
+
Use these, plus `capabilityOf` / `limitOf` / `hasLimitRoom` from `@owlmeans/payment`, wherever the
|
|
60
|
+
browser decides something; the server gate uses the same predicates, so a disabled button and a
|
|
61
|
+
403 cannot disagree.
|
|
62
|
+
|
|
63
|
+
## Pieces
|
|
64
|
+
|
|
65
|
+
Pieces take data and callbacks only — no protocol calls, no product copy (titles, prices, labels
|
|
66
|
+
and action text come from the application). Every one accepts `className`.
|
|
67
|
+
|
|
68
|
+
| Piece | Props | Renders |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| `PlanCard` | `plan: EntitlementPlanView`, `offer?: { sku, title, priceLabel, highlight? }`, `current?`, `pending?`, `actionLabel?`, `onAction?(sku)`, `children?` | Title; the status line (with a tone dot) for the entity's own plan, or for an offer only when it is current; a "Current plan" badge; `priceLabel`; children; one action button (outline when current, disabled while `pending`). `current` defaults to `offer.sku === plan.sku`. |
|
|
71
|
+
| `LimitMeter` | `limit: LimitView`, `label`, `showReset? = true`, `compact?` | `used of limit` (with `unit`), a `Progress` bar, "Limit reached" when exhausted, "Resets on …" for a window limit, the promo inscription. `limit: 0` reads "Not included" and draws no bar. |
|
|
72
|
+
| `CapabilityList` | `capabilities: CapabilityView[]`, `labels: Record<param, string>`, `onlyGranted?` | One row per labelled param in view order (duplicate params collapse, granted wins); unlabelled rows are not rendered; ungranted rows are muted; promo inscription under the label. |
|
|
73
|
+
| `CheckoutLimitNote` | `limit: CheckoutLimitView \| null`, `reasonLabel?: string \| (reason) => string` | Nothing for `null` or a limit that narrowed nothing; else "You can add up to {max} right now" (or "You cannot add credits right now" when `blocked`), the reason's sentence (`per-purchase`, `window`, `hold`, any other → generic; `reasonLabel` replaces it) and "More becomes available on {resetsAt}" (UTC, to the minute). |
|
|
74
|
+
|
|
75
|
+
- **Stable selectors** for tests and styling: `[data-plan-card]` with `data-plan-sku`,
|
|
76
|
+
`data-plan-status` (the line kind), `data-plan-tone`, `data-current`; `[data-plan-status-line]`,
|
|
77
|
+
`[data-plan-current]`, `[data-plan-price]`; `[data-limit-meter]` with `data-limit-key`,
|
|
78
|
+
`data-limit-kind`, `data-included`, `data-exhausted`, and `[data-limit-usage]`,
|
|
79
|
+
`[data-limit-resets]`, `[data-limit-exhausted]`; `[data-capability-list]`, `[data-capability]`
|
|
80
|
+
with `data-granted`; `[data-promo]` carrying the inscription kind; `[data-checkout-limit]` with
|
|
81
|
+
`data-max-minor`, `data-blocked` (`"true"`/`"false"`), `data-reason`, `data-resets-at` (ISO).
|
|
82
|
+
- **Dates render as calendar UTC days** (`dateStyle: 'medium'`) in the current language — the
|
|
83
|
+
calendar limit windows count in, so a reset date names the day the counter rolls.
|
|
84
|
+
- Promo copy: "Free until {{date}}", "Included for your plan", "Promotion ended".
|
|
26
85
|
|
|
27
86
|
## AmountCheckoutDialog
|
|
28
87
|
|
|
29
|
-
The dialog takes `{ open, onOpenChange, policy, pending, onConfirm
|
|
30
|
-
accepts locale decimal separators and at most two decimals, shows
|
|
31
|
-
input, and reports below/above-bound errors without clamping.
|
|
32
|
-
or pending.
|
|
88
|
+
The dialog takes `{ open, onOpenChange, policy, pending, onConfirm, estimate?, limit?, legalNote? }`.
|
|
89
|
+
It keeps integer minor units, accepts locale decimal separators and at most two decimals, shows
|
|
90
|
+
configured presets plus custom input, and reports below/above-bound errors without clamping.
|
|
91
|
+
Confirmation is disabled when invalid or pending.
|
|
92
|
+
|
|
93
|
+
It shows net credit value, processing adjustment and pre-tax subtotal from `chargeAmountMinor`.
|
|
94
|
+
With no `estimate`, the plain note that Stripe calculates applicable tax; with one, `PriceEstimateSummary`
|
|
95
|
+
renders instead (see below) against the SAME `chargeMinor`, so the country picker and its numbers
|
|
96
|
+
track whatever the buyer has typed. The policy maximum bounds net credit, not the adjusted or
|
|
97
|
+
tax-inclusive debit.
|
|
98
|
+
|
|
99
|
+
- **`limit`** (`AmountPolicyView.limit`, what the entity may buy NOW) narrows `policy` through
|
|
100
|
+
`@owlmeans/payment`'s `narrowAmountPolicy` — the same computation the server refuses with
|
|
101
|
+
(`CheckoutLimitExceeded`), so the control and a refusal cannot disagree. Presets above the
|
|
102
|
+
maximum disappear, the default is clamped, the above-bound error names the narrowed maximum
|
|
103
|
+
("The most you can add right now is …"), and a `CheckoutLimitNote` shows above the presets.
|
|
104
|
+
`policy` may be the plan's or one already narrowed (`AmountPolicyView.policy`) — narrowing is
|
|
105
|
+
idempotent. **`blocked`** disables the presets, the input and the confirm button; the pinned
|
|
106
|
+
policy `narrowAmountPolicy` returns for a block is never an offer of the minimum.
|
|
107
|
+
- **`legalNote`** is a slot right above the buttons for the application's legal line (the EU
|
|
108
|
+
withdrawal note of a top-up, terms links) — `[data-legal-note]`.
|
|
109
|
+
- Selectors: `[data-amount-checkout]` (`data-blocked`), `[data-amount-preset="<minor>"]`,
|
|
110
|
+
`[data-amount-confirm]`.
|
|
111
|
+
|
|
112
|
+
## Price estimate: a live tax/currency read for any amount
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
// self-contained (one estimate, its own picker) — the credit dialog:
|
|
116
|
+
const estimate = usePriceEstimate(ctx.entrypoint(account.priceEstimate), { enabled: dialogOpen })
|
|
117
|
+
<AmountCheckoutDialog … estimate={estimate} />
|
|
118
|
+
<PriceEstimateSummary control={estimate} subtotalMinor={planPriceMinor} currency="usd" />
|
|
119
|
+
|
|
120
|
+
// shared (one picker, several estimates) — a plan comparison table:
|
|
121
|
+
const [country, setCountry] = useState('')
|
|
122
|
+
const pro = usePriceEstimate(entry, { enabled, country, onCountryChange: setCountry }, { body: { planSku: 'pro' } })
|
|
123
|
+
const team = usePriceEstimate(entry, { enabled, country, onCountryChange: setCountry }, { body: { planSku: 'team' } })
|
|
124
|
+
<CountrySelect value={country} onChange={setCountry} disabled={pro.locked} /> {/* rendered ONCE */}
|
|
125
|
+
<PriceEstimateAmount control={pro} subtotalMinor={proPriceMinor} currency="usd" /> {/* per offer */}
|
|
126
|
+
<PriceEstimateAmount control={team} subtotalMinor={teamPriceMinor} currency="usd" />
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- **`usePriceEstimate(entry, { enabled, ttlMs?, country?, onCountryChange? }, ...request)`** calls a
|
|
130
|
+
`PriceEstimateBody` protocol (`@owlmeans/payment`'s `PriceEstimate` response) only while `enabled`,
|
|
131
|
+
and again whenever the country changes — a closed dialog costs nothing. A module-level client
|
|
132
|
+
cache (keyed by the entry's alias, the request body and the country; default TTL 5 min) shares an
|
|
133
|
+
answer across every mounted instance and never caches a rejected fetch. The caller's `request`
|
|
134
|
+
omits `body.country` — the hook owns it — the same way `usePortal`'s omits `flow`.
|
|
135
|
+
- **Uncontrolled** (no `opts.country`): the hook owns the country itself, and the first answer
|
|
136
|
+
whose `source` is `'customer'` preselects it, once.
|
|
137
|
+
- **Controlled** (`opts.country` given): the caller owns the country — several `usePriceEstimate`
|
|
138
|
+
calls can share ONE value (a plan comparison table, one picker, one estimate per offer); the
|
|
139
|
+
hook never preselects on its own, and the returned control's `onCountryChange` calls
|
|
140
|
+
`opts.onCountryChange` instead of an internal setter.
|
|
141
|
+
- **Locked** (an answer with `locked: true` or `source: 'profile'` — the entity's billing country
|
|
142
|
+
fixed by its first purchase): the hook adopts that country over any pick (controlled: through
|
|
143
|
+
`opts.onCountryChange`, once), returns `locked: true`, and ignores `onCountryChange` from then
|
|
144
|
+
on (`isLockedAnswer(estimate)`).
|
|
145
|
+
- **`CountrySelect({ value, onChange, label?, id?, className?, disabled?, note? })`** is the picker
|
|
146
|
+
alone — `Intl.DisplayNames` + `Intl.Collator` over `@owlmeans/payment`'s `COUNTRY_CODES`, so it
|
|
147
|
+
lists the buyer's language's own country names. Render it once and drive every estimate that
|
|
148
|
+
shares it. `disabled` (a locked country) disables it; `note` is a line under it. Selectors
|
|
149
|
+
`[data-country-select]` with `data-locked` and `data-country`, `[data-country-note]`.
|
|
150
|
+
- **`PriceEstimateAmount({ control, subtotalMinor, currency, suffix?, className? })`** is the
|
|
151
|
+
numbers alone, no picker: via `estimateOf` re-derived against `subtotalMinor`, a rate row for a
|
|
152
|
+
`taxed` status, an estimated total, and one sentence for every status that leaves no number to
|
|
153
|
+
trust (reverse charge, no tax, "at checkout", "choose a country"). `data-price-estimate` /
|
|
154
|
+
`data-status` are stable test hooks.
|
|
155
|
+
- When the estimate carries `local` (Adaptive Pricing found the country's currency), the tax and
|
|
156
|
+
total show ONLY in that currency, each marked `≈` — never both currencies at once, which would
|
|
157
|
+
read as two different prices for the same line. A short note explains the amount is converted
|
|
158
|
+
at Stripe's current rate and confirmed at checkout. With no `local`, the amounts show in
|
|
159
|
+
`currency` (the integration currency) with no `≈` and no note.
|
|
160
|
+
- **`PriceEstimateSummary`** is `CountrySelect` bound to the control's own `country`/
|
|
161
|
+
`onCountryChange` followed by `PriceEstimateAmount` — the one-estimate composition. A `locked`
|
|
162
|
+
control renders the picker disabled with the "set by your first purchase" note. Building a
|
|
163
|
+
shared picker composes the two pieces separately instead, one `PriceEstimateAmount` per estimate.
|
|
164
|
+
|
|
165
|
+
## `./consumer` — the EU consumer-rights pieces
|
|
166
|
+
|
|
167
|
+
`import { … } from '@owlmeans/web-payment/consumer'` — a separate subpath, so an application that
|
|
168
|
+
never renders them needs neither their checkbox primitive nor its peer. Legal text comes from
|
|
169
|
+
`@owlmeans/payment`'s `payment-consumer-rights` copy (`consumerText`, `legalLabelsOf`,
|
|
170
|
+
`consentStatementOf` render the same strings the server records and mails); the interface text
|
|
171
|
+
comes from this package's `web-payment` resource. Neither carries product copy: the trader, the
|
|
172
|
+
plan title and the price line are the view's or the application's.
|
|
173
|
+
|
|
174
|
+
**The language rule.** A consent or statutory function is shown in the CONTRACT language — the
|
|
175
|
+
billing country's (`view.language`, `list.language`, the `language` prop) — with a toggle to the
|
|
176
|
+
interface language and back (`useShownLanguage`, `LanguageToggle`). The whole piece switches: the
|
|
177
|
+
legal copy through `legalTextOf(lng)`, the interface strings through `paymentTextOf(lng)` (both
|
|
178
|
+
read any language without i18next and without draining a bundle — `resolveI18nResource`), dates
|
|
179
|
+
and amounts through `Intl` in that language. The toggle alone is phrased in the INTERFACE language
|
|
180
|
+
("Show in German") — the reader who needs it reads that one. The links follow the shown language
|
|
181
|
+
(`links` prop: a record by language or a function such as `lng => linksOf(policy, lng)`; absent,
|
|
182
|
+
the view's own). What a person agrees to is what was on screen: toggling un-ticks the checkbox, and
|
|
183
|
+
the recorded body names the language shown.
|
|
184
|
+
|
|
185
|
+
| Piece | Props | Behaviour |
|
|
186
|
+
|---|---|---|
|
|
187
|
+
| `PerformanceConsentDialog` | `open, onOpenChange, view: PerformanceConsentView \| null, onConfirm(body: PerformanceConsentBody), onDecline?, uiLanguage?, pending?, error?, links?, onWithdraw?, formatAmount?` | Title and intro (count, last deadline), the purchases with date, amount and last withdrawal day (`performance-consent.purchase`), ONE checkbox carrying the whole statement (`performance-consent.checkbox` with `view.trader`), **unchecked by default**; confirm ("Start now" / "Jetzt beginnen" …) disabled until it is ticked; decline ("Not now"); links Billing Terms · Withdrawal information · the withdrawal function (a button when `onWithdraw`, else the links' `withdrawalFunction` page). `onConfirm` gets `{ purchaseIds, textVersion, language: <shown>, acknowledged: true, uiLanguage }`. |
|
|
188
|
+
| `SubscriptionStartDialog` | `open, onOpenChange, view: SubscriptionStartView \| null, planTitle, price?: ReactNode, onConfirm(body: SubscriptionStartBody), onDecline?, uiLanguage?, pending?, error?, links?, onWithdraw?` | The same shape before a subscription checkout; confirm is "Continue to payment" — the step before the paygate's own order button. |
|
|
189
|
+
| `WithdrawalFunctionButton` | `language, onClick, uiLanguage?, disabled?, variant? = 'outline'` | The statutory entry ("Withdraw from contract here", "Vertrag widerrufen", "Renoncer au contrat ici", "Odstąp od umowy tutaj") in the contract language; the interface language's label as `title` when they differ. |
|
|
190
|
+
| `WithdrawalForm` / `WithdrawalDialog` | `mode: 'in-app' \| 'public', language, onSubmit(body: WithdrawalBody), list?, defaults?, uiLanguage?, pending?, error?, receipt?, formatAmount?` (+ `open, onOpenChange` for the dialog; `onClose` for the form) | Three steps. **Form**: in-app a contract picker over `list.candidates` (bought, paid, last day, estimated refund), publicly a contract-reference field — plus name and e-mail, NOTHING else is asked (a public form also carries the honeypot). **Review**: the summary and the statutory confirm ("Confirm withdrawal", "Widerruf bestätigen", "Confirmer la rétractation", "Potwierdź odstąpienie od umowy"). **Receipt** (whenever `receipt` is set): the received sentence with date AND time in UTC, reference, status, refund. The dialog does not clear the receipt the application holds — reset it on close. |
|
|
191
|
+
| `CancellationForm` | `mode, language, onSubmit(body: CancellationBody), defaults?, uiLanguage?, pending?, error?, receipt?, onPrint?, onClose?` | **Form**: kind (ordinary / extraordinary — the reason becomes required), name, contract or customer reference, effective (earliest / a date from today), e-mail, and a honeypot. **Summary** with the statutory confirm ("Cancel now", "Jetzt kündigen", "Notification de la résiliation", "Wypowiedz teraz"). **Receipt**: received date and time in UTC, the effective date when known, status, a print button (`onPrint`, default `window.print()`). |
|
|
192
|
+
|
|
193
|
+
- `error` is `true` (the generic sentence in the shown language) or the application's own node — a
|
|
194
|
+
`WithdrawalUnavailable` phrased by the app, say.
|
|
195
|
+
- **The honeypot** (`Honeypot`, internal): an input named `website`, off screen, `tabIndex={-1}`,
|
|
196
|
+
inside `aria-hidden`; only a filled one is sent (`body.honeypot`), and the server answers a bot
|
|
197
|
+
exactly like a person.
|
|
198
|
+
- **Bodies** carry `language` = the shown language; an in-app withdrawal sends `purchaseId` and
|
|
199
|
+
`contractRef`, a public one `contractRef` only.
|
|
200
|
+
|
|
201
|
+
### Hooks — protocol-bound, from `makeConsumerRightsProtocols`
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
usePerformanceConsent(view: RegisteredEntrypoint<{}, PerformanceConsentView>,
|
|
205
|
+
record: RegisteredEntrypoint<{ body: PerformanceConsentBody }, PerformanceConsentResponse>,
|
|
206
|
+
opts?: { enabled?, uiLanguage?, links?, onWithdraw?, onRecorded?(response) })
|
|
207
|
+
→ { view, required: boolean | null, ensure(opts?: { force? }): Promise<boolean>, refresh(), dialog }
|
|
208
|
+
PerformanceConsentProvider({ view, record, options?, children }) // ONE dialog for the app
|
|
209
|
+
useConsentGate() → { ensure, withConsent<T>(action): Promise<T>, required }
|
|
210
|
+
useSubscriptionStart(start: RegisteredEntrypoint<{ query: { planSku } }, SubscriptionStartView>,
|
|
211
|
+
requestStart: RegisteredEntrypoint<{ body: SubscriptionStartBody }, SubscriptionStartResponse>, opts?)
|
|
212
|
+
→ { ensure(planSku, { planTitle, price? }): Promise<string | null>, view, dialog }
|
|
213
|
+
useWithdrawal(withdrawals | null, withdraw, { enabled? }) → { list, load, submit, receipt, pending, error, reset, form }
|
|
214
|
+
useCancellation(cancel) → { submit, receipt, pending, error, reset, form }
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
- **`ensure()`** reads the view fresh: `true` when nothing is required, or once the consent was
|
|
218
|
+
confirmed AND recorded; `false` on a decline or a closed dialog. A failed read answers `true` —
|
|
219
|
+
the server's 428 stays the authority, and a flaky read never blocks work that needs no consent.
|
|
220
|
+
Concurrent calls share ONE pending answer (a burst of clicks opens one dialog). A record refused
|
|
221
|
+
with a 428 (a stale text version) reloads the view and keeps the dialog open.
|
|
222
|
+
- **`useSubscriptionStart().ensure`** answers the `startRequestId` to send with the checkout
|
|
223
|
+
(`CreateCheckoutBody.startRequestId`), `''` when none is needed (or the read failed — the
|
|
224
|
+
checkout's own refusal then decides), `null` on a decline.
|
|
225
|
+
- **`withConsent(action)`** runs the action; on a SPEND-consent refusal it asks with
|
|
226
|
+
`ensure({ force: true })` and retries exactly ONCE. A decline throws `ConsentDeclined`
|
|
227
|
+
(`isConsentDeclined`); a second refusal and every other failure propagate unchanged. Outside a
|
|
228
|
+
provider the gate passes through (`ensure` → `true`, refusals propagate).
|
|
229
|
+
- The asking state machine is `makeAsker` and the gate `makeConsentGate` (pure, React-free).
|
|
230
|
+
- `dialog` / `form` objects are spread into ONE piece each; `form.error` is a boolean, the raw
|
|
231
|
+
failure is `error`.
|
|
33
232
|
|
|
34
|
-
|
|
35
|
-
the note that Stripe calculates applicable tax. The policy maximum bounds net credit, not the
|
|
36
|
-
adjusted or tax-inclusive debit.
|
|
233
|
+
### Recognising a consent refusal
|
|
37
234
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
235
|
+
`isConsentRefusal(e)` — `consentRefusalOf(e) != null` (the class after the registry, or its marker
|
|
236
|
+
in `message`/`type`) OR `httpStatusOf(e) === 428` (`@owlmeans/api/status`: a production body is only
|
|
237
|
+
an incident id, so the status is all that is left). Read on the error AND on what it wraps —
|
|
238
|
+
`cause`, `error`, `original`, `originalError`, `inner`, `reason`, an aggregate's `errors`, and
|
|
239
|
+
strings — five levels deep with a cycle guard, so a planning `CommitFailed`
|
|
240
|
+
(`planning:commit-failed:<transition>:<the refusal's text>`) is recognised without depending on
|
|
241
|
+
planning. `consentRefusalKindOf(e)` → `'performance' | 'subscription-start' | 'unknown'` (a bare
|
|
242
|
+
428) `| null`; `isPerformanceConsentRefusal(e)` is what the gate retries on (performance or
|
|
243
|
+
unknown — never a subscription start).
|
|
244
|
+
|
|
245
|
+
### Selectors
|
|
246
|
+
|
|
247
|
+
| Piece | Selectors |
|
|
248
|
+
|---|---|
|
|
249
|
+
| Spend consent | `[data-consent-dialog]` (also `[data-performance-consent]`) with `data-language` (shown), `data-contract-language`, `data-text-version`; `[data-consent-purchase]` with `data-purchase-id`, `data-deadline` (ISO); `[data-consent-statement]`; `[data-consent-checkbox]` (Radix `data-state`); `[data-consent-confirm]`; `[data-consent-decline]`; `[data-consent-language-toggle]` (also `[data-language-toggle]` with `data-target-language`) |
|
|
250
|
+
| Legal links (both dialogs) | `[data-legal-links]`, `[data-legal-link="billing-terms" \| "withdrawal-information" \| "withdrawal-function"]` |
|
|
251
|
+
| Subscription start | `[data-start-dialog]` (also `[data-subscription-start]`) with `data-language`, `data-contract-language`, `data-plan-sku`; `[data-start-statement]`, `[data-start-price]`, `[data-start-checkbox]`, `[data-start-confirm]`, `[data-start-decline]`, `[data-start-language-toggle]` |
|
|
252
|
+
| Withdrawal | `[data-withdrawal-function]` (`data-language`); `[data-withdrawal-dialog]` (`data-language`, `data-step`); `[data-withdrawal-form]` with `data-withdrawal-step="form\|review\|receipt"` (also `data-step`, `data-mode`, `data-language`); `[data-withdrawal-candidate]` (`data-purchase-id`, `data-contract-ref`) and its radio `[data-withdrawal-candidate-input="<purchaseId>"]`; `[data-withdrawal-estimate]` (`data-refund-minor`); `[data-withdrawal-field="contract\|name\|email"]`; `[data-withdrawal-continue]`, `[data-withdrawal-back]`, `[data-withdrawal-confirm]`; `[data-withdrawal-receipt]` (`data-status`, `data-declaration-id`, `data-received-at`), `[data-withdrawal-reference]`, `[data-withdrawal-received-at]`, `[data-withdrawal-refund]`; `[data-withdrawal-language-toggle]` |
|
|
253
|
+
| Cancellation | `[data-cancellation-form]` with `data-cancellation-step="form\|review\|receipt"` (also `data-step`, `data-mode`, `data-language`); `[data-cancellation-field="kind\|reason\|name\|contract\|effective\|date\|email"]` (kind radios carry `data-kind`, effective radios `data-effective`); `[data-cancellation-continue]`, `[data-cancellation-back]`, `[data-cancellation-confirm]`, `[data-cancellation-summary]`; `[data-cancellation-receipt]` (`data-status`, `data-declaration-id`, `data-received-at`, `data-effective-at`), `[data-cancellation-effective]`, `[data-cancellation-print]`; `[data-cancellation-language-toggle]` |
|
|
254
|
+
| Honeypot | `[data-honeypot]` |
|
|
255
|
+
|
|
256
|
+
## The `@/components/ui/*` contract
|
|
257
|
+
|
|
258
|
+
Components import the consuming app's shadcn primitives through the app alias:
|
|
259
|
+
`@/components/ui/{button,dialog,input,label,select}` for the dialog and estimate summary,
|
|
260
|
+
`@/components/ui/{card,progress,button}` for the pieces (`Card`, `CardHeader`, `CardTitle`,
|
|
261
|
+
`CardDescription`, `CardContent`, `CardFooter`, `Progress`), and — **only from `./consumer`** —
|
|
262
|
+
`@/components/ui/checkbox` (`export { Checkbox }` with the Radix Root props, the stock shadcn file).
|
|
263
|
+
The consumer therefore provides those files and the peers `@radix-ui/react-progress` /
|
|
264
|
+
`@radix-ui/react-select` beside the dialog's Radix ones, plus `@radix-ui/react-checkbox` when it
|
|
265
|
+
imports `./consumer`. The package carries standalone copies under `src/@` only so its own build and
|
|
266
|
+
tests resolve the same alias; they are never exported (its checkbox draws an inline SVG check, no
|
|
267
|
+
icon library). Styling uses semantic theme tokens only (`primary`, `muted-foreground`,
|
|
268
|
+
`destructive`, `border`, `card`).
|
|
269
|
+
|
|
270
|
+
A Tailwind v4 consumer scanning package source adds:
|
|
42
271
|
|
|
43
272
|
```css
|
|
44
273
|
@source "../../node_modules/@owlmeans/web-payment/src";
|
|
45
274
|
```
|
|
46
275
|
|
|
47
|
-
|
|
48
|
-
|
|
276
|
+
## Strings
|
|
277
|
+
|
|
278
|
+
All visible interface strings live in the `web-payment` library resource (`lib` namespace,
|
|
279
|
+
`WEB_PAYMENT_RESOURCE`) in all eight languages — `en pl ru be uk es de fr` — under
|
|
280
|
+
`amount-checkout` (incl. `above-limit`), `checkout-limit` (`note`, `blocked`, `resets`,
|
|
281
|
+
`reason.{per-purchase,window,hold,other}`), `entitlement` (`plan`, `status`, `limit`, `promo`,
|
|
282
|
+
`capability`), `estimate` (`country`, `country-locked`, `tax-type`, `rate`, `total`,
|
|
283
|
+
`converted-note`, `status`, `loading`, `failed`), and for `./consumer`: `consumer` (toggle, steps,
|
|
284
|
+
receipt labels, validation), `withdrawal` (candidate lines, estimate, kinds, `status.*`) and
|
|
285
|
+
`cancellation` (`effective-at`, `status.*`). The legal copy is NOT here — it is `@owlmeans/payment`'s.
|
|
286
|
+
|
|
287
|
+
- A new key lands in every language at once, with the same `{{placeholders}}`; the parity spec
|
|
288
|
+
walks the resources recursively and scans every language for the forbidden wording (never
|
|
289
|
+
"non-refundable" or a translation of it: the right of withdrawal EXPIRES for what was used, and
|
|
290
|
+
unused credits ARE reimbursed). Every `WithdrawalStatus`, `CancellationStatus` (incl. `review` —
|
|
291
|
+
extraordinary and unmatched public cancellations) and `PurchaseKind` value has its string; the
|
|
292
|
+
spec iterates the enums, so a new status fails it until all eight languages phrase it.
|
|
293
|
+
- The last withdrawal day shown anywhere is `@owlmeans/payment`'s `lastWithdrawalDayOf(deadline)`
|
|
294
|
+
(the deadline is exclusive), formatted as a UTC date — the rule the server's e-mails use.
|
|
295
|
+
- The `consumer`/`withdrawal`/`cancellation` branches take the register of the legal copy they sit
|
|
296
|
+
beside (de and es formal, like `payment-consumer-rights`), while `amount-checkout` and
|
|
297
|
+
`checkout-limit` keep the dialog's.
|
|
298
|
+
- An application overrides a string with `addI18nApp(lng, 'web-payment', data, { ns: LIB_NAMESPACE })`
|
|
299
|
+
— `paymentTextOf` reads that override too.
|
|
300
|
+
|
|
301
|
+
## Tests
|
|
302
|
+
|
|
303
|
+
Category D plus unit specs: `bun test ./tests` runs the selector, hook, cache, consent-refusal
|
|
304
|
+
(`consent-refusal.spec.ts`: class, marker in message/type/string, bare 428 `ApiStatusError`,
|
|
305
|
+
stamped status, `cause`/`error`/aggregate nesting, a `CommitFailed`-shaped message, negatives) and
|
|
306
|
+
asker/gate (`consumer-hooks.spec.ts`: `makeAsker` sharing and failing open, `withConsent` retrying
|
|
307
|
+
exactly once, first-render hook shapes with `react-dom/server`) specs, the 8-language parity spec,
|
|
308
|
+
and drives chromium through the Vite harness, which picks a surface by `?case=` (none = the dialog,
|
|
309
|
+
`pieces`, `hook`, `shared-estimate`; `consent`, `start`, `withdrawal`, `withdrawal-public`,
|
|
310
|
+
`cancellation`, `limit` (`&blocked=true`), `country-locked`, `consent-gate`), with `?lng=` the
|
|
311
|
+
contract language and `?ui=` the interface language, and for the dialog an `?estimate=<name>`
|
|
312
|
+
canned `PriceEstimateControl` fixture (`tests/harness/estimate-fixtures.ts`,
|
|
313
|
+
`tests/harness/consumer-fixtures.ts` — no server, no Stripe). The harness pre-bundles every runtime
|
|
314
|
+
dependency in `optimizeDeps.include` (`@radix-ui/react-checkbox` included); one discovered
|
|
315
|
+
mid-navigation loads a second React and the page throws "Invalid hook call".
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare function Card({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
3
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
4
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
5
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
6
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
10
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../../src/@/components/ui/card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,iBAAS,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWjE;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWvE;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQtE;AAED,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQ5E;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWvE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQxE;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQvE;AAED,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,GACZ,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '@/lib/utils';
|
|
3
|
+
function Card({ className, ...props }) {
|
|
4
|
+
return (_jsx("div", { "data-slot": "card", className: cn("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm", className), ...props }));
|
|
5
|
+
}
|
|
6
|
+
function CardHeader({ className, ...props }) {
|
|
7
|
+
return (_jsx("div", { "data-slot": "card-header", className: cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6", className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
function CardTitle({ className, ...props }) {
|
|
10
|
+
return (_jsx("div", { "data-slot": "card-title", className: cn("leading-none font-semibold", className), ...props }));
|
|
11
|
+
}
|
|
12
|
+
function CardDescription({ className, ...props }) {
|
|
13
|
+
return (_jsx("div", { "data-slot": "card-description", className: cn("text-muted-foreground text-sm", className), ...props }));
|
|
14
|
+
}
|
|
15
|
+
function CardAction({ className, ...props }) {
|
|
16
|
+
return (_jsx("div", { "data-slot": "card-action", className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className), ...props }));
|
|
17
|
+
}
|
|
18
|
+
function CardContent({ className, ...props }) {
|
|
19
|
+
return (_jsx("div", { "data-slot": "card-content", className: cn("px-6", className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function CardFooter({ className, ...props }) {
|
|
22
|
+
return (_jsx("div", { "data-slot": "card-footer", className: cn("flex items-center px-6 [.border-t]:pt-6", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
25
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../../src/@/components/ui/card.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,SAAS,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IAChE,OAAO,CACL,2BACY,MAAM,EAChB,SAAS,EAAE,EAAE,CACX,mFAAmF,EACnF,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IACtE,OAAO,CACL,2BACY,aAAa,EACvB,SAAS,EAAE,EAAE,CACX,4JAA4J,EAC5J,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IACrE,OAAO,CACL,2BACY,YAAY,EACtB,SAAS,EAAE,EAAE,CAAC,4BAA4B,EAAE,SAAS,CAAC,KAClD,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IAC3E,OAAO,CACL,2BACY,kBAAkB,EAC5B,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KACrD,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IACtE,OAAO,CACL,2BACY,aAAa,EACvB,SAAS,EAAE,EAAE,CACX,gEAAgE,EAChE,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IACvE,OAAO,CACL,2BACY,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,KAC5B,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IACtE,OAAO,CACL,2BACY,aAAa,EACvB,SAAS,EAAE,EAAE,CAAC,yCAAyC,EAAE,SAAS,CAAC,KAC/D,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,GACZ,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
/** The shadcn checkbox, with an inline check mark instead of an icon library. */
|
|
4
|
+
export declare const Checkbox: ({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) => React.JSX.Element;
|
|
5
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../src/@/components/ui/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAA;AAG7D,iFAAiF;AACjF,eAAO,MAAM,QAAQ,4BAA6B,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,sBAiB1E,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
import { cn } from '@/lib/utils';
|
|
4
|
+
/** The shadcn checkbox, with an inline check mark instead of an icon library. */
|
|
5
|
+
export const Checkbox = ({ className, ...props }) => _jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn('peer border-input size-4 shrink-0 cursor-pointer rounded-[4px] border shadow-xs outline-none transition-shadow', 'data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", className: "flex items-center justify-center text-current", children: _jsx("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", className: "size-3.5", fill: "none", stroke: "currentColor", strokeWidth: 3, strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "M20 6 9 17l-5-5" }) }) }) });
|
|
6
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../../src/@/components/ui/checkbox.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,iFAAiF;AACjF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAuD,EAAE,EAAE,CACvG,KAAC,iBAAiB,CAAC,IAAI,iBACX,UAAU,EACpB,SAAS,EAAE,EAAE,CACX,gHAAgH,EAChH,kHAAkH,EAClH,+HAA+H,EAC/H,SAAS,CACV,KACG,KAAK,YAET,KAAC,iBAAiB,CAAC,SAAS,iBAAW,oBAAoB,EAAC,SAAS,EAAC,+CAA+C,YACnH,cAAK,OAAO,EAAC,WAAW,iBAAa,MAAM,EAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAChG,WAAW,EAAE,CAAC,EAAE,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,YAC5D,eAAM,CAAC,EAAC,iBAAiB,GAAG,GACxB,GACsB,GACP,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
3
|
+
declare function Progress({ className, value, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
export { Progress };
|
|
5
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../../src/@/components/ui/progress.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAA;AAI7D,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,qBA4BrD;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
3
|
+
import { cn } from '@/lib/utils';
|
|
4
|
+
function Progress({ className, value, ...props }) {
|
|
5
|
+
const indeterminate = value == null;
|
|
6
|
+
return (_jsx(ProgressPrimitive.Root, { "data-slot": "progress", className: cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", className), value: indeterminate ? undefined : value, ...props, children: _jsx(ProgressPrimitive.Indicator, { "data-slot": "progress-indicator", "data-state": indeterminate ? 'indeterminate' : 'determinate', className: cn("bg-primary h-full w-full flex-1 transition-all", indeterminate && "absolute inset-y-0 left-0 w-1/3 animate-[progress-indeterminate_1.5s_linear_infinite]"), style: indeterminate
|
|
7
|
+
? undefined
|
|
8
|
+
: { transform: `translateX(-${100 - (value || 0)}%)` } }) }));
|
|
9
|
+
}
|
|
10
|
+
export { Progress };
|
|
11
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../../src/@/components/ui/progress.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAA;AAE7D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,SAAS,QAAQ,CAAC,EAChB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EAC4C;IACpD,MAAM,aAAa,GAAG,KAAK,IAAI,IAAI,CAAA;IAEnC,OAAO,CACL,KAAC,iBAAiB,CAAC,IAAI,iBACX,UAAU,EACpB,SAAS,EAAE,EAAE,CACX,gEAAgE,EAChE,SAAS,CACV,EACD,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,KACpC,KAAK,YAET,KAAC,iBAAiB,CAAC,SAAS,iBAChB,oBAAoB,gBAClB,aAAa,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAC3D,SAAS,EAAE,EAAE,CACX,gDAAgD,EAChD,aAAa,IAAI,uFAAuF,CACzG,EACD,KAAK,EACH,aAAa;gBACX,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,GAAG,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,EAAE,GAE1D,GACqB,CAC1B,CAAA;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
+
export declare const Select: (props: React.ComponentProps<typeof SelectPrimitive.Root>) => React.JSX.Element;
|
|
4
|
+
export declare const SelectValue: (props: React.ComponentProps<typeof SelectPrimitive.Value>) => React.JSX.Element;
|
|
5
|
+
export declare const SelectTrigger: ({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger>) => React.JSX.Element;
|
|
6
|
+
export declare const SelectContent: ({ className, children, position, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>) => React.JSX.Element;
|
|
7
|
+
export declare const SelectItem: ({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) => React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/@/components/ui/select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAGzD,eAAO,MAAM,MAAM,UAAW,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,sBAAwC,CAAA;AACvH,eAAO,MAAM,WAAW,UAAW,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,sBAAyC,CAAA;AAE9H,eAAO,MAAM,aAAa,sCAAuC,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,sBAepH,CAAA;AAED,eAAO,MAAM,aAAa,gDAA4D,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,sBAsBzI,CAAA;AAED,eAAO,MAAM,UAAU,sCAAuC,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,sBAa9G,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
+
import { cn } from '@/lib/utils';
|
|
4
|
+
export const Select = (props) => _jsx(SelectPrimitive.Root, { ...props });
|
|
5
|
+
export const SelectValue = (props) => _jsx(SelectPrimitive.Value, { ...props });
|
|
6
|
+
export const SelectTrigger = ({ className, children, ...props }) => (_jsxs(SelectPrimitive.Trigger, { className: cn('border-input data-[placeholder]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50', 'flex h-9 w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs', 'outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx("span", { "aria-hidden": "true", className: "text-muted-foreground shrink-0", children: "\u25BE" }) })] }));
|
|
7
|
+
export const SelectContent = ({ className, children, position = 'popper', ...props }) => (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { position: position, className: cn('bg-popover text-popover-foreground relative z-50 max-h-96 min-w-[8rem] overflow-y-auto rounded-md border shadow-md', position === 'popper' && 'data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1', className), ...props, children: [_jsx(SelectPrimitive.ScrollUpButton, { className: "flex items-center justify-center py-1", children: _jsx("span", { "aria-hidden": "true", children: "\u25B4" }) }), _jsx(SelectPrimitive.Viewport, { className: cn('p-1', position === 'popper' && 'w-full min-w-[var(--radix-select-trigger-width)]'), children: children }), _jsx(SelectPrimitive.ScrollDownButton, { className: "flex items-center justify-center py-1", children: _jsx("span", { "aria-hidden": "true", children: "\u25BE" }) })] }) }));
|
|
8
|
+
export const SelectItem = ({ className, children, ...props }) => (_jsxs(SelectPrimitive.Item, { className: cn('focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50', className), ...props, children: [_jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { "aria-hidden": "true", children: "\u2713" }) }), _jsx(SelectPrimitive.ItemText, { children: children })] }));
|
|
9
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/@/components/ui/select.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAwD,EAAE,EAAE,CAAC,KAAC,eAAe,CAAC,IAAI,OAAK,KAAK,GAAI,CAAA;AACvH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAyD,EAAE,EAAE,CAAC,KAAC,eAAe,CAAC,KAAK,OAAK,KAAK,GAAI,CAAA;AAE9H,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAwD,EAAE,EAAE,CAAC,CACxH,MAAC,eAAe,CAAC,OAAO,IACtB,SAAS,EAAE,EAAE,CACX,4GAA4G,EAC5G,iHAAiH,EACjH,qHAAqH,EACrH,SAAS,CACV,KACG,KAAK,aAER,QAAQ,EACT,KAAC,eAAe,CAAC,IAAI,IAAC,OAAO,kBAC3B,8BAAkB,MAAM,EAAC,SAAS,EAAC,gCAAgC,uBAAS,GACvD,IACC,CAC3B,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAwD,EAAE,EAAE,CAAC,CAC7I,KAAC,eAAe,CAAC,MAAM,cACrB,MAAC,eAAe,CAAC,OAAO,IACtB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,EAAE,CACX,oHAAoH,EACpH,QAAQ,KAAK,QAAQ,IAAI,iEAAiE,EAC1F,SAAS,CACV,KACG,KAAK,aAET,KAAC,eAAe,CAAC,cAAc,IAAC,SAAS,EAAC,uCAAuC,YAC/E,8BAAkB,MAAM,uBAAS,GACF,EACjC,KAAC,eAAe,CAAC,QAAQ,IAAC,SAAS,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,QAAQ,IAAI,kDAAkD,CAAC,YACxH,QAAQ,GACgB,EAC3B,KAAC,eAAe,CAAC,gBAAgB,IAAC,SAAS,EAAC,uCAAuC,YACjF,8BAAkB,MAAM,uBAAS,GACA,IACX,GACH,CAC1B,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAqD,EAAE,EAAE,CAAC,CAClH,MAAC,eAAe,CAAC,IAAI,IACnB,SAAS,EAAE,EAAE,CACX,mOAAmO,EACnO,SAAS,CACV,KACG,KAAK,aAET,eAAM,SAAS,EAAC,4DAA4D,YAC1E,KAAC,eAAe,CAAC,aAAa,mBAAa,MAAM,uBAAkC,GAC9E,EACP,KAAC,eAAe,CAAC,QAAQ,cAAE,QAAQ,GAA4B,IAC1C,CACxB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CapabilityListProps } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The capabilities of a view, labelled by the application. A capability without a label is not
|
|
4
|
+
* rendered, so a view may carry grants a screen has nothing to say about.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CapabilityList: ({ capabilities, labels, onlyGranted, className }: CapabilityListProps) => import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=capability-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-list.d.ts","sourceRoot":"","sources":["../src/capability-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAkBrD;;;GAGG;AACH,eAAO,MAAM,cAAc,qDAA8D,mBAAmB,gCAyB3G,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PromoNote, useEntitlementCopy } from './copy.js';
|
|
3
|
+
const classes = (...names) => names.filter(Boolean).join(' ');
|
|
4
|
+
/** One row per param, in view order: granted when any row grants it, the promo of that row. */
|
|
5
|
+
const collapse = (capabilities) => {
|
|
6
|
+
const rows = new Map();
|
|
7
|
+
for (const capability of capabilities) {
|
|
8
|
+
const seen = rows.get(capability.param);
|
|
9
|
+
if (seen == null || (!seen.granted && capability.granted)) {
|
|
10
|
+
rows.set(capability.param, capability);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return [...rows.values()];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The capabilities of a view, labelled by the application. A capability without a label is not
|
|
17
|
+
* rendered, so a view may carry grants a screen has nothing to say about.
|
|
18
|
+
*/
|
|
19
|
+
export const CapabilityList = ({ capabilities, labels, onlyGranted = false, className }) => {
|
|
20
|
+
const copy = useEntitlementCopy();
|
|
21
|
+
const rows = collapse(capabilities).filter(capability => (labels[capability.param] ?? '') !== '' && (!onlyGranted || capability.granted));
|
|
22
|
+
return _jsx("ul", { "data-capability-list": "", className: classes('grid gap-2 text-sm', className), children: rows.map(capability => _jsxs("li", { "data-capability": capability.param, "data-granted": capability.granted ? 'true' : 'false', className: "flex items-start gap-2", children: [_jsx("span", { "aria-hidden": "true", className: classes('mt-0.5 inline-flex size-4 shrink-0 items-center justify-center text-xs font-semibold', capability.granted ? 'text-primary' : 'text-muted-foreground'), children: capability.granted ? '✓' : '–' }), _jsxs("span", { className: "grid gap-0.5", children: [_jsxs("span", { className: capability.granted ? undefined : 'text-muted-foreground', children: [labels[capability.param], _jsx("span", { className: "sr-only", children: ` — ${copy.text(capability.granted ? 'capability.included' : 'capability.not-included')}` })] }), capability.promo != null && _jsx("span", { className: "text-xs", children: _jsx(PromoNote, { promo: capability.promo, copy: copy }) })] })] }, capability.param)) });
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=capability-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-list.js","sourceRoot":"","sources":["../src/capability-list.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAGzD,MAAM,OAAO,GAAG,CAAC,GAAG,KAA+C,EAAU,EAAE,CAC7E,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAEjC,+FAA+F;AAC/F,MAAM,QAAQ,GAAG,CAAC,YAA8B,EAAoB,EAAE;IACpE,MAAM,IAAI,GAAG,IAAI,GAAG,EAA0B,CAAA;IAC9C,KAAK,MAAM,UAAU,IAAI,YAAY,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;QACxC,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;AAC3B,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,SAAS,EAAuB,EAAE,EAAE;IAC9G,MAAM,IAAI,GAAG,kBAAkB,EAAE,CAAA;IACjC,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CACtD,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,WAAW,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;IAElF,OAAO,qCAAyB,EAAE,EAAC,SAAS,EAAE,OAAO,CAAC,oBAAoB,EAAE,SAAS,CAAC,YACnF,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,iCAEL,UAAU,CAAC,KAAK,kBACnB,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EACnD,SAAS,EAAC,wBAAwB,aAElC,8BAAkB,MAAM,EAAC,SAAS,EAAE,OAAO,CACzC,sFAAsF,EACtF,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,uBAAuB,CAC9D,YAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAQ,EAC1C,gBAAM,SAAS,EAAC,cAAc,aAC5B,gBAAM,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAuB,aACtE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EACzB,eAAM,SAAS,EAAC,SAAS,YAAE,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,yBAAyB,CAAC,EAAE,GAAQ,IACvH,EACN,UAAU,CAAC,KAAK,IAAI,IAAI,IAAI,eAAM,SAAS,EAAC,SAAS,YAAC,KAAC,SAAS,IAAC,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,GAAI,GAAO,IAC3G,KAfF,UAAU,CAAC,KAAK,CAgBlB,CAAC,GACH,CAAA;AACP,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CheckoutLimitNoteProps } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* What an amount checkout is narrowed to for this entity now: the largest amount (or that nothing
|
|
4
|
+
* may be bought), why, and when it rises again — the same `CheckoutLimitView` the server refuses
|
|
5
|
+
* with, so the note and a refusal never disagree.
|
|
6
|
+
*
|
|
7
|
+
* `[data-checkout-limit]` carries `data-max-minor`, `data-blocked`, `data-reason` and, when known,
|
|
8
|
+
* `data-resets-at` (ISO).
|
|
9
|
+
*/
|
|
10
|
+
export declare const CheckoutLimitNote: ({ limit, reasonLabel, className }: CheckoutLimitNoteProps) => import("react").JSX.Element | null;
|
|
11
|
+
//# sourceMappingURL=checkout-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout-limit.d.ts","sourceRoot":"","sources":["../src/checkout-limit.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAKxD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,sCAAuC,sBAAsB,uCA+B1F,CAAA"}
|