@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.
@@ -45,7 +45,7 @@ __export(mcp_exports, {
45
45
  LineItem: () => LineItem,
46
46
  MCP_DISPLAY_MODES: () => MCP_DISPLAY_MODES,
47
47
  MCP_HOSTED_MIN_WIDTH: () => MCP_HOSTED_MIN_WIDTH,
48
- MCP_TOOL_NAMES: () => import_mcp_core4.MCP_TOOL_NAMES,
48
+ MCP_TOOL_NAMES: () => import_mcp_core3.MCP_TOOL_NAMES,
49
49
  MCP_USAGE_CRITICAL_AT: () => MCP_USAGE_CRITICAL_AT,
50
50
  MCP_USAGE_WARNING_AT: () => MCP_USAGE_WARNING_AT,
51
51
  McpAccountView: () => McpAccountView,
@@ -183,7 +183,7 @@ function createMcpAppAdapter(app) {
183
183
  }
184
184
 
185
185
  // src/mcp/index.ts
186
- var import_mcp_core4 = require("@solvapay/mcp-core");
186
+ var import_mcp_core3 = require("@solvapay/mcp-core");
187
187
 
188
188
  // src/mcp/useStripeProbe.ts
189
189
  var import_react = require("react");
@@ -662,25 +662,24 @@ function classifyHostEntry(app) {
662
662
  }
663
663
  return { kind: "other", toolName };
664
664
  }
665
- function inferViewFromHost(app) {
665
+ function fallbackViewFromHost(app) {
666
666
  const classification = classifyHostEntry(app);
667
667
  if (classification.kind === "intent") return classification.view;
668
- return "checkout";
668
+ return "account";
669
669
  }
670
670
  async function fetchMcpBootstrap(app) {
671
- const view = inferViewFromHost(app);
672
- const toolName = import_mcp_core2.TOOL_FOR_VIEW[view];
671
+ const view = fallbackViewFromHost(app);
673
672
  const result = await app.callServerTool({
674
- name: toolName,
673
+ name: import_mcp_core2.VIEWER_TOOL_NAME,
675
674
  arguments: {}
676
675
  });
677
- return parseBootstrapFromToolResult(result, toolName, view);
676
+ return parseBootstrapFromToolResult(result, import_mcp_core2.VIEWER_TOOL_NAME, view);
678
677
  }
679
678
  async function fetchMcpBootstrapViaResource(app) {
680
679
  if (typeof app.readServerResource !== "function") {
681
680
  throw new Error("Host does not support readServerResource");
682
681
  }
683
- const view = inferViewFromHost(app);
682
+ const view = fallbackViewFromHost(app);
684
683
  const result = await app.readServerResource({ uri: import_mcp_core2.SOLVAPAY_BOOTSTRAP_URI });
685
684
  const text = result.contents?.[0]?.text;
686
685
  if (typeof text !== "string" || !text) {
@@ -692,12 +691,11 @@ async function fetchMcpBootstrapViaResource(app) {
692
691
  } catch {
693
692
  throw new Error("Bootstrap resource returned invalid JSON");
694
693
  }
695
- const bootstrap = parseBootstrapFromToolResult(
694
+ return parseBootstrapFromToolResult(
696
695
  { structuredContent: payload },
697
696
  import_mcp_core2.SOLVAPAY_BOOTSTRAP_URI,
698
697
  view
699
698
  );
700
- return { ...bootstrap, view };
701
699
  }
702
700
  function parseBootstrapFromToolResult(result, toolName, fallbackView) {
703
701
  const structured = result.structuredContent;
@@ -1502,6 +1500,7 @@ var enCopy = {
1502
1500
  soldBy: "Sold by {merchant}",
1503
1501
  fullHistory: "Full history",
1504
1502
  fullAccount: "Full account",
1503
+ signedInAs: "Signed in as",
1505
1504
  creditActivityEyebrow: "Credit activity",
1506
1505
  chargesEyebrow: "Charges for this product",
1507
1506
  creditActivityCaption: "Every credit event on your account, newest first, including other products and top-ups. Credits are shared, so the balance only makes sense account-wide.",
@@ -2862,8 +2861,8 @@ function deriveUsage(purchase, limits) {
2862
2861
  const hasFiniteCap = limits.unlimited === false && limits.remaining !== null;
2863
2862
  const remaining = hasFiniteCap ? limits.remaining : null;
2864
2863
  const total = typeof limits.limit === "number" && limits.limit > 0 ? limits.limit : null;
2865
- const used = typeof limits.used === "number" ? limits.used : total !== null && remaining !== null ? Math.max(0, total - remaining) : typeof usage?.used === "number" ? usage.used : 0;
2866
- const percentUsed = total !== null && total > 0 ? Math.min(100, Math.round(used / total * 1e4) / 100) : null;
2864
+ const used = typeof limits.used === "number" ? limits.used : total !== null && remaining !== null ? Math.max(0, total - remaining) : null;
2865
+ const percentUsed = total !== null && total > 0 && used !== null ? Math.min(100, Math.round(used / total * 1e4) / 100) : null;
2867
2866
  return {
2868
2867
  meterRef: limits.meterName,
2869
2868
  total,
@@ -3015,7 +3014,6 @@ function seedMcpCaches(initial, config) {
3015
3014
 
3016
3015
  // src/mcp/McpApp.tsx
3017
3016
  var import_react58 = require("react");
3018
- var import_mcp_core3 = require("@solvapay/mcp-core");
3019
3017
 
3020
3018
  // src/mcp/McpAppShell.tsx
3021
3019
  var import_react55 = require("react");
@@ -3386,7 +3384,7 @@ var import_core6 = require("@solvapay/core");
3386
3384
 
3387
3385
  // src/utils/isPayg.ts
3388
3386
  function isPaygPlan(plan) {
3389
- return plan?.type === "usage-based" || plan?.type === "hybrid";
3387
+ return plan?.type === "usage-based";
3390
3388
  }
3391
3389
 
3392
3390
  // src/utils/planPricing.ts
@@ -4051,7 +4049,7 @@ var Label = (0, import_react21.forwardRef)(function UsageMeterLabel({ className,
4051
4049
  );
4052
4050
  }
4053
4051
  const unit = ctx.usage.meterRef ?? "requests";
4054
- const label = ctx.usage.total !== null ? interpolate(copy.usage.usedLabel, {
4052
+ const label = ctx.usage.total !== null && ctx.usage.used !== null ? interpolate(copy.usage.usedLabel, {
4055
4053
  used: String(ctx.usage.used),
4056
4054
  total: String(ctx.usage.total),
4057
4055
  unit
@@ -4599,10 +4597,27 @@ function ChargesTable({ charges: charges2 }) {
4599
4597
  }) })
4600
4598
  ] });
4601
4599
  }
4600
+ function AccountSignedInAs() {
4601
+ const copy = useCopy();
4602
+ const { email, customerRef } = useCustomer();
4603
+ const resolvedRef = customerRef?.trim();
4604
+ const resolvedEmail = email?.trim();
4605
+ if (!resolvedRef) return null;
4606
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "solvapay-mcp-muted solvapay-mcp-signed-in", children: [
4607
+ copy.account.signedInAs,
4608
+ " ",
4609
+ resolvedEmail ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
4610
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: resolvedEmail }),
4611
+ " \xB7 "
4612
+ ] }) : null,
4613
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "solvapay-mcp-signed-in-ref", children: resolvedRef })
4614
+ ] });
4615
+ }
4602
4616
  function AccountIdentityFooter() {
4603
4617
  const copy = useCopy();
4604
4618
  const { merchant } = useMerchant();
4605
- const { name, email } = useCustomer();
4619
+ const { name, email, customerRef } = useCustomer();
4620
+ const signedInRef = customerRef?.trim();
4606
4621
  const handleExternalClick = useExternalLinkClick();
4607
4622
  const place = merchant ? formatMerchantPlace(merchant) : null;
4608
4623
  const websiteUrl = merchant?.websiteUrl;
@@ -4630,6 +4645,7 @@ function AccountIdentityFooter() {
4630
4645
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "solvapay-mcp-account-footer-buyer", children: [
4631
4646
  name ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: name }) : null,
4632
4647
  email ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "solvapay-mcp-muted", children: email }) : null,
4648
+ signedInRef ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "solvapay-mcp-muted solvapay-mcp-signed-in-ref", children: signedInRef }) : null,
4633
4649
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PortalTextLink, { children: copy.account.fullAccount })
4634
4650
  ] })
4635
4651
  ] });
@@ -4844,7 +4860,7 @@ function AllowanceAccountPanel({
4844
4860
  fullscreenCredits: isFullscreen
4845
4861
  });
4846
4862
  const showMeter = remaining.kind === "finite" && usage != null && total != null && total > 0;
4847
- const used = remaining.kind === "finite" && total != null ? usage?.total != null ? usage.used : Math.max(0, total - remaining.remaining) : usage?.used ?? 0;
4863
+ const used = remaining.kind === "finite" && total != null ? usage?.used ?? Math.max(0, total - remaining.remaining) : usage?.used ?? 0;
4848
4864
  const percent = usage?.percentUsed ?? (total != null && total > 0 ? Math.min(100, Math.round(used / total * 1e4) / 100) : null);
4849
4865
  const meterCaption = showMeter ? buildMeterCaption({
4850
4866
  used,
@@ -4902,7 +4918,8 @@ function AllowanceAccountPanel({
4902
4918
  errorClassName: cx2.button
4903
4919
  }
4904
4920
  )
4905
- ] }) : null
4921
+ ] }) : null,
4922
+ isFullscreen ? null : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AccountSignedInAs, {})
4906
4923
  ] }),
4907
4924
  isFullscreen && productRef ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChargesSection, { charges: history.charges, loading: history.loading, error: history.error }) : null,
4908
4925
  isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AccountIdentityFooter, {}) : null
@@ -5100,7 +5117,8 @@ function CreditAccountPanel({
5100
5117
  errorClassName: cx2.button
5101
5118
  }
5102
5119
  )
5103
- ] }) : null
5120
+ ] }) : null,
5121
+ isFullscreen ? null : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AccountSignedInAs, {})
5104
5122
  ] }),
5105
5123
  isFullscreen && productRef ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5106
5124
  CreditActivitySection,
@@ -5476,7 +5494,10 @@ function ForcedAccountPanel({
5476
5494
  }) {
5477
5495
  const cx2 = resolveMcpClassNames(classNames);
5478
5496
  if (accountState === "G") {
5479
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "solvapay-mcp-account", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: cx2.card, "data-solvapay-mcp-account-skeleton": "", "aria-busy": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccountSkeleton, {}) }) });
5497
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "solvapay-mcp-account", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cx2.card, "data-solvapay-mcp-account-skeleton": "", "aria-busy": "true", children: [
5498
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccountSkeleton, {}),
5499
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccountSignedInAs, {})
5500
+ ] }) });
5480
5501
  }
5481
5502
  if (accountState === "H") {
5482
5503
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
@@ -5597,7 +5618,8 @@ function ActivateAccountPanel({
5597
5618
  }
5598
5619
  ),
5599
5620
  error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: cx2.error, role: "alert", children: error }) : null,
5600
- showPortalCta ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PortalHint, { classNames }) : null
5621
+ showPortalCta ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PortalHint, { classNames }) : null,
5622
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccountSignedInAs, {})
5601
5623
  ] }) });
5602
5624
  }
5603
5625
  function OverageAccountPanel({
@@ -5665,7 +5687,8 @@ function OverageAccountPanel({
5665
5687
  ] }),
5666
5688
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "solvapay-mcp-overage-copy", children: copy.account.stillWorking }),
5667
5689
  onChangePlan ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: cx2.linkButton, onClick: () => onChangePlan(), children: copy.account.seeHigherLimit }) : null,
5668
- showPortalCta ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PortalHint, { classNames }) : null
5690
+ showPortalCta ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PortalHint, { classNames }) : null,
5691
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccountSignedInAs, {})
5669
5692
  ] }) });
5670
5693
  }
5671
5694
  function CancelledAccountPanel({
@@ -5693,7 +5716,7 @@ function CancelledAccountPanel({
5693
5716
  const total = remaining != null ? usage?.total ?? (cap && cap > 0 ? cap : null) : cap && cap > 0 ? cap : null;
5694
5717
  const meter = usage?.meterRef ?? limits.meterName;
5695
5718
  const showMeter = remaining != null && total != null && total > 0;
5696
- const used = remaining != null && total != null ? usage?.total != null ? usage.used : Math.max(0, total - remaining) : usage?.used ?? 0;
5719
+ const used = remaining != null && total != null ? usage?.used ?? Math.max(0, total - remaining) : usage?.used ?? 0;
5697
5720
  const percent = usage?.percentUsed ?? (total != null && total > 0 ? Math.min(100, Math.round(used / total * 1e4) / 100) : null);
5698
5721
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "solvapay-mcp-account", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cx2.card, children: [
5699
5722
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
@@ -5736,7 +5759,8 @@ function CancelledAccountPanel({
5736
5759
  )
5737
5760
  ] }) : null,
5738
5761
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CancelledPlanNotice.Root, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CancelledPlanNotice.ReactivateButton, { className: cx2.button, "data-variant": "secondary", children: interpolate(copy.account.reactivatePlan, { plan: planName }) }) }),
5739
- showPortalCta ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PortalHint, { classNames }) : null
5762
+ showPortalCta ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PortalHint, { classNames }) : null,
5763
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccountSignedInAs, {})
5740
5764
  ] }) });
5741
5765
  }
5742
5766
  function PortalHint({ classNames }) {
@@ -5975,7 +5999,8 @@ function LadderAccountPanel({
5975
5999
  errorClassName: cx2.button
5976
6000
  }
5977
6001
  )
5978
- ] }) : null
6002
+ ] }) : null,
6003
+ isFullscreen ? null : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AccountSignedInAs, {})
5979
6004
  ] }),
5980
6005
  isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AccountIdentityFooter, {}) : null
5981
6006
  ] });
@@ -6568,6 +6593,7 @@ function useCheckoutFlow(opts) {
6568
6593
  const planCtx = usePlanSelector();
6569
6594
  const planSelection = usePlanSelection();
6570
6595
  const transport = useTransport();
6596
+ const copy = useCopy();
6571
6597
  const locale = useLocale();
6572
6598
  const balance = useBalance();
6573
6599
  const { creditsPerMinorUnit, displayExchangeRate, adjustBalance } = balance;
@@ -6623,7 +6649,23 @@ function useCheckoutFlow(opts) {
6623
6649
  setError(null);
6624
6650
  setStatus("activating");
6625
6651
  try {
6626
- await transport.activatePlan({ productRef, planRef: selectedPlanRef });
6652
+ const result = await transport.activatePlan({ productRef, planRef: selectedPlanRef });
6653
+ switch (result.status) {
6654
+ case "activated":
6655
+ case "already_active":
6656
+ case "already_purchased":
6657
+ break;
6658
+ case "topup_required":
6659
+ setStatus("idle");
6660
+ setStep("amount");
6661
+ return true;
6662
+ case "payment_required":
6663
+ throw new Error(copy.activation.paymentRequired);
6664
+ case "invalid":
6665
+ throw new Error(result.message ?? copy.activation.invalidConfiguration);
6666
+ default:
6667
+ throw new Error(copy.activation.unexpectedResponse);
6668
+ }
6627
6669
  const credits = await balance.refetch() ?? balance.credits;
6628
6670
  if (credits == null) {
6629
6671
  throw new Error("Credit balance is unavailable");
@@ -6649,7 +6691,17 @@ function useCheckoutFlow(opts) {
6649
6691
  onErrorRef.current?.(wrapped, "activate");
6650
6692
  return false;
6651
6693
  }
6652
- }, [balance, locale, productRef, selectedPlanRef, selectedPlanShape, transport]);
6694
+ }, [
6695
+ balance,
6696
+ copy.activation.invalidConfiguration,
6697
+ copy.activation.paymentRequired,
6698
+ copy.activation.unexpectedResponse,
6699
+ locale,
6700
+ productRef,
6701
+ selectedPlanRef,
6702
+ selectedPlanShape,
6703
+ transport
6704
+ ]);
6653
6705
  const advanceFromPlan = (0, import_react30.useCallback)(async () => {
6654
6706
  if (!selectedPlanShape || !selectedPlanRef) return;
6655
6707
  if (branch === "payg") {
@@ -6687,7 +6739,15 @@ function useCheckoutFlow(opts) {
6687
6739
  }
6688
6740
  setError(null);
6689
6741
  setStep("payment");
6690
- }, [balance, branch, locale, planCtx.currentPlanRef, runActivate, selectedPlanRef, selectedPlanShape]);
6742
+ }, [
6743
+ balance,
6744
+ branch,
6745
+ locale,
6746
+ planCtx.currentPlanRef,
6747
+ runActivate,
6748
+ selectedPlanRef,
6749
+ selectedPlanShape
6750
+ ]);
6691
6751
  const recordPaygSuccess = (0, import_react30.useCallback)(
6692
6752
  (creditsAddedFromBackend) => {
6693
6753
  if (!selectedPlanShape || selectedAmountMinor == null) return;
@@ -7284,6 +7344,57 @@ function useAmountPicker() {
7284
7344
  return usePickerCtx("useAmountPicker");
7285
7345
  }
7286
7346
 
7347
+ // src/mcp/format-compact-credits.ts
7348
+ function formatCompactCredits(credits, locale = "en-US") {
7349
+ if (!Number.isFinite(credits) || credits < 0) {
7350
+ throw new Error(`formatCompactCredits: credits must be a finite non-negative number, got ${credits}`);
7351
+ }
7352
+ if (credits >= 1e6 && credits % 1e6 === 0) {
7353
+ return `${credits / 1e6}M credits`;
7354
+ }
7355
+ if (credits >= 1e3 && credits % 1e3 === 0) {
7356
+ return `${credits / 1e3}K credits`;
7357
+ }
7358
+ return `${credits.toLocaleString(locale)} credits`;
7359
+ }
7360
+
7361
+ // src/mcp/views/PresetAmountGrid.tsx
7362
+ var import_jsx_runtime27 = require("react/jsx-runtime");
7363
+ function estimateTopupCredits(amountMinor, payCurrency, displayCurrency, creditsPerMinorUnit, displayExchangeRate) {
7364
+ const rateAppliesToCurrency = displayCurrency != null && payCurrency.toUpperCase() === displayCurrency.toUpperCase();
7365
+ if (!rateAppliesToCurrency || creditsPerMinorUnit == null || creditsPerMinorUnit <= 0 || displayExchangeRate == null || displayExchangeRate <= 0) {
7366
+ return { kind: "unavailable" };
7367
+ }
7368
+ const credits = Math.floor(amountMinor / displayExchangeRate * creditsPerMinorUnit);
7369
+ return { kind: "available", credits };
7370
+ }
7371
+ function PresetAmountGrid({
7372
+ currencyDisplay
7373
+ }) {
7374
+ const locale = useHostLocale();
7375
+ const { quickAmounts, currency, creditsPerMinorUnit, displayExchangeRate } = useAmountPicker();
7376
+ const { displayCurrency } = useBalance();
7377
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "solvapay-mcp-preset-grid", "aria-label": "Quick amounts", children: quickAmounts.map((amount) => {
7378
+ const minor = amount * getMinorUnitsPerMajor(currency);
7379
+ const label = formatPrice(minor, currency, {
7380
+ locale,
7381
+ free: "",
7382
+ currencyDisplay
7383
+ });
7384
+ const estimate = estimateTopupCredits(
7385
+ minor,
7386
+ currency,
7387
+ displayCurrency,
7388
+ creditsPerMinorUnit,
7389
+ displayExchangeRate
7390
+ );
7391
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(AmountPicker.Option, { amount, className: "solvapay-mcp-preset-tile", children: [
7392
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "solvapay-mcp-preset-tile-amount", children: label }),
7393
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "solvapay-mcp-preset-tile-credits", children: estimate.kind === "available" ? formatCompactCredits(estimate.credits, locale) : "" })
7394
+ ] }, amount);
7395
+ }) });
7396
+ }
7397
+
7287
7398
  // src/mcp/views/autoRecharge/McpInlineAutoRecharge.tsx
7288
7399
  var import_react34 = require("react");
7289
7400
 
@@ -7454,7 +7565,7 @@ function validateAutoRechargeForm(form, currency, conversion, messages = DEFAULT
7454
7565
  }
7455
7566
 
7456
7567
  // src/mcp/views/autoRecharge/McpAutoRechargeFields.tsx
7457
- var import_jsx_runtime27 = require("react/jsx-runtime");
7568
+ var import_jsx_runtime28 = require("react/jsx-runtime");
7458
7569
  function currencySymbol(currency) {
7459
7570
  try {
7460
7571
  const parts = new Intl.NumberFormat("en", {
@@ -7487,8 +7598,8 @@ function McpAutoRechargeFields({
7487
7598
  const explainer = credits != null ? interpolate(copy.autoRechargeView.explainer, {
7488
7599
  credits: new Intl.NumberFormat().format(credits)
7489
7600
  }) : copy.autoRechargeView.explainerNoEstimate;
7490
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "solvapay-mcp-auto-recharge-fields", children: [
7491
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
7601
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "solvapay-mcp-auto-recharge-fields", children: [
7602
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7492
7603
  Field,
7493
7604
  {
7494
7605
  id: "mcp-auto-recharge-threshold",
@@ -7499,7 +7610,7 @@ function McpAutoRechargeFields({
7499
7610
  onChange: (thresholdAmountMajor) => onChange({ ...form, thresholdAmountMajor })
7500
7611
  }
7501
7612
  ),
7502
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
7613
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7503
7614
  Field,
7504
7615
  {
7505
7616
  id: "mcp-auto-recharge-topup",
@@ -7510,7 +7621,7 @@ function McpAutoRechargeFields({
7510
7621
  onChange: (topupAmountMajor) => onChange({ ...form, topupAmountMajor })
7511
7622
  }
7512
7623
  ),
7513
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
7624
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7514
7625
  Field,
7515
7626
  {
7516
7627
  id: "mcp-auto-recharge-cap",
@@ -7522,13 +7633,13 @@ function McpAutoRechargeFields({
7522
7633
  onChange: (maxMonthlySpendMajor) => onChange({ ...form, maxMonthlySpendMajor })
7523
7634
  }
7524
7635
  ),
7525
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "solvapay-mcp-auto-recharge-fields-explainer", children: explainer }),
7526
- validationError ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "solvapay-mcp-auto-recharge-fields-error", role: "alert", children: validationError }) : null
7636
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "solvapay-mcp-auto-recharge-fields-explainer", children: explainer }),
7637
+ validationError ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "solvapay-mcp-auto-recharge-fields-error", role: "alert", children: validationError }) : null
7527
7638
  ] });
7528
7639
  }
7529
7640
 
7530
7641
  // src/mcp/views/autoRecharge/McpInlineAutoRecharge.tsx
7531
- var import_jsx_runtime28 = require("react/jsx-runtime");
7642
+ var import_jsx_runtime29 = require("react/jsx-runtime");
7532
7643
  var McpInlineAutoRecharge = (0, import_react34.forwardRef)(function McpInlineAutoRecharge2({ currency, creditsPerMinorUnit, displayExchangeRate }, ref) {
7533
7644
  const copy = useCopy();
7534
7645
  const [form, setForm] = (0, import_react34.useState)(() => createDefaultAutoRechargeForm(currency));
@@ -7552,10 +7663,10 @@ var McpInlineAutoRecharge = (0, import_react34.forwardRef)(function McpInlineAut
7552
7663
  };
7553
7664
  }
7554
7665
  }));
7555
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "solvapay-mcp-auto-recharge-inline", children: [
7556
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(SplitRow, { children: [
7557
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { children: copy.autoRechargeView.heading }),
7558
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7666
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "solvapay-mcp-auto-recharge-inline", children: [
7667
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(SplitRow, { children: [
7668
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { children: copy.autoRechargeView.heading }),
7669
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
7559
7670
  Toggle,
7560
7671
  {
7561
7672
  checked: form.enabled,
@@ -7567,7 +7678,7 @@ var McpInlineAutoRecharge = (0, import_react34.forwardRef)(function McpInlineAut
7567
7678
  }
7568
7679
  )
7569
7680
  ] }),
7570
- form.enabled ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7681
+ form.enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
7571
7682
  McpAutoRechargeFields,
7572
7683
  {
7573
7684
  form,
@@ -7585,7 +7696,7 @@ var McpInlineAutoRecharge = (0, import_react34.forwardRef)(function McpInlineAut
7585
7696
  });
7586
7697
 
7587
7698
  // src/mcp/views/checkout/steps/AmountStep.tsx
7588
- var import_jsx_runtime29 = require("react/jsx-runtime");
7699
+ var import_jsx_runtime30 = require("react/jsx-runtime");
7589
7700
  var AmountStep = (0, import_react35.memo)(function AmountStep2({
7590
7701
  topupCurrency,
7591
7702
  topupCurrencies,
@@ -7602,23 +7713,23 @@ var AmountStep = (0, import_react35.memo)(function AmountStep2({
7602
7713
  const currencies = topupCurrencies ?? [];
7603
7714
  const showCurrencySwitch = currencies.length > 1 && !!onCurrencyChange;
7604
7715
  const currencyDisplay = showCurrencySwitch ? "code" : "symbol";
7605
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
7606
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BackLink, { label: "Back", onClick: onBack }),
7607
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "solvapay-mcp-step-header", children: [
7608
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h2", { className: cx2.heading, children: "How many credits?" }),
7609
- showCurrencySwitch && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
7716
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
7717
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(BackLink, { label: "Back", onClick: onBack }),
7718
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "solvapay-mcp-step-header", children: [
7719
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h2", { className: cx2.heading, children: "How many credits?" }),
7720
+ showCurrencySwitch && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
7610
7721
  "select",
7611
7722
  {
7612
7723
  className: "solvapay-mcp-currency-switch",
7613
7724
  value: currency,
7614
7725
  onChange: (event) => onCurrencyChange?.(event.target.value),
7615
7726
  "aria-label": "Topup currency",
7616
- children: currencies.map((code) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: code, children: code }, code))
7727
+ children: currencies.map((code) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: code, children: code }, code))
7617
7728
  }
7618
7729
  )
7619
7730
  ] }),
7620
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: cx2.muted, children: "Top up to start using the tool." }),
7621
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
7731
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: cx2.muted, children: "Top up to start using the tool." }),
7732
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
7622
7733
  AmountPicker.Root,
7623
7734
  {
7624
7735
  currency,
@@ -7626,9 +7737,9 @@ var AmountStep = (0, import_react35.memo)(function AmountStep2({
7626
7737
  className: cx2.amountPicker,
7627
7738
  onChange: (value) => setStagedAmountMinor(value),
7628
7739
  children: [
7629
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PresetAmountRow, { cx: cx2, currencyDisplay }),
7630
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomAmountRow, { rowClassName: cx2.amountCustom, currencyDisplay }),
7631
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
7740
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PresetAmountGrid, { currencyDisplay }),
7741
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CustomAmountRow, { rowClassName: cx2.amountCustom, currencyDisplay }),
7742
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
7632
7743
  McpInlineAutoRecharge,
7633
7744
  {
7634
7745
  ref: autoRechargeRef,
@@ -7637,7 +7748,7 @@ var AmountStep = (0, import_react35.memo)(function AmountStep2({
7637
7748
  displayExchangeRate
7638
7749
  }
7639
7750
  ),
7640
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
7751
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
7641
7752
  AmountPicker.Confirm,
7642
7753
  {
7643
7754
  className: cx2.button,
@@ -7657,41 +7768,15 @@ var AmountStep = (0, import_react35.memo)(function AmountStep2({
7657
7768
  )
7658
7769
  ] });
7659
7770
  });
7660
- function PresetAmountRow({
7661
- cx: cx2,
7662
- currencyDisplay
7663
- }) {
7664
- const { quickAmounts, currency } = useAmountPicker();
7665
- const locale = useHostLocale();
7666
- const popularIndex = Math.min(1, quickAmounts.length - 1);
7667
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cx2.amountOptions, children: quickAmounts.map((amount, i) => {
7668
- const label = formatPrice(amount * getMinorUnitsPerMajor(currency), currency, {
7669
- locale,
7670
- free: "",
7671
- currencyDisplay
7672
- });
7673
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
7674
- AmountPicker.Option,
7675
- {
7676
- amount,
7677
- className: cx2.amountOption,
7678
- "data-popular": i === popularIndex ? "" : void 0,
7679
- "aria-label": `${label}${i === popularIndex ? " (popular)" : ""}`,
7680
- children: label
7681
- },
7682
- amount
7683
- );
7684
- }) });
7685
- }
7686
7771
  function CustomAmountRow({
7687
7772
  rowClassName,
7688
7773
  currencyDisplay
7689
7774
  }) {
7690
7775
  const { currencySymbol: currencySymbol2, currency } = useAmountPicker();
7691
7776
  const prefix = currencyDisplay === "code" ? currency.toUpperCase() : currencySymbol2;
7692
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: rowClassName, children: [
7693
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "solvapay-mcp-amount-currency-symbol", children: prefix }),
7694
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AmountPicker.Custom, { className: "solvapay-mcp-amount-custom-input", placeholder: "0.00" })
7777
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: rowClassName, children: [
7778
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "solvapay-mcp-amount-currency-symbol", children: prefix }),
7779
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AmountPicker.Custom, { className: "solvapay-mcp-amount-custom-input", placeholder: "0.00" })
7695
7780
  ] });
7696
7781
  }
7697
7782
 
@@ -7822,7 +7907,7 @@ var SOLVAPAY_PRIVACY_URL = "https://solvapay.com/legal/privacy";
7822
7907
  var SOLVAPAY_WEBSITE_URL = "https://solvapay.com";
7823
7908
 
7824
7909
  // src/primitives/MandateText.tsx
7825
- var import_jsx_runtime30 = require("react/jsx-runtime");
7910
+ var import_jsx_runtime31 = require("react/jsx-runtime");
7826
7911
  var MandateText = (0, import_react37.forwardRef)(
7827
7912
  function MandateText2({
7828
7913
  planRef,
@@ -7886,7 +7971,7 @@ var MandateText = (0, import_react37.forwardRef)(
7886
7971
  const text = typeof template === "function" ? template(ctx) : template;
7887
7972
  if (!text) return null;
7888
7973
  const Comp = asChild ? Slot : "p";
7889
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
7974
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7890
7975
  Comp,
7891
7976
  {
7892
7977
  ref: forwardedRef,
@@ -7918,7 +8003,7 @@ function linkifyMandateText(text, ctx, copy, onLinkClick) {
7918
8003
  return text.split(pattern).map((part, i) => {
7919
8004
  const match = entries.find((e) => e.url === part);
7920
8005
  if (!match) return part;
7921
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
8006
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7922
8007
  "a",
7923
8008
  {
7924
8009
  href: match.url,
@@ -8003,7 +8088,7 @@ function toStripeElementLocale(locale) {
8003
8088
 
8004
8089
  // src/primitives/LegalFooter.tsx
8005
8090
  var import_react38 = require("react");
8006
- var import_jsx_runtime31 = require("react/jsx-runtime");
8091
+ var import_jsx_runtime32 = require("react/jsx-runtime");
8007
8092
  var LegalFooter = (0, import_react38.forwardRef)(
8008
8093
  function LegalFooter2({
8009
8094
  attribution = "provided",
@@ -8017,9 +8102,9 @@ var LegalFooter = (0, import_react38.forwardRef)(
8017
8102
  const handleExternalClick = useExternalLinkClick();
8018
8103
  const attributionLabel = attribution === "provided" ? copy.legalFooter.providedBy : attribution === "powered" ? copy.legalFooter.poweredBy : null;
8019
8104
  const Comp = asChild ? Slot : "div";
8020
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Comp, { ref: forwardedRef, "data-solvapay-legal-footer": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
8021
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { "data-solvapay-legal-footer-links": "", children: [
8022
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
8105
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Comp, { ref: forwardedRef, "data-solvapay-legal-footer": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
8106
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { "data-solvapay-legal-footer-links": "", children: [
8107
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
8023
8108
  "a",
8024
8109
  {
8025
8110
  "data-solvapay-legal-footer-link": "",
@@ -8030,8 +8115,8 @@ var LegalFooter = (0, import_react38.forwardRef)(
8030
8115
  children: copy.legalFooter.terms
8031
8116
  }
8032
8117
  ),
8033
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { "aria-hidden": "true", children: " \xB7 " }),
8034
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
8118
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { "data-solvapay-legal-footer-separator": "", "aria-hidden": "true", children: " \xB7 " }),
8119
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
8035
8120
  "a",
8036
8121
  {
8037
8122
  "data-solvapay-legal-footer-link": "",
@@ -8043,7 +8128,7 @@ var LegalFooter = (0, import_react38.forwardRef)(
8043
8128
  }
8044
8129
  )
8045
8130
  ] }),
8046
- attributionLabel ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
8131
+ attributionLabel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
8047
8132
  "a",
8048
8133
  {
8049
8134
  "data-solvapay-legal-footer-attribution": "",
@@ -8343,11 +8428,11 @@ function useTopup(options) {
8343
8428
  }
8344
8429
 
8345
8430
  // src/components/Spinner.tsx
8346
- var import_jsx_runtime32 = require("react/jsx-runtime");
8431
+ var import_jsx_runtime33 = require("react/jsx-runtime");
8347
8432
  var SIZE_PX = { sm: 16, md: 20, lg: 24 };
8348
8433
  var Spinner = ({ className, size = "md" }) => {
8349
8434
  const px2 = SIZE_PX[size];
8350
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
8435
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
8351
8436
  "svg",
8352
8437
  {
8353
8438
  "data-solvapay-spinner": "",
@@ -8358,7 +8443,7 @@ var Spinner = ({ className, size = "md" }) => {
8358
8443
  fill: "none",
8359
8444
  "aria-hidden": "true",
8360
8445
  children: [
8361
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
8446
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
8362
8447
  "circle",
8363
8448
  {
8364
8449
  cx: "12",
@@ -8369,7 +8454,7 @@ var Spinner = ({ className, size = "md" }) => {
8369
8454
  strokeOpacity: "0.25"
8370
8455
  }
8371
8456
  ),
8372
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
8457
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
8373
8458
  "path",
8374
8459
  {
8375
8460
  fill: "currentColor",
@@ -8490,7 +8575,7 @@ var import_core15 = require("@solvapay/core");
8490
8575
  // src/components/businessCheckoutParts.tsx
8491
8576
  var import_react41 = require("react");
8492
8577
  var import_core14 = require("@solvapay/core");
8493
- var import_jsx_runtime33 = require("react/jsx-runtime");
8578
+ var import_jsx_runtime34 = require("react/jsx-runtime");
8494
8579
  function mapBusinessFieldErrors(input) {
8495
8580
  const result = (0, import_core14.validateBusinessDetails)(input);
8496
8581
  if (result.success) return {};
@@ -8553,7 +8638,7 @@ function createBusinessDetailsParts(useCtx, prefix) {
8553
8638
  const Root8 = (0, import_react41.forwardRef)(function BusinessDetailsRoot({ asChild, children, ...rest }, forwardedRef) {
8554
8639
  useCtx("BusinessDetails");
8555
8640
  const Comp = asChild ? Slot : "section";
8556
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "business-details")]: "" }, ...rest, children });
8641
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "business-details")]: "" }, ...rest, children });
8557
8642
  });
8558
8643
  const Toggle2 = (0, import_react41.forwardRef)(function BusinessDetailsToggle({ asChild, onChange, ...rest }, forwardedRef) {
8559
8644
  const ctx = useCtx("BusinessDetails.Toggle");
@@ -8567,9 +8652,9 @@ function createBusinessDetailsParts(useCtx, prefix) {
8567
8652
  ...rest
8568
8653
  };
8569
8654
  if (asChild) {
8570
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Slot, { ref: forwardedRef, ...commonProps });
8655
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Slot, { ref: forwardedRef, ...commonProps });
8571
8656
  }
8572
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { ref: forwardedRef, ...commonProps });
8657
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { ref: forwardedRef, ...commonProps });
8573
8658
  });
8574
8659
  const BusinessName = (0, import_react41.forwardRef)(
8575
8660
  function BusinessDetailsBusinessName({ asChild, onChange, ...rest }, forwardedRef) {
@@ -8586,9 +8671,9 @@ function createBusinessDetailsParts(useCtx, prefix) {
8586
8671
  ...rest
8587
8672
  };
8588
8673
  if (asChild) {
8589
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Slot, { ref: forwardedRef, ...commonProps });
8674
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Slot, { ref: forwardedRef, ...commonProps });
8590
8675
  }
8591
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { ref: forwardedRef, ...commonProps });
8676
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { ref: forwardedRef, ...commonProps });
8592
8677
  }
8593
8678
  );
8594
8679
  const Country = (0, import_react41.forwardRef)(function BusinessDetailsCountry({ asChild, onChange, children, ...rest }, forwardedRef) {
@@ -8611,14 +8696,14 @@ function createBusinessDetailsParts(useCtx, prefix) {
8611
8696
  });
8612
8697
  })
8613
8698
  };
8614
- const defaultOptions = /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
8615
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "", children: "Select country" }),
8616
- import_core14.BUSINESS_COUNTRY_OPTIONS.map(({ value, label }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value, children: label }, value))
8699
+ const defaultOptions = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
8700
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "", children: "Select country" }),
8701
+ import_core14.BUSINESS_COUNTRY_OPTIONS.map(({ value, label }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value, children: label }, value))
8617
8702
  ] });
8618
8703
  if (asChild) {
8619
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Slot, { ref: forwardedRef, ...commonProps, children: children ?? defaultOptions });
8704
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Slot, { ref: forwardedRef, ...commonProps, children: children ?? defaultOptions });
8620
8705
  }
8621
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("select", { ref: forwardedRef, ...commonProps, children: children ?? defaultOptions });
8706
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("select", { ref: forwardedRef, ...commonProps, children: children ?? defaultOptions });
8622
8707
  });
8623
8708
  const State = (0, import_react41.forwardRef)(function BusinessDetailsState({ asChild, onChange, ...rest }, forwardedRef) {
8624
8709
  const ctx = useCtx("BusinessDetails.State");
@@ -8636,9 +8721,9 @@ function createBusinessDetailsParts(useCtx, prefix) {
8636
8721
  })
8637
8722
  };
8638
8723
  if (asChild) {
8639
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Slot, { ref: forwardedRef, ...commonProps });
8724
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Slot, { ref: forwardedRef, ...commonProps });
8640
8725
  }
8641
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { ref: forwardedRef, ...commonProps });
8726
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { ref: forwardedRef, ...commonProps });
8642
8727
  });
8643
8728
  const PostalCode = (0, import_react41.forwardRef)(function BusinessDetailsPostalCode({ asChild, onChange, ...rest }, forwardedRef) {
8644
8729
  const ctx = useCtx("BusinessDetails.PostalCode");
@@ -8657,9 +8742,9 @@ function createBusinessDetailsParts(useCtx, prefix) {
8657
8742
  })
8658
8743
  };
8659
8744
  if (asChild) {
8660
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Slot, { ref: forwardedRef, ...commonProps });
8745
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Slot, { ref: forwardedRef, ...commonProps });
8661
8746
  }
8662
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { ref: forwardedRef, ...commonProps });
8747
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { ref: forwardedRef, ...commonProps });
8663
8748
  });
8664
8749
  const TaxId = (0, import_react41.forwardRef)(function BusinessDetailsTaxId({ asChild, onChange, ...rest }, forwardedRef) {
8665
8750
  const ctx = useCtx("BusinessDetails.TaxId");
@@ -8675,9 +8760,9 @@ function createBusinessDetailsParts(useCtx, prefix) {
8675
8760
  ...rest
8676
8761
  };
8677
8762
  if (asChild) {
8678
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Slot, { ref: forwardedRef, ...commonProps });
8763
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Slot, { ref: forwardedRef, ...commonProps });
8679
8764
  }
8680
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { ref: forwardedRef, ...commonProps });
8765
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { ref: forwardedRef, ...commonProps });
8681
8766
  });
8682
8767
  const Fields = (0, import_react41.forwardRef)(function BusinessDetailsFields({ asChild, children, ...rest }, forwardedRef) {
8683
8768
  const ctx = useCtx("BusinessDetails.Fields");
@@ -8687,40 +8772,40 @@ function createBusinessDetailsParts(useCtx, prefix) {
8687
8772
  const taxIdHelperText = resolveTaxIdHelperText(country);
8688
8773
  const showState = !!country && (0, import_core14.isStateRequired)(country);
8689
8774
  const showPostal = !!country && (0, import_core14.isPostalCodeRequired)(country);
8690
- const content = /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
8691
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "solvapay-business-field", children: [
8692
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "solvapay-business-field-label", children: "Country" }),
8693
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Country, {})
8775
+ const content = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
8776
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "solvapay-business-field", children: [
8777
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "solvapay-business-field-label", children: "Country" }),
8778
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Country, {})
8694
8779
  ] }),
8695
- showState ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "solvapay-business-field", children: [
8696
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "solvapay-business-field-label", children: (0, import_core14.getStateFieldLabel)(country) }),
8697
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(State, {})
8780
+ showState ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "solvapay-business-field", children: [
8781
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "solvapay-business-field-label", children: (0, import_core14.getStateFieldLabel)(country) }),
8782
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(State, {})
8698
8783
  ] }) : null,
8699
- showPostal ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "solvapay-business-field", children: [
8700
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "solvapay-business-field-label", children: (0, import_core14.getPostalCodeFieldLabel)(country) }),
8701
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PostalCode, {})
8784
+ showPostal ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "solvapay-business-field", children: [
8785
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "solvapay-business-field-label", children: (0, import_core14.getPostalCodeFieldLabel)(country) }),
8786
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PostalCode, {})
8702
8787
  ] }) : null,
8703
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "solvapay-checkout-business-toggle", children: [
8704
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Toggle2, {}),
8788
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "solvapay-checkout-business-toggle", children: [
8789
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Toggle2, {}),
8705
8790
  "I'm purchasing as a business"
8706
8791
  ] }),
8707
- ctx.businessDetails.isBusiness ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("fieldset", { className: "solvapay-business-fields", children: [
8708
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "solvapay-business-field", children: [
8709
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "solvapay-business-field-label", children: "Business name" }),
8710
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BusinessName, { placeholder: "Acme GmbH" })
8792
+ ctx.businessDetails.isBusiness ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("fieldset", { className: "solvapay-business-fields", children: [
8793
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "solvapay-business-field", children: [
8794
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "solvapay-business-field-label", children: "Business name" }),
8795
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BusinessName, { placeholder: "Acme GmbH" })
8711
8796
  ] }),
8712
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "solvapay-business-field", children: [
8713
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "solvapay-business-field-label", children: taxIdLabel }),
8714
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TaxId, { placeholder: taxIdPlaceholder }),
8715
- taxIdHelperText ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "solvapay-business-field-hint", children: taxIdHelperText }) : null
8797
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "solvapay-business-field", children: [
8798
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "solvapay-business-field-label", children: taxIdLabel }),
8799
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TaxId, { placeholder: taxIdPlaceholder }),
8800
+ taxIdHelperText ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "solvapay-business-field-hint", children: taxIdHelperText }) : null
8716
8801
  ] })
8717
8802
  ] }) : null,
8718
8803
  children
8719
8804
  ] });
8720
8805
  if (asChild) {
8721
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Slot, { ref: forwardedRef, ...rest, children: content });
8806
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Slot, { ref: forwardedRef, ...rest, children: content });
8722
8807
  }
8723
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("section", { ref: forwardedRef, ...{ [attr(prefix, "business-details-fields")]: "" }, ...rest, children: content });
8808
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("section", { ref: forwardedRef, ...{ [attr(prefix, "business-details-fields")]: "" }, ...rest, children: content });
8724
8809
  });
8725
8810
  return {
8726
8811
  Root: Root8,
@@ -8757,14 +8842,14 @@ function createTaxSummaryParts(useCtx, prefix) {
8757
8842
  const ctx = useCtx("Summary");
8758
8843
  if (!ctx.isBusiness) return null;
8759
8844
  const Comp = asChild ? Slot : "section";
8760
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary")]: "" }, ...rest, children });
8845
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary")]: "" }, ...rest, children });
8761
8846
  });
8762
8847
  const Subtotal = (0, import_react41.forwardRef)(function TaxSummarySubtotal({ asChild, children, ...rest }, forwardedRef) {
8763
8848
  const ctx = useCtx("Summary.Subtotal");
8764
8849
  const { subtotalFormatted } = useSummaryAmounts(useCtx, "Summary.Subtotal");
8765
8850
  if (!ctx.isBusiness) return null;
8766
8851
  const Comp = asChild ? Slot : "span";
8767
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-subtotal")]: "" }, ...rest, children: children ?? subtotalFormatted });
8852
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-subtotal")]: "" }, ...rest, children: children ?? subtotalFormatted });
8768
8853
  });
8769
8854
  const Tax = (0, import_react41.forwardRef)(function TaxSummaryTax({ asChild, children, ...rest }, forwardedRef) {
8770
8855
  const ctx = useCtx("Summary.Tax");
@@ -8776,10 +8861,10 @@ function createTaxSummaryParts(useCtx, prefix) {
8776
8861
  treatment: treatment ?? "standard",
8777
8862
  taxRate
8778
8863
  });
8779
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-tax")]: "" }, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
8780
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: defaultLabel }),
8864
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-tax")]: "" }, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
8865
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: defaultLabel }),
8781
8866
  " ",
8782
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { ...{ [attr(prefix, "summary-tax-amount")]: "" }, children: taxFormatted })
8867
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { ...{ [attr(prefix, "summary-tax-amount")]: "" }, children: taxFormatted })
8783
8868
  ] }) });
8784
8869
  });
8785
8870
  const Total = (0, import_react41.forwardRef)(function TaxSummaryTotal({ asChild, children, ...rest }, forwardedRef) {
@@ -8787,7 +8872,7 @@ function createTaxSummaryParts(useCtx, prefix) {
8787
8872
  const { totalFormatted } = useSummaryAmounts(useCtx, "Summary.Total");
8788
8873
  if (!ctx.isBusiness) return null;
8789
8874
  const Comp = asChild ? Slot : "span";
8790
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-total")]: "" }, ...rest, children: children ?? totalFormatted });
8875
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-total")]: "" }, ...rest, children: children ?? totalFormatted });
8791
8876
  });
8792
8877
  const TaxNote = (0, import_react41.forwardRef)(function TaxSummaryTaxNote({ asChild, children, ...rest }, forwardedRef) {
8793
8878
  const ctx = useCtx("Summary.TaxNote");
@@ -8797,7 +8882,7 @@ function createTaxSummaryParts(useCtx, prefix) {
8797
8882
  const Comp = asChild ? Slot : "p";
8798
8883
  const defaultNote = treatment === "reverse_charge" ? REVERSE_CHARGE_NOTE : treatment === "not_collecting" || treatment === "not_supported" ? TAX_NOT_COLLECTED_NOTE : null;
8799
8884
  if (!defaultNote && !children) return null;
8800
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-tax-note")]: "" }, ...rest, children: children ?? defaultNote });
8885
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-tax-note")]: "" }, ...rest, children: children ?? defaultNote });
8801
8886
  });
8802
8887
  const Rows = (0, import_react41.forwardRef)(function TaxSummaryRows({ asChild, children, ...rest }, forwardedRef) {
8803
8888
  const ctx = useCtx("Summary.Rows");
@@ -8808,26 +8893,26 @@ function createTaxSummaryParts(useCtx, prefix) {
8808
8893
  treatment: treatment ?? "standard",
8809
8894
  taxRate
8810
8895
  });
8811
- const content = /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("dl", { className: "solvapay-tax-summary-rows", children: [
8812
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "solvapay-tax-summary-row", children: [
8813
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("dt", { children: formatSubtotalLabel(treatment) }),
8814
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Subtotal, {}) })
8896
+ const content = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("dl", { className: "solvapay-tax-summary-rows", children: [
8897
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "solvapay-tax-summary-row", children: [
8898
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("dt", { children: formatSubtotalLabel(treatment) }),
8899
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Subtotal, {}) })
8815
8900
  ] }),
8816
- showTaxRow ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "solvapay-tax-summary-row", children: [
8817
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("dt", { children: vatLabel }),
8818
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { ...{ [attr(prefix, "summary-tax-amount")]: "" }, children: taxFormatted }) })
8901
+ showTaxRow ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "solvapay-tax-summary-row", children: [
8902
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("dt", { children: vatLabel }),
8903
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { ...{ [attr(prefix, "summary-tax-amount")]: "" }, children: taxFormatted }) })
8819
8904
  ] }) : null,
8820
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "solvapay-tax-summary-row solvapay-tax-summary-row--total", children: [
8821
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("dt", { children: "Total" }),
8822
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Total, {}) })
8905
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "solvapay-tax-summary-row solvapay-tax-summary-row--total", children: [
8906
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("dt", { children: "Total" }),
8907
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Total, {}) })
8823
8908
  ] }),
8824
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TaxNote, {}),
8909
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TaxNote, {}),
8825
8910
  children
8826
8911
  ] });
8827
8912
  if (asChild) {
8828
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Slot, { ref: forwardedRef, ...rest, children: content });
8913
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Slot, { ref: forwardedRef, ...rest, children: content });
8829
8914
  }
8830
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("section", { ref: forwardedRef, ...{ [attr(prefix, "summary-rows")]: "" }, ...rest, children: content });
8915
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("section", { ref: forwardedRef, ...{ [attr(prefix, "summary-rows")]: "" }, ...rest, children: content });
8831
8916
  });
8832
8917
  return {
8833
8918
  Root: Root8,
@@ -8955,7 +9040,7 @@ function useBusinessDetailsAttach(options) {
8955
9040
  }
8956
9041
 
8957
9042
  // src/primitives/TopupForm.tsx
8958
- var import_jsx_runtime34 = require("react/jsx-runtime");
9043
+ var import_jsx_runtime35 = require("react/jsx-runtime");
8959
9044
  var TopupFormContext = (0, import_react43.createContext)(null);
8960
9045
  function useTopupCtx(part) {
8961
9046
  const ctx = (0, import_react43.useContext)(TopupFormContext);
@@ -9050,7 +9135,7 @@ var Root5 = (0, import_react43.forwardRef)(function TopupFormRoot(props, forward
9050
9135
  };
9051
9136
  const rootRef = composeRefs(forwardedRef, attachRoot);
9052
9137
  if (asChild) {
9053
- const slotted = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9138
+ const slotted = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
9054
9139
  Slot,
9055
9140
  {
9056
9141
  ref: rootRef,
@@ -9062,11 +9147,11 @@ var Root5 = (0, import_react43.forwardRef)(function TopupFormRoot(props, forward
9062
9147
  }
9063
9148
  );
9064
9149
  if (canMountElements) {
9065
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_stripe_js.Elements, { stripe: stripePromise, options: elementsOptions, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Inner, { ...innerCommon, children: slotted }) }, clientSecret);
9150
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_stripe_js.Elements, { stripe: stripePromise, options: elementsOptions, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Inner, { ...innerCommon, children: slotted }) }, clientSecret);
9066
9151
  }
9067
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(OfflineInner, { ...innerCommon, children: slotted });
9152
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(OfflineInner, { ...innerCommon, children: slotted });
9068
9153
  }
9069
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9154
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
9070
9155
  "section",
9071
9156
  {
9072
9157
  ref: rootRef,
@@ -9074,7 +9159,7 @@ var Root5 = (0, import_react43.forwardRef)(function TopupFormRoot(props, forward
9074
9159
  "data-solvapay-topup-form": "",
9075
9160
  "data-state": dataState,
9076
9161
  ...rest,
9077
- children: canMountElements ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_stripe_js.Elements, { stripe: stripePromise, options: elementsOptions, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Inner, { ...innerCommon, children }) }, clientSecret) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(OfflineInner, { ...innerCommon, children })
9162
+ children: canMountElements ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_stripe_js.Elements, { stripe: stripePromise, options: elementsOptions, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Inner, { ...innerCommon, children }) }, clientSecret) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(OfflineInner, { ...innerCommon, children })
9078
9163
  }
9079
9164
  );
9080
9165
  });
@@ -9338,7 +9423,7 @@ var Inner = ({
9338
9423
  submit
9339
9424
  ]
9340
9425
  );
9341
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TopupFormContext.Provider, { value: ctx, children });
9426
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TopupFormContext.Provider, { value: ctx, children });
9342
9427
  };
9343
9428
  var OfflineInner = ({
9344
9429
  amount,
@@ -9393,16 +9478,16 @@ var OfflineInner = ({
9393
9478
  noopSubmit
9394
9479
  ]
9395
9480
  );
9396
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TopupFormContext.Provider, { value: ctx, children });
9481
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TopupFormContext.Provider, { value: ctx, children });
9397
9482
  };
9398
9483
  var PaymentElementSlot = ({ options }) => {
9399
9484
  const { setPaymentInputComplete, isReady, stripe, elements } = useTopupCtx("PaymentElement");
9400
9485
  const locale = useLocale();
9401
9486
  if (!stripe || !elements) return null;
9402
9487
  if (!isReady) {
9403
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("output", { "data-solvapay-topup-form-loading": "", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Spinner, { size: "sm" }) });
9488
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("output", { "data-solvapay-topup-form-loading": "", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Spinner, { size: "sm" }) });
9404
9489
  }
9405
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("section", { "data-solvapay-topup-form-payment-element": "", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9490
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("section", { "data-solvapay-topup-form-payment-element": "", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
9406
9491
  import_react_stripe_js.PaymentElement,
9407
9492
  {
9408
9493
  options: withPaymentElementDefaults(options),
@@ -9416,9 +9501,9 @@ var SubmitButton = (0, import_react43.forwardRef)(
9416
9501
  const ctx = useTopupCtx("SubmitButton");
9417
9502
  const copy = useCopy();
9418
9503
  const dataState = ctx.isProcessing ? "processing" : !ctx.canSubmit ? "disabled" : "idle";
9419
- const processingContent = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
9420
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Spinner, { size: "sm" }),
9421
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: copy.cta.processing })
9504
+ const processingContent = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
9505
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Spinner, { size: "sm" }),
9506
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: copy.cta.processing })
9422
9507
  ] });
9423
9508
  const commonProps = {
9424
9509
  "data-solvapay-topup-form-submit": "",
@@ -9438,33 +9523,33 @@ var SubmitButton = (0, import_react43.forwardRef)(
9438
9523
  void 0,
9439
9524
  processingContent
9440
9525
  ) : children;
9441
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Slot, { ref: forwardedRef, ...commonProps, children: slotChild });
9526
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Slot, { ref: forwardedRef, ...commonProps, children: slotChild });
9442
9527
  }
9443
9528
  const content = ctx.isProcessing ? processingContent : children ? children : copy.cta.topUp;
9444
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { ref: forwardedRef, type: "submit", ...commonProps, children: content });
9529
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { ref: forwardedRef, type: "submit", ...commonProps, children: content });
9445
9530
  }
9446
9531
  );
9447
9532
  var Loading3 = (0, import_react43.forwardRef)(function TopupFormLoading({ asChild, children, ...rest }, forwardedRef) {
9448
9533
  const ctx = useTopupCtx("Loading");
9449
9534
  if (ctx.state !== "loading") return null;
9450
9535
  if (asChild) {
9451
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9536
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
9452
9537
  Slot,
9453
9538
  {
9454
9539
  ref: forwardedRef,
9455
9540
  "data-solvapay-topup-form-loading": "",
9456
9541
  ...rest,
9457
- children: children ?? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Spinner, { size: "sm" })
9542
+ children: children ?? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Spinner, { size: "sm" })
9458
9543
  }
9459
9544
  );
9460
9545
  }
9461
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("output", { ref: forwardedRef, "data-solvapay-topup-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Spinner, { size: "sm" }) });
9546
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("output", { ref: forwardedRef, "data-solvapay-topup-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Spinner, { size: "sm" }) });
9462
9547
  });
9463
9548
  var ErrorSlot2 = (0, import_react43.forwardRef)(function TopupFormError({ asChild, children, ...rest }, forwardedRef) {
9464
9549
  const ctx = useTopupCtx("Error");
9465
9550
  if (!ctx.error) return null;
9466
9551
  if (asChild) {
9467
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9552
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
9468
9553
  Slot,
9469
9554
  {
9470
9555
  ref: forwardedRef,
@@ -9477,7 +9562,7 @@ var ErrorSlot2 = (0, import_react43.forwardRef)(function TopupFormError({ asChil
9477
9562
  }
9478
9563
  );
9479
9564
  }
9480
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9565
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
9481
9566
  "p",
9482
9567
  {
9483
9568
  ref: forwardedRef,
@@ -9531,27 +9616,27 @@ function chargeAmountMinor(taxBreakdown, amountMinor) {
9531
9616
  }
9532
9617
 
9533
9618
  // src/mcp/views/McpHosted.tsx
9534
- var import_jsx_runtime35 = require("react/jsx-runtime");
9619
+ var import_jsx_runtime36 = require("react/jsx-runtime");
9535
9620
  function McpHostedColumn({
9536
9621
  surface,
9537
9622
  children
9538
9623
  }) {
9539
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "solvapay-mcp-hosted", "data-mcp-surface": surface, children });
9624
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "solvapay-mcp-hosted", "data-mcp-surface": surface, children });
9540
9625
  }
9541
9626
  function McpHostedLayout({ children }) {
9542
9627
  const displayMode = useDisplayMode();
9543
9628
  const rail = resolveHostedRail(displayMode);
9544
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "solvapay-mcp-hosted-layout", "data-rail": rail, children });
9629
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "solvapay-mcp-hosted-layout", "data-rail": rail, children });
9545
9630
  }
9546
9631
  function McpSummaryRail({ children }) {
9547
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("aside", { className: "solvapay-mcp-summary-rail", children });
9632
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("aside", { className: "solvapay-mcp-summary-rail", children });
9548
9633
  }
9549
9634
  function McpHostedBody({ children }) {
9550
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "solvapay-mcp-hosted-body", children });
9635
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "solvapay-mcp-hosted-body", children });
9551
9636
  }
9552
9637
 
9553
9638
  // src/mcp/views/McpPayingAs.tsx
9554
- var import_jsx_runtime36 = require("react/jsx-runtime");
9639
+ var import_jsx_runtime37 = require("react/jsx-runtime");
9555
9640
  function McpPayingAs({ email }) {
9556
9641
  const { email: customerEmail } = useCustomer();
9557
9642
  const { displayMode } = useDisplayMode();
@@ -9559,19 +9644,19 @@ function McpPayingAs({ email }) {
9559
9644
  if (!resolved) return null;
9560
9645
  const variant = displayMode === "fullscreen" ? "stacked" : "inline";
9561
9646
  if (variant === "stacked") {
9562
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "solvapay-mcp-paying-as", "data-variant": "stacked", children: [
9563
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "solvapay-mcp-paying-as-label", children: "Paying as" }),
9564
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "solvapay-mcp-paying-as-email", children: resolved })
9647
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "solvapay-mcp-paying-as", "data-variant": "stacked", children: [
9648
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "solvapay-mcp-paying-as-label", children: "Paying as" }),
9649
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "solvapay-mcp-paying-as-email", children: resolved })
9565
9650
  ] });
9566
9651
  }
9567
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "solvapay-mcp-paying-as", "data-variant": "inline", children: [
9652
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "solvapay-mcp-paying-as", "data-variant": "inline", children: [
9568
9653
  "Paying as ",
9569
9654
  resolved
9570
9655
  ] });
9571
9656
  }
9572
9657
 
9573
9658
  // src/mcp/views/McpPaymentHeader.tsx
9574
- var import_jsx_runtime37 = require("react/jsx-runtime");
9659
+ var import_jsx_runtime38 = require("react/jsx-runtime");
9575
9660
  function McpPaymentHeader({
9576
9661
  backLabel,
9577
9662
  onBack,
@@ -9582,18 +9667,18 @@ function McpPaymentHeader({
9582
9667
  const cx2 = resolveMcpClassNames(classNames);
9583
9668
  const { displayMode } = useDisplayMode();
9584
9669
  const isFullscreen = displayMode === "fullscreen";
9585
- const title = heading ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h2", { className: headingClassName ?? cx2.heading, children: heading }) : null;
9586
- const back = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(BackLink, { label: backLabel, onClick: onBack });
9587
- const payingAs = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(McpPayingAs, {});
9670
+ const title = heading ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { className: headingClassName ?? cx2.heading, children: heading }) : null;
9671
+ const back = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BackLink, { label: backLabel, onClick: onBack });
9672
+ const payingAs = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(McpPayingAs, {});
9588
9673
  if (isFullscreen) {
9589
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
9674
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
9590
9675
  back,
9591
9676
  title,
9592
9677
  payingAs
9593
9678
  ] });
9594
9679
  }
9595
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
9596
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "solvapay-mcp-form-identity-row", children: [
9680
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
9681
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "solvapay-mcp-form-identity-row", children: [
9597
9682
  back,
9598
9683
  payingAs
9599
9684
  ] }),
@@ -9607,7 +9692,7 @@ var MCP_PAYMENT_ELEMENT_OPTIONS = {
9607
9692
  };
9608
9693
 
9609
9694
  // src/mcp/views/checkout/steps/PaygPaymentStep.tsx
9610
- var import_jsx_runtime38 = require("react/jsx-runtime");
9695
+ var import_jsx_runtime39 = require("react/jsx-runtime");
9611
9696
  var PaygPaymentStep = (0, import_react44.memo)(function PaygPaymentStep2({
9612
9697
  plan: _plan,
9613
9698
  amountMinor,
@@ -9624,7 +9709,7 @@ var PaygPaymentStep = (0, import_react44.memo)(function PaygPaymentStep2({
9624
9709
  const { displayMode } = useDisplayMode();
9625
9710
  const isFullscreen = displayMode === "fullscreen";
9626
9711
  const creditsAdded = creditsPerMinorUnit != null && creditsPerMinorUnit > 0 ? Math.floor(amountMinor / (displayExchangeRate ?? 1) * creditsPerMinorUnit) : null;
9627
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9712
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
9628
9713
  TopupForm.Root,
9629
9714
  {
9630
9715
  amount: amountMinor,
@@ -9632,17 +9717,17 @@ var PaygPaymentStep = (0, import_react44.memo)(function PaygPaymentStep2({
9632
9717
  autoRecharge,
9633
9718
  returnUrl,
9634
9719
  onSuccess: (_intent, extras) => onSuccess(extras),
9635
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(McpHostedLayout, { children: [
9636
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(McpSummaryRail, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "solvapay-mcp-checkout-order-summary", "data-variant": "payg", children: [
9637
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "solvapay-mcp-checkout-order-summary-row", children: [
9638
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: cx2.muted, children: creditsAdded != null ? `${creditsAdded.toLocaleString(locale)} credits` : formatPrice(amountMinor, currency, { locale }) }),
9639
- creditsAdded != null ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: formatPrice(amountMinor, currency, { locale }) }) : null
9720
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(McpHostedLayout, { children: [
9721
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(McpSummaryRail, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "solvapay-mcp-checkout-order-summary", "data-variant": "payg", children: [
9722
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "solvapay-mcp-checkout-order-summary-row", children: [
9723
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: cx2.muted, children: creditsAdded != null ? `${creditsAdded.toLocaleString(locale)} credits` : formatPrice(amountMinor, currency, { locale }) }),
9724
+ creditsAdded != null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: formatPrice(amountMinor, currency, { locale }) }) : null
9640
9725
  ] }),
9641
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "solvapay-mcp-checkout-order-summary-row", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: cx2.muted, children: "One-time" }) }),
9642
- isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TopupForm.Summary.Rows, { className: cx2.taxSummary }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TopupForm.Summary.TaxNote, { className: cx2.muted })
9726
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "solvapay-mcp-checkout-order-summary-row", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: cx2.muted, children: "One-time" }) }),
9727
+ isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TopupForm.Summary.Rows, { className: cx2.taxSummary }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TopupForm.Summary.TaxNote, { className: cx2.muted })
9643
9728
  ] }) }),
9644
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(McpHostedBody, { children: [
9645
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9729
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(McpHostedBody, { children: [
9730
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
9646
9731
  McpPaymentHeader,
9647
9732
  {
9648
9733
  backLabel: "Change amount",
@@ -9651,13 +9736,13 @@ var PaygPaymentStep = (0, import_react44.memo)(function PaygPaymentStep2({
9651
9736
  headingClassName: cx2.heading
9652
9737
  }
9653
9738
  ),
9654
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: cx2.topupForm, children: [
9655
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TopupForm.Loading, {}),
9656
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TopupForm.PaymentElement, { options: MCP_PAYMENT_ELEMENT_OPTIONS }),
9657
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TopupForm.BusinessDetails.Root, { className: cx2.businessDetails, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TopupForm.BusinessDetails.Fields, {}) }),
9658
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TopupForm.Error, { className: cx2.error }),
9659
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TopupForm.SubmitButton, { className: cx2.button, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PaygChargeCta, { amountMinor, currency }) }),
9660
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9739
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cx2.topupForm, children: [
9740
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TopupForm.Loading, {}),
9741
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TopupForm.PaymentElement, { options: MCP_PAYMENT_ELEMENT_OPTIONS }),
9742
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TopupForm.BusinessDetails.Root, { className: cx2.businessDetails, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TopupForm.BusinessDetails.Fields, {}) }),
9743
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TopupForm.Error, { className: cx2.error }),
9744
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TopupForm.SubmitButton, { className: cx2.button, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PaygChargeCta, { amountMinor, currency }) }),
9745
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
9661
9746
  MandateText,
9662
9747
  {
9663
9748
  mode: "topup",
@@ -9676,7 +9761,7 @@ function PaygChargeCta({ amountMinor, currency }) {
9676
9761
  const locale = useHostLocale();
9677
9762
  const { taxBreakdown } = useTopupForm();
9678
9763
  const minor = chargeAmountMinor(taxBreakdown, amountMinor);
9679
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
9764
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
9680
9765
  "Pay ",
9681
9766
  formatPrice(minor, taxBreakdown?.currency ?? currency, { locale })
9682
9767
  ] });
@@ -9687,7 +9772,7 @@ var import_react49 = require("react");
9687
9772
 
9688
9773
  // src/components/PaymentFormContext.tsx
9689
9774
  var import_react45 = require("react");
9690
- var import_jsx_runtime39 = require("react/jsx-runtime");
9775
+ var import_jsx_runtime40 = require("react/jsx-runtime");
9691
9776
  var PaymentFormContext = (0, import_react45.createContext)(null);
9692
9777
  function usePaymentForm() {
9693
9778
  const ctx = (0, import_react45.useContext)(PaymentFormContext);
@@ -9698,7 +9783,7 @@ function usePaymentForm() {
9698
9783
  }
9699
9784
  return ctx;
9700
9785
  }
9701
- var PaymentFormProvider = ({ value, children }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PaymentFormContext.Provider, { value, children });
9786
+ var PaymentFormProvider = ({ value, children }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PaymentFormContext.Provider, { value, children });
9702
9787
 
9703
9788
  // src/primitives/PaymentForm.tsx
9704
9789
  var import_react48 = __toESM(require("react"), 1);
@@ -9853,7 +9938,7 @@ function useCheckout(options) {
9853
9938
 
9854
9939
  // src/primitives/CheckoutSummary.tsx
9855
9940
  var import_react47 = require("react");
9856
- var import_jsx_runtime40 = require("react/jsx-runtime");
9941
+ var import_jsx_runtime41 = require("react/jsx-runtime");
9857
9942
  var CheckoutSummaryContext = (0, import_react47.createContext)(null);
9858
9943
  function useCheckoutSummaryContext(part) {
9859
9944
  const ctx = (0, import_react47.useContext)(CheckoutSummaryContext);
@@ -9927,35 +10012,35 @@ var Root6 = (0, import_react47.forwardRef)(function CheckoutSummaryRoot({ planRe
9927
10012
  ]
9928
10013
  );
9929
10014
  const Comp = asChild ? Slot : "section";
9930
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary": "", ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CheckoutSummaryContext.Provider, { value: ctx, children }) });
10015
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary": "", ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CheckoutSummaryContext.Provider, { value: ctx, children }) });
9931
10016
  });
9932
10017
  var ProductSlot = (0, import_react47.forwardRef)(function CheckoutSummaryProduct({ asChild, children, ...rest }, forwardedRef) {
9933
10018
  const ctx = useCheckoutSummaryContext("Product");
9934
10019
  const name = ctx.product?.name;
9935
10020
  if (!name) return null;
9936
10021
  const Comp = asChild ? Slot : "span";
9937
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-product": "", ...rest, children: children ?? name });
10022
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-product": "", ...rest, children: children ?? name });
9938
10023
  });
9939
10024
  var PlanSlot = (0, import_react47.forwardRef)(function CheckoutSummaryPlan({ asChild, children, ...rest }, forwardedRef) {
9940
10025
  const ctx = useCheckoutSummaryContext("Plan");
9941
10026
  const name = ctx.plan?.name;
9942
10027
  if (!name) return null;
9943
10028
  const Comp = asChild ? Slot : "span";
9944
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-plan": "", ...rest, children: children ?? name });
10029
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-plan": "", ...rest, children: children ?? name });
9945
10030
  });
9946
10031
  var TaxNoteSlot = (0, import_react47.forwardRef)(
9947
10032
  function CheckoutSummaryTaxNote({ asChild, children, ...rest }, forwardedRef) {
9948
10033
  const ctx = useCheckoutSummaryContext("TaxNote");
9949
10034
  if (ctx.taxBreakdown) return null;
9950
10035
  const Comp = asChild ? Slot : "p";
9951
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax-note": "", ...rest, children: children ?? "Taxes calculated at checkout" });
10036
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax-note": "", ...rest, children: children ?? "Taxes calculated at checkout" });
9952
10037
  }
9953
10038
  );
9954
10039
  var SubtotalSlot = (0, import_react47.forwardRef)(function CheckoutSummarySubtotal({ asChild, children, ...rest }, forwardedRef) {
9955
10040
  const ctx = useCheckoutSummaryContext("Subtotal");
9956
10041
  if (!ctx.taxBreakdown) return null;
9957
10042
  const Comp = asChild ? Slot : "span";
9958
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-subtotal": "", ...rest, children: children ?? ctx.subtotalFormatted });
10043
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-subtotal": "", ...rest, children: children ?? ctx.subtotalFormatted });
9959
10044
  });
9960
10045
  var TaxSlot = (0, import_react47.forwardRef)(function CheckoutSummaryTax({ asChild, children, ...rest }, forwardedRef) {
9961
10046
  const ctx = useCheckoutSummaryContext("Tax");
@@ -9964,17 +10049,17 @@ var TaxSlot = (0, import_react47.forwardRef)(function CheckoutSummaryTax({ asChi
9964
10049
  if (!shouldShowTaxRow(treatment)) return null;
9965
10050
  const Comp = asChild ? Slot : "span";
9966
10051
  const defaultLabel = formatVatSummaryLabel({ treatment, taxRate: taxRate ?? 0 });
9967
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
9968
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: defaultLabel }),
10052
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
10053
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: defaultLabel }),
9969
10054
  " ",
9970
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { "data-solvapay-checkout-summary-tax-amount": "", children: ctx.taxFormatted })
10055
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "data-solvapay-checkout-summary-tax-amount": "", children: ctx.taxFormatted })
9971
10056
  ] }) });
9972
10057
  });
9973
10058
  var TotalSlot = (0, import_react47.forwardRef)(function CheckoutSummaryTotal({ asChild, children, ...rest }, forwardedRef) {
9974
10059
  const ctx = useCheckoutSummaryContext("Total");
9975
10060
  if (!ctx.taxBreakdown) return null;
9976
10061
  const Comp = asChild ? Slot : "span";
9977
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-total": "", ...rest, children: children ?? ctx.totalFormatted });
10062
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-total": "", ...rest, children: children ?? ctx.totalFormatted });
9978
10063
  });
9979
10064
  var TaxTreatmentNoteSlot = (0, import_react47.forwardRef)(
9980
10065
  function CheckoutSummaryTaxTreatmentNote({ asChild, children, ...rest }, forwardedRef) {
@@ -9984,21 +10069,21 @@ var TaxTreatmentNoteSlot = (0, import_react47.forwardRef)(
9984
10069
  const Comp = asChild ? Slot : "p";
9985
10070
  const defaultNote = treatment === "reverse_charge" ? REVERSE_CHARGE_NOTE : treatment === "not_collecting" || treatment === "not_supported" ? TAX_NOT_COLLECTED_NOTE : null;
9986
10071
  if (!defaultNote && !children) return null;
9987
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax-treatment-note": "", ...rest, children: children ?? defaultNote });
10072
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax-treatment-note": "", ...rest, children: children ?? defaultNote });
9988
10073
  }
9989
10074
  );
9990
10075
  var PriceSlot = (0, import_react47.forwardRef)(function CheckoutSummaryPrice({ asChild, children, ...rest }, forwardedRef) {
9991
10076
  const ctx = useCheckoutSummaryContext("Price");
9992
10077
  if (ctx.taxBreakdown) return null;
9993
10078
  const Comp = asChild ? Slot : "span";
9994
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-price": "", ...rest, children: children ?? ctx.priceFormatted });
10079
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-price": "", ...rest, children: children ?? ctx.priceFormatted });
9995
10080
  });
9996
10081
  var TrialSlot = (0, import_react47.forwardRef)(
9997
10082
  function CheckoutSummaryTrial({ asChild, children, ...rest }, forwardedRef) {
9998
10083
  const ctx = useCheckoutSummaryContext("Trial");
9999
10084
  if (!ctx.trialBanner || ctx.taxBreakdown) return null;
10000
10085
  const Comp = asChild ? Slot : "p";
10001
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-trial": "", ...rest, children: children ?? ctx.trialBanner });
10086
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-trial": "", ...rest, children: children ?? ctx.trialBanner });
10002
10087
  }
10003
10088
  );
10004
10089
  var CheckoutSummary = {
@@ -10015,7 +10100,7 @@ var CheckoutSummary = {
10015
10100
  };
10016
10101
 
10017
10102
  // src/components/CheckoutSummary.tsx
10018
- var import_jsx_runtime41 = require("react/jsx-runtime");
10103
+ var import_jsx_runtime42 = require("react/jsx-runtime");
10019
10104
  var CheckoutSummary2 = ({
10020
10105
  planRef,
10021
10106
  productRef,
@@ -10027,7 +10112,7 @@ var CheckoutSummary2 = ({
10027
10112
  }) => {
10028
10113
  const rootClass = ["solvapay-checkout-summary", className].filter(Boolean).join(" ");
10029
10114
  const hasTax = taxBreakdown != null;
10030
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
10115
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10031
10116
  CheckoutSummary.Root,
10032
10117
  {
10033
10118
  planRef,
@@ -10036,25 +10121,25 @@ var CheckoutSummary2 = ({
10036
10121
  baseAmountMinor,
10037
10122
  className: rootClass,
10038
10123
  children: [
10039
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CheckoutSummary.Product, { className: "solvapay-checkout-summary-product" }),
10040
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "solvapay-checkout-summary-row", children: [
10041
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CheckoutSummary.Plan, { className: "solvapay-checkout-summary-plan" }),
10042
- !hasTax && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CheckoutSummary.Price, { className: "solvapay-checkout-summary-price" })
10124
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckoutSummary.Product, { className: "solvapay-checkout-summary-product" }),
10125
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "solvapay-checkout-summary-row", children: [
10126
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckoutSummary.Plan, { className: "solvapay-checkout-summary-plan" }),
10127
+ !hasTax && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckoutSummary.Price, { className: "solvapay-checkout-summary-price" })
10043
10128
  ] }),
10044
- hasTax ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
10045
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "solvapay-checkout-summary-row", children: [
10046
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Subtotal" }),
10047
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CheckoutSummary.Subtotal, { className: "solvapay-checkout-summary-subtotal" })
10129
+ hasTax ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
10130
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "solvapay-checkout-summary-row", children: [
10131
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: "Subtotal" }),
10132
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckoutSummary.Subtotal, { className: "solvapay-checkout-summary-subtotal" })
10048
10133
  ] }),
10049
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "solvapay-checkout-summary-row", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CheckoutSummary.Tax, { className: "solvapay-checkout-summary-tax" }) }),
10050
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "solvapay-checkout-summary-row", children: [
10051
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Total" }),
10052
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CheckoutSummary.Total, { className: "solvapay-checkout-summary-total" })
10134
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "solvapay-checkout-summary-row", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckoutSummary.Tax, { className: "solvapay-checkout-summary-tax" }) }),
10135
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "solvapay-checkout-summary-row", children: [
10136
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: "Total" }),
10137
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckoutSummary.Total, { className: "solvapay-checkout-summary-total" })
10053
10138
  ] }),
10054
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CheckoutSummary.TaxTreatmentNote, { className: "solvapay-checkout-summary-tax-treatment-note" })
10055
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
10056
- showTrial && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CheckoutSummary.Trial, { className: "solvapay-checkout-summary-trial" }),
10057
- showTaxNote && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CheckoutSummary.TaxNote, { className: "solvapay-checkout-summary-tax-note" })
10139
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckoutSummary.TaxTreatmentNote, { className: "solvapay-checkout-summary-tax-treatment-note" })
10140
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
10141
+ showTrial && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckoutSummary.Trial, { className: "solvapay-checkout-summary-trial" }),
10142
+ showTaxNote && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckoutSummary.TaxNote, { className: "solvapay-checkout-summary-tax-note" })
10058
10143
  ] })
10059
10144
  ]
10060
10145
  }
@@ -10157,7 +10242,7 @@ function resolveCta(input) {
10157
10242
 
10158
10243
  // src/primitives/PaymentForm.tsx
10159
10244
  var import_core17 = require("@solvapay/core");
10160
- var import_jsx_runtime42 = require("react/jsx-runtime");
10245
+ var import_jsx_runtime43 = require("react/jsx-runtime");
10161
10246
  function toSubmitVariant(variant) {
10162
10247
  switch (variant) {
10163
10248
  case "freeTier":
@@ -10249,7 +10334,7 @@ var Root7 = (0, import_react48.forwardRef)(
10249
10334
  const shouldRenderElements = !!(stripePromise && clientSecret && appearanceReady);
10250
10335
  const dataState = !hasPlanOrProduct || checkoutError ? "error" : isFreePlan && resolvedPlan ? "ready" : shouldRenderElements ? "ready" : "loading";
10251
10336
  const dataVariant = isFreePlan && resolvedPlan ? "free" : shouldRenderElements ? "paid" : void 0;
10252
- const pending = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10337
+ const pending = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10253
10338
  PendingInner,
10254
10339
  {
10255
10340
  planRef: effectivePlanRef,
@@ -10263,7 +10348,7 @@ var Root7 = (0, import_react48.forwardRef)(
10263
10348
  children
10264
10349
  }
10265
10350
  );
10266
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10351
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10267
10352
  "section",
10268
10353
  {
10269
10354
  ref: sectionRef,
@@ -10271,7 +10356,7 @@ var Root7 = (0, import_react48.forwardRef)(
10271
10356
  "data-solvapay-payment-form": "",
10272
10357
  "data-state": dataState,
10273
10358
  ...dataVariant ? { "data-variant": dataVariant } : {},
10274
- children: !hasPlanOrProduct ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", "data-solvapay-payment-form-error": "", children: copy.errors.configMissingPlanOrProduct }) : checkoutError ? pending : isFreePlan && resolvedPlan ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10359
+ children: !hasPlanOrProduct ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", "data-solvapay-payment-form-error": "", children: copy.errors.configMissingPlanOrProduct }) : checkoutError ? pending : isFreePlan && resolvedPlan ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10275
10360
  FreeInner,
10276
10361
  {
10277
10362
  planRef: effectivePlanRef,
@@ -10286,7 +10371,7 @@ var Root7 = (0, import_react48.forwardRef)(
10286
10371
  onError,
10287
10372
  children
10288
10373
  }
10289
- ) : shouldRenderElements && elementsOptions && clientSecret ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_stripe_js2.Elements, { stripe: stripePromise, options: elementsOptions, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10374
+ ) : shouldRenderElements && elementsOptions && clientSecret ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_stripe_js2.Elements, { stripe: stripePromise, options: elementsOptions, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10290
10375
  PaidInner,
10291
10376
  {
10292
10377
  planRef: effectivePlanRef,
@@ -10642,7 +10727,7 @@ var PaidInner = ({
10642
10727
  submit
10643
10728
  ]
10644
10729
  );
10645
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PaymentFormProvider, { value: contextValue, children });
10730
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentFormProvider, { value: contextValue, children });
10646
10731
  };
10647
10732
  var FreeInner = ({
10648
10733
  planRef,
@@ -10754,7 +10839,7 @@ var FreeInner = ({
10754
10839
  submit
10755
10840
  ]
10756
10841
  );
10757
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PaymentFormProvider, { value: contextValue, children });
10842
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentFormProvider, { value: contextValue, children });
10758
10843
  };
10759
10844
  var PendingInner = ({
10760
10845
  planRef,
@@ -10820,11 +10905,11 @@ var PendingInner = ({
10820
10905
  error
10821
10906
  ]
10822
10907
  );
10823
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PaymentFormProvider, { value: contextValue, children });
10908
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentFormProvider, { value: contextValue, children });
10824
10909
  };
10825
10910
  var Summary2 = (props) => {
10826
10911
  const ctx = usePaymentForm();
10827
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10912
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10828
10913
  CheckoutSummary2,
10829
10914
  {
10830
10915
  ...props,
@@ -10837,7 +10922,7 @@ var Summary2 = (props) => {
10837
10922
  };
10838
10923
  var MandateTextPrimitive = (props) => {
10839
10924
  const ctx = usePaymentForm();
10840
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10925
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10841
10926
  MandateText,
10842
10927
  {
10843
10928
  ...props,
@@ -10854,14 +10939,14 @@ var CustomerFields = (0, import_react48.forwardRef)(
10854
10939
  const email = customer.email ?? prefillCustomer?.email;
10855
10940
  if (!email) return null;
10856
10941
  const Comp = asChild ? Slot : "section";
10857
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Comp, { ref, "data-solvapay-payment-form-customer-fields": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
10858
- email && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("dl", { "data-solvapay-payment-form-customer-email": "", children: [
10859
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("dt", { children: copy.customer.emailLabel }),
10860
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("dd", { children: email })
10942
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Comp, { ref, "data-solvapay-payment-form-customer-fields": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
10943
+ email && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("dl", { "data-solvapay-payment-form-customer-email": "", children: [
10944
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("dt", { children: copy.customer.emailLabel }),
10945
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("dd", { children: email })
10861
10946
  ] }),
10862
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("dl", { "data-solvapay-payment-form-customer-name": "", children: [
10863
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("dt", { children: copy.customer.nameLabel }),
10864
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10947
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("dl", { "data-solvapay-payment-form-customer-name": "", children: [
10948
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("dt", { children: copy.customer.nameLabel }),
10949
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10865
10950
  "input",
10866
10951
  {
10867
10952
  type: "text",
@@ -10889,9 +10974,9 @@ var PaymentElementSlot2 = ({ options }) => {
10889
10974
  }, [setElementKind, stripe, elements]);
10890
10975
  if (!stripe || !elements) return null;
10891
10976
  if (!isReady) {
10892
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("output", { "data-solvapay-payment-form-loading": "", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Spinner, { size: "sm" }) });
10977
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("output", { "data-solvapay-payment-form-loading": "", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Spinner, { size: "sm" }) });
10893
10978
  }
10894
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("section", { "data-solvapay-payment-form-payment-element": "", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10979
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("section", { "data-solvapay-payment-form-payment-element": "", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10895
10980
  import_react_stripe_js2.PaymentElement,
10896
10981
  {
10897
10982
  options: withPaymentElementDefaults(options),
@@ -10907,9 +10992,9 @@ var CardElementSlot = ({ options }) => {
10907
10992
  }, [setElementKind, stripe, elements]);
10908
10993
  if (!stripe || !elements) return null;
10909
10994
  if (!isReady) {
10910
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("output", { "data-solvapay-payment-form-loading": "", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Spinner, { size: "sm" }) });
10995
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("output", { "data-solvapay-payment-form-loading": "", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Spinner, { size: "sm" }) });
10911
10996
  }
10912
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("section", { "data-solvapay-payment-form-card-element": "", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_stripe_js2.CardElement, { options, onChange: (e) => setPaymentInputComplete(e.complete) }) });
10997
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("section", { "data-solvapay-payment-form-card-element": "", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_stripe_js2.CardElement, { options, onChange: (e) => setPaymentInputComplete(e.complete) }) });
10913
10998
  };
10914
10999
  var TermsCheckbox = (0, import_react48.forwardRef)(
10915
11000
  function PaymentFormTermsCheckbox({ asChild, label, children, ...rest }, ref) {
@@ -10917,10 +11002,10 @@ var TermsCheckbox = (0, import_react48.forwardRef)(
10917
11002
  const copy = useCopy();
10918
11003
  const id = "solvapay-terms-checkbox";
10919
11004
  if (asChild) {
10920
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Slot, { ref, "data-solvapay-payment-form-terms": "", ...rest, children });
11005
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Slot, { ref, "data-solvapay-payment-form-terms": "", ...rest, children });
10921
11006
  }
10922
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { ref, htmlFor: id, "data-solvapay-payment-form-terms": "", ...rest, children: [
10923
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11007
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { ref, htmlFor: id, "data-solvapay-payment-form-terms": "", ...rest, children: [
11008
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10924
11009
  "input",
10925
11010
  {
10926
11011
  id,
@@ -10929,7 +11014,7 @@ var TermsCheckbox = (0, import_react48.forwardRef)(
10929
11014
  onChange: (e) => setTermsAccepted(e.target.checked)
10930
11015
  }
10931
11016
  ),
10932
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: label ?? copy.terms.checkboxLabel })
11017
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: label ?? copy.terms.checkboxLabel })
10933
11018
  ] });
10934
11019
  }
10935
11020
  );
@@ -10962,9 +11047,9 @@ var SubmitButton2 = (0, import_react48.forwardRef)(
10962
11047
  copy,
10963
11048
  override: typeof children === "string" ? children : ctx.submitButtonText
10964
11049
  });
10965
- const processingContent = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
10966
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Spinner, { size: "sm" }),
10967
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: copy.cta.processing })
11050
+ const processingContent = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
11051
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Spinner, { size: "sm" }),
11052
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: copy.cta.processing })
10968
11053
  ] });
10969
11054
  const buttonProps = {
10970
11055
  "data-solvapay-payment-form-submit": "",
@@ -10987,25 +11072,25 @@ var SubmitButton2 = (0, import_react48.forwardRef)(
10987
11072
  void 0,
10988
11073
  processingContent
10989
11074
  ) : children;
10990
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Slot, { ref, ...buttonProps, children: slotChild });
11075
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Slot, { ref, ...buttonProps, children: slotChild });
10991
11076
  }
10992
11077
  const content = ctx.isProcessing ? processingContent : children && typeof children !== "string" ? children : label;
10993
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { ref, type: "submit", ...buttonProps, children: content });
11078
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { ref, type: "submit", ...buttonProps, children: content });
10994
11079
  }
10995
11080
  );
10996
11081
  var Loading4 = (0, import_react48.forwardRef)(function PaymentFormLoading({ asChild, children, ...rest }, ref) {
10997
11082
  const ctx = usePaymentForm();
10998
11083
  if (ctx.isReady && ctx.clientSecret) return null;
10999
11084
  if (asChild) {
11000
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Slot, { ref, "data-solvapay-payment-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Spinner, { size: "sm" }) });
11085
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Slot, { ref, "data-solvapay-payment-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Spinner, { size: "sm" }) });
11001
11086
  }
11002
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("output", { ref, "data-solvapay-payment-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Spinner, { size: "sm" }) });
11087
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("output", { ref, "data-solvapay-payment-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Spinner, { size: "sm" }) });
11003
11088
  });
11004
11089
  var ErrorSlot3 = (0, import_react48.forwardRef)(function PaymentFormError({ asChild, children, ...rest }, ref) {
11005
11090
  const ctx = usePaymentForm();
11006
11091
  if (!ctx.error) return null;
11007
11092
  if (asChild) {
11008
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11093
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
11009
11094
  Slot,
11010
11095
  {
11011
11096
  ref,
@@ -11018,7 +11103,7 @@ var ErrorSlot3 = (0, import_react48.forwardRef)(function PaymentFormError({ asCh
11018
11103
  }
11019
11104
  );
11020
11105
  }
11021
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11106
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
11022
11107
  "p",
11023
11108
  {
11024
11109
  ref,
@@ -11068,7 +11153,7 @@ var PaymentForm = {
11068
11153
  };
11069
11154
 
11070
11155
  // src/mcp/views/checkout/steps/RecurringPaymentStep.tsx
11071
- var import_jsx_runtime43 = require("react/jsx-runtime");
11156
+ var import_jsx_runtime44 = require("react/jsx-runtime");
11072
11157
  var RecurringPaymentStep = (0, import_react49.memo)(function RecurringPaymentStep2({
11073
11158
  plan,
11074
11159
  planRef,
@@ -11092,7 +11177,7 @@ var RecurringPaymentStep = (0, import_react49.memo)(function RecurringPaymentSte
11092
11177
  const planName = plan.name ?? "Plan";
11093
11178
  const { displayMode } = useDisplayMode();
11094
11179
  const isFullscreen = displayMode === "fullscreen";
11095
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
11180
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
11096
11181
  PaymentForm.Root,
11097
11182
  {
11098
11183
  planRef,
@@ -11100,25 +11185,25 @@ var RecurringPaymentStep = (0, import_react49.memo)(function RecurringPaymentSte
11100
11185
  returnUrl,
11101
11186
  requireTermsAcceptance: false,
11102
11187
  onSuccess,
11103
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(McpHostedLayout, { children: [
11104
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(McpSummaryRail, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "solvapay-mcp-checkout-order-summary", "data-variant": "recurring", children: [
11105
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "solvapay-mcp-checkout-order-summary-row", children: [
11106
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: cx2.muted, children: planName }),
11107
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { children: [
11188
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(McpHostedLayout, { children: [
11189
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(McpSummaryRail, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "solvapay-mcp-checkout-order-summary", "data-variant": "recurring", children: [
11190
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "solvapay-mcp-checkout-order-summary-row", children: [
11191
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: cx2.muted, children: planName }),
11192
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { children: [
11108
11193
  formatPrice(amountMinor, currency, { locale }),
11109
11194
  formatCycleSuffix(cycle)
11110
11195
  ] })
11111
11196
  ] }),
11112
- included != null ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "solvapay-mcp-checkout-order-summary-row", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: cx2.muted, children: [
11197
+ included != null ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "solvapay-mcp-checkout-order-summary-row", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: cx2.muted, children: [
11113
11198
  included.toLocaleString(locale),
11114
11199
  " ",
11115
11200
  meterName3,
11116
11201
  " included"
11117
11202
  ] }) }) : null,
11118
- isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentForm.TaxSummary.Rows, { className: cx2.taxSummary }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentForm.TaxSummary.TaxNote, { className: cx2.muted })
11203
+ isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PaymentForm.TaxSummary.Rows, { className: cx2.taxSummary }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PaymentForm.TaxSummary.TaxNote, { className: cx2.muted })
11119
11204
  ] }) }),
11120
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(McpHostedBody, { children: [
11121
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
11205
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(McpHostedBody, { children: [
11206
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
11122
11207
  McpPaymentHeader,
11123
11208
  {
11124
11209
  backLabel: "Change plan",
@@ -11127,12 +11212,12 @@ var RecurringPaymentStep = (0, import_react49.memo)(function RecurringPaymentSte
11127
11212
  headingClassName: cx2.heading
11128
11213
  }
11129
11214
  ),
11130
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentForm.Loading, {}),
11131
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentForm.PaymentElement, {}),
11132
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentForm.BusinessDetails.Root, { className: cx2.businessDetails, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentForm.BusinessDetails.Fields, {}) }),
11133
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentForm.Error, { className: cx2.error }),
11134
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentForm.SubmitButton, { className: cx2.button, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RecurringChargeCta, { amountMinor, currency, cycle }) }),
11135
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PaymentForm.MandateText, { savesPaymentMethod: true })
11215
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PaymentForm.Loading, {}),
11216
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PaymentForm.PaymentElement, {}),
11217
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PaymentForm.BusinessDetails.Root, { className: cx2.businessDetails, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PaymentForm.BusinessDetails.Fields, {}) }),
11218
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PaymentForm.Error, { className: cx2.error }),
11219
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PaymentForm.SubmitButton, { className: cx2.button, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(RecurringChargeCta, { amountMinor, currency, cycle }) }),
11220
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PaymentForm.MandateText, { savesPaymentMethod: true })
11136
11221
  ] })
11137
11222
  ] })
11138
11223
  }
@@ -11146,7 +11231,7 @@ function RecurringChargeCta({
11146
11231
  const locale = useHostLocale();
11147
11232
  const { taxBreakdown } = usePaymentForm();
11148
11233
  const minor = chargeAmountMinor(taxBreakdown, amountMinor);
11149
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
11234
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
11150
11235
  "Subscribe \u2014 ",
11151
11236
  formatPrice(minor, taxBreakdown?.currency ?? currency, { locale }),
11152
11237
  formatCycleSuffix(cycle)
@@ -11155,81 +11240,81 @@ function RecurringChargeCta({
11155
11240
 
11156
11241
  // src/mcp/views/checkout/steps/SuccessStep.tsx
11157
11242
  var import_react50 = require("react");
11158
- var import_jsx_runtime44 = require("react/jsx-runtime");
11243
+ var import_jsx_runtime45 = require("react/jsx-runtime");
11159
11244
  var SuccessStep = (0, import_react50.memo)(function SuccessStep2({ meta, cx: cx2 }) {
11160
11245
  const locale = useHostLocale();
11161
11246
  if (meta.branch === "payg") {
11162
11247
  const chargedAmount = meta.amountMinor;
11163
11248
  const chargedCurrency = meta.currency;
11164
11249
  const charged = chargedAmount != null && chargedCurrency != null;
11165
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
11166
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "solvapay-mcp-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
11167
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { className: cx2.heading, children: charged ? "Credits added" : "Plan activated" }),
11168
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: cx2.muted, children: "Pay as you go plan is active." }),
11169
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("dl", { className: "solvapay-mcp-checkout-receipt", "data-variant": "payg", children: [
11170
- charged ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
11171
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11172
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dt", { children: "Amount" }),
11173
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dd", { children: formatPrice(chargedAmount, chargedCurrency, { locale }) })
11250
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
11251
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "solvapay-mcp-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
11252
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: cx2.heading, children: charged ? "Credits added" : "Plan activated" }),
11253
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: cx2.muted, children: "Pay as you go plan is active." }),
11254
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("dl", { className: "solvapay-mcp-checkout-receipt", "data-variant": "payg", children: [
11255
+ charged ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
11256
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11257
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dt", { children: "Amount" }),
11258
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dd", { children: formatPrice(chargedAmount, chargedCurrency, { locale }) })
11174
11259
  ] }),
11175
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11176
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dt", { children: "Credits" }),
11177
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("dd", { children: [
11260
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11261
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dt", { children: "Credits" }),
11262
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("dd", { children: [
11178
11263
  "+",
11179
11264
  (meta.creditsAdded ?? 0).toLocaleString(locale)
11180
11265
  ] })
11181
11266
  ] })
11182
11267
  ] }) : null,
11183
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11184
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dt", { children: "Plan" }),
11185
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dd", { children: meta.plan.name ?? "Pay as you go" })
11268
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11269
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dt", { children: "Plan" }),
11270
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dd", { children: meta.plan.name ?? "Pay as you go" })
11186
11271
  ] }),
11187
- meta.rateLabel ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11188
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dt", { children: "Rate" }),
11189
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dd", { children: meta.rateLabel })
11272
+ meta.rateLabel ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11273
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dt", { children: "Rate" }),
11274
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dd", { children: meta.rateLabel })
11190
11275
  ] }) : null
11191
11276
  ] })
11192
11277
  ] });
11193
11278
  }
11194
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
11195
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "solvapay-mcp-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
11196
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("h2", { className: cx2.heading, children: [
11279
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
11280
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "solvapay-mcp-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
11281
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("h2", { className: cx2.heading, children: [
11197
11282
  meta.plan.name ?? "Plan",
11198
11283
  " active"
11199
11284
  ] }),
11200
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: cx2.muted, children: "Subscription is live and credits are ready." }),
11201
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("dl", { className: "solvapay-mcp-checkout-receipt", "data-variant": "recurring", children: [
11202
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11203
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dt", { children: "Plan" }),
11204
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dd", { children: meta.plan.name ?? "Plan" })
11285
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: cx2.muted, children: "Subscription is live and credits are ready." }),
11286
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("dl", { className: "solvapay-mcp-checkout-receipt", "data-variant": "recurring", children: [
11287
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11288
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dt", { children: "Plan" }),
11289
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dd", { children: meta.plan.name ?? "Plan" })
11205
11290
  ] }),
11206
- meta.includedUnits != null ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11207
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dt", { children: "Included" }),
11208
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("dd", { children: [
11291
+ meta.includedUnits != null ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11292
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dt", { children: "Included" }),
11293
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("dd", { children: [
11209
11294
  meta.includedUnits.toLocaleString(locale),
11210
11295
  " ",
11211
11296
  meta.meterName ?? "units"
11212
11297
  ] })
11213
11298
  ] }) : null,
11214
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11215
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dt", { children: "Charged today" }),
11216
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dd", { children: formatPrice(meta.chargedTodayMinor, meta.currency, { locale }) })
11299
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11300
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dt", { children: "Charged today" }),
11301
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dd", { children: formatPrice(meta.chargedTodayMinor, meta.currency, { locale }) })
11217
11302
  ] }),
11218
- meta.nextRenewalLabel ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11219
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dt", { children: "Next renewal" }),
11220
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dd", { children: meta.nextRenewalLabel })
11303
+ meta.nextRenewalLabel ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
11304
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dt", { children: "Next renewal" }),
11305
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("dd", { children: meta.nextRenewalLabel })
11221
11306
  ] }) : null
11222
11307
  ] }),
11223
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("p", { className: `${cx2.muted} solvapay-mcp-checkout-manage-pointer`.trim(), children: [
11308
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: `${cx2.muted} solvapay-mcp-checkout-manage-pointer`.trim(), children: [
11224
11309
  "Manage from ",
11225
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("code", { children: "/manage_account" })
11310
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("code", { children: "/manage_account" })
11226
11311
  ] })
11227
11312
  ] });
11228
11313
  });
11229
11314
 
11230
11315
  // src/mcp/views/checkout/HostedCheckout.tsx
11231
11316
  var import_react51 = __toESM(require("react"), 1);
11232
- var import_jsx_runtime45 = require("react/jsx-runtime");
11317
+ var import_jsx_runtime46 = require("react/jsx-runtime");
11233
11318
  var POLL_INTERVAL_MS = 3e3;
11234
11319
  var AWAITING_TIMEOUT_MS = 10 * 60 * 1e3;
11235
11320
  function useHostedUrl(enabled, fetcher, label) {
@@ -11264,7 +11349,7 @@ var HostedLinkButton = import_react51.default.memo(function HostedLinkButton2({
11264
11349
  }) {
11265
11350
  const handleExternalClick = useExternalLinkClick();
11266
11351
  if (state.status === "ready") {
11267
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
11352
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11268
11353
  "a",
11269
11354
  {
11270
11355
  className: "solvapay-mcp-hosted-link",
@@ -11276,17 +11361,17 @@ var HostedLinkButton = import_react51.default.memo(function HostedLinkButton2({
11276
11361
  onLaunch?.(state.href);
11277
11362
  handleExternalClick(event);
11278
11363
  },
11279
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("button", { type: "button", className: cx2.button, children: [
11364
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("button", { type: "button", className: cx2.button, children: [
11280
11365
  readyLabel,
11281
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ExternalLinkGlyph, {})
11366
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ExternalLinkGlyph, {})
11282
11367
  ] })
11283
11368
  }
11284
11369
  );
11285
11370
  }
11286
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: cx2.button, disabled: true, children: state.status === "error" ? "Unavailable" : loadingLabel });
11371
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: cx2.button, disabled: true, children: state.status === "error" ? "Unavailable" : loadingLabel });
11287
11372
  });
11288
11373
  function Spinner2() {
11289
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "solvapay-mcp-spinner", "aria-hidden": "true" });
11374
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "solvapay-mcp-spinner", "aria-hidden": "true" });
11290
11375
  }
11291
11376
  var AwaitingBody = import_react51.default.memo(function AwaitingBody2({
11292
11377
  href,
@@ -11296,13 +11381,13 @@ var AwaitingBody = import_react51.default.memo(function AwaitingBody2({
11296
11381
  cx: cx2
11297
11382
  }) {
11298
11383
  const handleExternalClick = useExternalLinkClick();
11299
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
11300
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: cx2.awaitingHeader, children: [
11301
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Spinner2, {}),
11302
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: cx2.heading, children: timedOut ? "Still waiting for payment" : "Waiting for payment\u2026" })
11384
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
11385
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: cx2.awaitingHeader, children: [
11386
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Spinner2, {}),
11387
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h2", { className: cx2.heading, children: timedOut ? "Still waiting for payment" : "Waiting for payment\u2026" })
11303
11388
  ] }),
11304
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("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." }),
11305
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
11389
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("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." }),
11390
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11306
11391
  "a",
11307
11392
  {
11308
11393
  className: "solvapay-mcp-hosted-link",
@@ -11314,13 +11399,13 @@ var AwaitingBody = import_react51.default.memo(function AwaitingBody2({
11314
11399
  onReopen();
11315
11400
  handleExternalClick(event);
11316
11401
  },
11317
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("button", { type: "button", className: cx2.button, children: [
11402
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("button", { type: "button", className: cx2.button, children: [
11318
11403
  "Reopen checkout",
11319
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ExternalLinkGlyph, {})
11404
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ExternalLinkGlyph, {})
11320
11405
  ] })
11321
11406
  }
11322
11407
  ),
11323
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: cx2.linkButton, onClick: onCancel, children: "Didn't complete? Cancel" })
11408
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: cx2.linkButton, onClick: onCancel, children: "Didn't complete? Cancel" })
11324
11409
  ] });
11325
11410
  });
11326
11411
  var CancelledBody = import_react51.default.memo(function CancelledBody2({
@@ -11332,25 +11417,25 @@ var CancelledBody = import_react51.default.memo(function CancelledBody2({
11332
11417
  onLaunch,
11333
11418
  cx: cx2
11334
11419
  }) {
11335
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
11336
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("h2", { className: cx2.heading, children: [
11420
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
11421
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("h2", { className: cx2.heading, children: [
11337
11422
  "Your ",
11338
11423
  productName,
11339
11424
  " purchase is cancelled"
11340
11425
  ] }),
11341
- endDate && formattedEndDate ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: cx2.notice, children: [
11342
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("strong", { children: [
11426
+ endDate && formattedEndDate ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: cx2.notice, children: [
11427
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("strong", { children: [
11343
11428
  "Access expires ",
11344
11429
  formattedEndDate
11345
11430
  ] }) }),
11346
- daysLeft !== null && daysLeft > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: cx2.muted, children: [
11431
+ daysLeft !== null && daysLeft > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { className: cx2.muted, children: [
11347
11432
  daysLeft,
11348
11433
  " ",
11349
11434
  daysLeft === 1 ? "day" : "days",
11350
11435
  " remaining"
11351
11436
  ] })
11352
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: cx2.muted, children: "Your purchase access has ended." }),
11353
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
11437
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: cx2.muted, children: "Your purchase access has ended." }),
11438
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11354
11439
  HostedLinkButton,
11355
11440
  {
11356
11441
  state: checkout,
@@ -11360,7 +11445,7 @@ var CancelledBody = import_react51.default.memo(function CancelledBody2({
11360
11445
  cx: cx2
11361
11446
  }
11362
11447
  ),
11363
- checkout.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: cx2.error, role: "alert", children: checkout.message })
11448
+ checkout.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: cx2.error, role: "alert", children: checkout.message })
11364
11449
  ] });
11365
11450
  });
11366
11451
  var UpgradeBody = import_react51.default.memo(function UpgradeBody2({
@@ -11371,11 +11456,11 @@ var UpgradeBody = import_react51.default.memo(function UpgradeBody2({
11371
11456
  backLabel,
11372
11457
  cx: cx2
11373
11458
  }) {
11374
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
11375
- onBack ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(BackLink, { label: backLabel, onClick: onBack }) : null,
11376
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: cx2.heading, children: planName ? `Complete your ${planName} purchase` : "Upgrade your plan" }),
11377
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("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." }),
11378
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
11459
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
11460
+ onBack ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(BackLink, { label: backLabel, onClick: onBack }) : null,
11461
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h2", { className: cx2.heading, children: planName ? `Complete your ${planName} purchase` : "Upgrade your plan" }),
11462
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("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." }),
11463
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11379
11464
  HostedLinkButton,
11380
11465
  {
11381
11466
  state: checkout,
@@ -11385,7 +11470,7 @@ var UpgradeBody = import_react51.default.memo(function UpgradeBody2({
11385
11470
  cx: cx2
11386
11471
  }
11387
11472
  ),
11388
- checkout.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: cx2.error, role: "alert", children: checkout.message })
11473
+ checkout.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: cx2.error, role: "alert", children: checkout.message })
11389
11474
  ] });
11390
11475
  });
11391
11476
  function HostedCheckout({
@@ -11398,7 +11483,7 @@ function HostedCheckout({
11398
11483
  cx: cx2,
11399
11484
  children
11400
11485
  }) {
11401
- const { loading, isRefetching, refetch, hasPaidPurchase, activePurchase } = usePurchase();
11486
+ const { loading, refetch, hasPaidPurchase, activePurchase } = usePurchase();
11402
11487
  const { cancelledPurchase, shouldShowCancelledNotice, formatDate, getDaysUntilExpiration } = usePurchaseStatus();
11403
11488
  const transport = useTransport();
11404
11489
  const [awaiting, setAwaiting] = (0, import_react51.useState)(null);
@@ -11493,7 +11578,7 @@ function HostedCheckout({
11493
11578
  const awaitingHref = awaiting?.href ?? null;
11494
11579
  const inner = (0, import_react51.useMemo)(() => {
11495
11580
  if (awaiting && awaitingHref) {
11496
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
11581
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11497
11582
  AwaitingBody,
11498
11583
  {
11499
11584
  href: awaitingHref,
@@ -11505,7 +11590,7 @@ function HostedCheckout({
11505
11590
  );
11506
11591
  }
11507
11592
  if (shouldShowCancelledNotice && cancelledProductName) {
11508
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
11593
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11509
11594
  CancelledBody,
11510
11595
  {
11511
11596
  productName: cancelledProductName,
@@ -11518,7 +11603,7 @@ function HostedCheckout({
11518
11603
  }
11519
11604
  );
11520
11605
  }
11521
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
11606
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11522
11607
  UpgradeBody,
11523
11608
  {
11524
11609
  planName,
@@ -11548,16 +11633,16 @@ function HostedCheckout({
11548
11633
  cx2
11549
11634
  ]);
11550
11635
  if (loading) {
11551
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { children: "Loading purchase\u2026" });
11636
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: "Loading purchase\u2026" });
11552
11637
  }
11553
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { "data-refreshing": isRefetching ? "true" : void 0, children: [
11638
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: cx2.stack, children: [
11554
11639
  inner,
11555
11640
  children
11556
11641
  ] });
11557
11642
  }
11558
11643
 
11559
11644
  // src/mcp/views/checkout/EmbeddedCheckout.tsx
11560
- var import_jsx_runtime46 = require("react/jsx-runtime");
11645
+ var import_jsx_runtime47 = require("react/jsx-runtime");
11561
11646
  function EmbeddedCheckout({
11562
11647
  productRef,
11563
11648
  returnUrl,
@@ -11589,10 +11674,10 @@ function EmbeddedCheckout({
11589
11674
  [currentPlanRef]
11590
11675
  );
11591
11676
  if (loading) {
11592
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: cx2.card, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: "Loading checkout\u2026" }) });
11677
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: cx2.card, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { children: "Loading checkout\u2026" }) });
11593
11678
  }
11594
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: cx2.card, "data-refreshing": isRefetching ? "true" : void 0, children: [
11595
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11679
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: cx2.card, "data-refreshing": isRefetching ? "true" : void 0, children: [
11680
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11596
11681
  PlanSelector.Root,
11597
11682
  {
11598
11683
  productRef,
@@ -11603,7 +11688,7 @@ function EmbeddedCheckout({
11603
11688
  autoSelectFirstPaid: Boolean(paygPlanRef),
11604
11689
  initialPlanRef,
11605
11690
  className: "solvapay-plan-selector",
11606
- children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11691
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11607
11692
  McpCheckoutBody,
11608
11693
  {
11609
11694
  productRef,
@@ -11698,9 +11783,9 @@ function McpCheckoutBody({
11698
11783
  const waitingForSelection = Boolean(autoAdvance) && !flow.selectedPlanRef;
11699
11784
  const matchingPending = Boolean(autoAdvance) && flow.selectedPlanRef === initialPlanRef && flow.status === "activating";
11700
11785
  if (waitingForSelection || matchingPending) {
11701
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: "Loading checkout\u2026" });
11786
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { children: "Loading checkout\u2026" });
11702
11787
  }
11703
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11788
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11704
11789
  PlanStep,
11705
11790
  {
11706
11791
  fromPaywall,
@@ -11719,7 +11804,7 @@ function McpCheckoutBody({
11719
11804
  if (!selectedPlanShape) {
11720
11805
  return null;
11721
11806
  }
11722
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11807
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11723
11808
  AmountStep,
11724
11809
  {
11725
11810
  plan: selectedPlanShape,
@@ -11741,11 +11826,11 @@ function McpCheckoutBody({
11741
11826
  }
11742
11827
  if (flow.step === "payment") {
11743
11828
  if (stripeProbe === "loading") {
11744
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: "Loading checkout\u2026" });
11829
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { children: "Loading checkout\u2026" });
11745
11830
  }
11746
11831
  if (stripeProbe === "blocked") {
11747
11832
  const hostedBackLabel = flow.branch === "payg" ? "Change amount" : "Change plan";
11748
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11833
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11749
11834
  HostedCheckout,
11750
11835
  {
11751
11836
  productRef,
@@ -11759,7 +11844,7 @@ function McpCheckoutBody({
11759
11844
  );
11760
11845
  }
11761
11846
  if (flow.branch === "payg" && selectedPlanShape && flow.selectedAmountMinor != null) {
11762
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11847
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11763
11848
  PaygPaymentStep,
11764
11849
  {
11765
11850
  plan: selectedPlanShape,
@@ -11774,7 +11859,7 @@ function McpCheckoutBody({
11774
11859
  );
11775
11860
  }
11776
11861
  if (flow.branch === "recurring" && selectedPlanShape && flow.selectedPlanRef) {
11777
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
11862
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11778
11863
  RecurringPaymentStep,
11779
11864
  {
11780
11865
  plan: selectedPlanShape,
@@ -11790,13 +11875,13 @@ function McpCheckoutBody({
11790
11875
  return null;
11791
11876
  }
11792
11877
  if (flow.step === "success" && flow.successMeta) {
11793
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SuccessStep, { meta: flow.successMeta, cx: cx2 });
11878
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SuccessStep, { meta: flow.successMeta, cx: cx2 });
11794
11879
  }
11795
11880
  return null;
11796
11881
  }
11797
11882
 
11798
11883
  // src/mcp/views/McpCheckoutView.tsx
11799
- var import_jsx_runtime47 = require("react/jsx-runtime");
11884
+ var import_jsx_runtime48 = require("react/jsx-runtime");
11800
11885
  function McpCheckoutView({
11801
11886
  productRef,
11802
11887
  publishableKey = null,
@@ -11815,7 +11900,7 @@ function McpCheckoutView({
11815
11900
  }) {
11816
11901
  const cx2 = resolveMcpClassNames(classNames);
11817
11902
  const probe = useStripeProbe(publishableKey);
11818
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
11903
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
11819
11904
  EmbeddedCheckout,
11820
11905
  {
11821
11906
  productRef,
@@ -11842,7 +11927,7 @@ var import_react54 = require("react");
11842
11927
  // src/primitives/BalanceBadge.tsx
11843
11928
  var import_react53 = require("react");
11844
11929
  var import_core18 = require("@solvapay/core");
11845
- var import_jsx_runtime48 = require("react/jsx-runtime");
11930
+ var import_jsx_runtime49 = require("react/jsx-runtime");
11846
11931
  var BalanceBadge = (0, import_react53.forwardRef)(function BalanceBadge2({ asChild, numberOnly, lowThreshold = 10, children, ...rest }, forwardedRef) {
11847
11932
  const solva = (0, import_react53.useContext)(SolvaPayContext);
11848
11933
  if (!solva) throw new MissingProviderError("BalanceBadge");
@@ -11861,10 +11946,10 @@ var BalanceBadge = (0, import_react53.forwardRef)(function BalanceBadge2({ asChi
11861
11946
  if (asChild) {
11862
11947
  return (
11863
11948
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11864
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Slot, { ref: forwardedRef, ...commonProps, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, {}) })
11949
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slot, { ref: forwardedRef, ...commonProps, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx_runtime49.Fragment, {}) })
11865
11950
  );
11866
11951
  }
11867
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { ref: forwardedRef, ...commonProps });
11952
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { ref: forwardedRef, ...commonProps });
11868
11953
  }
11869
11954
  if (credits == null) return null;
11870
11955
  const formattedCredits = new Intl.NumberFormat(locale).format(credits);
@@ -11886,7 +11971,7 @@ var BalanceBadge = (0, import_react53.forwardRef)(function BalanceBadge2({ asChi
11886
11971
  currencyEquivalent = interpolate(copy.balance.currencyEquivalent, { amount: formatted });
11887
11972
  }
11888
11973
  }
11889
- const content = children ?? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
11974
+ const content = children ?? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
11890
11975
  formattedCredits,
11891
11976
  !numberOnly && copy.balance.credits,
11892
11977
  !numberOnly && currencyEquivalent
@@ -11894,28 +11979,14 @@ var BalanceBadge = (0, import_react53.forwardRef)(function BalanceBadge2({ asChi
11894
11979
  if (asChild) {
11895
11980
  return (
11896
11981
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11897
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Slot, { ref: forwardedRef, ...commonProps, children: content })
11982
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slot, { ref: forwardedRef, ...commonProps, children: content })
11898
11983
  );
11899
11984
  }
11900
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { ref: forwardedRef, ...commonProps, children: content });
11985
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { ref: forwardedRef, ...commonProps, children: content });
11901
11986
  });
11902
11987
 
11903
- // src/mcp/format-compact-credits.ts
11904
- function formatCompactCredits(credits, locale = "en-US") {
11905
- if (!Number.isFinite(credits) || credits < 0) {
11906
- throw new Error(`formatCompactCredits: credits must be a finite non-negative number, got ${credits}`);
11907
- }
11908
- if (credits >= 1e6 && credits % 1e6 === 0) {
11909
- return `${credits / 1e6}M credits`;
11910
- }
11911
- if (credits >= 1e3 && credits % 1e3 === 0) {
11912
- return `${credits / 1e3}K credits`;
11913
- }
11914
- return `${credits.toLocaleString(locale)} credits`;
11915
- }
11916
-
11917
11988
  // src/mcp/views/McpTopupView.tsx
11918
- var import_jsx_runtime49 = require("react/jsx-runtime");
11989
+ var import_jsx_runtime50 = require("react/jsx-runtime");
11919
11990
  var FALLBACK_TOPUP_CURRENCY = "USD";
11920
11991
  function resolveDefaultCurrency(merchant) {
11921
11992
  if (merchant?.defaultCurrency) {
@@ -11923,14 +11994,6 @@ function resolveDefaultCurrency(merchant) {
11923
11994
  }
11924
11995
  return FALLBACK_TOPUP_CURRENCY;
11925
11996
  }
11926
- function estimateTopupCredits(amountMinor, payCurrency, displayCurrency, creditsPerMinorUnit, displayExchangeRate) {
11927
- const rateAppliesToCurrency = displayCurrency != null && payCurrency.toUpperCase() === displayCurrency.toUpperCase();
11928
- if (!rateAppliesToCurrency || creditsPerMinorUnit == null || creditsPerMinorUnit <= 0 || displayExchangeRate == null || displayExchangeRate <= 0) {
11929
- return { kind: "unavailable" };
11930
- }
11931
- const credits = Math.floor(amountMinor / displayExchangeRate * creditsPerMinorUnit);
11932
- return { kind: "available", credits };
11933
- }
11934
11997
  function McpTopupView({
11935
11998
  publishableKey = null,
11936
11999
  returnUrl,
@@ -11942,14 +12005,14 @@ function McpTopupView({
11942
12005
  const probe = useStripeProbe(publishableKey);
11943
12006
  const { merchant, loading: merchantLoading } = useMerchant();
11944
12007
  if (merchantLoading) {
11945
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("section", { className: cx2.card, "aria-label": "Loading top-up", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { children: "Loading top-up\u2026" }) });
12008
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("section", { className: cx2.card, "aria-label": "Loading top-up", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { children: "Loading top-up\u2026" }) });
11946
12009
  }
11947
12010
  const defaultCurrency = resolveDefaultCurrency(merchant ?? void 0);
11948
12011
  const fromMerchant = (merchant?.supportedTopupCurrencies ?? []).map((code) => code.toUpperCase()).filter(Boolean);
11949
12012
  const topupCurrencies = Array.from(
11950
12013
  new Set(fromMerchant.length > 0 ? fromMerchant : [defaultCurrency])
11951
12014
  );
11952
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12015
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11953
12016
  EmbeddedTopup,
11954
12017
  {
11955
12018
  returnUrl,
@@ -11995,17 +12058,17 @@ function EmbeddedTopup({
11995
12058
  creditsPerMinorUnit,
11996
12059
  displayExchangeRate
11997
12060
  );
11998
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { className: cx2.card, "aria-label": "Top-up success", children: [
11999
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "solvapay-mcp-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
12000
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("h2", { className: cx2.heading, children: "Credits added" }),
12001
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("dl", { className: "solvapay-mcp-checkout-receipt", "data-variant": "payg", children: [
12002
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
12003
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("dt", { children: "Amount" }),
12004
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("dd", { children: formatPrice(screen.amountMinor, currency, { locale, free: "" }) })
12061
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("section", { className: cx2.card, "aria-label": "Top-up success", children: [
12062
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "solvapay-mcp-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
12063
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h2", { className: cx2.heading, children: "Credits added" }),
12064
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("dl", { className: "solvapay-mcp-checkout-receipt", "data-variant": "payg", children: [
12065
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
12066
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("dt", { children: "Amount" }),
12067
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("dd", { children: formatPrice(screen.amountMinor, currency, { locale, free: "" }) })
12005
12068
  ] }),
12006
- estimate.kind === "available" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
12007
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("dt", { children: "Credits" }),
12008
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("dd", { children: [
12069
+ estimate.kind === "available" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "solvapay-mcp-checkout-receipt-row", children: [
12070
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("dt", { children: "Credits" }),
12071
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("dd", { children: [
12009
12072
  "+",
12010
12073
  estimate.credits.toLocaleString(locale)
12011
12074
  ] })
@@ -12015,10 +12078,10 @@ function EmbeddedTopup({
12015
12078
  }
12016
12079
  if (screen.step === "payment") {
12017
12080
  if (stripeProbe === "loading") {
12018
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("section", { className: cx2.card, "aria-label": "Loading top-up", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { children: "Loading top-up\u2026" }) });
12081
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("section", { className: cx2.card, "aria-label": "Loading top-up", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { children: "Loading top-up\u2026" }) });
12019
12082
  }
12020
12083
  if (stripeProbe === "blocked") {
12021
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(HostedTopupFallback, { cx: cx2, onChangeAmount: () => setScreen({ step: "amount" }) });
12084
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(HostedTopupFallback, { cx: cx2, onChangeAmount: () => setScreen({ step: "amount" }) });
12022
12085
  }
12023
12086
  const committedAmountMinor = screen.amountMinor;
12024
12087
  const savesCard = screen.autoRecharge != null;
@@ -12034,7 +12097,7 @@ function EmbeddedTopup({
12034
12097
  creditEstimate.kind === "available" ? `Adds ${creditEstimate.credits.toLocaleString(locale)} credits` : void 0,
12035
12098
  formattedBalance ? `Balance ${formattedBalance} credits` : void 0
12036
12099
  ].filter((part) => part != null);
12037
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("section", { className: cx2.card, "aria-label": "Top-up payment", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12100
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("section", { className: cx2.card, "aria-label": "Top-up payment", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12038
12101
  TopupForm.Root,
12039
12102
  {
12040
12103
  amount: committedAmountMinor,
@@ -12059,32 +12122,32 @@ function EmbeddedTopup({
12059
12122
  });
12060
12123
  onTopupSuccess?.(committedAmountMinor);
12061
12124
  },
12062
- children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(McpHostedLayout, { children: [
12063
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(McpSummaryRail, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { className: cx2.stack, children: [
12064
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: cx2.muted, children: "Total due today" }),
12065
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: cx2.topupAmountHero, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TopupChargeAmount, { amountMinor: committedAmountMinor, currency }) }),
12066
- contextParts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: cx2.topupBalanceContext, children: contextParts.join(" \xB7 ") }) : null,
12067
- isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TopupForm.Summary.Rows, { className: cx2.taxSummary }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TopupForm.Summary.TaxNote, { className: cx2.muted })
12125
+ children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(McpHostedLayout, { children: [
12126
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(McpSummaryRail, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("section", { className: cx2.stack, children: [
12127
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: cx2.muted, children: "Total due today" }),
12128
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: cx2.topupAmountHero, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TopupChargeAmount, { amountMinor: committedAmountMinor, currency }) }),
12129
+ contextParts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: cx2.topupBalanceContext, children: contextParts.join(" \xB7 ") }) : null,
12130
+ isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TopupForm.Summary.Rows, { className: cx2.taxSummary }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TopupForm.Summary.TaxNote, { className: cx2.muted })
12068
12131
  ] }) }),
12069
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(McpHostedBody, { children: [
12070
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12132
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(McpHostedBody, { children: [
12133
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12071
12134
  McpPaymentHeader,
12072
12135
  {
12073
12136
  backLabel: "Change amount",
12074
12137
  onBack: () => setScreen({ step: "amount" })
12075
12138
  }
12076
12139
  ),
12077
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cx2.topupForm, children: [
12078
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TopupForm.Loading, {}),
12079
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TopupForm.PaymentElement, { options: MCP_PAYMENT_ELEMENT_OPTIONS }),
12080
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TopupForm.BusinessDetails.Root, { className: cx2.businessDetails, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TopupForm.BusinessDetails.Fields, {}) }),
12081
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TopupForm.Error, { className: cx2.error }),
12082
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(TopupForm.SubmitButton, { className: cx2.button, children: [
12140
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cx2.topupForm, children: [
12141
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TopupForm.Loading, {}),
12142
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TopupForm.PaymentElement, { options: MCP_PAYMENT_ELEMENT_OPTIONS }),
12143
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TopupForm.BusinessDetails.Root, { className: cx2.businessDetails, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TopupForm.BusinessDetails.Fields, {}) }),
12144
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TopupForm.Error, { className: cx2.error }),
12145
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(TopupForm.SubmitButton, { className: cx2.button, children: [
12083
12146
  "Top up",
12084
12147
  " ",
12085
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TopupChargeAmount, { amountMinor: committedAmountMinor, currency })
12148
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TopupChargeAmount, { amountMinor: committedAmountMinor, currency })
12086
12149
  ] }),
12087
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12150
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12088
12151
  MandateText,
12089
12152
  {
12090
12153
  mode: "topup",
@@ -12100,7 +12163,7 @@ function EmbeddedTopup({
12100
12163
  ) });
12101
12164
  }
12102
12165
  const currencyDisplay = showCurrencySwitch ? "code" : "symbol";
12103
- const amountForm = /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
12166
+ const amountForm = /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
12104
12167
  AmountPicker.Root,
12105
12168
  {
12106
12169
  currency,
@@ -12108,7 +12171,7 @@ function EmbeddedTopup({
12108
12171
  selector: topupSelector,
12109
12172
  className: cx2.amountPicker,
12110
12173
  children: [
12111
- isFullscreen ? null : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12174
+ isFullscreen ? null : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12112
12175
  AmountStepHeader,
12113
12176
  {
12114
12177
  cx: cx2,
@@ -12118,15 +12181,15 @@ function EmbeddedTopup({
12118
12181
  onCurrencyChange: handleCurrencyChange
12119
12182
  }
12120
12183
  ),
12121
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PresetAmountGrid, { currencyDisplay, locale }),
12122
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12184
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PresetAmountGrid, { currencyDisplay }),
12185
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12123
12186
  CustomAmountRow2,
12124
12187
  {
12125
12188
  rowClassName: cx2.amountCustom,
12126
12189
  currencyDisplay
12127
12190
  }
12128
12191
  ),
12129
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12192
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12130
12193
  McpInlineAutoRecharge,
12131
12194
  {
12132
12195
  ref: autoRechargeRef,
@@ -12135,8 +12198,8 @@ function EmbeddedTopup({
12135
12198
  displayExchangeRate
12136
12199
  }
12137
12200
  ),
12138
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(AmountDueSummary, { locale, currency }),
12139
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12201
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(AmountDueSummary, { locale, currency }),
12202
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12140
12203
  AmountPicker.Confirm,
12141
12204
  {
12142
12205
  className: cx2.button,
@@ -12165,8 +12228,8 @@ function EmbeddedTopup({
12165
12228
  }
12166
12229
  );
12167
12230
  if (isFullscreen) {
12168
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("section", { className: cx2.card, "aria-label": "Add credits", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(McpHostedLayout, { children: [
12169
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(McpSummaryRail, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12231
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("section", { className: cx2.card, "aria-label": "Add credits", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(McpHostedLayout, { children: [
12232
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(McpSummaryRail, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12170
12233
  AmountStepHeader,
12171
12234
  {
12172
12235
  cx: cx2,
@@ -12177,14 +12240,14 @@ function EmbeddedTopup({
12177
12240
  rail: true
12178
12241
  }
12179
12242
  ) }),
12180
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(McpHostedBody, { children: [
12181
- onBack ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BackLink, { label: "Back to my account", onClick: onBack }) : null,
12243
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(McpHostedBody, { children: [
12244
+ onBack ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BackLink, { label: "Back to my account", onClick: onBack }) : null,
12182
12245
  amountForm
12183
12246
  ] })
12184
12247
  ] }) });
12185
12248
  }
12186
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { className: cx2.card, "aria-label": "Add credits", children: [
12187
- onBack ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BackLink, { label: "Back to my account", onClick: onBack }) : null,
12249
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("section", { className: cx2.card, "aria-label": "Add credits", children: [
12250
+ onBack ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BackLink, { label: "Back to my account", onClick: onBack }) : null,
12188
12251
  amountForm
12189
12252
  ] });
12190
12253
  }
@@ -12195,7 +12258,7 @@ function TopupChargeAmount({
12195
12258
  const locale = useHostLocale();
12196
12259
  const { taxBreakdown } = useTopupForm();
12197
12260
  const minor = chargeAmountMinor(taxBreakdown, amountMinor);
12198
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx_runtime49.Fragment, { children: formatPrice(minor, taxBreakdown?.currency ?? currency, { locale, free: "" }) });
12261
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_jsx_runtime50.Fragment, { children: formatPrice(minor, taxBreakdown?.currency ?? currency, { locale, free: "" }) });
12199
12262
  }
12200
12263
  function AmountStepHeader({
12201
12264
  cx: cx2,
@@ -12208,69 +12271,43 @@ function AmountStepHeader({
12208
12271
  const { credits } = useBalance();
12209
12272
  const locale = useHostLocale();
12210
12273
  const formattedBalance = credits != null ? new Intl.NumberFormat(locale).format(credits) : void 0;
12211
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("header", { className: rail ? cx2.stack : void 0, children: [
12212
- rail ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
12213
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Eyebrow, { variant: "rail", children: "Add credits" }),
12214
- formattedBalance ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { className: cx2.muted, children: [
12274
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("header", { className: rail ? cx2.stack : void 0, children: [
12275
+ rail ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
12276
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Eyebrow, { variant: "rail", children: "Add credits" }),
12277
+ formattedBalance ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("p", { className: cx2.muted, children: [
12215
12278
  "Balance ",
12216
12279
  formattedBalance,
12217
12280
  " credits"
12218
12281
  ] }) : null
12219
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cx2.balanceRow, children: [
12220
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("h2", { className: cx2.heading, children: "Add credits" }),
12221
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BalanceBadge, {})
12282
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cx2.balanceRow, children: [
12283
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h2", { className: cx2.heading, children: "Add credits" }),
12284
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BalanceBadge, {})
12222
12285
  ] }),
12223
- showCurrencySwitch ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "solvapay-mcp-step-header", children: [
12224
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: cx2.muted, children: "Pay in" }),
12225
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12286
+ showCurrencySwitch ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "solvapay-mcp-step-header", children: [
12287
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: cx2.muted, children: "Pay in" }),
12288
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12226
12289
  "select",
12227
12290
  {
12228
12291
  className: "solvapay-mcp-currency-switch",
12229
12292
  value: currency,
12230
12293
  onChange: (event) => onCurrencyChange(event.target.value),
12231
12294
  "aria-label": "Topup currency",
12232
- children: topupCurrencies.map((code) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("option", { value: code, children: code }, code))
12295
+ children: topupCurrencies.map((code) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: code, children: code }, code))
12233
12296
  }
12234
12297
  )
12235
12298
  ] }) : null
12236
12299
  ] });
12237
12300
  }
12238
- function PresetAmountGrid({
12239
- currencyDisplay,
12240
- locale
12241
- }) {
12242
- const { quickAmounts, currency, creditsPerMinorUnit, displayExchangeRate } = useAmountPicker();
12243
- const { displayCurrency } = useBalance();
12244
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "solvapay-mcp-preset-grid", "aria-label": "Quick amounts", children: quickAmounts.map((amount) => {
12245
- const minor = amount * getMinorUnitsPerMajor(currency);
12246
- const label = formatPrice(minor, currency, {
12247
- locale,
12248
- free: "",
12249
- currencyDisplay
12250
- });
12251
- const estimate = estimateTopupCredits(
12252
- minor,
12253
- currency,
12254
- displayCurrency,
12255
- creditsPerMinorUnit,
12256
- displayExchangeRate
12257
- );
12258
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(AmountPicker.Option, { amount, className: "solvapay-mcp-preset-tile", children: [
12259
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "solvapay-mcp-preset-tile-amount", children: label }),
12260
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "solvapay-mcp-preset-tile-credits", children: estimate.kind === "available" ? formatCompactCredits(estimate.credits, locale) : "" })
12261
- ] }, amount);
12262
- }) });
12263
- }
12264
12301
  function AmountDueSummary({ locale, currency }) {
12265
12302
  const { resolvedAmountMinor } = useAmountPicker();
12266
12303
  const displayAmount = resolvedAmountMinor != null ? formatPrice(resolvedAmountMinor, currency, { locale, free: "" }) : formatPrice(0, currency, { locale, free: "" });
12267
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12304
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12268
12305
  AmountLadder,
12269
12306
  {
12270
12307
  rows: [
12271
12308
  {
12272
12309
  label: "Total due today",
12273
- value: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "solvapay-mcp-topup-total", children: displayAmount })
12310
+ value: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "solvapay-mcp-topup-total", children: displayAmount })
12274
12311
  }
12275
12312
  ]
12276
12313
  }
@@ -12282,20 +12319,20 @@ function CustomAmountRow2({
12282
12319
  }) {
12283
12320
  const { currencySymbol: currencySymbol2, currency } = useAmountPicker();
12284
12321
  const prefix = currencyDisplay === "code" ? currency.toUpperCase() : currencySymbol2;
12285
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: rowClassName, children: [
12286
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "solvapay-mcp-amount-currency-symbol", children: prefix }),
12287
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(AmountPicker.Custom, { className: "solvapay-mcp-amount-custom-input", placeholder: "0.00" })
12322
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: rowClassName, children: [
12323
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "solvapay-mcp-amount-currency-symbol", children: prefix }),
12324
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(AmountPicker.Custom, { className: "solvapay-mcp-amount-custom-input", placeholder: "0.00" })
12288
12325
  ] });
12289
12326
  }
12290
12327
  function HostedTopupFallback({
12291
12328
  cx: cx2,
12292
12329
  onChangeAmount
12293
12330
  }) {
12294
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("section", { className: cx2.card, "aria-label": "Add credits", children: [
12295
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BackLink, { label: "Change amount", onClick: onChangeAmount }),
12296
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("h2", { className: cx2.heading, children: "Add credits" }),
12297
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("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." }),
12298
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
12331
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("section", { className: cx2.card, "aria-label": "Add credits", children: [
12332
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BackLink, { label: "Change amount", onClick: onChangeAmount }),
12333
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h2", { className: cx2.heading, children: "Add credits" }),
12334
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("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." }),
12335
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12299
12336
  LaunchCustomerPortalButton,
12300
12337
  {
12301
12338
  className: cx2.button,
@@ -12308,7 +12345,7 @@ function HostedTopupFallback({
12308
12345
  }
12309
12346
 
12310
12347
  // src/mcp/McpAppShell.tsx
12311
- var import_jsx_runtime50 = require("react/jsx-runtime");
12348
+ var import_jsx_runtime51 = require("react/jsx-runtime");
12312
12349
  function resolveSurface(bootstrapView) {
12313
12350
  switch (bootstrapView) {
12314
12351
  case "checkout":
@@ -12345,8 +12382,8 @@ function McpAppShell({
12345
12382
  const effectiveView = overrideView ?? resolvedView;
12346
12383
  const showFooter = footer ?? true;
12347
12384
  const surface = effectiveView === "account" || effectiveView === "auto-recharge" ? "management" : "payment";
12348
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "solvapay-mcp-shell", children: [
12349
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(McpHostedColumn, { surface, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(McpHostedLayout, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "solvapay-mcp-shell-body", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12385
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "solvapay-mcp-shell", children: [
12386
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(McpHostedColumn, { surface, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(McpHostedLayout, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "solvapay-mcp-shell-body", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
12350
12387
  McpViewRouter,
12351
12388
  {
12352
12389
  view: effectiveView,
@@ -12359,12 +12396,16 @@ function McpAppShell({
12359
12396
  onClose
12360
12397
  }
12361
12398
  ) }) }) }),
12362
- showFooter ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ShellFooter, { classNames }) : null
12399
+ showFooter ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ShellFooter, { classNames }) : null
12363
12400
  ] });
12364
12401
  }
12365
12402
  function ShellFooter({ classNames }) {
12366
12403
  const cx2 = resolveMcpClassNames(classNames);
12367
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("footer", { className: `solvapay-mcp-shell-footer ${cx2.muted}`.trim(), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LegalFooter, { attribution: "provided" }) });
12404
+ const copy = useCopy();
12405
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("footer", { className: `solvapay-mcp-shell-footer ${cx2.muted}`.trim(), children: [
12406
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: copy.legalFooter.providedBy }),
12407
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(LegalFooter, { attribution: false })
12408
+ ] });
12368
12409
  }
12369
12410
  function McpViewRouter({
12370
12411
  view,
@@ -12385,7 +12426,7 @@ function McpViewRouter({
12385
12426
  const goAccount = onSurfaceChange ? () => onSurfaceChange("account") : void 0;
12386
12427
  switch (view) {
12387
12428
  case "checkout":
12388
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12429
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
12389
12430
  CheckoutView,
12390
12431
  {
12391
12432
  productRef,
@@ -12403,7 +12444,7 @@ function McpViewRouter({
12403
12444
  );
12404
12445
  case "auto-recharge":
12405
12446
  case "account":
12406
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12447
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
12407
12448
  AccountView,
12408
12449
  {
12409
12450
  classNames,
@@ -12417,7 +12458,7 @@ function McpViewRouter({
12417
12458
  }
12418
12459
  );
12419
12460
  case "topup":
12420
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
12461
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
12421
12462
  TopupView,
12422
12463
  {
12423
12464
  publishableKey: stripePublishableKey,
@@ -12436,17 +12477,17 @@ var import_react57 = require("react");
12436
12477
 
12437
12478
  // src/mcp/hooks/useHostInfo.tsx
12438
12479
  var import_react56 = require("react");
12439
- var import_jsx_runtime51 = require("react/jsx-runtime");
12480
+ var import_jsx_runtime52 = require("react/jsx-runtime");
12440
12481
  var McpHostInfoContext = (0, import_react56.createContext)(null);
12441
12482
  function McpHostInfoProvider({ hostName, children }) {
12442
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(McpHostInfoContext.Provider, { value: hostName, children });
12483
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(McpHostInfoContext.Provider, { value: hostName, children });
12443
12484
  }
12444
12485
  function useHostName() {
12445
12486
  return (0, import_react56.useContext)(McpHostInfoContext);
12446
12487
  }
12447
12488
 
12448
12489
  // src/mcp/views/AppHeader.tsx
12449
- var import_jsx_runtime52 = require("react/jsx-runtime");
12490
+ var import_jsx_runtime53 = require("react/jsx-runtime");
12450
12491
  var HOSTS_WITH_MERCHANT_CHROME = /chatgpt|openai|claude/i;
12451
12492
  function useMerchantSafe() {
12452
12493
  const ctx = (0, import_react57.useContext)(SolvaPayContext);
@@ -12499,8 +12540,8 @@ function AppHeader({
12499
12540
  const rootClass = [cx2.appHeader, className].filter(Boolean).join(" ");
12500
12541
  const hasIconUrl = iconUrl !== null && !imgFailed;
12501
12542
  const showInitials = !hasIconUrl || !imgLoaded;
12502
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("header", { className: rootClass, children: [
12503
- hasIconUrl ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
12543
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("header", { className: rootClass, children: [
12544
+ hasIconUrl ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
12504
12545
  "img",
12505
12546
  {
12506
12547
  ref: imgRef,
@@ -12512,14 +12553,14 @@ function AppHeader({
12512
12553
  onError: () => setImgFailed(true)
12513
12554
  }
12514
12555
  ) : null,
12515
- showInitials ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: cx2.appHeaderInitials, "aria-hidden": "true", children: getInitials(name) }) : null,
12516
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: cx2.appHeaderName, children: name }),
12517
- children ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "solvapay-mcp-app-header-slot", children }) : null
12556
+ showInitials ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: cx2.appHeaderInitials, "aria-hidden": "true", children: getInitials(name) }) : null,
12557
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: cx2.appHeaderName, children: name }),
12558
+ children ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "solvapay-mcp-app-header-slot", children }) : null
12518
12559
  ] });
12519
12560
  }
12520
12561
 
12521
12562
  // src/mcp/McpApp.tsx
12522
- var import_jsx_runtime53 = require("react/jsx-runtime");
12563
+ var import_jsx_runtime54 = require("react/jsx-runtime");
12523
12564
  function bootstrapToInitial(bs) {
12524
12565
  return {
12525
12566
  customerRef: bs.customer?.ref ?? null,
@@ -12533,6 +12574,7 @@ function bootstrapToInitial(bs) {
12533
12574
  plans: bs.plans
12534
12575
  };
12535
12576
  }
12577
+ var OPENING_RESULT_GRACE_MS = 1500;
12536
12578
  function McpApp({
12537
12579
  app,
12538
12580
  productRef: productRefOverride,
@@ -12567,9 +12609,18 @@ function McpApp({
12567
12609
  setHostName(null);
12568
12610
  setDisplayModeState(DEFAULT_DISPLAY_MODE_STATE);
12569
12611
  let hasBootstrap = false;
12612
+ let toolCallInFlight = false;
12613
+ let initialFetchInFlight = false;
12614
+ let graceTimer = null;
12615
+ const clearGrace = () => {
12616
+ if (graceTimer !== null) {
12617
+ clearTimeout(graceTimer);
12618
+ graceTimer = null;
12619
+ }
12620
+ };
12570
12621
  const loadBootstrap = async () => {
12571
- if (cancelled || hasBootstrap || pendingBootstrapFetchRef.current > 0) return;
12572
- pendingBootstrapFetchRef.current += 1;
12622
+ if (cancelled || hasBootstrap || initialFetchInFlight) return;
12623
+ initialFetchInFlight = true;
12573
12624
  try {
12574
12625
  let resolved;
12575
12626
  try {
@@ -12577,17 +12628,16 @@ function McpApp({
12577
12628
  } catch {
12578
12629
  resolved = await fetchMcpBootstrap(app);
12579
12630
  }
12580
- if (!cancelled) {
12581
- hasBootstrap = true;
12582
- setBootstrap(resolved);
12583
- }
12631
+ if (cancelled || hasBootstrap) return;
12632
+ hasBootstrap = true;
12633
+ setBootstrap(resolved);
12584
12634
  } catch (err) {
12585
12635
  if (cancelled) return;
12586
12636
  const message = err instanceof Error ? err.message : "Failed to initialize SolvaPay";
12587
12637
  setInitError(message);
12588
12638
  onInitErrorRef.current?.(err instanceof Error ? err : new Error(message));
12589
12639
  } finally {
12590
- pendingBootstrapFetchRef.current = Math.max(0, pendingBootstrapFetchRef.current - 1);
12640
+ initialFetchInFlight = false;
12591
12641
  }
12592
12642
  };
12593
12643
  const applyHostContext = (ctx) => {
@@ -12598,33 +12648,51 @@ function McpApp({
12598
12648
  applyHostContext(ctx);
12599
12649
  };
12600
12650
  app.onteardown = async () => ({});
12651
+ const onToolInput = () => {
12652
+ if (cancelled) return;
12653
+ toolCallInFlight = true;
12654
+ clearGrace();
12655
+ };
12656
+ const onToolCancelled = () => {
12657
+ if (cancelled) return;
12658
+ toolCallInFlight = false;
12659
+ clearGrace();
12660
+ if (!hasBootstrap) void loadBootstrap();
12661
+ };
12601
12662
  const onToolResult = (params) => {
12602
12663
  if (cancelled) return;
12603
12664
  const toolName = app.getHostContext?.()?.toolInfo?.tool?.name ?? null;
12604
12665
  if (toolName && isTransportToolName(toolName)) return;
12605
12666
  if (pendingBootstrapFetchRef.current) return;
12606
12667
  try {
12607
- const intentView = toolName ? import_mcp_core3.VIEW_FOR_TOOL[toolName] : void 0;
12608
- const fallbackView = intentView ?? "checkout";
12609
12668
  const fresh = parseBootstrapFromToolResult(
12610
12669
  params,
12611
12670
  toolName ?? "(unknown tool)",
12612
- fallbackView
12671
+ fallbackViewFromHost(app)
12613
12672
  );
12673
+ toolCallInFlight = false;
12614
12674
  hasBootstrap = true;
12675
+ clearGrace();
12615
12676
  setBootstrap(fresh);
12616
12677
  } catch {
12617
- if (!hasBootstrap && classifyHostEntry(app).kind === "intent") {
12678
+ toolCallInFlight = false;
12679
+ clearGrace();
12680
+ if (!hasBootstrap) {
12618
12681
  void loadBootstrap();
12619
- return;
12620
12682
  }
12621
12683
  }
12622
12684
  };
12623
12685
  let unsubscribe;
12624
12686
  if (typeof app.addEventListener === "function") {
12625
12687
  app.addEventListener("toolresult", onToolResult);
12688
+ app.addEventListener("toolinput", onToolInput);
12689
+ app.addEventListener("toolinputpartial", onToolInput);
12690
+ app.addEventListener("toolcancelled", onToolCancelled);
12626
12691
  unsubscribe = () => {
12627
12692
  app.removeEventListener?.("toolresult", onToolResult);
12693
+ app.removeEventListener?.("toolinput", onToolInput);
12694
+ app.removeEventListener?.("toolinputpartial", onToolInput);
12695
+ app.removeEventListener?.("toolcancelled", onToolCancelled);
12628
12696
  };
12629
12697
  } else {
12630
12698
  const prior = app.ontoolresult;
@@ -12645,8 +12713,13 @@ function McpApp({
12645
12713
  applyHostContext(app.getHostContext());
12646
12714
  setHostName(app.getHostVersion?.()?.name ?? null);
12647
12715
  const hostEntry = classifyHostEntry(app);
12648
- if (hostEntry.kind === "other") {
12716
+ if (hostEntry.kind === "other" && hostEntry.toolName && isTransportToolName(hostEntry.toolName)) {
12649
12717
  await loadBootstrap();
12718
+ } else if (hostEntry.kind === "other" && !toolCallInFlight) {
12719
+ graceTimer = setTimeout(() => {
12720
+ graceTimer = null;
12721
+ if (!cancelled && !hasBootstrap && !toolCallInFlight) void loadBootstrap();
12722
+ }, OPENING_RESULT_GRACE_MS);
12650
12723
  }
12651
12724
  } catch (err) {
12652
12725
  if (cancelled) return;
@@ -12657,6 +12730,7 @@ function McpApp({
12657
12730
  })();
12658
12731
  return () => {
12659
12732
  cancelled = true;
12733
+ clearGrace();
12660
12734
  unsubscribe?.();
12661
12735
  };
12662
12736
  }, [app]);
@@ -12741,31 +12815,31 @@ function McpApp({
12741
12815
  );
12742
12816
  const effectiveOnClose = onClose ?? defaultOnClose;
12743
12817
  const effectiveBootstrap = bootstrap && productRefOverride ? { ...bootstrap, productRef: productRefOverride } : bootstrap;
12744
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(McpHostInfoProvider, { hostName, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(McpDisplayModeProvider, { value: displayModeState, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
12818
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(McpHostInfoProvider, { hostName, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(McpDisplayModeProvider, { value: displayModeState, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
12745
12819
  "main",
12746
12820
  {
12747
12821
  className: "solvapay-mcp-main",
12748
12822
  "data-display-mode": displayModeState.displayMode,
12749
12823
  style: hostSafeAreaPadding(displayModeState.safeAreaInsets),
12750
12824
  children: [
12751
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "solvapay-mcp-chrome-row", children: displayModeState.displayMode !== "fullscreen" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
12825
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "solvapay-mcp-chrome-row", children: displayModeState.displayMode !== "fullscreen" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
12752
12826
  AppHeader,
12753
12827
  {
12754
12828
  classNames,
12755
12829
  merchant: effectiveBootstrap?.merchant ?? null
12756
12830
  }
12757
12831
  ) : null }),
12758
- initError ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `${cx2.card} ${cx2.error}`.trim(), children: [
12759
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h2", { className: cx2.heading, children: "Unable to load SolvaPay" }),
12760
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { children: initError })
12832
+ initError ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: `${cx2.card} ${cx2.error}`.trim(), children: [
12833
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h2", { className: cx2.heading, children: "Unable to load SolvaPay" }),
12834
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { children: initError })
12761
12835
  ] }) : !effectiveBootstrap ? (
12762
12836
  // Intent-tool / fallback entries show a loading card while the
12763
12837
  // in-flight `fetchMcpBootstrap` call resolves. Data-tool iframe
12764
12838
  // entries no longer exist (payable merchant tools don't advertise
12765
12839
  // `_meta.ui.resourceUri`) so this is always legitimate user
12766
12840
  // feedback for an in-flight tool call.
12767
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: cx2.card, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { children: "Loading\u2026" }) })
12768
- ) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SolvaPayProvider, { config: providerConfig, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(McpBridgeProvider, { app, messageOnSuccess, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
12841
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: cx2.card, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { children: "Loading\u2026" }) })
12842
+ ) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SolvaPayProvider, { config: providerConfig, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(McpBridgeProvider, { app, messageOnSuccess, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
12769
12843
  McpAppShell,
12770
12844
  {
12771
12845
  bootstrap: effectiveBootstrap,