@solvapay/react 2.5.0 → 2.6.0
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 +17 -0
- package/dist/{UsageMeter-YX-icS_X.d.cts → UsageMeter-Cxn3_A-q.d.cts} +1 -1
- package/dist/{UsageMeter-Cg9IAFvV.d.ts → UsageMeter-sAFkX-Tz.d.ts} +1 -1
- package/dist/{chunk-BI5MJT24.js → chunk-PLKII2BF.js} +1 -1
- package/dist/{chunk-IZPE4LKU.js → chunk-SISWCV4B.js} +1 -1
- package/dist/{chunk-67GJCZZU.js → chunk-WVWUTOBU.js} +44 -8
- package/dist/{index-B8rb25FF.d.cts → index-CCNxvSm-.d.cts} +1 -1
- package/dist/{index-DBd1TLZA.d.ts → index-ykfNzPia.d.ts} +1 -1
- package/dist/index.cjs +44 -8
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/mcp/index.cjs +618 -544
- package/dist/mcp/index.d.cts +23 -16
- package/dist/mcp/index.d.ts +23 -16
- package/dist/mcp/index.js +427 -385
- package/dist/mcp/styles.css +63 -94
- package/dist/primitives/index.cjs +44 -8
- package/dist/primitives/index.d.cts +5 -5
- package/dist/primitives/index.d.ts +5 -5
- package/dist/primitives/index.js +2 -2
- package/dist/{useUsage-DwFZIuQW.d.ts → useUsage-Bee4D9Hw.d.ts} +28 -35
- package/dist/{useUsage-DwwQ-jAO.d.cts → useUsage-CPlXBdC5.d.cts} +28 -35
- package/package.json +3 -3
package/dist/mcp/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ExternalLinkGlyph,
|
|
3
3
|
LaunchCustomerPortalButton,
|
|
4
4
|
paymentMethodCache
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-PLKII2BF.js";
|
|
6
6
|
import {
|
|
7
7
|
AmountPicker,
|
|
8
8
|
BalanceBadge,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
useTransport,
|
|
58
58
|
useUsage,
|
|
59
59
|
validateAutoRechargeForm
|
|
60
|
-
} from "../chunk-
|
|
60
|
+
} from "../chunk-WVWUTOBU.js";
|
|
61
61
|
import "../chunk-UMXOAUW7.js";
|
|
62
62
|
import "../chunk-MLKGABMK.js";
|
|
63
63
|
|
|
@@ -484,7 +484,13 @@ function defaultSuccessCopy(evt, locale) {
|
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
// src/mcp/bootstrap.ts
|
|
487
|
-
import {
|
|
487
|
+
import {
|
|
488
|
+
MCP_TOOL_NAMES as MCP_TOOL_NAMES2,
|
|
489
|
+
TOOL_FOR_VIEW,
|
|
490
|
+
VIEW_FOR_TOOL,
|
|
491
|
+
VIEWER_TOOL_NAME,
|
|
492
|
+
SOLVAPAY_BOOTSTRAP_URI
|
|
493
|
+
} from "@solvapay/mcp-core";
|
|
488
494
|
var SOLVAPAY_TRANSPORT_TOOL_NAMES = new Set(
|
|
489
495
|
Object.values(MCP_TOOL_NAMES2).filter(
|
|
490
496
|
(name) => !(name in VIEW_FOR_TOOL)
|
|
@@ -506,25 +512,24 @@ function classifyHostEntry(app) {
|
|
|
506
512
|
}
|
|
507
513
|
return { kind: "other", toolName };
|
|
508
514
|
}
|
|
509
|
-
function
|
|
515
|
+
function fallbackViewFromHost(app) {
|
|
510
516
|
const classification = classifyHostEntry(app);
|
|
511
517
|
if (classification.kind === "intent") return classification.view;
|
|
512
|
-
return "
|
|
518
|
+
return "account";
|
|
513
519
|
}
|
|
514
520
|
async function fetchMcpBootstrap(app) {
|
|
515
|
-
const view =
|
|
516
|
-
const toolName = TOOL_FOR_VIEW[view];
|
|
521
|
+
const view = fallbackViewFromHost(app);
|
|
517
522
|
const result = await app.callServerTool({
|
|
518
|
-
name:
|
|
523
|
+
name: VIEWER_TOOL_NAME,
|
|
519
524
|
arguments: {}
|
|
520
525
|
});
|
|
521
|
-
return parseBootstrapFromToolResult(result,
|
|
526
|
+
return parseBootstrapFromToolResult(result, VIEWER_TOOL_NAME, view);
|
|
522
527
|
}
|
|
523
528
|
async function fetchMcpBootstrapViaResource(app) {
|
|
524
529
|
if (typeof app.readServerResource !== "function") {
|
|
525
530
|
throw new Error("Host does not support readServerResource");
|
|
526
531
|
}
|
|
527
|
-
const view =
|
|
532
|
+
const view = fallbackViewFromHost(app);
|
|
528
533
|
const result = await app.readServerResource({ uri: SOLVAPAY_BOOTSTRAP_URI });
|
|
529
534
|
const text = result.contents?.[0]?.text;
|
|
530
535
|
if (typeof text !== "string" || !text) {
|
|
@@ -536,12 +541,11 @@ async function fetchMcpBootstrapViaResource(app) {
|
|
|
536
541
|
} catch {
|
|
537
542
|
throw new Error("Bootstrap resource returned invalid JSON");
|
|
538
543
|
}
|
|
539
|
-
|
|
544
|
+
return parseBootstrapFromToolResult(
|
|
540
545
|
{ structuredContent: payload },
|
|
541
546
|
SOLVAPAY_BOOTSTRAP_URI,
|
|
542
547
|
view
|
|
543
548
|
);
|
|
544
|
-
return { ...bootstrap, view };
|
|
545
549
|
}
|
|
546
550
|
function parseBootstrapFromToolResult(result, toolName, fallbackView) {
|
|
547
551
|
const structured = result.structuredContent;
|
|
@@ -701,7 +705,6 @@ function seedMcpCaches(initial, config) {
|
|
|
701
705
|
|
|
702
706
|
// src/mcp/McpApp.tsx
|
|
703
707
|
import { useEffect as useEffect7, useMemo as useMemo5, useRef as useRef8, useState as useState12 } from "react";
|
|
704
|
-
import { VIEW_FOR_TOOL as VIEW_FOR_TOOL2 } from "@solvapay/mcp-core";
|
|
705
708
|
|
|
706
709
|
// src/mcp/McpAppShell.tsx
|
|
707
710
|
import { useCallback as useCallback5, useState as useState10 } from "react";
|
|
@@ -1551,7 +1554,7 @@ function websiteHostLabel(url) {
|
|
|
1551
1554
|
}
|
|
1552
1555
|
|
|
1553
1556
|
// src/mcp/views/accountFullscreen.tsx
|
|
1554
|
-
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1557
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1555
1558
|
function CreditActivitySection({
|
|
1556
1559
|
entries,
|
|
1557
1560
|
loading,
|
|
@@ -1623,10 +1626,27 @@ function ChargesTable({ charges: charges2 }) {
|
|
|
1623
1626
|
}) })
|
|
1624
1627
|
] });
|
|
1625
1628
|
}
|
|
1629
|
+
function AccountSignedInAs() {
|
|
1630
|
+
const copy = useCopy();
|
|
1631
|
+
const { email, customerRef } = useCustomer();
|
|
1632
|
+
const resolvedRef = customerRef?.trim();
|
|
1633
|
+
const resolvedEmail = email?.trim();
|
|
1634
|
+
if (!resolvedRef) return null;
|
|
1635
|
+
return /* @__PURE__ */ jsxs2("p", { className: "solvapay-mcp-muted solvapay-mcp-signed-in", children: [
|
|
1636
|
+
copy.account.signedInAs,
|
|
1637
|
+
" ",
|
|
1638
|
+
resolvedEmail ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
1639
|
+
/* @__PURE__ */ jsx5("span", { children: resolvedEmail }),
|
|
1640
|
+
" \xB7 "
|
|
1641
|
+
] }) : null,
|
|
1642
|
+
/* @__PURE__ */ jsx5("span", { className: "solvapay-mcp-signed-in-ref", children: resolvedRef })
|
|
1643
|
+
] });
|
|
1644
|
+
}
|
|
1626
1645
|
function AccountIdentityFooter() {
|
|
1627
1646
|
const copy = useCopy();
|
|
1628
1647
|
const { merchant } = useMerchant();
|
|
1629
|
-
const { name, email } = useCustomer();
|
|
1648
|
+
const { name, email, customerRef } = useCustomer();
|
|
1649
|
+
const signedInRef = customerRef?.trim();
|
|
1630
1650
|
const handleExternalClick = useExternalLinkClick();
|
|
1631
1651
|
const place = merchant ? formatMerchantPlace(merchant) : null;
|
|
1632
1652
|
const websiteUrl = merchant?.websiteUrl;
|
|
@@ -1654,6 +1674,7 @@ function AccountIdentityFooter() {
|
|
|
1654
1674
|
/* @__PURE__ */ jsxs2("div", { className: "solvapay-mcp-account-footer-buyer", children: [
|
|
1655
1675
|
name ? /* @__PURE__ */ jsx5("span", { children: name }) : null,
|
|
1656
1676
|
email ? /* @__PURE__ */ jsx5("span", { className: "solvapay-mcp-muted", children: email }) : null,
|
|
1677
|
+
signedInRef ? /* @__PURE__ */ jsx5("span", { className: "solvapay-mcp-muted solvapay-mcp-signed-in-ref", children: signedInRef }) : null,
|
|
1657
1678
|
/* @__PURE__ */ jsx5(PortalTextLink, { children: copy.account.fullAccount })
|
|
1658
1679
|
] })
|
|
1659
1680
|
] });
|
|
@@ -1794,7 +1815,7 @@ function resolveMcpClassNames(overrides) {
|
|
|
1794
1815
|
}
|
|
1795
1816
|
|
|
1796
1817
|
// src/mcp/views/AllowanceAccountPanel.tsx
|
|
1797
|
-
import { Fragment, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1818
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1798
1819
|
function AllowanceAccountPanel({
|
|
1799
1820
|
accountState,
|
|
1800
1821
|
product,
|
|
@@ -1856,7 +1877,7 @@ function AllowanceAccountPanel({
|
|
|
1856
1877
|
fullscreenCredits: isFullscreen
|
|
1857
1878
|
});
|
|
1858
1879
|
const showMeter = remaining.kind === "finite" && usage != null && total != null && total > 0;
|
|
1859
|
-
const used = remaining.kind === "finite" && total != null ? usage?.
|
|
1880
|
+
const used = remaining.kind === "finite" && total != null ? usage?.used ?? Math.max(0, total - remaining.remaining) : usage?.used ?? 0;
|
|
1860
1881
|
const percent = usage?.percentUsed ?? (total != null && total > 0 ? Math.min(100, Math.round(used / total * 1e4) / 100) : null);
|
|
1861
1882
|
const meterCaption = showMeter ? buildMeterCaption({
|
|
1862
1883
|
used,
|
|
@@ -1904,7 +1925,7 @@ function AllowanceAccountPanel({
|
|
|
1904
1925
|
] }),
|
|
1905
1926
|
/* @__PURE__ */ jsx7("button", { type: "button", className: cx2.linkButton, onClick: () => onChangePlan(), children: copy.account.seePlans })
|
|
1906
1927
|
] }) : null,
|
|
1907
|
-
showPortalCta && !isFullscreen ? /* @__PURE__ */ jsxs4(
|
|
1928
|
+
showPortalCta && !isFullscreen ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1908
1929
|
/* @__PURE__ */ jsx7("p", { className: cx2.muted, "data-solvapay-mcp-portal-hint": "", children: copy.currentPlan.portalHint }),
|
|
1909
1930
|
/* @__PURE__ */ jsx7(
|
|
1910
1931
|
LaunchCustomerPortalButton,
|
|
@@ -1914,7 +1935,8 @@ function AllowanceAccountPanel({
|
|
|
1914
1935
|
errorClassName: cx2.button
|
|
1915
1936
|
}
|
|
1916
1937
|
)
|
|
1917
|
-
] }) : null
|
|
1938
|
+
] }) : null,
|
|
1939
|
+
isFullscreen ? null : /* @__PURE__ */ jsx7(AccountSignedInAs, {})
|
|
1918
1940
|
] }),
|
|
1919
1941
|
isFullscreen && productRef ? /* @__PURE__ */ jsx7(ChargesSection, { charges: history.charges, loading: history.loading, error: history.error }) : null,
|
|
1920
1942
|
isFullscreen ? /* @__PURE__ */ jsx7(AccountIdentityFooter, {}) : null
|
|
@@ -2010,7 +2032,7 @@ function buildMeterCaption({
|
|
|
2010
2032
|
}
|
|
2011
2033
|
|
|
2012
2034
|
// src/mcp/views/CreditAccountPanel.tsx
|
|
2013
|
-
import { Fragment as
|
|
2035
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2014
2036
|
function CreditAccountPanel({
|
|
2015
2037
|
accountState,
|
|
2016
2038
|
product,
|
|
@@ -2102,7 +2124,7 @@ function CreditAccountPanel({
|
|
|
2102
2124
|
}
|
|
2103
2125
|
) : null
|
|
2104
2126
|
] }),
|
|
2105
|
-
showPortalCta && !isFullscreen ? /* @__PURE__ */ jsxs5(
|
|
2127
|
+
showPortalCta && !isFullscreen ? /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
2106
2128
|
/* @__PURE__ */ jsx8("p", { className: cx2.muted, "data-solvapay-mcp-portal-hint": "", children: copy.currentPlan.portalHint }),
|
|
2107
2129
|
/* @__PURE__ */ jsx8(
|
|
2108
2130
|
LaunchCustomerPortalButton,
|
|
@@ -2112,7 +2134,8 @@ function CreditAccountPanel({
|
|
|
2112
2134
|
errorClassName: cx2.button
|
|
2113
2135
|
}
|
|
2114
2136
|
)
|
|
2115
|
-
] }) : null
|
|
2137
|
+
] }) : null,
|
|
2138
|
+
isFullscreen ? null : /* @__PURE__ */ jsx8(AccountSignedInAs, {})
|
|
2116
2139
|
] }),
|
|
2117
2140
|
isFullscreen && productRef ? /* @__PURE__ */ jsx8(
|
|
2118
2141
|
CreditActivitySection,
|
|
@@ -2128,7 +2151,7 @@ function CreditAccountPanel({
|
|
|
2128
2151
|
|
|
2129
2152
|
// src/mcp/views/ForcedAccountPanel.tsx
|
|
2130
2153
|
import { billingCycle as billingCycle4, includedUnits as includedUnits2 } from "@solvapay/core";
|
|
2131
|
-
import { Fragment as
|
|
2154
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2132
2155
|
function ForcedAccountPanel({
|
|
2133
2156
|
accountState,
|
|
2134
2157
|
product,
|
|
@@ -2143,7 +2166,10 @@ function ForcedAccountPanel({
|
|
|
2143
2166
|
}) {
|
|
2144
2167
|
const cx2 = resolveMcpClassNames(classNames);
|
|
2145
2168
|
if (accountState === "G") {
|
|
2146
|
-
return /* @__PURE__ */ jsx9("div", { className: "solvapay-mcp-account", children: /* @__PURE__ */
|
|
2169
|
+
return /* @__PURE__ */ jsx9("div", { className: "solvapay-mcp-account", children: /* @__PURE__ */ jsxs6("div", { className: cx2.card, "data-solvapay-mcp-account-skeleton": "", "aria-busy": "true", children: [
|
|
2170
|
+
/* @__PURE__ */ jsx9(AccountSkeleton, {}),
|
|
2171
|
+
/* @__PURE__ */ jsx9(AccountSignedInAs, {})
|
|
2172
|
+
] }) });
|
|
2147
2173
|
}
|
|
2148
2174
|
if (accountState === "H") {
|
|
2149
2175
|
return /* @__PURE__ */ jsx9(
|
|
@@ -2264,7 +2290,8 @@ function ActivateAccountPanel({
|
|
|
2264
2290
|
}
|
|
2265
2291
|
),
|
|
2266
2292
|
error ? /* @__PURE__ */ jsx9("p", { className: cx2.error, role: "alert", children: error }) : null,
|
|
2267
|
-
showPortalCta ? /* @__PURE__ */ jsx9(PortalHint, { classNames }) : null
|
|
2293
|
+
showPortalCta ? /* @__PURE__ */ jsx9(PortalHint, { classNames }) : null,
|
|
2294
|
+
/* @__PURE__ */ jsx9(AccountSignedInAs, {})
|
|
2268
2295
|
] }) });
|
|
2269
2296
|
}
|
|
2270
2297
|
function OverageAccountPanel({
|
|
@@ -2332,7 +2359,8 @@ function OverageAccountPanel({
|
|
|
2332
2359
|
] }),
|
|
2333
2360
|
/* @__PURE__ */ jsx9("p", { className: "solvapay-mcp-overage-copy", children: copy.account.stillWorking }),
|
|
2334
2361
|
onChangePlan ? /* @__PURE__ */ jsx9("button", { type: "button", className: cx2.linkButton, onClick: () => onChangePlan(), children: copy.account.seeHigherLimit }) : null,
|
|
2335
|
-
showPortalCta ? /* @__PURE__ */ jsx9(PortalHint, { classNames }) : null
|
|
2362
|
+
showPortalCta ? /* @__PURE__ */ jsx9(PortalHint, { classNames }) : null,
|
|
2363
|
+
/* @__PURE__ */ jsx9(AccountSignedInAs, {})
|
|
2336
2364
|
] }) });
|
|
2337
2365
|
}
|
|
2338
2366
|
function CancelledAccountPanel({
|
|
@@ -2360,7 +2388,7 @@ function CancelledAccountPanel({
|
|
|
2360
2388
|
const total = remaining != null ? usage?.total ?? (cap && cap > 0 ? cap : null) : cap && cap > 0 ? cap : null;
|
|
2361
2389
|
const meter = usage?.meterRef ?? limits.meterName;
|
|
2362
2390
|
const showMeter = remaining != null && total != null && total > 0;
|
|
2363
|
-
const used = remaining != null && total != null ? usage?.
|
|
2391
|
+
const used = remaining != null && total != null ? usage?.used ?? Math.max(0, total - remaining) : usage?.used ?? 0;
|
|
2364
2392
|
const percent = usage?.percentUsed ?? (total != null && total > 0 ? Math.min(100, Math.round(used / total * 1e4) / 100) : null);
|
|
2365
2393
|
return /* @__PURE__ */ jsx9("div", { className: "solvapay-mcp-account", children: /* @__PURE__ */ jsxs6("div", { className: cx2.card, children: [
|
|
2366
2394
|
/* @__PURE__ */ jsx9(
|
|
@@ -2403,13 +2431,14 @@ function CancelledAccountPanel({
|
|
|
2403
2431
|
)
|
|
2404
2432
|
] }) : null,
|
|
2405
2433
|
/* @__PURE__ */ jsx9(CancelledPlanNotice.Root, { children: /* @__PURE__ */ jsx9(CancelledPlanNotice.ReactivateButton, { className: cx2.button, "data-variant": "secondary", children: interpolate(copy.account.reactivatePlan, { plan: planName }) }) }),
|
|
2406
|
-
showPortalCta ? /* @__PURE__ */ jsx9(PortalHint, { classNames }) : null
|
|
2434
|
+
showPortalCta ? /* @__PURE__ */ jsx9(PortalHint, { classNames }) : null,
|
|
2435
|
+
/* @__PURE__ */ jsx9(AccountSignedInAs, {})
|
|
2407
2436
|
] }) });
|
|
2408
2437
|
}
|
|
2409
2438
|
function PortalHint({ classNames }) {
|
|
2410
2439
|
const cx2 = resolveMcpClassNames(classNames);
|
|
2411
2440
|
const copy = useCopy();
|
|
2412
|
-
return /* @__PURE__ */ jsxs6(
|
|
2441
|
+
return /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
2413
2442
|
/* @__PURE__ */ jsx9("p", { className: cx2.muted, "data-solvapay-mcp-portal-hint": "", children: copy.currentPlan.portalHint }),
|
|
2414
2443
|
/* @__PURE__ */ jsx9(
|
|
2415
2444
|
LaunchCustomerPortalButton,
|
|
@@ -2533,7 +2562,7 @@ function optionFromPlan(plan) {
|
|
|
2533
2562
|
}
|
|
2534
2563
|
|
|
2535
2564
|
// src/mcp/views/LadderAccountPanel.tsx
|
|
2536
|
-
import { Fragment as
|
|
2565
|
+
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2537
2566
|
function LadderAccountPanel({
|
|
2538
2567
|
accountState,
|
|
2539
2568
|
product,
|
|
@@ -2636,7 +2665,7 @@ function LadderAccountPanel({
|
|
|
2636
2665
|
/* @__PURE__ */ jsx11("button", { type: "button", className: cx2.button, onClick: () => onChangePlan(), children: copy.account.pickPlanButton })
|
|
2637
2666
|
] }) : null,
|
|
2638
2667
|
error ? /* @__PURE__ */ jsx11("p", { className: cx2.error, role: "alert", children: error }) : null,
|
|
2639
|
-
showPortalCta && !isFullscreen ? /* @__PURE__ */ jsxs7(
|
|
2668
|
+
showPortalCta && !isFullscreen ? /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
2640
2669
|
/* @__PURE__ */ jsx11("p", { className: cx2.muted, "data-solvapay-mcp-portal-hint": "", children: copy.currentPlan.portalHint }),
|
|
2641
2670
|
/* @__PURE__ */ jsx11(
|
|
2642
2671
|
LaunchCustomerPortalButton,
|
|
@@ -2646,7 +2675,8 @@ function LadderAccountPanel({
|
|
|
2646
2675
|
errorClassName: cx2.button
|
|
2647
2676
|
}
|
|
2648
2677
|
)
|
|
2649
|
-
] }) : null
|
|
2678
|
+
] }) : null,
|
|
2679
|
+
isFullscreen ? null : /* @__PURE__ */ jsx11(AccountSignedInAs, {})
|
|
2650
2680
|
] }),
|
|
2651
2681
|
isFullscreen ? /* @__PURE__ */ jsx11(AccountIdentityFooter, {}) : null
|
|
2652
2682
|
] });
|
|
@@ -2875,7 +2905,7 @@ function planWhatItGives(plan, locale, balance) {
|
|
|
2875
2905
|
}
|
|
2876
2906
|
|
|
2877
2907
|
// src/mcp/views/checkout/steps/PlanStep.tsx
|
|
2878
|
-
import { Fragment as
|
|
2908
|
+
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2879
2909
|
var PlanStep = memo(function PlanStep2({
|
|
2880
2910
|
fromPaywall,
|
|
2881
2911
|
paywallKind,
|
|
@@ -2895,7 +2925,7 @@ var PlanStep = memo(function PlanStep2({
|
|
|
2895
2925
|
const pricingOption = selectedPlan ? getSelectedOption(selectedPlan) : void 0;
|
|
2896
2926
|
const ctaLabel = formatContinueLabel(selectedPlanShape, locale, pricingOption);
|
|
2897
2927
|
const showPreface = fromPaywall && !hideUpgradeBanner && paywallKind !== "payment_required";
|
|
2898
|
-
return /* @__PURE__ */ jsxs9(
|
|
2928
|
+
return /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
2899
2929
|
onBack ? /* @__PURE__ */ jsx15(BackLink, { label: copy.checkout.backToAccount, onClick: onBack }) : null,
|
|
2900
2930
|
showPreface ? /* @__PURE__ */ jsx15("p", { className: cx2.muted, role: "status", children: "This tool needs a paid plan. Pick one to get started." }) : null,
|
|
2901
2931
|
/* @__PURE__ */ jsxs9("div", { className: "solvapay-mcp-plan-step-header", children: [
|
|
@@ -2946,11 +2976,62 @@ var PlanStep = memo(function PlanStep2({
|
|
|
2946
2976
|
// src/mcp/views/checkout/steps/AmountStep.tsx
|
|
2947
2977
|
import { memo as memo2, useRef as useRef3, useState as useState6 } from "react";
|
|
2948
2978
|
|
|
2979
|
+
// src/mcp/format-compact-credits.ts
|
|
2980
|
+
function formatCompactCredits(credits, locale = "en-US") {
|
|
2981
|
+
if (!Number.isFinite(credits) || credits < 0) {
|
|
2982
|
+
throw new Error(`formatCompactCredits: credits must be a finite non-negative number, got ${credits}`);
|
|
2983
|
+
}
|
|
2984
|
+
if (credits >= 1e6 && credits % 1e6 === 0) {
|
|
2985
|
+
return `${credits / 1e6}M credits`;
|
|
2986
|
+
}
|
|
2987
|
+
if (credits >= 1e3 && credits % 1e3 === 0) {
|
|
2988
|
+
return `${credits / 1e3}K credits`;
|
|
2989
|
+
}
|
|
2990
|
+
return `${credits.toLocaleString(locale)} credits`;
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
// src/mcp/views/PresetAmountGrid.tsx
|
|
2994
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2995
|
+
function estimateTopupCredits(amountMinor, payCurrency, displayCurrency, creditsPerMinorUnit, displayExchangeRate) {
|
|
2996
|
+
const rateAppliesToCurrency = displayCurrency != null && payCurrency.toUpperCase() === displayCurrency.toUpperCase();
|
|
2997
|
+
if (!rateAppliesToCurrency || creditsPerMinorUnit == null || creditsPerMinorUnit <= 0 || displayExchangeRate == null || displayExchangeRate <= 0) {
|
|
2998
|
+
return { kind: "unavailable" };
|
|
2999
|
+
}
|
|
3000
|
+
const credits = Math.floor(amountMinor / displayExchangeRate * creditsPerMinorUnit);
|
|
3001
|
+
return { kind: "available", credits };
|
|
3002
|
+
}
|
|
3003
|
+
function PresetAmountGrid({
|
|
3004
|
+
currencyDisplay
|
|
3005
|
+
}) {
|
|
3006
|
+
const locale = useHostLocale();
|
|
3007
|
+
const { quickAmounts, currency, creditsPerMinorUnit, displayExchangeRate } = useAmountPicker();
|
|
3008
|
+
const { displayCurrency } = useBalance();
|
|
3009
|
+
return /* @__PURE__ */ jsx16("div", { className: "solvapay-mcp-preset-grid", "aria-label": "Quick amounts", children: quickAmounts.map((amount) => {
|
|
3010
|
+
const minor = amount * getMinorUnitsPerMajor(currency);
|
|
3011
|
+
const label = formatPrice(minor, currency, {
|
|
3012
|
+
locale,
|
|
3013
|
+
free: "",
|
|
3014
|
+
currencyDisplay
|
|
3015
|
+
});
|
|
3016
|
+
const estimate = estimateTopupCredits(
|
|
3017
|
+
minor,
|
|
3018
|
+
currency,
|
|
3019
|
+
displayCurrency,
|
|
3020
|
+
creditsPerMinorUnit,
|
|
3021
|
+
displayExchangeRate
|
|
3022
|
+
);
|
|
3023
|
+
return /* @__PURE__ */ jsxs10(AmountPicker.Option, { amount, className: "solvapay-mcp-preset-tile", children: [
|
|
3024
|
+
/* @__PURE__ */ jsx16("span", { className: "solvapay-mcp-preset-tile-amount", children: label }),
|
|
3025
|
+
/* @__PURE__ */ jsx16("span", { className: "solvapay-mcp-preset-tile-credits", children: estimate.kind === "available" ? formatCompactCredits(estimate.credits, locale) : "" })
|
|
3026
|
+
] }, amount);
|
|
3027
|
+
}) });
|
|
3028
|
+
}
|
|
3029
|
+
|
|
2949
3030
|
// src/mcp/views/autoRecharge/McpInlineAutoRecharge.tsx
|
|
2950
3031
|
import { forwardRef, useImperativeHandle, useState as useState5 } from "react";
|
|
2951
3032
|
|
|
2952
3033
|
// src/mcp/views/autoRecharge/McpAutoRechargeFields.tsx
|
|
2953
|
-
import { jsx as
|
|
3034
|
+
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2954
3035
|
function currencySymbol(currency) {
|
|
2955
3036
|
try {
|
|
2956
3037
|
const parts = new Intl.NumberFormat("en", {
|
|
@@ -2983,8 +3064,8 @@ function McpAutoRechargeFields({
|
|
|
2983
3064
|
const explainer = credits != null ? interpolate(copy.autoRechargeView.explainer, {
|
|
2984
3065
|
credits: new Intl.NumberFormat().format(credits)
|
|
2985
3066
|
}) : copy.autoRechargeView.explainerNoEstimate;
|
|
2986
|
-
return /* @__PURE__ */
|
|
2987
|
-
/* @__PURE__ */
|
|
3067
|
+
return /* @__PURE__ */ jsxs11("div", { className: "solvapay-mcp-auto-recharge-fields", children: [
|
|
3068
|
+
/* @__PURE__ */ jsx17(
|
|
2988
3069
|
Field,
|
|
2989
3070
|
{
|
|
2990
3071
|
id: "mcp-auto-recharge-threshold",
|
|
@@ -2995,7 +3076,7 @@ function McpAutoRechargeFields({
|
|
|
2995
3076
|
onChange: (thresholdAmountMajor) => onChange({ ...form, thresholdAmountMajor })
|
|
2996
3077
|
}
|
|
2997
3078
|
),
|
|
2998
|
-
/* @__PURE__ */
|
|
3079
|
+
/* @__PURE__ */ jsx17(
|
|
2999
3080
|
Field,
|
|
3000
3081
|
{
|
|
3001
3082
|
id: "mcp-auto-recharge-topup",
|
|
@@ -3006,7 +3087,7 @@ function McpAutoRechargeFields({
|
|
|
3006
3087
|
onChange: (topupAmountMajor) => onChange({ ...form, topupAmountMajor })
|
|
3007
3088
|
}
|
|
3008
3089
|
),
|
|
3009
|
-
/* @__PURE__ */
|
|
3090
|
+
/* @__PURE__ */ jsx17(
|
|
3010
3091
|
Field,
|
|
3011
3092
|
{
|
|
3012
3093
|
id: "mcp-auto-recharge-cap",
|
|
@@ -3018,13 +3099,13 @@ function McpAutoRechargeFields({
|
|
|
3018
3099
|
onChange: (maxMonthlySpendMajor) => onChange({ ...form, maxMonthlySpendMajor })
|
|
3019
3100
|
}
|
|
3020
3101
|
),
|
|
3021
|
-
/* @__PURE__ */
|
|
3022
|
-
validationError ? /* @__PURE__ */
|
|
3102
|
+
/* @__PURE__ */ jsx17("p", { className: "solvapay-mcp-auto-recharge-fields-explainer", children: explainer }),
|
|
3103
|
+
validationError ? /* @__PURE__ */ jsx17("p", { className: "solvapay-mcp-auto-recharge-fields-error", role: "alert", children: validationError }) : null
|
|
3023
3104
|
] });
|
|
3024
3105
|
}
|
|
3025
3106
|
|
|
3026
3107
|
// src/mcp/views/autoRecharge/McpInlineAutoRecharge.tsx
|
|
3027
|
-
import { jsx as
|
|
3108
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3028
3109
|
var McpInlineAutoRecharge = forwardRef(function McpInlineAutoRecharge2({ currency, creditsPerMinorUnit, displayExchangeRate }, ref) {
|
|
3029
3110
|
const copy = useCopy();
|
|
3030
3111
|
const [form, setForm] = useState5(() => createDefaultAutoRechargeForm(currency));
|
|
@@ -3048,10 +3129,10 @@ var McpInlineAutoRecharge = forwardRef(function McpInlineAutoRecharge2({ currenc
|
|
|
3048
3129
|
};
|
|
3049
3130
|
}
|
|
3050
3131
|
}));
|
|
3051
|
-
return /* @__PURE__ */
|
|
3052
|
-
/* @__PURE__ */
|
|
3053
|
-
/* @__PURE__ */
|
|
3054
|
-
/* @__PURE__ */
|
|
3132
|
+
return /* @__PURE__ */ jsxs12("div", { className: "solvapay-mcp-auto-recharge-inline", children: [
|
|
3133
|
+
/* @__PURE__ */ jsxs12(SplitRow, { children: [
|
|
3134
|
+
/* @__PURE__ */ jsx18("p", { children: copy.autoRechargeView.heading }),
|
|
3135
|
+
/* @__PURE__ */ jsx18(
|
|
3055
3136
|
Toggle,
|
|
3056
3137
|
{
|
|
3057
3138
|
checked: form.enabled,
|
|
@@ -3063,7 +3144,7 @@ var McpInlineAutoRecharge = forwardRef(function McpInlineAutoRecharge2({ currenc
|
|
|
3063
3144
|
}
|
|
3064
3145
|
)
|
|
3065
3146
|
] }),
|
|
3066
|
-
form.enabled ? /* @__PURE__ */
|
|
3147
|
+
form.enabled ? /* @__PURE__ */ jsx18(
|
|
3067
3148
|
McpAutoRechargeFields,
|
|
3068
3149
|
{
|
|
3069
3150
|
form,
|
|
@@ -3081,7 +3162,7 @@ var McpInlineAutoRecharge = forwardRef(function McpInlineAutoRecharge2({ currenc
|
|
|
3081
3162
|
});
|
|
3082
3163
|
|
|
3083
3164
|
// src/mcp/views/checkout/steps/AmountStep.tsx
|
|
3084
|
-
import { Fragment as
|
|
3165
|
+
import { Fragment as Fragment7, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3085
3166
|
var AmountStep = memo2(function AmountStep2({
|
|
3086
3167
|
topupCurrency,
|
|
3087
3168
|
topupCurrencies,
|
|
@@ -3098,23 +3179,23 @@ var AmountStep = memo2(function AmountStep2({
|
|
|
3098
3179
|
const currencies = topupCurrencies ?? [];
|
|
3099
3180
|
const showCurrencySwitch = currencies.length > 1 && !!onCurrencyChange;
|
|
3100
3181
|
const currencyDisplay = showCurrencySwitch ? "code" : "symbol";
|
|
3101
|
-
return /* @__PURE__ */
|
|
3102
|
-
/* @__PURE__ */
|
|
3103
|
-
/* @__PURE__ */
|
|
3104
|
-
/* @__PURE__ */
|
|
3105
|
-
showCurrencySwitch && /* @__PURE__ */
|
|
3182
|
+
return /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
3183
|
+
/* @__PURE__ */ jsx19(BackLink, { label: "Back", onClick: onBack }),
|
|
3184
|
+
/* @__PURE__ */ jsxs13("div", { className: "solvapay-mcp-step-header", children: [
|
|
3185
|
+
/* @__PURE__ */ jsx19("h2", { className: cx2.heading, children: "How many credits?" }),
|
|
3186
|
+
showCurrencySwitch && /* @__PURE__ */ jsx19(
|
|
3106
3187
|
"select",
|
|
3107
3188
|
{
|
|
3108
3189
|
className: "solvapay-mcp-currency-switch",
|
|
3109
3190
|
value: currency,
|
|
3110
3191
|
onChange: (event) => onCurrencyChange?.(event.target.value),
|
|
3111
3192
|
"aria-label": "Topup currency",
|
|
3112
|
-
children: currencies.map((code) => /* @__PURE__ */
|
|
3193
|
+
children: currencies.map((code) => /* @__PURE__ */ jsx19("option", { value: code, children: code }, code))
|
|
3113
3194
|
}
|
|
3114
3195
|
)
|
|
3115
3196
|
] }),
|
|
3116
|
-
/* @__PURE__ */
|
|
3117
|
-
/* @__PURE__ */
|
|
3197
|
+
/* @__PURE__ */ jsx19("p", { className: cx2.muted, children: "Top up to start using the tool." }),
|
|
3198
|
+
/* @__PURE__ */ jsxs13(
|
|
3118
3199
|
AmountPicker.Root,
|
|
3119
3200
|
{
|
|
3120
3201
|
currency,
|
|
@@ -3122,9 +3203,9 @@ var AmountStep = memo2(function AmountStep2({
|
|
|
3122
3203
|
className: cx2.amountPicker,
|
|
3123
3204
|
onChange: (value) => setStagedAmountMinor(value),
|
|
3124
3205
|
children: [
|
|
3125
|
-
/* @__PURE__ */
|
|
3126
|
-
/* @__PURE__ */
|
|
3127
|
-
/* @__PURE__ */
|
|
3206
|
+
/* @__PURE__ */ jsx19(PresetAmountGrid, { currencyDisplay }),
|
|
3207
|
+
/* @__PURE__ */ jsx19(CustomAmountRow, { rowClassName: cx2.amountCustom, currencyDisplay }),
|
|
3208
|
+
/* @__PURE__ */ jsx19(
|
|
3128
3209
|
McpInlineAutoRecharge,
|
|
3129
3210
|
{
|
|
3130
3211
|
ref: autoRechargeRef,
|
|
@@ -3133,7 +3214,7 @@ var AmountStep = memo2(function AmountStep2({
|
|
|
3133
3214
|
displayExchangeRate
|
|
3134
3215
|
}
|
|
3135
3216
|
),
|
|
3136
|
-
/* @__PURE__ */
|
|
3217
|
+
/* @__PURE__ */ jsx19(
|
|
3137
3218
|
AmountPicker.Confirm,
|
|
3138
3219
|
{
|
|
3139
3220
|
className: cx2.button,
|
|
@@ -3153,41 +3234,15 @@ var AmountStep = memo2(function AmountStep2({
|
|
|
3153
3234
|
)
|
|
3154
3235
|
] });
|
|
3155
3236
|
});
|
|
3156
|
-
function PresetAmountRow({
|
|
3157
|
-
cx: cx2,
|
|
3158
|
-
currencyDisplay
|
|
3159
|
-
}) {
|
|
3160
|
-
const { quickAmounts, currency } = useAmountPicker();
|
|
3161
|
-
const locale = useHostLocale();
|
|
3162
|
-
const popularIndex = Math.min(1, quickAmounts.length - 1);
|
|
3163
|
-
return /* @__PURE__ */ jsx18("div", { className: cx2.amountOptions, children: quickAmounts.map((amount, i) => {
|
|
3164
|
-
const label = formatPrice(amount * getMinorUnitsPerMajor(currency), currency, {
|
|
3165
|
-
locale,
|
|
3166
|
-
free: "",
|
|
3167
|
-
currencyDisplay
|
|
3168
|
-
});
|
|
3169
|
-
return /* @__PURE__ */ jsx18(
|
|
3170
|
-
AmountPicker.Option,
|
|
3171
|
-
{
|
|
3172
|
-
amount,
|
|
3173
|
-
className: cx2.amountOption,
|
|
3174
|
-
"data-popular": i === popularIndex ? "" : void 0,
|
|
3175
|
-
"aria-label": `${label}${i === popularIndex ? " (popular)" : ""}`,
|
|
3176
|
-
children: label
|
|
3177
|
-
},
|
|
3178
|
-
amount
|
|
3179
|
-
);
|
|
3180
|
-
}) });
|
|
3181
|
-
}
|
|
3182
3237
|
function CustomAmountRow({
|
|
3183
3238
|
rowClassName,
|
|
3184
3239
|
currencyDisplay
|
|
3185
3240
|
}) {
|
|
3186
3241
|
const { currencySymbol: currencySymbol2, currency } = useAmountPicker();
|
|
3187
3242
|
const prefix = currencyDisplay === "code" ? currency.toUpperCase() : currencySymbol2;
|
|
3188
|
-
return /* @__PURE__ */
|
|
3189
|
-
/* @__PURE__ */
|
|
3190
|
-
/* @__PURE__ */
|
|
3243
|
+
return /* @__PURE__ */ jsxs13("div", { className: rowClassName, children: [
|
|
3244
|
+
/* @__PURE__ */ jsx19("span", { className: "solvapay-mcp-amount-currency-symbol", children: prefix }),
|
|
3245
|
+
/* @__PURE__ */ jsx19(AmountPicker.Custom, { className: "solvapay-mcp-amount-custom-input", placeholder: "0.00" })
|
|
3191
3246
|
] });
|
|
3192
3247
|
}
|
|
3193
3248
|
|
|
@@ -3200,27 +3255,27 @@ function chargeAmountMinor(taxBreakdown, amountMinor) {
|
|
|
3200
3255
|
}
|
|
3201
3256
|
|
|
3202
3257
|
// src/mcp/views/McpHosted.tsx
|
|
3203
|
-
import { jsx as
|
|
3258
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
3204
3259
|
function McpHostedColumn({
|
|
3205
3260
|
surface,
|
|
3206
3261
|
children
|
|
3207
3262
|
}) {
|
|
3208
|
-
return /* @__PURE__ */
|
|
3263
|
+
return /* @__PURE__ */ jsx20("div", { className: "solvapay-mcp-hosted", "data-mcp-surface": surface, children });
|
|
3209
3264
|
}
|
|
3210
3265
|
function McpHostedLayout({ children }) {
|
|
3211
3266
|
const displayMode = useDisplayMode();
|
|
3212
3267
|
const rail = resolveHostedRail(displayMode);
|
|
3213
|
-
return /* @__PURE__ */
|
|
3268
|
+
return /* @__PURE__ */ jsx20("div", { className: "solvapay-mcp-hosted-layout", "data-rail": rail, children });
|
|
3214
3269
|
}
|
|
3215
3270
|
function McpSummaryRail({ children }) {
|
|
3216
|
-
return /* @__PURE__ */
|
|
3271
|
+
return /* @__PURE__ */ jsx20("aside", { className: "solvapay-mcp-summary-rail", children });
|
|
3217
3272
|
}
|
|
3218
3273
|
function McpHostedBody({ children }) {
|
|
3219
|
-
return /* @__PURE__ */
|
|
3274
|
+
return /* @__PURE__ */ jsx20("div", { className: "solvapay-mcp-hosted-body", children });
|
|
3220
3275
|
}
|
|
3221
3276
|
|
|
3222
3277
|
// src/mcp/views/McpPayingAs.tsx
|
|
3223
|
-
import { jsx as
|
|
3278
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3224
3279
|
function McpPayingAs({ email }) {
|
|
3225
3280
|
const { email: customerEmail } = useCustomer();
|
|
3226
3281
|
const { displayMode } = useDisplayMode();
|
|
@@ -3228,19 +3283,19 @@ function McpPayingAs({ email }) {
|
|
|
3228
3283
|
if (!resolved) return null;
|
|
3229
3284
|
const variant = displayMode === "fullscreen" ? "stacked" : "inline";
|
|
3230
3285
|
if (variant === "stacked") {
|
|
3231
|
-
return /* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3233
|
-
/* @__PURE__ */
|
|
3286
|
+
return /* @__PURE__ */ jsxs14("div", { className: "solvapay-mcp-paying-as", "data-variant": "stacked", children: [
|
|
3287
|
+
/* @__PURE__ */ jsx21("span", { className: "solvapay-mcp-paying-as-label", children: "Paying as" }),
|
|
3288
|
+
/* @__PURE__ */ jsx21("span", { className: "solvapay-mcp-paying-as-email", children: resolved })
|
|
3234
3289
|
] });
|
|
3235
3290
|
}
|
|
3236
|
-
return /* @__PURE__ */
|
|
3291
|
+
return /* @__PURE__ */ jsxs14("span", { className: "solvapay-mcp-paying-as", "data-variant": "inline", children: [
|
|
3237
3292
|
"Paying as ",
|
|
3238
3293
|
resolved
|
|
3239
3294
|
] });
|
|
3240
3295
|
}
|
|
3241
3296
|
|
|
3242
3297
|
// src/mcp/views/McpPaymentHeader.tsx
|
|
3243
|
-
import { Fragment as
|
|
3298
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3244
3299
|
function McpPaymentHeader({
|
|
3245
3300
|
backLabel,
|
|
3246
3301
|
onBack,
|
|
@@ -3251,18 +3306,18 @@ function McpPaymentHeader({
|
|
|
3251
3306
|
const cx2 = resolveMcpClassNames(classNames);
|
|
3252
3307
|
const { displayMode } = useDisplayMode();
|
|
3253
3308
|
const isFullscreen = displayMode === "fullscreen";
|
|
3254
|
-
const title = heading ? /* @__PURE__ */
|
|
3255
|
-
const back = /* @__PURE__ */
|
|
3256
|
-
const payingAs = /* @__PURE__ */
|
|
3309
|
+
const title = heading ? /* @__PURE__ */ jsx22("h2", { className: headingClassName ?? cx2.heading, children: heading }) : null;
|
|
3310
|
+
const back = /* @__PURE__ */ jsx22(BackLink, { label: backLabel, onClick: onBack });
|
|
3311
|
+
const payingAs = /* @__PURE__ */ jsx22(McpPayingAs, {});
|
|
3257
3312
|
if (isFullscreen) {
|
|
3258
|
-
return /* @__PURE__ */
|
|
3313
|
+
return /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
3259
3314
|
back,
|
|
3260
3315
|
title,
|
|
3261
3316
|
payingAs
|
|
3262
3317
|
] });
|
|
3263
3318
|
}
|
|
3264
|
-
return /* @__PURE__ */
|
|
3265
|
-
/* @__PURE__ */
|
|
3319
|
+
return /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
3320
|
+
/* @__PURE__ */ jsxs15("div", { className: "solvapay-mcp-form-identity-row", children: [
|
|
3266
3321
|
back,
|
|
3267
3322
|
payingAs
|
|
3268
3323
|
] }),
|
|
@@ -3276,7 +3331,7 @@ var MCP_PAYMENT_ELEMENT_OPTIONS = {
|
|
|
3276
3331
|
};
|
|
3277
3332
|
|
|
3278
3333
|
// src/mcp/views/checkout/steps/PaygPaymentStep.tsx
|
|
3279
|
-
import { Fragment as
|
|
3334
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3280
3335
|
var PaygPaymentStep = memo3(function PaygPaymentStep2({
|
|
3281
3336
|
plan: _plan,
|
|
3282
3337
|
amountMinor,
|
|
@@ -3293,7 +3348,7 @@ var PaygPaymentStep = memo3(function PaygPaymentStep2({
|
|
|
3293
3348
|
const { displayMode } = useDisplayMode();
|
|
3294
3349
|
const isFullscreen = displayMode === "fullscreen";
|
|
3295
3350
|
const creditsAdded = creditsPerMinorUnit != null && creditsPerMinorUnit > 0 ? Math.floor(amountMinor / (displayExchangeRate ?? 1) * creditsPerMinorUnit) : null;
|
|
3296
|
-
return /* @__PURE__ */
|
|
3351
|
+
return /* @__PURE__ */ jsx23(
|
|
3297
3352
|
TopupForm.Root,
|
|
3298
3353
|
{
|
|
3299
3354
|
amount: amountMinor,
|
|
@@ -3301,17 +3356,17 @@ var PaygPaymentStep = memo3(function PaygPaymentStep2({
|
|
|
3301
3356
|
autoRecharge,
|
|
3302
3357
|
returnUrl,
|
|
3303
3358
|
onSuccess: (_intent, extras) => onSuccess(extras),
|
|
3304
|
-
children: /* @__PURE__ */
|
|
3305
|
-
/* @__PURE__ */
|
|
3306
|
-
/* @__PURE__ */
|
|
3307
|
-
/* @__PURE__ */
|
|
3308
|
-
creditsAdded != null ? /* @__PURE__ */
|
|
3359
|
+
children: /* @__PURE__ */ jsxs16(McpHostedLayout, { children: [
|
|
3360
|
+
/* @__PURE__ */ jsx23(McpSummaryRail, { children: /* @__PURE__ */ jsxs16("div", { className: "solvapay-mcp-checkout-order-summary", "data-variant": "payg", children: [
|
|
3361
|
+
/* @__PURE__ */ jsxs16("div", { className: "solvapay-mcp-checkout-order-summary-row", children: [
|
|
3362
|
+
/* @__PURE__ */ jsx23("span", { className: cx2.muted, children: creditsAdded != null ? `${creditsAdded.toLocaleString(locale)} credits` : formatPrice(amountMinor, currency, { locale }) }),
|
|
3363
|
+
creditsAdded != null ? /* @__PURE__ */ jsx23("span", { children: formatPrice(amountMinor, currency, { locale }) }) : null
|
|
3309
3364
|
] }),
|
|
3310
|
-
/* @__PURE__ */
|
|
3311
|
-
isFullscreen ? /* @__PURE__ */
|
|
3365
|
+
/* @__PURE__ */ jsx23("div", { className: "solvapay-mcp-checkout-order-summary-row", children: /* @__PURE__ */ jsx23("span", { className: cx2.muted, children: "One-time" }) }),
|
|
3366
|
+
isFullscreen ? /* @__PURE__ */ jsx23(TopupForm.Summary.Rows, { className: cx2.taxSummary }) : /* @__PURE__ */ jsx23(TopupForm.Summary.TaxNote, { className: cx2.muted })
|
|
3312
3367
|
] }) }),
|
|
3313
|
-
/* @__PURE__ */
|
|
3314
|
-
/* @__PURE__ */
|
|
3368
|
+
/* @__PURE__ */ jsxs16(McpHostedBody, { children: [
|
|
3369
|
+
/* @__PURE__ */ jsx23(
|
|
3315
3370
|
McpPaymentHeader,
|
|
3316
3371
|
{
|
|
3317
3372
|
backLabel: "Change amount",
|
|
@@ -3320,13 +3375,13 @@ var PaygPaymentStep = memo3(function PaygPaymentStep2({
|
|
|
3320
3375
|
headingClassName: cx2.heading
|
|
3321
3376
|
}
|
|
3322
3377
|
),
|
|
3323
|
-
/* @__PURE__ */
|
|
3324
|
-
/* @__PURE__ */
|
|
3325
|
-
/* @__PURE__ */
|
|
3326
|
-
/* @__PURE__ */
|
|
3327
|
-
/* @__PURE__ */
|
|
3328
|
-
/* @__PURE__ */
|
|
3329
|
-
/* @__PURE__ */
|
|
3378
|
+
/* @__PURE__ */ jsxs16("div", { className: cx2.topupForm, children: [
|
|
3379
|
+
/* @__PURE__ */ jsx23(TopupForm.Loading, {}),
|
|
3380
|
+
/* @__PURE__ */ jsx23(TopupForm.PaymentElement, { options: MCP_PAYMENT_ELEMENT_OPTIONS }),
|
|
3381
|
+
/* @__PURE__ */ jsx23(TopupForm.BusinessDetails.Root, { className: cx2.businessDetails, children: /* @__PURE__ */ jsx23(TopupForm.BusinessDetails.Fields, {}) }),
|
|
3382
|
+
/* @__PURE__ */ jsx23(TopupForm.Error, { className: cx2.error }),
|
|
3383
|
+
/* @__PURE__ */ jsx23(TopupForm.SubmitButton, { className: cx2.button, children: /* @__PURE__ */ jsx23(PaygChargeCta, { amountMinor, currency }) }),
|
|
3384
|
+
/* @__PURE__ */ jsx23(
|
|
3330
3385
|
MandateText,
|
|
3331
3386
|
{
|
|
3332
3387
|
mode: "topup",
|
|
@@ -3345,7 +3400,7 @@ function PaygChargeCta({ amountMinor, currency }) {
|
|
|
3345
3400
|
const locale = useHostLocale();
|
|
3346
3401
|
const { taxBreakdown } = useTopupForm();
|
|
3347
3402
|
const minor = chargeAmountMinor(taxBreakdown, amountMinor);
|
|
3348
|
-
return /* @__PURE__ */
|
|
3403
|
+
return /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
3349
3404
|
"Pay ",
|
|
3350
3405
|
formatPrice(minor, taxBreakdown?.currency ?? currency, { locale })
|
|
3351
3406
|
] });
|
|
@@ -3353,7 +3408,7 @@ function PaygChargeCta({ amountMinor, currency }) {
|
|
|
3353
3408
|
|
|
3354
3409
|
// src/mcp/views/checkout/steps/RecurringPaymentStep.tsx
|
|
3355
3410
|
import { memo as memo4 } from "react";
|
|
3356
|
-
import { Fragment as
|
|
3411
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3357
3412
|
var RecurringPaymentStep = memo4(function RecurringPaymentStep2({
|
|
3358
3413
|
plan,
|
|
3359
3414
|
planRef,
|
|
@@ -3377,7 +3432,7 @@ var RecurringPaymentStep = memo4(function RecurringPaymentStep2({
|
|
|
3377
3432
|
const planName = plan.name ?? "Plan";
|
|
3378
3433
|
const { displayMode } = useDisplayMode();
|
|
3379
3434
|
const isFullscreen = displayMode === "fullscreen";
|
|
3380
|
-
return /* @__PURE__ */
|
|
3435
|
+
return /* @__PURE__ */ jsx24(
|
|
3381
3436
|
PaymentForm.Root,
|
|
3382
3437
|
{
|
|
3383
3438
|
planRef,
|
|
@@ -3385,25 +3440,25 @@ var RecurringPaymentStep = memo4(function RecurringPaymentStep2({
|
|
|
3385
3440
|
returnUrl,
|
|
3386
3441
|
requireTermsAcceptance: false,
|
|
3387
3442
|
onSuccess,
|
|
3388
|
-
children: /* @__PURE__ */
|
|
3389
|
-
/* @__PURE__ */
|
|
3390
|
-
/* @__PURE__ */
|
|
3391
|
-
/* @__PURE__ */
|
|
3392
|
-
/* @__PURE__ */
|
|
3443
|
+
children: /* @__PURE__ */ jsxs17(McpHostedLayout, { children: [
|
|
3444
|
+
/* @__PURE__ */ jsx24(McpSummaryRail, { children: /* @__PURE__ */ jsxs17("div", { className: "solvapay-mcp-checkout-order-summary", "data-variant": "recurring", children: [
|
|
3445
|
+
/* @__PURE__ */ jsxs17("div", { className: "solvapay-mcp-checkout-order-summary-row", children: [
|
|
3446
|
+
/* @__PURE__ */ jsx24("span", { className: cx2.muted, children: planName }),
|
|
3447
|
+
/* @__PURE__ */ jsxs17("span", { children: [
|
|
3393
3448
|
formatPrice(amountMinor, currency, { locale }),
|
|
3394
3449
|
formatCycleSuffix(cycle)
|
|
3395
3450
|
] })
|
|
3396
3451
|
] }),
|
|
3397
|
-
included != null ? /* @__PURE__ */
|
|
3452
|
+
included != null ? /* @__PURE__ */ jsx24("div", { className: "solvapay-mcp-checkout-order-summary-row", children: /* @__PURE__ */ jsxs17("span", { className: cx2.muted, children: [
|
|
3398
3453
|
included.toLocaleString(locale),
|
|
3399
3454
|
" ",
|
|
3400
3455
|
meterName2,
|
|
3401
3456
|
" included"
|
|
3402
3457
|
] }) }) : null,
|
|
3403
|
-
isFullscreen ? /* @__PURE__ */
|
|
3458
|
+
isFullscreen ? /* @__PURE__ */ jsx24(PaymentForm.TaxSummary.Rows, { className: cx2.taxSummary }) : /* @__PURE__ */ jsx24(PaymentForm.TaxSummary.TaxNote, { className: cx2.muted })
|
|
3404
3459
|
] }) }),
|
|
3405
|
-
/* @__PURE__ */
|
|
3406
|
-
/* @__PURE__ */
|
|
3460
|
+
/* @__PURE__ */ jsxs17(McpHostedBody, { children: [
|
|
3461
|
+
/* @__PURE__ */ jsx24(
|
|
3407
3462
|
McpPaymentHeader,
|
|
3408
3463
|
{
|
|
3409
3464
|
backLabel: "Change plan",
|
|
@@ -3412,12 +3467,12 @@ var RecurringPaymentStep = memo4(function RecurringPaymentStep2({
|
|
|
3412
3467
|
headingClassName: cx2.heading
|
|
3413
3468
|
}
|
|
3414
3469
|
),
|
|
3415
|
-
/* @__PURE__ */
|
|
3416
|
-
/* @__PURE__ */
|
|
3417
|
-
/* @__PURE__ */
|
|
3418
|
-
/* @__PURE__ */
|
|
3419
|
-
/* @__PURE__ */
|
|
3420
|
-
/* @__PURE__ */
|
|
3470
|
+
/* @__PURE__ */ jsx24(PaymentForm.Loading, {}),
|
|
3471
|
+
/* @__PURE__ */ jsx24(PaymentForm.PaymentElement, {}),
|
|
3472
|
+
/* @__PURE__ */ jsx24(PaymentForm.BusinessDetails.Root, { className: cx2.businessDetails, children: /* @__PURE__ */ jsx24(PaymentForm.BusinessDetails.Fields, {}) }),
|
|
3473
|
+
/* @__PURE__ */ jsx24(PaymentForm.Error, { className: cx2.error }),
|
|
3474
|
+
/* @__PURE__ */ jsx24(PaymentForm.SubmitButton, { className: cx2.button, children: /* @__PURE__ */ jsx24(RecurringChargeCta, { amountMinor, currency, cycle }) }),
|
|
3475
|
+
/* @__PURE__ */ jsx24(PaymentForm.MandateText, { savesPaymentMethod: true })
|
|
3421
3476
|
] })
|
|
3422
3477
|
] })
|
|
3423
3478
|
}
|
|
@@ -3431,7 +3486,7 @@ function RecurringChargeCta({
|
|
|
3431
3486
|
const locale = useHostLocale();
|
|
3432
3487
|
const { taxBreakdown } = usePaymentForm();
|
|
3433
3488
|
const minor = chargeAmountMinor(taxBreakdown, amountMinor);
|
|
3434
|
-
return /* @__PURE__ */
|
|
3489
|
+
return /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
3435
3490
|
"Subscribe \u2014 ",
|
|
3436
3491
|
formatPrice(minor, taxBreakdown?.currency ?? currency, { locale }),
|
|
3437
3492
|
formatCycleSuffix(cycle)
|
|
@@ -3440,81 +3495,81 @@ function RecurringChargeCta({
|
|
|
3440
3495
|
|
|
3441
3496
|
// src/mcp/views/checkout/steps/SuccessStep.tsx
|
|
3442
3497
|
import { memo as memo5 } from "react";
|
|
3443
|
-
import { Fragment as
|
|
3498
|
+
import { Fragment as Fragment11, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3444
3499
|
var SuccessStep = memo5(function SuccessStep2({ meta, cx: cx2 }) {
|
|
3445
3500
|
const locale = useHostLocale();
|
|
3446
3501
|
if (meta.branch === "payg") {
|
|
3447
3502
|
const chargedAmount = meta.amountMinor;
|
|
3448
3503
|
const chargedCurrency = meta.currency;
|
|
3449
3504
|
const charged = chargedAmount != null && chargedCurrency != null;
|
|
3450
|
-
return /* @__PURE__ */
|
|
3451
|
-
/* @__PURE__ */
|
|
3452
|
-
/* @__PURE__ */
|
|
3453
|
-
/* @__PURE__ */
|
|
3454
|
-
/* @__PURE__ */
|
|
3455
|
-
charged ? /* @__PURE__ */
|
|
3456
|
-
/* @__PURE__ */
|
|
3457
|
-
/* @__PURE__ */
|
|
3458
|
-
/* @__PURE__ */
|
|
3505
|
+
return /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
3506
|
+
/* @__PURE__ */ jsx25("div", { className: "solvapay-mcp-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
|
|
3507
|
+
/* @__PURE__ */ jsx25("h2", { className: cx2.heading, children: charged ? "Credits added" : "Plan activated" }),
|
|
3508
|
+
/* @__PURE__ */ jsx25("p", { className: cx2.muted, children: "Pay as you go plan is active." }),
|
|
3509
|
+
/* @__PURE__ */ jsxs18("dl", { className: "solvapay-mcp-checkout-receipt", "data-variant": "payg", children: [
|
|
3510
|
+
charged ? /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
3511
|
+
/* @__PURE__ */ jsxs18("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
|
|
3512
|
+
/* @__PURE__ */ jsx25("dt", { children: "Amount" }),
|
|
3513
|
+
/* @__PURE__ */ jsx25("dd", { children: formatPrice(chargedAmount, chargedCurrency, { locale }) })
|
|
3459
3514
|
] }),
|
|
3460
|
-
/* @__PURE__ */
|
|
3461
|
-
/* @__PURE__ */
|
|
3462
|
-
/* @__PURE__ */
|
|
3515
|
+
/* @__PURE__ */ jsxs18("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
|
|
3516
|
+
/* @__PURE__ */ jsx25("dt", { children: "Credits" }),
|
|
3517
|
+
/* @__PURE__ */ jsxs18("dd", { children: [
|
|
3463
3518
|
"+",
|
|
3464
3519
|
(meta.creditsAdded ?? 0).toLocaleString(locale)
|
|
3465
3520
|
] })
|
|
3466
3521
|
] })
|
|
3467
3522
|
] }) : null,
|
|
3468
|
-
/* @__PURE__ */
|
|
3469
|
-
/* @__PURE__ */
|
|
3470
|
-
/* @__PURE__ */
|
|
3523
|
+
/* @__PURE__ */ jsxs18("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
|
|
3524
|
+
/* @__PURE__ */ jsx25("dt", { children: "Plan" }),
|
|
3525
|
+
/* @__PURE__ */ jsx25("dd", { children: meta.plan.name ?? "Pay as you go" })
|
|
3471
3526
|
] }),
|
|
3472
|
-
meta.rateLabel ? /* @__PURE__ */
|
|
3473
|
-
/* @__PURE__ */
|
|
3474
|
-
/* @__PURE__ */
|
|
3527
|
+
meta.rateLabel ? /* @__PURE__ */ jsxs18("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
|
|
3528
|
+
/* @__PURE__ */ jsx25("dt", { children: "Rate" }),
|
|
3529
|
+
/* @__PURE__ */ jsx25("dd", { children: meta.rateLabel })
|
|
3475
3530
|
] }) : null
|
|
3476
3531
|
] })
|
|
3477
3532
|
] });
|
|
3478
3533
|
}
|
|
3479
|
-
return /* @__PURE__ */
|
|
3480
|
-
/* @__PURE__ */
|
|
3481
|
-
/* @__PURE__ */
|
|
3534
|
+
return /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
3535
|
+
/* @__PURE__ */ jsx25("div", { className: "solvapay-mcp-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
|
|
3536
|
+
/* @__PURE__ */ jsxs18("h2", { className: cx2.heading, children: [
|
|
3482
3537
|
meta.plan.name ?? "Plan",
|
|
3483
3538
|
" active"
|
|
3484
3539
|
] }),
|
|
3485
|
-
/* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */
|
|
3487
|
-
/* @__PURE__ */
|
|
3488
|
-
/* @__PURE__ */
|
|
3489
|
-
/* @__PURE__ */
|
|
3540
|
+
/* @__PURE__ */ jsx25("p", { className: cx2.muted, children: "Subscription is live and credits are ready." }),
|
|
3541
|
+
/* @__PURE__ */ jsxs18("dl", { className: "solvapay-mcp-checkout-receipt", "data-variant": "recurring", children: [
|
|
3542
|
+
/* @__PURE__ */ jsxs18("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
|
|
3543
|
+
/* @__PURE__ */ jsx25("dt", { children: "Plan" }),
|
|
3544
|
+
/* @__PURE__ */ jsx25("dd", { children: meta.plan.name ?? "Plan" })
|
|
3490
3545
|
] }),
|
|
3491
|
-
meta.includedUnits != null ? /* @__PURE__ */
|
|
3492
|
-
/* @__PURE__ */
|
|
3493
|
-
/* @__PURE__ */
|
|
3546
|
+
meta.includedUnits != null ? /* @__PURE__ */ jsxs18("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
|
|
3547
|
+
/* @__PURE__ */ jsx25("dt", { children: "Included" }),
|
|
3548
|
+
/* @__PURE__ */ jsxs18("dd", { children: [
|
|
3494
3549
|
meta.includedUnits.toLocaleString(locale),
|
|
3495
3550
|
" ",
|
|
3496
3551
|
meta.meterName ?? "units"
|
|
3497
3552
|
] })
|
|
3498
3553
|
] }) : null,
|
|
3499
|
-
/* @__PURE__ */
|
|
3500
|
-
/* @__PURE__ */
|
|
3501
|
-
/* @__PURE__ */
|
|
3554
|
+
/* @__PURE__ */ jsxs18("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
|
|
3555
|
+
/* @__PURE__ */ jsx25("dt", { children: "Charged today" }),
|
|
3556
|
+
/* @__PURE__ */ jsx25("dd", { children: formatPrice(meta.chargedTodayMinor, meta.currency, { locale }) })
|
|
3502
3557
|
] }),
|
|
3503
|
-
meta.nextRenewalLabel ? /* @__PURE__ */
|
|
3504
|
-
/* @__PURE__ */
|
|
3505
|
-
/* @__PURE__ */
|
|
3558
|
+
meta.nextRenewalLabel ? /* @__PURE__ */ jsxs18("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
|
|
3559
|
+
/* @__PURE__ */ jsx25("dt", { children: "Next renewal" }),
|
|
3560
|
+
/* @__PURE__ */ jsx25("dd", { children: meta.nextRenewalLabel })
|
|
3506
3561
|
] }) : null
|
|
3507
3562
|
] }),
|
|
3508
|
-
/* @__PURE__ */
|
|
3563
|
+
/* @__PURE__ */ jsxs18("p", { className: `${cx2.muted} solvapay-mcp-checkout-manage-pointer`.trim(), children: [
|
|
3509
3564
|
"Manage from ",
|
|
3510
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsx25("code", { children: "/manage_account" })
|
|
3511
3566
|
] })
|
|
3512
3567
|
] });
|
|
3513
3568
|
});
|
|
3514
3569
|
|
|
3515
3570
|
// src/mcp/views/checkout/HostedCheckout.tsx
|
|
3516
3571
|
import React10, { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4, useState as useState7 } from "react";
|
|
3517
|
-
import { Fragment as
|
|
3572
|
+
import { Fragment as Fragment12, jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3518
3573
|
var POLL_INTERVAL_MS = 3e3;
|
|
3519
3574
|
var AWAITING_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
3520
3575
|
function useHostedUrl(enabled, fetcher, label) {
|
|
@@ -3549,7 +3604,7 @@ var HostedLinkButton = React10.memo(function HostedLinkButton2({
|
|
|
3549
3604
|
}) {
|
|
3550
3605
|
const handleExternalClick = useExternalLinkClick();
|
|
3551
3606
|
if (state.status === "ready") {
|
|
3552
|
-
return /* @__PURE__ */
|
|
3607
|
+
return /* @__PURE__ */ jsx26(
|
|
3553
3608
|
"a",
|
|
3554
3609
|
{
|
|
3555
3610
|
className: "solvapay-mcp-hosted-link",
|
|
@@ -3561,17 +3616,17 @@ var HostedLinkButton = React10.memo(function HostedLinkButton2({
|
|
|
3561
3616
|
onLaunch?.(state.href);
|
|
3562
3617
|
handleExternalClick(event);
|
|
3563
3618
|
},
|
|
3564
|
-
children: /* @__PURE__ */
|
|
3619
|
+
children: /* @__PURE__ */ jsxs19("button", { type: "button", className: cx2.button, children: [
|
|
3565
3620
|
readyLabel,
|
|
3566
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsx26(ExternalLinkGlyph, {})
|
|
3567
3622
|
] })
|
|
3568
3623
|
}
|
|
3569
3624
|
);
|
|
3570
3625
|
}
|
|
3571
|
-
return /* @__PURE__ */
|
|
3626
|
+
return /* @__PURE__ */ jsx26("button", { type: "button", className: cx2.button, disabled: true, children: state.status === "error" ? "Unavailable" : loadingLabel });
|
|
3572
3627
|
});
|
|
3573
3628
|
function Spinner() {
|
|
3574
|
-
return /* @__PURE__ */
|
|
3629
|
+
return /* @__PURE__ */ jsx26("span", { className: "solvapay-mcp-spinner", "aria-hidden": "true" });
|
|
3575
3630
|
}
|
|
3576
3631
|
var AwaitingBody = React10.memo(function AwaitingBody2({
|
|
3577
3632
|
href,
|
|
@@ -3581,13 +3636,13 @@ var AwaitingBody = React10.memo(function AwaitingBody2({
|
|
|
3581
3636
|
cx: cx2
|
|
3582
3637
|
}) {
|
|
3583
3638
|
const handleExternalClick = useExternalLinkClick();
|
|
3584
|
-
return /* @__PURE__ */
|
|
3585
|
-
/* @__PURE__ */
|
|
3586
|
-
/* @__PURE__ */
|
|
3587
|
-
/* @__PURE__ */
|
|
3639
|
+
return /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
3640
|
+
/* @__PURE__ */ jsxs19("div", { className: cx2.awaitingHeader, children: [
|
|
3641
|
+
/* @__PURE__ */ jsx26(Spinner, {}),
|
|
3642
|
+
/* @__PURE__ */ jsx26("h2", { className: cx2.heading, children: timedOut ? "Still waiting for payment" : "Waiting for payment\u2026" })
|
|
3588
3643
|
] }),
|
|
3589
|
-
/* @__PURE__ */
|
|
3590
|
-
/* @__PURE__ */
|
|
3644
|
+
/* @__PURE__ */ jsx26("p", { className: cx2.muted, children: timedOut ? "We haven't seen your purchase yet. If you completed payment, give it another moment \u2014 otherwise reopen checkout or cancel." : "Complete payment in the other tab. Your purchase will show up here automatically." }),
|
|
3645
|
+
/* @__PURE__ */ jsx26(
|
|
3591
3646
|
"a",
|
|
3592
3647
|
{
|
|
3593
3648
|
className: "solvapay-mcp-hosted-link",
|
|
@@ -3599,13 +3654,13 @@ var AwaitingBody = React10.memo(function AwaitingBody2({
|
|
|
3599
3654
|
onReopen();
|
|
3600
3655
|
handleExternalClick(event);
|
|
3601
3656
|
},
|
|
3602
|
-
children: /* @__PURE__ */
|
|
3657
|
+
children: /* @__PURE__ */ jsxs19("button", { type: "button", className: cx2.button, children: [
|
|
3603
3658
|
"Reopen checkout",
|
|
3604
|
-
/* @__PURE__ */
|
|
3659
|
+
/* @__PURE__ */ jsx26(ExternalLinkGlyph, {})
|
|
3605
3660
|
] })
|
|
3606
3661
|
}
|
|
3607
3662
|
),
|
|
3608
|
-
/* @__PURE__ */
|
|
3663
|
+
/* @__PURE__ */ jsx26("button", { type: "button", className: cx2.linkButton, onClick: onCancel, children: "Didn't complete? Cancel" })
|
|
3609
3664
|
] });
|
|
3610
3665
|
});
|
|
3611
3666
|
var CancelledBody = React10.memo(function CancelledBody2({
|
|
@@ -3617,25 +3672,25 @@ var CancelledBody = React10.memo(function CancelledBody2({
|
|
|
3617
3672
|
onLaunch,
|
|
3618
3673
|
cx: cx2
|
|
3619
3674
|
}) {
|
|
3620
|
-
return /* @__PURE__ */
|
|
3621
|
-
/* @__PURE__ */
|
|
3675
|
+
return /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
3676
|
+
/* @__PURE__ */ jsxs19("h2", { className: cx2.heading, children: [
|
|
3622
3677
|
"Your ",
|
|
3623
3678
|
productName,
|
|
3624
3679
|
" purchase is cancelled"
|
|
3625
3680
|
] }),
|
|
3626
|
-
endDate && formattedEndDate ? /* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */
|
|
3681
|
+
endDate && formattedEndDate ? /* @__PURE__ */ jsxs19("div", { className: cx2.notice, children: [
|
|
3682
|
+
/* @__PURE__ */ jsx26("p", { children: /* @__PURE__ */ jsxs19("strong", { children: [
|
|
3628
3683
|
"Access expires ",
|
|
3629
3684
|
formattedEndDate
|
|
3630
3685
|
] }) }),
|
|
3631
|
-
daysLeft !== null && daysLeft > 0 && /* @__PURE__ */
|
|
3686
|
+
daysLeft !== null && daysLeft > 0 && /* @__PURE__ */ jsxs19("p", { className: cx2.muted, children: [
|
|
3632
3687
|
daysLeft,
|
|
3633
3688
|
" ",
|
|
3634
3689
|
daysLeft === 1 ? "day" : "days",
|
|
3635
3690
|
" remaining"
|
|
3636
3691
|
] })
|
|
3637
|
-
] }) : /* @__PURE__ */
|
|
3638
|
-
/* @__PURE__ */
|
|
3692
|
+
] }) : /* @__PURE__ */ jsx26("p", { className: cx2.muted, children: "Your purchase access has ended." }),
|
|
3693
|
+
/* @__PURE__ */ jsx26(
|
|
3639
3694
|
HostedLinkButton,
|
|
3640
3695
|
{
|
|
3641
3696
|
state: checkout,
|
|
@@ -3645,7 +3700,7 @@ var CancelledBody = React10.memo(function CancelledBody2({
|
|
|
3645
3700
|
cx: cx2
|
|
3646
3701
|
}
|
|
3647
3702
|
),
|
|
3648
|
-
checkout.status === "error" && /* @__PURE__ */
|
|
3703
|
+
checkout.status === "error" && /* @__PURE__ */ jsx26("p", { className: cx2.error, role: "alert", children: checkout.message })
|
|
3649
3704
|
] });
|
|
3650
3705
|
});
|
|
3651
3706
|
var UpgradeBody = React10.memo(function UpgradeBody2({
|
|
@@ -3656,11 +3711,11 @@ var UpgradeBody = React10.memo(function UpgradeBody2({
|
|
|
3656
3711
|
backLabel,
|
|
3657
3712
|
cx: cx2
|
|
3658
3713
|
}) {
|
|
3659
|
-
return /* @__PURE__ */
|
|
3660
|
-
onBack ? /* @__PURE__ */
|
|
3661
|
-
/* @__PURE__ */
|
|
3662
|
-
/* @__PURE__ */
|
|
3663
|
-
/* @__PURE__ */
|
|
3714
|
+
return /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
3715
|
+
onBack ? /* @__PURE__ */ jsx26(BackLink, { label: backLabel, onClick: onBack }) : null,
|
|
3716
|
+
/* @__PURE__ */ jsx26("h2", { className: cx2.heading, children: planName ? `Complete your ${planName} purchase` : "Upgrade your plan" }),
|
|
3717
|
+
/* @__PURE__ */ jsx26("p", { className: cx2.muted, children: "This host doesn't allow embedded payments. Open the SolvaPay checkout in a new tab to complete your purchase there. Return here after payment and your purchase will show up automatically." }),
|
|
3718
|
+
/* @__PURE__ */ jsx26(
|
|
3664
3719
|
HostedLinkButton,
|
|
3665
3720
|
{
|
|
3666
3721
|
state: checkout,
|
|
@@ -3670,7 +3725,7 @@ var UpgradeBody = React10.memo(function UpgradeBody2({
|
|
|
3670
3725
|
cx: cx2
|
|
3671
3726
|
}
|
|
3672
3727
|
),
|
|
3673
|
-
checkout.status === "error" && /* @__PURE__ */
|
|
3728
|
+
checkout.status === "error" && /* @__PURE__ */ jsx26("p", { className: cx2.error, role: "alert", children: checkout.message })
|
|
3674
3729
|
] });
|
|
3675
3730
|
});
|
|
3676
3731
|
function HostedCheckout({
|
|
@@ -3683,7 +3738,7 @@ function HostedCheckout({
|
|
|
3683
3738
|
cx: cx2,
|
|
3684
3739
|
children
|
|
3685
3740
|
}) {
|
|
3686
|
-
const { loading,
|
|
3741
|
+
const { loading, refetch, hasPaidPurchase, activePurchase } = usePurchase();
|
|
3687
3742
|
const { cancelledPurchase, shouldShowCancelledNotice, formatDate, getDaysUntilExpiration } = usePurchaseStatus();
|
|
3688
3743
|
const transport = useTransport();
|
|
3689
3744
|
const [awaiting, setAwaiting] = useState7(null);
|
|
@@ -3778,7 +3833,7 @@ function HostedCheckout({
|
|
|
3778
3833
|
const awaitingHref = awaiting?.href ?? null;
|
|
3779
3834
|
const inner = useMemo3(() => {
|
|
3780
3835
|
if (awaiting && awaitingHref) {
|
|
3781
|
-
return /* @__PURE__ */
|
|
3836
|
+
return /* @__PURE__ */ jsx26(
|
|
3782
3837
|
AwaitingBody,
|
|
3783
3838
|
{
|
|
3784
3839
|
href: awaitingHref,
|
|
@@ -3790,7 +3845,7 @@ function HostedCheckout({
|
|
|
3790
3845
|
);
|
|
3791
3846
|
}
|
|
3792
3847
|
if (shouldShowCancelledNotice && cancelledProductName) {
|
|
3793
|
-
return /* @__PURE__ */
|
|
3848
|
+
return /* @__PURE__ */ jsx26(
|
|
3794
3849
|
CancelledBody,
|
|
3795
3850
|
{
|
|
3796
3851
|
productName: cancelledProductName,
|
|
@@ -3803,7 +3858,7 @@ function HostedCheckout({
|
|
|
3803
3858
|
}
|
|
3804
3859
|
);
|
|
3805
3860
|
}
|
|
3806
|
-
return /* @__PURE__ */
|
|
3861
|
+
return /* @__PURE__ */ jsx26(
|
|
3807
3862
|
UpgradeBody,
|
|
3808
3863
|
{
|
|
3809
3864
|
planName,
|
|
@@ -3833,16 +3888,16 @@ function HostedCheckout({
|
|
|
3833
3888
|
cx2
|
|
3834
3889
|
]);
|
|
3835
3890
|
if (loading) {
|
|
3836
|
-
return /* @__PURE__ */
|
|
3891
|
+
return /* @__PURE__ */ jsx26("p", { children: "Loading purchase\u2026" });
|
|
3837
3892
|
}
|
|
3838
|
-
return /* @__PURE__ */
|
|
3893
|
+
return /* @__PURE__ */ jsxs19("div", { className: cx2.stack, children: [
|
|
3839
3894
|
inner,
|
|
3840
3895
|
children
|
|
3841
3896
|
] });
|
|
3842
3897
|
}
|
|
3843
3898
|
|
|
3844
3899
|
// src/mcp/views/checkout/EmbeddedCheckout.tsx
|
|
3845
|
-
import { jsx as
|
|
3900
|
+
import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3846
3901
|
function EmbeddedCheckout({
|
|
3847
3902
|
productRef,
|
|
3848
3903
|
returnUrl,
|
|
@@ -3874,10 +3929,10 @@ function EmbeddedCheckout({
|
|
|
3874
3929
|
[currentPlanRef]
|
|
3875
3930
|
);
|
|
3876
3931
|
if (loading) {
|
|
3877
|
-
return /* @__PURE__ */
|
|
3932
|
+
return /* @__PURE__ */ jsx27("div", { className: cx2.card, children: /* @__PURE__ */ jsx27("p", { children: "Loading checkout\u2026" }) });
|
|
3878
3933
|
}
|
|
3879
|
-
return /* @__PURE__ */
|
|
3880
|
-
/* @__PURE__ */
|
|
3934
|
+
return /* @__PURE__ */ jsxs20("div", { className: cx2.card, "data-refreshing": isRefetching ? "true" : void 0, children: [
|
|
3935
|
+
/* @__PURE__ */ jsx27(
|
|
3881
3936
|
PlanSelector.Root,
|
|
3882
3937
|
{
|
|
3883
3938
|
productRef,
|
|
@@ -3888,7 +3943,7 @@ function EmbeddedCheckout({
|
|
|
3888
3943
|
autoSelectFirstPaid: Boolean(paygPlanRef),
|
|
3889
3944
|
initialPlanRef,
|
|
3890
3945
|
className: "solvapay-plan-selector",
|
|
3891
|
-
children: /* @__PURE__ */
|
|
3946
|
+
children: /* @__PURE__ */ jsx27(
|
|
3892
3947
|
McpCheckoutBody,
|
|
3893
3948
|
{
|
|
3894
3949
|
productRef,
|
|
@@ -3983,9 +4038,9 @@ function McpCheckoutBody({
|
|
|
3983
4038
|
const waitingForSelection = Boolean(autoAdvance) && !flow.selectedPlanRef;
|
|
3984
4039
|
const matchingPending = Boolean(autoAdvance) && flow.selectedPlanRef === initialPlanRef && flow.status === "activating";
|
|
3985
4040
|
if (waitingForSelection || matchingPending) {
|
|
3986
|
-
return /* @__PURE__ */
|
|
4041
|
+
return /* @__PURE__ */ jsx27("p", { children: "Loading checkout\u2026" });
|
|
3987
4042
|
}
|
|
3988
|
-
return /* @__PURE__ */
|
|
4043
|
+
return /* @__PURE__ */ jsx27(
|
|
3989
4044
|
PlanStep,
|
|
3990
4045
|
{
|
|
3991
4046
|
fromPaywall,
|
|
@@ -4004,7 +4059,7 @@ function McpCheckoutBody({
|
|
|
4004
4059
|
if (!selectedPlanShape) {
|
|
4005
4060
|
return null;
|
|
4006
4061
|
}
|
|
4007
|
-
return /* @__PURE__ */
|
|
4062
|
+
return /* @__PURE__ */ jsx27(
|
|
4008
4063
|
AmountStep,
|
|
4009
4064
|
{
|
|
4010
4065
|
plan: selectedPlanShape,
|
|
@@ -4026,11 +4081,11 @@ function McpCheckoutBody({
|
|
|
4026
4081
|
}
|
|
4027
4082
|
if (flow.step === "payment") {
|
|
4028
4083
|
if (stripeProbe === "loading") {
|
|
4029
|
-
return /* @__PURE__ */
|
|
4084
|
+
return /* @__PURE__ */ jsx27("p", { children: "Loading checkout\u2026" });
|
|
4030
4085
|
}
|
|
4031
4086
|
if (stripeProbe === "blocked") {
|
|
4032
4087
|
const hostedBackLabel = flow.branch === "payg" ? "Change amount" : "Change plan";
|
|
4033
|
-
return /* @__PURE__ */
|
|
4088
|
+
return /* @__PURE__ */ jsx27(
|
|
4034
4089
|
HostedCheckout,
|
|
4035
4090
|
{
|
|
4036
4091
|
productRef,
|
|
@@ -4044,7 +4099,7 @@ function McpCheckoutBody({
|
|
|
4044
4099
|
);
|
|
4045
4100
|
}
|
|
4046
4101
|
if (flow.branch === "payg" && selectedPlanShape && flow.selectedAmountMinor != null) {
|
|
4047
|
-
return /* @__PURE__ */
|
|
4102
|
+
return /* @__PURE__ */ jsx27(
|
|
4048
4103
|
PaygPaymentStep,
|
|
4049
4104
|
{
|
|
4050
4105
|
plan: selectedPlanShape,
|
|
@@ -4059,7 +4114,7 @@ function McpCheckoutBody({
|
|
|
4059
4114
|
);
|
|
4060
4115
|
}
|
|
4061
4116
|
if (flow.branch === "recurring" && selectedPlanShape && flow.selectedPlanRef) {
|
|
4062
|
-
return /* @__PURE__ */
|
|
4117
|
+
return /* @__PURE__ */ jsx27(
|
|
4063
4118
|
RecurringPaymentStep,
|
|
4064
4119
|
{
|
|
4065
4120
|
plan: selectedPlanShape,
|
|
@@ -4075,13 +4130,13 @@ function McpCheckoutBody({
|
|
|
4075
4130
|
return null;
|
|
4076
4131
|
}
|
|
4077
4132
|
if (flow.step === "success" && flow.successMeta) {
|
|
4078
|
-
return /* @__PURE__ */
|
|
4133
|
+
return /* @__PURE__ */ jsx27(SuccessStep, { meta: flow.successMeta, cx: cx2 });
|
|
4079
4134
|
}
|
|
4080
4135
|
return null;
|
|
4081
4136
|
}
|
|
4082
4137
|
|
|
4083
4138
|
// src/mcp/views/McpCheckoutView.tsx
|
|
4084
|
-
import { jsx as
|
|
4139
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4085
4140
|
function McpCheckoutView({
|
|
4086
4141
|
productRef,
|
|
4087
4142
|
publishableKey = null,
|
|
@@ -4100,7 +4155,7 @@ function McpCheckoutView({
|
|
|
4100
4155
|
}) {
|
|
4101
4156
|
const cx2 = resolveMcpClassNames(classNames);
|
|
4102
4157
|
const probe = useStripeProbe(publishableKey);
|
|
4103
|
-
return /* @__PURE__ */
|
|
4158
|
+
return /* @__PURE__ */ jsx28(
|
|
4104
4159
|
EmbeddedCheckout,
|
|
4105
4160
|
{
|
|
4106
4161
|
productRef,
|
|
@@ -4123,23 +4178,7 @@ function McpCheckoutView({
|
|
|
4123
4178
|
|
|
4124
4179
|
// src/mcp/views/McpTopupView.tsx
|
|
4125
4180
|
import { useRef as useRef6, useState as useState9 } from "react";
|
|
4126
|
-
|
|
4127
|
-
// src/mcp/format-compact-credits.ts
|
|
4128
|
-
function formatCompactCredits(credits, locale = "en-US") {
|
|
4129
|
-
if (!Number.isFinite(credits) || credits < 0) {
|
|
4130
|
-
throw new Error(`formatCompactCredits: credits must be a finite non-negative number, got ${credits}`);
|
|
4131
|
-
}
|
|
4132
|
-
if (credits >= 1e6 && credits % 1e6 === 0) {
|
|
4133
|
-
return `${credits / 1e6}M credits`;
|
|
4134
|
-
}
|
|
4135
|
-
if (credits >= 1e3 && credits % 1e3 === 0) {
|
|
4136
|
-
return `${credits / 1e3}K credits`;
|
|
4137
|
-
}
|
|
4138
|
-
return `${credits.toLocaleString(locale)} credits`;
|
|
4139
|
-
}
|
|
4140
|
-
|
|
4141
|
-
// src/mcp/views/McpTopupView.tsx
|
|
4142
|
-
import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4181
|
+
import { Fragment as Fragment13, jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4143
4182
|
var FALLBACK_TOPUP_CURRENCY = "USD";
|
|
4144
4183
|
function resolveDefaultCurrency(merchant) {
|
|
4145
4184
|
if (merchant?.defaultCurrency) {
|
|
@@ -4147,14 +4186,6 @@ function resolveDefaultCurrency(merchant) {
|
|
|
4147
4186
|
}
|
|
4148
4187
|
return FALLBACK_TOPUP_CURRENCY;
|
|
4149
4188
|
}
|
|
4150
|
-
function estimateTopupCredits(amountMinor, payCurrency, displayCurrency, creditsPerMinorUnit, displayExchangeRate) {
|
|
4151
|
-
const rateAppliesToCurrency = displayCurrency != null && payCurrency.toUpperCase() === displayCurrency.toUpperCase();
|
|
4152
|
-
if (!rateAppliesToCurrency || creditsPerMinorUnit == null || creditsPerMinorUnit <= 0 || displayExchangeRate == null || displayExchangeRate <= 0) {
|
|
4153
|
-
return { kind: "unavailable" };
|
|
4154
|
-
}
|
|
4155
|
-
const credits = Math.floor(amountMinor / displayExchangeRate * creditsPerMinorUnit);
|
|
4156
|
-
return { kind: "available", credits };
|
|
4157
|
-
}
|
|
4158
4189
|
function McpTopupView({
|
|
4159
4190
|
publishableKey = null,
|
|
4160
4191
|
returnUrl,
|
|
@@ -4166,14 +4197,14 @@ function McpTopupView({
|
|
|
4166
4197
|
const probe = useStripeProbe(publishableKey);
|
|
4167
4198
|
const { merchant, loading: merchantLoading } = useMerchant();
|
|
4168
4199
|
if (merchantLoading) {
|
|
4169
|
-
return /* @__PURE__ */
|
|
4200
|
+
return /* @__PURE__ */ jsx29("section", { className: cx2.card, "aria-label": "Loading top-up", children: /* @__PURE__ */ jsx29("p", { children: "Loading top-up\u2026" }) });
|
|
4170
4201
|
}
|
|
4171
4202
|
const defaultCurrency = resolveDefaultCurrency(merchant ?? void 0);
|
|
4172
4203
|
const fromMerchant = (merchant?.supportedTopupCurrencies ?? []).map((code) => code.toUpperCase()).filter(Boolean);
|
|
4173
4204
|
const topupCurrencies = Array.from(
|
|
4174
4205
|
new Set(fromMerchant.length > 0 ? fromMerchant : [defaultCurrency])
|
|
4175
4206
|
);
|
|
4176
|
-
return /* @__PURE__ */
|
|
4207
|
+
return /* @__PURE__ */ jsx29(
|
|
4177
4208
|
EmbeddedTopup,
|
|
4178
4209
|
{
|
|
4179
4210
|
returnUrl,
|
|
@@ -4219,17 +4250,17 @@ function EmbeddedTopup({
|
|
|
4219
4250
|
creditsPerMinorUnit,
|
|
4220
4251
|
displayExchangeRate
|
|
4221
4252
|
);
|
|
4222
|
-
return /* @__PURE__ */
|
|
4223
|
-
/* @__PURE__ */
|
|
4224
|
-
/* @__PURE__ */
|
|
4225
|
-
/* @__PURE__ */
|
|
4226
|
-
/* @__PURE__ */
|
|
4227
|
-
/* @__PURE__ */
|
|
4228
|
-
/* @__PURE__ */
|
|
4253
|
+
return /* @__PURE__ */ jsxs21("section", { className: cx2.card, "aria-label": "Top-up success", children: [
|
|
4254
|
+
/* @__PURE__ */ jsx29("div", { className: "solvapay-mcp-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
|
|
4255
|
+
/* @__PURE__ */ jsx29("h2", { className: cx2.heading, children: "Credits added" }),
|
|
4256
|
+
/* @__PURE__ */ jsxs21("dl", { className: "solvapay-mcp-checkout-receipt", "data-variant": "payg", children: [
|
|
4257
|
+
/* @__PURE__ */ jsxs21("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
|
|
4258
|
+
/* @__PURE__ */ jsx29("dt", { children: "Amount" }),
|
|
4259
|
+
/* @__PURE__ */ jsx29("dd", { children: formatPrice(screen.amountMinor, currency, { locale, free: "" }) })
|
|
4229
4260
|
] }),
|
|
4230
|
-
estimate.kind === "available" ? /* @__PURE__ */
|
|
4231
|
-
/* @__PURE__ */
|
|
4232
|
-
/* @__PURE__ */
|
|
4261
|
+
estimate.kind === "available" ? /* @__PURE__ */ jsxs21("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
|
|
4262
|
+
/* @__PURE__ */ jsx29("dt", { children: "Credits" }),
|
|
4263
|
+
/* @__PURE__ */ jsxs21("dd", { children: [
|
|
4233
4264
|
"+",
|
|
4234
4265
|
estimate.credits.toLocaleString(locale)
|
|
4235
4266
|
] })
|
|
@@ -4239,10 +4270,10 @@ function EmbeddedTopup({
|
|
|
4239
4270
|
}
|
|
4240
4271
|
if (screen.step === "payment") {
|
|
4241
4272
|
if (stripeProbe === "loading") {
|
|
4242
|
-
return /* @__PURE__ */
|
|
4273
|
+
return /* @__PURE__ */ jsx29("section", { className: cx2.card, "aria-label": "Loading top-up", children: /* @__PURE__ */ jsx29("p", { children: "Loading top-up\u2026" }) });
|
|
4243
4274
|
}
|
|
4244
4275
|
if (stripeProbe === "blocked") {
|
|
4245
|
-
return /* @__PURE__ */
|
|
4276
|
+
return /* @__PURE__ */ jsx29(HostedTopupFallback, { cx: cx2, onChangeAmount: () => setScreen({ step: "amount" }) });
|
|
4246
4277
|
}
|
|
4247
4278
|
const committedAmountMinor = screen.amountMinor;
|
|
4248
4279
|
const savesCard = screen.autoRecharge != null;
|
|
@@ -4258,7 +4289,7 @@ function EmbeddedTopup({
|
|
|
4258
4289
|
creditEstimate.kind === "available" ? `Adds ${creditEstimate.credits.toLocaleString(locale)} credits` : void 0,
|
|
4259
4290
|
formattedBalance ? `Balance ${formattedBalance} credits` : void 0
|
|
4260
4291
|
].filter((part) => part != null);
|
|
4261
|
-
return /* @__PURE__ */
|
|
4292
|
+
return /* @__PURE__ */ jsx29("section", { className: cx2.card, "aria-label": "Top-up payment", children: /* @__PURE__ */ jsx29(
|
|
4262
4293
|
TopupForm.Root,
|
|
4263
4294
|
{
|
|
4264
4295
|
amount: committedAmountMinor,
|
|
@@ -4283,32 +4314,32 @@ function EmbeddedTopup({
|
|
|
4283
4314
|
});
|
|
4284
4315
|
onTopupSuccess?.(committedAmountMinor);
|
|
4285
4316
|
},
|
|
4286
|
-
children: /* @__PURE__ */
|
|
4287
|
-
/* @__PURE__ */
|
|
4288
|
-
/* @__PURE__ */
|
|
4289
|
-
/* @__PURE__ */
|
|
4290
|
-
contextParts.length > 0 ? /* @__PURE__ */
|
|
4291
|
-
isFullscreen ? /* @__PURE__ */
|
|
4317
|
+
children: /* @__PURE__ */ jsxs21(McpHostedLayout, { children: [
|
|
4318
|
+
/* @__PURE__ */ jsx29(McpSummaryRail, { children: /* @__PURE__ */ jsxs21("section", { className: cx2.stack, children: [
|
|
4319
|
+
/* @__PURE__ */ jsx29("p", { className: cx2.muted, children: "Total due today" }),
|
|
4320
|
+
/* @__PURE__ */ jsx29("p", { className: cx2.topupAmountHero, children: /* @__PURE__ */ jsx29(TopupChargeAmount, { amountMinor: committedAmountMinor, currency }) }),
|
|
4321
|
+
contextParts.length > 0 ? /* @__PURE__ */ jsx29("p", { className: cx2.topupBalanceContext, children: contextParts.join(" \xB7 ") }) : null,
|
|
4322
|
+
isFullscreen ? /* @__PURE__ */ jsx29(TopupForm.Summary.Rows, { className: cx2.taxSummary }) : /* @__PURE__ */ jsx29(TopupForm.Summary.TaxNote, { className: cx2.muted })
|
|
4292
4323
|
] }) }),
|
|
4293
|
-
/* @__PURE__ */
|
|
4294
|
-
/* @__PURE__ */
|
|
4324
|
+
/* @__PURE__ */ jsxs21(McpHostedBody, { children: [
|
|
4325
|
+
/* @__PURE__ */ jsx29(
|
|
4295
4326
|
McpPaymentHeader,
|
|
4296
4327
|
{
|
|
4297
4328
|
backLabel: "Change amount",
|
|
4298
4329
|
onBack: () => setScreen({ step: "amount" })
|
|
4299
4330
|
}
|
|
4300
4331
|
),
|
|
4301
|
-
/* @__PURE__ */
|
|
4302
|
-
/* @__PURE__ */
|
|
4303
|
-
/* @__PURE__ */
|
|
4304
|
-
/* @__PURE__ */
|
|
4305
|
-
/* @__PURE__ */
|
|
4306
|
-
/* @__PURE__ */
|
|
4332
|
+
/* @__PURE__ */ jsxs21("div", { className: cx2.topupForm, children: [
|
|
4333
|
+
/* @__PURE__ */ jsx29(TopupForm.Loading, {}),
|
|
4334
|
+
/* @__PURE__ */ jsx29(TopupForm.PaymentElement, { options: MCP_PAYMENT_ELEMENT_OPTIONS }),
|
|
4335
|
+
/* @__PURE__ */ jsx29(TopupForm.BusinessDetails.Root, { className: cx2.businessDetails, children: /* @__PURE__ */ jsx29(TopupForm.BusinessDetails.Fields, {}) }),
|
|
4336
|
+
/* @__PURE__ */ jsx29(TopupForm.Error, { className: cx2.error }),
|
|
4337
|
+
/* @__PURE__ */ jsxs21(TopupForm.SubmitButton, { className: cx2.button, children: [
|
|
4307
4338
|
"Top up",
|
|
4308
4339
|
" ",
|
|
4309
|
-
/* @__PURE__ */
|
|
4340
|
+
/* @__PURE__ */ jsx29(TopupChargeAmount, { amountMinor: committedAmountMinor, currency })
|
|
4310
4341
|
] }),
|
|
4311
|
-
/* @__PURE__ */
|
|
4342
|
+
/* @__PURE__ */ jsx29(
|
|
4312
4343
|
MandateText,
|
|
4313
4344
|
{
|
|
4314
4345
|
mode: "topup",
|
|
@@ -4324,7 +4355,7 @@ function EmbeddedTopup({
|
|
|
4324
4355
|
) });
|
|
4325
4356
|
}
|
|
4326
4357
|
const currencyDisplay = showCurrencySwitch ? "code" : "symbol";
|
|
4327
|
-
const amountForm = /* @__PURE__ */
|
|
4358
|
+
const amountForm = /* @__PURE__ */ jsxs21(
|
|
4328
4359
|
AmountPicker.Root,
|
|
4329
4360
|
{
|
|
4330
4361
|
currency,
|
|
@@ -4332,7 +4363,7 @@ function EmbeddedTopup({
|
|
|
4332
4363
|
selector: topupSelector,
|
|
4333
4364
|
className: cx2.amountPicker,
|
|
4334
4365
|
children: [
|
|
4335
|
-
isFullscreen ? null : /* @__PURE__ */
|
|
4366
|
+
isFullscreen ? null : /* @__PURE__ */ jsx29(
|
|
4336
4367
|
AmountStepHeader,
|
|
4337
4368
|
{
|
|
4338
4369
|
cx: cx2,
|
|
@@ -4342,15 +4373,15 @@ function EmbeddedTopup({
|
|
|
4342
4373
|
onCurrencyChange: handleCurrencyChange
|
|
4343
4374
|
}
|
|
4344
4375
|
),
|
|
4345
|
-
/* @__PURE__ */
|
|
4346
|
-
/* @__PURE__ */
|
|
4376
|
+
/* @__PURE__ */ jsx29(PresetAmountGrid, { currencyDisplay }),
|
|
4377
|
+
/* @__PURE__ */ jsx29(
|
|
4347
4378
|
CustomAmountRow2,
|
|
4348
4379
|
{
|
|
4349
4380
|
rowClassName: cx2.amountCustom,
|
|
4350
4381
|
currencyDisplay
|
|
4351
4382
|
}
|
|
4352
4383
|
),
|
|
4353
|
-
/* @__PURE__ */
|
|
4384
|
+
/* @__PURE__ */ jsx29(
|
|
4354
4385
|
McpInlineAutoRecharge,
|
|
4355
4386
|
{
|
|
4356
4387
|
ref: autoRechargeRef,
|
|
@@ -4359,8 +4390,8 @@ function EmbeddedTopup({
|
|
|
4359
4390
|
displayExchangeRate
|
|
4360
4391
|
}
|
|
4361
4392
|
),
|
|
4362
|
-
/* @__PURE__ */
|
|
4363
|
-
/* @__PURE__ */
|
|
4393
|
+
/* @__PURE__ */ jsx29(AmountDueSummary, { locale, currency }),
|
|
4394
|
+
/* @__PURE__ */ jsx29(
|
|
4364
4395
|
AmountPicker.Confirm,
|
|
4365
4396
|
{
|
|
4366
4397
|
className: cx2.button,
|
|
@@ -4389,8 +4420,8 @@ function EmbeddedTopup({
|
|
|
4389
4420
|
}
|
|
4390
4421
|
);
|
|
4391
4422
|
if (isFullscreen) {
|
|
4392
|
-
return /* @__PURE__ */
|
|
4393
|
-
/* @__PURE__ */
|
|
4423
|
+
return /* @__PURE__ */ jsx29("section", { className: cx2.card, "aria-label": "Add credits", children: /* @__PURE__ */ jsxs21(McpHostedLayout, { children: [
|
|
4424
|
+
/* @__PURE__ */ jsx29(McpSummaryRail, { children: /* @__PURE__ */ jsx29(
|
|
4394
4425
|
AmountStepHeader,
|
|
4395
4426
|
{
|
|
4396
4427
|
cx: cx2,
|
|
@@ -4401,14 +4432,14 @@ function EmbeddedTopup({
|
|
|
4401
4432
|
rail: true
|
|
4402
4433
|
}
|
|
4403
4434
|
) }),
|
|
4404
|
-
/* @__PURE__ */
|
|
4405
|
-
onBack ? /* @__PURE__ */
|
|
4435
|
+
/* @__PURE__ */ jsxs21(McpHostedBody, { children: [
|
|
4436
|
+
onBack ? /* @__PURE__ */ jsx29(BackLink, { label: "Back to my account", onClick: onBack }) : null,
|
|
4406
4437
|
amountForm
|
|
4407
4438
|
] })
|
|
4408
4439
|
] }) });
|
|
4409
4440
|
}
|
|
4410
|
-
return /* @__PURE__ */
|
|
4411
|
-
onBack ? /* @__PURE__ */
|
|
4441
|
+
return /* @__PURE__ */ jsxs21("section", { className: cx2.card, "aria-label": "Add credits", children: [
|
|
4442
|
+
onBack ? /* @__PURE__ */ jsx29(BackLink, { label: "Back to my account", onClick: onBack }) : null,
|
|
4412
4443
|
amountForm
|
|
4413
4444
|
] });
|
|
4414
4445
|
}
|
|
@@ -4419,7 +4450,7 @@ function TopupChargeAmount({
|
|
|
4419
4450
|
const locale = useHostLocale();
|
|
4420
4451
|
const { taxBreakdown } = useTopupForm();
|
|
4421
4452
|
const minor = chargeAmountMinor(taxBreakdown, amountMinor);
|
|
4422
|
-
return /* @__PURE__ */
|
|
4453
|
+
return /* @__PURE__ */ jsx29(Fragment13, { children: formatPrice(minor, taxBreakdown?.currency ?? currency, { locale, free: "" }) });
|
|
4423
4454
|
}
|
|
4424
4455
|
function AmountStepHeader({
|
|
4425
4456
|
cx: cx2,
|
|
@@ -4432,69 +4463,43 @@ function AmountStepHeader({
|
|
|
4432
4463
|
const { credits } = useBalance();
|
|
4433
4464
|
const locale = useHostLocale();
|
|
4434
4465
|
const formattedBalance = credits != null ? new Intl.NumberFormat(locale).format(credits) : void 0;
|
|
4435
|
-
return /* @__PURE__ */
|
|
4436
|
-
rail ? /* @__PURE__ */
|
|
4437
|
-
/* @__PURE__ */
|
|
4438
|
-
formattedBalance ? /* @__PURE__ */
|
|
4466
|
+
return /* @__PURE__ */ jsxs21("header", { className: rail ? cx2.stack : void 0, children: [
|
|
4467
|
+
rail ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
4468
|
+
/* @__PURE__ */ jsx29(Eyebrow, { variant: "rail", children: "Add credits" }),
|
|
4469
|
+
formattedBalance ? /* @__PURE__ */ jsxs21("p", { className: cx2.muted, children: [
|
|
4439
4470
|
"Balance ",
|
|
4440
4471
|
formattedBalance,
|
|
4441
4472
|
" credits"
|
|
4442
4473
|
] }) : null
|
|
4443
|
-
] }) : /* @__PURE__ */
|
|
4444
|
-
/* @__PURE__ */
|
|
4445
|
-
/* @__PURE__ */
|
|
4474
|
+
] }) : /* @__PURE__ */ jsxs21("div", { className: cx2.balanceRow, children: [
|
|
4475
|
+
/* @__PURE__ */ jsx29("h2", { className: cx2.heading, children: "Add credits" }),
|
|
4476
|
+
/* @__PURE__ */ jsx29(BalanceBadge, {})
|
|
4446
4477
|
] }),
|
|
4447
|
-
showCurrencySwitch ? /* @__PURE__ */
|
|
4448
|
-
/* @__PURE__ */
|
|
4449
|
-
/* @__PURE__ */
|
|
4478
|
+
showCurrencySwitch ? /* @__PURE__ */ jsxs21("label", { className: "solvapay-mcp-step-header", children: [
|
|
4479
|
+
/* @__PURE__ */ jsx29("span", { className: cx2.muted, children: "Pay in" }),
|
|
4480
|
+
/* @__PURE__ */ jsx29(
|
|
4450
4481
|
"select",
|
|
4451
4482
|
{
|
|
4452
4483
|
className: "solvapay-mcp-currency-switch",
|
|
4453
4484
|
value: currency,
|
|
4454
4485
|
onChange: (event) => onCurrencyChange(event.target.value),
|
|
4455
4486
|
"aria-label": "Topup currency",
|
|
4456
|
-
children: topupCurrencies.map((code) => /* @__PURE__ */
|
|
4487
|
+
children: topupCurrencies.map((code) => /* @__PURE__ */ jsx29("option", { value: code, children: code }, code))
|
|
4457
4488
|
}
|
|
4458
4489
|
)
|
|
4459
4490
|
] }) : null
|
|
4460
4491
|
] });
|
|
4461
4492
|
}
|
|
4462
|
-
function PresetAmountGrid({
|
|
4463
|
-
currencyDisplay,
|
|
4464
|
-
locale
|
|
4465
|
-
}) {
|
|
4466
|
-
const { quickAmounts, currency, creditsPerMinorUnit, displayExchangeRate } = useAmountPicker();
|
|
4467
|
-
const { displayCurrency } = useBalance();
|
|
4468
|
-
return /* @__PURE__ */ jsx28("div", { className: "solvapay-mcp-preset-grid", "aria-label": "Quick amounts", children: quickAmounts.map((amount) => {
|
|
4469
|
-
const minor = amount * getMinorUnitsPerMajor(currency);
|
|
4470
|
-
const label = formatPrice(minor, currency, {
|
|
4471
|
-
locale,
|
|
4472
|
-
free: "",
|
|
4473
|
-
currencyDisplay
|
|
4474
|
-
});
|
|
4475
|
-
const estimate = estimateTopupCredits(
|
|
4476
|
-
minor,
|
|
4477
|
-
currency,
|
|
4478
|
-
displayCurrency,
|
|
4479
|
-
creditsPerMinorUnit,
|
|
4480
|
-
displayExchangeRate
|
|
4481
|
-
);
|
|
4482
|
-
return /* @__PURE__ */ jsxs20(AmountPicker.Option, { amount, className: "solvapay-mcp-preset-tile", children: [
|
|
4483
|
-
/* @__PURE__ */ jsx28("span", { className: "solvapay-mcp-preset-tile-amount", children: label }),
|
|
4484
|
-
/* @__PURE__ */ jsx28("span", { className: "solvapay-mcp-preset-tile-credits", children: estimate.kind === "available" ? formatCompactCredits(estimate.credits, locale) : "" })
|
|
4485
|
-
] }, amount);
|
|
4486
|
-
}) });
|
|
4487
|
-
}
|
|
4488
4493
|
function AmountDueSummary({ locale, currency }) {
|
|
4489
4494
|
const { resolvedAmountMinor } = useAmountPicker();
|
|
4490
4495
|
const displayAmount = resolvedAmountMinor != null ? formatPrice(resolvedAmountMinor, currency, { locale, free: "" }) : formatPrice(0, currency, { locale, free: "" });
|
|
4491
|
-
return /* @__PURE__ */
|
|
4496
|
+
return /* @__PURE__ */ jsx29(
|
|
4492
4497
|
AmountLadder,
|
|
4493
4498
|
{
|
|
4494
4499
|
rows: [
|
|
4495
4500
|
{
|
|
4496
4501
|
label: "Total due today",
|
|
4497
|
-
value: /* @__PURE__ */
|
|
4502
|
+
value: /* @__PURE__ */ jsx29("span", { className: "solvapay-mcp-topup-total", children: displayAmount })
|
|
4498
4503
|
}
|
|
4499
4504
|
]
|
|
4500
4505
|
}
|
|
@@ -4506,20 +4511,20 @@ function CustomAmountRow2({
|
|
|
4506
4511
|
}) {
|
|
4507
4512
|
const { currencySymbol: currencySymbol2, currency } = useAmountPicker();
|
|
4508
4513
|
const prefix = currencyDisplay === "code" ? currency.toUpperCase() : currencySymbol2;
|
|
4509
|
-
return /* @__PURE__ */
|
|
4510
|
-
/* @__PURE__ */
|
|
4511
|
-
/* @__PURE__ */
|
|
4514
|
+
return /* @__PURE__ */ jsxs21("label", { className: rowClassName, children: [
|
|
4515
|
+
/* @__PURE__ */ jsx29("span", { className: "solvapay-mcp-amount-currency-symbol", children: prefix }),
|
|
4516
|
+
/* @__PURE__ */ jsx29(AmountPicker.Custom, { className: "solvapay-mcp-amount-custom-input", placeholder: "0.00" })
|
|
4512
4517
|
] });
|
|
4513
4518
|
}
|
|
4514
4519
|
function HostedTopupFallback({
|
|
4515
4520
|
cx: cx2,
|
|
4516
4521
|
onChangeAmount
|
|
4517
4522
|
}) {
|
|
4518
|
-
return /* @__PURE__ */
|
|
4519
|
-
/* @__PURE__ */
|
|
4520
|
-
/* @__PURE__ */
|
|
4521
|
-
/* @__PURE__ */
|
|
4522
|
-
/* @__PURE__ */
|
|
4523
|
+
return /* @__PURE__ */ jsxs21("section", { className: cx2.card, "aria-label": "Add credits", children: [
|
|
4524
|
+
/* @__PURE__ */ jsx29(BackLink, { label: "Change amount", onClick: onChangeAmount }),
|
|
4525
|
+
/* @__PURE__ */ jsx29("h2", { className: cx2.heading, children: "Add credits" }),
|
|
4526
|
+
/* @__PURE__ */ jsx29("p", { className: cx2.muted, children: "This host doesn't allow embedded payments. Open the SolvaPay portal in a new tab to complete your top-up there." }),
|
|
4527
|
+
/* @__PURE__ */ jsx29(
|
|
4523
4528
|
LaunchCustomerPortalButton,
|
|
4524
4529
|
{
|
|
4525
4530
|
className: cx2.button,
|
|
@@ -4532,7 +4537,7 @@ function HostedTopupFallback({
|
|
|
4532
4537
|
}
|
|
4533
4538
|
|
|
4534
4539
|
// src/mcp/McpAppShell.tsx
|
|
4535
|
-
import { jsx as
|
|
4540
|
+
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4536
4541
|
function resolveSurface(bootstrapView) {
|
|
4537
4542
|
switch (bootstrapView) {
|
|
4538
4543
|
case "checkout":
|
|
@@ -4569,8 +4574,8 @@ function McpAppShell({
|
|
|
4569
4574
|
const effectiveView = overrideView ?? resolvedView;
|
|
4570
4575
|
const showFooter = footer ?? true;
|
|
4571
4576
|
const surface = effectiveView === "account" || effectiveView === "auto-recharge" ? "management" : "payment";
|
|
4572
|
-
return /* @__PURE__ */
|
|
4573
|
-
/* @__PURE__ */
|
|
4577
|
+
return /* @__PURE__ */ jsxs22("div", { className: "solvapay-mcp-shell", children: [
|
|
4578
|
+
/* @__PURE__ */ jsx30(McpHostedColumn, { surface, children: /* @__PURE__ */ jsx30(McpHostedLayout, { children: /* @__PURE__ */ jsx30("div", { className: "solvapay-mcp-shell-body", children: /* @__PURE__ */ jsx30(
|
|
4574
4579
|
McpViewRouter,
|
|
4575
4580
|
{
|
|
4576
4581
|
view: effectiveView,
|
|
@@ -4583,12 +4588,16 @@ function McpAppShell({
|
|
|
4583
4588
|
onClose
|
|
4584
4589
|
}
|
|
4585
4590
|
) }) }) }),
|
|
4586
|
-
showFooter ? /* @__PURE__ */
|
|
4591
|
+
showFooter ? /* @__PURE__ */ jsx30(ShellFooter, { classNames }) : null
|
|
4587
4592
|
] });
|
|
4588
4593
|
}
|
|
4589
4594
|
function ShellFooter({ classNames }) {
|
|
4590
4595
|
const cx2 = resolveMcpClassNames(classNames);
|
|
4591
|
-
|
|
4596
|
+
const copy = useCopy();
|
|
4597
|
+
return /* @__PURE__ */ jsxs22("footer", { className: `solvapay-mcp-shell-footer ${cx2.muted}`.trim(), children: [
|
|
4598
|
+
/* @__PURE__ */ jsx30("span", { children: copy.legalFooter.providedBy }),
|
|
4599
|
+
/* @__PURE__ */ jsx30(LegalFooter, { attribution: false })
|
|
4600
|
+
] });
|
|
4592
4601
|
}
|
|
4593
4602
|
function McpViewRouter({
|
|
4594
4603
|
view,
|
|
@@ -4609,7 +4618,7 @@ function McpViewRouter({
|
|
|
4609
4618
|
const goAccount = onSurfaceChange ? () => onSurfaceChange("account") : void 0;
|
|
4610
4619
|
switch (view) {
|
|
4611
4620
|
case "checkout":
|
|
4612
|
-
return /* @__PURE__ */
|
|
4621
|
+
return /* @__PURE__ */ jsx30(
|
|
4613
4622
|
CheckoutView,
|
|
4614
4623
|
{
|
|
4615
4624
|
productRef,
|
|
@@ -4627,7 +4636,7 @@ function McpViewRouter({
|
|
|
4627
4636
|
);
|
|
4628
4637
|
case "auto-recharge":
|
|
4629
4638
|
case "account":
|
|
4630
|
-
return /* @__PURE__ */
|
|
4639
|
+
return /* @__PURE__ */ jsx30(
|
|
4631
4640
|
AccountView,
|
|
4632
4641
|
{
|
|
4633
4642
|
classNames,
|
|
@@ -4641,7 +4650,7 @@ function McpViewRouter({
|
|
|
4641
4650
|
}
|
|
4642
4651
|
);
|
|
4643
4652
|
case "topup":
|
|
4644
|
-
return /* @__PURE__ */
|
|
4653
|
+
return /* @__PURE__ */ jsx30(
|
|
4645
4654
|
TopupView,
|
|
4646
4655
|
{
|
|
4647
4656
|
publishableKey: stripePublishableKey,
|
|
@@ -4660,17 +4669,17 @@ import { useContext as useContext4, useLayoutEffect, useRef as useRef7, useState
|
|
|
4660
4669
|
|
|
4661
4670
|
// src/mcp/hooks/useHostInfo.tsx
|
|
4662
4671
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
4663
|
-
import { jsx as
|
|
4672
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
4664
4673
|
var McpHostInfoContext = createContext3(null);
|
|
4665
4674
|
function McpHostInfoProvider({ hostName, children }) {
|
|
4666
|
-
return /* @__PURE__ */
|
|
4675
|
+
return /* @__PURE__ */ jsx31(McpHostInfoContext.Provider, { value: hostName, children });
|
|
4667
4676
|
}
|
|
4668
4677
|
function useHostName() {
|
|
4669
4678
|
return useContext3(McpHostInfoContext);
|
|
4670
4679
|
}
|
|
4671
4680
|
|
|
4672
4681
|
// src/mcp/views/AppHeader.tsx
|
|
4673
|
-
import { jsx as
|
|
4682
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4674
4683
|
var HOSTS_WITH_MERCHANT_CHROME = /chatgpt|openai|claude/i;
|
|
4675
4684
|
function useMerchantSafe() {
|
|
4676
4685
|
const ctx = useContext4(SolvaPayContext);
|
|
@@ -4723,8 +4732,8 @@ function AppHeader({
|
|
|
4723
4732
|
const rootClass = [cx2.appHeader, className].filter(Boolean).join(" ");
|
|
4724
4733
|
const hasIconUrl = iconUrl !== null && !imgFailed;
|
|
4725
4734
|
const showInitials = !hasIconUrl || !imgLoaded;
|
|
4726
|
-
return /* @__PURE__ */
|
|
4727
|
-
hasIconUrl ? /* @__PURE__ */
|
|
4735
|
+
return /* @__PURE__ */ jsxs23("header", { className: rootClass, children: [
|
|
4736
|
+
hasIconUrl ? /* @__PURE__ */ jsx32(
|
|
4728
4737
|
"img",
|
|
4729
4738
|
{
|
|
4730
4739
|
ref: imgRef,
|
|
@@ -4736,14 +4745,14 @@ function AppHeader({
|
|
|
4736
4745
|
onError: () => setImgFailed(true)
|
|
4737
4746
|
}
|
|
4738
4747
|
) : null,
|
|
4739
|
-
showInitials ? /* @__PURE__ */
|
|
4740
|
-
/* @__PURE__ */
|
|
4741
|
-
children ? /* @__PURE__ */
|
|
4748
|
+
showInitials ? /* @__PURE__ */ jsx32("span", { className: cx2.appHeaderInitials, "aria-hidden": "true", children: getInitials(name) }) : null,
|
|
4749
|
+
/* @__PURE__ */ jsx32("span", { className: cx2.appHeaderName, children: name }),
|
|
4750
|
+
children ? /* @__PURE__ */ jsx32("span", { className: "solvapay-mcp-app-header-slot", children }) : null
|
|
4742
4751
|
] });
|
|
4743
4752
|
}
|
|
4744
4753
|
|
|
4745
4754
|
// src/mcp/McpApp.tsx
|
|
4746
|
-
import { jsx as
|
|
4755
|
+
import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4747
4756
|
function bootstrapToInitial(bs) {
|
|
4748
4757
|
return {
|
|
4749
4758
|
customerRef: bs.customer?.ref ?? null,
|
|
@@ -4757,6 +4766,7 @@ function bootstrapToInitial(bs) {
|
|
|
4757
4766
|
plans: bs.plans
|
|
4758
4767
|
};
|
|
4759
4768
|
}
|
|
4769
|
+
var OPENING_RESULT_GRACE_MS = 1500;
|
|
4760
4770
|
function McpApp({
|
|
4761
4771
|
app,
|
|
4762
4772
|
productRef: productRefOverride,
|
|
@@ -4791,9 +4801,18 @@ function McpApp({
|
|
|
4791
4801
|
setHostName(null);
|
|
4792
4802
|
setDisplayModeState(DEFAULT_DISPLAY_MODE_STATE);
|
|
4793
4803
|
let hasBootstrap = false;
|
|
4804
|
+
let toolCallInFlight = false;
|
|
4805
|
+
let initialFetchInFlight = false;
|
|
4806
|
+
let graceTimer = null;
|
|
4807
|
+
const clearGrace = () => {
|
|
4808
|
+
if (graceTimer !== null) {
|
|
4809
|
+
clearTimeout(graceTimer);
|
|
4810
|
+
graceTimer = null;
|
|
4811
|
+
}
|
|
4812
|
+
};
|
|
4794
4813
|
const loadBootstrap = async () => {
|
|
4795
|
-
if (cancelled || hasBootstrap ||
|
|
4796
|
-
|
|
4814
|
+
if (cancelled || hasBootstrap || initialFetchInFlight) return;
|
|
4815
|
+
initialFetchInFlight = true;
|
|
4797
4816
|
try {
|
|
4798
4817
|
let resolved;
|
|
4799
4818
|
try {
|
|
@@ -4801,17 +4820,16 @@ function McpApp({
|
|
|
4801
4820
|
} catch {
|
|
4802
4821
|
resolved = await fetchMcpBootstrap(app);
|
|
4803
4822
|
}
|
|
4804
|
-
if (
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
}
|
|
4823
|
+
if (cancelled || hasBootstrap) return;
|
|
4824
|
+
hasBootstrap = true;
|
|
4825
|
+
setBootstrap(resolved);
|
|
4808
4826
|
} catch (err) {
|
|
4809
4827
|
if (cancelled) return;
|
|
4810
4828
|
const message = err instanceof Error ? err.message : "Failed to initialize SolvaPay";
|
|
4811
4829
|
setInitError(message);
|
|
4812
4830
|
onInitErrorRef.current?.(err instanceof Error ? err : new Error(message));
|
|
4813
4831
|
} finally {
|
|
4814
|
-
|
|
4832
|
+
initialFetchInFlight = false;
|
|
4815
4833
|
}
|
|
4816
4834
|
};
|
|
4817
4835
|
const applyHostContext = (ctx) => {
|
|
@@ -4822,33 +4840,51 @@ function McpApp({
|
|
|
4822
4840
|
applyHostContext(ctx);
|
|
4823
4841
|
};
|
|
4824
4842
|
app.onteardown = async () => ({});
|
|
4843
|
+
const onToolInput = () => {
|
|
4844
|
+
if (cancelled) return;
|
|
4845
|
+
toolCallInFlight = true;
|
|
4846
|
+
clearGrace();
|
|
4847
|
+
};
|
|
4848
|
+
const onToolCancelled = () => {
|
|
4849
|
+
if (cancelled) return;
|
|
4850
|
+
toolCallInFlight = false;
|
|
4851
|
+
clearGrace();
|
|
4852
|
+
if (!hasBootstrap) void loadBootstrap();
|
|
4853
|
+
};
|
|
4825
4854
|
const onToolResult = (params) => {
|
|
4826
4855
|
if (cancelled) return;
|
|
4827
4856
|
const toolName = app.getHostContext?.()?.toolInfo?.tool?.name ?? null;
|
|
4828
4857
|
if (toolName && isTransportToolName(toolName)) return;
|
|
4829
4858
|
if (pendingBootstrapFetchRef.current) return;
|
|
4830
4859
|
try {
|
|
4831
|
-
const intentView = toolName ? VIEW_FOR_TOOL2[toolName] : void 0;
|
|
4832
|
-
const fallbackView = intentView ?? "checkout";
|
|
4833
4860
|
const fresh = parseBootstrapFromToolResult(
|
|
4834
4861
|
params,
|
|
4835
4862
|
toolName ?? "(unknown tool)",
|
|
4836
|
-
|
|
4863
|
+
fallbackViewFromHost(app)
|
|
4837
4864
|
);
|
|
4865
|
+
toolCallInFlight = false;
|
|
4838
4866
|
hasBootstrap = true;
|
|
4867
|
+
clearGrace();
|
|
4839
4868
|
setBootstrap(fresh);
|
|
4840
4869
|
} catch {
|
|
4841
|
-
|
|
4870
|
+
toolCallInFlight = false;
|
|
4871
|
+
clearGrace();
|
|
4872
|
+
if (!hasBootstrap) {
|
|
4842
4873
|
void loadBootstrap();
|
|
4843
|
-
return;
|
|
4844
4874
|
}
|
|
4845
4875
|
}
|
|
4846
4876
|
};
|
|
4847
4877
|
let unsubscribe;
|
|
4848
4878
|
if (typeof app.addEventListener === "function") {
|
|
4849
4879
|
app.addEventListener("toolresult", onToolResult);
|
|
4880
|
+
app.addEventListener("toolinput", onToolInput);
|
|
4881
|
+
app.addEventListener("toolinputpartial", onToolInput);
|
|
4882
|
+
app.addEventListener("toolcancelled", onToolCancelled);
|
|
4850
4883
|
unsubscribe = () => {
|
|
4851
4884
|
app.removeEventListener?.("toolresult", onToolResult);
|
|
4885
|
+
app.removeEventListener?.("toolinput", onToolInput);
|
|
4886
|
+
app.removeEventListener?.("toolinputpartial", onToolInput);
|
|
4887
|
+
app.removeEventListener?.("toolcancelled", onToolCancelled);
|
|
4852
4888
|
};
|
|
4853
4889
|
} else {
|
|
4854
4890
|
const prior = app.ontoolresult;
|
|
@@ -4869,8 +4905,13 @@ function McpApp({
|
|
|
4869
4905
|
applyHostContext(app.getHostContext());
|
|
4870
4906
|
setHostName(app.getHostVersion?.()?.name ?? null);
|
|
4871
4907
|
const hostEntry = classifyHostEntry(app);
|
|
4872
|
-
if (hostEntry.kind === "other") {
|
|
4908
|
+
if (hostEntry.kind === "other" && hostEntry.toolName && isTransportToolName(hostEntry.toolName)) {
|
|
4873
4909
|
await loadBootstrap();
|
|
4910
|
+
} else if (hostEntry.kind === "other" && !toolCallInFlight) {
|
|
4911
|
+
graceTimer = setTimeout(() => {
|
|
4912
|
+
graceTimer = null;
|
|
4913
|
+
if (!cancelled && !hasBootstrap && !toolCallInFlight) void loadBootstrap();
|
|
4914
|
+
}, OPENING_RESULT_GRACE_MS);
|
|
4874
4915
|
}
|
|
4875
4916
|
} catch (err) {
|
|
4876
4917
|
if (cancelled) return;
|
|
@@ -4881,6 +4922,7 @@ function McpApp({
|
|
|
4881
4922
|
})();
|
|
4882
4923
|
return () => {
|
|
4883
4924
|
cancelled = true;
|
|
4925
|
+
clearGrace();
|
|
4884
4926
|
unsubscribe?.();
|
|
4885
4927
|
};
|
|
4886
4928
|
}, [app]);
|
|
@@ -4965,31 +5007,31 @@ function McpApp({
|
|
|
4965
5007
|
);
|
|
4966
5008
|
const effectiveOnClose = onClose ?? defaultOnClose;
|
|
4967
5009
|
const effectiveBootstrap = bootstrap && productRefOverride ? { ...bootstrap, productRef: productRefOverride } : bootstrap;
|
|
4968
|
-
return /* @__PURE__ */
|
|
5010
|
+
return /* @__PURE__ */ jsx33(McpHostInfoProvider, { hostName, children: /* @__PURE__ */ jsx33(McpDisplayModeProvider, { value: displayModeState, children: /* @__PURE__ */ jsxs24(
|
|
4969
5011
|
"main",
|
|
4970
5012
|
{
|
|
4971
5013
|
className: "solvapay-mcp-main",
|
|
4972
5014
|
"data-display-mode": displayModeState.displayMode,
|
|
4973
5015
|
style: hostSafeAreaPadding(displayModeState.safeAreaInsets),
|
|
4974
5016
|
children: [
|
|
4975
|
-
/* @__PURE__ */
|
|
5017
|
+
/* @__PURE__ */ jsx33("div", { className: "solvapay-mcp-chrome-row", children: displayModeState.displayMode !== "fullscreen" ? /* @__PURE__ */ jsx33(
|
|
4976
5018
|
AppHeader,
|
|
4977
5019
|
{
|
|
4978
5020
|
classNames,
|
|
4979
5021
|
merchant: effectiveBootstrap?.merchant ?? null
|
|
4980
5022
|
}
|
|
4981
5023
|
) : null }),
|
|
4982
|
-
initError ? /* @__PURE__ */
|
|
4983
|
-
/* @__PURE__ */
|
|
4984
|
-
/* @__PURE__ */
|
|
5024
|
+
initError ? /* @__PURE__ */ jsxs24("div", { className: `${cx2.card} ${cx2.error}`.trim(), children: [
|
|
5025
|
+
/* @__PURE__ */ jsx33("h2", { className: cx2.heading, children: "Unable to load SolvaPay" }),
|
|
5026
|
+
/* @__PURE__ */ jsx33("p", { children: initError })
|
|
4985
5027
|
] }) : !effectiveBootstrap ? (
|
|
4986
5028
|
// Intent-tool / fallback entries show a loading card while the
|
|
4987
5029
|
// in-flight `fetchMcpBootstrap` call resolves. Data-tool iframe
|
|
4988
5030
|
// entries no longer exist (payable merchant tools don't advertise
|
|
4989
5031
|
// `_meta.ui.resourceUri`) so this is always legitimate user
|
|
4990
5032
|
// feedback for an in-flight tool call.
|
|
4991
|
-
/* @__PURE__ */
|
|
4992
|
-
) : /* @__PURE__ */
|
|
5033
|
+
/* @__PURE__ */ jsx33("div", { className: cx2.card, children: /* @__PURE__ */ jsx33("p", { children: "Loading\u2026" }) })
|
|
5034
|
+
) : /* @__PURE__ */ jsx33(SolvaPayProvider, { config: providerConfig, children: /* @__PURE__ */ jsx33(McpBridgeProvider, { app, messageOnSuccess, children: /* @__PURE__ */ jsx33(
|
|
4993
5035
|
McpAppShell,
|
|
4994
5036
|
{
|
|
4995
5037
|
bootstrap: effectiveBootstrap,
|