@solvapay/react 2.1.1 → 2.2.0-preview-11dbbe603cd1b9a44cc41b5eee3686bc4000f97f

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.
@@ -1,4 +1,4 @@
1
- import { $ as components, b as Plan, P as PaymentFormProps, a as PrefillCustomer, A as ActivationResult, r as UseTopupAmountSelectorReturn, a0 as AutoRechargeInput, t as AutoRechargeConfig, a1 as AutoRechargeDisplayBlock, E as CheckoutStep, O as SuccessMeta } from './shared-CUl6mTC1.js';
1
+ import { $ as components, b as Plan, P as PaymentFormProps, a as PrefillCustomer, A as ActivationResult, s as UseTopupAmountSelectorReturn, a0 as AutoRechargeInput, u as AutoRechargeConfig, a1 as AutoRechargeDisplayBlock, E as CheckoutStep, O as SuccessMeta } from './shared-BQbMyX5V.cjs';
2
2
  import React from 'react';
3
3
  import { PaymentElement, CardElement } from '@stripe/react-stripe-js';
4
4
  import { TaxBreakdown } from '@solvapay/core';
@@ -17,7 +17,36 @@ type LimitActivationProduct = components['schemas']['LimitProductBriefDto'];
17
17
  /**
18
18
  * Structured content for paywall errors (MCP structuredContent and manual handling).
19
19
  */
20
- type PaywallStructuredContent = {
20
+ /**
21
+ * Fields shared by every `PaywallStructuredContent` kind so a text-only
22
+ * host can recover from a gate without a second tool call. Every field
23
+ * other than `kind` / `product` / `checkoutUrl` / `message` is omitted
24
+ * when the backend did not send it — never defaulted.
25
+ */
26
+ type PaywallGateRecoveryFields = {
27
+ /** Active plan reference from `limits.plan`. */
28
+ planRef?: string;
29
+ /** Product plans from `checkLimits` (activation already had this). */
30
+ plans?: LimitPlanSummary[];
31
+ /** Meter the gated call was charged against. */
32
+ meterName?: string;
33
+ /** Per-unit charge of the active plan, in minor currency units. */
34
+ unitPriceMinor?: number;
35
+ /** ISO 4217 currency for `unitPriceMinor`. */
36
+ currency?: string;
37
+ /**
38
+ * Included-usage counters. Omitted when `freeUnits` is absent or `0`
39
+ * (the unlimited sentinel) so we never emit misleading zeros.
40
+ */
41
+ included?: {
42
+ total: number;
43
+ used: number;
44
+ remaining: number;
45
+ };
46
+ /** Prepaid credit balance, coalesced from nested or top-level fields. */
47
+ creditBalance?: number;
48
+ };
49
+ type PaywallStructuredContent = ({
21
50
  kind: 'payment_required';
22
51
  /** Product ref from paywall metadata (or env default) */
23
52
  product: string;
@@ -32,7 +61,7 @@ type PaywallStructuredContent = {
32
61
  balance?: LimitActivationBalance;
33
62
  /** Rich product context from checkLimits (name, ref, provider slug/id) */
34
63
  productDetails?: LimitActivationProduct;
35
- } | {
64
+ } & PaywallGateRecoveryFields) | ({
36
65
  kind: 'activation_required';
37
66
  /** Product ref from paywall metadata (or env default) */
38
67
  product: string;
@@ -42,11 +71,10 @@ type PaywallStructuredContent = {
42
71
  */
43
72
  checkoutUrl: string;
44
73
  confirmationUrl?: string;
45
- plans?: LimitPlanSummary[];
46
74
  balance?: LimitActivationBalance;
47
75
  /** Rich product context from checkLimits (name, ref, provider slug/id) */
48
76
  productDetails?: LimitActivationProduct;
49
- };
77
+ } & PaywallGateRecoveryFields);
50
78
 
51
79
  /**
52
80
  * Default-tree shim over the `CheckoutSummary` primitive.
@@ -1,4 +1,4 @@
1
- import { $ as components, b as Plan, P as PaymentFormProps, a as PrefillCustomer, A as ActivationResult, r as UseTopupAmountSelectorReturn, a0 as AutoRechargeInput, t as AutoRechargeConfig, a1 as AutoRechargeDisplayBlock, E as CheckoutStep, O as SuccessMeta } from './shared-D0hmT1qU.cjs';
1
+ import { $ as components, b as Plan, P as PaymentFormProps, a as PrefillCustomer, A as ActivationResult, s as UseTopupAmountSelectorReturn, a0 as AutoRechargeInput, u as AutoRechargeConfig, a1 as AutoRechargeDisplayBlock, E as CheckoutStep, O as SuccessMeta } from './shared-DJdsOLag.js';
2
2
  import React from 'react';
3
3
  import { PaymentElement, CardElement } from '@stripe/react-stripe-js';
4
4
  import { TaxBreakdown } from '@solvapay/core';
@@ -17,7 +17,36 @@ type LimitActivationProduct = components['schemas']['LimitProductBriefDto'];
17
17
  /**
18
18
  * Structured content for paywall errors (MCP structuredContent and manual handling).
19
19
  */
20
- type PaywallStructuredContent = {
20
+ /**
21
+ * Fields shared by every `PaywallStructuredContent` kind so a text-only
22
+ * host can recover from a gate without a second tool call. Every field
23
+ * other than `kind` / `product` / `checkoutUrl` / `message` is omitted
24
+ * when the backend did not send it — never defaulted.
25
+ */
26
+ type PaywallGateRecoveryFields = {
27
+ /** Active plan reference from `limits.plan`. */
28
+ planRef?: string;
29
+ /** Product plans from `checkLimits` (activation already had this). */
30
+ plans?: LimitPlanSummary[];
31
+ /** Meter the gated call was charged against. */
32
+ meterName?: string;
33
+ /** Per-unit charge of the active plan, in minor currency units. */
34
+ unitPriceMinor?: number;
35
+ /** ISO 4217 currency for `unitPriceMinor`. */
36
+ currency?: string;
37
+ /**
38
+ * Included-usage counters. Omitted when `freeUnits` is absent or `0`
39
+ * (the unlimited sentinel) so we never emit misleading zeros.
40
+ */
41
+ included?: {
42
+ total: number;
43
+ used: number;
44
+ remaining: number;
45
+ };
46
+ /** Prepaid credit balance, coalesced from nested or top-level fields. */
47
+ creditBalance?: number;
48
+ };
49
+ type PaywallStructuredContent = ({
21
50
  kind: 'payment_required';
22
51
  /** Product ref from paywall metadata (or env default) */
23
52
  product: string;
@@ -32,7 +61,7 @@ type PaywallStructuredContent = {
32
61
  balance?: LimitActivationBalance;
33
62
  /** Rich product context from checkLimits (name, ref, provider slug/id) */
34
63
  productDetails?: LimitActivationProduct;
35
- } | {
64
+ } & PaywallGateRecoveryFields) | ({
36
65
  kind: 'activation_required';
37
66
  /** Product ref from paywall metadata (or env default) */
38
67
  product: string;
@@ -42,11 +71,10 @@ type PaywallStructuredContent = {
42
71
  */
43
72
  checkoutUrl: string;
44
73
  confirmationUrl?: string;
45
- plans?: LimitPlanSummary[];
46
74
  balance?: LimitActivationBalance;
47
75
  /** Rich product context from checkLimits (name, ref, provider slug/id) */
48
76
  productDetails?: LimitActivationProduct;
49
- };
77
+ } & PaywallGateRecoveryFields);
50
78
 
51
79
  /**
52
80
  * Default-tree shim over the `CheckoutSummary` primitive.