@solvapay/react 1.0.9 → 2.0.0-preview-4a7c769f90e0a4169dd30338d9139a3631aa6906
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 +67 -3
- package/README.md +62 -3
- package/dist/adapters/auth.js +0 -1
- package/dist/{chunk-HWVJL5X6.js → chunk-6VKNPQJT.js} +1 -1
- package/dist/{chunk-37R5NZGF.js → chunk-BB3VVVBI.js} +1 -31
- package/dist/{chunk-R2ZPZ7VM.js → chunk-I744P2TC.js} +32 -2
- package/dist/chunk-PLPNLBDA.js +10 -0
- package/dist/{index-onWNU7iT.d.ts → index-BrQgUDNH.d.ts} +7 -44
- package/dist/{index-WBjulQHf.d.cts → index-CrTUB4dF.d.cts} +7 -44
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -6
- package/dist/mcp/index.cjs +252 -795
- package/dist/mcp/index.d.cts +166 -142
- package/dist/mcp/index.d.ts +166 -142
- package/dist/mcp/index.js +235 -434
- package/dist/mcp/styles.css +68 -149
- package/dist/primitives/index.d.cts +3 -3
- package/dist/primitives/index.d.ts +3 -3
- package/dist/primitives/index.js +333 -15
- package/dist/{useUsage-nD7zwSbG.d.ts → useUsage-BNnyZ-os.d.ts} +45 -2
- package/dist/{useUsage-BmOYXxgG.d.cts → useUsage-geKuuRoO.d.cts} +45 -2
- package/package.json +4 -4
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-ZAV7CQ4G.js +0 -361
- package/dist/webapi-K5XBCEO6.js +0 -3775
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# @solvapay/react changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0-preview-4a7c769f90e0a4169dd30338d9139a3631aa6906
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5d55459: **Text-only paywall / nudge — widget iframe reserved for deliberate
|
|
8
|
+
intent-tool calls.**
|
|
9
|
+
|
|
10
|
+
Paywall, low-balance nudge, and activation-required responses from
|
|
11
|
+
merchant `registerPayable` tools are now plain text narrations
|
|
12
|
+
instead of widget surfaces. `content[0].text` names the recovery
|
|
13
|
+
intent tool (`upgrade` / `topup` / `activate_plan`) and inlines
|
|
14
|
+
`gate.checkoutUrl` for terminal-first hosts. `isError` stays `false`
|
|
15
|
+
and `structuredContent = gate` for programmatic consumers. The
|
|
16
|
+
SolvaPay widget iframe now only opens when the user (or LLM)
|
|
17
|
+
deliberately invokes one of the three SolvaPay intent tools —
|
|
18
|
+
`upgrade`, `manage_account`, `topup` — where the UX genuinely is the
|
|
19
|
+
iframe.
|
|
20
|
+
|
|
21
|
+
Why: descriptor-advertising `_meta.ui.resourceUri` means the host
|
|
22
|
+
MUST open the iframe on every call per SEP-1865 / MCP Apps
|
|
23
|
+
(2026-01-26). Stamping it on payable data tools made silent
|
|
24
|
+
successes flash an empty widget next to every `predict_direction` /
|
|
25
|
+
`search_knowledge` result — the original "MCP App: ui://…" empty box
|
|
26
|
+
complaint.
|
|
27
|
+
|
|
28
|
+
**Breaking changes:**
|
|
29
|
+
- `@solvapay/server` — gate `message` copy changed. `classifyPaywallState` +
|
|
30
|
+
`buildGateMessage` (new, exported) now produce the narration; the
|
|
31
|
+
previous "Pick a plan below to keep going" text is gone. Client code
|
|
32
|
+
that asserted substrings on `gate.message` needs to update. The
|
|
33
|
+
structured gate shape (`kind`, `checkoutUrl`, `plans`, `balance`,
|
|
34
|
+
`productDetails`) is unchanged.
|
|
35
|
+
- `@solvapay/mcp` — `registerPayableTool` no longer accepts or honours
|
|
36
|
+
the `resourceUri` option. One-line fix for direct callers: delete
|
|
37
|
+
the `resourceUri` argument. The convenience
|
|
38
|
+
`registerPayable({...})` binding inside
|
|
39
|
+
`createSolvaPayMcpServer({ additionalTools })` already strips it
|
|
40
|
+
transparently.
|
|
41
|
+
- `@solvapay/mcp-core` — `BuildPayableHandlerContext.resourceUri`
|
|
42
|
+
removed. `SolvaPayMcpPaywallContent` removed. `SolvaPayMcpViewKind`
|
|
43
|
+
narrowed to `'checkout' | 'account' | 'topup'`. `BootstrapPayload`
|
|
44
|
+
loses the `paywall` / `nudge` / `data` fields.
|
|
45
|
+
`buildPaywallUiMeta`, `PaywallUiMeta`, and `PaywallUiMetaInput`
|
|
46
|
+
(previously deprecated) are removed outright.
|
|
47
|
+
- `@solvapay/react` — `McpPaywallView`, `McpNudgeView`, and
|
|
48
|
+
`McpUpsellStrip` (plus their prop types) removed from the public
|
|
49
|
+
surface along with the matching `McpAppViewOverrides` slots.
|
|
50
|
+
`McpBootstrap` loses the `paywall` / `nudge` / `data` fields;
|
|
51
|
+
`McpViewKind` narrows to the three remaining surfaces;
|
|
52
|
+
`HostEntryClassification` collapses to `'intent' | 'other'`.
|
|
53
|
+
|
|
54
|
+
**Migration:**
|
|
55
|
+
|
|
56
|
+
Merchant handlers that previously returned
|
|
57
|
+
`ctx.respond(data, { nudge })` don't need to change — nudges are now
|
|
58
|
+
appended to `content[0].text` as a plain-text suffix automatically.
|
|
59
|
+
If you were importing the removed React views (`McpPaywallView` /
|
|
60
|
+
`McpNudgeView` / `McpUpsellStrip`) you can drop those imports
|
|
61
|
+
entirely; the paywall is now narrated in text and no widget mounts
|
|
62
|
+
for it.
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [5d55459]
|
|
67
|
+
- @solvapay/mcp-core@1.0.0-preview-4a7c769f90e0a4169dd30338d9139a3631aa6906
|
|
68
|
+
|
|
3
69
|
From `1.0.10` onwards this changelog is generated by
|
|
4
70
|
[changesets](https://github.com/changesets/changesets) — prior entries
|
|
5
71
|
are maintained by hand and are grouped by the first preview / stable
|
|
@@ -169,9 +235,7 @@ backend is blocked by the host sandbox:
|
|
|
169
235
|
|
|
170
236
|
```tsx
|
|
171
237
|
import { createMcpAppAdapter } from '@solvapay/react/mcp'
|
|
172
|
-
|
|
173
|
-
{children}
|
|
174
|
-
</SolvaPayProvider>
|
|
238
|
+
;<SolvaPayProvider config={{ transport: createMcpAppAdapter(app) }}>{children}</SolvaPayProvider>
|
|
175
239
|
```
|
|
176
240
|
|
|
177
241
|
See the [MCP App integration guide](https://docs.solvapay.com/sdks/typescript/guides/mcp-app)
|
package/README.md
CHANGED
|
@@ -342,14 +342,13 @@ a bespoke layout — compose the pieces directly:
|
|
|
342
342
|
|
|
343
343
|
```tsx
|
|
344
344
|
import {
|
|
345
|
+
AppHeader,
|
|
345
346
|
createMcpAppAdapter,
|
|
346
347
|
createMcpFetch,
|
|
347
348
|
fetchMcpBootstrap,
|
|
348
349
|
McpCheckoutView,
|
|
349
350
|
McpAccountView,
|
|
350
351
|
McpTopupView,
|
|
351
|
-
McpPaywallView,
|
|
352
|
-
McpNudgeView,
|
|
353
352
|
McpViewRouter,
|
|
354
353
|
useStripeProbe,
|
|
355
354
|
} from '@solvapay/react/mcp'
|
|
@@ -357,7 +356,67 @@ import {
|
|
|
357
356
|
|
|
358
357
|
Every view accepts a `classNames?: McpViewClassNames` partial. Props are
|
|
359
358
|
typed per-view (`McpCheckoutViewProps`, `McpAccountViewProps`,
|
|
360
|
-
`McpTopupViewProps
|
|
359
|
+
`McpTopupViewProps`). The previous `McpPaywallView` / `McpNudgeView`
|
|
360
|
+
/ `McpUpsellStrip` surfaces were removed with the text-only paywall
|
|
361
|
+
refactor — merchant paywall / nudge responses narrate in
|
|
362
|
+
`content[0].text` and don't open the widget iframe.
|
|
363
|
+
|
|
364
|
+
### `<AppHeader>` — host-aware merchant strip
|
|
365
|
+
|
|
366
|
+
Every built-in view renders `<AppHeader />` at its surface root: a
|
|
367
|
+
compact `[icon] Merchant-Name` row at the top of the card. When you
|
|
368
|
+
compose your own view (via `<McpViewRouter>` or `<SolvaPayProvider>`
|
|
369
|
+
directly) drop it in as the first child to keep branding consistent.
|
|
370
|
+
|
|
371
|
+
```tsx
|
|
372
|
+
import { AppHeader } from '@solvapay/react/mcp'
|
|
373
|
+
|
|
374
|
+
function MyView() {
|
|
375
|
+
return (
|
|
376
|
+
<div className="solvapay-mcp-card">
|
|
377
|
+
<AppHeader />
|
|
378
|
+
<h2>Your custom step</h2>
|
|
379
|
+
{/* ... */}
|
|
380
|
+
</div>
|
|
381
|
+
)
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
`<AppHeader>` is **host-aware**. In `mode="auto"` (the default) it
|
|
386
|
+
suppresses itself on hosts that already paint a merchant mark in their
|
|
387
|
+
chrome:
|
|
388
|
+
|
|
389
|
+
- **ChatGPT**, whose [Apps SDK UI guidelines](https://developers.openai.com/apps-sdk/concepts/ui-guidelines)
|
|
390
|
+
explicitly prohibit in-widget logos (*"ChatGPT will always append
|
|
391
|
+
your logo and app name before the widget is rendered."*).
|
|
392
|
+
- **Claude Desktop**, which paints its own MCP app chrome strip (app
|
|
393
|
+
icon + app name + active tool name) above every widget iframe — a
|
|
394
|
+
second in-widget merchant row stacks on top of it.
|
|
395
|
+
|
|
396
|
+
On MCP Jam, VS Code, and other hosts that leave in-widget branding to
|
|
397
|
+
the app, `<AppHeader>` paints the strip so the user always sees who
|
|
398
|
+
they're dealing with.
|
|
399
|
+
|
|
400
|
+
```tsx
|
|
401
|
+
<AppHeader mode="auto" /> // default — host-aware
|
|
402
|
+
<AppHeader mode="always" /> // force render (e.g. testing)
|
|
403
|
+
<AppHeader mode="never" /> // force hide (e.g. custom chrome)
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
Use `classNames={{ appHeader, appHeaderIcon, appHeaderInitials, appHeaderName }}`
|
|
407
|
+
to restyle any slot, or pass `children` for inline content on the
|
|
408
|
+
right side (e.g. a close affordance or status chip). The merchant is
|
|
409
|
+
read from `useMerchant()` automatically.
|
|
410
|
+
|
|
411
|
+
Integrators building entirely custom shells can also read the raw host
|
|
412
|
+
name via `useHostName()`:
|
|
413
|
+
|
|
414
|
+
```tsx
|
|
415
|
+
import { useHostName, HOSTS_WITH_MERCHANT_CHROME } from '@solvapay/react/mcp'
|
|
416
|
+
|
|
417
|
+
const hostName = useHostName() // 'ChatGPT' | 'Claude Desktop' | 'MCP Jam' | null
|
|
418
|
+
const showMark = !hostName || !HOSTS_WITH_MERCHANT_CHROME.test(hostName)
|
|
419
|
+
```
|
|
361
420
|
|
|
362
421
|
### Architecture ADR
|
|
363
422
|
|
package/dist/adapters/auth.js
CHANGED
|
@@ -4664,35 +4664,6 @@ function useUsageMeter() {
|
|
|
4664
4664
|
return useUsageMeterCtx("useUsageMeter");
|
|
4665
4665
|
}
|
|
4666
4666
|
|
|
4667
|
-
// src/hooks/usePaywallResolver.ts
|
|
4668
|
-
import { useCallback as useCallback19, useMemo as useMemo16 } from "react";
|
|
4669
|
-
function usePaywallResolver(content) {
|
|
4670
|
-
const { activePurchase, hasPaidPurchase, refetch: refetchPurchase } = usePurchase();
|
|
4671
|
-
const { credits, refetch: refetchBalance } = useBalance();
|
|
4672
|
-
const resolved = useMemo16(() => {
|
|
4673
|
-
if (!content) return false;
|
|
4674
|
-
const productMatches = !content.product || activePurchase?.productRef === content.product || activePurchase?.productName === content.product;
|
|
4675
|
-
if (content.kind === "payment_required") {
|
|
4676
|
-
return Boolean(hasPaidPurchase && productMatches);
|
|
4677
|
-
}
|
|
4678
|
-
const balance = content.balance;
|
|
4679
|
-
if (balance && typeof balance.remainingUnits === "number" && balance.remainingUnits > 0) {
|
|
4680
|
-
return true;
|
|
4681
|
-
}
|
|
4682
|
-
if (balance && credits != null && balance.creditsPerUnit && credits >= balance.creditsPerUnit) {
|
|
4683
|
-
return true;
|
|
4684
|
-
}
|
|
4685
|
-
return Boolean(productMatches && activePurchase?.status === "active");
|
|
4686
|
-
}, [content, hasPaidPurchase, activePurchase, credits]);
|
|
4687
|
-
const refetch = useCallback19(async () => {
|
|
4688
|
-
await Promise.all([
|
|
4689
|
-
refetchPurchase().catch(() => void 0),
|
|
4690
|
-
refetchBalance().catch(() => void 0)
|
|
4691
|
-
]);
|
|
4692
|
-
}, [refetchPurchase, refetchBalance]);
|
|
4693
|
-
return { resolved, refetch };
|
|
4694
|
-
}
|
|
4695
|
-
|
|
4696
4667
|
export {
|
|
4697
4668
|
filterPurchases,
|
|
4698
4669
|
getActivePurchases,
|
|
@@ -4819,6 +4790,5 @@ export {
|
|
|
4819
4790
|
Loading4 as Loading,
|
|
4820
4791
|
Empty,
|
|
4821
4792
|
UsageMeter,
|
|
4822
|
-
useUsageMeter
|
|
4823
|
-
usePaywallResolver
|
|
4793
|
+
useUsageMeter
|
|
4824
4794
|
};
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
useProduct,
|
|
17
17
|
usePurchase,
|
|
18
18
|
useTopupAmountSelector
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BB3VVVBI.js";
|
|
20
20
|
|
|
21
21
|
// src/TopupForm.tsx
|
|
22
22
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -564,6 +564,35 @@ function useCreditGate() {
|
|
|
564
564
|
return useGateCtx2("useCreditGate");
|
|
565
565
|
}
|
|
566
566
|
|
|
567
|
+
// src/hooks/usePaywallResolver.ts
|
|
568
|
+
import { useCallback as useCallback2, useMemo as useMemo4 } from "react";
|
|
569
|
+
function usePaywallResolver(content) {
|
|
570
|
+
const { activePurchase, hasPaidPurchase, refetch: refetchPurchase } = usePurchase();
|
|
571
|
+
const { credits, refetch: refetchBalance } = useBalance();
|
|
572
|
+
const resolved = useMemo4(() => {
|
|
573
|
+
if (!content) return false;
|
|
574
|
+
const productMatches = !content.product || activePurchase?.productRef === content.product || activePurchase?.productName === content.product;
|
|
575
|
+
if (content.kind === "payment_required") {
|
|
576
|
+
return Boolean(hasPaidPurchase && productMatches);
|
|
577
|
+
}
|
|
578
|
+
const balance = content.balance;
|
|
579
|
+
if (balance && typeof balance.remainingUnits === "number" && balance.remainingUnits > 0) {
|
|
580
|
+
return true;
|
|
581
|
+
}
|
|
582
|
+
if (balance && credits != null && balance.creditsPerUnit && credits >= balance.creditsPerUnit) {
|
|
583
|
+
return true;
|
|
584
|
+
}
|
|
585
|
+
return Boolean(productMatches && activePurchase?.status === "active");
|
|
586
|
+
}, [content, hasPaidPurchase, activePurchase, credits]);
|
|
587
|
+
const refetch = useCallback2(async () => {
|
|
588
|
+
await Promise.all([
|
|
589
|
+
refetchPurchase().catch(() => void 0),
|
|
590
|
+
refetchBalance().catch(() => void 0)
|
|
591
|
+
]);
|
|
592
|
+
}, [refetchPurchase, refetchBalance]);
|
|
593
|
+
return { resolved, refetch };
|
|
594
|
+
}
|
|
595
|
+
|
|
567
596
|
export {
|
|
568
597
|
TopupForm2 as TopupForm,
|
|
569
598
|
ProductBadge2 as ProductBadge,
|
|
@@ -593,5 +622,6 @@ export {
|
|
|
593
622
|
CreditGateLoading2 as CreditGateLoading,
|
|
594
623
|
CreditGateError2 as CreditGateError,
|
|
595
624
|
CreditGate,
|
|
596
|
-
useCreditGate
|
|
625
|
+
useCreditGate,
|
|
626
|
+
usePaywallResolver
|
|
597
627
|
};
|
|
@@ -2616,49 +2616,6 @@ type ActivatePlanResult = components['schemas']['ActivatePlanResponseDto'];
|
|
|
2616
2616
|
*/
|
|
2617
2617
|
type PaymentMethodInfo = operations['PaymentMethodSdkController_getPaymentMethod']['responses']['200']['content']['application/json'];
|
|
2618
2618
|
|
|
2619
|
-
/**
|
|
2620
|
-
* Paywall Type Definitions
|
|
2621
|
-
*
|
|
2622
|
-
* Types related to paywall protection, limits, and gating functionality.
|
|
2623
|
-
*/
|
|
2624
|
-
|
|
2625
|
-
type LimitPlanSummary = components['schemas']['LimitPlanItemDto'];
|
|
2626
|
-
type LimitActivationBalance = components['schemas']['LimitBalanceDto'];
|
|
2627
|
-
type LimitActivationProduct = components['schemas']['LimitProductBriefDto'];
|
|
2628
|
-
/**
|
|
2629
|
-
* Structured content for paywall errors (MCP structuredContent and manual handling).
|
|
2630
|
-
*/
|
|
2631
|
-
type PaywallStructuredContent = {
|
|
2632
|
-
kind: 'payment_required';
|
|
2633
|
-
/** Product ref from paywall metadata (or env default) */
|
|
2634
|
-
product: string;
|
|
2635
|
-
checkoutUrl: string;
|
|
2636
|
-
message: string;
|
|
2637
|
-
/**
|
|
2638
|
-
* Quota balance at the moment the paywall tripped. Optional so
|
|
2639
|
-
* older server versions (pre-balance-on-payment_required) stay
|
|
2640
|
-
* compatible; the React `PaywallNotice.Message` prefers this
|
|
2641
|
-
* structured data over the raw `message` when available.
|
|
2642
|
-
*/
|
|
2643
|
-
balance?: LimitActivationBalance;
|
|
2644
|
-
/** Rich product context from checkLimits (name, ref, provider slug/id) */
|
|
2645
|
-
productDetails?: LimitActivationProduct;
|
|
2646
|
-
} | {
|
|
2647
|
-
kind: 'activation_required';
|
|
2648
|
-
/** Product ref from paywall metadata (or env default) */
|
|
2649
|
-
product: string;
|
|
2650
|
-
message: string;
|
|
2651
|
-
/**
|
|
2652
|
-
* Best URL for completing purchase or confirmation; mirrors confirmationUrl when present.
|
|
2653
|
-
*/
|
|
2654
|
-
checkoutUrl: string;
|
|
2655
|
-
confirmationUrl?: string;
|
|
2656
|
-
plans?: LimitPlanSummary[];
|
|
2657
|
-
balance?: LimitActivationBalance;
|
|
2658
|
-
/** Rich product context from checkLimits (name, ref, provider slug/id) */
|
|
2659
|
-
productDetails?: LimitActivationProduct;
|
|
2660
|
-
};
|
|
2661
|
-
|
|
2662
2619
|
/**
|
|
2663
2620
|
* Customer Helper (Core)
|
|
2664
2621
|
*
|
|
@@ -3109,6 +3066,12 @@ interface Merchant {
|
|
|
3109
3066
|
defaultCurrency?: string;
|
|
3110
3067
|
statementDescriptor?: string;
|
|
3111
3068
|
logoUrl?: string;
|
|
3069
|
+
/**
|
|
3070
|
+
* Absolute URL to a square app icon / logomark. Preferred over
|
|
3071
|
+
* `logoUrl` for avatar slots and chrome-strip icons that can't
|
|
3072
|
+
* letterbox a landscape mark.
|
|
3073
|
+
*/
|
|
3074
|
+
iconUrl?: string;
|
|
3112
3075
|
}
|
|
3113
3076
|
interface UseMerchantReturn {
|
|
3114
3077
|
merchant: Merchant | null;
|
|
@@ -3653,4 +3616,4 @@ interface UseTopupAmountSelectorReturn {
|
|
|
3653
3616
|
}
|
|
3654
3617
|
type PurchaseStatusValue = 'pending' | 'active' | 'trialing' | 'past_due' | 'cancelled' | 'expired' | 'suspended' | 'refunded';
|
|
3655
3618
|
|
|
3656
|
-
export { type ActivationResult as A, type BalanceStatus as B, type CheckoutResult as C, type
|
|
3619
|
+
export { type ActivationResult as A, type BalanceStatus as B, type CheckoutResult as C, type PaymentError as D, type PaymentIntentResult as E, type PaymentMethodInfo as F, type PaymentResult as G, type PurchaseStatusValue as H, type TopupPaymentResult as I, type TransportBalanceResult as J, type TransportCheckoutSessionResult as K, type TransportCustomerSessionResult as L, type MandateContext as M, UnsupportedTransportMethodError as N, type SolvaPayProviderInitial as O, type PaymentFormProps as P, type components as Q, type ReactivateResult as R, type SolvaPayProviderProps as S, type TopupFormProps as T, type UsePlansOptions as U, type PrefillCustomer as a, type Plan as b, type PurchaseStatus as c, type SolvaPayContextValue as d, type UsePlansReturn as e, type UsePlanOptions as f, type UsePlanReturn as g, type UseProductReturn as h, type UseMerchantReturn as i, type SolvaPayCopy as j, type PurchaseStatusReturn as k, type CancelResult as l, type ActivatePlanResult as m, type UseTopupOptions as n, type UseTopupReturn as o, type UseTopupAmountSelectorOptions as p, type UseTopupAmountSelectorReturn as q, type UsePaymentMethodReturn as r, type SolvaPayTransport as s, type PartialSolvaPayCopy as t, type PurchaseInfo as u, type Product as v, type SolvaPayConfig as w, type CustomerPurchaseData as x, type MandateTemplate as y, type Merchant as z };
|
|
@@ -2616,49 +2616,6 @@ type ActivatePlanResult = components['schemas']['ActivatePlanResponseDto'];
|
|
|
2616
2616
|
*/
|
|
2617
2617
|
type PaymentMethodInfo = operations['PaymentMethodSdkController_getPaymentMethod']['responses']['200']['content']['application/json'];
|
|
2618
2618
|
|
|
2619
|
-
/**
|
|
2620
|
-
* Paywall Type Definitions
|
|
2621
|
-
*
|
|
2622
|
-
* Types related to paywall protection, limits, and gating functionality.
|
|
2623
|
-
*/
|
|
2624
|
-
|
|
2625
|
-
type LimitPlanSummary = components['schemas']['LimitPlanItemDto'];
|
|
2626
|
-
type LimitActivationBalance = components['schemas']['LimitBalanceDto'];
|
|
2627
|
-
type LimitActivationProduct = components['schemas']['LimitProductBriefDto'];
|
|
2628
|
-
/**
|
|
2629
|
-
* Structured content for paywall errors (MCP structuredContent and manual handling).
|
|
2630
|
-
*/
|
|
2631
|
-
type PaywallStructuredContent = {
|
|
2632
|
-
kind: 'payment_required';
|
|
2633
|
-
/** Product ref from paywall metadata (or env default) */
|
|
2634
|
-
product: string;
|
|
2635
|
-
checkoutUrl: string;
|
|
2636
|
-
message: string;
|
|
2637
|
-
/**
|
|
2638
|
-
* Quota balance at the moment the paywall tripped. Optional so
|
|
2639
|
-
* older server versions (pre-balance-on-payment_required) stay
|
|
2640
|
-
* compatible; the React `PaywallNotice.Message` prefers this
|
|
2641
|
-
* structured data over the raw `message` when available.
|
|
2642
|
-
*/
|
|
2643
|
-
balance?: LimitActivationBalance;
|
|
2644
|
-
/** Rich product context from checkLimits (name, ref, provider slug/id) */
|
|
2645
|
-
productDetails?: LimitActivationProduct;
|
|
2646
|
-
} | {
|
|
2647
|
-
kind: 'activation_required';
|
|
2648
|
-
/** Product ref from paywall metadata (or env default) */
|
|
2649
|
-
product: string;
|
|
2650
|
-
message: string;
|
|
2651
|
-
/**
|
|
2652
|
-
* Best URL for completing purchase or confirmation; mirrors confirmationUrl when present.
|
|
2653
|
-
*/
|
|
2654
|
-
checkoutUrl: string;
|
|
2655
|
-
confirmationUrl?: string;
|
|
2656
|
-
plans?: LimitPlanSummary[];
|
|
2657
|
-
balance?: LimitActivationBalance;
|
|
2658
|
-
/** Rich product context from checkLimits (name, ref, provider slug/id) */
|
|
2659
|
-
productDetails?: LimitActivationProduct;
|
|
2660
|
-
};
|
|
2661
|
-
|
|
2662
2619
|
/**
|
|
2663
2620
|
* Customer Helper (Core)
|
|
2664
2621
|
*
|
|
@@ -3109,6 +3066,12 @@ interface Merchant {
|
|
|
3109
3066
|
defaultCurrency?: string;
|
|
3110
3067
|
statementDescriptor?: string;
|
|
3111
3068
|
logoUrl?: string;
|
|
3069
|
+
/**
|
|
3070
|
+
* Absolute URL to a square app icon / logomark. Preferred over
|
|
3071
|
+
* `logoUrl` for avatar slots and chrome-strip icons that can't
|
|
3072
|
+
* letterbox a landscape mark.
|
|
3073
|
+
*/
|
|
3074
|
+
iconUrl?: string;
|
|
3112
3075
|
}
|
|
3113
3076
|
interface UseMerchantReturn {
|
|
3114
3077
|
merchant: Merchant | null;
|
|
@@ -3653,4 +3616,4 @@ interface UseTopupAmountSelectorReturn {
|
|
|
3653
3616
|
}
|
|
3654
3617
|
type PurchaseStatusValue = 'pending' | 'active' | 'trialing' | 'past_due' | 'cancelled' | 'expired' | 'suspended' | 'refunded';
|
|
3655
3618
|
|
|
3656
|
-
export { type ActivationResult as A, type BalanceStatus as B, type CheckoutResult as C, type
|
|
3619
|
+
export { type ActivationResult as A, type BalanceStatus as B, type CheckoutResult as C, type PaymentError as D, type PaymentIntentResult as E, type PaymentMethodInfo as F, type PaymentResult as G, type PurchaseStatusValue as H, type TopupPaymentResult as I, type TransportBalanceResult as J, type TransportCheckoutSessionResult as K, type TransportCustomerSessionResult as L, type MandateContext as M, UnsupportedTransportMethodError as N, type SolvaPayProviderInitial as O, type PaymentFormProps as P, type components as Q, type ReactivateResult as R, type SolvaPayProviderProps as S, type TopupFormProps as T, type UsePlansOptions as U, type PrefillCustomer as a, type Plan as b, type PurchaseStatus as c, type SolvaPayContextValue as d, type UsePlansReturn as e, type UsePlanOptions as f, type UsePlanReturn as g, type UseProductReturn as h, type UseMerchantReturn as i, type SolvaPayCopy as j, type PurchaseStatusReturn as k, type CancelResult as l, type ActivatePlanResult as m, type UseTopupOptions as n, type UseTopupReturn as o, type UseTopupAmountSelectorOptions as p, type UseTopupAmountSelectorReturn as q, type UsePaymentMethodReturn as r, type SolvaPayTransport as s, type PartialSolvaPayCopy as t, type PurchaseInfo as u, type Product as v, type SolvaPayConfig as w, type CustomerPurchaseData as x, type MandateTemplate as y, type Merchant as z };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { S as SolvaPayProviderProps, P as PaymentFormProps, a as PrefillCustomer, T as TopupFormProps, C as CheckoutResult, b as Plan, A as ActivationResult, c as PurchaseStatus, d as SolvaPayContextValue, U as UsePlansOptions, e as UsePlansReturn, f as UsePlanOptions, g as UsePlanReturn, h as UseProductReturn, i as UseMerchantReturn, j as SolvaPayCopy, k as PurchaseStatusReturn, l as CancelResult, R as ReactivateResult, m as ActivatePlanResult, n as UseTopupOptions, o as UseTopupReturn, B as BalanceStatus, p as UseTopupAmountSelectorOptions, q as UseTopupAmountSelectorReturn, r as UsePaymentMethodReturn, s as SolvaPayTransport, t as
|
|
3
|
-
export {
|
|
4
|
-
import { P as PaymentFormSummary, a as PaymentFormCustomerFields, b as PaymentFormPaymentElement, c as PaymentFormCardElement, d as PaymentFormMandateText, e as PaymentFormTermsCheckbox, f as PaymentFormSubmitButton, g as PaymentFormLoading, h as PaymentFormError, C as CheckoutVariant } from './useUsage-
|
|
5
|
-
export { A as ActivationFlowStep, B as BalanceBadge,
|
|
2
|
+
import { S as SolvaPayProviderProps, P as PaymentFormProps, a as PrefillCustomer, T as TopupFormProps, C as CheckoutResult, b as Plan, A as ActivationResult, c as PurchaseStatus, d as SolvaPayContextValue, U as UsePlansOptions, e as UsePlansReturn, f as UsePlanOptions, g as UsePlanReturn, h as UseProductReturn, i as UseMerchantReturn, j as SolvaPayCopy, k as PurchaseStatusReturn, l as CancelResult, R as ReactivateResult, m as ActivatePlanResult, n as UseTopupOptions, o as UseTopupReturn, B as BalanceStatus, p as UseTopupAmountSelectorOptions, q as UseTopupAmountSelectorReturn, r as UsePaymentMethodReturn, s as SolvaPayTransport, t as PartialSolvaPayCopy, u as PurchaseInfo, v as Product, w as SolvaPayConfig } from './index-CrTUB4dF.cjs';
|
|
3
|
+
export { x as CustomerPurchaseData, M as MandateContext, y as MandateTemplate, z as Merchant, D as PaymentError, E as PaymentIntentResult, F as PaymentMethodInfo, G as PaymentResult, H as PurchaseStatusValue, I as TopupPaymentResult, J as TransportBalanceResult, K as TransportCheckoutSessionResult, L as TransportCustomerSessionResult, N as UnsupportedTransportMethodError } from './index-CrTUB4dF.cjs';
|
|
4
|
+
import { P as PaymentFormSummary, a as PaymentFormCustomerFields, b as PaymentFormPaymentElement, c as PaymentFormCardElement, d as PaymentFormMandateText, e as PaymentFormTermsCheckbox, f as PaymentFormSubmitButton, g as PaymentFormLoading, h as PaymentFormError, i as PaywallStructuredContent, C as CheckoutVariant } from './useUsage-geKuuRoO.cjs';
|
|
5
|
+
export { A as ActivationFlowStep, B as BalanceBadge, j as CancelPlanButton, k as CheckoutSummary, l as CheckoutSummaryProps, M as MandateText, m as MandateTextProps, n as PlanBadge, o as ProductBadge, p as PurchaseGate, U as UsageSnapshot, q as UseUsageReturn, r as deriveVariant, u as useUsage } from './useUsage-geKuuRoO.cjs';
|
|
6
6
|
import { PaymentIntent, Stripe, StripeElements } from '@stripe/stripe-js';
|
|
7
7
|
export { AuthAdapter, defaultAuthAdapter } from './adapters/auth.cjs';
|
|
8
8
|
import '@stripe/react-stripe-js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { S as SolvaPayProviderProps, P as PaymentFormProps, a as PrefillCustomer, T as TopupFormProps, C as CheckoutResult, b as Plan, A as ActivationResult, c as PurchaseStatus, d as SolvaPayContextValue, U as UsePlansOptions, e as UsePlansReturn, f as UsePlanOptions, g as UsePlanReturn, h as UseProductReturn, i as UseMerchantReturn, j as SolvaPayCopy, k as PurchaseStatusReturn, l as CancelResult, R as ReactivateResult, m as ActivatePlanResult, n as UseTopupOptions, o as UseTopupReturn, B as BalanceStatus, p as UseTopupAmountSelectorOptions, q as UseTopupAmountSelectorReturn, r as UsePaymentMethodReturn, s as SolvaPayTransport, t as
|
|
3
|
-
export {
|
|
4
|
-
import { P as PaymentFormSummary, a as PaymentFormCustomerFields, b as PaymentFormPaymentElement, c as PaymentFormCardElement, d as PaymentFormMandateText, e as PaymentFormTermsCheckbox, f as PaymentFormSubmitButton, g as PaymentFormLoading, h as PaymentFormError, C as CheckoutVariant } from './useUsage-
|
|
5
|
-
export { A as ActivationFlowStep, B as BalanceBadge,
|
|
2
|
+
import { S as SolvaPayProviderProps, P as PaymentFormProps, a as PrefillCustomer, T as TopupFormProps, C as CheckoutResult, b as Plan, A as ActivationResult, c as PurchaseStatus, d as SolvaPayContextValue, U as UsePlansOptions, e as UsePlansReturn, f as UsePlanOptions, g as UsePlanReturn, h as UseProductReturn, i as UseMerchantReturn, j as SolvaPayCopy, k as PurchaseStatusReturn, l as CancelResult, R as ReactivateResult, m as ActivatePlanResult, n as UseTopupOptions, o as UseTopupReturn, B as BalanceStatus, p as UseTopupAmountSelectorOptions, q as UseTopupAmountSelectorReturn, r as UsePaymentMethodReturn, s as SolvaPayTransport, t as PartialSolvaPayCopy, u as PurchaseInfo, v as Product, w as SolvaPayConfig } from './index-BrQgUDNH.js';
|
|
3
|
+
export { x as CustomerPurchaseData, M as MandateContext, y as MandateTemplate, z as Merchant, D as PaymentError, E as PaymentIntentResult, F as PaymentMethodInfo, G as PaymentResult, H as PurchaseStatusValue, I as TopupPaymentResult, J as TransportBalanceResult, K as TransportCheckoutSessionResult, L as TransportCustomerSessionResult, N as UnsupportedTransportMethodError } from './index-BrQgUDNH.js';
|
|
4
|
+
import { P as PaymentFormSummary, a as PaymentFormCustomerFields, b as PaymentFormPaymentElement, c as PaymentFormCardElement, d as PaymentFormMandateText, e as PaymentFormTermsCheckbox, f as PaymentFormSubmitButton, g as PaymentFormLoading, h as PaymentFormError, i as PaywallStructuredContent, C as CheckoutVariant } from './useUsage-BNnyZ-os.js';
|
|
5
|
+
export { A as ActivationFlowStep, B as BalanceBadge, j as CancelPlanButton, k as CheckoutSummary, l as CheckoutSummaryProps, M as MandateText, m as MandateTextProps, n as PlanBadge, o as ProductBadge, p as PurchaseGate, U as UsageSnapshot, q as UseUsageReturn, r as deriveVariant, u as useUsage } from './useUsage-BNnyZ-os.js';
|
|
6
6
|
import { PaymentIntent, Stripe, StripeElements } from '@stripe/stripe-js';
|
|
7
7
|
export { AuthAdapter, defaultAuthAdapter } from './adapters/auth.js';
|
|
8
8
|
import '@stripe/react-stripe-js';
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
LaunchCustomerPortalButton,
|
|
4
4
|
UpdatePaymentMethodButton,
|
|
5
5
|
usePaymentMethod
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6VKNPQJT.js";
|
|
7
7
|
import {
|
|
8
8
|
ActivationFlow,
|
|
9
9
|
CreditGate,
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
PurchaseGate,
|
|
13
13
|
TopupForm,
|
|
14
14
|
useActivationFlow,
|
|
15
|
-
useCreditGate
|
|
16
|
-
|
|
15
|
+
useCreditGate,
|
|
16
|
+
usePaywallResolver
|
|
17
|
+
} from "./chunk-I744P2TC.js";
|
|
17
18
|
import {
|
|
18
19
|
AmountPicker,
|
|
19
20
|
BalanceBadge,
|
|
@@ -69,7 +70,6 @@ import {
|
|
|
69
70
|
useLocale,
|
|
70
71
|
useMerchant,
|
|
71
72
|
usePaymentForm,
|
|
72
|
-
usePaywallResolver,
|
|
73
73
|
usePlan,
|
|
74
74
|
usePlans,
|
|
75
75
|
useProduct,
|
|
@@ -81,11 +81,10 @@ import {
|
|
|
81
81
|
useTopupAmountSelector,
|
|
82
82
|
useTransport,
|
|
83
83
|
useUsage
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-BB3VVVBI.js";
|
|
85
85
|
import {
|
|
86
86
|
defaultAuthAdapter
|
|
87
87
|
} from "./chunk-OUSEQRCT.js";
|
|
88
|
-
import "./chunk-MLKGABMK.js";
|
|
89
88
|
|
|
90
89
|
// src/PaymentForm.tsx
|
|
91
90
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|