@solvapay/react 1.0.9 → 1.0.11-preview-e89911bc8c4dd3759eab37b440559220b691fd23
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 +74 -4
- package/README.md +66 -7
- package/dist/adapters/auth.js +0 -1
- package/dist/{chunk-R2ZPZ7VM.js → chunk-5Y7H6EUH.js} +32 -2
- package/dist/{chunk-37R5NZGF.js → chunk-LXEDJ5HB.js} +17 -33
- package/dist/chunk-PLPNLBDA.js +10 -0
- package/dist/{chunk-HWVJL5X6.js → chunk-PYOULKIW.js} +1 -1
- 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.cjs +16 -2
- 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 +287 -829
- package/dist/mcp/index.d.cts +166 -142
- package/dist/mcp/index.d.ts +166 -142
- package/dist/mcp/index.js +254 -466
- package/dist/mcp/styles.css +68 -149
- package/dist/primitives/index.cjs +16 -2
- 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,11 +1,83 @@
|
|
|
1
1
|
# @solvapay/react changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.11-preview-e89911bc8c4dd3759eab37b440559220b691fd23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d4183ba: **PAYG checkout now activates at the plan step.**
|
|
8
|
+
|
|
9
|
+
`CheckoutStateMachine` fires `activate_plan` from the plan picker's
|
|
10
|
+
`Continue with Pay as you go` button instead of from the amount picker.
|
|
11
|
+
This pairs with the backend change that makes `activate_plan` eagerly
|
|
12
|
+
create the active usage-based purchase regardless of current credit
|
|
13
|
+
balance — one user-visible click, one activation round-trip.
|
|
14
|
+
|
|
15
|
+
Behaviour change:
|
|
16
|
+
- Plan step `Continue` now awaits `activate_plan` before advancing to
|
|
17
|
+
the amount picker. The button renders in its existing activating
|
|
18
|
+
state while the call is in flight; failures surface via
|
|
19
|
+
`activationError` below the button.
|
|
20
|
+
- Amount step `Continue` is now a purely-local state transition — it
|
|
21
|
+
no longer fires `activate_plan`. Back-navigation from the payment
|
|
22
|
+
step (`Change amount`) therefore does not re-activate.
|
|
23
|
+
- `AmountStep` props trimmed: `isActivating` and `activationError`
|
|
24
|
+
removed (unused on this step now). `onContinue` is synchronous.
|
|
25
|
+
|
|
26
|
+
Migration notes:
|
|
27
|
+
- Custom surfaces that pass `isActivating` / `activationError` into
|
|
28
|
+
their own `<AmountStep>` wrapper should drop those props.
|
|
29
|
+
- Consumers subclassing `CheckoutStateMachine` should move any logic
|
|
30
|
+
that reacted to "activation-in-flight at the amount step" into the
|
|
31
|
+
plan step's activating window.
|
|
32
|
+
|
|
33
|
+
Paired backend PR: `solvapay-backend#112` — eager activation for
|
|
34
|
+
usage-based plans in the `activate_plan` MCP tool handler.
|
|
35
|
+
|
|
3
36
|
From `1.0.10` onwards this changelog is generated by
|
|
4
37
|
[changesets](https://github.com/changesets/changesets) — prior entries
|
|
5
38
|
are maintained by hand and are grouped by the first preview / stable
|
|
6
39
|
release that contains them.
|
|
7
40
|
|
|
8
|
-
##
|
|
41
|
+
## 1.0.10
|
|
42
|
+
|
|
43
|
+
SEP-1865 text-only-paywall surface trim. Hand-set version (the
|
|
44
|
+
Changesets peer-dep cascade would otherwise have forced this to
|
|
45
|
+
`2.0.0` because the upstream `@solvapay/mcp-core` minor bump on a
|
|
46
|
+
`workspace:*` peer cascades to `major` under Changesets' default
|
|
47
|
+
rule). Released as a patch despite the removed public surface
|
|
48
|
+
because no external consumers rely on the removed views — they
|
|
49
|
+
lived in `@solvapay/react/mcp` behind the preview channel and were
|
|
50
|
+
never stabilised. See
|
|
51
|
+
`.changeset/hand-set-versions-consolidation.md` for the full
|
|
52
|
+
rationale.
|
|
53
|
+
|
|
54
|
+
### Removed (breaking): MCP paywall / nudge / upsell views
|
|
55
|
+
|
|
56
|
+
Per SEP-1865 / MCP Apps (2026-01-26) descriptor-advertising means
|
|
57
|
+
the host MUST open the iframe on every call. Text-only narrations
|
|
58
|
+
live on `content[0].text` now; there's no widget state for the
|
|
59
|
+
paywall / nudge / activation surfaces anymore, so the views that
|
|
60
|
+
rendered them are removed from the public API:
|
|
61
|
+
|
|
62
|
+
- `McpPaywallView` + `McpPaywallViewProps`
|
|
63
|
+
- `McpNudgeView` + `McpNudgeViewProps`
|
|
64
|
+
- `McpUpsellStrip` + `McpUpsellStripProps`
|
|
65
|
+
- The matching slots on `McpAppViewOverrides`
|
|
66
|
+
(`paywall` / `nudge` / `upsellStrip`)
|
|
67
|
+
- `McpViewKind` narrows to `'checkout' | 'account' | 'topup'`
|
|
68
|
+
(the `'paywall'` and `'nudge'` variants are gone)
|
|
69
|
+
- `HostEntryClassification` collapses from the four-way paywall /
|
|
70
|
+
nudge / intent / other split to `'intent' | 'other'`
|
|
71
|
+
- `McpBootstrap` loses the `paywall`, `nudge`, and `data` fields —
|
|
72
|
+
the payload the text-only paywall returns no longer carries
|
|
73
|
+
those slots
|
|
74
|
+
|
|
75
|
+
Migration: drop any imports of `McpPaywallView` / `McpNudgeView` /
|
|
76
|
+
`McpUpsellStrip` from your MCP App shell — the paywall narration
|
|
77
|
+
surfaces in the LLM's conversation transcript via the paywalled
|
|
78
|
+
tool's text response, and no widget mounts for a gate. If you had
|
|
79
|
+
custom view overrides for the paywall / nudge slots, delete them;
|
|
80
|
+
the compound `<McpApp>` no longer routes through those kinds.
|
|
9
81
|
|
|
10
82
|
## 1.0.9 — peer-dep rename: `@solvapay/mcp` → `@solvapay/mcp-core`
|
|
11
83
|
|
|
@@ -169,9 +241,7 @@ backend is blocked by the host sandbox:
|
|
|
169
241
|
|
|
170
242
|
```tsx
|
|
171
243
|
import { createMcpAppAdapter } from '@solvapay/react/mcp'
|
|
172
|
-
|
|
173
|
-
{children}
|
|
174
|
-
</SolvaPayProvider>
|
|
244
|
+
;<SolvaPayProvider config={{ transport: createMcpAppAdapter(app) }}>{children}</SolvaPayProvider>
|
|
175
245
|
```
|
|
176
246
|
|
|
177
247
|
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
|
|
|
@@ -715,11 +774,11 @@ Lovable-style apps deploy React frontends against Supabase Edge Functions
|
|
|
715
774
|
</SolvaPayProvider>
|
|
716
775
|
```
|
|
717
776
|
|
|
718
|
-
The matching Deno edge functions ship
|
|
719
|
-
[`@solvapay/fetch`](
|
|
777
|
+
The matching Deno edge functions ship on the
|
|
778
|
+
[`@solvapay/server/fetch`](../server/src/fetch) subpath — see
|
|
720
779
|
[`examples/supabase-edge`](../../examples/supabase-edge) for one-liner
|
|
721
|
-
`Deno.serve(handler)` files covering every handler including
|
|
722
|
-
`get-merchant` and `get-product
|
|
780
|
+
`Deno.serve(handler)` files covering every handler including
|
|
781
|
+
`get-merchant` and `get-product`.
|
|
723
782
|
|
|
724
783
|
## More Information
|
|
725
784
|
|
package/dist/adapters/auth.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
useProduct,
|
|
17
17
|
usePurchase,
|
|
18
18
|
useTopupAmountSelector
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-LXEDJ5HB.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
|
};
|
|
@@ -2262,6 +2262,20 @@ import {
|
|
|
2262
2262
|
CardElement as StripeCardElement
|
|
2263
2263
|
} from "@stripe/react-stripe-js";
|
|
2264
2264
|
|
|
2265
|
+
// src/primitives/paymentElementDefaults.ts
|
|
2266
|
+
var DEFAULT_PAYMENT_ELEMENT_OPTIONS = {
|
|
2267
|
+
wallets: { link: "never" }
|
|
2268
|
+
};
|
|
2269
|
+
function withPaymentElementDefaults(options) {
|
|
2270
|
+
return {
|
|
2271
|
+
...options,
|
|
2272
|
+
wallets: {
|
|
2273
|
+
...DEFAULT_PAYMENT_ELEMENT_OPTIONS.wallets,
|
|
2274
|
+
...options?.wallets
|
|
2275
|
+
}
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2265
2279
|
// src/utils/processPaymentResult.ts
|
|
2266
2280
|
async function reconcilePayment(input) {
|
|
2267
2281
|
const { paymentIntentId, productRef, planRef, processPayment, refetchPurchase, copy } = input;
|
|
@@ -2821,7 +2835,7 @@ var PaymentElementSlot = ({ options }) => {
|
|
|
2821
2835
|
return /* @__PURE__ */ jsx10("div", { "data-solvapay-payment-form-payment-element": "", children: /* @__PURE__ */ jsx10(
|
|
2822
2836
|
StripePaymentElement,
|
|
2823
2837
|
{
|
|
2824
|
-
options,
|
|
2838
|
+
options: withPaymentElementDefaults(options),
|
|
2825
2839
|
onChange: (e) => setPaymentInputComplete(e.complete)
|
|
2826
2840
|
},
|
|
2827
2841
|
locale || "default"
|
|
@@ -3575,7 +3589,7 @@ var PaymentElementSlot2 = ({ options }) => {
|
|
|
3575
3589
|
return /* @__PURE__ */ jsx12("div", { "data-solvapay-topup-form-payment-element": "", children: /* @__PURE__ */ jsx12(
|
|
3576
3590
|
StripePaymentElement2,
|
|
3577
3591
|
{
|
|
3578
|
-
options,
|
|
3592
|
+
options: withPaymentElementDefaults(options),
|
|
3579
3593
|
onChange: (e) => setPaymentInputComplete(e.complete)
|
|
3580
3594
|
},
|
|
3581
3595
|
locale || "default"
|
|
@@ -4664,35 +4678,6 @@ function useUsageMeter() {
|
|
|
4664
4678
|
return useUsageMeterCtx("useUsageMeter");
|
|
4665
4679
|
}
|
|
4666
4680
|
|
|
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
4681
|
export {
|
|
4697
4682
|
filterPurchases,
|
|
4698
4683
|
getActivePurchases,
|
|
@@ -4819,6 +4804,5 @@ export {
|
|
|
4819
4804
|
Loading4 as Loading,
|
|
4820
4805
|
Empty,
|
|
4821
4806
|
UsageMeter,
|
|
4822
|
-
useUsageMeter
|
|
4823
|
-
usePaywallResolver
|
|
4807
|
+
useUsageMeter
|
|
4824
4808
|
};
|
|
@@ -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.cjs
CHANGED
|
@@ -1192,6 +1192,20 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
|
|
|
1192
1192
|
};
|
|
1193
1193
|
}
|
|
1194
1194
|
|
|
1195
|
+
// src/primitives/paymentElementDefaults.ts
|
|
1196
|
+
var DEFAULT_PAYMENT_ELEMENT_OPTIONS = {
|
|
1197
|
+
wallets: { link: "never" }
|
|
1198
|
+
};
|
|
1199
|
+
function withPaymentElementDefaults(options) {
|
|
1200
|
+
return {
|
|
1201
|
+
...options,
|
|
1202
|
+
wallets: {
|
|
1203
|
+
...DEFAULT_PAYMENT_ELEMENT_OPTIONS.wallets,
|
|
1204
|
+
...options?.wallets
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1195
1209
|
// src/utils/errors.ts
|
|
1196
1210
|
var DOCS_BASE_URL = "https://solvapay.com/docs";
|
|
1197
1211
|
var SolvaPayError = class extends Error {
|
|
@@ -2930,7 +2944,7 @@ var PaymentElementSlot = ({ options }) => {
|
|
|
2930
2944
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { "data-solvapay-payment-form-payment-element": "", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2931
2945
|
import_react_stripe_js.PaymentElement,
|
|
2932
2946
|
{
|
|
2933
|
-
options,
|
|
2947
|
+
options: withPaymentElementDefaults(options),
|
|
2934
2948
|
onChange: (e) => setPaymentInputComplete(e.complete)
|
|
2935
2949
|
},
|
|
2936
2950
|
locale || "default"
|
|
@@ -3691,7 +3705,7 @@ var PaymentElementSlot2 = ({ options }) => {
|
|
|
3691
3705
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-solvapay-topup-form-payment-element": "", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3692
3706
|
import_react_stripe_js2.PaymentElement,
|
|
3693
3707
|
{
|
|
3694
|
-
options,
|
|
3708
|
+
options: withPaymentElementDefaults(options),
|
|
3695
3709
|
onChange: (e) => setPaymentInputComplete(e.complete)
|
|
3696
3710
|
},
|
|
3697
3711
|
locale || "default"
|
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-PYOULKIW.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-5Y7H6EUH.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-LXEDJ5HB.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";
|