@solvapay/react 2.1.1 → 2.2.0-preview-e3e546693c002c32f128d83bf6c5fe76ac182a79

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.
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  AmountPicker,
3
- CACHE_DURATION,
4
3
  MandateText,
5
4
  MissingProductRefError,
6
5
  MissingProviderError,
@@ -10,37 +9,44 @@ import {
10
9
  SolvaPayContext,
11
10
  Spinner,
12
11
  TopupForm,
13
- autoRechargeCache,
14
- autoRechargeCacheKeyFor,
15
12
  buildDefaultCheckoutPlanFilter,
13
+ buildSummaryLine,
16
14
  composeEventHandlers,
17
- createHttpTransport,
15
+ configToForm,
16
+ createDefaultAutoRechargeForm,
17
+ effectiveMonthlySpend,
18
+ estimateCredits,
19
+ estimateCurrencyMajorFromCredits,
20
+ flipUnitValue,
18
21
  formatContinueLabel,
22
+ formatCycleSuffix,
19
23
  formatPrice,
20
24
  getMinorUnitsPerMajor,
21
25
  interpolate,
26
+ isMonthlySpendCapReached,
22
27
  isPaygPlan,
28
+ planBillingCycle,
23
29
  planBillingInterval,
24
30
  planSortByPaygFirstThenAsc,
25
- shortCycle,
26
- subscribeAutoRecharge,
27
31
  useActivation,
28
32
  useAmountPicker,
29
33
  useAmountPickerCopy,
34
+ useAutoRecharge,
30
35
  useBalance,
31
36
  useCheckoutFlow,
32
37
  useCopy,
38
+ useExternalLinkClick,
33
39
  useLocale,
34
40
  usePlan,
35
41
  usePlanSelection,
36
42
  usePlans,
37
43
  useProduct,
38
44
  usePurchase,
39
- useSolvaPay,
45
+ usePurchaseActions,
40
46
  useTopupAmountSelector,
41
- withPaymentElementDefaults,
42
- writeAutoRechargeCache
43
- } from "./chunk-LL6AYSTC.js";
47
+ validateAutoRechargeForm,
48
+ withPaymentElementDefaults
49
+ } from "./chunk-VTGYZIE2.js";
44
50
 
45
51
  // src/TopupForm.tsx
46
52
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -470,23 +476,99 @@ function useActivationFlow() {
470
476
  return useFlowCtx("useActivationFlow");
471
477
  }
472
478
 
479
+ // src/primitives/CancelPlanButton.tsx
480
+ import { countsUsage } from "@solvapay/core";
481
+ import { forwardRef as forwardRef4, useCallback as useCallback2, useContext as useContext4, useMemo as useMemo3 } from "react";
482
+ import { Fragment as Fragment3, jsx as jsx5 } from "react/jsx-runtime";
483
+ function resolveConfirmText(confirm, purchase, defaults) {
484
+ if (confirm === false) return null;
485
+ if (typeof confirm === "string") return confirm;
486
+ const isUsageBased = (countsUsage(purchase?.planSnapshot) || purchase?.planSnapshot?.isMetered === true) && purchase?.isRecurring !== true;
487
+ if (isUsageBased) return defaults.usageBased;
488
+ return defaults.recurring;
489
+ }
490
+ var CancelPlanButton = forwardRef4(
491
+ function CancelPlanButton2({
492
+ asChild,
493
+ purchaseRef,
494
+ reason,
495
+ confirm = true,
496
+ onCancelled,
497
+ onError,
498
+ onClick,
499
+ children,
500
+ ...rest
501
+ }, forwardedRef) {
502
+ const solva = useContext4(SolvaPayContext);
503
+ if (!solva) throw new MissingProviderError("CancelPlanButton");
504
+ const copy = useCopy();
505
+ const { activePurchase } = usePurchase();
506
+ const { cancelRenewal, isCancelling } = usePurchaseActions();
507
+ const effectivePurchase = useMemo3(
508
+ () => purchaseRef ? activePurchase && activePurchase.reference === purchaseRef ? activePurchase : { reference: purchaseRef } : activePurchase,
509
+ [purchaseRef, activePurchase]
510
+ );
511
+ const effectiveRef = purchaseRef ?? effectivePurchase?.reference;
512
+ const cancel = useCallback2(async () => {
513
+ if (!effectiveRef) return;
514
+ const confirmText = resolveConfirmText(confirm, effectivePurchase, {
515
+ recurring: copy.cancelPlan.confirmRecurring,
516
+ usageBased: copy.cancelPlan.confirmUsageBased
517
+ });
518
+ if (confirmText && typeof window !== "undefined" && !window.confirm(confirmText)) {
519
+ return;
520
+ }
521
+ try {
522
+ await cancelRenewal({ purchaseRef: effectiveRef, reason });
523
+ onCancelled?.();
524
+ } catch (err) {
525
+ onError?.(err instanceof Error ? err : new Error(String(err)));
526
+ }
527
+ }, [effectiveRef, effectivePurchase, confirm, copy, cancelRenewal, reason, onCancelled, onError]);
528
+ if (effectivePurchase?.status === "active" && effectivePurchase.cancelledAt) {
529
+ return null;
530
+ }
531
+ const disabled = isCancelling || !effectiveRef;
532
+ const state = isCancelling ? "cancelling" : "idle";
533
+ const commonProps = {
534
+ "data-solvapay-cancel-plan": "",
535
+ "data-state": state,
536
+ "aria-busy": isCancelling,
537
+ "aria-disabled": disabled || void 0,
538
+ disabled,
539
+ onClick: composeEventHandlers(onClick, () => {
540
+ void cancel();
541
+ }),
542
+ ...rest
543
+ };
544
+ const label = isCancelling ? copy.cancelPlan.buttonLoading : copy.cancelPlan.button;
545
+ if (asChild) {
546
+ return (
547
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
548
+ /* @__PURE__ */ jsx5(Slot, { ref: forwardedRef, ...commonProps, children: children ?? /* @__PURE__ */ jsx5(Fragment3, { children: label }) })
549
+ );
550
+ }
551
+ return /* @__PURE__ */ jsx5("button", { ref: forwardedRef, type: "button", ...commonProps, children: children ?? label });
552
+ }
553
+ );
554
+
473
555
  // src/primitives/CreditGate.tsx
474
556
  import {
475
557
  createContext as createContext3,
476
- forwardRef as forwardRef4,
477
- useContext as useContext4,
478
- useMemo as useMemo3
558
+ forwardRef as forwardRef5,
559
+ useContext as useContext5,
560
+ useMemo as useMemo4
479
561
  } from "react";
480
- import { jsx as jsx5 } from "react/jsx-runtime";
562
+ import { jsx as jsx6 } from "react/jsx-runtime";
481
563
  var CreditGateContext = createContext3(null);
482
564
  function useGateCtx2(part) {
483
- const ctx = useContext4(CreditGateContext);
565
+ const ctx = useContext5(CreditGateContext);
484
566
  if (!ctx) {
485
567
  throw new Error(`CreditGate.${part} must be rendered inside <CreditGate.Root>.`);
486
568
  }
487
569
  return ctx;
488
570
  }
489
- var Root3 = forwardRef4(function CreditGateRoot({
571
+ var Root3 = forwardRef5(function CreditGateRoot({
490
572
  minCredits = 1,
491
573
  productRef,
492
574
  topupAmount = 1e3,
@@ -495,13 +577,13 @@ var Root3 = forwardRef4(function CreditGateRoot({
495
577
  children,
496
578
  ...rest
497
579
  }, forwardedRef) {
498
- const solva = useContext4(SolvaPayContext);
580
+ const solva = useContext5(SolvaPayContext);
499
581
  if (!solva) throw new MissingProviderError("CreditGate");
500
582
  const { credits, loading } = useBalance();
501
583
  const { product } = useProduct(productRef);
502
584
  const hasCredits = credits != null && credits >= minCredits;
503
585
  const state = loading && credits == null ? "loading" : hasCredits ? "allowed" : "blocked";
504
- const ctx = useMemo3(
586
+ const ctx = useMemo4(
505
587
  () => ({
506
588
  state,
507
589
  loading,
@@ -514,7 +596,7 @@ var Root3 = forwardRef4(function CreditGateRoot({
514
596
  [state, loading, hasCredits, credits, product?.name, topupAmount, topupCurrency]
515
597
  );
516
598
  const Comp = asChild ? Slot : "div";
517
- return /* @__PURE__ */ jsx5(CreditGateContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx5(
599
+ return /* @__PURE__ */ jsx6(CreditGateContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx6(
518
600
  Comp,
519
601
  {
520
602
  ref: forwardedRef,
@@ -525,14 +607,14 @@ var Root3 = forwardRef4(function CreditGateRoot({
525
607
  }
526
608
  ) });
527
609
  });
528
- var Heading = forwardRef4(function CreditGateHeading({ asChild, children, ...rest }, forwardedRef) {
610
+ var Heading = forwardRef5(function CreditGateHeading({ asChild, children, ...rest }, forwardedRef) {
529
611
  const ctx = useGateCtx2("Heading");
530
612
  const copy = useCopy();
531
613
  if (ctx.state !== "blocked") return null;
532
614
  const Comp = asChild ? Slot : "h3";
533
- return /* @__PURE__ */ jsx5(Comp, { ref: forwardedRef, "data-solvapay-credit-gate-heading": "", ...rest, children: children ?? copy.creditGate.lowBalanceHeading });
615
+ return /* @__PURE__ */ jsx6(Comp, { ref: forwardedRef, "data-solvapay-credit-gate-heading": "", ...rest, children: children ?? copy.creditGate.lowBalanceHeading });
534
616
  });
535
- var Subheading = forwardRef4(function CreditGateSubheading({ asChild, children, ...rest }, forwardedRef) {
617
+ var Subheading = forwardRef5(function CreditGateSubheading({ asChild, children, ...rest }, forwardedRef) {
536
618
  const ctx = useGateCtx2("Subheading");
537
619
  const copy = useCopy();
538
620
  if (ctx.state !== "blocked") return null;
@@ -540,12 +622,12 @@ var Subheading = forwardRef4(function CreditGateSubheading({ asChild, children,
540
622
  product: ctx.productName ?? "this product"
541
623
  });
542
624
  const Comp = asChild ? Slot : "p";
543
- return /* @__PURE__ */ jsx5(Comp, { ref: forwardedRef, "data-solvapay-credit-gate-subheading": "", ...rest, children: children ?? text });
625
+ return /* @__PURE__ */ jsx6(Comp, { ref: forwardedRef, "data-solvapay-credit-gate-subheading": "", ...rest, children: children ?? text });
544
626
  });
545
627
  var Topup = ({ amount, currency }) => {
546
628
  const ctx = useGateCtx2("Topup");
547
629
  if (ctx.state !== "blocked") return null;
548
- return /* @__PURE__ */ jsx5(
630
+ return /* @__PURE__ */ jsx6(
549
631
  TopupForm2,
550
632
  {
551
633
  amount: amount ?? ctx.topupAmount,
@@ -553,21 +635,21 @@ var Topup = ({ amount, currency }) => {
553
635
  }
554
636
  );
555
637
  };
556
- var Loading3 = forwardRef4(function CreditGateLoading({ asChild, children, ...rest }, forwardedRef) {
638
+ var Loading3 = forwardRef5(function CreditGateLoading({ asChild, children, ...rest }, forwardedRef) {
557
639
  const ctx = useGateCtx2("Loading");
558
640
  if (ctx.state !== "loading") return null;
559
641
  const Comp = asChild ? Slot : "div";
560
642
  return (
561
643
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
562
- /* @__PURE__ */ jsx5(Comp, { ref: forwardedRef, "data-solvapay-credit-gate-loading": "", ...rest, children })
644
+ /* @__PURE__ */ jsx6(Comp, { ref: forwardedRef, "data-solvapay-credit-gate-loading": "", ...rest, children })
563
645
  );
564
646
  });
565
- var ErrorSlot3 = forwardRef4(function CreditGateError({ asChild, children, ...rest }, forwardedRef) {
647
+ var ErrorSlot3 = forwardRef5(function CreditGateError({ asChild, children, ...rest }, forwardedRef) {
566
648
  if (!children) return null;
567
649
  const Comp = asChild ? Slot : "div";
568
650
  return (
569
651
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
570
- /* @__PURE__ */ jsx5(Comp, { ref: forwardedRef, "data-solvapay-credit-gate-error": "", role: "alert", ...rest, children })
652
+ /* @__PURE__ */ jsx6(Comp, { ref: forwardedRef, "data-solvapay-credit-gate-error": "", role: "alert", ...rest, children })
571
653
  );
572
654
  });
573
655
  var CreditGateRoot2 = Root3;
@@ -588,510 +670,17 @@ function useCreditGate() {
588
670
  return useGateCtx2("useCreditGate");
589
671
  }
590
672
 
591
- // src/hooks/useAutoRecharge.ts
592
- import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
593
- function mergeAutoRechargeConfig(config, display) {
594
- return display ? { ...config, display } : config;
595
- }
596
- async function fetchAutoRecharge(config) {
597
- const transport = config?.transport ?? createHttpTransport(config);
598
- if (!transport.getAutoRecharge) return null;
599
- const response = await transport.getAutoRecharge();
600
- if (!response.config) return null;
601
- return mergeAutoRechargeConfig(response.config, response.display);
602
- }
603
- function useAutoRecharge() {
604
- const { _config } = useSolvaPay();
605
- const key = autoRechargeCacheKeyFor(_config);
606
- const [config, setConfig] = useState3(
607
- () => autoRechargeCache.get(key)?.config ?? null
608
- );
609
- const [loading, setLoading] = useState3(() => {
610
- const cached = autoRechargeCache.get(key);
611
- return !cached || !cached.config && !cached.promise;
612
- });
613
- const [saving, setSaving] = useState3(false);
614
- const [disabling, setDisabling] = useState3(false);
615
- const [error, setError] = useState3(null);
616
- const requestSeq = useRef2(0);
617
- const load = useCallback2(
618
- async (force = false) => {
619
- const seq = requestSeq.current;
620
- const cached = autoRechargeCache.get(key);
621
- const now = Date.now();
622
- if (!force && cached?.config && now - cached.timestamp < CACHE_DURATION) {
623
- if (seq !== requestSeq.current) return;
624
- setConfig(cached.config);
625
- setLoading(false);
626
- setError(null);
627
- return;
628
- }
629
- if (!force && cached?.promise) {
630
- setLoading(true);
631
- try {
632
- const value = await cached.promise;
633
- if (seq !== requestSeq.current) return;
634
- setConfig(value);
635
- setError(null);
636
- } catch (caught) {
637
- if (seq !== requestSeq.current) return;
638
- setError(caught instanceof Error ? caught : new Error(String(caught)));
639
- } finally {
640
- if (seq === requestSeq.current) {
641
- setLoading(false);
642
- }
643
- }
644
- return;
645
- }
646
- setLoading(true);
647
- setError(null);
648
- const promise = fetchAutoRecharge(_config);
649
- writeAutoRechargeCache(key, {
650
- config: cached?.config ?? null,
651
- promise,
652
- timestamp: now
653
- });
654
- try {
655
- const value = await promise;
656
- if (seq !== requestSeq.current) return;
657
- writeAutoRechargeCache(key, { config: value, promise: null, timestamp: Date.now() });
658
- setConfig(value);
659
- } catch (caught) {
660
- if (seq !== requestSeq.current) return;
661
- const err = caught instanceof Error ? caught : new Error(String(caught));
662
- writeAutoRechargeCache(key, {
663
- config: cached?.config ?? null,
664
- promise: null,
665
- timestamp: Date.now()
666
- });
667
- setError(err);
668
- } finally {
669
- if (seq === requestSeq.current) {
670
- setLoading(false);
671
- }
672
- }
673
- },
674
- [_config, key]
675
- );
676
- useEffect3(() => {
677
- void load();
678
- }, [load]);
679
- useEffect3(() => {
680
- return subscribeAutoRecharge(key, () => {
681
- const cached = autoRechargeCache.get(key);
682
- if (cached) {
683
- setConfig(cached.config);
684
- return;
685
- }
686
- void load(true);
687
- });
688
- }, [key, load]);
689
- const refresh = useCallback2(
690
- async (force = true) => {
691
- await load(force);
692
- },
693
- [load]
694
- );
695
- const save = useCallback2(
696
- async (input) => {
697
- const transport = _config?.transport ?? createHttpTransport(_config);
698
- if (!transport.saveAutoRecharge) {
699
- throw new Error("saveAutoRecharge is not available on this transport");
700
- }
701
- setSaving(true);
702
- setError(null);
703
- const seq = ++requestSeq.current;
704
- try {
705
- const result = await transport.saveAutoRecharge(input);
706
- if (seq !== requestSeq.current) return result;
707
- const nextConfig = mergeAutoRechargeConfig(result.config, result.display);
708
- writeAutoRechargeCache(key, {
709
- config: nextConfig,
710
- promise: null,
711
- timestamp: Date.now()
712
- });
713
- setConfig(nextConfig);
714
- return result;
715
- } catch (caught) {
716
- const err = caught instanceof Error ? caught : new Error(String(caught));
717
- setError(err);
718
- throw err;
719
- } finally {
720
- setSaving(false);
721
- }
722
- },
723
- [_config, key]
724
- );
725
- const disable = useCallback2(async () => {
726
- const transport = _config?.transport ?? createHttpTransport(_config);
727
- if (!transport.disableAutoRecharge) {
728
- throw new Error("disableAutoRecharge is not available on this transport");
729
- }
730
- setDisabling(true);
731
- setError(null);
732
- const seq = ++requestSeq.current;
733
- try {
734
- const result = await transport.disableAutoRecharge();
735
- if (seq === requestSeq.current) {
736
- setConfig((current) => {
737
- const disabledConfig = current ? { ...current, enabled: false } : null;
738
- writeAutoRechargeCache(key, {
739
- config: disabledConfig,
740
- promise: null,
741
- timestamp: Date.now()
742
- });
743
- return disabledConfig;
744
- });
745
- await refresh(true);
746
- setConfig((current) => {
747
- const disabledConfig = current ? { ...current, enabled: false } : null;
748
- writeAutoRechargeCache(key, {
749
- config: disabledConfig,
750
- promise: null,
751
- timestamp: Date.now()
752
- });
753
- return disabledConfig;
754
- });
755
- }
756
- return result;
757
- } catch (caught) {
758
- const err = caught instanceof Error ? caught : new Error(String(caught));
759
- setError(err);
760
- throw err;
761
- } finally {
762
- setDisabling(false);
763
- }
764
- }, [_config, key, refresh]);
765
- return { config, loading, saving, disabling, error, refresh, save, disable };
766
- }
767
-
768
- // src/utils/credit-estimation.ts
769
- import { creditsToDisplayMinorUnits } from "@solvapay/core";
770
- function estimateCredits(resolvedAmountMajor, currency, creditsPerMinorUnit, displayExchangeRate) {
771
- if (resolvedAmountMajor == null || resolvedAmountMajor <= 0) return null;
772
- if (creditsPerMinorUnit == null || creditsPerMinorUnit <= 0) return null;
773
- const rate = displayExchangeRate ?? 1;
774
- const resolvedAmountMinor = Math.round(resolvedAmountMajor * getMinorUnitsPerMajor(currency));
775
- return Math.round(resolvedAmountMinor / rate * creditsPerMinorUnit);
776
- }
777
- function estimateCurrencyMajorFromCredits(credits, currency, creditsPerMinorUnit, displayExchangeRate) {
778
- if (credits == null || credits <= 0) return null;
779
- if (creditsPerMinorUnit == null || creditsPerMinorUnit <= 0) return null;
780
- const rate = displayExchangeRate ?? 1;
781
- const displayMinor = creditsToDisplayMinorUnits({
782
- credits,
783
- creditsPerMinorUnit,
784
- displayExchangeRate: rate,
785
- displayCurrency: currency
786
- });
787
- if (displayMinor === null) return null;
788
- return displayMinor / getMinorUnitsPerMajor(currency);
789
- }
790
-
791
- // src/helpers/stripe-minimums.ts
792
- var STRIPE_MINIMUM_MINOR = {
793
- USD: 50,
794
- EUR: 50,
795
- GBP: 30,
796
- SEK: 300,
797
- NOK: 300,
798
- DKK: 250,
799
- CHF: 50,
800
- CAD: 50,
801
- AUD: 50,
802
- JPY: 50,
803
- KRW: 500
804
- };
805
- var DEFAULT_MINIMUM_MINOR = 50;
806
- function getStripeMinimumMinor(currency) {
807
- return STRIPE_MINIMUM_MINOR[currency.toUpperCase()] ?? DEFAULT_MINIMUM_MINOR;
808
- }
809
-
810
- // src/helpers/auto-recharge-form.ts
811
- var DEFAULT_VALIDATION_MESSAGES = {
812
- invalidThreshold: "Enter a valid balance threshold.",
813
- thresholdTooLow: "Balance threshold must be greater than zero.",
814
- minTopupAmount: "Top-up amount must be at least {amount}.",
815
- topupBelowThreshold: "Top-up amount must be at least your balance threshold ({amount}).",
816
- invalidMaxMonthlySpend: "Maximum monthly spend must be a positive amount.",
817
- maxMonthlySpendBelowTopup: "Maximum monthly spend must be at least your top-up amount ({amount})."
818
- };
819
- function amountAnchors(thresholdValue, topupValue, unit = "currency") {
820
- return {
821
- thresholdBaseValue: thresholdValue,
822
- thresholdBaseUnit: unit,
823
- topupBaseValue: topupValue,
824
- topupBaseUnit: unit
825
- };
826
- }
827
- function createDefaultAutoRechargeForm(currency, defaultTopupMajor, defaultThresholdMajor) {
828
- const topup = defaultTopupMajor != null && defaultTopupMajor > 0 ? String(defaultTopupMajor) : "10";
829
- const threshold = defaultThresholdMajor != null && defaultThresholdMajor >= 0 ? String(defaultThresholdMajor) : "5";
830
- return {
831
- enabled: false,
832
- thresholdAmountMajor: threshold,
833
- thresholdUnit: "currency",
834
- topupAmountMajor: topup,
835
- topupUnit: "currency",
836
- maxMonthlySpendMajor: "",
837
- ...amountAnchors(threshold, topup, "currency")
838
- };
839
- }
840
- function currentSpendPeriod(now = /* @__PURE__ */ new Date()) {
841
- const year = now.getUTCFullYear();
842
- const month = now.getUTCMonth() + 1;
843
- return `${year}-${String(month).padStart(2, "0")}`;
844
- }
845
- function effectiveMonthlySpend(config, now = /* @__PURE__ */ new Date()) {
846
- if (config.monthlySpendPeriod !== currentSpendPeriod(now)) {
847
- return 0;
848
- }
849
- return config.monthlySpendMinor ?? 0;
850
- }
851
- function isMonthlySpendCapReached(config, now = /* @__PURE__ */ new Date()) {
852
- if (config.maxMonthlySpendMinor == null) return false;
853
- const effectiveSpend = effectiveMonthlySpend(config, now);
854
- return effectiveSpend + config.topup.amountMinor > config.maxMonthlySpendMinor;
855
- }
856
- function maxMonthlySpendMajorFromConfig(config, currency) {
857
- if (config.maxMonthlySpendMinor == null) return "";
858
- const minorPerMajor = getMinorUnitsPerMajor(currency);
859
- return String(config.maxMonthlySpendMinor / minorPerMajor);
860
- }
861
- function parsePositiveNumber(value) {
862
- const trimmed = value.trim();
863
- if (trimmed.length === 0) return null;
864
- const parsed = Number(trimmed);
865
- if (!Number.isFinite(parsed) || parsed <= 0) return null;
866
- return parsed;
867
- }
868
- function parseNonNegativeNumber(value) {
869
- const trimmed = value.trim();
870
- if (trimmed.length === 0) return null;
871
- const parsed = Number(trimmed);
872
- if (!Number.isFinite(parsed) || parsed < 0) return null;
873
- return parsed;
874
- }
875
- function validateAutoRechargeForm(form, currency, conversion, messages = DEFAULT_VALIDATION_MESSAGES) {
876
- if (!form.enabled) {
877
- return {
878
- ok: true,
879
- payload: {
880
- enabled: false,
881
- triggerType: "balance",
882
- currency: currency.toUpperCase()
883
- }
884
- };
885
- }
886
- const payload = {
887
- enabled: true,
888
- triggerType: "balance",
889
- currency: currency.toUpperCase()
890
- };
891
- const minorPerMajor = getMinorUnitsPerMajor(currency);
892
- const minMinor = getStripeMinimumMinor(currency);
893
- const thresholdRaw = parseNonNegativeNumber(form.thresholdAmountMajor);
894
- if (thresholdRaw == null) {
895
- return { ok: false, error: messages.invalidThreshold };
896
- }
897
- if (form.thresholdUnit === "credits") {
898
- const major = estimateCurrencyMajorFromCredits(
899
- thresholdRaw,
900
- currency,
901
- conversion?.creditsPerMinorUnit,
902
- conversion?.displayExchangeRate
903
- );
904
- if (major == null) {
905
- return { ok: false, error: messages.invalidThreshold };
906
- }
907
- payload.thresholdAmountMajor = major;
908
- } else {
909
- payload.thresholdAmountMajor = thresholdRaw;
910
- }
911
- if (payload.thresholdAmountMajor == null || payload.thresholdAmountMajor <= 0) {
912
- return { ok: false, error: messages.thresholdTooLow };
913
- }
914
- const amountRaw = parsePositiveNumber(form.topupAmountMajor);
915
- if (amountRaw == null) {
916
- return {
917
- ok: false,
918
- error: interpolate(messages.minTopupAmount, {
919
- amount: formatPrice(minMinor, currency, { free: "" })
920
- })
921
- };
922
- }
923
- const amountMajor = form.topupUnit === "credits" ? estimateCurrencyMajorFromCredits(
924
- amountRaw,
925
- currency,
926
- conversion?.creditsPerMinorUnit,
927
- conversion?.displayExchangeRate
928
- ) : amountRaw;
929
- if (amountMajor == null || Math.round(amountMajor * minorPerMajor) < minMinor) {
930
- return {
931
- ok: false,
932
- error: interpolate(messages.minTopupAmount, {
933
- amount: formatPrice(minMinor, currency, { free: "" })
934
- })
935
- };
936
- }
937
- payload.topupAmountMajor = amountMajor;
938
- if (amountMajor < payload.thresholdAmountMajor) {
939
- return {
940
- ok: false,
941
- error: interpolate(messages.topupBelowThreshold, {
942
- amount: formatPrice(
943
- Math.round(payload.thresholdAmountMajor * minorPerMajor),
944
- currency,
945
- { free: "" }
946
- )
947
- })
948
- };
949
- }
950
- if (form.maxMonthlySpendMajor.trim().length > 0) {
951
- const max = parsePositiveNumber(form.maxMonthlySpendMajor);
952
- if (max == null) {
953
- return { ok: false, error: messages.invalidMaxMonthlySpend };
954
- }
955
- if (max < amountMajor) {
956
- return {
957
- ok: false,
958
- error: interpolate(messages.maxMonthlySpendBelowTopup, {
959
- amount: formatPrice(Math.round(amountMajor * minorPerMajor), currency, { free: "" })
960
- })
961
- };
962
- }
963
- payload.maxMonthlySpendMajor = max;
964
- }
965
- return { ok: true, payload };
966
- }
967
- function triggerAmountMajorFromConfig(config) {
968
- const topupCurrency = config.topup.currency.toUpperCase();
969
- const minorPerMajor = getMinorUnitsPerMajor(topupCurrency);
970
- const { thresholdAmountMinor } = config.trigger;
971
- if (!Number.isFinite(thresholdAmountMinor) || thresholdAmountMinor < 0) {
972
- return null;
973
- }
974
- return thresholdAmountMinor / minorPerMajor;
975
- }
976
- function configToAutoRechargeInput(config, options) {
977
- if (!config.enabled) return null;
978
- const display = options?.display ?? config.display;
979
- const currency = (display?.currency ?? config.topup.currency ?? options?.currency ?? "USD").toUpperCase();
980
- if (display?.thresholdAmountMajor != null && display.topupAmountMajor != null) {
981
- return {
982
- enabled: true,
983
- triggerType: "balance",
984
- thresholdAmountMajor: display.thresholdAmountMajor,
985
- topupAmountMajor: display.topupAmountMajor,
986
- currency,
987
- ...config.maxMonthlySpendMinor != null ? {
988
- maxMonthlySpendMajor: config.maxMonthlySpendMinor / getMinorUnitsPerMajor(currency)
989
- } : {}
990
- };
991
- }
992
- const thresholdMajor = triggerAmountMajorFromConfig(config);
993
- const topupAmountMajor = config.topup.amountMinor / getMinorUnitsPerMajor(currency);
994
- if (thresholdMajor == null || !Number.isFinite(topupAmountMajor) || topupAmountMajor <= 0) {
995
- return null;
996
- }
997
- return {
998
- enabled: true,
999
- triggerType: "balance",
1000
- thresholdAmountMajor: Math.max(0, thresholdMajor),
1001
- topupAmountMajor,
1002
- currency,
1003
- ...config.maxMonthlySpendMinor != null ? {
1004
- maxMonthlySpendMajor: config.maxMonthlySpendMinor / getMinorUnitsPerMajor(currency)
1005
- } : {}
1006
- };
1007
- }
1008
- function configToForm(config, currency) {
1009
- const base = createDefaultAutoRechargeForm(currency);
1010
- const display = config.display;
1011
- if (display?.thresholdAmountMajor != null && display.topupAmountMajor != null) {
1012
- const thresholdStr2 = String(Math.max(0, display.thresholdAmountMajor));
1013
- const topupStr2 = String(display.topupAmountMajor);
1014
- return {
1015
- ...base,
1016
- enabled: config.enabled,
1017
- thresholdAmountMajor: thresholdStr2,
1018
- topupAmountMajor: topupStr2,
1019
- maxMonthlySpendMajor: maxMonthlySpendMajorFromConfig(config, currency),
1020
- ...amountAnchors(thresholdStr2, topupStr2, "currency")
1021
- };
1022
- }
1023
- const thresholdMajor = triggerAmountMajorFromConfig(config);
1024
- const thresholdStr = thresholdMajor != null ? String(Math.max(0, thresholdMajor)) : "0";
1025
- const topupStr = String(config.topup.amountMinor / getMinorUnitsPerMajor(currency));
1026
- return {
1027
- ...base,
1028
- enabled: config.enabled,
1029
- thresholdAmountMajor: thresholdStr,
1030
- topupAmountMajor: topupStr,
1031
- maxMonthlySpendMajor: maxMonthlySpendMajorFromConfig(config, currency),
1032
- ...amountAnchors(thresholdStr, topupStr, "currency")
1033
- };
1034
- }
1035
- function formatAmountWithUnit(value, unit, currency) {
1036
- const num = Number(value);
1037
- if (!value || !Number.isFinite(num)) return "\u2014";
1038
- if (unit === "credits") {
1039
- return `${new Intl.NumberFormat().format(num)} credits`;
1040
- }
1041
- return formatPrice(Math.round(num * getMinorUnitsPerMajor(currency)), currency, { free: "" });
1042
- }
1043
- function buildSummaryLine(form, currency) {
1044
- if (!form.enabled) return null;
1045
- const thresholdDisplay = formatAmountWithUnit(
1046
- form.thresholdAmountMajor,
1047
- form.thresholdUnit,
1048
- currency
1049
- );
1050
- const fixedDisplay = formatAmountWithUnit(form.topupAmountMajor, form.topupUnit, currency);
1051
- return `When my balance falls below ${thresholdDisplay}, add ${fixedDisplay}.`;
1052
- }
1053
- function convertAmountForUnitFlip(value, fromUnit, toUnit, currency, creditsPerMinorUnit, displayExchangeRate) {
1054
- if (fromUnit === toUnit) return value;
1055
- const parsed = Number(value);
1056
- if (!Number.isFinite(parsed) || parsed <= 0) return value;
1057
- if (fromUnit === "currency" && toUnit === "credits") {
1058
- const credits = estimateCredits(parsed, currency, creditsPerMinorUnit, displayExchangeRate);
1059
- return credits != null ? String(credits) : value;
1060
- }
1061
- const major = estimateCurrencyMajorFromCredits(
1062
- parsed,
1063
- currency,
1064
- creditsPerMinorUnit,
1065
- displayExchangeRate
1066
- );
1067
- return major != null ? String(major) : value;
1068
- }
1069
- function flipUnitValue(anchor, targetUnit, currency, creditsPerMinorUnit, displayExchangeRate) {
1070
- if (targetUnit === anchor.unit) {
1071
- return { value: anchor.value, unit: anchor.unit };
1072
- }
1073
- const converted = convertAmountForUnitFlip(
1074
- anchor.value,
1075
- anchor.unit,
1076
- targetUnit,
1077
- currency,
1078
- creditsPerMinorUnit,
1079
- displayExchangeRate
1080
- );
1081
- return { value: converted, unit: targetUnit };
1082
- }
1083
-
1084
673
  // src/primitives/AutoRecharge.tsx
1085
674
  import {
1086
675
  createContext as createContext4,
1087
- forwardRef as forwardRef5,
676
+ forwardRef as forwardRef6,
1088
677
  useCallback as useCallback3,
1089
- useContext as useContext5,
1090
- useEffect as useEffect4,
678
+ useContext as useContext6,
679
+ useEffect as useEffect3,
1091
680
  useId,
1092
- useMemo as useMemo4,
1093
- useRef as useRef3,
1094
- useState as useState4
681
+ useMemo as useMemo5,
682
+ useRef as useRef2,
683
+ useState as useState3
1095
684
  } from "react";
1096
685
  import { createPortal } from "react-dom";
1097
686
  import {
@@ -1140,10 +729,10 @@ function stripSetupIntentParams() {
1140
729
  }
1141
730
 
1142
731
  // src/primitives/AutoRecharge.tsx
1143
- import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
732
+ import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
1144
733
  var AutoRechargeContext = createContext4(null);
1145
734
  function useAutoRechargeCtx(part) {
1146
- const ctx = useContext5(AutoRechargeContext);
735
+ const ctx = useContext6(AutoRechargeContext);
1147
736
  if (!ctx) {
1148
737
  throw new Error(`AutoRecharge.${part} must be rendered inside <AutoRecharge.Root>.`);
1149
738
  }
@@ -1151,7 +740,11 @@ function useAutoRechargeCtx(part) {
1151
740
  }
1152
741
  function getCurrencySymbol(currency) {
1153
742
  try {
1154
- const parts = new Intl.NumberFormat("en", { style: "currency", currency }).formatToParts(0);
743
+ const parts = new Intl.NumberFormat("en", {
744
+ style: "currency",
745
+ currency,
746
+ currencyDisplay: "narrowSymbol"
747
+ }).formatToParts(0);
1155
748
  const sym = parts.find((p) => p.type === "currency");
1156
749
  return sym?.value ?? currency.toUpperCase();
1157
750
  } catch {
@@ -1162,7 +755,7 @@ var stripePromiseCache = /* @__PURE__ */ new Map();
1162
755
  function getStripeCacheKey(publishableKey, accountId) {
1163
756
  return accountId ? `${publishableKey}:${accountId}` : publishableKey;
1164
757
  }
1165
- var Root4 = forwardRef5(function AutoRechargeRoot({
758
+ var Root4 = forwardRef6(function AutoRechargeRoot({
1166
759
  currency = "USD",
1167
760
  defaultThresholdAmountMajor,
1168
761
  defaultTopupAmountMajor,
@@ -1179,15 +772,15 @@ var Root4 = forwardRef5(function AutoRechargeRoot({
1179
772
  className,
1180
773
  ...rest
1181
774
  }, forwardedRef) {
1182
- const solva = useContext5(SolvaPayContext);
775
+ const solva = useContext6(SolvaPayContext);
1183
776
  if (!solva) throw new MissingProviderError("AutoRecharge");
1184
777
  const autoRecharge = useAutoRecharge();
1185
778
  const { creditsPerMinorUnit, displayExchangeRate } = useBalance();
1186
779
  const copy = useCopy();
1187
780
  const titleId = useId();
1188
- const triggerRef = useRef3(null);
781
+ const triggerRef = useRef2(null);
1189
782
  const defaultTopup = defaultTopupAmountMajor ?? defaultThresholdAmountMajor ?? void 0;
1190
- const [uncontrolledOpen, setUncontrolledOpen] = useState4(defaultOpen);
783
+ const [uncontrolledOpen, setUncontrolledOpen] = useState3(defaultOpen);
1191
784
  const isControlled = openProp !== void 0;
1192
785
  const open = isControlled ? openProp : uncontrolledOpen;
1193
786
  const setOpen = useCallback3(
@@ -1205,17 +798,17 @@ var Root4 = forwardRef5(function AutoRechargeRoot({
1205
798
  const focusTrigger = useCallback3(() => {
1206
799
  triggerRef.current?.focus();
1207
800
  }, []);
1208
- const [form, setForm] = useState4(
801
+ const [form, setForm] = useState3(
1209
802
  () => autoRecharge.config ? configToForm(autoRecharge.config, currency) : createDefaultAutoRechargeForm(currency, defaultTopup)
1210
803
  );
1211
- const [validationError, setValidationError] = useState4(null);
1212
- const [statusMessage, setStatusMessage] = useState4(null);
1213
- const [setup, setSetup] = useState4(null);
1214
- const latestConfigRef = useRef3(autoRecharge.config);
1215
- useEffect4(() => {
804
+ const [validationError, setValidationError] = useState3(null);
805
+ const [statusMessage, setStatusMessage] = useState3(null);
806
+ const [setup, setSetup] = useState3(null);
807
+ const latestConfigRef = useRef2(autoRecharge.config);
808
+ useEffect3(() => {
1216
809
  latestConfigRef.current = autoRecharge.config;
1217
810
  }, [autoRecharge.config]);
1218
- useEffect4(() => {
811
+ useEffect3(() => {
1219
812
  if (autoRecharge.config) {
1220
813
  setForm(configToForm(autoRecharge.config, currency));
1221
814
  }
@@ -1281,7 +874,7 @@ var Root4 = forwardRef5(function AutoRechargeRoot({
1281
874
  },
1282
875
  [currency, creditsPerMinorUnit, displayExchangeRate, emitValidation]
1283
876
  );
1284
- const fixedTopupHint = useMemo4(() => {
877
+ const fixedTopupHint = useMemo5(() => {
1285
878
  const parsed = Number(form.topupAmountMajor);
1286
879
  if (!Number.isFinite(parsed) || parsed <= 0) return null;
1287
880
  if (form.topupUnit === "currency") {
@@ -1305,8 +898,8 @@ var Root4 = forwardRef5(function AutoRechargeRoot({
1305
898
  displayExchangeRate,
1306
899
  isApproximate
1307
900
  ]);
1308
- const summaryLine = useMemo4(() => buildSummaryLine(form, currency), [form, currency]);
1309
- const savedSummaryLine = useMemo4(() => {
901
+ const summaryLine = useMemo5(() => buildSummaryLine(form, currency), [form, currency]);
902
+ const savedSummaryLine = useMemo5(() => {
1310
903
  if (!autoRecharge.config?.enabled) return null;
1311
904
  return buildSummaryLine(
1312
905
  configToForm(autoRecharge.config, currency),
@@ -1365,7 +958,7 @@ var Root4 = forwardRef5(function AutoRechargeRoot({
1365
958
  }
1366
959
  }, [autoRecharge, copy.autoRecharge, form.enabled, setOpen]);
1367
960
  const dataState = setup ? "setup" : autoRecharge.error ? "error" : autoRecharge.loading ? "loading" : autoRecharge.saving ? "saving" : autoRecharge.disabling ? "disabling" : "idle";
1368
- const ctx = useMemo4(
961
+ const ctx = useMemo5(
1369
962
  () => ({
1370
963
  form,
1371
964
  updateForm,
@@ -1436,7 +1029,7 @@ var Root4 = forwardRef5(function AutoRechargeRoot({
1436
1029
  ]
1437
1030
  );
1438
1031
  const Comp = asChild ? Slot : "section";
1439
- return /* @__PURE__ */ jsx6(AutoRechargeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx6(
1032
+ return /* @__PURE__ */ jsx7(AutoRechargeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx7(
1440
1033
  Comp,
1441
1034
  {
1442
1035
  ref: forwardedRef,
@@ -1449,18 +1042,18 @@ var Root4 = forwardRef5(function AutoRechargeRoot({
1449
1042
  }
1450
1043
  ) });
1451
1044
  });
1452
- var Loading4 = forwardRef5(
1045
+ var Loading4 = forwardRef6(
1453
1046
  function AutoRechargeLoading({ className, children, ...rest }, forwardedRef) {
1454
1047
  const ctx = useAutoRechargeCtx("Loading");
1455
1048
  if (!ctx.loading) return null;
1456
- return /* @__PURE__ */ jsx6("p", { ref: forwardedRef, className, "data-solvapay-auto-recharge-loading": "", ...rest, children: children ?? /* @__PURE__ */ jsxs2(Fragment3, { children: [
1457
- /* @__PURE__ */ jsx6(Spinner, { size: "sm" }),
1049
+ return /* @__PURE__ */ jsx7("p", { ref: forwardedRef, className, "data-solvapay-auto-recharge-loading": "", ...rest, children: children ?? /* @__PURE__ */ jsxs2(Fragment4, { children: [
1050
+ /* @__PURE__ */ jsx7(Spinner, { size: "sm" }),
1458
1051
  " Loading auto-recharge settings\u2026"
1459
1052
  ] }) });
1460
1053
  }
1461
1054
  );
1462
- var Card = forwardRef5(function AutoRechargeCard({ className, children, ...rest }, forwardedRef) {
1463
- return /* @__PURE__ */ jsx6(
1055
+ var Card = forwardRef6(function AutoRechargeCard({ className, children, ...rest }, forwardedRef) {
1056
+ return /* @__PURE__ */ jsx7(
1464
1057
  "section",
1465
1058
  {
1466
1059
  ref: forwardedRef,
@@ -1471,10 +1064,10 @@ var Card = forwardRef5(function AutoRechargeCard({ className, children, ...rest
1471
1064
  }
1472
1065
  );
1473
1066
  });
1474
- var CardHeading = forwardRef5(
1067
+ var CardHeading = forwardRef6(
1475
1068
  function AutoRechargeCardHeading({ className, children, ...rest }, forwardedRef) {
1476
1069
  const copy = useCopy();
1477
- return /* @__PURE__ */ jsx6(
1070
+ return /* @__PURE__ */ jsx7(
1478
1071
  "h3",
1479
1072
  {
1480
1073
  ref: forwardedRef,
@@ -1486,12 +1079,12 @@ var CardHeading = forwardRef5(
1486
1079
  );
1487
1080
  }
1488
1081
  );
1489
- var CardSummary = forwardRef5(
1082
+ var CardSummary = forwardRef6(
1490
1083
  function AutoRechargeCardSummary({ className, children, ...rest }, forwardedRef) {
1491
1084
  const ctx = useAutoRechargeCtx("CardSummary");
1492
1085
  const copy = useCopy();
1493
1086
  const text = ctx.savedSummaryLine ?? copy.autoRecharge.notConfiguredHint;
1494
- return /* @__PURE__ */ jsx6(
1087
+ return /* @__PURE__ */ jsx7(
1495
1088
  "p",
1496
1089
  {
1497
1090
  ref: forwardedRef,
@@ -1503,7 +1096,7 @@ var CardSummary = forwardRef5(
1503
1096
  );
1504
1097
  }
1505
1098
  );
1506
- var Trigger = forwardRef5(function AutoRechargeTrigger({ asChild, onClick, children, className, ...rest }, forwardedRef) {
1099
+ var Trigger = forwardRef6(function AutoRechargeTrigger({ asChild, onClick, children, className, ...rest }, forwardedRef) {
1507
1100
  const ctx = useAutoRechargeCtx("Trigger");
1508
1101
  const copy = useCopy();
1509
1102
  const hasExistingConfig = Boolean(ctx.config?.enabled);
@@ -1531,14 +1124,14 @@ var Trigger = forwardRef5(function AutoRechargeTrigger({ asChild, onClick, child
1531
1124
  ...rest
1532
1125
  };
1533
1126
  if (asChild) {
1534
- return /* @__PURE__ */ jsx6(Slot, { ref: setRefs, ...commonProps, children: children ?? label });
1127
+ return /* @__PURE__ */ jsx7(Slot, { ref: setRefs, ...commonProps, children: children ?? label });
1535
1128
  }
1536
- return /* @__PURE__ */ jsx6("button", { ref: setRefs, ...commonProps, children: children ?? label });
1129
+ return /* @__PURE__ */ jsx7("button", { ref: setRefs, ...commonProps, children: children ?? label });
1537
1130
  });
1538
- var Overlay = forwardRef5(
1131
+ var Overlay = forwardRef6(
1539
1132
  function AutoRechargeOverlay({ onClick, className, ...rest }, forwardedRef) {
1540
1133
  const ctx = useAutoRechargeCtx("Overlay");
1541
- return /* @__PURE__ */ jsx6(
1134
+ return /* @__PURE__ */ jsx7(
1542
1135
  "div",
1543
1136
  {
1544
1137
  ref: forwardedRef,
@@ -1555,10 +1148,10 @@ var Overlay = forwardRef5(
1555
1148
  );
1556
1149
  }
1557
1150
  );
1558
- var Content = forwardRef5(function AutoRechargeContent({ className, children, ...rest }, forwardedRef) {
1151
+ var Content = forwardRef6(function AutoRechargeContent({ className, children, ...rest }, forwardedRef) {
1559
1152
  const ctx = useAutoRechargeCtx("Content");
1560
- const panelRef = useRef3(null);
1561
- useEffect4(() => {
1153
+ const panelRef = useRef2(null);
1154
+ useEffect3(() => {
1562
1155
  if (!ctx.open) return;
1563
1156
  const handleKeyDown = (event) => {
1564
1157
  if (event.key === "Escape") {
@@ -1575,12 +1168,12 @@ var Content = forwardRef5(function AutoRechargeContent({ className, children, ..
1575
1168
  return () => {
1576
1169
  document.removeEventListener("keydown", handleKeyDown);
1577
1170
  };
1578
- }, [ctx.open, ctx.resetForm, ctx.setOpen, ctx.focusTrigger]);
1171
+ }, [ctx]);
1579
1172
  if (!ctx.open || typeof document === "undefined") return null;
1580
1173
  return createPortal(
1581
1174
  /* @__PURE__ */ jsxs2("div", { "data-solvapay-auto-recharge-portal": "", children: [
1582
- /* @__PURE__ */ jsx6(Overlay, {}),
1583
- /* @__PURE__ */ jsx6(
1175
+ /* @__PURE__ */ jsx7(Overlay, {}),
1176
+ /* @__PURE__ */ jsx7(
1584
1177
  "div",
1585
1178
  {
1586
1179
  ref: (node) => {
@@ -1604,11 +1197,11 @@ var Content = forwardRef5(function AutoRechargeContent({ className, children, ..
1604
1197
  document.body
1605
1198
  );
1606
1199
  });
1607
- var Title = forwardRef5(
1200
+ var Title = forwardRef6(
1608
1201
  function AutoRechargeTitle({ className, children, ...rest }, forwardedRef) {
1609
1202
  const ctx = useAutoRechargeCtx("Title");
1610
1203
  const copy = useCopy();
1611
- return /* @__PURE__ */ jsx6(
1204
+ return /* @__PURE__ */ jsx7(
1612
1205
  "h2",
1613
1206
  {
1614
1207
  ref: forwardedRef,
@@ -1621,16 +1214,16 @@ var Title = forwardRef5(
1621
1214
  );
1622
1215
  }
1623
1216
  );
1624
- var EnableQuestion = forwardRef5(
1217
+ var EnableQuestion = forwardRef6(
1625
1218
  function AutoRechargeEnableQuestion({ className, children, ...rest }, forwardedRef) {
1626
1219
  const copy = useCopy();
1627
- return /* @__PURE__ */ jsx6("p", { ref: forwardedRef, className, "data-solvapay-auto-recharge-question": "", ...rest, children: children ?? copy.autoRecharge.enableQuestion });
1220
+ return /* @__PURE__ */ jsx7("p", { ref: forwardedRef, className, "data-solvapay-auto-recharge-question": "", ...rest, children: children ?? copy.autoRecharge.enableQuestion });
1628
1221
  }
1629
1222
  );
1630
- var EnableSentence = forwardRef5(
1223
+ var EnableSentence = forwardRef6(
1631
1224
  function AutoRechargeEnableSentence({ className, children, ...rest }, forwardedRef) {
1632
1225
  const copy = useCopy();
1633
- return /* @__PURE__ */ jsx6(
1226
+ return /* @__PURE__ */ jsx7(
1634
1227
  "label",
1635
1228
  {
1636
1229
  ref: forwardedRef,
@@ -1642,25 +1235,25 @@ var EnableSentence = forwardRef5(
1642
1235
  );
1643
1236
  }
1644
1237
  );
1645
- var EnableRow = forwardRef5(
1238
+ var EnableRow = forwardRef6(
1646
1239
  function AutoRechargeEnableRow({ className, children, ...rest }, forwardedRef) {
1647
1240
  const enableId = useId();
1648
- return /* @__PURE__ */ jsx6(
1241
+ return /* @__PURE__ */ jsx7(
1649
1242
  "div",
1650
1243
  {
1651
1244
  ref: forwardedRef,
1652
1245
  className,
1653
1246
  "data-solvapay-auto-recharge-enable-row": "",
1654
1247
  ...rest,
1655
- children: children ?? /* @__PURE__ */ jsxs2(Fragment3, { children: [
1656
- /* @__PURE__ */ jsx6(EnableSwitch, { appearance: "checkbox", id: enableId }),
1657
- /* @__PURE__ */ jsx6(EnableSentence, { htmlFor: enableId })
1248
+ children: children ?? /* @__PURE__ */ jsxs2(Fragment4, { children: [
1249
+ /* @__PURE__ */ jsx7(EnableSwitch, { appearance: "checkbox", id: enableId }),
1250
+ /* @__PURE__ */ jsx7(EnableSentence, { htmlFor: enableId })
1658
1251
  ] })
1659
1252
  }
1660
1253
  );
1661
1254
  }
1662
1255
  );
1663
- var CancelButton = forwardRef5(
1256
+ var CancelButton = forwardRef6(
1664
1257
  function AutoRechargeCancelButton({ asChild, onClick, children, className, ...rest }, forwardedRef) {
1665
1258
  const ctx = useAutoRechargeCtx("CancelButton");
1666
1259
  const copy = useCopy();
@@ -1677,7 +1270,7 @@ var CancelButton = forwardRef5(
1677
1270
  ...rest
1678
1271
  };
1679
1272
  if (asChild) {
1680
- return /* @__PURE__ */ jsx6(
1273
+ return /* @__PURE__ */ jsx7(
1681
1274
  Slot,
1682
1275
  {
1683
1276
  ref: forwardedRef,
@@ -1686,10 +1279,10 @@ var CancelButton = forwardRef5(
1686
1279
  }
1687
1280
  );
1688
1281
  }
1689
- return /* @__PURE__ */ jsx6("button", { ref: forwardedRef, ...commonProps, children: children ?? copy.autoRecharge.cancelButton });
1282
+ return /* @__PURE__ */ jsx7("button", { ref: forwardedRef, ...commonProps, children: children ?? copy.autoRecharge.cancelButton });
1690
1283
  }
1691
1284
  );
1692
- var Header = forwardRef5(
1285
+ var Header = forwardRef6(
1693
1286
  function AutoRechargeHeader({ className, ...rest }, forwardedRef) {
1694
1287
  const copy = useCopy();
1695
1288
  const headingId = useId();
@@ -1702,19 +1295,19 @@ var Header = forwardRef5(
1702
1295
  ...rest,
1703
1296
  children: [
1704
1297
  /* @__PURE__ */ jsxs2("section", { "data-solvapay-auto-recharge-heading-group": "", children: [
1705
- /* @__PURE__ */ jsx6("h3", { id: headingId, "data-solvapay-auto-recharge-heading": "", children: copy.autoRecharge.heading }),
1706
- /* @__PURE__ */ jsx6(Description, {})
1298
+ /* @__PURE__ */ jsx7("h3", { id: headingId, "data-solvapay-auto-recharge-heading": "", children: copy.autoRecharge.heading }),
1299
+ /* @__PURE__ */ jsx7(Description, {})
1707
1300
  ] }),
1708
- /* @__PURE__ */ jsx6(EnableSwitch, { "aria-labelledby": headingId })
1301
+ /* @__PURE__ */ jsx7(EnableSwitch, { "aria-labelledby": headingId })
1709
1302
  ]
1710
1303
  }
1711
1304
  );
1712
1305
  }
1713
1306
  );
1714
- var Description = forwardRef5(
1307
+ var Description = forwardRef6(
1715
1308
  function AutoRechargeDescription({ className, children, ...rest }, forwardedRef) {
1716
1309
  const copy = useCopy();
1717
- return /* @__PURE__ */ jsx6(
1310
+ return /* @__PURE__ */ jsx7(
1718
1311
  "p",
1719
1312
  {
1720
1313
  ref: forwardedRef,
@@ -1726,7 +1319,7 @@ var Description = forwardRef5(
1726
1319
  );
1727
1320
  }
1728
1321
  );
1729
- var EnableSwitch = forwardRef5(
1322
+ var EnableSwitch = forwardRef6(
1730
1323
  function AutoRechargeEnableSwitch({ asChild, appearance = "switch", onChange, className, ...rest }, forwardedRef) {
1731
1324
  const ctx = useAutoRechargeCtx("EnableSwitch");
1732
1325
  const copy = useCopy();
@@ -1745,7 +1338,7 @@ var EnableSwitch = forwardRef5(
1745
1338
  ...rest
1746
1339
  };
1747
1340
  if (asChild) {
1748
- return /* @__PURE__ */ jsx6(
1341
+ return /* @__PURE__ */ jsx7(
1749
1342
  Slot,
1750
1343
  {
1751
1344
  ref: forwardedRef,
@@ -1753,10 +1346,10 @@ var EnableSwitch = forwardRef5(
1753
1346
  }
1754
1347
  );
1755
1348
  }
1756
- return /* @__PURE__ */ jsx6("input", { ref: forwardedRef, ...commonProps });
1349
+ return /* @__PURE__ */ jsx7("input", { ref: forwardedRef, ...commonProps });
1757
1350
  }
1758
1351
  );
1759
- var Fields = forwardRef5(
1352
+ var Fields = forwardRef6(
1760
1353
  function AutoRechargeFields({ className, children, ...rest }, forwardedRef) {
1761
1354
  const ctx = useAutoRechargeCtx("Fields");
1762
1355
  const copy = useCopy();
@@ -1772,64 +1365,66 @@ var Fields = forwardRef5(
1772
1365
  "data-state": "open",
1773
1366
  ...rest,
1774
1367
  children: [
1775
- /* @__PURE__ */ jsx6("legend", { className: "sr-only", children: copy.autoRecharge.heading }),
1776
- children ?? /* @__PURE__ */ jsxs2(Fragment3, { children: [
1777
- /* @__PURE__ */ jsx6(Summary2, {}),
1778
- /* @__PURE__ */ jsx6(ThresholdField, {}),
1779
- /* @__PURE__ */ jsx6(TopupField, {}),
1780
- /* @__PURE__ */ jsx6(MaxMonthlySpendField, {}),
1781
- /* @__PURE__ */ jsx6(ValidationError, {})
1368
+ /* @__PURE__ */ jsx7("legend", { className: "sr-only", children: copy.autoRecharge.heading }),
1369
+ children ?? /* @__PURE__ */ jsxs2(Fragment4, { children: [
1370
+ /* @__PURE__ */ jsx7(Summary2, {}),
1371
+ /* @__PURE__ */ jsx7(ThresholdField, {}),
1372
+ /* @__PURE__ */ jsx7(TopupField, {}),
1373
+ /* @__PURE__ */ jsx7(MaxMonthlySpendField, {}),
1374
+ /* @__PURE__ */ jsx7(DeepDrawdownExplainer, {}),
1375
+ /* @__PURE__ */ jsx7(ValidationError, {})
1782
1376
  ] })
1783
1377
  ]
1784
1378
  }
1785
1379
  );
1786
1380
  }
1787
1381
  );
1788
- var Setup = forwardRef5(
1382
+ var Setup = forwardRef6(
1789
1383
  function AutoRechargeSetup({ className, children, ...rest }, forwardedRef) {
1790
1384
  const ctx = useAutoRechargeCtx("Setup");
1791
1385
  if (!ctx.setup?.setupClientSecret) return null;
1792
- return /* @__PURE__ */ jsx6(
1386
+ return /* @__PURE__ */ jsx7(
1793
1387
  "div",
1794
1388
  {
1795
1389
  ref: forwardedRef,
1796
1390
  className,
1797
1391
  "data-solvapay-auto-recharge-setup-panel": "",
1798
1392
  ...rest,
1799
- children: children ?? /* @__PURE__ */ jsx6(CardSetup, { setup: ctx.setup, onComplete: ctx.completeSetup })
1393
+ children: children ?? /* @__PURE__ */ jsx7(CardSetup, { setup: ctx.setup, onComplete: ctx.completeSetup })
1800
1394
  }
1801
1395
  );
1802
1396
  }
1803
1397
  );
1804
- var Body = forwardRef5(
1398
+ var Body = forwardRef6(
1805
1399
  function AutoRechargeBody({ className, children, ...rest }, forwardedRef) {
1806
1400
  const ctx = useAutoRechargeCtx("Body");
1807
1401
  if (ctx.setup?.setupClientSecret) {
1808
- return /* @__PURE__ */ jsx6(Setup, { className });
1402
+ return /* @__PURE__ */ jsx7(Setup, { className });
1809
1403
  }
1810
1404
  if (!ctx.form.enabled) return null;
1811
- return /* @__PURE__ */ jsx6(Fields, { ref: forwardedRef, className, ...rest, children: children ?? /* @__PURE__ */ jsxs2(Fragment3, { children: [
1812
- /* @__PURE__ */ jsx6(Summary2, {}),
1813
- /* @__PURE__ */ jsx6(ThresholdField, {}),
1814
- /* @__PURE__ */ jsx6(TopupField, {}),
1815
- /* @__PURE__ */ jsx6(MaxMonthlySpendField, {}),
1816
- /* @__PURE__ */ jsx6(ValidationError, {}),
1817
- /* @__PURE__ */ jsx6(Actions, {})
1405
+ return /* @__PURE__ */ jsx7(Fields, { ref: forwardedRef, className, ...rest, children: children ?? /* @__PURE__ */ jsxs2(Fragment4, { children: [
1406
+ /* @__PURE__ */ jsx7(Summary2, {}),
1407
+ /* @__PURE__ */ jsx7(ThresholdField, {}),
1408
+ /* @__PURE__ */ jsx7(TopupField, {}),
1409
+ /* @__PURE__ */ jsx7(MaxMonthlySpendField, {}),
1410
+ /* @__PURE__ */ jsx7(DeepDrawdownExplainer, {}),
1411
+ /* @__PURE__ */ jsx7(ValidationError, {}),
1412
+ /* @__PURE__ */ jsx7(Actions, {})
1818
1413
  ] }) });
1819
1414
  }
1820
1415
  );
1821
- var Summary2 = forwardRef5(
1416
+ var Summary2 = forwardRef6(
1822
1417
  function AutoRechargeSummary({ className, children, ...rest }, forwardedRef) {
1823
1418
  const ctx = useAutoRechargeCtx("Summary");
1824
1419
  const copy = useCopy();
1825
1420
  if (!ctx.summaryLine) return null;
1826
1421
  return /* @__PURE__ */ jsxs2("div", { "data-solvapay-auto-recharge-summary": "", children: [
1827
- /* @__PURE__ */ jsx6("p", { ref: forwardedRef, className, ...rest, children: children ?? ctx.summaryLine }),
1828
- /* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: copy.autoRecharge.taxDisclosure })
1422
+ /* @__PURE__ */ jsx7("p", { ref: forwardedRef, className, ...rest, children: children ?? ctx.summaryLine }),
1423
+ /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: copy.autoRecharge.taxDisclosure })
1829
1424
  ] });
1830
1425
  }
1831
1426
  );
1832
- var AmountField = forwardRef5(function AutoRechargeAmountField({ field, showLabel = true, asChild, onChange, className, ...rest }, forwardedRef) {
1427
+ var AmountField = forwardRef6(function AutoRechargeAmountField({ field, showLabel = true, asChild, onChange, className, ...rest }, forwardedRef) {
1833
1428
  const ctx = useAutoRechargeCtx("AmountField");
1834
1429
  const copy = useCopy();
1835
1430
  const fieldConfig = {
@@ -1890,11 +1485,11 @@ var AmountField = forwardRef5(function AutoRechargeAmountField({ field, showLabe
1890
1485
  };
1891
1486
  const slotRef = forwardedRef;
1892
1487
  return /* @__PURE__ */ jsxs2("p", { "data-solvapay-auto-recharge-field": "", "data-field": field, children: [
1893
- showLabel ? /* @__PURE__ */ jsx6("label", { htmlFor: inputId, children: fieldConfig.label }) : null,
1488
+ showLabel ? /* @__PURE__ */ jsx7("label", { htmlFor: inputId, children: fieldConfig.label }) : null,
1894
1489
  /* @__PURE__ */ jsxs2("span", { "data-solvapay-auto-recharge-amount-row": "", children: [
1895
- prefix ? /* @__PURE__ */ jsx6("span", { "data-solvapay-auto-recharge-currency-prefix": "", "aria-hidden": "true", children: prefix }) : null,
1896
- asChild ? /* @__PURE__ */ jsx6(Slot, { ref: slotRef, ...inputProps }) : /* @__PURE__ */ jsx6("input", { ref: forwardedRef, ...inputProps }),
1897
- ctx.canToggleUnits ? /* @__PURE__ */ jsx6(
1490
+ prefix ? /* @__PURE__ */ jsx7("span", { "data-solvapay-auto-recharge-currency-prefix": "", "aria-hidden": "true", children: prefix }) : null,
1491
+ asChild ? /* @__PURE__ */ jsx7(Slot, { ref: slotRef, ...inputProps }) : /* @__PURE__ */ jsx7("input", { ref: forwardedRef, ...inputProps }),
1492
+ ctx.canToggleUnits ? /* @__PURE__ */ jsx7(
1898
1493
  UnitToggle,
1899
1494
  {
1900
1495
  unit: fieldConfig.unit,
@@ -1911,12 +1506,12 @@ var AmountField = forwardRef5(function AutoRechargeAmountField({ field, showLabe
1911
1506
  ] })
1912
1507
  ] });
1913
1508
  });
1914
- var ThresholdField = forwardRef5(
1509
+ var ThresholdField = forwardRef6(
1915
1510
  function AutoRechargeThresholdField({ className, ...rest }, ref) {
1916
- return /* @__PURE__ */ jsx6("section", { ref, className, ...rest, children: /* @__PURE__ */ jsx6(AmountField, { field: "threshold" }) });
1511
+ return /* @__PURE__ */ jsx7("section", { ref, className, ...rest, children: /* @__PURE__ */ jsx7(AmountField, { field: "threshold" }) });
1917
1512
  }
1918
1513
  );
1919
- var TopupField = forwardRef5(
1514
+ var TopupField = forwardRef6(
1920
1515
  function AutoRechargeTopupField({ className, ...rest }, ref) {
1921
1516
  return /* @__PURE__ */ jsxs2(
1922
1517
  "section",
@@ -1926,14 +1521,14 @@ var TopupField = forwardRef5(
1926
1521
  "data-solvapay-auto-recharge-topup-field": "",
1927
1522
  ...rest,
1928
1523
  children: [
1929
- /* @__PURE__ */ jsx6(AmountField, { field: "fixed" }),
1930
- /* @__PURE__ */ jsx6(Hint, {})
1524
+ /* @__PURE__ */ jsx7(AmountField, { field: "fixed" }),
1525
+ /* @__PURE__ */ jsx7(Hint, {})
1931
1526
  ]
1932
1527
  }
1933
1528
  );
1934
1529
  }
1935
1530
  );
1936
- var MaxMonthlySpendField = forwardRef5(function AutoRechargeMaxMonthlySpendField({ onChange, className, ...rest }, forwardedRef) {
1531
+ var MaxMonthlySpendField = forwardRef6(function AutoRechargeMaxMonthlySpendField({ onChange, className, ...rest }, forwardedRef) {
1937
1532
  const ctx = useAutoRechargeCtx("MaxMonthlySpendField");
1938
1533
  const copy = useCopy();
1939
1534
  const inputId = useId();
@@ -1943,10 +1538,10 @@ var MaxMonthlySpendField = forwardRef5(function AutoRechargeMaxMonthlySpendField
1943
1538
  ctx.updateForm({ maxMonthlySpendMajor: raw });
1944
1539
  };
1945
1540
  return /* @__PURE__ */ jsxs2("section", { "data-solvapay-auto-recharge-field": "", "data-field": "max-monthly-spend", children: [
1946
- /* @__PURE__ */ jsx6("label", { htmlFor: inputId, children: copy.autoRecharge.maxMonthlySpendLabel }),
1541
+ /* @__PURE__ */ jsx7("label", { htmlFor: inputId, children: copy.autoRecharge.maxMonthlySpendLabel }),
1947
1542
  /* @__PURE__ */ jsxs2("span", { "data-solvapay-auto-recharge-amount-row": "", children: [
1948
- /* @__PURE__ */ jsx6("span", { "data-solvapay-auto-recharge-currency-prefix": "", "aria-hidden": "true", children: prefix }),
1949
- /* @__PURE__ */ jsx6(
1543
+ /* @__PURE__ */ jsx7("span", { "data-solvapay-auto-recharge-currency-prefix": "", "aria-hidden": "true", children: prefix }),
1544
+ /* @__PURE__ */ jsx7(
1950
1545
  "input",
1951
1546
  {
1952
1547
  ref: forwardedRef,
@@ -1964,16 +1559,29 @@ var MaxMonthlySpendField = forwardRef5(function AutoRechargeMaxMonthlySpendField
1964
1559
  }
1965
1560
  )
1966
1561
  ] }),
1967
- /* @__PURE__ */ jsx6("p", { "data-solvapay-auto-recharge-max-spend-helper": "", children: copy.autoRecharge.maxMonthlySpendHelper })
1562
+ /* @__PURE__ */ jsx7("p", { "data-solvapay-auto-recharge-max-spend-helper": "", children: copy.autoRecharge.maxMonthlySpendHelper })
1968
1563
  ] });
1969
1564
  });
1970
- var MonthlySpend = forwardRef5(
1565
+ var DeepDrawdownExplainer = forwardRef6(function AutoRechargeDeepDrawdownExplainer({ className, ...rest }, forwardedRef) {
1566
+ const copy = useCopy();
1567
+ return /* @__PURE__ */ jsx7(
1568
+ "p",
1569
+ {
1570
+ ref: forwardedRef,
1571
+ className,
1572
+ "data-solvapay-auto-recharge-deep-drawdown": "",
1573
+ ...rest,
1574
+ children: copy.autoRecharge.deepDrawdownExplainer
1575
+ }
1576
+ );
1577
+ });
1578
+ var MonthlySpend = forwardRef6(
1971
1579
  function AutoRechargeMonthlySpend({ className, children, ...rest }, forwardedRef) {
1972
1580
  const ctx = useAutoRechargeCtx("MonthlySpend");
1973
1581
  const copy = useCopy();
1974
1582
  if (!ctx.config?.maxMonthlySpendMinor) return null;
1975
1583
  const spent = effectiveMonthlySpend(ctx.config);
1976
- return /* @__PURE__ */ jsx6(
1584
+ return /* @__PURE__ */ jsx7(
1977
1585
  "p",
1978
1586
  {
1979
1587
  ref: forwardedRef,
@@ -1988,10 +1596,10 @@ var MonthlySpend = forwardRef5(
1988
1596
  );
1989
1597
  }
1990
1598
  );
1991
- var UnitToggle = forwardRef5(function AutoRechargeUnitToggle({ unit, fieldLabel, onToggle, className, ...rest }, forwardedRef) {
1599
+ var UnitToggle = forwardRef6(function AutoRechargeUnitToggle({ unit, fieldLabel, onToggle, className, ...rest }, forwardedRef) {
1992
1600
  const ctx = useAutoRechargeCtx("UnitToggle");
1993
1601
  const targetUnitLabel = unit === "currency" ? "credits" : "currency";
1994
- return /* @__PURE__ */ jsx6(
1602
+ return /* @__PURE__ */ jsx7(
1995
1603
  "button",
1996
1604
  {
1997
1605
  ref: forwardedRef,
@@ -2005,7 +1613,7 @@ var UnitToggle = forwardRef5(function AutoRechargeUnitToggle({ unit, fieldLabel,
2005
1613
  }
2006
1614
  );
2007
1615
  });
2008
- var Hint = forwardRef5(
1616
+ var Hint = forwardRef6(
2009
1617
  function AutoRechargeHint({ className, ...rest }, forwardedRef) {
2010
1618
  const ctx = useAutoRechargeCtx("Hint");
2011
1619
  const copy = useCopy();
@@ -2019,13 +1627,13 @@ var Hint = forwardRef5(
2019
1627
  ctx.isApproximate ? copy.autoRecharge.currencyPerRechargeApprox : copy.autoRecharge.currencyPerRecharge,
2020
1628
  { amount: hint }
2021
1629
  );
2022
- return /* @__PURE__ */ jsx6("p", { ref: forwardedRef, className, "data-solvapay-auto-recharge-hint": "", ...rest, children: text });
1630
+ return /* @__PURE__ */ jsx7("p", { ref: forwardedRef, className, "data-solvapay-auto-recharge-hint": "", ...rest, children: text });
2023
1631
  }
2024
1632
  );
2025
- var ValidationError = forwardRef5(function AutoRechargeValidationError({ className, ...rest }, forwardedRef) {
1633
+ var ValidationError = forwardRef6(function AutoRechargeValidationError({ className, ...rest }, forwardedRef) {
2026
1634
  const ctx = useAutoRechargeCtx("ValidationError");
2027
1635
  if (!ctx.validationError) return null;
2028
- return /* @__PURE__ */ jsx6(
1636
+ return /* @__PURE__ */ jsx7(
2029
1637
  "p",
2030
1638
  {
2031
1639
  ref: forwardedRef,
@@ -2038,24 +1646,24 @@ var ValidationError = forwardRef5(function AutoRechargeValidationError({ classNa
2038
1646
  }
2039
1647
  );
2040
1648
  });
2041
- var Actions = forwardRef5(
1649
+ var Actions = forwardRef6(
2042
1650
  function AutoRechargeActions({ className, children, ...rest }, forwardedRef) {
2043
- return /* @__PURE__ */ jsx6(
1651
+ return /* @__PURE__ */ jsx7(
2044
1652
  "menu",
2045
1653
  {
2046
1654
  ref: forwardedRef,
2047
1655
  className,
2048
1656
  "data-solvapay-auto-recharge-actions": "",
2049
1657
  ...rest,
2050
- children: children ?? /* @__PURE__ */ jsxs2(Fragment3, { children: [
2051
- /* @__PURE__ */ jsx6("li", { children: /* @__PURE__ */ jsx6(CancelButton, {}) }),
2052
- /* @__PURE__ */ jsx6("li", { children: /* @__PURE__ */ jsx6(SaveButton, {}) })
1658
+ children: children ?? /* @__PURE__ */ jsxs2(Fragment4, { children: [
1659
+ /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsx7(CancelButton, {}) }),
1660
+ /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsx7(SaveButton, {}) })
2053
1661
  ] })
2054
1662
  }
2055
1663
  );
2056
1664
  }
2057
1665
  );
2058
- var SaveButton = forwardRef5(function AutoRechargeSaveButton({ asChild, onClick, children, className, ...rest }, forwardedRef) {
1666
+ var SaveButton = forwardRef6(function AutoRechargeSaveButton({ asChild, onClick, children, className, ...rest }, forwardedRef) {
2059
1667
  const ctx = useAutoRechargeCtx("SaveButton");
2060
1668
  const copy = useCopy();
2061
1669
  const dataState = ctx.saving ? "processing" : ctx.validationError ? "disabled" : "idle";
@@ -2072,13 +1680,13 @@ var SaveButton = forwardRef5(function AutoRechargeSaveButton({ asChild, onClick,
2072
1680
  className,
2073
1681
  ...rest
2074
1682
  };
2075
- const content = ctx.saving ? /* @__PURE__ */ jsxs2(Fragment3, { children: [
2076
- /* @__PURE__ */ jsx6(Spinner, { size: "sm" }),
1683
+ const content = ctx.saving ? /* @__PURE__ */ jsxs2(Fragment4, { children: [
1684
+ /* @__PURE__ */ jsx7(Spinner, { size: "sm" }),
2077
1685
  " ",
2078
1686
  copy.cta.processing
2079
1687
  ] }) : children ?? copy.autoRecharge.saveButton;
2080
1688
  if (asChild) {
2081
- return /* @__PURE__ */ jsx6(
1689
+ return /* @__PURE__ */ jsx7(
2082
1690
  Slot,
2083
1691
  {
2084
1692
  ref: forwardedRef,
@@ -2087,9 +1695,9 @@ var SaveButton = forwardRef5(function AutoRechargeSaveButton({ asChild, onClick,
2087
1695
  }
2088
1696
  );
2089
1697
  }
2090
- return /* @__PURE__ */ jsx6("button", { ref: forwardedRef, ...commonProps, children: content });
1698
+ return /* @__PURE__ */ jsx7("button", { ref: forwardedRef, ...commonProps, children: content });
2091
1699
  });
2092
- var DisableButton = forwardRef5(
1700
+ var DisableButton = forwardRef6(
2093
1701
  function AutoRechargeDisableButton({ asChild, onClick, children, className, ...rest }, forwardedRef) {
2094
1702
  const ctx = useAutoRechargeCtx("DisableButton");
2095
1703
  const copy = useCopy();
@@ -2107,7 +1715,7 @@ var DisableButton = forwardRef5(
2107
1715
  ...rest
2108
1716
  };
2109
1717
  if (asChild) {
2110
- return /* @__PURE__ */ jsx6(
1718
+ return /* @__PURE__ */ jsx7(
2111
1719
  Slot,
2112
1720
  {
2113
1721
  ref: forwardedRef,
@@ -2116,14 +1724,14 @@ var DisableButton = forwardRef5(
2116
1724
  }
2117
1725
  );
2118
1726
  }
2119
- return /* @__PURE__ */ jsx6("button", { ref: forwardedRef, ...commonProps, children: children ?? copy.autoRecharge.disableButton });
1727
+ return /* @__PURE__ */ jsx7("button", { ref: forwardedRef, ...commonProps, children: children ?? copy.autoRecharge.disableButton });
2120
1728
  }
2121
1729
  );
2122
- var ErrorSlot4 = forwardRef5(
1730
+ var ErrorSlot4 = forwardRef6(
2123
1731
  function AutoRechargeError({ className, children, ...rest }, forwardedRef) {
2124
1732
  const ctx = useAutoRechargeCtx("Error");
2125
1733
  if (!ctx.error) return null;
2126
- return /* @__PURE__ */ jsx6(
1734
+ return /* @__PURE__ */ jsx7(
2127
1735
  "p",
2128
1736
  {
2129
1737
  ref: forwardedRef,
@@ -2137,11 +1745,11 @@ var ErrorSlot4 = forwardRef5(
2137
1745
  );
2138
1746
  }
2139
1747
  );
2140
- var StatusMessage = forwardRef5(
1748
+ var StatusMessage = forwardRef6(
2141
1749
  function AutoRechargeStatusMessage({ className, children, ...rest }, forwardedRef) {
2142
1750
  const ctx = useAutoRechargeCtx("StatusMessage");
2143
1751
  if (!ctx.statusMessage) return null;
2144
- return /* @__PURE__ */ jsx6(
1752
+ return /* @__PURE__ */ jsx7(
2145
1753
  "p",
2146
1754
  {
2147
1755
  ref: forwardedRef,
@@ -2154,7 +1762,7 @@ var StatusMessage = forwardRef5(
2154
1762
  );
2155
1763
  }
2156
1764
  );
2157
- var Status = forwardRef5(
1765
+ var Status = forwardRef6(
2158
1766
  function AutoRechargeStatus({ className, ...rest }, forwardedRef) {
2159
1767
  const ctx = useAutoRechargeCtx("Status");
2160
1768
  const copy = useCopy();
@@ -2171,8 +1779,8 @@ var Status = forwardRef5(
2171
1779
  "data-solvapay-auto-recharge-status-group": "",
2172
1780
  ...rest,
2173
1781
  children: [
2174
- failedLabel ? /* @__PURE__ */ jsx6("span", { "data-solvapay-auto-recharge-status": "", "data-status": "failed", children: failedLabel }) : null,
2175
- capLabel ? /* @__PURE__ */ jsx6("span", { "data-solvapay-auto-recharge-status": "", "data-status": "monthly-cap-reached", children: capLabel }) : null
1782
+ failedLabel ? /* @__PURE__ */ jsx7("span", { "data-solvapay-auto-recharge-status": "", "data-status": "failed", children: failedLabel }) : null,
1783
+ capLabel ? /* @__PURE__ */ jsx7("span", { "data-solvapay-auto-recharge-status": "", "data-status": "monthly-cap-reached", children: capLabel }) : null
2176
1784
  ]
2177
1785
  }
2178
1786
  );
@@ -2182,9 +1790,9 @@ function CardSetupInner({ onComplete }) {
2182
1790
  const copy = useCopy();
2183
1791
  const stripe = useStripe();
2184
1792
  const elements = useElements();
2185
- const [processing, setProcessing] = useState4(false);
2186
- const [error, setError] = useState4(null);
2187
- useEffect4(() => {
1793
+ const [processing, setProcessing] = useState3(false);
1794
+ const [error, setError] = useState3(null);
1795
+ useEffect3(() => {
2188
1796
  if (!stripe) return;
2189
1797
  const clientSecret = readSetupIntentClientSecret(window.location.search);
2190
1798
  if (!clientSecret) return;
@@ -2240,11 +1848,11 @@ function CardSetupInner({ onComplete }) {
2240
1848
  setProcessing(false);
2241
1849
  };
2242
1850
  return /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, "data-solvapay-auto-recharge-setup": "", children: [
2243
- /* @__PURE__ */ jsx6("h4", { children: copy.autoRecharge.setupHeading }),
2244
- /* @__PURE__ */ jsx6("p", { children: copy.autoRecharge.setupDescription }),
2245
- /* @__PURE__ */ jsx6(StripePaymentElement, { options: withPaymentElementDefaults() }),
2246
- error ? /* @__PURE__ */ jsx6("p", { role: "alert", "aria-live": "polite", "data-solvapay-auto-recharge-setup-error": "", children: error }) : null,
2247
- /* @__PURE__ */ jsx6(
1851
+ /* @__PURE__ */ jsx7("h4", { children: copy.autoRecharge.setupHeading }),
1852
+ /* @__PURE__ */ jsx7("p", { children: copy.autoRecharge.setupDescription }),
1853
+ /* @__PURE__ */ jsx7(StripePaymentElement, { options: withPaymentElementDefaults() }),
1854
+ error ? /* @__PURE__ */ jsx7("p", { role: "alert", "aria-live": "polite", "data-solvapay-auto-recharge-setup-error": "", children: error }) : null,
1855
+ /* @__PURE__ */ jsx7(
2248
1856
  "button",
2249
1857
  {
2250
1858
  type: "submit",
@@ -2256,7 +1864,7 @@ function CardSetupInner({ onComplete }) {
2256
1864
  ] });
2257
1865
  }
2258
1866
  function CardSetup({ setup, onComplete }) {
2259
- const stripePromise = useMemo4(() => {
1867
+ const stripePromise = useMemo5(() => {
2260
1868
  if (!setup.publishableKey || !setup.setupClientSecret) return null;
2261
1869
  const options = {
2262
1870
  ...setup.stripeAccountId ? { stripeAccount: setup.stripeAccountId } : {},
@@ -2271,16 +1879,16 @@ function CardSetup({ setup, onComplete }) {
2271
1879
  }, [setup.publishableKey, setup.setupClientSecret, setup.stripeAccountId]);
2272
1880
  if (!stripePromise || !setup.setupClientSecret) {
2273
1881
  return /* @__PURE__ */ jsxs2("p", { "data-solvapay-auto-recharge-setup-loading": "", children: [
2274
- /* @__PURE__ */ jsx6(Spinner, { size: "sm" }),
1882
+ /* @__PURE__ */ jsx7(Spinner, { size: "sm" }),
2275
1883
  " Loading card form\u2026"
2276
1884
  ] });
2277
1885
  }
2278
- return /* @__PURE__ */ jsx6(
1886
+ return /* @__PURE__ */ jsx7(
2279
1887
  Elements,
2280
1888
  {
2281
1889
  stripe: stripePromise,
2282
1890
  options: { clientSecret: setup.setupClientSecret },
2283
- children: /* @__PURE__ */ jsx6(CardSetupInner, { onComplete })
1891
+ children: /* @__PURE__ */ jsx7(CardSetupInner, { onComplete })
2284
1892
  },
2285
1893
  setup.setupClientSecret
2286
1894
  );
@@ -2362,7 +1970,7 @@ function useAutoRechargeForm() {
2362
1970
  }
2363
1971
 
2364
1972
  // src/hooks/usePaywallResolver.ts
2365
- import { useCallback as useCallback4, useMemo as useMemo5 } from "react";
1973
+ import { useCallback as useCallback4, useMemo as useMemo6 } from "react";
2366
1974
  function balanceCoversNextUnit(balance, credits) {
2367
1975
  if (!balance) return false;
2368
1976
  if (typeof balance.remainingUnits === "number" && balance.remainingUnits > 0) {
@@ -2376,7 +1984,7 @@ function balanceCoversNextUnit(balance, credits) {
2376
1984
  function usePaywallResolver(content) {
2377
1985
  const { activePurchase, hasPaidPurchase, refetch: refetchPurchase } = usePurchase();
2378
1986
  const { credits, refetch: refetchBalance } = useBalance();
2379
- const resolved = useMemo5(() => {
1987
+ const resolved = useMemo6(() => {
2380
1988
  if (!content) return false;
2381
1989
  const productMatches = !content.product || activePurchase?.productRef === content.product || activePurchase?.productName === content.product;
2382
1990
  if (content.kind === "payment_required") {
@@ -2398,20 +2006,20 @@ function usePaywallResolver(content) {
2398
2006
  // src/primitives/PaywallNotice.tsx
2399
2007
  import {
2400
2008
  createContext as createContext6,
2401
- forwardRef as forwardRef7,
2009
+ forwardRef as forwardRef8,
2402
2010
  useCallback as useCallback5,
2403
- useContext as useContext7,
2404
- useEffect as useEffect5,
2405
- useMemo as useMemo7,
2406
- useRef as useRef4
2011
+ useContext as useContext8,
2012
+ useEffect as useEffect4,
2013
+ useMemo as useMemo8,
2014
+ useRef as useRef3
2407
2015
  } from "react";
2408
2016
 
2409
2017
  // src/primitives/checkout/index.tsx
2410
- import { createContext as createContext5, forwardRef as forwardRef6, useContext as useContext6, useMemo as useMemo6 } from "react";
2411
- import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
2018
+ import { createContext as createContext5, forwardRef as forwardRef7, useContext as useContext7, useMemo as useMemo7 } from "react";
2019
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
2412
2020
  var CheckoutContext = createContext5(null);
2413
2021
  function useCheckoutContext(part) {
2414
- const ctx = useContext6(CheckoutContext);
2022
+ const ctx = useContext7(CheckoutContext);
2415
2023
  if (!ctx) {
2416
2024
  throw new Error(`CheckoutSteps.${part} must be rendered inside <CheckoutSteps.Root>.`);
2417
2025
  }
@@ -2420,7 +2028,7 @@ function useCheckoutContext(part) {
2420
2028
  function useCheckoutSteps() {
2421
2029
  return useCheckoutContext("useCheckoutSteps");
2422
2030
  }
2423
- var Root5 = forwardRef6(function CheckoutStepsRoot(props, forwardedRef) {
2031
+ var Root5 = forwardRef7(function CheckoutStepsRoot(props, forwardedRef) {
2424
2032
  const {
2425
2033
  productRef,
2426
2034
  returnUrl: _returnUrl,
@@ -2442,9 +2050,9 @@ var Root5 = forwardRef6(function CheckoutStepsRoot(props, forwardedRef) {
2442
2050
  children
2443
2051
  } = props;
2444
2052
  if (externalFlow) {
2445
- return /* @__PURE__ */ jsx7("div", { ref: forwardedRef, "data-solvapay-checkout": "", className, children: /* @__PURE__ */ jsx7(CheckoutContext.Provider, { value: externalFlow, children }) });
2053
+ return /* @__PURE__ */ jsx8("div", { ref: forwardedRef, "data-solvapay-checkout": "", className, children: /* @__PURE__ */ jsx8(CheckoutContext.Provider, { value: externalFlow, children }) });
2446
2054
  }
2447
- return /* @__PURE__ */ jsx7(
2055
+ return /* @__PURE__ */ jsx8(
2448
2056
  RootWithPlanSelector,
2449
2057
  {
2450
2058
  productRef,
@@ -2487,11 +2095,11 @@ function RootWithPlanSelector({
2487
2095
  children
2488
2096
  }) {
2489
2097
  const { plans } = usePlans({ productRef });
2490
- const resolvedFilter = useMemo6(
2098
+ const resolvedFilter = useMemo7(
2491
2099
  () => filter ?? buildDefaultCheckoutPlanFilter(plans),
2492
2100
  [filter, plans]
2493
2101
  );
2494
- return /* @__PURE__ */ jsx7(
2102
+ return /* @__PURE__ */ jsx8(
2495
2103
  PlanSelector.Root,
2496
2104
  {
2497
2105
  productRef,
@@ -2501,7 +2109,7 @@ function RootWithPlanSelector({
2501
2109
  currentPlanRef,
2502
2110
  autoSelectFirstPaid,
2503
2111
  initialPlanRef,
2504
- children: /* @__PURE__ */ jsx7(
2112
+ children: /* @__PURE__ */ jsx8(
2505
2113
  FlowProvider,
2506
2114
  {
2507
2115
  productRef,
@@ -2543,22 +2151,22 @@ function FlowProvider({
2543
2151
  onPurchaseSuccess,
2544
2152
  onError
2545
2153
  });
2546
- return /* @__PURE__ */ jsx7("div", { ref: forwardedRef, "data-solvapay-checkout": "", "data-step": flow.step, className, children: /* @__PURE__ */ jsx7(CheckoutContext.Provider, { value: flow, children }) });
2154
+ return /* @__PURE__ */ jsx8("div", { ref: forwardedRef, "data-solvapay-checkout": "", "data-step": flow.step, className, children: /* @__PURE__ */ jsx8(CheckoutContext.Provider, { value: flow, children }) });
2547
2155
  }
2548
2156
  function IfStep({ step, children }) {
2549
2157
  const flow = useCheckoutContext("IfStep");
2550
2158
  const matches = Array.isArray(step) ? step.includes(flow.step) : flow.step === step;
2551
2159
  if (!matches) return null;
2552
- return /* @__PURE__ */ jsx7(Fragment4, { children });
2160
+ return /* @__PURE__ */ jsx8(Fragment5, { children });
2553
2161
  }
2554
- var StepHeading = forwardRef6(function CheckoutStepsStepHeading({ asChild, children, className, ...rest }, forwardedRef) {
2162
+ var StepHeading = forwardRef7(function CheckoutStepsStepHeading({ asChild, children, className, ...rest }, forwardedRef) {
2555
2163
  const flow = useCheckoutContext("StepHeading");
2556
2164
  const copy = useCopy();
2557
2165
  const paywallCtx = usePaywallNoticeOptional();
2558
2166
  if (flow.step === "success") return null;
2559
2167
  const defaultText = resolveStepHeading(flow.step, copy, paywallCtx?.content ?? null);
2560
2168
  const Comp = asChild ? Slot : "h3";
2561
- return /* @__PURE__ */ jsx7(
2169
+ return /* @__PURE__ */ jsx8(
2562
2170
  Comp,
2563
2171
  {
2564
2172
  ref: forwardedRef,
@@ -2570,7 +2178,7 @@ var StepHeading = forwardRef6(function CheckoutStepsStepHeading({ asChild, child
2570
2178
  }
2571
2179
  );
2572
2180
  });
2573
- var StepMessage = forwardRef6(
2181
+ var StepMessage = forwardRef7(
2574
2182
  function CheckoutStepsStepMessage({ asChild, children, className, ...rest }, forwardedRef) {
2575
2183
  const flow = useCheckoutContext("StepMessage");
2576
2184
  const copy = useCopy();
@@ -2579,7 +2187,7 @@ var StepMessage = forwardRef6(
2579
2187
  const defaultText = resolveStepMessage(flow, copy, paywallCtx?.content ?? null);
2580
2188
  if (!defaultText && children == null) return null;
2581
2189
  const Comp = asChild ? Slot : "p";
2582
- return /* @__PURE__ */ jsx7(
2190
+ return /* @__PURE__ */ jsx8(
2583
2191
  Comp,
2584
2192
  {
2585
2193
  ref: forwardedRef,
@@ -2627,21 +2235,21 @@ function resolveStepMessage(flow, copy, content) {
2627
2235
  return "";
2628
2236
  }
2629
2237
  function PlanGrid({ className, children }) {
2630
- return /* @__PURE__ */ jsx7(PlanSelector.Grid, { className: className ?? "solvapay-checkout-plan-grid", children: children ?? /* @__PURE__ */ jsxs3(PlanSelector.Card, { className: "solvapay-checkout-plan-card", children: [
2631
- /* @__PURE__ */ jsx7(PlanSelector.CardBadge, { className: "solvapay-checkout-plan-card-badge" }),
2632
- /* @__PURE__ */ jsx7(PlanSelector.CardName, { className: "solvapay-checkout-plan-card-name" }),
2633
- /* @__PURE__ */ jsx7(PlanSelector.CardPrice, { className: "solvapay-checkout-plan-card-price" }),
2634
- /* @__PURE__ */ jsx7(PlanSelector.CardInterval, { className: "solvapay-checkout-plan-card-interval" })
2238
+ return /* @__PURE__ */ jsx8(PlanSelector.Grid, { className: className ?? "solvapay-checkout-plan-grid", children: children ?? /* @__PURE__ */ jsxs3(PlanSelector.Card, { className: "solvapay-checkout-plan-card", children: [
2239
+ /* @__PURE__ */ jsx8(PlanSelector.CardBadge, { className: "solvapay-checkout-plan-card-badge" }),
2240
+ /* @__PURE__ */ jsx8(PlanSelector.CardName, { className: "solvapay-checkout-plan-card-name" }),
2241
+ /* @__PURE__ */ jsx8(PlanSelector.CardPrice, { className: "solvapay-checkout-plan-card-price" }),
2242
+ /* @__PURE__ */ jsx8(PlanSelector.CardInterval, { className: "solvapay-checkout-plan-card-interval" })
2635
2243
  ] }) });
2636
2244
  }
2637
- var PlanContinueButton = forwardRef6(
2245
+ var PlanContinueButton = forwardRef7(
2638
2246
  function PlanContinueButton2({ className, children, onClick, disabled, ...rest }, ref) {
2639
2247
  const flow = useCheckoutContext("PlanContinueButton");
2640
2248
  const locale = useLocale();
2641
2249
  const selectedPlanShape = flow.selectedPlan;
2642
2250
  const isDisabled = disabled || !flow.selectedPlanRef || flow.status === "activating";
2643
2251
  const label = children ?? formatContinueLabel(selectedPlanShape, locale);
2644
- return /* @__PURE__ */ jsx7(
2252
+ return /* @__PURE__ */ jsx8(
2645
2253
  "button",
2646
2254
  {
2647
2255
  ref,
@@ -2664,7 +2272,7 @@ var PlanContinueButton = forwardRef6(
2664
2272
  function AmountPicker2({ className, children }) {
2665
2273
  const flow = useCheckoutContext("AmountPicker");
2666
2274
  if (!flow.topupCurrencyReady || flow.topupCurrency == null) {
2667
- return /* @__PURE__ */ jsx7("div", { className: className ?? "solvapay-amount-picker", "data-state": "loading", "aria-busy": "true", children: /* @__PURE__ */ jsx7("div", { className: "solvapay-amount-picker-pills", children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx7(
2275
+ return /* @__PURE__ */ jsx8("div", { className: className ?? "solvapay-amount-picker", "data-state": "loading", "aria-busy": "true", children: /* @__PURE__ */ jsx8("div", { className: "solvapay-amount-picker-pills", children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx8(
2668
2276
  "span",
2669
2277
  {
2670
2278
  className: "solvapay-amount-picker-pill",
@@ -2674,7 +2282,7 @@ function AmountPicker2({ className, children }) {
2674
2282
  i
2675
2283
  )) }) });
2676
2284
  }
2677
- return /* @__PURE__ */ jsx7(
2285
+ return /* @__PURE__ */ jsx8(
2678
2286
  AmountPicker.Root,
2679
2287
  {
2680
2288
  currency: flow.topupCurrency,
@@ -2685,16 +2293,16 @@ function AmountPicker2({ className, children }) {
2685
2293
  flow.selectAmount(value);
2686
2294
  }
2687
2295
  },
2688
- children: children ?? /* @__PURE__ */ jsx7(DefaultAmountTree, {})
2296
+ children: children ?? /* @__PURE__ */ jsx8(DefaultAmountTree, {})
2689
2297
  }
2690
2298
  );
2691
2299
  }
2692
2300
  function DefaultAmountTree() {
2693
2301
  const ctx = useAmountPicker();
2694
2302
  const { selectAmountLabel, customAmountLabel, creditEstimate } = useAmountPickerCopy();
2695
- return /* @__PURE__ */ jsxs3(Fragment4, { children: [
2696
- /* @__PURE__ */ jsx7("p", { className: "solvapay-amount-picker-label", children: selectAmountLabel }),
2697
- /* @__PURE__ */ jsx7("div", { className: "solvapay-amount-picker-pills", children: ctx.quickAmounts.map((amount) => /* @__PURE__ */ jsx7(
2303
+ return /* @__PURE__ */ jsxs3(Fragment5, { children: [
2304
+ /* @__PURE__ */ jsx8("p", { className: "solvapay-amount-picker-label", children: selectAmountLabel }),
2305
+ /* @__PURE__ */ jsx8("div", { className: "solvapay-amount-picker-pills", children: ctx.quickAmounts.map((amount) => /* @__PURE__ */ jsx8(
2698
2306
  AmountPicker.Option,
2699
2307
  {
2700
2308
  amount,
@@ -2703,10 +2311,10 @@ function DefaultAmountTree() {
2703
2311
  amount
2704
2312
  )) }),
2705
2313
  /* @__PURE__ */ jsxs3("div", { className: "solvapay-amount-picker-custom-wrapper", children: [
2706
- /* @__PURE__ */ jsx7("p", { className: "solvapay-amount-picker-custom-label", children: customAmountLabel }),
2314
+ /* @__PURE__ */ jsx8("p", { className: "solvapay-amount-picker-custom-label", children: customAmountLabel }),
2707
2315
  /* @__PURE__ */ jsxs3("div", { className: "solvapay-amount-picker-custom-row", children: [
2708
- /* @__PURE__ */ jsx7("span", { className: "solvapay-amount-picker-currency-symbol", children: ctx.currencySymbol }),
2709
- /* @__PURE__ */ jsx7(
2316
+ /* @__PURE__ */ jsx8("span", { className: "solvapay-amount-picker-currency-symbol", children: ctx.currencySymbol }),
2317
+ /* @__PURE__ */ jsx8(
2710
2318
  AmountPicker.Custom,
2711
2319
  {
2712
2320
  className: "solvapay-amount-picker-custom-input",
@@ -2715,7 +2323,7 @@ function DefaultAmountTree() {
2715
2323
  )
2716
2324
  ] })
2717
2325
  ] }),
2718
- /* @__PURE__ */ jsx7(
2326
+ /* @__PURE__ */ jsx8(
2719
2327
  "p",
2720
2328
  {
2721
2329
  className: "solvapay-amount-picker-credit-estimate",
@@ -2725,7 +2333,7 @@ function DefaultAmountTree() {
2725
2333
  )
2726
2334
  ] });
2727
2335
  }
2728
- var AmountContinueButton = forwardRef6(
2336
+ var AmountContinueButton = forwardRef7(
2729
2337
  function AmountContinueButton2({ className, children, onClick, disabled, ...rest }, ref) {
2730
2338
  const flow = useCheckoutContext("AmountContinueButton");
2731
2339
  const locale = useLocale();
@@ -2734,7 +2342,7 @@ var AmountContinueButton = forwardRef6(
2734
2342
  const ready = flow.topupCurrencyReady && currency != null;
2735
2343
  const isDisabled = disabled || !ready || amountMinor == null;
2736
2344
  const label = children ?? (ready && currency != null && amountMinor != null ? `Continue \u2014 ${formatPrice(amountMinor, currency, { locale })}` : "Continue");
2737
- return /* @__PURE__ */ jsx7(
2345
+ return /* @__PURE__ */ jsx8(
2738
2346
  "button",
2739
2347
  {
2740
2348
  ref,
@@ -2757,10 +2365,10 @@ var AmountContinueButton = forwardRef6(
2757
2365
  function Payment({ className }) {
2758
2366
  const flow = useCheckoutContext("Payment");
2759
2367
  if (flow.branch === "payg") {
2760
- return /* @__PURE__ */ jsx7(PaygPayment, { className });
2368
+ return /* @__PURE__ */ jsx8(PaygPayment, { className });
2761
2369
  }
2762
2370
  if (flow.branch === "recurring") {
2763
- return /* @__PURE__ */ jsx7(RecurringPayment, { className });
2371
+ return /* @__PURE__ */ jsx8(RecurringPayment, { className });
2764
2372
  }
2765
2373
  return null;
2766
2374
  }
@@ -2775,9 +2383,9 @@ function PaygPayment({ className }) {
2775
2383
  if (!selectedPlanShape || amountMinor == null || currency == null) return null;
2776
2384
  const creditsAdded = creditsPerMinorUnit != null && creditsPerMinorUnit > 0 ? Math.floor(amountMinor / (displayExchangeRate ?? 1) * creditsPerMinorUnit) : null;
2777
2385
  return /* @__PURE__ */ jsxs3("div", { className: className ?? "solvapay-checkout-payment", "data-branch": "payg", children: [
2778
- /* @__PURE__ */ jsx7("div", { className: "solvapay-checkout-order-summary", "data-variant": "payg", children: /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-order-summary-row", children: [
2779
- /* @__PURE__ */ jsx7("span", { children: creditsAdded != null ? `${creditsAdded.toLocaleString(locale)} credits` : formatPrice(amountMinor, currency, { locale }) }),
2780
- creditsAdded != null ? /* @__PURE__ */ jsx7("span", { children: formatPrice(amountMinor, currency, { locale }) }) : null
2386
+ /* @__PURE__ */ jsx8("div", { className: "solvapay-checkout-order-summary", "data-variant": "payg", children: /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-order-summary-row", children: [
2387
+ /* @__PURE__ */ jsx8("span", { children: creditsAdded != null ? `${creditsAdded.toLocaleString(locale)} credits` : formatPrice(amountMinor, currency, { locale }) }),
2388
+ creditsAdded != null ? /* @__PURE__ */ jsx8("span", { children: formatPrice(amountMinor, currency, { locale }) }) : null
2781
2389
  ] }) }),
2782
2390
  /* @__PURE__ */ jsxs3(
2783
2391
  TopupForm.Root,
@@ -2788,17 +2396,17 @@ function PaygPayment({ className }) {
2788
2396
  className: "solvapay-checkout-topup-form",
2789
2397
  onSuccess: (intent, extras) => flow.notifyPaymentSuccess(intent, extras),
2790
2398
  children: [
2791
- /* @__PURE__ */ jsx7(TopupForm.Loading, {}),
2792
- /* @__PURE__ */ jsx7(TopupForm.BusinessDetails.Root, { className: "solvapay-checkout-business-details", children: /* @__PURE__ */ jsx7(TopupForm.BusinessDetails.Fields, {}) }),
2793
- /* @__PURE__ */ jsx7(TopupForm.Summary.Root, { className: "solvapay-checkout-tax-summary", children: /* @__PURE__ */ jsx7(TopupForm.Summary.Rows, {}) }),
2794
- /* @__PURE__ */ jsx7(TopupForm.PaymentElement, {}),
2795
- /* @__PURE__ */ jsx7(TopupForm.Error, { className: "solvapay-checkout-error" }),
2796
- /* @__PURE__ */ jsx7(MandateText, { mode: "topup", amountMinor, currency }),
2797
- /* @__PURE__ */ jsx7("span", { className: "solvapay-secure-note", children: "Secure payment processed by Stripe" }),
2399
+ /* @__PURE__ */ jsx8(TopupForm.Loading, {}),
2400
+ /* @__PURE__ */ jsx8(TopupForm.BusinessDetails.Root, { className: "solvapay-checkout-business-details", children: /* @__PURE__ */ jsx8(TopupForm.BusinessDetails.Fields, {}) }),
2401
+ /* @__PURE__ */ jsx8(TopupForm.Summary.Root, { className: "solvapay-checkout-tax-summary", children: /* @__PURE__ */ jsx8(TopupForm.Summary.Rows, {}) }),
2402
+ /* @__PURE__ */ jsx8(TopupForm.PaymentElement, {}),
2403
+ /* @__PURE__ */ jsx8(TopupForm.Error, { className: "solvapay-checkout-error" }),
2404
+ /* @__PURE__ */ jsx8("span", { className: "solvapay-secure-note", children: "Secure payment processed by Stripe" }),
2798
2405
  /* @__PURE__ */ jsxs3(TopupForm.SubmitButton, { className: "solvapay-checkout-pay-button", children: [
2799
2406
  "Pay ",
2800
2407
  formatPrice(amountMinor, currency, { locale })
2801
- ] })
2408
+ ] }),
2409
+ /* @__PURE__ */ jsx8(MandateText, { mode: "topup", amountMinor, currency })
2802
2410
  ]
2803
2411
  }
2804
2412
  )
@@ -2813,15 +2421,15 @@ function RecurringPayment({ className }) {
2813
2421
  if (!selectedPlanShape || !flow.selectedPlanRef) return null;
2814
2422
  const currency = (selectedPlanShape.currency ?? "USD").toUpperCase();
2815
2423
  const amountMinor = selectedPlanShape.price ?? 0;
2816
- const cycle = planBillingInterval(selectedPlanShape);
2424
+ const cycle = planBillingCycle(selectedPlanShape);
2817
2425
  const planName = selectedPlanShape.name ?? "Plan";
2818
- const isRecurring = !!cycle;
2426
+ const isRecurring = cycle != null;
2819
2427
  const formattedAmount = formatPrice(amountMinor, currency, { locale });
2820
- const priceLine = isRecurring ? `${formattedAmount}/${shortCycle(cycle)}` : formattedAmount;
2428
+ const priceLine = isRecurring ? `${formattedAmount}${formatCycleSuffix(cycle)}` : `${formattedAmount} once`;
2821
2429
  return /* @__PURE__ */ jsxs3("div", { className: className ?? "solvapay-checkout-payment", "data-branch": "recurring", children: [
2822
- /* @__PURE__ */ jsx7("div", { className: "solvapay-checkout-order-summary", "data-variant": "recurring", children: /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-order-summary-row", children: [
2823
- /* @__PURE__ */ jsx7("span", { children: planName }),
2824
- /* @__PURE__ */ jsx7("span", { children: priceLine })
2430
+ /* @__PURE__ */ jsx8("div", { className: "solvapay-checkout-order-summary", "data-variant": "recurring", children: /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-order-summary-row", children: [
2431
+ /* @__PURE__ */ jsx8("span", { children: planName }),
2432
+ /* @__PURE__ */ jsx8("span", { children: priceLine })
2825
2433
  ] }) }),
2826
2434
  /* @__PURE__ */ jsxs3(
2827
2435
  PaymentForm.Root,
@@ -2832,14 +2440,14 @@ function RecurringPayment({ className }) {
2832
2440
  requireTermsAcceptance: false,
2833
2441
  onSuccess: (intent) => flow.notifyPaymentSuccess(intent),
2834
2442
  children: [
2835
- /* @__PURE__ */ jsx7(PaymentForm.Loading, {}),
2836
- /* @__PURE__ */ jsx7(PaymentForm.BusinessDetails.Root, { className: "solvapay-checkout-business-details", children: /* @__PURE__ */ jsx7(PaymentForm.BusinessDetails.Fields, {}) }),
2837
- /* @__PURE__ */ jsx7(PaymentForm.TaxSummary.Root, { className: "solvapay-checkout-tax-summary", children: /* @__PURE__ */ jsx7(PaymentForm.TaxSummary.Rows, {}) }),
2838
- /* @__PURE__ */ jsx7(PaymentForm.PaymentElement, {}),
2839
- /* @__PURE__ */ jsx7(PaymentForm.Error, { className: "solvapay-checkout-error" }),
2840
- /* @__PURE__ */ jsx7(PaymentForm.MandateText, {}),
2841
- /* @__PURE__ */ jsx7("span", { className: "solvapay-secure-note", children: "Secure payment processed by Stripe" }),
2842
- /* @__PURE__ */ jsx7(PaymentForm.SubmitButton, { className: "solvapay-checkout-pay-button", children: isRecurring ? `Subscribe \u2014 ${priceLine}` : `Pay ${formattedAmount}` })
2443
+ /* @__PURE__ */ jsx8(PaymentForm.Loading, {}),
2444
+ /* @__PURE__ */ jsx8(PaymentForm.BusinessDetails.Root, { className: "solvapay-checkout-business-details", children: /* @__PURE__ */ jsx8(PaymentForm.BusinessDetails.Fields, {}) }),
2445
+ /* @__PURE__ */ jsx8(PaymentForm.TaxSummary.Root, { className: "solvapay-checkout-tax-summary", children: /* @__PURE__ */ jsx8(PaymentForm.TaxSummary.Rows, {}) }),
2446
+ /* @__PURE__ */ jsx8(PaymentForm.PaymentElement, {}),
2447
+ /* @__PURE__ */ jsx8(PaymentForm.Error, { className: "solvapay-checkout-error" }),
2448
+ /* @__PURE__ */ jsx8("span", { className: "solvapay-secure-note", children: "Secure payment processed by Stripe" }),
2449
+ /* @__PURE__ */ jsx8(PaymentForm.SubmitButton, { className: "solvapay-checkout-pay-button", children: isRecurring ? `Subscribe \u2014 ${priceLine}` : `Pay ${formattedAmount}` }),
2450
+ /* @__PURE__ */ jsx8(PaymentForm.MandateText, {})
2843
2451
  ]
2844
2452
  }
2845
2453
  )
@@ -2847,12 +2455,12 @@ function RecurringPayment({ className }) {
2847
2455
  }
2848
2456
  var CheckoutEnvContext = createContext5(null);
2849
2457
  function useReturnUrl() {
2850
- return useContext6(CheckoutEnvContext)?.returnUrl ?? "";
2458
+ return useContext7(CheckoutEnvContext)?.returnUrl ?? "";
2851
2459
  }
2852
2460
  function useProductRef() {
2853
- return useContext6(CheckoutEnvContext)?.productRef ?? "";
2461
+ return useContext7(CheckoutEnvContext)?.productRef ?? "";
2854
2462
  }
2855
- var BackLink = forwardRef6(function CheckoutStepsBackLink({ label, glyph = "\u2190", className, onClick, ...rest }, ref) {
2463
+ var BackLink = forwardRef7(function CheckoutStepsBackLink({ label, glyph = "\u2190", className, onClick, ...rest }, ref) {
2856
2464
  const flow = useCheckoutContext("BackLink");
2857
2465
  if (!flow.canGoBack) return null;
2858
2466
  const resolvedLabel = label ?? (flow.step === "payment" && flow.branch === "payg" ? "Change amount" : flow.step === "payment" && flow.branch === "recurring" ? "Change plan" : "Back");
@@ -2870,8 +2478,8 @@ var BackLink = forwardRef6(function CheckoutStepsBackLink({ label, glyph = "\u21
2870
2478
  },
2871
2479
  ...rest,
2872
2480
  children: [
2873
- /* @__PURE__ */ jsx7("span", { className: "solvapay-checkout-back-link-glyph", "aria-hidden": "true", children: glyph }),
2874
- /* @__PURE__ */ jsx7("span", { className: "solvapay-checkout-back-link-label", children: resolvedLabel })
2481
+ /* @__PURE__ */ jsx8("span", { className: "solvapay-checkout-back-link-glyph", "aria-hidden": "true", children: glyph }),
2482
+ /* @__PURE__ */ jsx8("span", { className: "solvapay-checkout-back-link-label", children: resolvedLabel })
2875
2483
  ]
2876
2484
  }
2877
2485
  );
@@ -2881,7 +2489,7 @@ function Success({ className, children }) {
2881
2489
  const locale = useLocale();
2882
2490
  if (flow.step !== "success" || !flow.successMeta) return null;
2883
2491
  if (children) {
2884
- return /* @__PURE__ */ jsx7("div", { className: className ?? "solvapay-checkout-success", children });
2492
+ return /* @__PURE__ */ jsx8("div", { className: className ?? "solvapay-checkout-success", children });
2885
2493
  }
2886
2494
  const meta = flow.successMeta;
2887
2495
  if (meta.branch === "payg") {
@@ -2889,17 +2497,17 @@ function Success({ className, children }) {
2889
2497
  const chargedCurrency = meta.currency;
2890
2498
  const charged = chargedAmount != null && chargedCurrency != null;
2891
2499
  return /* @__PURE__ */ jsxs3("div", { className: className ?? "solvapay-checkout-success", "data-branch": "payg", children: [
2892
- /* @__PURE__ */ jsx7("div", { className: "solvapay-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
2893
- /* @__PURE__ */ jsx7("h2", { className: "solvapay-checkout-success-heading", children: charged ? "Credits added" : "Plan activated" }),
2894
- /* @__PURE__ */ jsx7("p", { className: "solvapay-checkout-success-subheading", children: "Pay as you go plan is active." }),
2500
+ /* @__PURE__ */ jsx8("div", { className: "solvapay-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
2501
+ /* @__PURE__ */ jsx8("h2", { className: "solvapay-checkout-success-heading", children: charged ? "Credits added" : "Plan activated" }),
2502
+ /* @__PURE__ */ jsx8("p", { className: "solvapay-checkout-success-subheading", children: "Pay as you go plan is active." }),
2895
2503
  /* @__PURE__ */ jsxs3("dl", { className: "solvapay-checkout-receipt", "data-variant": "payg", children: [
2896
- charged ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
2504
+ charged ? /* @__PURE__ */ jsxs3(Fragment5, { children: [
2897
2505
  /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-receipt-row", children: [
2898
- /* @__PURE__ */ jsx7("dt", { children: "Amount" }),
2899
- /* @__PURE__ */ jsx7("dd", { children: formatPrice(chargedAmount, chargedCurrency, { locale }) })
2506
+ /* @__PURE__ */ jsx8("dt", { children: "Amount" }),
2507
+ /* @__PURE__ */ jsx8("dd", { children: formatPrice(chargedAmount, chargedCurrency, { locale }) })
2900
2508
  ] }),
2901
2509
  /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-receipt-row", children: [
2902
- /* @__PURE__ */ jsx7("dt", { children: "Credits" }),
2510
+ /* @__PURE__ */ jsx8("dt", { children: "Credits" }),
2903
2511
  /* @__PURE__ */ jsxs3("dd", { children: [
2904
2512
  "+",
2905
2513
  (meta.creditsAdded ?? 0).toLocaleString(locale)
@@ -2907,30 +2515,30 @@ function Success({ className, children }) {
2907
2515
  ] })
2908
2516
  ] }) : null,
2909
2517
  /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-receipt-row", children: [
2910
- /* @__PURE__ */ jsx7("dt", { children: "Plan" }),
2911
- /* @__PURE__ */ jsx7("dd", { children: meta.plan.name ?? "Pay as you go" })
2518
+ /* @__PURE__ */ jsx8("dt", { children: "Plan" }),
2519
+ /* @__PURE__ */ jsx8("dd", { children: meta.plan.name ?? "Pay as you go" })
2912
2520
  ] }),
2913
2521
  meta.rateLabel ? /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-receipt-row", children: [
2914
- /* @__PURE__ */ jsx7("dt", { children: "Rate" }),
2915
- /* @__PURE__ */ jsx7("dd", { children: meta.rateLabel })
2522
+ /* @__PURE__ */ jsx8("dt", { children: "Rate" }),
2523
+ /* @__PURE__ */ jsx8("dd", { children: meta.rateLabel })
2916
2524
  ] }) : null
2917
2525
  ] })
2918
2526
  ] });
2919
2527
  }
2920
2528
  return /* @__PURE__ */ jsxs3("div", { className: className ?? "solvapay-checkout-success", "data-branch": "recurring", children: [
2921
- /* @__PURE__ */ jsx7("div", { className: "solvapay-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
2529
+ /* @__PURE__ */ jsx8("div", { className: "solvapay-checkout-success-check", "aria-hidden": "true", children: "\u2713" }),
2922
2530
  /* @__PURE__ */ jsxs3("h2", { className: "solvapay-checkout-success-heading", children: [
2923
2531
  meta.plan.name ?? "Plan",
2924
2532
  " active"
2925
2533
  ] }),
2926
- /* @__PURE__ */ jsx7("p", { className: "solvapay-checkout-success-subheading", children: "Subscription is live and credits are ready." }),
2534
+ /* @__PURE__ */ jsx8("p", { className: "solvapay-checkout-success-subheading", children: "Subscription is live and credits are ready." }),
2927
2535
  /* @__PURE__ */ jsxs3("dl", { className: "solvapay-checkout-receipt", "data-variant": "recurring", children: [
2928
2536
  /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-receipt-row", children: [
2929
- /* @__PURE__ */ jsx7("dt", { children: "Plan" }),
2930
- /* @__PURE__ */ jsx7("dd", { children: meta.plan.name ?? "Plan" })
2537
+ /* @__PURE__ */ jsx8("dt", { children: "Plan" }),
2538
+ /* @__PURE__ */ jsx8("dd", { children: meta.plan.name ?? "Plan" })
2931
2539
  ] }),
2932
2540
  meta.includedUnits != null ? /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-receipt-row", children: [
2933
- /* @__PURE__ */ jsx7("dt", { children: "Included" }),
2541
+ /* @__PURE__ */ jsx8("dt", { children: "Included" }),
2934
2542
  /* @__PURE__ */ jsxs3("dd", { children: [
2935
2543
  meta.includedUnits.toLocaleString(locale),
2936
2544
  " ",
@@ -2938,23 +2546,23 @@ function Success({ className, children }) {
2938
2546
  ] })
2939
2547
  ] }) : null,
2940
2548
  /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-receipt-row", children: [
2941
- /* @__PURE__ */ jsx7("dt", { children: "Charged today" }),
2942
- /* @__PURE__ */ jsx7("dd", { children: formatPrice(meta.chargedTodayMinor, meta.currency, { locale }) })
2549
+ /* @__PURE__ */ jsx8("dt", { children: "Charged today" }),
2550
+ /* @__PURE__ */ jsx8("dd", { children: formatPrice(meta.chargedTodayMinor, meta.currency, { locale }) })
2943
2551
  ] }),
2944
2552
  meta.nextRenewalLabel ? /* @__PURE__ */ jsxs3("div", { className: "solvapay-checkout-receipt-row", children: [
2945
- /* @__PURE__ */ jsx7("dt", { children: "Next renewal" }),
2946
- /* @__PURE__ */ jsx7("dd", { children: meta.nextRenewalLabel })
2553
+ /* @__PURE__ */ jsx8("dt", { children: "Next renewal" }),
2554
+ /* @__PURE__ */ jsx8("dd", { children: meta.nextRenewalLabel })
2947
2555
  ] }) : null
2948
2556
  ] })
2949
2557
  ] });
2950
2558
  }
2951
- var RootWithEnv = forwardRef6(
2559
+ var RootWithEnv = forwardRef7(
2952
2560
  function CheckoutStepsRootWithEnv(props, forwardedRef) {
2953
- const env = useMemo6(
2561
+ const env = useMemo7(
2954
2562
  () => ({ returnUrl: props.returnUrl, productRef: props.productRef }),
2955
2563
  [props.returnUrl, props.productRef]
2956
2564
  );
2957
- return /* @__PURE__ */ jsx7(CheckoutEnvContext.Provider, { value: env, children: /* @__PURE__ */ jsx7(Root5, { ...props, ref: forwardedRef }) });
2565
+ return /* @__PURE__ */ jsx8(CheckoutEnvContext.Provider, { value: env, children: /* @__PURE__ */ jsx8(Root5, { ...props, ref: forwardedRef }) });
2958
2566
  }
2959
2567
  );
2960
2568
  var CheckoutSteps = {
@@ -2983,32 +2591,32 @@ var CheckoutStepsBackLink2 = BackLink;
2983
2591
  var CheckoutStepsSuccess = Success;
2984
2592
 
2985
2593
  // src/primitives/PaywallNotice.tsx
2986
- import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
2594
+ import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
2987
2595
  var PaywallNoticeContext = createContext6(null);
2988
2596
  function usePaywallNoticeCtx(part) {
2989
- const ctx = useContext7(PaywallNoticeContext);
2597
+ const ctx = useContext8(PaywallNoticeContext);
2990
2598
  if (!ctx) {
2991
2599
  throw new Error(`PaywallNotice.${part} must be rendered inside <PaywallNotice.Root>.`);
2992
2600
  }
2993
2601
  return ctx;
2994
2602
  }
2995
- var Root6 = forwardRef7(function PaywallNoticeRoot({ content, onResolved, classNames, asChild, children, ...rest }, forwardedRef) {
2603
+ var Root6 = forwardRef8(function PaywallNoticeRoot({ content, onResolved, classNames, asChild, children, ...rest }, forwardedRef) {
2996
2604
  const { resolved, refetch } = usePaywallResolver(content);
2997
- const classNamesResolved = useMemo7(() => classNames ?? {}, [classNames]);
2998
- const onResolvedRef = useRef4(onResolved);
2999
- useEffect5(() => {
2605
+ const classNamesResolved = useMemo8(() => classNames ?? {}, [classNames]);
2606
+ const onResolvedRef = useRef3(onResolved);
2607
+ useEffect4(() => {
3000
2608
  onResolvedRef.current = onResolved;
3001
2609
  }, [onResolved]);
3002
- const hasResolvedRef = useRef4(false);
2610
+ const hasResolvedRef = useRef3(false);
3003
2611
  const signalResolved = useCallback5(() => {
3004
2612
  if (hasResolvedRef.current) return;
3005
2613
  hasResolvedRef.current = true;
3006
2614
  onResolvedRef.current?.();
3007
2615
  }, []);
3008
- useEffect5(() => {
2616
+ useEffect4(() => {
3009
2617
  if (resolved) signalResolved();
3010
2618
  }, [resolved, signalResolved]);
3011
- const ctx = useMemo7(
2619
+ const ctx = useMemo8(
3012
2620
  () => ({
3013
2621
  content,
3014
2622
  resolved,
@@ -3019,7 +2627,7 @@ var Root6 = forwardRef7(function PaywallNoticeRoot({ content, onResolved, classN
3019
2627
  [content, resolved, refetch, signalResolved, classNamesResolved]
3020
2628
  );
3021
2629
  const Comp = asChild ? Slot : "div";
3022
- return /* @__PURE__ */ jsx8(PaywallNoticeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx8(
2630
+ return /* @__PURE__ */ jsx9(PaywallNoticeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx9(
3023
2631
  Comp,
3024
2632
  {
3025
2633
  ref: forwardedRef,
@@ -3032,12 +2640,12 @@ var Root6 = forwardRef7(function PaywallNoticeRoot({ content, onResolved, classN
3032
2640
  }
3033
2641
  ) });
3034
2642
  });
3035
- var Heading2 = forwardRef7(function PaywallNoticeHeading({ asChild, children, className, ...rest }, forwardedRef) {
2643
+ var Heading2 = forwardRef8(function PaywallNoticeHeading({ asChild, children, className, ...rest }, forwardedRef) {
3036
2644
  const ctx = usePaywallNoticeCtx("Heading");
3037
2645
  const copy = useCopy();
3038
2646
  const defaultText = ctx.resolved ? copy.paywall.resolvedHeading : ctx.content.kind === "payment_required" ? copy.paywall.paymentRequiredHeading : isTopupGate(ctx.content) ? copy.paywall.topupRequiredHeading : copy.paywall.activationRequiredHeading;
3039
2647
  const Comp = asChild ? Slot : "h2";
3040
- return /* @__PURE__ */ jsx8(
2648
+ return /* @__PURE__ */ jsx9(
3041
2649
  Comp,
3042
2650
  {
3043
2651
  ref: forwardedRef,
@@ -3048,12 +2656,12 @@ var Heading2 = forwardRef7(function PaywallNoticeHeading({ asChild, children, cl
3048
2656
  }
3049
2657
  );
3050
2658
  });
3051
- var Message = forwardRef7(function PaywallNoticeMessage({ asChild, children, className, ...rest }, forwardedRef) {
2659
+ var Message = forwardRef8(function PaywallNoticeMessage({ asChild, children, className, ...rest }, forwardedRef) {
3052
2660
  const ctx = usePaywallNoticeCtx("Message");
3053
2661
  const copy = useCopy();
3054
2662
  const Comp = asChild ? Slot : "p";
3055
2663
  const defaultText = resolvePaywallMessage(ctx.content, copy.paywall);
3056
- return /* @__PURE__ */ jsx8(
2664
+ return /* @__PURE__ */ jsx9(
3057
2665
  Comp,
3058
2666
  {
3059
2667
  ref: forwardedRef,
@@ -3102,14 +2710,14 @@ function resolvePaywallMessage(content, paywallCopy) {
3102
2710
  }
3103
2711
  return content.message ?? "";
3104
2712
  }
3105
- var ProductContext = forwardRef7(function PaywallNoticeProductContext({ asChild, children, className, ...rest }, forwardedRef) {
2713
+ var ProductContext = forwardRef8(function PaywallNoticeProductContext({ asChild, children, className, ...rest }, forwardedRef) {
3106
2714
  const ctx = usePaywallNoticeCtx("ProductContext");
3107
2715
  const copy = useCopy();
3108
2716
  const product = ctx.content.kind === "activation_required" ? ctx.content.productDetails : void 0;
3109
2717
  if (!product?.name) return null;
3110
2718
  const label = interpolate(copy.paywall.productContext, { product: product.name });
3111
2719
  const Comp = asChild ? Slot : "div";
3112
- return /* @__PURE__ */ jsx8(
2720
+ return /* @__PURE__ */ jsx9(
3113
2721
  Comp,
3114
2722
  {
3115
2723
  ref: forwardedRef,
@@ -3120,7 +2728,7 @@ var ProductContext = forwardRef7(function PaywallNoticeProductContext({ asChild,
3120
2728
  }
3121
2729
  );
3122
2730
  });
3123
- var Balance = forwardRef7(function PaywallNoticeBalance({ asChild, children, className, ...rest }, forwardedRef) {
2731
+ var Balance = forwardRef8(function PaywallNoticeBalance({ asChild, children, className, ...rest }, forwardedRef) {
3124
2732
  const ctx = usePaywallNoticeCtx("Balance");
3125
2733
  const copy = useCopy();
3126
2734
  const balance = ctx.content.balance;
@@ -3130,7 +2738,7 @@ var Balance = forwardRef7(function PaywallNoticeBalance({ asChild, children, cla
3130
2738
  required: String(balance.creditsPerUnit ?? 1)
3131
2739
  });
3132
2740
  const Comp = asChild ? Slot : "div";
3133
- return /* @__PURE__ */ jsx8(
2741
+ return /* @__PURE__ */ jsx9(
3134
2742
  Comp,
3135
2743
  {
3136
2744
  ref: forwardedRef,
@@ -3146,27 +2754,28 @@ function Plans({ className, children }) {
3146
2754
  if (ctx.content.kind !== "activation_required") return null;
3147
2755
  if (!ctx.content.product) return null;
3148
2756
  const defaultClass = className ?? ctx.classNames.plans ?? "solvapay-paywall-plans";
3149
- return /* @__PURE__ */ jsx8("div", { "data-solvapay-paywall-plans": "", className: defaultClass, children: /* @__PURE__ */ jsx8(PlanSelector.Root, { productRef: ctx.content.product, filter: hidesFreePlan, children: children ?? /* @__PURE__ */ jsxs4(Fragment5, { children: [
3150
- /* @__PURE__ */ jsx8(PlanSelector.Grid, { children: /* @__PURE__ */ jsxs4(PlanSelector.Card, { children: [
3151
- /* @__PURE__ */ jsx8(PlanSelector.CardBadge, {}),
3152
- /* @__PURE__ */ jsx8(PlanSelector.CardName, {}),
3153
- /* @__PURE__ */ jsx8(PlanSelector.CardPrice, {}),
3154
- /* @__PURE__ */ jsx8(PlanSelector.CardInterval, {})
2757
+ return /* @__PURE__ */ jsx9("div", { "data-solvapay-paywall-plans": "", className: defaultClass, children: /* @__PURE__ */ jsx9(PlanSelector.Root, { productRef: ctx.content.product, filter: hidesFreePlan, children: children ?? /* @__PURE__ */ jsxs4(Fragment6, { children: [
2758
+ /* @__PURE__ */ jsx9(PlanSelector.Grid, { children: /* @__PURE__ */ jsxs4(PlanSelector.Card, { children: [
2759
+ /* @__PURE__ */ jsx9(PlanSelector.CardBadge, {}),
2760
+ /* @__PURE__ */ jsx9(PlanSelector.CardName, {}),
2761
+ /* @__PURE__ */ jsx9(PlanSelector.CardPrice, {}),
2762
+ /* @__PURE__ */ jsx9(PlanSelector.CardInterval, {})
3155
2763
  ] }) }),
3156
- /* @__PURE__ */ jsx8(PlanSelector.Loading, {}),
3157
- /* @__PURE__ */ jsx8(PlanSelector.Error, {})
2764
+ /* @__PURE__ */ jsx9(PlanSelector.Loading, {}),
2765
+ /* @__PURE__ */ jsx9(PlanSelector.Error, {})
3158
2766
  ] }) }) });
3159
2767
  }
3160
2768
  function hidesFreePlan(plan) {
3161
2769
  return plan.requiresPayment !== false;
3162
2770
  }
3163
- var HostedCheckoutLink = forwardRef7(function PaywallNoticeHostedCheckoutLink({ asChild, children, className, ...rest }, forwardedRef) {
2771
+ var HostedCheckoutLink = forwardRef8(function PaywallNoticeHostedCheckoutLink({ asChild, children, className, onClick, ...rest }, forwardedRef) {
3164
2772
  const ctx = usePaywallNoticeCtx("HostedCheckoutLink");
3165
2773
  const copy = useCopy();
2774
+ const handleExternalClick = useExternalLinkClick();
3166
2775
  const href = ctx.content.checkoutUrl;
3167
2776
  if (!href) return null;
3168
2777
  const Comp = asChild ? Slot : "a";
3169
- return /* @__PURE__ */ jsx8(
2778
+ return /* @__PURE__ */ jsx9(
3170
2779
  Comp,
3171
2780
  {
3172
2781
  ref: forwardedRef,
@@ -3175,6 +2784,7 @@ var HostedCheckoutLink = forwardRef7(function PaywallNoticeHostedCheckoutLink({
3175
2784
  rel: "noopener noreferrer",
3176
2785
  "data-solvapay-paywall-hosted-link": "",
3177
2786
  className: className ?? ctx.classNames.hostedLink,
2787
+ onClick: composeEventHandlers(onClick, handleExternalClick),
3178
2788
  ...rest,
3179
2789
  children: children ?? copy.paywall.hostedCheckoutButton
3180
2790
  }
@@ -3184,7 +2794,7 @@ function EmbeddedCheckout({ returnUrl, topupCurrency, className }) {
3184
2794
  const ctx = usePaywallNoticeCtx("EmbeddedCheckout");
3185
2795
  const productRef = ctx.content.product;
3186
2796
  const { plans } = usePlans({ productRef: productRef ?? void 0 });
3187
- const filter = useMemo7(() => buildDefaultCheckoutPlanFilter(plans), [plans]);
2797
+ const filter = useMemo8(() => buildDefaultCheckoutPlanFilter(plans), [plans]);
3188
2798
  if (!productRef) return null;
3189
2799
  const resolvedClassName = className ?? ctx.classNames.embeddedCheckout ?? "solvapay-paywall-embedded-checkout";
3190
2800
  const headingClassName = ctx.classNames.heading ?? "solvapay-paywall-step-heading";
@@ -3202,33 +2812,33 @@ function EmbeddedCheckout({ returnUrl, topupCurrency, className }) {
3202
2812
  },
3203
2813
  className: resolvedClassName,
3204
2814
  children: [
3205
- /* @__PURE__ */ jsx8(CheckoutSteps.StepHeading, { className: headingClassName }),
3206
- /* @__PURE__ */ jsx8(CheckoutSteps.StepMessage, { className: messageClassName }),
2815
+ /* @__PURE__ */ jsx9(CheckoutSteps.StepHeading, { className: headingClassName }),
2816
+ /* @__PURE__ */ jsx9(CheckoutSteps.StepMessage, { className: messageClassName }),
3207
2817
  /* @__PURE__ */ jsxs4(CheckoutSteps.IfStep, { step: "plan", children: [
3208
- /* @__PURE__ */ jsx8(CheckoutSteps.PlanGrid, {}),
3209
- /* @__PURE__ */ jsx8(PlanSelector.Loading, {}),
3210
- /* @__PURE__ */ jsx8(PlanSelector.Error, {}),
3211
- /* @__PURE__ */ jsx8(CheckoutSteps.PlanContinueButton, {})
2818
+ /* @__PURE__ */ jsx9(CheckoutSteps.PlanGrid, {}),
2819
+ /* @__PURE__ */ jsx9(PlanSelector.Loading, {}),
2820
+ /* @__PURE__ */ jsx9(PlanSelector.Error, {}),
2821
+ /* @__PURE__ */ jsx9(CheckoutSteps.PlanContinueButton, {})
3212
2822
  ] }),
3213
2823
  /* @__PURE__ */ jsxs4(CheckoutSteps.IfStep, { step: "amount", children: [
3214
- /* @__PURE__ */ jsx8(CheckoutSteps.BackLink, {}),
3215
- /* @__PURE__ */ jsx8(CheckoutSteps.AmountPicker, {}),
3216
- /* @__PURE__ */ jsx8(CheckoutSteps.AmountContinueButton, {})
2824
+ /* @__PURE__ */ jsx9(CheckoutSteps.BackLink, {}),
2825
+ /* @__PURE__ */ jsx9(CheckoutSteps.AmountPicker, {}),
2826
+ /* @__PURE__ */ jsx9(CheckoutSteps.AmountContinueButton, {})
3217
2827
  ] }),
3218
2828
  /* @__PURE__ */ jsxs4(CheckoutSteps.IfStep, { step: "payment", children: [
3219
- /* @__PURE__ */ jsx8(CheckoutSteps.BackLink, {}),
3220
- /* @__PURE__ */ jsx8(CheckoutSteps.Payment, {})
2829
+ /* @__PURE__ */ jsx9(CheckoutSteps.BackLink, {}),
2830
+ /* @__PURE__ */ jsx9(CheckoutSteps.Payment, {})
3221
2831
  ] }),
3222
- /* @__PURE__ */ jsx8(CheckoutSteps.IfStep, { step: "success", children: /* @__PURE__ */ jsx8(CheckoutSteps.Success, {}) })
2832
+ /* @__PURE__ */ jsx9(CheckoutSteps.IfStep, { step: "success", children: /* @__PURE__ */ jsx9(CheckoutSteps.Success, {}) })
3223
2833
  ]
3224
2834
  }
3225
2835
  );
3226
2836
  }
3227
- var Retry = forwardRef7(function PaywallNoticeRetry({ asChild, children, className, onClick, ...rest }, forwardedRef) {
2837
+ var Retry = forwardRef8(function PaywallNoticeRetry({ asChild, children, className, onClick, ...rest }, forwardedRef) {
3228
2838
  const ctx = usePaywallNoticeCtx("Retry");
3229
2839
  const copy = useCopy();
3230
2840
  const Comp = asChild ? Slot : "button";
3231
- return /* @__PURE__ */ jsx8(
2841
+ return /* @__PURE__ */ jsx9(
3232
2842
  Comp,
3233
2843
  {
3234
2844
  ref: forwardedRef,
@@ -3261,7 +2871,7 @@ function usePaywallNotice() {
3261
2871
  return usePaywallNoticeCtx("usePaywallNotice");
3262
2872
  }
3263
2873
  function usePaywallNoticeOptional() {
3264
- return useContext7(PaywallNoticeContext);
2874
+ return useContext8(PaywallNoticeContext);
3265
2875
  }
3266
2876
 
3267
2877
  export {
@@ -3286,6 +2896,7 @@ export {
3286
2896
  ActivationFlowError2 as ActivationFlowError,
3287
2897
  ActivationFlow,
3288
2898
  useActivationFlow,
2899
+ CancelPlanButton,
3289
2900
  CreditGateRoot2 as CreditGateRoot,
3290
2901
  CreditGateHeading2 as CreditGateHeading,
3291
2902
  CreditGateSubheading2 as CreditGateSubheading,
@@ -3294,8 +2905,6 @@ export {
3294
2905
  CreditGateError2 as CreditGateError,
3295
2906
  CreditGate,
3296
2907
  useCreditGate,
3297
- useAutoRecharge,
3298
- configToAutoRechargeInput,
3299
2908
  AutoRechargeRoot2 as AutoRechargeRoot,
3300
2909
  AutoRechargeLoading2 as AutoRechargeLoading,
3301
2910
  AutoRechargeCard2 as AutoRechargeCard,