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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -526,6 +526,9 @@ var enCopy = {
526
526
  expiresOn: "Expires {date}",
527
527
  validIndefinitely: "Valid indefinitely",
528
528
  startedOn: "Started {date}",
529
+ priceFieldLabel: "Price",
530
+ rateFieldLabel: "Rate",
531
+ balanceFieldLabel: "Balance",
529
532
  paymentMethod: "{brand} \u2022\u2022\u2022\u2022 {last4}",
530
533
  paymentMethodExpires: "expires {month}/{year}",
531
534
  noPaymentMethod: "No payment method on file",
@@ -545,7 +548,9 @@ var enCopy = {
545
548
  noPlanTitle: "Pick a plan",
546
549
  noPlanBody: "Choose a free, pay-as-you-go, or paid plan to start using this MCP server.",
547
550
  seePlansButton: "See plans",
548
- pickPlanButton: "Pick a plan"
551
+ pickPlanButton: "Pick a plan",
552
+ upgradeButton: "Upgrade",
553
+ changePlanButton: "Change plan"
549
554
  },
550
555
  customerPortal: {
551
556
  launchButton: "Manage account",
@@ -1435,6 +1440,45 @@ function useLocale() {
1435
1440
  return useCopyContext().locale;
1436
1441
  }
1437
1442
 
1443
+ // src/hooks/useExternalLink.tsx
1444
+ import { createContext as createContext3, useCallback as useCallback2, useContext as useContext2 } from "react";
1445
+ import { jsx as jsx4 } from "react/jsx-runtime";
1446
+ var ExternalLinkContext = createContext3(null);
1447
+ function ExternalLinkProvider({ opener, children }) {
1448
+ return /* @__PURE__ */ jsx4(ExternalLinkContext.Provider, { value: opener, children });
1449
+ }
1450
+ function useOpenExternal() {
1451
+ const opener = useContext2(ExternalLinkContext);
1452
+ return useCallback2(
1453
+ async (url) => {
1454
+ if (opener?.canOpen()) return opener.open(url);
1455
+ if (typeof window !== "undefined") {
1456
+ window.open(url, "_blank", "noopener,noreferrer");
1457
+ }
1458
+ return true;
1459
+ },
1460
+ [opener]
1461
+ );
1462
+ }
1463
+ function useExternalLinkClick() {
1464
+ const opener = useContext2(ExternalLinkContext);
1465
+ return useCallback2(
1466
+ (event) => {
1467
+ if (event.defaultPrevented) return;
1468
+ if (!opener?.canOpen()) return;
1469
+ const href = event.currentTarget.href;
1470
+ if (!href) return;
1471
+ event.preventDefault();
1472
+ void opener.open(href).then((opened) => {
1473
+ if (!opened) {
1474
+ console.warn(`[solvapay] host declined to open ${href}`);
1475
+ }
1476
+ });
1477
+ },
1478
+ [opener]
1479
+ );
1480
+ }
1481
+
1438
1482
  // src/primitives/LegalFooter.tsx
1439
1483
  import { forwardRef } from "react";
1440
1484
 
@@ -1444,7 +1488,7 @@ var SOLVAPAY_PRIVACY_URL = "https://solvapay.com/legal/privacy";
1444
1488
  var SOLVAPAY_WEBSITE_URL = "https://solvapay.com";
1445
1489
 
1446
1490
  // src/primitives/LegalFooter.tsx
1447
- import { Fragment as Fragment2, jsx as jsx4, jsxs } from "react/jsx-runtime";
1491
+ import { Fragment as Fragment2, jsx as jsx5, jsxs } from "react/jsx-runtime";
1448
1492
  var LegalFooter = forwardRef(
1449
1493
  function LegalFooter2({
1450
1494
  attribution = "provided",
@@ -1455,39 +1499,43 @@ var LegalFooter = forwardRef(
1455
1499
  ...rest
1456
1500
  }, forwardedRef) {
1457
1501
  const copy = useCopy();
1502
+ const handleExternalClick = useExternalLinkClick();
1458
1503
  const attributionLabel = attribution === "provided" ? copy.legalFooter.providedBy : attribution === "powered" ? copy.legalFooter.poweredBy : null;
1459
1504
  const Comp = asChild ? Slot : "div";
1460
- return /* @__PURE__ */ jsx4(Comp, { ref: forwardedRef, "data-solvapay-legal-footer": "", ...rest, children: children ?? /* @__PURE__ */ jsxs(Fragment2, { children: [
1505
+ return /* @__PURE__ */ jsx5(Comp, { ref: forwardedRef, "data-solvapay-legal-footer": "", ...rest, children: children ?? /* @__PURE__ */ jsxs(Fragment2, { children: [
1461
1506
  /* @__PURE__ */ jsxs("div", { "data-solvapay-legal-footer-links": "", children: [
1462
- /* @__PURE__ */ jsx4(
1507
+ /* @__PURE__ */ jsx5(
1463
1508
  "a",
1464
1509
  {
1465
1510
  "data-solvapay-legal-footer-link": "",
1466
1511
  href: termsUrl,
1467
1512
  target: "_blank",
1468
1513
  rel: "noopener noreferrer",
1514
+ onClick: handleExternalClick,
1469
1515
  children: copy.legalFooter.terms
1470
1516
  }
1471
1517
  ),
1472
- /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", children: " \xB7 " }),
1473
- /* @__PURE__ */ jsx4(
1518
+ /* @__PURE__ */ jsx5("span", { "aria-hidden": "true", children: " \xB7 " }),
1519
+ /* @__PURE__ */ jsx5(
1474
1520
  "a",
1475
1521
  {
1476
1522
  "data-solvapay-legal-footer-link": "",
1477
1523
  href: privacyUrl,
1478
1524
  target: "_blank",
1479
1525
  rel: "noopener noreferrer",
1526
+ onClick: handleExternalClick,
1480
1527
  children: copy.legalFooter.privacy
1481
1528
  }
1482
1529
  )
1483
1530
  ] }),
1484
- attributionLabel ? /* @__PURE__ */ jsx4(
1531
+ attributionLabel ? /* @__PURE__ */ jsx5(
1485
1532
  "a",
1486
1533
  {
1487
1534
  "data-solvapay-legal-footer-attribution": "",
1488
1535
  href: SOLVAPAY_WEBSITE_URL,
1489
1536
  target: "_blank",
1490
1537
  rel: "noopener noreferrer",
1538
+ onClick: handleExternalClick,
1491
1539
  children: attributionLabel
1492
1540
  }
1493
1541
  ) : null
@@ -1496,9 +1544,9 @@ var LegalFooter = forwardRef(
1496
1544
  );
1497
1545
 
1498
1546
  // src/hooks/useSolvaPay.ts
1499
- import { useContext as useContext2 } from "react";
1547
+ import { useContext as useContext3 } from "react";
1500
1548
  function useSolvaPay() {
1501
- const context = useContext2(SolvaPayContext);
1549
+ const context = useContext3(SolvaPayContext);
1502
1550
  if (!context) {
1503
1551
  throw new Error(
1504
1552
  "useSolvaPay must be used within a SolvaPayProvider. Wrap your component tree with <SolvaPayProvider> to use this hook."
@@ -1508,19 +1556,19 @@ function useSolvaPay() {
1508
1556
  }
1509
1557
 
1510
1558
  // src/hooks/useCheckout.ts
1511
- import { useState as useState2, useCallback as useCallback2, useRef as useRef2 } from "react";
1559
+ import { useState as useState2, useCallback as useCallback3, useRef as useRef2 } from "react";
1512
1560
  import { loadStripe } from "@stripe/stripe-js";
1513
1561
 
1514
1562
  // src/components/PlanSelectionContext.tsx
1515
- import { createContext as createContext3, useContext as useContext3 } from "react";
1516
- import { jsx as jsx5 } from "react/jsx-runtime";
1517
- var PlanSelectionContext = createContext3(null);
1563
+ import { createContext as createContext4, useContext as useContext4 } from "react";
1564
+ import { jsx as jsx6 } from "react/jsx-runtime";
1565
+ var PlanSelectionContext = createContext4(null);
1518
1566
  var PlanSelectionProvider = ({
1519
1567
  value,
1520
1568
  children
1521
- }) => /* @__PURE__ */ jsx5(PlanSelectionContext.Provider, { value, children });
1569
+ }) => /* @__PURE__ */ jsx6(PlanSelectionContext.Provider, { value, children });
1522
1570
  function usePlanSelection() {
1523
- return useContext3(PlanSelectionContext);
1571
+ return useContext4(PlanSelectionContext);
1524
1572
  }
1525
1573
 
1526
1574
  // src/hooks/useCheckout.ts
@@ -1571,7 +1619,7 @@ function useCheckout(options) {
1571
1619
  const [processorPaymentId, setProcessorPaymentId] = useState2(null);
1572
1620
  const [resolvedPlanRef, setResolvedPlanRef] = useState2(planRef || null);
1573
1621
  const isStartingRef = useRef2(false);
1574
- const startCheckout = useCallback2(async () => {
1622
+ const startCheckout = useCallback3(async () => {
1575
1623
  if (isStartingRef.current || loading) {
1576
1624
  return;
1577
1625
  }
@@ -1647,7 +1695,7 @@ function useCheckout(options) {
1647
1695
  loading,
1648
1696
  _config
1649
1697
  ]);
1650
- const reset = useCallback2(() => {
1698
+ const reset = useCallback3(() => {
1651
1699
  isStartingRef.current = false;
1652
1700
  setLoading(false);
1653
1701
  setError(null);
@@ -1689,7 +1737,7 @@ function useCustomer() {
1689
1737
  }
1690
1738
 
1691
1739
  // src/hooks/usePlans.ts
1692
- import { useContext as useContext4, useState as useState3, useEffect as useEffect2, useCallback as useCallback3, useMemo as useMemo3, useRef as useRef3 } from "react";
1740
+ import { useContext as useContext5, useState as useState3, useEffect as useEffect2, useCallback as useCallback4, useMemo as useMemo3, useRef as useRef3 } from "react";
1693
1741
 
1694
1742
  // src/transport/list-plans.ts
1695
1743
  async function defaultListPlans(productRef, config) {
@@ -1742,7 +1790,7 @@ function usePlans(options) {
1742
1790
  initialPlanRef,
1743
1791
  selectionReady = true
1744
1792
  } = options;
1745
- const solvaContext = useContext4(SolvaPayContext);
1793
+ const solvaContext = useContext5(SolvaPayContext);
1746
1794
  const config = solvaContext?._config;
1747
1795
  const effectiveFetcher = useMemo3(
1748
1796
  () => fetcher ?? ((ref) => defaultListPlans(ref, config)),
@@ -1796,11 +1844,11 @@ function usePlans(options) {
1796
1844
  useEffect2(() => {
1797
1845
  selectionReadyRef.current = selectionReady;
1798
1846
  }, [selectionReady]);
1799
- const setSelectedPlanIndex = useCallback3((index) => {
1847
+ const setSelectedPlanIndex = useCallback4((index) => {
1800
1848
  userHasSelectedRef.current = true;
1801
1849
  setSelectedPlanIndexState(index);
1802
1850
  }, []);
1803
- const applyInitialSelection = useCallback3((processedPlans) => {
1851
+ const applyInitialSelection = useCallback4((processedPlans) => {
1804
1852
  if (hasAppliedInitialRef.current || userHasSelectedRef.current) return;
1805
1853
  if (!selectionReadyRef.current || processedPlans.length === 0) return;
1806
1854
  hasAppliedInitialRef.current = true;
@@ -1811,7 +1859,7 @@ function usePlans(options) {
1811
1859
  );
1812
1860
  setSelectedPlanIndexState(idx);
1813
1861
  }, []);
1814
- const fetchPlans = useCallback3(
1862
+ const fetchPlans = useCallback4(
1815
1863
  async (force = false) => {
1816
1864
  if (!productRef) {
1817
1865
  setError(new Error("Product reference not configured"));
@@ -1883,7 +1931,7 @@ function usePlans(options) {
1883
1931
  applyInitialSelection(plans);
1884
1932
  }, [selectionReady, plans, applyInitialSelection]);
1885
1933
  const selectedPlan = useMemo3(() => plans[selectedPlanIndex] || null, [plans, selectedPlanIndex]);
1886
- const selectPlan = useCallback3(
1934
+ const selectPlan = useCallback4(
1887
1935
  (planRef) => {
1888
1936
  const index = plans.findIndex((p) => p.reference === planRef);
1889
1937
  if (index >= 0) {
@@ -1906,11 +1954,11 @@ function usePlans(options) {
1906
1954
  }
1907
1955
 
1908
1956
  // src/hooks/usePlan.ts
1909
- import { useCallback as useCallback4, useEffect as useEffect3, useState as useState4 } from "react";
1957
+ import { useCallback as useCallback5, useEffect as useEffect3, useState as useState4 } from "react";
1910
1958
  function usePlan(options) {
1911
1959
  const { planRef, productRef } = options;
1912
1960
  const { _config } = useSolvaPay();
1913
- const findPlan = useCallback4(
1961
+ const findPlan = useCallback5(
1914
1962
  (plans) => {
1915
1963
  if (!planRef) return null;
1916
1964
  return plans.find((p) => p.reference === planRef) || null;
@@ -1925,7 +1973,7 @@ function usePlan(options) {
1925
1973
  });
1926
1974
  const [loading, setLoading] = useState4(() => !!(planRef && !plan));
1927
1975
  const [error, setError] = useState4(null);
1928
- const load = useCallback4(
1976
+ const load = useCallback5(
1929
1977
  async (force = false) => {
1930
1978
  if (!planRef) {
1931
1979
  setPlan(null);
@@ -2004,7 +2052,7 @@ function usePlan(options) {
2004
2052
  }
2005
2053
 
2006
2054
  // src/hooks/useProduct.ts
2007
- import { useCallback as useCallback5, useEffect as useEffect4, useState as useState5 } from "react";
2055
+ import { useCallback as useCallback6, useEffect as useEffect4, useState as useState5 } from "react";
2008
2056
  var productCache = /* @__PURE__ */ new Map();
2009
2057
  var CACHE_DURATION4 = 5 * 60 * 1e3;
2010
2058
  function cacheKeyFor(config, productRef) {
@@ -2027,7 +2075,7 @@ function useProduct(productRef) {
2027
2075
  return !cached || !cached.product && !cached.promise;
2028
2076
  });
2029
2077
  const [error, setError] = useState5(null);
2030
- const load = useCallback5(
2078
+ const load = useCallback6(
2031
2079
  async (force = false) => {
2032
2080
  if (!productRef) {
2033
2081
  setProduct(null);
@@ -2100,14 +2148,14 @@ function useProduct(productRef) {
2100
2148
  }
2101
2149
 
2102
2150
  // src/hooks/useActivation.ts
2103
- import { useState as useState6, useCallback as useCallback6 } from "react";
2151
+ import { useState as useState6, useCallback as useCallback7 } from "react";
2104
2152
  function useActivation() {
2105
2153
  const { activatePlan } = useSolvaPay();
2106
2154
  const copy = useCopy();
2107
2155
  const [state, setState] = useState6("idle");
2108
2156
  const [error, setError] = useState6(null);
2109
2157
  const [result, setResult] = useState6(null);
2110
- const activate = useCallback6(
2158
+ const activate = useCallback7(
2111
2159
  async (params) => {
2112
2160
  setState("activating");
2113
2161
  setError(null);
@@ -2142,7 +2190,7 @@ function useActivation() {
2142
2190
  },
2143
2191
  [activatePlan, copy]
2144
2192
  );
2145
- const reset = useCallback6(() => {
2193
+ const reset = useCallback7(() => {
2146
2194
  setState("idle");
2147
2195
  setError(null);
2148
2196
  setResult(null);
@@ -2151,11 +2199,11 @@ function useActivation() {
2151
2199
  }
2152
2200
 
2153
2201
  // src/components/PaymentFormContext.tsx
2154
- import { createContext as createContext4, useContext as useContext5 } from "react";
2155
- import { jsx as jsx6 } from "react/jsx-runtime";
2156
- var PaymentFormContext = createContext4(null);
2202
+ import { createContext as createContext5, useContext as useContext6 } from "react";
2203
+ import { jsx as jsx7 } from "react/jsx-runtime";
2204
+ var PaymentFormContext = createContext5(null);
2157
2205
  function usePaymentForm() {
2158
- const ctx = useContext5(PaymentFormContext);
2206
+ const ctx = useContext6(PaymentFormContext);
2159
2207
  if (!ctx) {
2160
2208
  throw new Error(
2161
2209
  "PaymentForm subcomponents must be used inside a <PaymentForm>. Wrap the slots with <PaymentForm planRef=... productRef=...>."
@@ -2163,7 +2211,7 @@ function usePaymentForm() {
2163
2211
  }
2164
2212
  return ctx;
2165
2213
  }
2166
- var PaymentFormProvider = ({ value, children }) => /* @__PURE__ */ jsx6(PaymentFormContext.Provider, { value, children });
2214
+ var PaymentFormProvider = ({ value, children }) => /* @__PURE__ */ jsx7(PaymentFormContext.Provider, { value, children });
2167
2215
 
2168
2216
  // src/utils/format.ts
2169
2217
  var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
@@ -2230,7 +2278,7 @@ function interpolate(template, vars) {
2230
2278
  }
2231
2279
 
2232
2280
  // src/primitives/CheckoutSummary.tsx
2233
- import { createContext as createContext5, forwardRef as forwardRef3, useContext as useContext6, useMemo as useMemo4 } from "react";
2281
+ import { createContext as createContext6, forwardRef as forwardRef3, useContext as useContext7, useMemo as useMemo4 } from "react";
2234
2282
 
2235
2283
  // src/components/businessCheckoutParts.tsx
2236
2284
  import { forwardRef as forwardRef2 } from "react";
@@ -2242,7 +2290,7 @@ import {
2242
2290
  getTaxIdExample,
2243
2291
  getTaxIdHelperText
2244
2292
  } from "@solvapay/core";
2245
- import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
2293
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
2246
2294
  function mapBusinessFieldErrors(input) {
2247
2295
  const result = validateBusinessDetails(input);
2248
2296
  if (result.success) return {};
@@ -2305,7 +2353,7 @@ function createBusinessDetailsParts(useCtx, prefix) {
2305
2353
  const Root8 = forwardRef2(function BusinessDetailsRoot({ asChild, children, ...rest }, forwardedRef) {
2306
2354
  useCtx("BusinessDetails");
2307
2355
  const Comp = asChild ? Slot : "section";
2308
- return /* @__PURE__ */ jsx7(Comp, { ref: forwardedRef, ...{ [attr(prefix, "business-details")]: "" }, ...rest, children });
2356
+ return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, ...{ [attr(prefix, "business-details")]: "" }, ...rest, children });
2309
2357
  });
2310
2358
  const Toggle = forwardRef2(function BusinessDetailsToggle({ asChild, onChange, ...rest }, forwardedRef) {
2311
2359
  const ctx = useCtx("BusinessDetails.Toggle");
@@ -2319,9 +2367,9 @@ function createBusinessDetailsParts(useCtx, prefix) {
2319
2367
  ...rest
2320
2368
  };
2321
2369
  if (asChild) {
2322
- return /* @__PURE__ */ jsx7(Slot, { ref: forwardedRef, ...commonProps });
2370
+ return /* @__PURE__ */ jsx8(Slot, { ref: forwardedRef, ...commonProps });
2323
2371
  }
2324
- return /* @__PURE__ */ jsx7("input", { ref: forwardedRef, ...commonProps });
2372
+ return /* @__PURE__ */ jsx8("input", { ref: forwardedRef, ...commonProps });
2325
2373
  });
2326
2374
  const BusinessName = forwardRef2(
2327
2375
  function BusinessDetailsBusinessName({ asChild, onChange, ...rest }, forwardedRef) {
@@ -2338,9 +2386,9 @@ function createBusinessDetailsParts(useCtx, prefix) {
2338
2386
  ...rest
2339
2387
  };
2340
2388
  if (asChild) {
2341
- return /* @__PURE__ */ jsx7(Slot, { ref: forwardedRef, ...commonProps });
2389
+ return /* @__PURE__ */ jsx8(Slot, { ref: forwardedRef, ...commonProps });
2342
2390
  }
2343
- return /* @__PURE__ */ jsx7("input", { ref: forwardedRef, ...commonProps });
2391
+ return /* @__PURE__ */ jsx8("input", { ref: forwardedRef, ...commonProps });
2344
2392
  }
2345
2393
  );
2346
2394
  const Country = forwardRef2(function BusinessDetailsCountry({ asChild, onChange, children, ...rest }, forwardedRef) {
@@ -2356,13 +2404,13 @@ function createBusinessDetailsParts(useCtx, prefix) {
2356
2404
  ...rest
2357
2405
  };
2358
2406
  const defaultOptions = /* @__PURE__ */ jsxs2(Fragment3, { children: [
2359
- /* @__PURE__ */ jsx7("option", { value: "", children: "Select country" }),
2360
- BUSINESS_COUNTRY_OPTIONS.map(({ value, label }) => /* @__PURE__ */ jsx7("option", { value, children: label }, value))
2407
+ /* @__PURE__ */ jsx8("option", { value: "", children: "Select country" }),
2408
+ BUSINESS_COUNTRY_OPTIONS.map(({ value, label }) => /* @__PURE__ */ jsx8("option", { value, children: label }, value))
2361
2409
  ] });
2362
2410
  if (asChild) {
2363
- return /* @__PURE__ */ jsx7(Slot, { ref: forwardedRef, ...commonProps, children: children ?? defaultOptions });
2411
+ return /* @__PURE__ */ jsx8(Slot, { ref: forwardedRef, ...commonProps, children: children ?? defaultOptions });
2364
2412
  }
2365
- return /* @__PURE__ */ jsx7("select", { ref: forwardedRef, ...commonProps, children: children ?? defaultOptions });
2413
+ return /* @__PURE__ */ jsx8("select", { ref: forwardedRef, ...commonProps, children: children ?? defaultOptions });
2366
2414
  });
2367
2415
  const TaxId = forwardRef2(function BusinessDetailsTaxId({ asChild, onChange, ...rest }, forwardedRef) {
2368
2416
  const ctx = useCtx("BusinessDetails.TaxId");
@@ -2378,9 +2426,9 @@ function createBusinessDetailsParts(useCtx, prefix) {
2378
2426
  ...rest
2379
2427
  };
2380
2428
  if (asChild) {
2381
- return /* @__PURE__ */ jsx7(Slot, { ref: forwardedRef, ...commonProps });
2429
+ return /* @__PURE__ */ jsx8(Slot, { ref: forwardedRef, ...commonProps });
2382
2430
  }
2383
- return /* @__PURE__ */ jsx7("input", { ref: forwardedRef, ...commonProps });
2431
+ return /* @__PURE__ */ jsx8("input", { ref: forwardedRef, ...commonProps });
2384
2432
  });
2385
2433
  const Fields = forwardRef2(function BusinessDetailsFields({ asChild, children, ...rest }, forwardedRef) {
2386
2434
  const ctx = useCtx("BusinessDetails.Fields");
@@ -2390,30 +2438,30 @@ function createBusinessDetailsParts(useCtx, prefix) {
2390
2438
  const taxIdHelperText = resolveTaxIdHelperText(country);
2391
2439
  const content = /* @__PURE__ */ jsxs2(Fragment3, { children: [
2392
2440
  /* @__PURE__ */ jsxs2("label", { className: "solvapay-checkout-business-toggle", children: [
2393
- /* @__PURE__ */ jsx7(Toggle, {}),
2441
+ /* @__PURE__ */ jsx8(Toggle, {}),
2394
2442
  "I'm purchasing as a business"
2395
2443
  ] }),
2396
2444
  ctx.businessDetails.isBusiness ? /* @__PURE__ */ jsxs2("fieldset", { className: "solvapay-business-fields", children: [
2397
2445
  /* @__PURE__ */ jsxs2("label", { className: "solvapay-business-field", children: [
2398
- /* @__PURE__ */ jsx7("span", { className: "solvapay-business-field-label", children: "Business name" }),
2399
- /* @__PURE__ */ jsx7(BusinessName, { placeholder: "Acme GmbH" })
2446
+ /* @__PURE__ */ jsx8("span", { className: "solvapay-business-field-label", children: "Business name" }),
2447
+ /* @__PURE__ */ jsx8(BusinessName, { placeholder: "Acme GmbH" })
2400
2448
  ] }),
2401
2449
  /* @__PURE__ */ jsxs2("label", { className: "solvapay-business-field", children: [
2402
- /* @__PURE__ */ jsx7("span", { className: "solvapay-business-field-label", children: "Country" }),
2403
- /* @__PURE__ */ jsx7(Country, {})
2450
+ /* @__PURE__ */ jsx8("span", { className: "solvapay-business-field-label", children: "Country" }),
2451
+ /* @__PURE__ */ jsx8(Country, {})
2404
2452
  ] }),
2405
2453
  /* @__PURE__ */ jsxs2("label", { className: "solvapay-business-field", children: [
2406
- /* @__PURE__ */ jsx7("span", { className: "solvapay-business-field-label", children: taxIdLabel }),
2407
- /* @__PURE__ */ jsx7(TaxId, { placeholder: taxIdPlaceholder }),
2408
- taxIdHelperText ? /* @__PURE__ */ jsx7("p", { className: "solvapay-business-field-hint", children: taxIdHelperText }) : null
2454
+ /* @__PURE__ */ jsx8("span", { className: "solvapay-business-field-label", children: taxIdLabel }),
2455
+ /* @__PURE__ */ jsx8(TaxId, { placeholder: taxIdPlaceholder }),
2456
+ taxIdHelperText ? /* @__PURE__ */ jsx8("p", { className: "solvapay-business-field-hint", children: taxIdHelperText }) : null
2409
2457
  ] })
2410
2458
  ] }) : null,
2411
2459
  children
2412
2460
  ] });
2413
2461
  if (asChild) {
2414
- return /* @__PURE__ */ jsx7(Slot, { ref: forwardedRef, ...rest, children: content });
2462
+ return /* @__PURE__ */ jsx8(Slot, { ref: forwardedRef, ...rest, children: content });
2415
2463
  }
2416
- return /* @__PURE__ */ jsx7("section", { ref: forwardedRef, ...{ [attr(prefix, "business-details-fields")]: "" }, ...rest, children: content });
2464
+ return /* @__PURE__ */ jsx8("section", { ref: forwardedRef, ...{ [attr(prefix, "business-details-fields")]: "" }, ...rest, children: content });
2417
2465
  });
2418
2466
  return {
2419
2467
  Root: Root8,
@@ -2448,14 +2496,14 @@ function createTaxSummaryParts(useCtx, prefix) {
2448
2496
  const ctx = useCtx("Summary");
2449
2497
  if (!ctx.isBusiness) return null;
2450
2498
  const Comp = asChild ? Slot : "section";
2451
- return /* @__PURE__ */ jsx7(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary")]: "" }, ...rest, children });
2499
+ return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary")]: "" }, ...rest, children });
2452
2500
  });
2453
2501
  const Subtotal = forwardRef2(function TaxSummarySubtotal({ asChild, children, ...rest }, forwardedRef) {
2454
2502
  const ctx = useCtx("Summary.Subtotal");
2455
2503
  const { subtotalFormatted } = useSummaryAmounts(useCtx, "Summary.Subtotal");
2456
2504
  if (!ctx.isBusiness) return null;
2457
2505
  const Comp = asChild ? Slot : "span";
2458
- return /* @__PURE__ */ jsx7(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-subtotal")]: "" }, ...rest, children: children ?? subtotalFormatted });
2506
+ return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-subtotal")]: "" }, ...rest, children: children ?? subtotalFormatted });
2459
2507
  });
2460
2508
  const Tax = forwardRef2(function TaxSummaryTax({ asChild, children, ...rest }, forwardedRef) {
2461
2509
  const ctx = useCtx("Summary.Tax");
@@ -2467,10 +2515,10 @@ function createTaxSummaryParts(useCtx, prefix) {
2467
2515
  treatment: treatment ?? "standard",
2468
2516
  taxRate
2469
2517
  });
2470
- return /* @__PURE__ */ jsx7(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-tax")]: "" }, ...rest, children: children ?? /* @__PURE__ */ jsxs2(Fragment3, { children: [
2471
- /* @__PURE__ */ jsx7("span", { children: defaultLabel }),
2518
+ return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-tax")]: "" }, ...rest, children: children ?? /* @__PURE__ */ jsxs2(Fragment3, { children: [
2519
+ /* @__PURE__ */ jsx8("span", { children: defaultLabel }),
2472
2520
  " ",
2473
- /* @__PURE__ */ jsx7("span", { ...{ [attr(prefix, "summary-tax-amount")]: "" }, children: taxFormatted })
2521
+ /* @__PURE__ */ jsx8("span", { ...{ [attr(prefix, "summary-tax-amount")]: "" }, children: taxFormatted })
2474
2522
  ] }) });
2475
2523
  });
2476
2524
  const Total = forwardRef2(function TaxSummaryTotal({ asChild, children, ...rest }, forwardedRef) {
@@ -2478,7 +2526,7 @@ function createTaxSummaryParts(useCtx, prefix) {
2478
2526
  const { totalFormatted } = useSummaryAmounts(useCtx, "Summary.Total");
2479
2527
  if (!ctx.isBusiness) return null;
2480
2528
  const Comp = asChild ? Slot : "span";
2481
- return /* @__PURE__ */ jsx7(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-total")]: "" }, ...rest, children: children ?? totalFormatted });
2529
+ return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-total")]: "" }, ...rest, children: children ?? totalFormatted });
2482
2530
  });
2483
2531
  const TaxNote = forwardRef2(function TaxSummaryTaxNote({ asChild, children, ...rest }, forwardedRef) {
2484
2532
  const ctx = useCtx("Summary.TaxNote");
@@ -2488,7 +2536,7 @@ function createTaxSummaryParts(useCtx, prefix) {
2488
2536
  const Comp = asChild ? Slot : "p";
2489
2537
  const defaultNote = treatment === "reverse_charge" ? REVERSE_CHARGE_NOTE : treatment === "not_collecting" || treatment === "not_supported" ? TAX_NOT_COLLECTED_NOTE : null;
2490
2538
  if (!defaultNote && !children) return null;
2491
- return /* @__PURE__ */ jsx7(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-tax-note")]: "" }, ...rest, children: children ?? defaultNote });
2539
+ return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, ...{ [attr(prefix, "summary-tax-note")]: "" }, ...rest, children: children ?? defaultNote });
2492
2540
  });
2493
2541
  const Rows = forwardRef2(function TaxSummaryRows({ asChild, children, ...rest }, forwardedRef) {
2494
2542
  const ctx = useCtx("Summary.Rows");
@@ -2501,24 +2549,24 @@ function createTaxSummaryParts(useCtx, prefix) {
2501
2549
  });
2502
2550
  const content = /* @__PURE__ */ jsxs2("dl", { className: "solvapay-tax-summary-rows", children: [
2503
2551
  /* @__PURE__ */ jsxs2("div", { className: "solvapay-tax-summary-row", children: [
2504
- /* @__PURE__ */ jsx7("dt", { children: formatSubtotalLabel(treatment) }),
2505
- /* @__PURE__ */ jsx7("dd", { children: /* @__PURE__ */ jsx7(Subtotal, {}) })
2552
+ /* @__PURE__ */ jsx8("dt", { children: formatSubtotalLabel(treatment) }),
2553
+ /* @__PURE__ */ jsx8("dd", { children: /* @__PURE__ */ jsx8(Subtotal, {}) })
2506
2554
  ] }),
2507
2555
  showTaxRow ? /* @__PURE__ */ jsxs2("div", { className: "solvapay-tax-summary-row", children: [
2508
- /* @__PURE__ */ jsx7("dt", { children: vatLabel }),
2509
- /* @__PURE__ */ jsx7("dd", { children: /* @__PURE__ */ jsx7("span", { ...{ [attr(prefix, "summary-tax-amount")]: "" }, children: taxFormatted }) })
2556
+ /* @__PURE__ */ jsx8("dt", { children: vatLabel }),
2557
+ /* @__PURE__ */ jsx8("dd", { children: /* @__PURE__ */ jsx8("span", { ...{ [attr(prefix, "summary-tax-amount")]: "" }, children: taxFormatted }) })
2510
2558
  ] }) : null,
2511
2559
  /* @__PURE__ */ jsxs2("div", { className: "solvapay-tax-summary-row solvapay-tax-summary-row--total", children: [
2512
- /* @__PURE__ */ jsx7("dt", { children: "Total" }),
2513
- /* @__PURE__ */ jsx7("dd", { children: /* @__PURE__ */ jsx7(Total, {}) })
2560
+ /* @__PURE__ */ jsx8("dt", { children: "Total" }),
2561
+ /* @__PURE__ */ jsx8("dd", { children: /* @__PURE__ */ jsx8(Total, {}) })
2514
2562
  ] }),
2515
- /* @__PURE__ */ jsx7(TaxNote, {}),
2563
+ /* @__PURE__ */ jsx8(TaxNote, {}),
2516
2564
  children
2517
2565
  ] });
2518
2566
  if (asChild) {
2519
- return /* @__PURE__ */ jsx7(Slot, { ref: forwardedRef, ...rest, children: content });
2567
+ return /* @__PURE__ */ jsx8(Slot, { ref: forwardedRef, ...rest, children: content });
2520
2568
  }
2521
- return /* @__PURE__ */ jsx7("section", { ref: forwardedRef, ...{ [attr(prefix, "summary-rows")]: "" }, ...rest, children: content });
2569
+ return /* @__PURE__ */ jsx8("section", { ref: forwardedRef, ...{ [attr(prefix, "summary-rows")]: "" }, ...rest, children: content });
2522
2570
  });
2523
2571
  return {
2524
2572
  Root: Root8,
@@ -2566,10 +2614,10 @@ var MissingProductRefError = class extends SolvaPayError2 {
2566
2614
  };
2567
2615
 
2568
2616
  // src/primitives/CheckoutSummary.tsx
2569
- import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
2570
- var CheckoutSummaryContext = createContext5(null);
2617
+ import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
2618
+ var CheckoutSummaryContext = createContext6(null);
2571
2619
  function useCheckoutSummaryContext(part) {
2572
- const ctx = useContext6(CheckoutSummaryContext);
2620
+ const ctx = useContext7(CheckoutSummaryContext);
2573
2621
  if (!ctx) {
2574
2622
  throw new Error(
2575
2623
  `CheckoutSummary.${part} must be rendered inside <CheckoutSummary.Root>.`
@@ -2578,7 +2626,7 @@ function useCheckoutSummaryContext(part) {
2578
2626
  return ctx;
2579
2627
  }
2580
2628
  var Root = forwardRef3(function CheckoutSummaryRoot({ planRef, productRef, taxBreakdown = null, baseAmountMinor = 0, asChild, children, ...rest }, forwardedRef) {
2581
- const solva = useContext6(SolvaPayContext);
2629
+ const solva = useContext7(SolvaPayContext);
2582
2630
  if (!solva) throw new MissingProviderError("CheckoutSummary");
2583
2631
  const locale = useLocale();
2584
2632
  const copy = useCopy();
@@ -2640,35 +2688,35 @@ var Root = forwardRef3(function CheckoutSummaryRoot({ planRef, productRef, taxBr
2640
2688
  ]
2641
2689
  );
2642
2690
  const Comp = asChild ? Slot : "section";
2643
- return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary": "", ...rest, children: /* @__PURE__ */ jsx8(CheckoutSummaryContext.Provider, { value: ctx, children }) });
2691
+ return /* @__PURE__ */ jsx9(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary": "", ...rest, children: /* @__PURE__ */ jsx9(CheckoutSummaryContext.Provider, { value: ctx, children }) });
2644
2692
  });
2645
2693
  var ProductSlot = forwardRef3(function CheckoutSummaryProduct({ asChild, children, ...rest }, forwardedRef) {
2646
2694
  const ctx = useCheckoutSummaryContext("Product");
2647
2695
  const name = ctx.product?.name;
2648
2696
  if (!name) return null;
2649
2697
  const Comp = asChild ? Slot : "span";
2650
- return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-product": "", ...rest, children: children ?? name });
2698
+ return /* @__PURE__ */ jsx9(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-product": "", ...rest, children: children ?? name });
2651
2699
  });
2652
2700
  var PlanSlot = forwardRef3(function CheckoutSummaryPlan({ asChild, children, ...rest }, forwardedRef) {
2653
2701
  const ctx = useCheckoutSummaryContext("Plan");
2654
2702
  const name = ctx.plan?.name;
2655
2703
  if (!name) return null;
2656
2704
  const Comp = asChild ? Slot : "span";
2657
- return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-plan": "", ...rest, children: children ?? name });
2705
+ return /* @__PURE__ */ jsx9(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-plan": "", ...rest, children: children ?? name });
2658
2706
  });
2659
2707
  var TaxNoteSlot = forwardRef3(
2660
2708
  function CheckoutSummaryTaxNote({ asChild, children, ...rest }, forwardedRef) {
2661
2709
  const ctx = useCheckoutSummaryContext("TaxNote");
2662
2710
  if (ctx.taxBreakdown) return null;
2663
2711
  const Comp = asChild ? Slot : "p";
2664
- return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax-note": "", ...rest, children: children ?? "Taxes calculated at checkout" });
2712
+ return /* @__PURE__ */ jsx9(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax-note": "", ...rest, children: children ?? "Taxes calculated at checkout" });
2665
2713
  }
2666
2714
  );
2667
2715
  var SubtotalSlot = forwardRef3(function CheckoutSummarySubtotal({ asChild, children, ...rest }, forwardedRef) {
2668
2716
  const ctx = useCheckoutSummaryContext("Subtotal");
2669
2717
  if (!ctx.taxBreakdown) return null;
2670
2718
  const Comp = asChild ? Slot : "span";
2671
- return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-subtotal": "", ...rest, children: children ?? ctx.subtotalFormatted });
2719
+ return /* @__PURE__ */ jsx9(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-subtotal": "", ...rest, children: children ?? ctx.subtotalFormatted });
2672
2720
  });
2673
2721
  var TaxSlot = forwardRef3(function CheckoutSummaryTax({ asChild, children, ...rest }, forwardedRef) {
2674
2722
  const ctx = useCheckoutSummaryContext("Tax");
@@ -2677,17 +2725,17 @@ var TaxSlot = forwardRef3(function CheckoutSummaryTax({ asChild, children, ...re
2677
2725
  if (!shouldShowTaxRow(treatment)) return null;
2678
2726
  const Comp = asChild ? Slot : "span";
2679
2727
  const defaultLabel = formatVatSummaryLabel({ treatment, taxRate: taxRate ?? 0 });
2680
- return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax": "", ...rest, children: children ?? /* @__PURE__ */ jsxs3(Fragment4, { children: [
2681
- /* @__PURE__ */ jsx8("span", { children: defaultLabel }),
2728
+ return /* @__PURE__ */ jsx9(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax": "", ...rest, children: children ?? /* @__PURE__ */ jsxs3(Fragment4, { children: [
2729
+ /* @__PURE__ */ jsx9("span", { children: defaultLabel }),
2682
2730
  " ",
2683
- /* @__PURE__ */ jsx8("span", { "data-solvapay-checkout-summary-tax-amount": "", children: ctx.taxFormatted })
2731
+ /* @__PURE__ */ jsx9("span", { "data-solvapay-checkout-summary-tax-amount": "", children: ctx.taxFormatted })
2684
2732
  ] }) });
2685
2733
  });
2686
2734
  var TotalSlot = forwardRef3(function CheckoutSummaryTotal({ asChild, children, ...rest }, forwardedRef) {
2687
2735
  const ctx = useCheckoutSummaryContext("Total");
2688
2736
  if (!ctx.taxBreakdown) return null;
2689
2737
  const Comp = asChild ? Slot : "span";
2690
- return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-total": "", ...rest, children: children ?? ctx.totalFormatted });
2738
+ return /* @__PURE__ */ jsx9(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-total": "", ...rest, children: children ?? ctx.totalFormatted });
2691
2739
  });
2692
2740
  var TaxTreatmentNoteSlot = forwardRef3(
2693
2741
  function CheckoutSummaryTaxTreatmentNote({ asChild, children, ...rest }, forwardedRef) {
@@ -2697,21 +2745,21 @@ var TaxTreatmentNoteSlot = forwardRef3(
2697
2745
  const Comp = asChild ? Slot : "p";
2698
2746
  const defaultNote = treatment === "reverse_charge" ? REVERSE_CHARGE_NOTE : treatment === "not_collecting" || treatment === "not_supported" ? TAX_NOT_COLLECTED_NOTE : null;
2699
2747
  if (!defaultNote && !children) return null;
2700
- return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax-treatment-note": "", ...rest, children: children ?? defaultNote });
2748
+ return /* @__PURE__ */ jsx9(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-tax-treatment-note": "", ...rest, children: children ?? defaultNote });
2701
2749
  }
2702
2750
  );
2703
2751
  var PriceSlot = forwardRef3(function CheckoutSummaryPrice({ asChild, children, ...rest }, forwardedRef) {
2704
2752
  const ctx = useCheckoutSummaryContext("Price");
2705
2753
  if (ctx.taxBreakdown) return null;
2706
2754
  const Comp = asChild ? Slot : "span";
2707
- return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-price": "", ...rest, children: children ?? ctx.priceFormatted });
2755
+ return /* @__PURE__ */ jsx9(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-price": "", ...rest, children: children ?? ctx.priceFormatted });
2708
2756
  });
2709
2757
  var TrialSlot = forwardRef3(
2710
2758
  function CheckoutSummaryTrial({ asChild, children, ...rest }, forwardedRef) {
2711
2759
  const ctx = useCheckoutSummaryContext("Trial");
2712
2760
  if (!ctx.trialBanner || ctx.taxBreakdown) return null;
2713
2761
  const Comp = asChild ? Slot : "p";
2714
- return /* @__PURE__ */ jsx8(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-trial": "", ...rest, children: children ?? ctx.trialBanner });
2762
+ return /* @__PURE__ */ jsx9(Comp, { ref: forwardedRef, "data-solvapay-checkout-summary-trial": "", ...rest, children: children ?? ctx.trialBanner });
2715
2763
  }
2716
2764
  );
2717
2765
  var CheckoutSummaryRoot2 = Root;
@@ -2741,7 +2789,7 @@ function useCheckoutSummary() {
2741
2789
  }
2742
2790
 
2743
2791
  // src/components/CheckoutSummary.tsx
2744
- import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
2792
+ import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
2745
2793
  var CheckoutSummary2 = ({
2746
2794
  planRef,
2747
2795
  productRef,
@@ -2762,25 +2810,25 @@ var CheckoutSummary2 = ({
2762
2810
  baseAmountMinor,
2763
2811
  className: rootClass,
2764
2812
  children: [
2765
- /* @__PURE__ */ jsx9(CheckoutSummary.Product, { className: "solvapay-checkout-summary-product" }),
2813
+ /* @__PURE__ */ jsx10(CheckoutSummary.Product, { className: "solvapay-checkout-summary-product" }),
2766
2814
  /* @__PURE__ */ jsxs4("div", { className: "solvapay-checkout-summary-row", children: [
2767
- /* @__PURE__ */ jsx9(CheckoutSummary.Plan, { className: "solvapay-checkout-summary-plan" }),
2768
- !hasTax && /* @__PURE__ */ jsx9(CheckoutSummary.Price, { className: "solvapay-checkout-summary-price" })
2815
+ /* @__PURE__ */ jsx10(CheckoutSummary.Plan, { className: "solvapay-checkout-summary-plan" }),
2816
+ !hasTax && /* @__PURE__ */ jsx10(CheckoutSummary.Price, { className: "solvapay-checkout-summary-price" })
2769
2817
  ] }),
2770
2818
  hasTax ? /* @__PURE__ */ jsxs4(Fragment5, { children: [
2771
2819
  /* @__PURE__ */ jsxs4("div", { className: "solvapay-checkout-summary-row", children: [
2772
- /* @__PURE__ */ jsx9("span", { children: "Subtotal" }),
2773
- /* @__PURE__ */ jsx9(CheckoutSummary.Subtotal, { className: "solvapay-checkout-summary-subtotal" })
2820
+ /* @__PURE__ */ jsx10("span", { children: "Subtotal" }),
2821
+ /* @__PURE__ */ jsx10(CheckoutSummary.Subtotal, { className: "solvapay-checkout-summary-subtotal" })
2774
2822
  ] }),
2775
- /* @__PURE__ */ jsx9("div", { className: "solvapay-checkout-summary-row", children: /* @__PURE__ */ jsx9(CheckoutSummary.Tax, { className: "solvapay-checkout-summary-tax" }) }),
2823
+ /* @__PURE__ */ jsx10("div", { className: "solvapay-checkout-summary-row", children: /* @__PURE__ */ jsx10(CheckoutSummary.Tax, { className: "solvapay-checkout-summary-tax" }) }),
2776
2824
  /* @__PURE__ */ jsxs4("div", { className: "solvapay-checkout-summary-row", children: [
2777
- /* @__PURE__ */ jsx9("span", { children: "Total" }),
2778
- /* @__PURE__ */ jsx9(CheckoutSummary.Total, { className: "solvapay-checkout-summary-total" })
2825
+ /* @__PURE__ */ jsx10("span", { children: "Total" }),
2826
+ /* @__PURE__ */ jsx10(CheckoutSummary.Total, { className: "solvapay-checkout-summary-total" })
2779
2827
  ] }),
2780
- /* @__PURE__ */ jsx9(CheckoutSummary.TaxTreatmentNote, { className: "solvapay-checkout-summary-tax-treatment-note" })
2828
+ /* @__PURE__ */ jsx10(CheckoutSummary.TaxTreatmentNote, { className: "solvapay-checkout-summary-tax-treatment-note" })
2781
2829
  ] }) : /* @__PURE__ */ jsxs4(Fragment5, { children: [
2782
- showTrial && /* @__PURE__ */ jsx9(CheckoutSummary.Trial, { className: "solvapay-checkout-summary-trial" }),
2783
- showTaxNote && /* @__PURE__ */ jsx9(CheckoutSummary.TaxNote, { className: "solvapay-checkout-summary-tax-note" })
2830
+ showTrial && /* @__PURE__ */ jsx10(CheckoutSummary.Trial, { className: "solvapay-checkout-summary-trial" }),
2831
+ showTaxNote && /* @__PURE__ */ jsx10(CheckoutSummary.TaxNote, { className: "solvapay-checkout-summary-tax-note" })
2784
2832
  ] })
2785
2833
  ]
2786
2834
  }
@@ -2788,7 +2836,7 @@ var CheckoutSummary2 = ({
2788
2836
  };
2789
2837
 
2790
2838
  // src/hooks/useMerchant.ts
2791
- import { useCallback as useCallback7, useEffect as useEffect5, useState as useState7 } from "react";
2839
+ import { useCallback as useCallback8, useEffect as useEffect5, useState as useState7 } from "react";
2792
2840
  var merchantCache = /* @__PURE__ */ new Map();
2793
2841
  var CACHE_DURATION5 = 5 * 60 * 1e3;
2794
2842
  function cacheKeyFor2(config) {
@@ -2810,7 +2858,7 @@ function useMerchant() {
2810
2858
  return !cached || !cached.merchant && !cached.promise;
2811
2859
  });
2812
2860
  const [error, setError] = useState7(null);
2813
- const load = useCallback7(
2861
+ const load = useCallback8(
2814
2862
  async (force = false) => {
2815
2863
  const cached = merchantCache.get(key);
2816
2864
  const now = Date.now();
@@ -2893,8 +2941,8 @@ function deriveVariant(plan, mode) {
2893
2941
  }
2894
2942
 
2895
2943
  // src/primitives/MandateText.tsx
2896
- import { forwardRef as forwardRef4, useContext as useContext7, useMemo as useMemo5 } from "react";
2897
- import { jsx as jsx10 } from "react/jsx-runtime";
2944
+ import { forwardRef as forwardRef4, useContext as useContext8, useMemo as useMemo5 } from "react";
2945
+ import { jsx as jsx11 } from "react/jsx-runtime";
2898
2946
  var MandateText = forwardRef4(
2899
2947
  function MandateText2({
2900
2948
  planRef,
@@ -2907,10 +2955,11 @@ var MandateText = forwardRef4(
2907
2955
  children,
2908
2956
  ...rest
2909
2957
  }, forwardedRef) {
2910
- const solva = useContext7(SolvaPayContext);
2958
+ const solva = useContext8(SolvaPayContext);
2911
2959
  if (!solva) throw new MissingProviderError("MandateText");
2912
2960
  const locale = useLocale();
2913
2961
  const copy = useCopy();
2962
+ const handleExternalClick = useExternalLinkClick();
2914
2963
  const planSelection = usePlanSelection();
2915
2964
  const resolvedPlanRef = planRef ?? planSelection?.selectedPlanRef ?? void 0;
2916
2965
  const resolvedProductRef = productRef ?? planSelection?.productRef;
@@ -2951,19 +3000,19 @@ var MandateText = forwardRef4(
2951
3000
  const text = typeof template === "function" ? template(ctx) : template;
2952
3001
  if (!text) return null;
2953
3002
  const Comp = asChild ? Slot : "p";
2954
- return /* @__PURE__ */ jsx10(
3003
+ return /* @__PURE__ */ jsx11(
2955
3004
  Comp,
2956
3005
  {
2957
3006
  ref: forwardedRef,
2958
3007
  "data-solvapay-mandate-text": "",
2959
3008
  "data-variant": resolvedVariant,
2960
3009
  ...rest,
2961
- children: children ?? linkifyMandateText(text, ctx.merchant, copy)
3010
+ children: children ?? linkifyMandateText(text, ctx.merchant, copy, handleExternalClick)
2962
3011
  }
2963
3012
  );
2964
3013
  }
2965
3014
  );
2966
- function linkifyMandateText(text, merchant, copy) {
3015
+ function linkifyMandateText(text, merchant, copy, onLinkClick) {
2967
3016
  const entries = [
2968
3017
  { url: merchant.termsUrl, label: copy.legalFooter.terms },
2969
3018
  { url: merchant.privacyUrl, label: copy.legalFooter.privacy }
@@ -2973,13 +3022,14 @@ function linkifyMandateText(text, merchant, copy) {
2973
3022
  return text.split(pattern).map((part, i) => {
2974
3023
  const match = entries.find((e) => e.url === part);
2975
3024
  if (!match) return part;
2976
- return /* @__PURE__ */ jsx10(
3025
+ return /* @__PURE__ */ jsx11(
2977
3026
  "a",
2978
3027
  {
2979
3028
  href: match.url,
2980
3029
  target: "_blank",
2981
3030
  rel: "noopener noreferrer",
2982
3031
  "data-solvapay-mandate-link": "",
3032
+ onClick: onLinkClick,
2983
3033
  children: match.label || match.url
2984
3034
  },
2985
3035
  i
@@ -2991,7 +3041,7 @@ function escapeRegExp(value) {
2991
3041
  }
2992
3042
 
2993
3043
  // src/components/Spinner.tsx
2994
- import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
3044
+ import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
2995
3045
  var SIZE_PX = { sm: 16, md: 20, lg: 24 };
2996
3046
  var Spinner = ({ className, size = "md" }) => {
2997
3047
  const px = SIZE_PX[size];
@@ -3006,7 +3056,7 @@ var Spinner = ({ className, size = "md" }) => {
3006
3056
  fill: "none",
3007
3057
  "aria-hidden": "true",
3008
3058
  children: [
3009
- /* @__PURE__ */ jsx11(
3059
+ /* @__PURE__ */ jsx12(
3010
3060
  "circle",
3011
3061
  {
3012
3062
  cx: "12",
@@ -3017,7 +3067,7 @@ var Spinner = ({ className, size = "md" }) => {
3017
3067
  strokeOpacity: "0.25"
3018
3068
  }
3019
3069
  ),
3020
- /* @__PURE__ */ jsx11(
3070
+ /* @__PURE__ */ jsx12(
3021
3071
  "path",
3022
3072
  {
3023
3073
  fill: "currentColor",
@@ -3157,10 +3207,10 @@ function resolveCta(input) {
3157
3207
  }
3158
3208
 
3159
3209
  // src/primitives/PaymentForm.tsx
3160
- import React10, {
3210
+ import React11, {
3161
3211
  forwardRef as forwardRef5,
3162
- useCallback as useCallback9,
3163
- useContext as useContext8,
3212
+ useCallback as useCallback10,
3213
+ useContext as useContext9,
3164
3214
  useEffect as useEffect7,
3165
3215
  useMemo as useMemo6,
3166
3216
  useRef as useRef5,
@@ -3321,7 +3371,7 @@ function normalizeOneTimePurchase(input) {
3321
3371
  }
3322
3372
 
3323
3373
  // src/hooks/useBusinessDetailsAttach.ts
3324
- import { useCallback as useCallback8, useEffect as useEffect6, useRef as useRef4, useState as useState8 } from "react";
3374
+ import { useCallback as useCallback9, useEffect as useEffect6, useRef as useRef4, useState as useState8 } from "react";
3325
3375
  import {
3326
3376
  validateBusinessDetails as validateBusinessDetails2
3327
3377
  } from "@solvapay/core";
@@ -3341,7 +3391,7 @@ function useBusinessDetailsAttach(options) {
3341
3391
  const [businessDetailsError, setBusinessDetailsError] = useState8(null);
3342
3392
  const [fieldErrors, setFieldErrors] = useState8({});
3343
3393
  const attachRequestIdRef = useRef4(0);
3344
- const setBusinessDetails = useCallback8((patch) => {
3394
+ const setBusinessDetails = useCallback9((patch) => {
3345
3395
  setBusinessDetailsState((prev) => {
3346
3396
  const next = { ...prev, ...patch };
3347
3397
  if (patch.isBusiness === false) {
@@ -3352,7 +3402,7 @@ function useBusinessDetailsAttach(options) {
3352
3402
  setBusinessDetailsAttached(false);
3353
3403
  setBusinessDetailsError(null);
3354
3404
  }, []);
3355
- const runAttach = useCallback8(
3405
+ const runAttach = useCallback9(
3356
3406
  async (input) => {
3357
3407
  if (!processorPaymentId || !attachBusinessDetails) {
3358
3408
  return !attachBusinessDetails;
@@ -3423,7 +3473,7 @@ function useBusinessDetailsAttach(options) {
3423
3473
  }
3424
3474
 
3425
3475
  // src/primitives/PaymentForm.tsx
3426
- import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
3476
+ import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
3427
3477
  function toSubmitVariant(variant) {
3428
3478
  switch (variant) {
3429
3479
  case "freeTier":
@@ -3453,7 +3503,7 @@ var Root2 = forwardRef5(
3453
3503
  requireTermsAcceptance = false,
3454
3504
  children
3455
3505
  } = props;
3456
- const solva = useContext8(SolvaPayContext);
3506
+ const solva = useContext9(SolvaPayContext);
3457
3507
  if (!solva) throw new MissingProviderError("PaymentForm");
3458
3508
  const { attachBusinessDetails, customerRef } = solva;
3459
3509
  const copy = useCopy();
@@ -3501,19 +3551,19 @@ var Root2 = forwardRef5(
3501
3551
  }, [clientSecret, locale]);
3502
3552
  const shouldRenderElements = !!(stripePromise && clientSecret);
3503
3553
  if (!hasPlanOrProduct) {
3504
- return /* @__PURE__ */ jsx12(
3554
+ return /* @__PURE__ */ jsx13(
3505
3555
  "section",
3506
3556
  {
3507
3557
  ref: forwardedRef,
3508
3558
  className,
3509
3559
  "data-solvapay-payment-form": "",
3510
3560
  "data-state": "error",
3511
- children: /* @__PURE__ */ jsx12("p", { role: "alert", "data-solvapay-payment-form-error": "", children: copy.errors.configMissingPlanOrProduct })
3561
+ children: /* @__PURE__ */ jsx13("p", { role: "alert", "data-solvapay-payment-form-error": "", children: copy.errors.configMissingPlanOrProduct })
3512
3562
  }
3513
3563
  );
3514
3564
  }
3515
3565
  if (checkoutError) {
3516
- return /* @__PURE__ */ jsx12(
3566
+ return /* @__PURE__ */ jsx13(
3517
3567
  "section",
3518
3568
  {
3519
3569
  ref: forwardedRef,
@@ -3529,7 +3579,7 @@ var Root2 = forwardRef5(
3529
3579
  );
3530
3580
  }
3531
3581
  if (isFreePlan && resolvedPlan) {
3532
- return /* @__PURE__ */ jsx12(
3582
+ return /* @__PURE__ */ jsx13(
3533
3583
  "section",
3534
3584
  {
3535
3585
  ref: forwardedRef,
@@ -3537,7 +3587,7 @@ var Root2 = forwardRef5(
3537
3587
  "data-solvapay-payment-form": "",
3538
3588
  "data-state": "ready",
3539
3589
  "data-variant": "free",
3540
- children: /* @__PURE__ */ jsx12(
3590
+ children: /* @__PURE__ */ jsx13(
3541
3591
  FreeInner,
3542
3592
  {
3543
3593
  planRef: effectivePlanRef,
@@ -3558,7 +3608,7 @@ var Root2 = forwardRef5(
3558
3608
  }
3559
3609
  if (shouldRenderElements && elementsOptions && clientSecret) {
3560
3610
  const resolvedClientSecret = clientSecret;
3561
- return /* @__PURE__ */ jsx12(
3611
+ return /* @__PURE__ */ jsx13(
3562
3612
  "section",
3563
3613
  {
3564
3614
  ref: forwardedRef,
@@ -3566,7 +3616,7 @@ var Root2 = forwardRef5(
3566
3616
  "data-solvapay-payment-form": "",
3567
3617
  "data-state": "ready",
3568
3618
  "data-variant": "paid",
3569
- children: /* @__PURE__ */ jsx12(Elements, { stripe: stripePromise, options: elementsOptions, children: /* @__PURE__ */ jsx12(
3619
+ children: /* @__PURE__ */ jsx13(Elements, { stripe: stripePromise, options: elementsOptions, children: /* @__PURE__ */ jsx13(
3570
3620
  PaidInner,
3571
3621
  {
3572
3622
  planRef: effectivePlanRef,
@@ -3592,14 +3642,14 @@ var Root2 = forwardRef5(
3592
3642
  }
3593
3643
  );
3594
3644
  }
3595
- return /* @__PURE__ */ jsx12(
3645
+ return /* @__PURE__ */ jsx13(
3596
3646
  "section",
3597
3647
  {
3598
3648
  ref: forwardedRef,
3599
3649
  className,
3600
3650
  "data-solvapay-payment-form": "",
3601
3651
  "data-state": "loading",
3602
- children: /* @__PURE__ */ jsx12("output", { "data-solvapay-payment-form-loading": "", children: /* @__PURE__ */ jsx12(Spinner, { size: "md" }) })
3652
+ children: /* @__PURE__ */ jsx13("output", { "data-solvapay-payment-form-loading": "", children: /* @__PURE__ */ jsx13(Spinner, { size: "md" }) })
3603
3653
  }
3604
3654
  );
3605
3655
  }
@@ -3630,7 +3680,7 @@ var PaidInner = ({
3630
3680
  const customer = useCustomer();
3631
3681
  const { processPayment, upsertPurchase } = useSolvaPay();
3632
3682
  const { refetch } = usePurchase();
3633
- const refreshElements = useCallback9(async () => {
3683
+ const refreshElements = useCallback10(async () => {
3634
3684
  if (elements) {
3635
3685
  await elements.fetchUpdates();
3636
3686
  }
@@ -3749,7 +3799,7 @@ var PaidInner = ({
3749
3799
  ]);
3750
3800
  const isReady = !!(stripe && elements);
3751
3801
  const canSubmit = isReady && !!clientSecret && !!elementKind && paymentInputComplete && (!requireTermsAcceptance || termsAccepted) && (!requiresBusinessAttach || businessDetailsAttached) && !businessDetailsAttaching && !isProcessing;
3752
- const submit = useCallback9(async () => {
3802
+ const submit = useCallback10(async () => {
3753
3803
  if (!stripe || !elements || !clientSecret || !elementKind) {
3754
3804
  const msg = !stripe || !elements ? copy.errors.stripeUnavailable : copy.errors.paymentIntentUnavailable;
3755
3805
  setError(msg);
@@ -3922,7 +3972,7 @@ var PaidInner = ({
3922
3972
  submit
3923
3973
  ]
3924
3974
  );
3925
- return /* @__PURE__ */ jsx12(PaymentFormProvider, { value: contextValue, children });
3975
+ return /* @__PURE__ */ jsx13(PaymentFormProvider, { value: contextValue, children });
3926
3976
  };
3927
3977
  var FreeInner = ({
3928
3978
  planRef,
@@ -3955,7 +4005,7 @@ var FreeInner = ({
3955
4005
  }, [state, activationResult, onResult, refetch]);
3956
4006
  const isProcessing = state === "activating";
3957
4007
  const canSubmit = !isProcessing && (!requireTermsAcceptance || termsAccepted) && !!productRef;
3958
- const submit = useCallback9(async () => {
4008
+ const submit = useCallback10(async () => {
3959
4009
  if (!productRef) {
3960
4010
  const msg = copy.errors.configMissingPlanOrProduct;
3961
4011
  setLocalError(msg);
@@ -4034,11 +4084,11 @@ var FreeInner = ({
4034
4084
  submit
4035
4085
  ]
4036
4086
  );
4037
- return /* @__PURE__ */ jsx12(PaymentFormProvider, { value: contextValue, children });
4087
+ return /* @__PURE__ */ jsx13(PaymentFormProvider, { value: contextValue, children });
4038
4088
  };
4039
4089
  var Summary = (props) => {
4040
4090
  const ctx = usePaymentForm();
4041
- return /* @__PURE__ */ jsx12(
4091
+ return /* @__PURE__ */ jsx13(
4042
4092
  CheckoutSummary2,
4043
4093
  {
4044
4094
  ...props,
@@ -4051,7 +4101,7 @@ var Summary = (props) => {
4051
4101
  };
4052
4102
  var MandateTextPrimitive = (props) => {
4053
4103
  const ctx = usePaymentForm();
4054
- return /* @__PURE__ */ jsx12(
4104
+ return /* @__PURE__ */ jsx13(
4055
4105
  MandateText,
4056
4106
  {
4057
4107
  ...props,
@@ -4068,14 +4118,14 @@ var CustomerFields = forwardRef5(
4068
4118
  const email = customer.email ?? prefillCustomer?.email;
4069
4119
  if (!email) return null;
4070
4120
  const Comp = asChild ? Slot : "section";
4071
- return /* @__PURE__ */ jsx12(Comp, { ref, "data-solvapay-payment-form-customer-fields": "", ...rest, children: children ?? /* @__PURE__ */ jsxs6(Fragment6, { children: [
4121
+ return /* @__PURE__ */ jsx13(Comp, { ref, "data-solvapay-payment-form-customer-fields": "", ...rest, children: children ?? /* @__PURE__ */ jsxs6(Fragment6, { children: [
4072
4122
  email && /* @__PURE__ */ jsxs6("dl", { "data-solvapay-payment-form-customer-email": "", children: [
4073
- /* @__PURE__ */ jsx12("dt", { children: copy.customer.emailLabel }),
4074
- /* @__PURE__ */ jsx12("dd", { children: email })
4123
+ /* @__PURE__ */ jsx13("dt", { children: copy.customer.emailLabel }),
4124
+ /* @__PURE__ */ jsx13("dd", { children: email })
4075
4125
  ] }),
4076
4126
  /* @__PURE__ */ jsxs6("dl", { "data-solvapay-payment-form-customer-name": "", children: [
4077
- /* @__PURE__ */ jsx12("dt", { children: copy.customer.nameLabel }),
4078
- /* @__PURE__ */ jsx12("dd", { children: /* @__PURE__ */ jsx12(
4127
+ /* @__PURE__ */ jsx13("dt", { children: copy.customer.nameLabel }),
4128
+ /* @__PURE__ */ jsx13("dd", { children: /* @__PURE__ */ jsx13(
4079
4129
  "input",
4080
4130
  {
4081
4131
  type: "text",
@@ -4103,9 +4153,9 @@ var PaymentElementSlot = ({ options }) => {
4103
4153
  }, [setElementKind, stripe, elements]);
4104
4154
  if (!stripe || !elements) return null;
4105
4155
  if (!isReady) {
4106
- return /* @__PURE__ */ jsx12("output", { "data-solvapay-payment-form-loading": "", children: /* @__PURE__ */ jsx12(Spinner, { size: "sm" }) });
4156
+ return /* @__PURE__ */ jsx13("output", { "data-solvapay-payment-form-loading": "", children: /* @__PURE__ */ jsx13(Spinner, { size: "sm" }) });
4107
4157
  }
4108
- return /* @__PURE__ */ jsx12("section", { "data-solvapay-payment-form-payment-element": "", children: /* @__PURE__ */ jsx12(
4158
+ return /* @__PURE__ */ jsx13("section", { "data-solvapay-payment-form-payment-element": "", children: /* @__PURE__ */ jsx13(
4109
4159
  StripePaymentElement,
4110
4160
  {
4111
4161
  options: withPaymentElementDefaults(options),
@@ -4121,9 +4171,9 @@ var CardElementSlot = ({ options }) => {
4121
4171
  }, [setElementKind, stripe, elements]);
4122
4172
  if (!stripe || !elements) return null;
4123
4173
  if (!isReady) {
4124
- return /* @__PURE__ */ jsx12("output", { "data-solvapay-payment-form-loading": "", children: /* @__PURE__ */ jsx12(Spinner, { size: "sm" }) });
4174
+ return /* @__PURE__ */ jsx13("output", { "data-solvapay-payment-form-loading": "", children: /* @__PURE__ */ jsx13(Spinner, { size: "sm" }) });
4125
4175
  }
4126
- return /* @__PURE__ */ jsx12("section", { "data-solvapay-payment-form-card-element": "", children: /* @__PURE__ */ jsx12(StripeCardElement, { options, onChange: (e) => setPaymentInputComplete(e.complete) }) });
4176
+ return /* @__PURE__ */ jsx13("section", { "data-solvapay-payment-form-card-element": "", children: /* @__PURE__ */ jsx13(StripeCardElement, { options, onChange: (e) => setPaymentInputComplete(e.complete) }) });
4127
4177
  };
4128
4178
  var TermsCheckbox = forwardRef5(
4129
4179
  function PaymentFormTermsCheckbox({ asChild, label, children, ...rest }, ref) {
@@ -4131,10 +4181,10 @@ var TermsCheckbox = forwardRef5(
4131
4181
  const copy = useCopy();
4132
4182
  const id = "solvapay-terms-checkbox";
4133
4183
  if (asChild) {
4134
- return /* @__PURE__ */ jsx12(Slot, { ref, "data-solvapay-payment-form-terms": "", ...rest, children });
4184
+ return /* @__PURE__ */ jsx13(Slot, { ref, "data-solvapay-payment-form-terms": "", ...rest, children });
4135
4185
  }
4136
4186
  return /* @__PURE__ */ jsxs6("label", { ref, htmlFor: id, "data-solvapay-payment-form-terms": "", ...rest, children: [
4137
- /* @__PURE__ */ jsx12(
4187
+ /* @__PURE__ */ jsx13(
4138
4188
  "input",
4139
4189
  {
4140
4190
  id,
@@ -4143,7 +4193,7 @@ var TermsCheckbox = forwardRef5(
4143
4193
  onChange: (e) => setTermsAccepted(e.target.checked)
4144
4194
  }
4145
4195
  ),
4146
- /* @__PURE__ */ jsx12("span", { children: label ?? copy.terms.checkboxLabel })
4196
+ /* @__PURE__ */ jsx13("span", { children: label ?? copy.terms.checkboxLabel })
4147
4197
  ] });
4148
4198
  }
4149
4199
  );
@@ -4177,8 +4227,8 @@ var SubmitButton = forwardRef5(
4177
4227
  override: typeof children === "string" ? children : ctx.submitButtonText
4178
4228
  });
4179
4229
  const processingContent = /* @__PURE__ */ jsxs6(Fragment6, { children: [
4180
- /* @__PURE__ */ jsx12(Spinner, { size: "sm" }),
4181
- /* @__PURE__ */ jsx12("span", { children: copy.cta.processing })
4230
+ /* @__PURE__ */ jsx13(Spinner, { size: "sm" }),
4231
+ /* @__PURE__ */ jsx13("span", { children: copy.cta.processing })
4182
4232
  ] });
4183
4233
  const buttonProps = {
4184
4234
  "data-solvapay-payment-form-submit": "",
@@ -4196,30 +4246,30 @@ var SubmitButton = forwardRef5(
4196
4246
  ...rest
4197
4247
  };
4198
4248
  if (asChild) {
4199
- const slotChild = ctx.isProcessing && React10.isValidElement(children) ? React10.cloneElement(
4249
+ const slotChild = ctx.isProcessing && React11.isValidElement(children) ? React11.cloneElement(
4200
4250
  children,
4201
4251
  void 0,
4202
4252
  processingContent
4203
4253
  ) : children;
4204
- return /* @__PURE__ */ jsx12(Slot, { ref, ...buttonProps, children: slotChild });
4254
+ return /* @__PURE__ */ jsx13(Slot, { ref, ...buttonProps, children: slotChild });
4205
4255
  }
4206
4256
  const content = ctx.isProcessing ? processingContent : children && typeof children !== "string" ? children : label;
4207
- return /* @__PURE__ */ jsx12("button", { ref, type: "submit", ...buttonProps, children: content });
4257
+ return /* @__PURE__ */ jsx13("button", { ref, type: "submit", ...buttonProps, children: content });
4208
4258
  }
4209
4259
  );
4210
4260
  var Loading = forwardRef5(function PaymentFormLoading({ asChild, children, ...rest }, ref) {
4211
4261
  const ctx = usePaymentForm();
4212
4262
  if (ctx.isReady && ctx.clientSecret) return null;
4213
4263
  if (asChild) {
4214
- return /* @__PURE__ */ jsx12(Slot, { ref, "data-solvapay-payment-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ jsx12(Spinner, { size: "sm" }) });
4264
+ return /* @__PURE__ */ jsx13(Slot, { ref, "data-solvapay-payment-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ jsx13(Spinner, { size: "sm" }) });
4215
4265
  }
4216
- return /* @__PURE__ */ jsx12("output", { ref, "data-solvapay-payment-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ jsx12(Spinner, { size: "sm" }) });
4266
+ return /* @__PURE__ */ jsx13("output", { ref, "data-solvapay-payment-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ jsx13(Spinner, { size: "sm" }) });
4217
4267
  });
4218
4268
  var ErrorSlot = forwardRef5(function PaymentFormError({ asChild, children, ...rest }, ref) {
4219
4269
  const ctx = usePaymentForm();
4220
4270
  if (!ctx.error) return null;
4221
4271
  if (asChild) {
4222
- return /* @__PURE__ */ jsx12(
4272
+ return /* @__PURE__ */ jsx13(
4223
4273
  Slot,
4224
4274
  {
4225
4275
  ref,
@@ -4232,7 +4282,7 @@ var ErrorSlot = forwardRef5(function PaymentFormError({ asChild, children, ...re
4232
4282
  }
4233
4283
  );
4234
4284
  }
4235
- return /* @__PURE__ */ jsx12(
4285
+ return /* @__PURE__ */ jsx13(
4236
4286
  "p",
4237
4287
  {
4238
4288
  ref,
@@ -4295,7 +4345,7 @@ var PaymentForm = {
4295
4345
  };
4296
4346
 
4297
4347
  // src/hooks/useTopupAmountSelector.ts
4298
- import { useState as useState10, useCallback as useCallback10, useMemo as useMemo7 } from "react";
4348
+ import { useState as useState10, useCallback as useCallback11, useMemo as useMemo7 } from "react";
4299
4349
  function getQuickAmounts(currency) {
4300
4350
  switch (currency.toUpperCase()) {
4301
4351
  case "SEK":
@@ -4339,7 +4389,7 @@ function useTopupAmountSelector(options) {
4339
4389
  }
4340
4390
  return selectedAmount;
4341
4391
  }, [selectedAmount, customAmount]);
4342
- const selectQuickAmount = useCallback10(
4392
+ const selectQuickAmount = useCallback11(
4343
4393
  (amount) => {
4344
4394
  setSelectedAmount(amount);
4345
4395
  setCustomAmountRaw("");
@@ -4347,7 +4397,7 @@ function useTopupAmountSelector(options) {
4347
4397
  },
4348
4398
  []
4349
4399
  );
4350
- const setCustomAmount = useCallback10(
4400
+ const setCustomAmount = useCallback11(
4351
4401
  (value) => {
4352
4402
  const sanitized = value.replace(/[^0-9.]/g, "");
4353
4403
  const dotIndex = sanitized.indexOf(".");
@@ -4358,7 +4408,7 @@ function useTopupAmountSelector(options) {
4358
4408
  },
4359
4409
  []
4360
4410
  );
4361
- const validate = useCallback10(() => {
4411
+ const validate = useCallback11(() => {
4362
4412
  if (resolvedAmount == null) {
4363
4413
  setError(copy.topup.selectOrEnterAmount);
4364
4414
  return false;
@@ -4386,7 +4436,7 @@ function useTopupAmountSelector(options) {
4386
4436
  setError(null);
4387
4437
  return true;
4388
4438
  }, [resolvedAmount, minAmount, maxAmount, currency, copy]);
4389
- const reset = useCallback10(() => {
4439
+ const reset = useCallback11(() => {
4390
4440
  setSelectedAmount(null);
4391
4441
  setCustomAmountRaw("");
4392
4442
  setError(null);
@@ -4417,17 +4467,17 @@ function useBalance() {
4417
4467
 
4418
4468
  // src/primitives/AmountPicker.tsx
4419
4469
  import {
4420
- createContext as createContext6,
4470
+ createContext as createContext7,
4421
4471
  forwardRef as forwardRef6,
4422
- useCallback as useCallback11,
4423
- useContext as useContext9,
4472
+ useCallback as useCallback12,
4473
+ useContext as useContext10,
4424
4474
  useEffect as useEffect9,
4425
4475
  useMemo as useMemo8
4426
4476
  } from "react";
4427
- import { jsx as jsx13 } from "react/jsx-runtime";
4428
- var AmountPickerContext = createContext6(null);
4477
+ import { jsx as jsx14 } from "react/jsx-runtime";
4478
+ var AmountPickerContext = createContext7(null);
4429
4479
  function usePickerCtx(part) {
4430
- const ctx = useContext9(AmountPickerContext);
4480
+ const ctx = useContext10(AmountPickerContext);
4431
4481
  if (!ctx) {
4432
4482
  throw new Error(`AmountPicker.${part} must be rendered inside <AmountPicker.Root>.`);
4433
4483
  }
@@ -4444,7 +4494,7 @@ var Root3 = forwardRef6(function AmountPickerRoot({
4444
4494
  children,
4445
4495
  ...rest
4446
4496
  }, forwardedRef) {
4447
- const solva = useContext9(SolvaPayContext);
4497
+ const solva = useContext10(SolvaPayContext);
4448
4498
  if (!solva) throw new MissingProviderError("AmountPicker");
4449
4499
  const internalSelector = useTopupAmountSelector({ currency, minAmount, maxAmount });
4450
4500
  const selector = externalSelector ?? internalSelector;
@@ -4484,7 +4534,7 @@ var Root3 = forwardRef6(function AmountPickerRoot({
4484
4534
  ]
4485
4535
  );
4486
4536
  const Comp = asChild ? Slot : "div";
4487
- return /* @__PURE__ */ jsx13(AmountPickerContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx13(Comp, { ref: forwardedRef, "data-solvapay-amount-picker": "", ...rest, children }) });
4537
+ return /* @__PURE__ */ jsx14(AmountPickerContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx14(Comp, { ref: forwardedRef, "data-solvapay-amount-picker": "", ...rest, children }) });
4488
4538
  });
4489
4539
  var Option = forwardRef6(function AmountPickerOption({ asChild, amount, onClick, children, ...rest }, forwardedRef) {
4490
4540
  const ctx = usePickerCtx("Option");
@@ -4508,10 +4558,10 @@ var Option = forwardRef6(function AmountPickerOption({ asChild, amount, onClick,
4508
4558
  if (asChild) {
4509
4559
  return (
4510
4560
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4511
- /* @__PURE__ */ jsx13(Slot, { ref: forwardedRef, ...commonProps, children: children ?? defaultLabel })
4561
+ /* @__PURE__ */ jsx14(Slot, { ref: forwardedRef, ...commonProps, children: children ?? defaultLabel })
4512
4562
  );
4513
4563
  }
4514
- return /* @__PURE__ */ jsx13("button", { ref: forwardedRef, type: "button", ...commonProps, children: children ?? defaultLabel });
4564
+ return /* @__PURE__ */ jsx14("button", { ref: forwardedRef, type: "button", ...commonProps, children: children ?? defaultLabel });
4515
4565
  });
4516
4566
  var Custom = forwardRef6(function AmountPickerCustom({ asChild, onChange, onFocus, ...rest }, forwardedRef) {
4517
4567
  const ctx = usePickerCtx("Custom");
@@ -4534,15 +4584,15 @@ var Custom = forwardRef6(function AmountPickerCustom({ asChild, onChange, onFocu
4534
4584
  if (asChild) {
4535
4585
  return (
4536
4586
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4537
- /* @__PURE__ */ jsx13(Slot, { ref: forwardedRef, ...commonProps })
4587
+ /* @__PURE__ */ jsx14(Slot, { ref: forwardedRef, ...commonProps })
4538
4588
  );
4539
4589
  }
4540
- return /* @__PURE__ */ jsx13("input", { ref: forwardedRef, ...commonProps });
4590
+ return /* @__PURE__ */ jsx14("input", { ref: forwardedRef, ...commonProps });
4541
4591
  });
4542
4592
  var Confirm = forwardRef6(function AmountPickerConfirm({ asChild, onClick, onConfirm, disabled, children, ...rest }, forwardedRef) {
4543
4593
  const ctx = usePickerCtx("Confirm");
4544
4594
  const isDisabled = disabled || !ctx.resolvedAmount;
4545
- const handleConfirm = useCallback11(() => {
4595
+ const handleConfirm = useCallback12(() => {
4546
4596
  if (!ctx.validate()) return;
4547
4597
  if (ctx.emit === "minor") {
4548
4598
  if (ctx.resolvedAmountMinor != null) onConfirm?.(ctx.resolvedAmountMinor);
@@ -4561,10 +4611,10 @@ var Confirm = forwardRef6(function AmountPickerConfirm({ asChild, onClick, onCon
4561
4611
  if (asChild) {
4562
4612
  return (
4563
4613
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4564
- /* @__PURE__ */ jsx13(Slot, { ref: forwardedRef, ...commonProps, children })
4614
+ /* @__PURE__ */ jsx14(Slot, { ref: forwardedRef, ...commonProps, children })
4565
4615
  );
4566
4616
  }
4567
- return /* @__PURE__ */ jsx13("button", { ref: forwardedRef, type: "button", ...commonProps, children });
4617
+ return /* @__PURE__ */ jsx14("button", { ref: forwardedRef, type: "button", ...commonProps, children });
4568
4618
  });
4569
4619
  var AmountPickerRoot2 = Root3;
4570
4620
  var AmountPickerOption2 = Option;
@@ -4593,7 +4643,7 @@ function useAmountPickerCopy() {
4593
4643
  }
4594
4644
 
4595
4645
  // src/hooks/useTopup.ts
4596
- import { useState as useState11, useCallback as useCallback12, useRef as useRef6 } from "react";
4646
+ import { useState as useState11, useCallback as useCallback13, useRef as useRef6 } from "react";
4597
4647
  import { loadStripe as loadStripe2 } from "@stripe/stripe-js";
4598
4648
  var stripePromiseCache2 = /* @__PURE__ */ new Map();
4599
4649
  function getStripeCacheKey2(publishableKey, accountId) {
@@ -4608,7 +4658,7 @@ function useTopup(options) {
4608
4658
  const [clientSecret, setClientSecret] = useState11(null);
4609
4659
  const [processorPaymentId, setProcessorPaymentId] = useState11(null);
4610
4660
  const isStartingRef = useRef6(false);
4611
- const startTopup = useCallback12(async () => {
4661
+ const startTopup = useCallback13(async () => {
4612
4662
  if (isStartingRef.current || loading) {
4613
4663
  return;
4614
4664
  }
@@ -4656,7 +4706,7 @@ function useTopup(options) {
4656
4706
  isStartingRef.current = false;
4657
4707
  }
4658
4708
  }, [amount, currency, autoRecharge, createTopupPayment, customerRef, updateCustomerRef, loading]);
4659
- const reset = useCallback12(() => {
4709
+ const reset = useCallback13(() => {
4660
4710
  isStartingRef.current = false;
4661
4711
  setLoading(false);
4662
4712
  setError(null);
@@ -4676,11 +4726,11 @@ function useTopup(options) {
4676
4726
  }
4677
4727
 
4678
4728
  // src/primitives/TopupForm.tsx
4679
- import React12, {
4680
- createContext as createContext7,
4729
+ import React13, {
4730
+ createContext as createContext8,
4681
4731
  forwardRef as forwardRef7,
4682
- useCallback as useCallback13,
4683
- useContext as useContext10,
4732
+ useCallback as useCallback14,
4733
+ useContext as useContext11,
4684
4734
  useEffect as useEffect10,
4685
4735
  useMemo as useMemo9,
4686
4736
  useRef as useRef7,
@@ -4692,10 +4742,10 @@ import {
4692
4742
  useElements as useElements2,
4693
4743
  PaymentElement as StripePaymentElement2
4694
4744
  } from "@stripe/react-stripe-js";
4695
- import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
4696
- var TopupFormContext = createContext7(null);
4745
+ import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
4746
+ var TopupFormContext = createContext8(null);
4697
4747
  function useTopupCtx(part) {
4698
- const ctx = useContext10(TopupFormContext);
4748
+ const ctx = useContext11(TopupFormContext);
4699
4749
  if (!ctx) {
4700
4750
  throw new Error(`TopupForm.${part} must be rendered inside <TopupForm.Root>.`);
4701
4751
  }
@@ -4717,7 +4767,7 @@ var Root4 = forwardRef7(function TopupFormRoot(props, forwardedRef) {
4717
4767
  children,
4718
4768
  ...rest
4719
4769
  } = props;
4720
- const solva = useContext10(SolvaPayContext);
4770
+ const solva = useContext11(SolvaPayContext);
4721
4771
  if (!solva) throw new MissingProviderError("TopupForm");
4722
4772
  const { processTopupPayment, attachBusinessDetails, customerRef } = solva;
4723
4773
  const copy = useCopy();
@@ -4770,7 +4820,7 @@ var Root4 = forwardRef7(function TopupFormRoot(props, forwardedRef) {
4770
4820
  attachBusinessDetails,
4771
4821
  customerRef
4772
4822
  };
4773
- const shell = /* @__PURE__ */ jsx14(
4823
+ const shell = /* @__PURE__ */ jsx15(
4774
4824
  Comp,
4775
4825
  {
4776
4826
  ref: forwardedRef,
@@ -4782,9 +4832,9 @@ var Root4 = forwardRef7(function TopupFormRoot(props, forwardedRef) {
4782
4832
  }
4783
4833
  );
4784
4834
  if (canMountElements) {
4785
- return /* @__PURE__ */ jsx14(Elements2, { stripe: stripePromise, options: elementsOptions, children: /* @__PURE__ */ jsx14(Inner, { ...innerCommon, children: shell }) }, clientSecret);
4835
+ return /* @__PURE__ */ jsx15(Elements2, { stripe: stripePromise, options: elementsOptions, children: /* @__PURE__ */ jsx15(Inner, { ...innerCommon, children: shell }) }, clientSecret);
4786
4836
  }
4787
- return /* @__PURE__ */ jsx14(OfflineInner, { ...innerCommon, children: shell });
4837
+ return /* @__PURE__ */ jsx15(OfflineInner, { ...innerCommon, children: shell });
4788
4838
  });
4789
4839
  var Inner = ({
4790
4840
  amount,
@@ -4899,7 +4949,7 @@ var Inner = ({
4899
4949
  });
4900
4950
  const isReady = !!(stripe && elements);
4901
4951
  const canSubmit = isReady && paymentInputComplete && !isProcessing && !!clientSecret && (!requiresBusinessAttach || businessDetailsAttached) && !businessDetailsAttaching;
4902
- const submit = useCallback13(async () => {
4952
+ const submit = useCallback14(async () => {
4903
4953
  if (!stripe || !elements || !clientSecret) {
4904
4954
  const msg = copy.errors.stripeUnavailable;
4905
4955
  setError(msg);
@@ -5036,7 +5086,7 @@ var Inner = ({
5036
5086
  submit
5037
5087
  ]
5038
5088
  );
5039
- return /* @__PURE__ */ jsx14(TopupFormContext.Provider, { value: ctx, children });
5089
+ return /* @__PURE__ */ jsx15(TopupFormContext.Provider, { value: ctx, children });
5040
5090
  };
5041
5091
  var OfflineInner = ({
5042
5092
  amount,
@@ -5048,11 +5098,11 @@ var OfflineInner = ({
5048
5098
  state,
5049
5099
  children
5050
5100
  }) => {
5051
- const noopSubmit = useCallback13(async () => {
5101
+ const noopSubmit = useCallback14(async () => {
5052
5102
  }, []);
5053
- const noopSet = useCallback13(() => {
5103
+ const noopSet = useCallback14(() => {
5054
5104
  }, []);
5055
- const noopBusinessSet = useCallback13(() => {
5105
+ const noopBusinessSet = useCallback14(() => {
5056
5106
  }, []);
5057
5107
  const ctx = useMemo9(
5058
5108
  () => ({
@@ -5092,16 +5142,16 @@ var OfflineInner = ({
5092
5142
  noopBusinessSet
5093
5143
  ]
5094
5144
  );
5095
- return /* @__PURE__ */ jsx14(TopupFormContext.Provider, { value: ctx, children });
5145
+ return /* @__PURE__ */ jsx15(TopupFormContext.Provider, { value: ctx, children });
5096
5146
  };
5097
5147
  var PaymentElementSlot2 = ({ options }) => {
5098
5148
  const { setPaymentInputComplete, isReady, stripe, elements } = useTopupCtx("PaymentElement");
5099
5149
  const locale = useLocale();
5100
5150
  if (!stripe || !elements) return null;
5101
5151
  if (!isReady) {
5102
- return /* @__PURE__ */ jsx14("output", { "data-solvapay-topup-form-loading": "", children: /* @__PURE__ */ jsx14(Spinner, { size: "sm" }) });
5152
+ return /* @__PURE__ */ jsx15("output", { "data-solvapay-topup-form-loading": "", children: /* @__PURE__ */ jsx15(Spinner, { size: "sm" }) });
5103
5153
  }
5104
- return /* @__PURE__ */ jsx14("section", { "data-solvapay-topup-form-payment-element": "", children: /* @__PURE__ */ jsx14(
5154
+ return /* @__PURE__ */ jsx15("section", { "data-solvapay-topup-form-payment-element": "", children: /* @__PURE__ */ jsx15(
5105
5155
  StripePaymentElement2,
5106
5156
  {
5107
5157
  options: withPaymentElementDefaults(options),
@@ -5116,8 +5166,8 @@ var SubmitButton2 = forwardRef7(
5116
5166
  const copy = useCopy();
5117
5167
  const dataState = ctx.isProcessing ? "processing" : !ctx.canSubmit ? "disabled" : "idle";
5118
5168
  const processingContent = /* @__PURE__ */ jsxs7(Fragment7, { children: [
5119
- /* @__PURE__ */ jsx14(Spinner, { size: "sm" }),
5120
- /* @__PURE__ */ jsx14("span", { children: copy.cta.processing })
5169
+ /* @__PURE__ */ jsx15(Spinner, { size: "sm" }),
5170
+ /* @__PURE__ */ jsx15("span", { children: copy.cta.processing })
5121
5171
  ] });
5122
5172
  const commonProps = {
5123
5173
  "data-solvapay-topup-form-submit": "",
@@ -5132,38 +5182,38 @@ var SubmitButton2 = forwardRef7(
5132
5182
  ...rest
5133
5183
  };
5134
5184
  if (asChild) {
5135
- const slotChild = ctx.isProcessing && React12.isValidElement(children) ? React12.cloneElement(
5185
+ const slotChild = ctx.isProcessing && React13.isValidElement(children) ? React13.cloneElement(
5136
5186
  children,
5137
5187
  void 0,
5138
5188
  processingContent
5139
5189
  ) : children;
5140
- return /* @__PURE__ */ jsx14(Slot, { ref: forwardedRef, ...commonProps, children: slotChild });
5190
+ return /* @__PURE__ */ jsx15(Slot, { ref: forwardedRef, ...commonProps, children: slotChild });
5141
5191
  }
5142
5192
  const content = ctx.isProcessing ? processingContent : children ? children : copy.cta.topUp;
5143
- return /* @__PURE__ */ jsx14("button", { ref: forwardedRef, type: "submit", ...commonProps, children: content });
5193
+ return /* @__PURE__ */ jsx15("button", { ref: forwardedRef, type: "submit", ...commonProps, children: content });
5144
5194
  }
5145
5195
  );
5146
5196
  var Loading2 = forwardRef7(function TopupFormLoading({ asChild, children, ...rest }, forwardedRef) {
5147
5197
  const ctx = useTopupCtx("Loading");
5148
5198
  if (ctx.state !== "loading") return null;
5149
5199
  if (asChild) {
5150
- return /* @__PURE__ */ jsx14(
5200
+ return /* @__PURE__ */ jsx15(
5151
5201
  Slot,
5152
5202
  {
5153
5203
  ref: forwardedRef,
5154
5204
  "data-solvapay-topup-form-loading": "",
5155
5205
  ...rest,
5156
- children: children ?? /* @__PURE__ */ jsx14(Spinner, { size: "sm" })
5206
+ children: children ?? /* @__PURE__ */ jsx15(Spinner, { size: "sm" })
5157
5207
  }
5158
5208
  );
5159
5209
  }
5160
- return /* @__PURE__ */ jsx14("output", { ref: forwardedRef, "data-solvapay-topup-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ jsx14(Spinner, { size: "sm" }) });
5210
+ return /* @__PURE__ */ jsx15("output", { ref: forwardedRef, "data-solvapay-topup-form-loading": "", ...rest, children: children ?? /* @__PURE__ */ jsx15(Spinner, { size: "sm" }) });
5161
5211
  });
5162
5212
  var ErrorSlot2 = forwardRef7(function TopupFormError({ asChild, children, ...rest }, forwardedRef) {
5163
5213
  const ctx = useTopupCtx("Error");
5164
5214
  if (!ctx.error) return null;
5165
5215
  if (asChild) {
5166
- return /* @__PURE__ */ jsx14(
5216
+ return /* @__PURE__ */ jsx15(
5167
5217
  Slot,
5168
5218
  {
5169
5219
  ref: forwardedRef,
@@ -5176,7 +5226,7 @@ var ErrorSlot2 = forwardRef7(function TopupFormError({ asChild, children, ...res
5176
5226
  }
5177
5227
  );
5178
5228
  }
5179
- return /* @__PURE__ */ jsx14(
5229
+ return /* @__PURE__ */ jsx15(
5180
5230
  "p",
5181
5231
  {
5182
5232
  ref: forwardedRef,
@@ -5233,11 +5283,11 @@ function useTopupForm() {
5233
5283
  }
5234
5284
 
5235
5285
  // src/primitives/BalanceBadge.tsx
5236
- import { forwardRef as forwardRef8, useContext as useContext11 } from "react";
5286
+ import { forwardRef as forwardRef8, useContext as useContext12 } from "react";
5237
5287
  import { creditsToDisplayMinorUnits, minorUnitsPerMajor } from "@solvapay/core";
5238
- import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
5288
+ import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
5239
5289
  var BalanceBadge = forwardRef8(function BalanceBadge2({ asChild, numberOnly, lowThreshold = 10, children, ...rest }, forwardedRef) {
5240
- const solva = useContext11(SolvaPayContext);
5290
+ const solva = useContext12(SolvaPayContext);
5241
5291
  if (!solva) throw new MissingProviderError("BalanceBadge");
5242
5292
  const { credits, displayCurrency, creditsPerMinorUnit, displayExchangeRate, loading } = useBalance();
5243
5293
  const copy = useCopy();
@@ -5254,10 +5304,10 @@ var BalanceBadge = forwardRef8(function BalanceBadge2({ asChild, numberOnly, low
5254
5304
  if (asChild) {
5255
5305
  return (
5256
5306
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5257
- /* @__PURE__ */ jsx15(Slot, { ref: forwardedRef, ...commonProps, children: children ?? /* @__PURE__ */ jsx15(Fragment8, {}) })
5307
+ /* @__PURE__ */ jsx16(Slot, { ref: forwardedRef, ...commonProps, children: children ?? /* @__PURE__ */ jsx16(Fragment8, {}) })
5258
5308
  );
5259
5309
  }
5260
- return /* @__PURE__ */ jsx15("span", { ref: forwardedRef, ...commonProps });
5310
+ return /* @__PURE__ */ jsx16("span", { ref: forwardedRef, ...commonProps });
5261
5311
  }
5262
5312
  if (credits == null) return null;
5263
5313
  const formattedCredits = new Intl.NumberFormat(locale).format(credits);
@@ -5287,18 +5337,18 @@ var BalanceBadge = forwardRef8(function BalanceBadge2({ asChild, numberOnly, low
5287
5337
  if (asChild) {
5288
5338
  return (
5289
5339
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5290
- /* @__PURE__ */ jsx15(Slot, { ref: forwardedRef, ...commonProps, children: content })
5340
+ /* @__PURE__ */ jsx16(Slot, { ref: forwardedRef, ...commonProps, children: content })
5291
5341
  );
5292
5342
  }
5293
- return /* @__PURE__ */ jsx15("span", { ref: forwardedRef, ...commonProps, children: content });
5343
+ return /* @__PURE__ */ jsx16("span", { ref: forwardedRef, ...commonProps, children: content });
5294
5344
  });
5295
5345
 
5296
5346
  // src/primitives/PlanSelector.tsx
5297
5347
  import {
5298
- createContext as createContext8,
5348
+ createContext as createContext9,
5299
5349
  forwardRef as forwardRef9,
5300
- useCallback as useCallback14,
5301
- useContext as useContext12,
5350
+ useCallback as useCallback15,
5351
+ useContext as useContext13,
5302
5352
  useEffect as useEffect11,
5303
5353
  useMemo as useMemo10,
5304
5354
  useRef as useRef8,
@@ -5343,18 +5393,18 @@ function resolvePlanPricingOption(plan, currency) {
5343
5393
  }
5344
5394
 
5345
5395
  // src/primitives/PlanSelector.tsx
5346
- import { jsx as jsx16 } from "react/jsx-runtime";
5347
- var PlanSelectorContext = createContext8(null);
5396
+ import { jsx as jsx17 } from "react/jsx-runtime";
5397
+ var PlanSelectorContext = createContext9(null);
5348
5398
  function usePlanSelectorContext(part) {
5349
- const ctx = useContext12(PlanSelectorContext);
5399
+ const ctx = useContext13(PlanSelectorContext);
5350
5400
  if (!ctx) {
5351
5401
  throw new Error(`PlanSelector.${part} must be rendered inside <PlanSelector.Root>.`);
5352
5402
  }
5353
5403
  return ctx;
5354
5404
  }
5355
- var CardContext = createContext8(null);
5405
+ var CardContext = createContext9(null);
5356
5406
  function useCardContext(part) {
5357
- const ctx = useContext12(CardContext);
5407
+ const ctx = useContext13(CardContext);
5358
5408
  if (!ctx) {
5359
5409
  throw new Error(`PlanSelector.${part} must be rendered inside <PlanSelector.Card>.`);
5360
5410
  }
@@ -5374,7 +5424,7 @@ var Root5 = forwardRef9(function PlanSelectorRoot(props, forwardedRef) {
5374
5424
  children,
5375
5425
  ...rest
5376
5426
  } = props;
5377
- const solva = useContext12(SolvaPayContext);
5427
+ const solva = useContext13(SolvaPayContext);
5378
5428
  if (!solva) throw new MissingProviderError("PlanSelector");
5379
5429
  if (!productRef) throw new MissingProductRefError("PlanSelector");
5380
5430
  const { _config } = solva;
@@ -5396,19 +5446,19 @@ var Root5 = forwardRef9(function PlanSelectorRoot(props, forwardedRef) {
5396
5446
  return active?.planSnapshot?.reference ?? null;
5397
5447
  }, [purchases]);
5398
5448
  const resolvedCurrentPlanRef = currentPlanRef === null ? null : currentPlanRef ?? autoCurrentPlanRef;
5399
- const isCurrent = useCallback14(
5449
+ const isCurrent = useCallback15(
5400
5450
  (ref) => resolvedCurrentPlanRef === ref,
5401
5451
  [resolvedCurrentPlanRef]
5402
5452
  );
5403
- const isFree = useCallback14(
5453
+ const isFree = useCallback15(
5404
5454
  (ref) => plans.find((p) => p.reference === ref)?.requiresPayment === false,
5405
5455
  [plans]
5406
5456
  );
5407
- const isPopular = useCallback14(
5457
+ const isPopular = useCallback15(
5408
5458
  (ref) => popularPlanRef === ref,
5409
5459
  [popularPlanRef]
5410
5460
  );
5411
- const select = useCallback14(
5461
+ const select = useCallback15(
5412
5462
  (ref) => {
5413
5463
  const plan = plans.find((p) => p.reference === ref);
5414
5464
  if (!plan) return;
@@ -5418,24 +5468,24 @@ var Root5 = forwardRef9(function PlanSelectorRoot(props, forwardedRef) {
5418
5468
  },
5419
5469
  [plans, selectPlan, onSelect]
5420
5470
  );
5421
- const clearSelection = useCallback14(() => {
5471
+ const clearSelection = useCallback15(() => {
5422
5472
  setSelectedPlanIndex(-1);
5423
5473
  }, [setSelectedPlanIndex]);
5424
5474
  const selectedPlanRef = selectedPlan?.reference ?? null;
5425
5475
  const [preferredCurrency, setPreferredCurrencyState] = useState13(null);
5426
5476
  const [selectedCurrencies, setSelectedCurrencies] = useState13({});
5427
- const getSelectedOption = useCallback14(
5477
+ const getSelectedOption = useCallback15(
5428
5478
  (plan) => resolvePlanPricingOption(
5429
5479
  plan,
5430
5480
  selectedCurrencies[plan.reference] ?? preferredCurrency ?? null
5431
5481
  ),
5432
5482
  [selectedCurrencies, preferredCurrency]
5433
5483
  );
5434
- const setPreferredCurrency = useCallback14((currency) => {
5484
+ const setPreferredCurrency = useCallback15((currency) => {
5435
5485
  setPreferredCurrencyState(currency.toUpperCase());
5436
5486
  setSelectedCurrencies({});
5437
5487
  }, []);
5438
- const setPlanCurrency = useCallback14((planRef, currency) => {
5488
+ const setPlanCurrency = useCallback15((planRef, currency) => {
5439
5489
  setSelectedCurrencies((current) => ({ ...current, [planRef]: currency }));
5440
5490
  }, []);
5441
5491
  const selectedCurrency = selectedPlan ? getSelectedOption(selectedPlan).currency : null;
@@ -5495,7 +5545,7 @@ var Root5 = forwardRef9(function PlanSelectorRoot(props, forwardedRef) {
5495
5545
  getSelectedOption
5496
5546
  ]
5497
5547
  );
5498
- return /* @__PURE__ */ jsx16(
5548
+ return /* @__PURE__ */ jsx17(
5499
5549
  PlanSelectionProvider,
5500
5550
  {
5501
5551
  value: {
@@ -5514,7 +5564,7 @@ var Root5 = forwardRef9(function PlanSelectorRoot(props, forwardedRef) {
5514
5564
  loading,
5515
5565
  error
5516
5566
  },
5517
- children: /* @__PURE__ */ jsx16("div", { ref: forwardedRef, "data-solvapay-plan-selector": "", ...rest, children: /* @__PURE__ */ jsx16(PlanSelectorContext.Provider, { value: ctx, children }) })
5567
+ children: /* @__PURE__ */ jsx17("div", { ref: forwardedRef, "data-solvapay-plan-selector": "", ...rest, children: /* @__PURE__ */ jsx17(PlanSelectorContext.Provider, { value: ctx, children }) })
5518
5568
  }
5519
5569
  );
5520
5570
  });
@@ -5522,11 +5572,11 @@ var Heading = forwardRef9(function PlanSelectorHeading({ asChild, children, ...r
5522
5572
  usePlanSelectorContext("Heading");
5523
5573
  const copy = useCopy();
5524
5574
  const Comp = asChild ? Slot : "h3";
5525
- return /* @__PURE__ */ jsx16(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-heading": "", ...rest, children: children ?? copy.planSelector.heading });
5575
+ return /* @__PURE__ */ jsx17(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-heading": "", ...rest, children: children ?? copy.planSelector.heading });
5526
5576
  });
5527
5577
  var Grid = forwardRef9(function PlanSelectorGrid({ children, ...rest }, forwardedRef) {
5528
5578
  const ctx = usePlanSelectorContext("Grid");
5529
- return /* @__PURE__ */ jsx16("div", { ref: forwardedRef, "data-solvapay-plan-selector-grid": "", ...rest, children: ctx.plans.map((plan) => {
5579
+ return /* @__PURE__ */ jsx17("div", { ref: forwardedRef, "data-solvapay-plan-selector-grid": "", ...rest, children: ctx.plans.map((plan) => {
5530
5580
  const isCurrent = ctx.isCurrent(plan.reference);
5531
5581
  const isFree = ctx.isFree(plan.reference);
5532
5582
  const isPopular = ctx.isPopular(plan.reference);
@@ -5548,7 +5598,7 @@ var Grid = forwardRef9(function PlanSelectorGrid({ children, ...rest }, forwarde
5548
5598
  select: () => ctx.select(plan.reference),
5549
5599
  setCurrency: (currency) => ctx.setPlanCurrency(plan.reference, currency)
5550
5600
  };
5551
- return /* @__PURE__ */ jsx16(CardContext.Provider, { value: cardCtx, children }, plan.reference);
5601
+ return /* @__PURE__ */ jsx17(CardContext.Provider, { value: cardCtx, children }, plan.reference);
5552
5602
  }) });
5553
5603
  });
5554
5604
  var Card = forwardRef9(function PlanSelectorCard({ asChild, onClick, children, ...rest }, forwardedRef) {
@@ -5569,10 +5619,10 @@ var Card = forwardRef9(function PlanSelectorCard({ asChild, onClick, children, .
5569
5619
  if (asChild) {
5570
5620
  return (
5571
5621
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5572
- /* @__PURE__ */ jsx16(Slot, { ref: forwardedRef, ...commonProps, children })
5622
+ /* @__PURE__ */ jsx17(Slot, { ref: forwardedRef, ...commonProps, children })
5573
5623
  );
5574
5624
  }
5575
- return /* @__PURE__ */ jsx16(
5625
+ return /* @__PURE__ */ jsx17(
5576
5626
  "button",
5577
5627
  {
5578
5628
  ref: forwardedRef,
@@ -5589,7 +5639,7 @@ var CardName = forwardRef9(function PlanSelectorCardName({ asChild, children, ..
5589
5639
  const label = card.plan.name ?? fallback;
5590
5640
  if (!label && children == null) return null;
5591
5641
  const Comp = asChild ? Slot : "span";
5592
- return /* @__PURE__ */ jsx16(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-card-name": "", ...rest, children: children ?? label });
5642
+ return /* @__PURE__ */ jsx17(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-card-name": "", ...rest, children: children ?? label });
5593
5643
  });
5594
5644
  var CardPrice = forwardRef9(function PlanSelectorCardPrice({ asChild, children, ...rest }, forwardedRef) {
5595
5645
  const card = useCardContext("CardPrice");
@@ -5615,7 +5665,7 @@ var CardPrice = forwardRef9(function PlanSelectorCardPrice({ asChild, children,
5615
5665
  copy.interval.free
5616
5666
  ]);
5617
5667
  const Comp = asChild ? Slot : "span";
5618
- return /* @__PURE__ */ jsx16(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-card-price": "", ...rest, children: children ?? formatted });
5668
+ return /* @__PURE__ */ jsx17(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-card-price": "", ...rest, children: children ?? formatted });
5619
5669
  });
5620
5670
  var CardInterval = forwardRef9(function PlanSelectorCardInterval({ asChild, children, ...rest }, forwardedRef) {
5621
5671
  const card = useCardContext("CardInterval");
@@ -5625,7 +5675,7 @@ var CardInterval = forwardRef9(function PlanSelectorCardInterval({ asChild, chil
5625
5675
  if (!rawInterval) return null;
5626
5676
  const text = interpolate(copy.planSelector.perIntervalShort, { interval: rawInterval });
5627
5677
  const Comp = asChild ? Slot : "span";
5628
- return /* @__PURE__ */ jsx16(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-card-interval": "", ...rest, children: children ?? text });
5678
+ return /* @__PURE__ */ jsx17(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-card-interval": "", ...rest, children: children ?? text });
5629
5679
  });
5630
5680
  function normalizeBillingCycle(cycle) {
5631
5681
  if (!cycle) return null;
@@ -5651,7 +5701,7 @@ var CurrencySwitcher = forwardRef9(function PlanSelectorCurrencySwitcher({ child
5651
5701
  }, [ctx.plans]);
5652
5702
  if (availableCurrencies.length < 2) return null;
5653
5703
  const effectiveCurrency = ctx.preferredCurrency ?? (ctx.selectedPlan ? ctx.getSelectedOption(ctx.selectedPlan).currency.toUpperCase() : null) ?? availableCurrencies[0];
5654
- return /* @__PURE__ */ jsx16(
5704
+ return /* @__PURE__ */ jsx17(
5655
5705
  "select",
5656
5706
  {
5657
5707
  ref: forwardedRef,
@@ -5663,7 +5713,7 @@ var CurrencySwitcher = forwardRef9(function PlanSelectorCurrencySwitcher({ child
5663
5713
  onChange?.(event);
5664
5714
  },
5665
5715
  ...rest,
5666
- children: children ?? availableCurrencies.map((currency) => /* @__PURE__ */ jsx16("option", { value: currency, children: currency }, currency))
5716
+ children: children ?? availableCurrencies.map((currency) => /* @__PURE__ */ jsx17("option", { value: currency, children: currency }, currency))
5667
5717
  }
5668
5718
  );
5669
5719
  });
@@ -5671,7 +5721,7 @@ var CardCurrency = forwardRef9(
5671
5721
  function PlanSelectorCardCurrency({ children, onChange, ...rest }, forwardedRef) {
5672
5722
  const card = useCardContext("CardCurrency");
5673
5723
  if (card.pricingOptions.length <= 1) return null;
5674
- return /* @__PURE__ */ jsx16(
5724
+ return /* @__PURE__ */ jsx17(
5675
5725
  "select",
5676
5726
  {
5677
5727
  ref: forwardedRef,
@@ -5682,7 +5732,7 @@ var CardCurrency = forwardRef9(
5682
5732
  onChange?.(event);
5683
5733
  },
5684
5734
  ...rest,
5685
- children: children ?? card.pricingOptions.map((option) => /* @__PURE__ */ jsx16("option", { value: option.currency, children: option.currency }, option.currency))
5735
+ children: children ?? card.pricingOptions.map((option) => /* @__PURE__ */ jsx17("option", { value: option.currency, children: option.currency }, option.currency))
5686
5736
  }
5687
5737
  );
5688
5738
  }
@@ -5701,7 +5751,7 @@ var CardBadge = forwardRef9(function PlanSelectorCardBadge({ asChild, children,
5701
5751
  }
5702
5752
  if (!variant) return null;
5703
5753
  const Comp = asChild ? Slot : "span";
5704
- return /* @__PURE__ */ jsx16(
5754
+ return /* @__PURE__ */ jsx17(
5705
5755
  Comp,
5706
5756
  {
5707
5757
  ref: forwardedRef,
@@ -5716,13 +5766,13 @@ var Loading3 = forwardRef9(function PlanSelectorLoading({ asChild, children, ...
5716
5766
  const ctx = usePlanSelectorContext("Loading");
5717
5767
  if (!ctx.loading || ctx.plans.length > 0) return null;
5718
5768
  const Comp = asChild ? Slot : "div";
5719
- return /* @__PURE__ */ jsx16(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-loading": "", ...rest, children });
5769
+ return /* @__PURE__ */ jsx17(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-loading": "", ...rest, children });
5720
5770
  });
5721
5771
  var ErrorSlot3 = forwardRef9(function PlanSelectorError({ asChild, children, ...rest }, forwardedRef) {
5722
5772
  const ctx = usePlanSelectorContext("Error");
5723
5773
  if (!ctx.error) return null;
5724
5774
  const Comp = asChild ? Slot : "div";
5725
- return /* @__PURE__ */ jsx16(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-error": "", role: "alert", ...rest, children: children ?? ctx.error.message });
5775
+ return /* @__PURE__ */ jsx17(Comp, { ref: forwardedRef, "data-solvapay-plan-selector-error": "", role: "alert", ...rest, children: children ?? ctx.error.message });
5726
5776
  });
5727
5777
  var PlanSelectorRoot2 = Root5;
5728
5778
  var PlanSelectorHeading2 = Heading;
@@ -5755,13 +5805,13 @@ function usePlanSelector() {
5755
5805
  }
5756
5806
 
5757
5807
  // src/hooks/usePurchaseActions.ts
5758
- import { useState as useState14, useCallback as useCallback15 } from "react";
5808
+ import { useState as useState14, useCallback as useCallback16 } from "react";
5759
5809
  function usePurchaseActions() {
5760
5810
  const ctx = useSolvaPay();
5761
5811
  const [isCancelling, setIsCancelling] = useState14(false);
5762
5812
  const [isReactivating, setIsReactivating] = useState14(false);
5763
5813
  const [isActivating, setIsActivating] = useState14(false);
5764
- const cancelRenewal = useCallback15(
5814
+ const cancelRenewal = useCallback16(
5765
5815
  async (params) => {
5766
5816
  setIsCancelling(true);
5767
5817
  try {
@@ -5772,7 +5822,7 @@ function usePurchaseActions() {
5772
5822
  },
5773
5823
  [ctx.cancelRenewal]
5774
5824
  );
5775
- const reactivateRenewal = useCallback15(
5825
+ const reactivateRenewal = useCallback16(
5776
5826
  async (params) => {
5777
5827
  setIsReactivating(true);
5778
5828
  try {
@@ -5783,7 +5833,7 @@ function usePurchaseActions() {
5783
5833
  },
5784
5834
  [ctx.reactivateRenewal]
5785
5835
  );
5786
- const activatePlan = useCallback15(
5836
+ const activatePlan = useCallback16(
5787
5837
  async (params) => {
5788
5838
  setIsActivating(true);
5789
5839
  try {
@@ -5806,8 +5856,8 @@ function usePurchaseActions() {
5806
5856
 
5807
5857
  // src/primitives/CancelPlanButton.tsx
5808
5858
  import { countsUsage } from "@solvapay/core";
5809
- import { forwardRef as forwardRef10, useCallback as useCallback16, useContext as useContext13 } from "react";
5810
- import { Fragment as Fragment9, jsx as jsx17 } from "react/jsx-runtime";
5859
+ import { forwardRef as forwardRef10, useCallback as useCallback17, useContext as useContext14 } from "react";
5860
+ import { Fragment as Fragment9, jsx as jsx18 } from "react/jsx-runtime";
5811
5861
  function resolveConfirmText(confirm, purchase, defaults) {
5812
5862
  if (confirm === false) return null;
5813
5863
  if (typeof confirm === "string") return confirm;
@@ -5827,14 +5877,14 @@ var CancelPlanButton = forwardRef10(
5827
5877
  children,
5828
5878
  ...rest
5829
5879
  }, forwardedRef) {
5830
- const solva = useContext13(SolvaPayContext);
5880
+ const solva = useContext14(SolvaPayContext);
5831
5881
  if (!solva) throw new MissingProviderError("CancelPlanButton");
5832
5882
  const copy = useCopy();
5833
5883
  const { activePurchase } = usePurchase();
5834
5884
  const { cancelRenewal, isCancelling } = usePurchaseActions();
5835
5885
  const effectivePurchase = purchaseRef ? activePurchase && activePurchase.reference === purchaseRef ? activePurchase : { reference: purchaseRef } : activePurchase;
5836
5886
  const effectiveRef = purchaseRef ?? effectivePurchase?.reference;
5837
- const cancel = useCallback16(async () => {
5887
+ const cancel = useCallback17(async () => {
5838
5888
  if (!effectiveRef) return;
5839
5889
  const confirmText = resolveConfirmText(confirm, effectivePurchase, {
5840
5890
  recurring: copy.cancelPlan.confirmRecurring,
@@ -5870,19 +5920,19 @@ var CancelPlanButton = forwardRef10(
5870
5920
  if (asChild) {
5871
5921
  return (
5872
5922
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5873
- /* @__PURE__ */ jsx17(Slot, { ref: forwardedRef, ...commonProps, children: children ?? /* @__PURE__ */ jsx17(Fragment9, { children: label }) })
5923
+ /* @__PURE__ */ jsx18(Slot, { ref: forwardedRef, ...commonProps, children: children ?? /* @__PURE__ */ jsx18(Fragment9, { children: label }) })
5874
5924
  );
5875
5925
  }
5876
- return /* @__PURE__ */ jsx17("button", { ref: forwardedRef, type: "button", ...commonProps, children: children ?? label });
5926
+ return /* @__PURE__ */ jsx18("button", { ref: forwardedRef, type: "button", ...commonProps, children: children ?? label });
5877
5927
  }
5878
5928
  );
5879
5929
 
5880
5930
  // src/hooks/usePurchaseStatus.ts
5881
- import { useMemo as useMemo11, useCallback as useCallback17 } from "react";
5931
+ import { useMemo as useMemo11, useCallback as useCallback18 } from "react";
5882
5932
  function usePurchaseStatus() {
5883
5933
  const { purchases } = usePurchase();
5884
5934
  const locale = useLocale();
5885
- const isPaidPurchase2 = useCallback17((p) => {
5935
+ const isPaidPurchase2 = useCallback18((p) => {
5886
5936
  return (p.amount ?? 0) > 0;
5887
5937
  }, []);
5888
5938
  const purchaseData = useMemo11(() => {
@@ -5898,7 +5948,7 @@ function usePurchaseStatus() {
5898
5948
  shouldShowCancelledNotice
5899
5949
  };
5900
5950
  }, [purchases, isPaidPurchase2]);
5901
- const formatDate = useCallback17(
5951
+ const formatDate = useCallback18(
5902
5952
  (dateString) => {
5903
5953
  if (!dateString) return null;
5904
5954
  return new Date(dateString).toLocaleDateString(locale || "en-US", {
@@ -5909,7 +5959,7 @@ function usePurchaseStatus() {
5909
5959
  },
5910
5960
  [locale]
5911
5961
  );
5912
- const getDaysUntilExpiration = useCallback17((endDate) => {
5962
+ const getDaysUntilExpiration = useCallback18((endDate) => {
5913
5963
  if (!endDate) return null;
5914
5964
  const now = /* @__PURE__ */ new Date();
5915
5965
  const expiration = new Date(endDate);
@@ -5927,16 +5977,16 @@ function usePurchaseStatus() {
5927
5977
 
5928
5978
  // src/primitives/CancelledPlanNotice.tsx
5929
5979
  import {
5930
- createContext as createContext9,
5980
+ createContext as createContext10,
5931
5981
  forwardRef as forwardRef11,
5932
- useCallback as useCallback18,
5933
- useContext as useContext14,
5982
+ useCallback as useCallback19,
5983
+ useContext as useContext15,
5934
5984
  useMemo as useMemo12
5935
5985
  } from "react";
5936
- import { Fragment as Fragment10, jsx as jsx18 } from "react/jsx-runtime";
5937
- var CancelledPlanNoticeContext = createContext9(null);
5986
+ import { Fragment as Fragment10, jsx as jsx19 } from "react/jsx-runtime";
5987
+ var CancelledPlanNoticeContext = createContext10(null);
5938
5988
  function useNoticeCtx(part) {
5939
- const ctx = useContext14(CancelledPlanNoticeContext);
5989
+ const ctx = useContext15(CancelledPlanNoticeContext);
5940
5990
  if (!ctx) {
5941
5991
  throw new Error(
5942
5992
  `CancelledPlanNotice.${part} must be rendered inside <CancelledPlanNotice.Root>.`
@@ -5945,7 +5995,7 @@ function useNoticeCtx(part) {
5945
5995
  return ctx;
5946
5996
  }
5947
5997
  var Root6 = forwardRef11(function CancelledPlanNoticeRoot({ onReactivated, onError, asChild, children, ...rest }, forwardedRef) {
5948
- const solva = useContext14(SolvaPayContext);
5998
+ const solva = useContext15(SolvaPayContext);
5949
5999
  if (!solva) throw new MissingProviderError("CancelledPlanNotice");
5950
6000
  const {
5951
6001
  cancelledPurchase,
@@ -5954,7 +6004,7 @@ var Root6 = forwardRef11(function CancelledPlanNoticeRoot({ onReactivated, onErr
5954
6004
  getDaysUntilExpiration
5955
6005
  } = usePurchaseStatus();
5956
6006
  const { reactivateRenewal, isReactivating } = usePurchaseActions();
5957
- const reactivate = useCallback18(async () => {
6007
+ const reactivate = useCallback19(async () => {
5958
6008
  if (!cancelledPurchase) return;
5959
6009
  try {
5960
6010
  await reactivateRenewal({ purchaseRef: cancelledPurchase.reference });
@@ -5982,7 +6032,7 @@ var Root6 = forwardRef11(function CancelledPlanNoticeRoot({ onReactivated, onErr
5982
6032
  }, [cancelledPurchase, daysRemaining, formatDate, reactivate, isReactivating]);
5983
6033
  if (!shouldShowCancelledNotice || !ctx) return null;
5984
6034
  const Comp = asChild ? Slot : "div";
5985
- return /* @__PURE__ */ jsx18(CancelledPlanNoticeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx18(
6035
+ return /* @__PURE__ */ jsx19(CancelledPlanNoticeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx19(
5986
6036
  Comp,
5987
6037
  {
5988
6038
  ref: forwardedRef,
@@ -5998,7 +6048,7 @@ var Heading2 = forwardRef11(function CancelledPlanNoticeHeading({ asChild, child
5998
6048
  useNoticeCtx("Heading");
5999
6049
  const copy = useCopy();
6000
6050
  const Comp = asChild ? Slot : "p";
6001
- return /* @__PURE__ */ jsx18(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-heading": "", ...rest, children: children ?? copy.cancelledNotice.heading });
6051
+ return /* @__PURE__ */ jsx19(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-heading": "", ...rest, children: children ?? copy.cancelledNotice.heading });
6002
6052
  });
6003
6053
  var Expires = forwardRef11(function CancelledPlanNoticeExpires({ asChild, children, ...rest }, forwardedRef) {
6004
6054
  const ctx = useNoticeCtx("Expires");
@@ -6006,10 +6056,10 @@ var Expires = forwardRef11(function CancelledPlanNoticeExpires({ asChild, childr
6006
6056
  const date = ctx.formatDate(ctx.purchase.endDate);
6007
6057
  if (!ctx.purchase.endDate) {
6008
6058
  const Comp2 = asChild ? Slot : "p";
6009
- return /* @__PURE__ */ jsx18(Comp2, { ref: forwardedRef, "data-solvapay-cancelled-notice-expires": "", ...rest, children: children ?? copy.cancelledNotice.accessEnded });
6059
+ return /* @__PURE__ */ jsx19(Comp2, { ref: forwardedRef, "data-solvapay-cancelled-notice-expires": "", ...rest, children: children ?? copy.cancelledNotice.accessEnded });
6010
6060
  }
6011
6061
  const Comp = asChild ? Slot : "p";
6012
- return /* @__PURE__ */ jsx18(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-expires": "", ...rest, children: children ?? interpolate(copy.cancelledNotice.expiresLabel, { date: date ?? "" }) });
6062
+ return /* @__PURE__ */ jsx19(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-expires": "", ...rest, children: children ?? interpolate(copy.cancelledNotice.expiresLabel, { date: date ?? "" }) });
6013
6063
  });
6014
6064
  var DaysRemaining = forwardRef11(
6015
6065
  function CancelledPlanNoticeDaysRemaining({ asChild, children, ...rest }, forwardedRef) {
@@ -6018,7 +6068,7 @@ var DaysRemaining = forwardRef11(
6018
6068
  if (ctx.daysRemaining == null || ctx.daysRemaining <= 0) return null;
6019
6069
  const template = ctx.daysRemaining === 1 ? copy.cancelledNotice.dayRemaining : copy.cancelledNotice.daysRemaining;
6020
6070
  const Comp = asChild ? Slot : "p";
6021
- return /* @__PURE__ */ jsx18(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-days-remaining": "", ...rest, children: children ?? interpolate(template, { days: ctx.daysRemaining }) });
6071
+ return /* @__PURE__ */ jsx19(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-days-remaining": "", ...rest, children: children ?? interpolate(template, { days: ctx.daysRemaining }) });
6022
6072
  }
6023
6073
  );
6024
6074
  var AccessUntil = forwardRef11(
@@ -6027,7 +6077,7 @@ var AccessUntil = forwardRef11(
6027
6077
  const copy = useCopy();
6028
6078
  if (!ctx.purchase.endDate) return null;
6029
6079
  const Comp = asChild ? Slot : "p";
6030
- return /* @__PURE__ */ jsx18(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-access-until": "", ...rest, children: children ?? interpolate(copy.cancelledNotice.accessUntil, {
6080
+ return /* @__PURE__ */ jsx19(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-access-until": "", ...rest, children: children ?? interpolate(copy.cancelledNotice.accessUntil, {
6031
6081
  product: ctx.purchase.productName
6032
6082
  }) });
6033
6083
  }
@@ -6039,14 +6089,14 @@ var CancelledOn = forwardRef11(
6039
6089
  if (!ctx.purchase.cancelledAt) return null;
6040
6090
  const date = ctx.formatDate(ctx.purchase.cancelledAt);
6041
6091
  const Comp = asChild ? Slot : "p";
6042
- return /* @__PURE__ */ jsx18(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-cancelled-on": "", ...rest, children: children ?? interpolate(copy.cancelledNotice.cancelledOn, { date: date ?? "" }) });
6092
+ return /* @__PURE__ */ jsx19(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-cancelled-on": "", ...rest, children: children ?? interpolate(copy.cancelledNotice.cancelledOn, { date: date ?? "" }) });
6043
6093
  }
6044
6094
  );
6045
6095
  var Reason = forwardRef11(function CancelledPlanNoticeReason({ asChild, children, ...rest }, forwardedRef) {
6046
6096
  const ctx = useNoticeCtx("Reason");
6047
6097
  if (!ctx.hasReason) return null;
6048
6098
  const Comp = asChild ? Slot : "span";
6049
- return /* @__PURE__ */ jsx18(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-reason": "", ...rest, children: children ?? ctx.purchase.cancellationReason });
6099
+ return /* @__PURE__ */ jsx19(Comp, { ref: forwardedRef, "data-solvapay-cancelled-notice-reason": "", ...rest, children: children ?? ctx.purchase.cancellationReason });
6050
6100
  });
6051
6101
  var ReactivateButton = forwardRef11(
6052
6102
  function CancelledPlanNoticeReactivateButton({ asChild, onClick, children, ...rest }, forwardedRef) {
@@ -6068,10 +6118,10 @@ var ReactivateButton = forwardRef11(
6068
6118
  if (asChild) {
6069
6119
  return (
6070
6120
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6071
- /* @__PURE__ */ jsx18(Slot, { ref: forwardedRef, ...commonProps, children: children ?? /* @__PURE__ */ jsx18(Fragment10, { children: label }) })
6121
+ /* @__PURE__ */ jsx19(Slot, { ref: forwardedRef, ...commonProps, children: children ?? /* @__PURE__ */ jsx19(Fragment10, { children: label }) })
6072
6122
  );
6073
6123
  }
6074
- return /* @__PURE__ */ jsx18("button", { ref: forwardedRef, type: "button", ...commonProps, children: children ?? label });
6124
+ return /* @__PURE__ */ jsx19("button", { ref: forwardedRef, type: "button", ...commonProps, children: children ?? label });
6075
6125
  }
6076
6126
  );
6077
6127
  var CancelledPlanNoticeRoot2 = Root6;
@@ -6104,7 +6154,7 @@ function useTransport() {
6104
6154
  }
6105
6155
 
6106
6156
  // src/hooks/useLimits.ts
6107
- import { useCallback as useCallback19, useEffect as useEffect12, useRef as useRef9, useState as useState15 } from "react";
6157
+ import { useCallback as useCallback20, useEffect as useEffect12, useRef as useRef9, useState as useState15 } from "react";
6108
6158
  var CACHE_TTL_MS = 1e4;
6109
6159
  var OPTIMISTIC_GRACE_MS = 8e3;
6110
6160
  var limitsCache = /* @__PURE__ */ new Map();
@@ -6152,7 +6202,7 @@ function useLimits(options) {
6152
6202
  if (optimisticTimerRef.current) clearTimeout(optimisticTimerRef.current);
6153
6203
  };
6154
6204
  }, []);
6155
- const attachToFetch = useCallback19(
6205
+ const attachToFetch = useCallback20(
6156
6206
  async (promise) => {
6157
6207
  setLoading(true);
6158
6208
  try {
@@ -6169,7 +6219,7 @@ function useLimits(options) {
6169
6219
  },
6170
6220
  []
6171
6221
  );
6172
- const fetchLimits = useCallback19(
6222
+ const fetchLimits = useCallback20(
6173
6223
  async (force) => {
6174
6224
  if (!productRef || !enabled || !transport.getLimits) {
6175
6225
  setLoading(false);
@@ -6210,8 +6260,8 @@ function useLimits(options) {
6210
6260
  }
6211
6261
  prevPurchasesRef.current = purchase.purchases;
6212
6262
  }, [purchase.purchases, fetchLimits]);
6213
- const refetch = useCallback19(() => fetchLimits(true), [fetchLimits]);
6214
- const adjustRemaining = useCallback19(
6263
+ const refetch = useCallback20(() => fetchLimits(true), [fetchLimits]);
6264
+ const adjustRemaining = useCallback20(
6215
6265
  (delta) => {
6216
6266
  if (!productRef || !enabled) return;
6217
6267
  if (unlimitedRef.current) return;
@@ -6264,7 +6314,7 @@ function useLimits(options) {
6264
6314
 
6265
6315
  // src/hooks/useUsage.ts
6266
6316
  import { countsUsage as countsUsage2 } from "@solvapay/core";
6267
- import { useCallback as useCallback20, useEffect as useEffect13, useMemo as useMemo14, useState as useState16 } from "react";
6317
+ import { useCallback as useCallback21, useEffect as useEffect13, useMemo as useMemo14, useState as useState16 } from "react";
6268
6318
  function deriveUsage(purchase, limits) {
6269
6319
  if (!purchase) return null;
6270
6320
  const usage = purchase.usage;
@@ -6311,7 +6361,7 @@ function useUsage() {
6311
6361
  setOverride(null);
6312
6362
  }, [activePurchaseRef]);
6313
6363
  const usage = override ?? derived;
6314
- const refetch = useCallback20(async () => {
6364
+ const refetch = useCallback21(async () => {
6315
6365
  setError(null);
6316
6366
  if (typeof transport.getUsage === "function") {
6317
6367
  setTransportLoading(true);
@@ -6349,11 +6399,11 @@ function useUsage() {
6349
6399
  }
6350
6400
 
6351
6401
  // src/primitives/UsageMeter.tsx
6352
- import { createContext as createContext10, forwardRef as forwardRef12, useContext as useContext15, useMemo as useMemo15 } from "react";
6353
- import { jsx as jsx19 } from "react/jsx-runtime";
6354
- var UsageMeterContext = createContext10(null);
6402
+ import { createContext as createContext11, forwardRef as forwardRef12, useContext as useContext16, useMemo as useMemo15 } from "react";
6403
+ import { jsx as jsx20 } from "react/jsx-runtime";
6404
+ var UsageMeterContext = createContext11(null);
6355
6405
  function useUsageMeterCtx(part) {
6356
- const ctx = useContext15(UsageMeterContext);
6406
+ const ctx = useContext16(UsageMeterContext);
6357
6407
  if (!ctx) {
6358
6408
  throw new Error(`UsageMeter.${part} must be rendered inside <UsageMeter.Root>.`);
6359
6409
  }
@@ -6402,7 +6452,7 @@ var Root7 = forwardRef12(function UsageMeterRoot({
6402
6452
  );
6403
6453
  const rootClass = [classNames?.root ?? "solvapay-usage-meter", className].filter(Boolean).join(" ");
6404
6454
  const Comp = asChild ? Slot : "section";
6405
- return /* @__PURE__ */ jsx19(UsageMeterContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx19(
6455
+ return /* @__PURE__ */ jsx20(UsageMeterContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx20(
6406
6456
  Comp,
6407
6457
  {
6408
6458
  ref: forwardedRef,
@@ -6417,7 +6467,7 @@ var Root7 = forwardRef12(function UsageMeterRoot({
6417
6467
  var Bar = forwardRef12(function UsageMeterBar({ className, style, ...rest }, forwardedRef) {
6418
6468
  const ctx = useUsageMeterCtx("Bar");
6419
6469
  const width = ctx.percentUsed === null ? 0 : Math.max(0, Math.min(100, ctx.percentUsed));
6420
- return /* @__PURE__ */ jsx19(
6470
+ return /* @__PURE__ */ jsx20(
6421
6471
  "div",
6422
6472
  {
6423
6473
  ref: forwardedRef,
@@ -6443,7 +6493,7 @@ var Label = forwardRef12(function UsageMeterLabel({ className, children, ...rest
6443
6493
  const copy = useCopy();
6444
6494
  if (!ctx.usage) return null;
6445
6495
  if (ctx.isUnlimited) {
6446
- return /* @__PURE__ */ jsx19(
6496
+ return /* @__PURE__ */ jsx20(
6447
6497
  "span",
6448
6498
  {
6449
6499
  ref: forwardedRef,
@@ -6463,7 +6513,7 @@ var Label = forwardRef12(function UsageMeterLabel({ className, children, ...rest
6463
6513
  remaining: String(ctx.usage.remaining ?? 0),
6464
6514
  unit
6465
6515
  });
6466
- return /* @__PURE__ */ jsx19(
6516
+ return /* @__PURE__ */ jsx20(
6467
6517
  "span",
6468
6518
  {
6469
6519
  ref: forwardedRef,
@@ -6478,7 +6528,7 @@ var Percentage = forwardRef12(function UsageMeterPercentage({ className, childre
6478
6528
  const ctx = useUsageMeterCtx("Percentage");
6479
6529
  const copy = useCopy();
6480
6530
  if (ctx.percentUsed === null) return null;
6481
- return /* @__PURE__ */ jsx19(
6531
+ return /* @__PURE__ */ jsx20(
6482
6532
  "span",
6483
6533
  {
6484
6534
  ref: forwardedRef,
@@ -6502,7 +6552,7 @@ var ResetsIn = forwardRef12(function UsageMeterResetsIn({ className, children, .
6502
6552
  if (!periodEnd) return null;
6503
6553
  const label = formatResetsIn(copy, periodEnd);
6504
6554
  if (!label) return null;
6505
- return /* @__PURE__ */ jsx19(
6555
+ return /* @__PURE__ */ jsx20(
6506
6556
  "span",
6507
6557
  {
6508
6558
  ref: forwardedRef,
@@ -6517,7 +6567,7 @@ var Loading4 = forwardRef12(function UsageMeterLoading({ className, children, ..
6517
6567
  const ctx = useUsageMeterCtx("Loading");
6518
6568
  const copy = useCopy();
6519
6569
  if (ctx.state !== "loading") return null;
6520
- return /* @__PURE__ */ jsx19(
6570
+ return /* @__PURE__ */ jsx20(
6521
6571
  "div",
6522
6572
  {
6523
6573
  ref: forwardedRef,
@@ -6533,7 +6583,7 @@ var Empty = forwardRef12(function UsageMeterEmpty({ className, children, ...rest
6533
6583
  const ctx = useUsageMeterCtx("Empty");
6534
6584
  const copy = useCopy();
6535
6585
  if (ctx.loading || ctx.usage !== null) return null;
6536
- return /* @__PURE__ */ jsx19(
6586
+ return /* @__PURE__ */ jsx20(
6537
6587
  "div",
6538
6588
  {
6539
6589
  ref: forwardedRef,
@@ -6558,7 +6608,7 @@ function useUsageMeter() {
6558
6608
  }
6559
6609
 
6560
6610
  // src/hooks/useCheckoutFlow.ts
6561
- import { useCallback as useCallback21, useMemo as useMemo16, useRef as useRef10, useState as useState17 } from "react";
6611
+ import { useCallback as useCallback22, useMemo as useMemo16, useRef as useRef10, useState as useState17 } from "react";
6562
6612
 
6563
6613
  // src/primitives/checkout/shared.ts
6564
6614
  import {
@@ -6670,7 +6720,7 @@ function useCheckoutFlow(opts) {
6670
6720
  const planPickerCurrency = planCtx.preferredCurrency?.toUpperCase() ?? null;
6671
6721
  const topupCurrency = (topupCurrencyOverride && topupCurrencies.includes(topupCurrencyOverride) ? topupCurrencyOverride : null) ?? (planPickerCurrency && topupCurrencies.includes(planPickerCurrency) ? planPickerCurrency : null) ?? resolvedDefaultTopupCurrency;
6672
6722
  const topupCurrencyReady = topupCurrency != null;
6673
- const setTopupCurrency = useCallback21((code) => {
6723
+ const setTopupCurrency = useCallback22((code) => {
6674
6724
  const normalized = code.toUpperCase();
6675
6725
  setTopupCurrencyOverride(normalized);
6676
6726
  }, []);
@@ -6685,7 +6735,7 @@ function useCheckoutFlow(opts) {
6685
6735
  const selectedPlanShape = toBootstrapPlanLike(selectedPlan);
6686
6736
  const branch = selectedPlanShape ? isPayg(selectedPlanShape) ? "payg" : "recurring" : null;
6687
6737
  const canGoBack = step === "amount" || step === "payment";
6688
- const selectPlan = useCallback21(
6738
+ const selectPlan = useCallback22(
6689
6739
  (ref) => {
6690
6740
  planCtx.select(ref);
6691
6741
  const plan = planCtx.plans.find((p) => p.reference === ref) ?? null;
@@ -6695,7 +6745,7 @@ function useCheckoutFlow(opts) {
6695
6745
  },
6696
6746
  [planCtx]
6697
6747
  );
6698
- const selectAmount = useCallback21(
6748
+ const selectAmount = useCallback22(
6699
6749
  (amountMinor) => {
6700
6750
  selectedAmountMinorRef.current = amountMinor;
6701
6751
  setSelectedAmountMinor(amountMinor);
@@ -6704,7 +6754,7 @@ function useCheckoutFlow(opts) {
6704
6754
  },
6705
6755
  [topupCurrency]
6706
6756
  );
6707
- const runActivate = useCallback21(async () => {
6757
+ const runActivate = useCallback22(async () => {
6708
6758
  if (!selectedPlanShape || !selectedPlanRef) return false;
6709
6759
  setError(null);
6710
6760
  setStatus("activating");
@@ -6736,7 +6786,7 @@ function useCheckoutFlow(opts) {
6736
6786
  return false;
6737
6787
  }
6738
6788
  }, [balance, locale, productRef, selectedPlanRef, selectedPlanShape, transport]);
6739
- const advanceFromPlan = useCallback21(async () => {
6789
+ const advanceFromPlan = useCallback22(async () => {
6740
6790
  if (!selectedPlanShape || !selectedPlanRef) return;
6741
6791
  if (branch === "payg") {
6742
6792
  if (planCtx.currentPlanRef === selectedPlanRef) {
@@ -6774,7 +6824,7 @@ function useCheckoutFlow(opts) {
6774
6824
  setError(null);
6775
6825
  setStep("payment");
6776
6826
  }, [balance, branch, locale, planCtx.currentPlanRef, runActivate, selectedPlanRef, selectedPlanShape]);
6777
- const recordPaygSuccess = useCallback21(
6827
+ const recordPaygSuccess = useCallback22(
6778
6828
  (creditsAddedFromBackend) => {
6779
6829
  if (!selectedPlanShape || selectedAmountMinor == null) return;
6780
6830
  const currency = topupCurrency ?? "USD";
@@ -6818,7 +6868,7 @@ function useCheckoutFlow(opts) {
6818
6868
  transport
6819
6869
  ]
6820
6870
  );
6821
- const recordRecurringSuccess = useCallback21(() => {
6871
+ const recordRecurringSuccess = useCallback22(() => {
6822
6872
  if (!selectedPlanShape) return;
6823
6873
  const pricingOption = selectedPlan ? resolvePlanPricingOption(selectedPlan, planSelection?.selectedCurrency) : {
6824
6874
  currency: selectedPlanShape.currency ?? "USD",
@@ -6838,7 +6888,7 @@ function useCheckoutFlow(opts) {
6838
6888
  setStep("success");
6839
6889
  onPurchaseSuccessRef.current?.(meta);
6840
6890
  }, [selectedPlanShape, selectedPlan, planSelection?.selectedCurrency]);
6841
- const advance = useCallback21(async () => {
6891
+ const advance = useCallback22(async () => {
6842
6892
  if (step === "plan") {
6843
6893
  await advanceFromPlan();
6844
6894
  return;
@@ -6865,7 +6915,7 @@ function useCheckoutFlow(opts) {
6865
6915
  selectedAmountMinor,
6866
6916
  step
6867
6917
  ]);
6868
- const back = useCallback21(() => {
6918
+ const back = useCallback22(() => {
6869
6919
  setError(null);
6870
6920
  if (step === "amount") {
6871
6921
  setStep("plan");
@@ -6876,7 +6926,7 @@ function useCheckoutFlow(opts) {
6876
6926
  return;
6877
6927
  }
6878
6928
  }, [branch, step]);
6879
- const reset = useCallback21(() => {
6929
+ const reset = useCallback22(() => {
6880
6930
  setStep("plan");
6881
6931
  selectedAmountMinorRef.current = null;
6882
6932
  setSelectedAmountMinor(null);
@@ -6885,13 +6935,13 @@ function useCheckoutFlow(opts) {
6885
6935
  setStatus("idle");
6886
6936
  setTopupCurrencyOverride(null);
6887
6937
  }, []);
6888
- const retry = useCallback21(async () => {
6938
+ const retry = useCallback22(async () => {
6889
6939
  if (status !== "error") return;
6890
6940
  if (step === "plan" && branch === "payg") {
6891
6941
  await runActivate();
6892
6942
  }
6893
6943
  }, [branch, runActivate, status, step]);
6894
- const notifyPaymentSuccess = useCallback21(
6944
+ const notifyPaymentSuccess = useCallback22(
6895
6945
  (_intent, extras) => {
6896
6946
  if (branch === "payg") {
6897
6947
  recordPaygSuccess(extras?.creditsAdded);
@@ -6979,6 +7029,9 @@ export {
6979
7029
  composeEventHandlers,
6980
7030
  useCopy,
6981
7031
  useLocale,
7032
+ ExternalLinkProvider,
7033
+ useOpenExternal,
7034
+ useExternalLinkClick,
6982
7035
  LegalFooter,
6983
7036
  withPaymentElementDefaults,
6984
7037
  MissingProviderError,
@@ -7106,6 +7159,7 @@ export {
7106
7159
  buildDefaultCheckoutPlanFilter,
7107
7160
  formatContinueLabel,
7108
7161
  planBillingInterval,
7162
+ formatPaygRate,
7109
7163
  inferIncludedUnits,
7110
7164
  planMeterName,
7111
7165
  shortCycle,