@solvapay/react 2.1.1 → 2.2.0-preview-e3e546693c002c32f128d83bf6c5fe76ac182a79
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/CHANGELOG.md +23 -2
- package/dist/UsageMeter-BhxNHeRM.d.ts +74 -0
- package/dist/UsageMeter-rga6cyfB.d.cts +74 -0
- package/dist/chunk-FWT62B56.js +316 -0
- package/dist/{chunk-LL6AYSTC.js → chunk-VTGYZIE2.js} +1734 -688
- package/dist/{chunk-HQH6KSXJ.js → chunk-X65JBC2A.js} +419 -810
- package/dist/{index-CBWGkBqF.d.ts → index-BJGjKUtC.d.cts} +46 -39
- package/dist/{index-SylJb9Rh.d.cts → index-PsjS_d7V.d.ts} +46 -39
- package/dist/index.cjs +2284 -1580
- package/dist/index.d.cts +110 -25
- package/dist/index.d.ts +110 -25
- package/dist/index.js +388 -46
- package/dist/mcp/index.cjs +6537 -3396
- package/dist/mcp/index.d.cts +637 -158
- package/dist/mcp/index.d.ts +637 -158
- package/dist/mcp/index.js +3421 -1004
- package/dist/mcp/styles.css +1422 -500
- package/dist/primitives/index.cjs +1635 -1031
- package/dist/primitives/index.d.cts +19 -76
- package/dist/primitives/index.d.ts +19 -76
- package/dist/primitives/index.js +3 -3
- package/dist/styles.css +60 -10
- package/dist/{shared-CUl6mTC1.d.ts → useUsage-CMqxEF9d.d.ts} +387 -53
- package/dist/{shared-D0hmT1qU.d.cts → useUsage-CTgRBvFK.d.cts} +387 -53
- package/package.json +5 -5
- package/dist/chunk-QXNNMNCV.js +0 -579
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { w as SolvaPayTransport, a1 as SolvaPayProviderInitial, D as SolvaPayConfig, B as BootstrapPlanLike, y as PurchaseInfo, a2 as CreditActivityType, a3 as CreditActivityEntry, H as Merchant } from '../useUsage-CMqxEF9d.js';
|
|
2
2
|
import { TOOL_FOR_VIEW, SolvaPayMcpViewKind, BootstrapMerchant, BootstrapProduct, BootstrapPlan, BootstrapCustomer } from '@solvapay/mcp-core';
|
|
3
3
|
export { MCP_TOOL_NAMES, McpToolName } from '@solvapay/mcp-core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { PricingOptionLike } from '@solvapay/core';
|
|
6
|
+
import { PricingOptionLike, PricedLike, BalancePegLike } from '@solvapay/core';
|
|
7
|
+
import { U as UsageMeterRootProps } from '../UsageMeter-BhxNHeRM.js';
|
|
7
8
|
import '@stripe/stripe-js';
|
|
8
9
|
import '../adapters/auth.js';
|
|
9
10
|
|
|
@@ -64,12 +65,20 @@ declare function createMcpAppAdapter(app: McpAppLike): SolvaPayTransport;
|
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
67
|
* Probe whether `@stripe/stripe-js` can mount inside the current MCP host
|
|
67
|
-
* sandbox.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
68
|
+
* sandbox. Hosts that deliver the declared `_meta.ui.csp.frameDomains` to
|
|
69
|
+
* the widget document (basic-host, ChatGPT) let Stripe load normally.
|
|
70
|
+
* Reading `frameDomains` is not the same as the emitted policy surviving
|
|
71
|
+
* to the guest document — MCPJam currently reports a runtime mismatch
|
|
72
|
+
* between its effective CSP model and the browser's enforced policy.
|
|
73
|
+
* Non-compliant hosts (Claude today — see anthropics/claude-ai-mcp#40)
|
|
70
74
|
* hardcode `frame-src 'self' blob: data:` and the nested Stripe iframes
|
|
71
75
|
* are refused even though the parent script loads fine.
|
|
72
76
|
*
|
|
77
|
+
* A second, harder constraint: sandbox flags are inherited by descendant
|
|
78
|
+
* frames. A chain missing `allow-same-origin` cannot host Stripe at all
|
|
79
|
+
* regardless of `frame-src` — Stripe's own inner iframe fails its
|
|
80
|
+
* `script-src 'self'` when the ancestor omits it.
|
|
81
|
+
*
|
|
73
82
|
* ## Why `ready` alone is a lie on Claude
|
|
74
83
|
*
|
|
75
84
|
* Stripe's `PaymentElement` fires its `ready` event as soon as the
|
|
@@ -178,6 +187,25 @@ interface McpBridgeAppLike {
|
|
|
178
187
|
text: string;
|
|
179
188
|
}>;
|
|
180
189
|
}) => Promise<unknown> | void;
|
|
190
|
+
/**
|
|
191
|
+
* `ui/open-link` — ask the host to open a URL in the user's browser.
|
|
192
|
+
* On hosts whose iframe sandbox omits `allow-popups` (Claude) this is
|
|
193
|
+
* the only way out of the frame: `<a target="_blank">` and
|
|
194
|
+
* `window.open()` are both dropped there without an error.
|
|
195
|
+
*/
|
|
196
|
+
openLink?: (params: {
|
|
197
|
+
url: string;
|
|
198
|
+
}) => Promise<{
|
|
199
|
+
isError?: boolean;
|
|
200
|
+
} | undefined>;
|
|
201
|
+
/**
|
|
202
|
+
* Host capabilities resolved during `connect()`. `openLinks` gates
|
|
203
|
+
* `openLink` — a host can expose the method without declaring
|
|
204
|
+
* support, and calling it blind would swallow the click.
|
|
205
|
+
*/
|
|
206
|
+
getHostCapabilities?: () => {
|
|
207
|
+
openLinks?: unknown;
|
|
208
|
+
} | undefined;
|
|
181
209
|
}
|
|
182
210
|
interface NotifyModelContextParams {
|
|
183
211
|
/** Short, plain-text update ("User selected Pro"). */
|
|
@@ -351,11 +379,10 @@ declare function isTransportToolName(name: string): boolean;
|
|
|
351
379
|
* Classification of the host-invoked tool that opened the widget iframe.
|
|
352
380
|
* Drives `<McpApp>`'s mount branching:
|
|
353
381
|
*
|
|
354
|
-
* - `intent` —
|
|
355
|
-
* the corresponding tool via `fetchMcpBootstrap`.
|
|
382
|
+
* - `intent` — the `account` viewer. Call it via `fetchMcpBootstrap`.
|
|
356
383
|
* - `other` — no tool info, or a SolvaPay transport tool as the
|
|
357
|
-
* iframe entry point (rare). Fall back to the `
|
|
358
|
-
*
|
|
384
|
+
* iframe entry point (rare). Fall back to the `account`
|
|
385
|
+
* viewer for a fresh snapshot.
|
|
359
386
|
*
|
|
360
387
|
* The previous `data` kind was removed with the text-only paywall
|
|
361
388
|
* refactor: payable merchant tools no longer advertise
|
|
@@ -363,7 +390,7 @@ declare function isTransportToolName(name: string): boolean;
|
|
|
363
390
|
* silent success or a paywall response. If one of those ever fires
|
|
364
391
|
* anyway (a legacy opt-in server), the classification falls through
|
|
365
392
|
* to `other` and the shell asks `fetchMcpBootstrap` for a clean
|
|
366
|
-
* `
|
|
393
|
+
* `account` snapshot.
|
|
367
394
|
*/
|
|
368
395
|
type HostEntryClassification = {
|
|
369
396
|
kind: 'intent';
|
|
@@ -503,14 +530,15 @@ declare function waitForInitialToolResult(app: McpAppBootstrapLike & AppToolResu
|
|
|
503
530
|
|
|
504
531
|
/**
|
|
505
532
|
* Seed the module-level hook caches (`merchantCache`, `productCache`,
|
|
506
|
-
* `plansCache`, `paymentMethodCache`) from a
|
|
507
|
-
* snapshot so the MCP App shell never fires a
|
|
533
|
+
* `plansCache`, `paymentMethodCache`, `limitsCache`) from a
|
|
534
|
+
* `SolvaPayProviderInitial` snapshot so the MCP App shell never fires a
|
|
535
|
+
* first-mount fetch.
|
|
508
536
|
*
|
|
509
537
|
* Called from `<McpApp>` before rendering `<SolvaPayProvider>`. The
|
|
510
|
-
* seeded entries share the same
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
538
|
+
* seeded entries share the same TTL as normal fetches — once expired
|
|
539
|
+
* the caches fall back to their existing behaviour (which, for MCP,
|
|
540
|
+
* returns the seeded value because the hooks' fetchers become no-ops
|
|
541
|
+
* after the read tools are dropped).
|
|
514
542
|
*/
|
|
515
543
|
|
|
516
544
|
/**
|
|
@@ -523,6 +551,131 @@ declare function waitForInitialToolResult(app: McpAppBootstrapLike & AppToolResu
|
|
|
523
551
|
*/
|
|
524
552
|
declare function seedMcpCaches(initial: SolvaPayProviderInitial, config: SolvaPayConfig): void;
|
|
525
553
|
|
|
554
|
+
/**
|
|
555
|
+
* Pure derivation helpers that map a plan / active purchase onto the
|
|
556
|
+
* activation strategy + action-affordance shape the shell renders per
|
|
557
|
+
* plan type.
|
|
558
|
+
*
|
|
559
|
+
* Keeping these in a standalone module lets the hosted manage page
|
|
560
|
+
* share the same matrix as the MCP shell — "one plan-shape matrix,
|
|
561
|
+
* two surfaces" — and makes the 4 × 2 × 3 test matrix from the plan a
|
|
562
|
+
* pure-function target (no RTL needed).
|
|
563
|
+
*
|
|
564
|
+
* The shape is derived from the wire's `options[]` through the
|
|
565
|
+
* `@solvapay/core` readers. These helpers previously keyed off
|
|
566
|
+
* `planType`, `meterRef`, `meterId`, and `limit`, none of which the
|
|
567
|
+
* backend sends: every plan fell through to the unknown branch, so a
|
|
568
|
+
* pay-as-you-go plan (which has no headline `price`) resolved to
|
|
569
|
+
* `'free'` and metered subscriptions were indistinguishable from
|
|
570
|
+
* unlimited ones.
|
|
571
|
+
*/
|
|
572
|
+
|
|
573
|
+
type PlanShape = 'free' | 'trial' | 'usage-based' | 'recurring-unlimited' | 'recurring-metered';
|
|
574
|
+
/**
|
|
575
|
+
* Strategy the Plan tab uses when the user clicks a plan card:
|
|
576
|
+
* - `activate` — free / trial / free-priced recurring: instant activation
|
|
577
|
+
* via `ActivationFlow.Summary` + `ActivateButton`.
|
|
578
|
+
* - `topup-first` — usage-based: ActivationFlow's `AmountPicker`
|
|
579
|
+
* branch.
|
|
580
|
+
* - `paid-checkout` — recurring with a non-zero price: mount
|
|
581
|
+
* `PaymentFormGate` + `PaymentForm.*` for inline Stripe Elements.
|
|
582
|
+
*/
|
|
583
|
+
type ActivationStrategy = 'activate' | 'topup-first' | 'paid-checkout';
|
|
584
|
+
/**
|
|
585
|
+
* The subset of a plan — or of the plan snapshot frozen onto a purchase
|
|
586
|
+
* — that the shape derivation reads. A plan carries `requiresPayment`;
|
|
587
|
+
* a snapshot may not. Usage-counting and the rest come out of `options[]`.
|
|
588
|
+
*/
|
|
589
|
+
interface PlanLike {
|
|
590
|
+
/** Catalog / snapshot identifier used to match a purchase back to a live plan. */
|
|
591
|
+
reference?: string | null;
|
|
592
|
+
/** Display name. Catalog plans carry it; thin snapshots may not. */
|
|
593
|
+
name?: string | null;
|
|
594
|
+
/** Backend-derived pricing label, e.g. `'usage-based'` or `'hybrid'`. */
|
|
595
|
+
type?: string | null;
|
|
596
|
+
/** Composable pricing options: charges, billing cycle, limit, trial. */
|
|
597
|
+
options?: PricingOptionLike[] | null;
|
|
598
|
+
/** `false` marks a free plan. Only present on a plan, not a snapshot. */
|
|
599
|
+
requiresPayment?: boolean | null;
|
|
600
|
+
/** Derived headline amount; only a fallback for snapshots frozen before `options[]`. */
|
|
601
|
+
price?: number | null;
|
|
602
|
+
currency?: string | null;
|
|
603
|
+
/** Frozen on snapshots; usage-based when `options[]` is missing. */
|
|
604
|
+
isMetered?: boolean | null;
|
|
605
|
+
}
|
|
606
|
+
interface PurchaseSnapshotLike {
|
|
607
|
+
planSnapshot?: PlanLike | null;
|
|
608
|
+
/** Whether the customer has a payment method on file. */
|
|
609
|
+
hasPaymentMethod?: boolean;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Map a `BootstrapPlan` / `PlanSnapshot` to its concrete shape. The
|
|
613
|
+
* shapes are distinct in UX: each drives a different summary string, a
|
|
614
|
+
* different set of CTAs, and a different activity-strip variant.
|
|
615
|
+
*
|
|
616
|
+
* A billing cycle is what separates a subscription from a one-off, and
|
|
617
|
+
* metering is what separates capped from unlimited. A paid plan with
|
|
618
|
+
* neither is a one-time purchase, which this matrix has no member for
|
|
619
|
+
* and folds into `'recurring-unlimited'` — the same bucket it landed in
|
|
620
|
+
* before, and the one that routes it to paid checkout.
|
|
621
|
+
*/
|
|
622
|
+
declare function resolvePlanShape(plan: PlanLike | null | undefined): PlanShape | null;
|
|
623
|
+
/**
|
|
624
|
+
* Pick the activation strategy for a plan the user just clicked.
|
|
625
|
+
*
|
|
626
|
+
* Free and trial plans activate instantly, usage-based always tops up
|
|
627
|
+
* first, and everything else goes to Stripe checkout. A zero-priced
|
|
628
|
+
* plan needs no separate branch: it resolves to `'free'`, because
|
|
629
|
+
* charging nothing is what makes a plan free.
|
|
630
|
+
*/
|
|
631
|
+
declare function resolveActivationStrategy(plan: PlanLike | null | undefined): ActivationStrategy;
|
|
632
|
+
/**
|
|
633
|
+
* Per-variant action flags for the Plan-active card. Only flags that
|
|
634
|
+
* are `true` render affordances — this collapses the "should we show
|
|
635
|
+
* Cancel?" boolean maze into a single resolver call.
|
|
636
|
+
*
|
|
637
|
+
* Rules from the plan:
|
|
638
|
+
* - `topUp` — only on usage-based purchases.
|
|
639
|
+
* - `cancel` — recurring (paid subscription) and free plans. PAYG
|
|
640
|
+
* has no renewal to cancel.
|
|
641
|
+
* - `changePlan` — always, when the product exposes more than one
|
|
642
|
+
* plan.
|
|
643
|
+
* - `managePortal` — only when the customer has a payment method on
|
|
644
|
+
* file. Free plans that never charged a card skip this.
|
|
645
|
+
* - `upgrade` — shown *instead of* `changePlan` when the active plan
|
|
646
|
+
* is free AND at least one paid plan exists.
|
|
647
|
+
*/
|
|
648
|
+
interface PlanActions {
|
|
649
|
+
topUp: boolean;
|
|
650
|
+
cancel: boolean;
|
|
651
|
+
changePlan: boolean;
|
|
652
|
+
managePortal: boolean;
|
|
653
|
+
upgrade: boolean;
|
|
654
|
+
}
|
|
655
|
+
interface PlanActionsInput {
|
|
656
|
+
purchase: PurchaseSnapshotLike | null | undefined;
|
|
657
|
+
/** Total plans exposed on the product. */
|
|
658
|
+
planCount: number;
|
|
659
|
+
/** Number of paid plans (price > 0, not free) on the product. */
|
|
660
|
+
paidPlanCount: number;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Overlay a live catalog plan onto a (possibly thin) purchase snapshot.
|
|
664
|
+
* Snapshots frozen without `options[]` collapse PAYG to `{ price: 0 }`,
|
|
665
|
+
* which `resolvePlanShape` reads as `'free'`. Prefer the snapshot's
|
|
666
|
+
* `options[]` when present; otherwise take them from the catalog match.
|
|
667
|
+
*/
|
|
668
|
+
declare function mergePlanSnapshot(snapshot: PlanLike | null | undefined, catalog: PlanLike | null | undefined): PlanLike | null;
|
|
669
|
+
declare function findCatalogPlan(plans: readonly PlanLike[] | undefined, snapshot: PlanLike | null | undefined, planRef?: string | null): PlanLike | undefined;
|
|
670
|
+
declare function resolvePlanActions({ purchase, planCount, paidPlanCount, }: PlanActionsInput): PlanActions;
|
|
671
|
+
/**
|
|
672
|
+
* "Your activity" strip variant shown at the top of a surface when a
|
|
673
|
+
* returning customer has an active purchase. Hidden when the customer
|
|
674
|
+
* has no active purchase.
|
|
675
|
+
*/
|
|
676
|
+
type ActivityStripKind = 'none' | 'payg-balance' | 'recurring-unlimited-renew' | 'recurring-metered-usage' | 'free-usage';
|
|
677
|
+
declare function resolveActivityStrip(purchase: PurchaseSnapshotLike | null | undefined): ActivityStripKind;
|
|
678
|
+
|
|
526
679
|
/**
|
|
527
680
|
* Per-element className overrides for `<Mcp*View>` primitives.
|
|
528
681
|
*
|
|
@@ -538,8 +691,16 @@ interface McpViewClassNames {
|
|
|
538
691
|
muted?: string;
|
|
539
692
|
button?: string;
|
|
540
693
|
linkButton?: string;
|
|
694
|
+
/**
|
|
695
|
+
* @deprecated Prefer composing the hosted notice primitives.
|
|
696
|
+
* Slot retained for integrator overrides that still target it.
|
|
697
|
+
*/
|
|
541
698
|
notice?: string;
|
|
542
699
|
error?: string;
|
|
700
|
+
/**
|
|
701
|
+
* @deprecated Awaiting-payment chrome is an internal checkout state.
|
|
702
|
+
* Slot retained for integrator overrides that still target it.
|
|
703
|
+
*/
|
|
543
704
|
awaitingHeader?: string;
|
|
544
705
|
balanceRow?: string;
|
|
545
706
|
amountPicker?: string;
|
|
@@ -553,6 +714,10 @@ interface McpViewClassNames {
|
|
|
553
714
|
businessToggle?: string;
|
|
554
715
|
businessField?: string;
|
|
555
716
|
taxSummary?: string;
|
|
717
|
+
/**
|
|
718
|
+
* @deprecated Activation is no longer a standalone view.
|
|
719
|
+
* Slot retained for integrator overrides that still target it.
|
|
720
|
+
*/
|
|
556
721
|
activationFlow?: string;
|
|
557
722
|
/** Root wrapper of `<AppHeader>` (icon + merchant name row). */
|
|
558
723
|
appHeader?: string;
|
|
@@ -592,31 +757,42 @@ declare function resolveMcpClassNames(overrides: McpViewClassNames | undefined):
|
|
|
592
757
|
|
|
593
758
|
interface McpAccountViewProps {
|
|
594
759
|
/**
|
|
595
|
-
*
|
|
596
|
-
*
|
|
760
|
+
* Invoked product. Used as the identity header on credit and allowance
|
|
761
|
+
* states.
|
|
597
762
|
*/
|
|
598
763
|
product?: Pick<BootstrapProduct, 'name' | 'description'> | null;
|
|
764
|
+
/** Scopes active products and `useLimits` to this invocation. */
|
|
765
|
+
productRef?: string;
|
|
599
766
|
classNames?: McpViewClassNames;
|
|
600
767
|
/**
|
|
601
|
-
* Called when the user clicks
|
|
602
|
-
*
|
|
603
|
-
* `<McpAppShell>` wires this to a tab switch so nothing re-mounts.
|
|
768
|
+
* Called when the user clicks "Add funds". `<McpAppShell>`
|
|
769
|
+
* wires this to a surface swap so nothing re-mounts.
|
|
604
770
|
*/
|
|
605
771
|
onTopup?: () => void;
|
|
606
772
|
/**
|
|
607
|
-
* Called when the user clicks "
|
|
608
|
-
*
|
|
609
|
-
* switch to the checkout surface.
|
|
773
|
+
* Called when the user clicks "Turn on" or "Manage" on the
|
|
774
|
+
* auto-recharge row. Wired by the shell to the dedicated view.
|
|
610
775
|
*/
|
|
611
|
-
|
|
776
|
+
onAutoRecharge?: () => void;
|
|
612
777
|
/**
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
* `bootstrap.customer` is set) so the cards are not duplicated.
|
|
778
|
+
* Called when the user clicks "Pick a plan" or Change plan.
|
|
779
|
+
* Wired by the shell to switch to checkout.
|
|
616
780
|
*/
|
|
617
|
-
|
|
781
|
+
onChangePlan?: (planRef?: string) => void;
|
|
782
|
+
/**
|
|
783
|
+
* Product catalog used to decide Upgrade vs Change plan. The shell
|
|
784
|
+
* passes `bootstrap.plans`.
|
|
785
|
+
*/
|
|
786
|
+
plans?: readonly PlanLike[];
|
|
787
|
+
}
|
|
788
|
+
declare function McpAccountView({ product, productRef, classNames, onTopup, onAutoRecharge, onChangePlan, plans, }: McpAccountViewProps): react_jsx_runtime.JSX.Element;
|
|
789
|
+
|
|
790
|
+
interface McpAutoRechargeViewProps {
|
|
791
|
+
classNames?: McpViewClassNames;
|
|
792
|
+
/** Wired by the shell to return to the account surface. */
|
|
793
|
+
onBack?: () => void;
|
|
618
794
|
}
|
|
619
|
-
declare function
|
|
795
|
+
declare function McpAutoRechargeView({ classNames, onBack }: McpAutoRechargeViewProps): react_jsx_runtime.JSX.Element;
|
|
620
796
|
|
|
621
797
|
interface McpCheckoutViewProps {
|
|
622
798
|
productRef: string;
|
|
@@ -658,10 +834,21 @@ interface McpCheckoutViewProps {
|
|
|
658
834
|
* surface routing.
|
|
659
835
|
*/
|
|
660
836
|
onBack?: () => void;
|
|
837
|
+
/**
|
|
838
|
+
* Pre-select this plan and, with `autoAdvance`, skip the plan step
|
|
839
|
+
* by running `flow.advance()` once the selector has that plan.
|
|
840
|
+
*/
|
|
841
|
+
initialPlanRef?: string;
|
|
842
|
+
/**
|
|
843
|
+
* When set with `initialPlanRef`, fire the plan-step Continue path
|
|
844
|
+
* automatically so a ladder Switch/Activate lands on amount or
|
|
845
|
+
* payment — not a second plan picker.
|
|
846
|
+
*/
|
|
847
|
+
autoAdvance?: boolean;
|
|
661
848
|
classNames?: McpViewClassNames;
|
|
662
849
|
children?: React.ReactNode;
|
|
663
850
|
}
|
|
664
|
-
declare function McpCheckoutView({ productRef, publishableKey, returnUrl, onPurchaseSuccess, onRequestTopup: _onRequestTopup, fromPaywall, paywallKind, plans, onClose, onBack, classNames, children, }: McpCheckoutViewProps): react_jsx_runtime.JSX.Element;
|
|
851
|
+
declare function McpCheckoutView({ productRef, publishableKey, returnUrl, onPurchaseSuccess, onRequestTopup: _onRequestTopup, fromPaywall, paywallKind, plans, onClose, onBack, initialPlanRef, autoAdvance, classNames, children, }: McpCheckoutViewProps): react_jsx_runtime.JSX.Element;
|
|
665
852
|
|
|
666
853
|
interface McpTopupViewProps {
|
|
667
854
|
/** Public SDK contract — null means "no key supplied". Normalized internally. */
|
|
@@ -694,9 +881,10 @@ declare function McpTopupView({ publishableKey, returnUrl, onTopupSuccess, onBac
|
|
|
694
881
|
* The `paywall` / `nudge` kinds were removed as part of the text-only
|
|
695
882
|
* paywall refactor: merchant paywall / nudge responses are plain text
|
|
696
883
|
* narrations now, not widget surfaces. The iframe is only mounted for
|
|
697
|
-
* the
|
|
884
|
+
* the `account` viewer (slash prompts remap onto it with a `view`).
|
|
698
885
|
*/
|
|
699
|
-
|
|
886
|
+
|
|
887
|
+
type McpViewKind = SolvaPayMcpViewKind;
|
|
700
888
|
/**
|
|
701
889
|
* @deprecated Use `McpViewKind`. This alias exists for one minor
|
|
702
890
|
* version to give internal callers a grace window on the rename; the
|
|
@@ -734,15 +922,21 @@ interface McpViewRouterProps {
|
|
|
734
922
|
bootstrap: McpBootstrap;
|
|
735
923
|
views?: McpAppViewOverrides;
|
|
736
924
|
classNames?: McpViewClassNames;
|
|
737
|
-
/** Whether the shell already renders the customer/seller cards in a sidebar. */
|
|
738
|
-
suppressDetailCards?: boolean;
|
|
739
925
|
/**
|
|
740
926
|
* Called when a surface asks to swap to another surface in-session
|
|
741
|
-
* (account → topup via the
|
|
927
|
+
* (account → topup via the credits CTA, account → checkout via
|
|
742
928
|
* "Change plan", topup → account via "Back"). The shell wires this
|
|
743
929
|
* to its `overrideView` state.
|
|
744
930
|
*/
|
|
745
|
-
onSurfaceChange?: (next: McpViewKind
|
|
931
|
+
onSurfaceChange?: (next: McpViewKind, intent?: {
|
|
932
|
+
planRef?: string;
|
|
933
|
+
}) => void;
|
|
934
|
+
/**
|
|
935
|
+
* Plan the account ladder asked checkout to open on. The shell
|
|
936
|
+
* forwards it as `initialPlanRef` + `autoAdvance` so the plan step
|
|
937
|
+
* is skipped.
|
|
938
|
+
*/
|
|
939
|
+
overridePlanRef?: string;
|
|
746
940
|
/**
|
|
747
941
|
* Optional bootstrap re-fetcher. The shell triggers it once on mount
|
|
748
942
|
* so a customer who re-opens a backgrounded iframe sees fresh
|
|
@@ -761,7 +955,7 @@ interface McpViewRouterProps {
|
|
|
761
955
|
* Exported so integrators that own their own shell + provider mount
|
|
762
956
|
* can still get view dispatch for free.
|
|
763
957
|
*/
|
|
764
|
-
declare function McpViewRouter({ view, bootstrap, views, classNames,
|
|
958
|
+
declare function McpViewRouter({ view, bootstrap, views, classNames, onSurfaceChange, overridePlanRef, onRefreshBootstrap, onClose, }: McpViewRouterProps): React.ReactNode;
|
|
765
959
|
|
|
766
960
|
/**
|
|
767
961
|
* Minimal host-context shape `<McpApp>` reads. Kept loose so the real
|
|
@@ -816,6 +1010,7 @@ interface McpAppViewOverrides {
|
|
|
816
1010
|
checkout?: React.ComponentType<McpCheckoutViewProps>;
|
|
817
1011
|
account?: React.ComponentType<McpAccountViewProps>;
|
|
818
1012
|
topup?: React.ComponentType<McpTopupViewProps>;
|
|
1013
|
+
autoRecharge?: React.ComponentType<McpAutoRechargeViewProps>;
|
|
819
1014
|
}
|
|
820
1015
|
interface McpAppProps {
|
|
821
1016
|
app: McpAppFull;
|
|
@@ -865,114 +1060,195 @@ interface McpAppProps {
|
|
|
865
1060
|
}
|
|
866
1061
|
declare function McpApp({ app, productRef: productRefOverride, views, classNames, footer, onInitError, applyContext, onClose, messageOnSuccess, }: McpAppProps): react_jsx_runtime.JSX.Element;
|
|
867
1062
|
|
|
1063
|
+
interface ActiveProduct {
|
|
1064
|
+
reference: string;
|
|
1065
|
+
productName: string;
|
|
1066
|
+
productRef: string | null;
|
|
1067
|
+
planName: string | null;
|
|
1068
|
+
planRef: string | null;
|
|
1069
|
+
since: string | null;
|
|
1070
|
+
isMetered: boolean;
|
|
1071
|
+
amount: number;
|
|
1072
|
+
currency: string;
|
|
1073
|
+
}
|
|
1074
|
+
declare function deriveActiveProducts(purchases: readonly PurchaseInfo[] | undefined, productRef?: string | null): ActiveProduct[];
|
|
1075
|
+
declare function formatSince(iso: string | null, locale: string): string | null;
|
|
1076
|
+
declare function formatProductTerms(product: ActiveProduct, locale: string, extras?: {
|
|
1077
|
+
rate?: string | null;
|
|
1078
|
+
}): string;
|
|
1079
|
+
declare function formatAllowanceTerms(product: ActiveProduct, locale: string, extras?: {
|
|
1080
|
+
price?: string | null;
|
|
1081
|
+
renewsOn?: string | null;
|
|
1082
|
+
started?: boolean;
|
|
1083
|
+
qualifier?: 'one time' | null;
|
|
1084
|
+
}): string;
|
|
1085
|
+
|
|
868
1086
|
/**
|
|
869
|
-
* Pure
|
|
870
|
-
* activation strategy + action-affordance shape the shell renders per
|
|
871
|
-
* plan type.
|
|
872
|
-
*
|
|
873
|
-
* Keeping these in a standalone module lets the hosted manage page
|
|
874
|
-
* share the same matrix as the MCP shell — "one plan-shape matrix,
|
|
875
|
-
* two surfaces" — and makes the 4 × 2 × 3 test matrix from the plan a
|
|
876
|
-
* pure-function target (no RTL needed).
|
|
1087
|
+
* Pure account-widget state machine + field resolvers.
|
|
877
1088
|
*
|
|
878
|
-
*
|
|
879
|
-
*
|
|
880
|
-
*
|
|
881
|
-
*
|
|
882
|
-
* pay-as-you-go plan (which has no headline `price`) resolved to
|
|
883
|
-
* `'free'` and metered subscriptions were indistinguishable from
|
|
884
|
-
* unlimited ones.
|
|
1089
|
+
* `resolveAccountState()` maps bootstrap + limits onto the ten v3
|
|
1090
|
+
* states (A–J). The six field resolvers pin renderings that would
|
|
1091
|
+
* otherwise be re-decided per component. No React — same pattern as
|
|
1092
|
+
* `plan-actions.ts`.
|
|
885
1093
|
*/
|
|
886
1094
|
|
|
887
|
-
|
|
1095
|
+
declare const ACCOUNT_STATES: readonly ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"];
|
|
1096
|
+
type AccountState = (typeof ACCOUNT_STATES)[number];
|
|
1097
|
+
interface AccountLimitsLike {
|
|
1098
|
+
remaining: number | null;
|
|
1099
|
+
withinLimits: boolean | null;
|
|
1100
|
+
activationRequired: boolean | null;
|
|
1101
|
+
overage: boolean | null;
|
|
1102
|
+
needsTopUp: boolean | null;
|
|
1103
|
+
needsUpgrade: boolean | null;
|
|
1104
|
+
throttled: boolean | null;
|
|
1105
|
+
}
|
|
1106
|
+
interface AccountPurchaseLike {
|
|
1107
|
+
planSnapshot?: PlanLike | null;
|
|
1108
|
+
cancelledAt?: string | null;
|
|
1109
|
+
endDate?: string | null;
|
|
1110
|
+
usage?: {
|
|
1111
|
+
used?: number;
|
|
1112
|
+
periodEnd?: string | null;
|
|
1113
|
+
} | null;
|
|
1114
|
+
}
|
|
1115
|
+
interface AccountStateInput {
|
|
1116
|
+
/** Bootstrap / limits still in flight — state G. */
|
|
1117
|
+
loading?: boolean;
|
|
1118
|
+
purchase: AccountPurchaseLike | null | undefined;
|
|
1119
|
+
limits: AccountLimitsLike | null | undefined;
|
|
1120
|
+
/**
|
|
1121
|
+
* Pre-resolved shape. When omitted, derived from `purchase.planSnapshot`.
|
|
1122
|
+
* Callers that have the live catalog should pass `resolvePlanShape(mergePlanSnapshot(...))`.
|
|
1123
|
+
*/
|
|
1124
|
+
planShape?: PlanShape | null;
|
|
1125
|
+
now?: Date;
|
|
1126
|
+
}
|
|
888
1127
|
/**
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
*
|
|
1128
|
+
* Precedence (pinned in tests):
|
|
1129
|
+
* G loading
|
|
1130
|
+
* H `activationRequired` (outranks zero remaining → not F)
|
|
1131
|
+
* J `cancelledAt` + future `endDate` (outranks plan shape)
|
|
1132
|
+
* I `overage` (outranks `withinLimits` → not F)
|
|
1133
|
+
* D `needsTopUp` or a usage-based plan that is out of limits
|
|
1134
|
+
* F allowance plan at cap
|
|
1135
|
+
* B / C / E running plan-shape (`throttled` / `needsUpgrade` land here)
|
|
1136
|
+
* A no plan
|
|
896
1137
|
*/
|
|
897
|
-
|
|
1138
|
+
declare function resolveAccountState(input: AccountStateInput): AccountState;
|
|
1139
|
+
type RemainingDisplay = {
|
|
1140
|
+
kind: 'unknown';
|
|
1141
|
+
label: 'Not known yet';
|
|
1142
|
+
} | {
|
|
1143
|
+
kind: 'unlimited';
|
|
1144
|
+
label: 'Unlimited';
|
|
1145
|
+
} | {
|
|
1146
|
+
kind: 'finite';
|
|
1147
|
+
remaining: number;
|
|
1148
|
+
};
|
|
1149
|
+
declare function resolveRemaining(input: {
|
|
1150
|
+
remaining: number | null | undefined;
|
|
1151
|
+
/** Plan limit cap. `0` means unlimited (backend sentinel). */
|
|
1152
|
+
cap?: number | null;
|
|
1153
|
+
limitsResolved: boolean;
|
|
1154
|
+
}): RemainingDisplay;
|
|
1155
|
+
type MeterTone = 'ok' | 'warning' | 'critical';
|
|
898
1156
|
/**
|
|
899
|
-
*
|
|
900
|
-
*
|
|
901
|
-
* a snapshot may not. Usage-counting and the rest come out of `options[]`.
|
|
1157
|
+
* Warning at 80% used **or** last remaining call (`remaining === 1` on a
|
|
1158
|
+
* finite cap). Critical at 100%. E at 2 of 3 is the last-call case.
|
|
902
1159
|
*/
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
1160
|
+
declare function resolveMeterTone(input: {
|
|
1161
|
+
used: number;
|
|
1162
|
+
remaining: number | null;
|
|
1163
|
+
total: number | null;
|
|
1164
|
+
}): MeterTone;
|
|
1165
|
+
type RateDisplay = {
|
|
1166
|
+
kind: 'none';
|
|
1167
|
+
label: null;
|
|
1168
|
+
showRunway: false;
|
|
1169
|
+
} | {
|
|
1170
|
+
kind: 'unconvertible';
|
|
1171
|
+
label: 'Rate confirmed at checkout';
|
|
1172
|
+
showRunway: false;
|
|
1173
|
+
} | {
|
|
1174
|
+
kind: 'flat';
|
|
1175
|
+
creditsPerCall: number;
|
|
1176
|
+
label: string;
|
|
1177
|
+
showRunway: true;
|
|
1178
|
+
} | {
|
|
1179
|
+
kind: 'tiered';
|
|
1180
|
+
creditsPerCall: number;
|
|
1181
|
+
label: string;
|
|
1182
|
+
showRunway: true;
|
|
1183
|
+
};
|
|
1184
|
+
declare function resolveRateDisplay(plan: PricedLike | null | undefined, balance: BalancePegLike | null | undefined, meter?: string): RateDisplay;
|
|
1185
|
+
type PeriodDisplay = {
|
|
1186
|
+
kind: 'none';
|
|
1187
|
+
label: 'After your first call';
|
|
1188
|
+
} | {
|
|
1189
|
+
kind: 'date';
|
|
1190
|
+
periodEnd: string;
|
|
1191
|
+
};
|
|
1192
|
+
declare function resolvePeriodDisplay(periodEnd?: string | null): PeriodDisplay;
|
|
1193
|
+
interface OneTimeDisplay {
|
|
1194
|
+
showRenews: boolean;
|
|
1195
|
+
planQualifier: 'one time' | null;
|
|
916
1196
|
}
|
|
1197
|
+
declare function resolveOneTimeDisplay(plan: PricedLike | null | undefined): OneTimeDisplay;
|
|
917
1198
|
/**
|
|
918
|
-
*
|
|
919
|
-
*
|
|
920
|
-
* different set of CTAs, and a different activity-strip variant.
|
|
921
|
-
*
|
|
922
|
-
* A billing cycle is what separates a subscription from a one-off, and
|
|
923
|
-
* metering is what separates capped from unlimited. A paid plan with
|
|
924
|
-
* neither is a one-time purchase, which this matrix has no member for
|
|
925
|
-
* and folds into `'recurring-unlimited'` — the same bucket it landed in
|
|
926
|
-
* before, and the one that routes it to paid checkout.
|
|
1199
|
+
* The Sold-by strip is host chrome. No account state depends on it
|
|
1200
|
+
* being visible — provenance rides on the plan line.
|
|
927
1201
|
*/
|
|
928
|
-
declare function
|
|
1202
|
+
declare function resolveMerchantStrip(): {
|
|
1203
|
+
required: false;
|
|
1204
|
+
};
|
|
1205
|
+
declare function remainingCap(plan: PricedLike | null | undefined, meter?: string): number | null;
|
|
929
1206
|
/**
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
* Free and trial plans activate instantly, usage-based always tops up
|
|
933
|
-
* first, and everything else goes to Stripe checkout. A zero-priced
|
|
934
|
-
* plan needs no separate branch: it resolves to `'free'`, because
|
|
935
|
-
* charging nothing is what makes a plan free.
|
|
1207
|
+
* Whole days from `now` until `iso`. Floor at 0 so a past reset never
|
|
1208
|
+
* prints a negative caption. `null` when the date is unparseable.
|
|
936
1209
|
*/
|
|
937
|
-
declare function
|
|
1210
|
+
declare function daysUntil(iso: string, now?: Date): number | null;
|
|
938
1211
|
/**
|
|
939
|
-
*
|
|
940
|
-
*
|
|
941
|
-
* Cancel?" boolean maze into a single resolver call.
|
|
942
|
-
*
|
|
943
|
-
* Rules from the plan:
|
|
944
|
-
* - `topUp` — only on usage-based purchases.
|
|
945
|
-
* - `cancel` — recurring (paid subscription) and free plans. PAYG
|
|
946
|
-
* has no renewal to cancel.
|
|
947
|
-
* - `changePlan` — always, when the product exposes more than one
|
|
948
|
-
* plan.
|
|
949
|
-
* - `managePortal` — only when the customer has a payment method on
|
|
950
|
-
* file. Free plans that never charged a card skip this.
|
|
951
|
-
* - `upgrade` — shown *instead of* `changePlan` when the active plan
|
|
952
|
-
* is free AND at least one paid plan exists.
|
|
1212
|
+
* Display noun for an allowance meter. The default `requests` meter
|
|
1213
|
+
* reads as "calls" on this widget; any other meter keeps its name.
|
|
953
1214
|
*/
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
cancel: boolean;
|
|
957
|
-
changePlan: boolean;
|
|
958
|
-
managePortal: boolean;
|
|
959
|
-
upgrade: boolean;
|
|
960
|
-
}
|
|
961
|
-
interface PlanActionsInput {
|
|
962
|
-
purchase: PurchaseSnapshotLike | null | undefined;
|
|
963
|
-
/** Total plans exposed on the product. */
|
|
964
|
-
planCount: number;
|
|
965
|
-
/** Number of paid plans (price > 0, not free) on the product. */
|
|
966
|
-
paidPlanCount: number;
|
|
967
|
-
}
|
|
968
|
-
declare function resolvePlanActions({ purchase, planCount, paidPlanCount, }: PlanActionsInput): PlanActions;
|
|
1215
|
+
declare function allowanceMeterUnit(meter: string | null | undefined, count: number): string;
|
|
1216
|
+
|
|
969
1217
|
/**
|
|
970
|
-
*
|
|
971
|
-
*
|
|
972
|
-
* has no active purchase.
|
|
1218
|
+
* A/F ladder copy — what happens at the limit, and whether a card is
|
|
1219
|
+
* needed. Used on every ladder row in both inline and fullscreen.
|
|
973
1220
|
*/
|
|
974
|
-
|
|
975
|
-
declare function
|
|
1221
|
+
|
|
1222
|
+
declare function planConsequence(plan: PlanLike, locale: string, balance: BalancePegLike | null | undefined, extras?: {
|
|
1223
|
+
merchantName?: string | null;
|
|
1224
|
+
}): string;
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Map `get_history` rows onto the designed fullscreen tables.
|
|
1228
|
+
*
|
|
1229
|
+
* Credit activity is account-wide (seven B2 fields → Event / When /
|
|
1230
|
+
* Credits / Balance). Charges are product-scoped (Charge / Date /
|
|
1231
|
+
* Amount). No receipt column.
|
|
1232
|
+
*/
|
|
1233
|
+
|
|
1234
|
+
declare const CREDIT_ACTIVITY_TYPE_LABELS: Record<CreditActivityType, string>;
|
|
1235
|
+
declare function mapCreditActivityRow(entry: CreditActivityEntry, locale: string): {
|
|
1236
|
+
title: string;
|
|
1237
|
+
subtitle: string | null;
|
|
1238
|
+
when: string;
|
|
1239
|
+
credits: string;
|
|
1240
|
+
balance: string;
|
|
1241
|
+
};
|
|
1242
|
+
declare function mapChargeRow(purchase: PurchaseInfo, locale: string): {
|
|
1243
|
+
charge: string;
|
|
1244
|
+
date: string;
|
|
1245
|
+
amount: string;
|
|
1246
|
+
};
|
|
1247
|
+
declare function formatMerchantPlace(merchant: {
|
|
1248
|
+
city?: string | null;
|
|
1249
|
+
stateOrCounty?: string | null;
|
|
1250
|
+
}): string | null;
|
|
1251
|
+
declare function websiteHostLabel(url: string): string;
|
|
976
1252
|
|
|
977
1253
|
interface BackLinkProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
978
1254
|
/** Visible label; typically `"Back to my account"` or `"Change amount"`. */
|
|
@@ -1078,39 +1354,242 @@ declare function McpHostInfoProvider({ hostName, children }: McpHostInfoProvider
|
|
|
1078
1354
|
*/
|
|
1079
1355
|
declare function useHostName(): string | null;
|
|
1080
1356
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1357
|
+
/**
|
|
1358
|
+
* MCP Apps display-mode types and host-context readers.
|
|
1359
|
+
*
|
|
1360
|
+
* Display mode is host state, not routing: the host publishes
|
|
1361
|
+
* `displayMode` / `availableDisplayModes` on `McpUiHostContext`.
|
|
1362
|
+
* The host owns the expand affordance; the SDK reads and reacts.
|
|
1363
|
+
* `@solvapay/react/mcp` does not import
|
|
1364
|
+
* `@modelcontextprotocol/ext-apps` — these types are structural
|
|
1365
|
+
* aliases of that package's `McpUiDisplayMode` /
|
|
1366
|
+
* `McpUiAppCapabilities.availableDisplayModes`.
|
|
1367
|
+
*/
|
|
1368
|
+
declare const MCP_DISPLAY_MODES: readonly ["inline", "fullscreen", "pip"];
|
|
1369
|
+
type McpDisplayMode = (typeof MCP_DISPLAY_MODES)[number];
|
|
1370
|
+
interface McpSafeAreaInsets {
|
|
1371
|
+
top: number;
|
|
1372
|
+
right: number;
|
|
1373
|
+
bottom: number;
|
|
1374
|
+
left: number;
|
|
1375
|
+
}
|
|
1376
|
+
interface McpContainerDimensions {
|
|
1377
|
+
width?: number;
|
|
1378
|
+
height?: number;
|
|
1379
|
+
maxWidth?: number;
|
|
1380
|
+
maxHeight?: number;
|
|
1381
|
+
}
|
|
1382
|
+
interface McpDisplayModeState {
|
|
1383
|
+
displayMode: McpDisplayMode;
|
|
1384
|
+
availableDisplayModes: readonly McpDisplayMode[];
|
|
1385
|
+
containerDimensions?: McpContainerDimensions;
|
|
1386
|
+
safeAreaInsets?: McpSafeAreaInsets;
|
|
1095
1387
|
}
|
|
1096
1388
|
/**
|
|
1097
|
-
*
|
|
1098
|
-
*
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1389
|
+
* Capabilities the view advertises on `ui/initialize`. Pass as the
|
|
1390
|
+
* second argument to `new App(info, capabilities)` so the host only
|
|
1391
|
+
* offers modes this surface can handle. `pip` is excluded — account
|
|
1392
|
+
* and checkout are not live sessions.
|
|
1101
1393
|
*/
|
|
1102
|
-
declare
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1394
|
+
declare const SOLVAPAY_MCP_APP_CAPABILITIES: {
|
|
1395
|
+
availableDisplayModes: readonly ["inline", "fullscreen"];
|
|
1396
|
+
};
|
|
1397
|
+
declare const DEFAULT_DISPLAY_MODE_STATE: McpDisplayModeState;
|
|
1398
|
+
/** Host width at which fullscreen may use the 340px payment split. */
|
|
1399
|
+
declare const MCP_HOSTED_MIN_WIDTH = 1000;
|
|
1400
|
+
type McpHostedRail = 'hosted' | 'inline' | 'widget';
|
|
1401
|
+
/**
|
|
1402
|
+
* Space the host says we have. Prefer the tighter of `width` and
|
|
1403
|
+
* `maxWidth`.
|
|
1404
|
+
*/
|
|
1405
|
+
declare function hostWidthPx(dimensions: McpContainerDimensions | undefined): number | undefined;
|
|
1406
|
+
/**
|
|
1407
|
+
* Which payment geometry to stamp on `data-rail`.
|
|
1408
|
+
*
|
|
1409
|
+
* - `inline` — widget; 260px split only at the 760px mcp query
|
|
1410
|
+
* - `hosted` — fullscreen; 340px split at the 1000px `mcp-hosted` query
|
|
1411
|
+
*
|
|
1412
|
+
* Fullscreen always stamps `hosted`. Host-reported
|
|
1413
|
+
* `containerDimensions` can be stale (MCPJam keeps a 720 template
|
|
1414
|
+
* width on a `fixed inset-0` surface), so the JS width gate is not
|
|
1415
|
+
* trusted. `@container mcp-hosted (min-width: 1000px)` owns the
|
|
1416
|
+
* geometry from the measured width. Chrome (`displayMode`) stays
|
|
1417
|
+
* fullscreen either way.
|
|
1418
|
+
*/
|
|
1419
|
+
declare function resolveHostedRail(state: Pick<McpDisplayModeState, 'displayMode'>): McpHostedRail;
|
|
1420
|
+
declare function isMcpDisplayMode(value: unknown): value is McpDisplayMode;
|
|
1421
|
+
/**
|
|
1422
|
+
* Pull display-mode fields out of a host-context object. Unknown or
|
|
1423
|
+
* missing values fall back to {@link DEFAULT_DISPLAY_MODE_STATE} —
|
|
1424
|
+
* never invent a mode the host did not advertise.
|
|
1425
|
+
*/
|
|
1426
|
+
declare function readDisplayModeState(ctx: unknown): McpDisplayModeState;
|
|
1427
|
+
/**
|
|
1428
|
+
* Host composer / device insets as root-container padding.
|
|
1429
|
+
*
|
|
1430
|
+
* Read `hostContext.safeAreaInsets`, not `env(safe-area-inset-*)` —
|
|
1431
|
+
* inside a sandboxed iframe the env() values are the device's, and
|
|
1432
|
+
* the host composer is what actually overlaps us. Zero when the host
|
|
1433
|
+
* reports nothing; adding zero is harmless.
|
|
1434
|
+
*/
|
|
1435
|
+
declare function hostSafeAreaPadding(insets: McpSafeAreaInsets | undefined): {
|
|
1436
|
+
paddingTop: number;
|
|
1437
|
+
paddingRight: number;
|
|
1438
|
+
paddingBottom: number;
|
|
1439
|
+
paddingLeft: number;
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
interface McpDisplayModeProviderProps {
|
|
1443
|
+
value: McpDisplayModeState;
|
|
1444
|
+
children: React.ReactNode;
|
|
1107
1445
|
}
|
|
1446
|
+
declare function McpDisplayModeProvider({ value, children }: McpDisplayModeProviderProps): react_jsx_runtime.JSX.Element;
|
|
1447
|
+
/** Current host display mode. Never throws; defaults to inline. */
|
|
1448
|
+
declare function useDisplayMode(): McpDisplayModeState;
|
|
1449
|
+
|
|
1450
|
+
/**
|
|
1451
|
+
* Payment-form identity caption. Renders `Paying as {email}` only —
|
|
1452
|
+
* no merchant name, no middot join. Fullscreen stacks a muted label
|
|
1453
|
+
* over the email; inline is a single muted span.
|
|
1454
|
+
*/
|
|
1455
|
+
|
|
1456
|
+
interface McpPayingAsProps {
|
|
1457
|
+
/** Override the signed-in customer email. */
|
|
1458
|
+
email?: string | null;
|
|
1459
|
+
}
|
|
1460
|
+
declare function McpPayingAs({ email }: McpPayingAsProps): React.ReactElement | null;
|
|
1461
|
+
|
|
1462
|
+
declare function Section({ title, children, className, }: {
|
|
1463
|
+
title?: string;
|
|
1464
|
+
children: React.ReactNode;
|
|
1465
|
+
className?: string;
|
|
1466
|
+
}): React.ReactElement;
|
|
1467
|
+
declare function Eyebrow({ children, variant, className, }: {
|
|
1468
|
+
children: React.ReactNode;
|
|
1469
|
+
variant?: 'step' | 'rail';
|
|
1470
|
+
className?: string;
|
|
1471
|
+
}): React.ReactElement;
|
|
1472
|
+
declare function LineItem({ label, value, muted, className, }: {
|
|
1473
|
+
label: React.ReactNode;
|
|
1474
|
+
value: React.ReactNode;
|
|
1475
|
+
muted?: boolean;
|
|
1476
|
+
className?: string;
|
|
1477
|
+
}): React.ReactElement;
|
|
1478
|
+
interface AmountLadderRow {
|
|
1479
|
+
label: React.ReactNode;
|
|
1480
|
+
value: React.ReactNode;
|
|
1481
|
+
muted?: boolean;
|
|
1482
|
+
}
|
|
1483
|
+
declare function AmountLadder({ rows, className, }: {
|
|
1484
|
+
rows: readonly AmountLadderRow[];
|
|
1485
|
+
className?: string;
|
|
1486
|
+
}): React.ReactElement;
|
|
1487
|
+
declare function PresetTile({ amount, credits, selected, onClick, className, }: {
|
|
1488
|
+
amount: React.ReactNode;
|
|
1489
|
+
credits: React.ReactNode;
|
|
1490
|
+
selected?: boolean;
|
|
1491
|
+
onClick?: () => void;
|
|
1492
|
+
className?: string;
|
|
1493
|
+
}): React.ReactElement;
|
|
1494
|
+
declare function PlanRow({ name, description, price, selected, current, disabled, state, onClick, className, ...rest }: {
|
|
1495
|
+
name: React.ReactNode;
|
|
1496
|
+
description?: React.ReactNode;
|
|
1497
|
+
price: React.ReactNode;
|
|
1498
|
+
selected?: boolean;
|
|
1499
|
+
current?: boolean;
|
|
1500
|
+
disabled?: boolean;
|
|
1501
|
+
state?: 'idle' | 'selected' | 'current' | 'disabled';
|
|
1502
|
+
onClick?: () => void;
|
|
1503
|
+
className?: string;
|
|
1504
|
+
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'className'>): React.ReactElement;
|
|
1505
|
+
declare function StatusDot({ label, empty, className, }: {
|
|
1506
|
+
label?: string;
|
|
1507
|
+
/** Outline-only dot — state A "No plan". */
|
|
1508
|
+
empty?: boolean;
|
|
1509
|
+
className?: string;
|
|
1510
|
+
}): React.ReactElement;
|
|
1511
|
+
declare function Pill({ children, className, }: {
|
|
1512
|
+
children: React.ReactNode;
|
|
1513
|
+
className?: string;
|
|
1514
|
+
}): React.ReactElement;
|
|
1515
|
+
type StatusPillTone = 'neutral' | 'accent';
|
|
1516
|
+
/** Accent is reserved for the one failing/warning pill: D, F, I. */
|
|
1517
|
+
declare function statusPillTone(state: AccountState): StatusPillTone;
|
|
1518
|
+
declare function StatusPill({ children, tone, className, }: {
|
|
1519
|
+
children: React.ReactNode;
|
|
1520
|
+
tone?: StatusPillTone;
|
|
1521
|
+
className?: string;
|
|
1522
|
+
}): React.ReactElement;
|
|
1523
|
+
interface FactBandItem {
|
|
1524
|
+
key: string;
|
|
1525
|
+
label: React.ReactNode;
|
|
1526
|
+
value: React.ReactNode;
|
|
1527
|
+
/** Narrow-row value. Falls back to `value` when omitted. */
|
|
1528
|
+
compactValue?: React.ReactNode;
|
|
1529
|
+
caption?: React.ReactNode;
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Remaining-led fact strip. Columns at the 760px sidebar breakpoint,
|
|
1533
|
+
* key-value rows below it. Callers omit a fact entirely — never pass a
|
|
1534
|
+
* placeholder column. Unmetered subscriptions still render Remaining as
|
|
1535
|
+
* Unlimited; they omit the meter, not the fact.
|
|
1536
|
+
*/
|
|
1537
|
+
declare function FactBand({ items, className, }: {
|
|
1538
|
+
items: readonly FactBandItem[];
|
|
1539
|
+
className?: string;
|
|
1540
|
+
}): React.ReactElement;
|
|
1541
|
+
declare function sanitizeDecimalInput(raw: string): string;
|
|
1542
|
+
declare function Field({ id, label, value, onChange, prefix, suffix, placeholder, disabled, inputMode, ariaLabel, className, }: {
|
|
1543
|
+
id: string;
|
|
1544
|
+
label: string;
|
|
1545
|
+
value: string;
|
|
1546
|
+
onChange: (value: string) => void;
|
|
1547
|
+
prefix?: string;
|
|
1548
|
+
suffix?: string;
|
|
1549
|
+
placeholder?: string;
|
|
1550
|
+
disabled?: boolean;
|
|
1551
|
+
inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];
|
|
1552
|
+
ariaLabel?: string;
|
|
1553
|
+
className?: string;
|
|
1554
|
+
}): React.ReactElement;
|
|
1555
|
+
declare function Toggle({ checked, onChange, label, className, }: {
|
|
1556
|
+
checked: boolean;
|
|
1557
|
+
onChange: (checked: boolean) => void;
|
|
1558
|
+
label: string;
|
|
1559
|
+
className?: string;
|
|
1560
|
+
}): React.ReactElement;
|
|
1561
|
+
declare function LedgerRow({ cells, className, }: {
|
|
1562
|
+
cells: readonly {
|
|
1563
|
+
content: React.ReactNode;
|
|
1564
|
+
align?: 'left' | 'right';
|
|
1565
|
+
}[];
|
|
1566
|
+
className?: string;
|
|
1567
|
+
}): React.ReactElement;
|
|
1568
|
+
declare function AttributionFooter({ children, className, }: {
|
|
1569
|
+
children: React.ReactNode;
|
|
1570
|
+
className?: string;
|
|
1571
|
+
}): React.ReactElement;
|
|
1572
|
+
declare function SplitRow({ children, className, }: {
|
|
1573
|
+
children: React.ReactNode;
|
|
1574
|
+
className?: string;
|
|
1575
|
+
}): React.ReactElement;
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* MCP account-widget wrapper around the shared `<UsageMeter>`.
|
|
1579
|
+
*
|
|
1580
|
+
* Pins `warningAt=80` / `criticalAt=100` (shared defaults are 75/90) and
|
|
1581
|
+
* forces a warning when `remaining === 1` on a finite cap — E at 2 of 3
|
|
1582
|
+
* is a last-call warning, not a 67%=80% bug.
|
|
1583
|
+
*/
|
|
1584
|
+
|
|
1585
|
+
declare const MCP_USAGE_WARNING_AT = 80;
|
|
1586
|
+
declare const MCP_USAGE_CRITICAL_AT = 100;
|
|
1108
1587
|
/**
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1111
|
-
* iframe should see who they're actually paying, to the same level of
|
|
1112
|
-
* detail as hosted checkout.
|
|
1588
|
+
* `0` when remaining is the last call on a finite cap so the shared
|
|
1589
|
+
* percent gate still flips to warning below 80%. Otherwise 80.
|
|
1113
1590
|
*/
|
|
1114
|
-
declare function
|
|
1591
|
+
declare function mcpUsageWarningAt(remaining: number | null | undefined): number;
|
|
1592
|
+
type McpUsageMeterProps = Omit<UsageMeterRootProps, 'warningAt' | 'criticalAt'>;
|
|
1593
|
+
declare function McpUsageMeter({ usageOverride, className, children, ...rest }: McpUsageMeterProps): React.ReactElement;
|
|
1115
1594
|
|
|
1116
|
-
export { type ActivationStrategy, type ActivityStripKind, AppHeader, type AppHeaderMode, type AppHeaderProps, type AppToolResultEvents, BackLink, type BackLinkProps, HOSTS_WITH_MERCHANT_CHROME, type HostEntryClassification, McpAccountView, type McpAccountViewProps, McpApp, type McpAppBootstrapLike, type McpAppFull, type McpAppLike, type McpAppProps, McpAppShell, type McpAppShellProps, type McpAppViewOverrides, type McpBootstrap, type McpBridgeAppLike, McpBridgeProvider, type McpBridgeProviderProps, type McpBridgeValue, McpCheckoutView, type McpCheckoutViewProps,
|
|
1595
|
+
export { ACCOUNT_STATES, type AccountLimitsLike, type AccountPurchaseLike, type AccountState, type AccountStateInput, type ActivationStrategy, type ActiveProduct, type ActivityStripKind, AmountLadder, type AmountLadderRow, AppHeader, type AppHeaderMode, type AppHeaderProps, type AppToolResultEvents, AttributionFooter, BackLink, type BackLinkProps, CREDIT_ACTIVITY_TYPE_LABELS, DEFAULT_DISPLAY_MODE_STATE, Eyebrow, FactBand, type FactBandItem, Field, HOSTS_WITH_MERCHANT_CHROME, type HostEntryClassification, LedgerRow, LineItem, MCP_DISPLAY_MODES, MCP_HOSTED_MIN_WIDTH, MCP_USAGE_CRITICAL_AT, MCP_USAGE_WARNING_AT, McpAccountView, type McpAccountViewProps, McpApp, type McpAppBootstrapLike, type McpAppFull, type McpAppLike, type McpAppProps, McpAppShell, type McpAppShellProps, type McpAppViewOverrides, McpAutoRechargeView, type McpAutoRechargeViewProps, type McpBootstrap, type McpBridgeAppLike, McpBridgeProvider, type McpBridgeProviderProps, type McpBridgeValue, McpCheckoutView, type McpCheckoutViewProps, type McpContainerDimensions, type McpDisplayMode, McpDisplayModeProvider, type McpDisplayModeProviderProps, type McpDisplayModeState, McpHostInfoProvider, type McpHostInfoProviderProps, type McpHostedRail, type McpMessageOnSuccess, McpPayingAs, type McpPayingAsProps, type McpSafeAreaInsets, type McpSuccessEvent, type McpTabKind, type McpToolResult, McpTopupView, type McpTopupViewProps, type McpUiHostContextLike, McpUsageMeter, type McpUsageMeterProps, type McpView, type McpViewClassNames, type McpViewKind, McpViewRouter, type McpViewRouterProps, type MeterTone, type NotifyModelContextParams, type OneTimeDisplay, type PeriodDisplay, Pill, type PlanActions, type PlanActionsInput, type PlanLike, PlanRow, type PlanShape, PresetTile, type PurchaseSnapshotLike, type RateDisplay, type RemainingDisplay, SOLVAPAY_MCP_APP_CAPABILITIES, SOLVAPAY_TRANSPORT_TOOL_NAMES, Section, type SendMessageParams, SplitRow, StatusDot, StatusPill, type StatusPillTone, type StripeProbeState, Toggle, type WaitForInitialToolResultOptions, type WaitForInitialToolResultResult, allowanceMeterUnit, classifyHostEntry, createMcpAppAdapter, daysUntil, deriveActiveProducts, fetchMcpBootstrap, fetchMcpBootstrapViaResource, findCatalogPlan, formatAllowanceTerms, formatMerchantPlace, formatProductTerms, formatSince, hostSafeAreaPadding, hostWidthPx, isMcpDisplayMode, isTransportToolName, mapChargeRow, mapCreditActivityRow, mcpUsageWarningAt, mergePlanSnapshot, parseBootstrapFromToolResult, planConsequence, readDisplayModeState, remainingCap, resolveAccountState, resolveActivationStrategy, resolveActivityStrip, resolveHostedRail, resolveMcpClassNames, resolveMerchantStrip, resolveMeterTone, resolveOneTimeDisplay, resolvePeriodDisplay, resolvePlanActions, resolvePlanShape, resolveRateDisplay, resolveRemaining, sanitizeDecimalInput, seedMcpCaches, statusPillTone, useDisplayMode, useHostLocale, useHostName, useMcpBridge, useMcpToolResult, useStripeProbe, waitForInitialToolResult, websiteHostLabel };
|