@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.
- package/CHANGELOG.md +23 -2
- package/dist/UsageMeter-BhxNHeRM.d.ts +74 -0
- package/dist/UsageMeter-rga6cyfB.d.cts +74 -0
- package/dist/chunk-FWT62B56.js +316 -0
- package/dist/{chunk-LL6AYSTC.js → chunk-VTGYZIE2.js} +1734 -688
- package/dist/{chunk-HQH6KSXJ.js → chunk-X65JBC2A.js} +419 -810
- package/dist/{index-CBWGkBqF.d.ts → index-BJGjKUtC.d.cts} +46 -39
- package/dist/{index-SylJb9Rh.d.cts → index-PsjS_d7V.d.ts} +46 -39
- package/dist/index.cjs +2284 -1580
- package/dist/index.d.cts +110 -25
- package/dist/index.d.ts +110 -25
- package/dist/index.js +388 -46
- package/dist/mcp/index.cjs +6537 -3396
- package/dist/mcp/index.d.cts +637 -158
- package/dist/mcp/index.d.ts +637 -158
- package/dist/mcp/index.js +3421 -1004
- package/dist/mcp/styles.css +1422 -500
- package/dist/primitives/index.cjs +1635 -1031
- package/dist/primitives/index.d.cts +19 -76
- package/dist/primitives/index.d.ts +19 -76
- package/dist/primitives/index.js +3 -3
- package/dist/styles.css +60 -10
- package/dist/{shared-CUl6mTC1.d.ts → useUsage-CMqxEF9d.d.ts} +387 -53
- package/dist/{shared-D0hmT1qU.d.cts → useUsage-CTgRBvFK.d.cts} +387 -53
- package/package.json +5 -5
- package/dist/chunk-QXNNMNCV.js +0 -579
package/dist/index.js
CHANGED
|
@@ -2,36 +2,33 @@ import {
|
|
|
2
2
|
createSessionAuthAdapter
|
|
3
3
|
} from "./chunk-JTW665JR.js";
|
|
4
4
|
import {
|
|
5
|
-
CancelledPlanNotice,
|
|
6
|
-
CurrentPlanCard,
|
|
7
5
|
LaunchCustomerPortalButton,
|
|
8
|
-
UpdatePaymentMethodButton,
|
|
9
6
|
usePaymentMethod
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FWT62B56.js";
|
|
11
8
|
import {
|
|
12
9
|
ActivationFlow,
|
|
13
10
|
AutoRecharge,
|
|
11
|
+
CancelPlanButton,
|
|
14
12
|
CheckoutSteps,
|
|
15
13
|
CreditGate,
|
|
16
14
|
PlanBadge,
|
|
17
15
|
ProductBadge,
|
|
18
16
|
PurchaseGate,
|
|
19
17
|
TopupForm,
|
|
20
|
-
configToAutoRechargeInput,
|
|
21
18
|
useActivationFlow,
|
|
22
|
-
useAutoRecharge,
|
|
23
19
|
useCheckoutSteps,
|
|
24
20
|
useCreditGate,
|
|
25
21
|
usePaywallResolver
|
|
26
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-X65JBC2A.js";
|
|
27
23
|
import {
|
|
28
24
|
AmountPicker,
|
|
29
25
|
BalanceBadge,
|
|
30
|
-
|
|
26
|
+
CancelledPlanNotice,
|
|
31
27
|
CheckoutSummary2 as CheckoutSummary,
|
|
32
28
|
CopyContext,
|
|
33
29
|
CopyProvider,
|
|
34
30
|
DEFAULT_ROUTES,
|
|
31
|
+
ExternalLinkProvider,
|
|
35
32
|
MandateText,
|
|
36
33
|
PaymentForm,
|
|
37
34
|
PaymentFormBusinessDetails,
|
|
@@ -52,12 +49,15 @@ import {
|
|
|
52
49
|
SolvaPayContext,
|
|
53
50
|
SolvaPayProvider,
|
|
54
51
|
Spinner,
|
|
52
|
+
UsageMeter,
|
|
53
|
+
configToAutoRechargeInput,
|
|
55
54
|
confirmPayment,
|
|
56
55
|
createHttpTransport,
|
|
57
56
|
defaultListPlans,
|
|
58
57
|
deriveVariant,
|
|
59
58
|
enCopy,
|
|
60
59
|
filterPurchases,
|
|
60
|
+
formatPaygRate,
|
|
61
61
|
formatPrice,
|
|
62
62
|
getActivePurchases,
|
|
63
63
|
getCancelledPurchasesWithEndDate,
|
|
@@ -77,14 +77,17 @@ import {
|
|
|
77
77
|
useActivation,
|
|
78
78
|
useAmountPicker,
|
|
79
79
|
useAmountPickerCopy,
|
|
80
|
+
useAutoRecharge,
|
|
80
81
|
useBalance,
|
|
81
82
|
useCheckout,
|
|
82
83
|
useCheckoutFlow,
|
|
83
84
|
useCopy,
|
|
84
85
|
useCustomer,
|
|
86
|
+
useExternalLinkClick,
|
|
85
87
|
useLimits,
|
|
86
88
|
useLocale,
|
|
87
89
|
useMerchant,
|
|
90
|
+
useOpenExternal,
|
|
88
91
|
usePaymentForm,
|
|
89
92
|
usePlan,
|
|
90
93
|
usePlans,
|
|
@@ -97,7 +100,7 @@ import {
|
|
|
97
100
|
useTopupAmountSelector,
|
|
98
101
|
useTransport,
|
|
99
102
|
useUsage
|
|
100
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-VTGYZIE2.js";
|
|
101
104
|
import {
|
|
102
105
|
createAnonymousAuthAdapter,
|
|
103
106
|
defaultAuthAdapter,
|
|
@@ -116,9 +119,9 @@ var DefaultTree = ({
|
|
|
116
119
|
/* @__PURE__ */ jsx(PaymentForm.CustomerFields, {}),
|
|
117
120
|
/* @__PURE__ */ jsx(PaymentForm.PaymentElement, {}),
|
|
118
121
|
/* @__PURE__ */ jsx(PaymentForm.Error, {}),
|
|
119
|
-
/* @__PURE__ */ jsx(PaymentForm.MandateText, {}),
|
|
120
122
|
requireTermsAcceptance && /* @__PURE__ */ jsx(PaymentForm.TermsCheckbox, {}),
|
|
121
|
-
/* @__PURE__ */ jsx(PaymentForm.SubmitButton, {})
|
|
123
|
+
/* @__PURE__ */ jsx(PaymentForm.SubmitButton, {}),
|
|
124
|
+
/* @__PURE__ */ jsx(PaymentForm.MandateText, {})
|
|
122
125
|
] });
|
|
123
126
|
function PaidBusinessSlots() {
|
|
124
127
|
const ctx = usePaymentForm();
|
|
@@ -697,21 +700,52 @@ var DefaultTree3 = ({ showCreditEstimate }) => {
|
|
|
697
700
|
] });
|
|
698
701
|
};
|
|
699
702
|
|
|
703
|
+
// src/components/CancelledPlanNotice.tsx
|
|
704
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
705
|
+
var CancelledPlanNotice2 = ({
|
|
706
|
+
onReactivated,
|
|
707
|
+
onError,
|
|
708
|
+
className
|
|
709
|
+
}) => {
|
|
710
|
+
const rootClass = ["solvapay-cancelled-notice", className].filter(Boolean).join(" ");
|
|
711
|
+
return /* @__PURE__ */ jsxs7(
|
|
712
|
+
CancelledPlanNotice.Root,
|
|
713
|
+
{
|
|
714
|
+
onReactivated,
|
|
715
|
+
onError,
|
|
716
|
+
className: rootClass,
|
|
717
|
+
children: [
|
|
718
|
+
/* @__PURE__ */ jsx7(CancelledPlanNotice.Heading, { className: "solvapay-cancelled-notice-heading" }),
|
|
719
|
+
/* @__PURE__ */ jsxs7("div", { className: "solvapay-cancelled-notice-details", children: [
|
|
720
|
+
/* @__PURE__ */ jsx7(CancelledPlanNotice.Expires, { className: "solvapay-cancelled-notice-expires" }),
|
|
721
|
+
/* @__PURE__ */ jsx7(CancelledPlanNotice.DaysRemaining, { className: "solvapay-cancelled-notice-days-remaining" }),
|
|
722
|
+
/* @__PURE__ */ jsx7(CancelledPlanNotice.AccessUntil, { className: "solvapay-cancelled-notice-access-until" })
|
|
723
|
+
] }),
|
|
724
|
+
/* @__PURE__ */ jsxs7("div", { className: "solvapay-cancelled-notice-footer", children: [
|
|
725
|
+
/* @__PURE__ */ jsx7(CancelledPlanNotice.CancelledOn, { className: "solvapay-cancelled-notice-cancelled-on" }),
|
|
726
|
+
/* @__PURE__ */ jsx7(CancelledPlanNotice.Reason, { className: "solvapay-cancelled-notice-reason" })
|
|
727
|
+
] }),
|
|
728
|
+
/* @__PURE__ */ jsx7(CancelledPlanNotice.ReactivateButton, { className: "solvapay-cancelled-notice-reactivate" })
|
|
729
|
+
]
|
|
730
|
+
}
|
|
731
|
+
);
|
|
732
|
+
};
|
|
733
|
+
|
|
700
734
|
// src/components/CreditGate.tsx
|
|
701
|
-
import { Fragment as Fragment7, jsx as
|
|
735
|
+
import { Fragment as Fragment7, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
702
736
|
var AllowedContent = ({ children }) => {
|
|
703
737
|
const ctx = useCreditGate();
|
|
704
738
|
if (ctx.state !== "allowed") return null;
|
|
705
|
-
return /* @__PURE__ */
|
|
739
|
+
return /* @__PURE__ */ jsx8(Fragment7, { children });
|
|
706
740
|
};
|
|
707
741
|
var DefaultBlockedTree = ({ fallback }) => {
|
|
708
742
|
const ctx = useCreditGate();
|
|
709
743
|
if (ctx.state !== "blocked") return null;
|
|
710
|
-
if (fallback) return /* @__PURE__ */
|
|
711
|
-
return /* @__PURE__ */
|
|
712
|
-
/* @__PURE__ */
|
|
713
|
-
/* @__PURE__ */
|
|
714
|
-
/* @__PURE__ */
|
|
744
|
+
if (fallback) return /* @__PURE__ */ jsx8(Fragment7, { children: fallback });
|
|
745
|
+
return /* @__PURE__ */ jsxs8(Fragment7, { children: [
|
|
746
|
+
/* @__PURE__ */ jsx8(CreditGate.Heading, { className: "solvapay-credit-gate-heading" }),
|
|
747
|
+
/* @__PURE__ */ jsx8(CreditGate.Subheading, { className: "solvapay-credit-gate-subheading" }),
|
|
748
|
+
/* @__PURE__ */ jsx8(CreditGate.Topup, {})
|
|
715
749
|
] });
|
|
716
750
|
};
|
|
717
751
|
var CreditGate2 = ({
|
|
@@ -724,7 +758,7 @@ var CreditGate2 = ({
|
|
|
724
758
|
children
|
|
725
759
|
}) => {
|
|
726
760
|
const rootClass = ["solvapay-credit-gate", className].filter(Boolean).join(" ");
|
|
727
|
-
return /* @__PURE__ */
|
|
761
|
+
return /* @__PURE__ */ jsxs8(
|
|
728
762
|
CreditGate.Root,
|
|
729
763
|
{
|
|
730
764
|
minCredits,
|
|
@@ -733,15 +767,320 @@ var CreditGate2 = ({
|
|
|
733
767
|
topupCurrency,
|
|
734
768
|
className: rootClass,
|
|
735
769
|
children: [
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
770
|
+
/* @__PURE__ */ jsx8(AllowedContent, { children }),
|
|
771
|
+
/* @__PURE__ */ jsx8(DefaultBlockedTree, { fallback })
|
|
772
|
+
]
|
|
773
|
+
}
|
|
774
|
+
);
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
// src/components/CurrentPlanCard.tsx
|
|
778
|
+
import { countsUsage } from "@solvapay/core";
|
|
779
|
+
|
|
780
|
+
// src/components/UpdatePaymentMethodButton.tsx
|
|
781
|
+
import { forwardRef } from "react";
|
|
782
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
783
|
+
var UpdatePaymentMethodButton = forwardRef(function UpdatePaymentMethodButton2({ mode = "portal", children, ...rest }, forwardedRef) {
|
|
784
|
+
const copy = useCopy();
|
|
785
|
+
if (mode !== "portal") {
|
|
786
|
+
throw new Error(
|
|
787
|
+
`<UpdatePaymentMethodButton mode="${mode}"> is not implemented yet \u2014 use mode="portal" or omit the prop.`
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
return /* @__PURE__ */ jsx9(
|
|
791
|
+
LaunchCustomerPortalButton,
|
|
792
|
+
{
|
|
793
|
+
ref: forwardedRef,
|
|
794
|
+
"data-solvapay-update-payment-method": "",
|
|
795
|
+
...rest,
|
|
796
|
+
children: children ?? copy.currentPlan.updatePaymentButton
|
|
797
|
+
}
|
|
798
|
+
);
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
// src/components/CurrentPlanCard.tsx
|
|
802
|
+
import { Fragment as Fragment8, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
803
|
+
function PlanTypeLine({
|
|
804
|
+
purchase,
|
|
805
|
+
formatDate,
|
|
806
|
+
className
|
|
807
|
+
}) {
|
|
808
|
+
const copy = useCopy();
|
|
809
|
+
const isMetered = countsUsage(purchase.planSnapshot) || purchase.planSnapshot?.isMetered === true;
|
|
810
|
+
if (purchase.isRecurring) {
|
|
811
|
+
const date2 = formatDate(purchase.nextBillingDate);
|
|
812
|
+
if (!date2) return null;
|
|
813
|
+
return /* @__PURE__ */ jsx10("span", { className, "data-solvapay-current-plan-next-billing": "", children: interpolate(copy.currentPlan.nextBilling, { date: date2 }) });
|
|
814
|
+
}
|
|
815
|
+
if (isMetered) {
|
|
816
|
+
return null;
|
|
817
|
+
}
|
|
818
|
+
const date = formatDate(purchase.endDate);
|
|
819
|
+
return /* @__PURE__ */ jsx10("span", { className, "data-solvapay-current-plan-expires": "", children: date ? interpolate(copy.currentPlan.expiresOn, { date }) : copy.currentPlan.validIndefinitely });
|
|
820
|
+
}
|
|
821
|
+
function asPaygPlan(plan) {
|
|
822
|
+
if (!plan) return null;
|
|
823
|
+
return {
|
|
824
|
+
reference: plan.reference ?? void 0,
|
|
825
|
+
name: "name" in plan ? plan.name : void 0,
|
|
826
|
+
price: plan.price ?? void 0,
|
|
827
|
+
currency: plan.currency ?? void 0,
|
|
828
|
+
requiresPayment: "requiresPayment" in plan ? plan.requiresPayment ?? void 0 : void 0,
|
|
829
|
+
// Snapshot `options` are generated as `{ [key: string]: unknown }[]`;
|
|
830
|
+
// formatPaygRate reads them through `@solvapay/core` as PricingOptionLike.
|
|
831
|
+
options: plan.options
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
function resolvePriceLabel({
|
|
835
|
+
isUsageBased,
|
|
836
|
+
snapshot,
|
|
837
|
+
catalogPlan,
|
|
838
|
+
amount,
|
|
839
|
+
currency,
|
|
840
|
+
intervalLabel,
|
|
841
|
+
locale,
|
|
842
|
+
balance
|
|
843
|
+
}) {
|
|
844
|
+
if (isUsageBased) {
|
|
845
|
+
const snapshotPlan = asPaygPlan(snapshot);
|
|
846
|
+
const fromSnapshot = snapshotPlan ? formatPaygRate(snapshotPlan, locale, balance) : null;
|
|
847
|
+
if (fromSnapshot) return fromSnapshot;
|
|
848
|
+
const catalogAsPlan = asPaygPlan(catalogPlan);
|
|
849
|
+
if (catalogAsPlan) {
|
|
850
|
+
const fromCatalog = formatPaygRate(catalogAsPlan, locale, balance);
|
|
851
|
+
if (fromCatalog) return fromCatalog;
|
|
852
|
+
}
|
|
853
|
+
return null;
|
|
854
|
+
}
|
|
855
|
+
return formatPrice(amount, currency, {
|
|
856
|
+
interval: intervalLabel
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
function PlanField({
|
|
860
|
+
label,
|
|
861
|
+
labelClassName,
|
|
862
|
+
children
|
|
863
|
+
}) {
|
|
864
|
+
if (!label) return /* @__PURE__ */ jsx10(Fragment8, { children });
|
|
865
|
+
return /* @__PURE__ */ jsxs9("div", { className: "solvapay-current-plan-field", "data-solvapay-current-plan-field": "", children: [
|
|
866
|
+
/* @__PURE__ */ jsx10(
|
|
867
|
+
"span",
|
|
868
|
+
{
|
|
869
|
+
className: labelClassName ?? "solvapay-current-plan-field-label",
|
|
870
|
+
"data-solvapay-current-plan-field-label": "",
|
|
871
|
+
children: label
|
|
872
|
+
}
|
|
873
|
+
),
|
|
874
|
+
children
|
|
875
|
+
] });
|
|
876
|
+
}
|
|
877
|
+
function PaymentMethodLine({
|
|
878
|
+
paymentMethod,
|
|
879
|
+
className
|
|
880
|
+
}) {
|
|
881
|
+
const copy = useCopy();
|
|
882
|
+
if (paymentMethod.kind === "none") {
|
|
883
|
+
return /* @__PURE__ */ jsx10("span", { className, "data-solvapay-current-plan-payment-method": "none", children: copy.currentPlan.noPaymentMethod });
|
|
884
|
+
}
|
|
885
|
+
const brandDisplay = paymentMethod.brand.charAt(0).toUpperCase() + paymentMethod.brand.slice(1);
|
|
886
|
+
const label = interpolate(copy.currentPlan.paymentMethod, {
|
|
887
|
+
brand: brandDisplay,
|
|
888
|
+
last4: paymentMethod.last4
|
|
889
|
+
});
|
|
890
|
+
const expires = interpolate(copy.currentPlan.paymentMethodExpires, {
|
|
891
|
+
month: String(paymentMethod.expMonth).padStart(2, "0"),
|
|
892
|
+
year: paymentMethod.expYear
|
|
893
|
+
});
|
|
894
|
+
return /* @__PURE__ */ jsxs9("span", { className, "data-solvapay-current-plan-payment-method": "card", children: [
|
|
895
|
+
label,
|
|
896
|
+
", ",
|
|
897
|
+
expires
|
|
898
|
+
] });
|
|
899
|
+
}
|
|
900
|
+
var CurrentPlanCard = ({
|
|
901
|
+
hidePaymentMethod,
|
|
902
|
+
hideCancelButton,
|
|
903
|
+
hideCancelledNotice,
|
|
904
|
+
hideUpdatePaymentButton,
|
|
905
|
+
hideUsageMeter,
|
|
906
|
+
hideHeading,
|
|
907
|
+
hideProductContext,
|
|
908
|
+
showStartDate,
|
|
909
|
+
showReference,
|
|
910
|
+
showFieldLabels,
|
|
911
|
+
plans,
|
|
912
|
+
classNames: overrides,
|
|
913
|
+
className
|
|
914
|
+
}) => {
|
|
915
|
+
const copy = useCopy();
|
|
916
|
+
const locale = useLocale();
|
|
917
|
+
const balance = useBalance();
|
|
918
|
+
const { activePurchase } = usePurchase();
|
|
919
|
+
const { formatDate, shouldShowCancelledNotice } = usePurchaseStatus();
|
|
920
|
+
const { paymentMethod } = usePaymentMethod();
|
|
921
|
+
if (!activePurchase) return null;
|
|
922
|
+
const snapshot = activePurchase.planSnapshot;
|
|
923
|
+
const catalogPlan = plans?.find(
|
|
924
|
+
(p) => p.reference === (snapshot?.reference ?? activePurchase.planRef)
|
|
925
|
+
);
|
|
926
|
+
const isUsageBased = countsUsage(snapshot) || snapshot?.isMetered === true || countsUsage(catalogPlan);
|
|
927
|
+
const planType = activePurchase.isRecurring ? "recurring" : isUsageBased ? "usage-based" : "one-time";
|
|
928
|
+
const amount = activePurchase.originalAmount ?? activePurchase.amount ?? 0;
|
|
929
|
+
const currency = activePurchase.currency ?? "usd";
|
|
930
|
+
const rawCycle = activePurchase.billingCycle;
|
|
931
|
+
const cycleKey = rawCycle && rawCycle in copy.currentPlan.cycleUnit ? rawCycle : void 0;
|
|
932
|
+
const intervalLabel = cycleKey ? copy.currentPlan.cycleUnit[cycleKey] ?? rawCycle : rawCycle;
|
|
933
|
+
const priceLabel = resolvePriceLabel({
|
|
934
|
+
isUsageBased,
|
|
935
|
+
snapshot,
|
|
936
|
+
catalogPlan,
|
|
937
|
+
amount,
|
|
938
|
+
currency,
|
|
939
|
+
intervalLabel,
|
|
940
|
+
locale,
|
|
941
|
+
balance
|
|
942
|
+
});
|
|
943
|
+
const planName = activePurchase.planSnapshot?.name ?? activePurchase.productName;
|
|
944
|
+
const productContext = activePurchase.productName && activePurchase.productName !== planName ? activePurchase.productName : null;
|
|
945
|
+
const rootClass = ["solvapay-current-plan-card", overrides?.root, className].filter(Boolean).join(" ");
|
|
946
|
+
const shouldShowPaymentMethod = !hidePaymentMethod && paymentMethod !== null;
|
|
947
|
+
const showCancelButton = !hideCancelButton && !activePurchase.cancelledAt && !shouldShowCancelledNotice;
|
|
948
|
+
const showActions = !hideUpdatePaymentButton || showCancelButton;
|
|
949
|
+
return /* @__PURE__ */ jsxs9(
|
|
950
|
+
"section",
|
|
951
|
+
{
|
|
952
|
+
className: rootClass,
|
|
953
|
+
"data-solvapay-current-plan-card": "",
|
|
954
|
+
"data-plan-type": planType,
|
|
955
|
+
"data-solvapay-current-plan-ref": activePurchase.planRef ?? void 0,
|
|
956
|
+
children: [
|
|
957
|
+
!hideHeading && /* @__PURE__ */ jsx10(
|
|
958
|
+
"h2",
|
|
959
|
+
{
|
|
960
|
+
className: overrides?.heading ?? "solvapay-current-plan-heading",
|
|
961
|
+
"data-solvapay-current-plan-heading": "",
|
|
962
|
+
children: copy.currentPlan.heading
|
|
963
|
+
}
|
|
964
|
+
),
|
|
965
|
+
productContext && !hideProductContext && /* @__PURE__ */ jsx10(
|
|
966
|
+
"p",
|
|
967
|
+
{
|
|
968
|
+
className: overrides?.productContext ?? "solvapay-current-plan-product-context",
|
|
969
|
+
"data-solvapay-current-plan-product-context": "",
|
|
970
|
+
children: productContext
|
|
971
|
+
}
|
|
972
|
+
),
|
|
973
|
+
/* @__PURE__ */ jsx10(
|
|
974
|
+
"h3",
|
|
975
|
+
{
|
|
976
|
+
className: overrides?.planName ?? "solvapay-current-plan-name",
|
|
977
|
+
"data-solvapay-current-plan-name": "",
|
|
978
|
+
children: planName
|
|
979
|
+
}
|
|
980
|
+
),
|
|
981
|
+
priceLabel ? /* @__PURE__ */ jsx10(
|
|
982
|
+
PlanField,
|
|
983
|
+
{
|
|
984
|
+
label: showFieldLabels ? isUsageBased ? copy.currentPlan.rateFieldLabel : copy.currentPlan.priceFieldLabel : null,
|
|
985
|
+
labelClassName: overrides?.fieldLabel,
|
|
986
|
+
children: /* @__PURE__ */ jsx10(
|
|
987
|
+
"p",
|
|
988
|
+
{
|
|
989
|
+
className: overrides?.price ?? "solvapay-current-plan-price",
|
|
990
|
+
"data-solvapay-current-plan-price": "",
|
|
991
|
+
children: priceLabel
|
|
992
|
+
}
|
|
993
|
+
)
|
|
994
|
+
}
|
|
995
|
+
) : null,
|
|
996
|
+
/* @__PURE__ */ jsx10(
|
|
997
|
+
PlanTypeLine,
|
|
998
|
+
{
|
|
999
|
+
purchase: activePurchase,
|
|
1000
|
+
formatDate,
|
|
1001
|
+
className: overrides?.dateLine ?? "solvapay-current-plan-date-line"
|
|
1002
|
+
}
|
|
1003
|
+
),
|
|
1004
|
+
isUsageBased && activePurchase.isRecurring && !hideUsageMeter && /* @__PURE__ */ jsx10(
|
|
1005
|
+
"section",
|
|
1006
|
+
{
|
|
1007
|
+
className: overrides?.usageMeter ?? "solvapay-current-plan-usage-meter",
|
|
1008
|
+
"data-solvapay-current-plan-usage-meter": "",
|
|
1009
|
+
children: /* @__PURE__ */ jsxs9(UsageMeter.Root, { children: [
|
|
1010
|
+
/* @__PURE__ */ jsx10(UsageMeter.Label, {}),
|
|
1011
|
+
/* @__PURE__ */ jsx10(UsageMeter.Bar, {}),
|
|
1012
|
+
/* @__PURE__ */ jsx10(UsageMeter.Percentage, {}),
|
|
1013
|
+
/* @__PURE__ */ jsx10(UsageMeter.ResetsIn, {}),
|
|
1014
|
+
/* @__PURE__ */ jsx10(UsageMeter.Loading, {})
|
|
1015
|
+
] })
|
|
1016
|
+
}
|
|
1017
|
+
),
|
|
1018
|
+
isUsageBased && /* @__PURE__ */ jsx10(
|
|
1019
|
+
PlanField,
|
|
1020
|
+
{
|
|
1021
|
+
label: showFieldLabels ? copy.currentPlan.balanceFieldLabel : null,
|
|
1022
|
+
labelClassName: overrides?.fieldLabel,
|
|
1023
|
+
children: /* @__PURE__ */ jsx10(
|
|
1024
|
+
"p",
|
|
1025
|
+
{
|
|
1026
|
+
className: overrides?.balanceLine ?? "solvapay-current-plan-balance-line",
|
|
1027
|
+
"data-solvapay-current-plan-balance-line": "",
|
|
1028
|
+
children: /* @__PURE__ */ jsx10(BalanceBadge, {})
|
|
1029
|
+
}
|
|
1030
|
+
)
|
|
1031
|
+
}
|
|
1032
|
+
),
|
|
1033
|
+
showStartDate && (() => {
|
|
1034
|
+
const started = formatDate(activePurchase.startDate);
|
|
1035
|
+
if (!started) return null;
|
|
1036
|
+
return /* @__PURE__ */ jsx10(
|
|
1037
|
+
"span",
|
|
1038
|
+
{
|
|
1039
|
+
className: overrides?.startedLine ?? "solvapay-current-plan-started-line",
|
|
1040
|
+
"data-solvapay-current-plan-started-line": "",
|
|
1041
|
+
children: interpolate(copy.currentPlan.startedOn, { date: started })
|
|
1042
|
+
}
|
|
1043
|
+
);
|
|
1044
|
+
})(),
|
|
1045
|
+
showReference && activePurchase.reference && /* @__PURE__ */ jsx10(
|
|
1046
|
+
"span",
|
|
1047
|
+
{
|
|
1048
|
+
className: overrides?.reference ?? "solvapay-current-plan-reference",
|
|
1049
|
+
"data-solvapay-current-plan-reference": "",
|
|
1050
|
+
children: activePurchase.reference
|
|
1051
|
+
}
|
|
1052
|
+
),
|
|
1053
|
+
shouldShowPaymentMethod && paymentMethod && /* @__PURE__ */ jsx10(
|
|
1054
|
+
PaymentMethodLine,
|
|
1055
|
+
{
|
|
1056
|
+
paymentMethod,
|
|
1057
|
+
className: overrides?.paymentMethod ?? "solvapay-current-plan-payment-method"
|
|
1058
|
+
}
|
|
1059
|
+
),
|
|
1060
|
+
showActions && /* @__PURE__ */ jsxs9(
|
|
1061
|
+
"section",
|
|
1062
|
+
{
|
|
1063
|
+
className: overrides?.actions ?? "solvapay-current-plan-actions",
|
|
1064
|
+
"data-solvapay-current-plan-actions": "",
|
|
1065
|
+
children: [
|
|
1066
|
+
!hideUpdatePaymentButton && /* @__PURE__ */ jsx10(UpdatePaymentMethodButton, {}),
|
|
1067
|
+
showCancelButton && /* @__PURE__ */ jsx10(CancelPlanButton, {})
|
|
1068
|
+
]
|
|
1069
|
+
}
|
|
1070
|
+
),
|
|
1071
|
+
shouldShowCancelledNotice && !hideCancelledNotice && /* @__PURE__ */ jsx10(
|
|
1072
|
+
CancelledPlanNotice2,
|
|
1073
|
+
{
|
|
1074
|
+
className: overrides?.cancelledNotice ?? "solvapay-current-plan-cancelled-notice"
|
|
1075
|
+
}
|
|
1076
|
+
)
|
|
738
1077
|
]
|
|
739
1078
|
}
|
|
740
1079
|
);
|
|
741
1080
|
};
|
|
742
1081
|
|
|
743
1082
|
// src/components/AutoRecharge.tsx
|
|
744
|
-
import { jsx as
|
|
1083
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
745
1084
|
function AutoRecharge2({
|
|
746
1085
|
currency = "USD",
|
|
747
1086
|
defaultThresholdAmountMajor,
|
|
@@ -754,7 +1093,7 @@ function AutoRecharge2({
|
|
|
754
1093
|
className
|
|
755
1094
|
}) {
|
|
756
1095
|
const rootClass = ["solvapay-auto-recharge", className].filter(Boolean).join(" ");
|
|
757
|
-
return /* @__PURE__ */
|
|
1096
|
+
return /* @__PURE__ */ jsxs10(
|
|
758
1097
|
AutoRecharge.Root,
|
|
759
1098
|
{
|
|
760
1099
|
currency,
|
|
@@ -767,30 +1106,30 @@ function AutoRecharge2({
|
|
|
767
1106
|
onPendingConfig,
|
|
768
1107
|
className: rootClass,
|
|
769
1108
|
children: [
|
|
770
|
-
/* @__PURE__ */
|
|
771
|
-
/* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
/* @__PURE__ */
|
|
777
|
-
/* @__PURE__ */
|
|
1109
|
+
/* @__PURE__ */ jsx11(AutoRecharge.Loading, { className: "solvapay-auto-recharge-loading" }),
|
|
1110
|
+
/* @__PURE__ */ jsxs10(AutoRecharge.Card, { className: "solvapay-auto-recharge-card", children: [
|
|
1111
|
+
/* @__PURE__ */ jsx11(AutoRecharge.CardHeading, { className: "solvapay-auto-recharge-card-heading" }),
|
|
1112
|
+
/* @__PURE__ */ jsx11(AutoRecharge.CardSummary, { className: "solvapay-auto-recharge-card-summary" }),
|
|
1113
|
+
/* @__PURE__ */ jsx11(AutoRecharge.StatusMessage, { className: "solvapay-auto-recharge-status-message" }),
|
|
1114
|
+
/* @__PURE__ */ jsx11(AutoRecharge.MonthlySpend, { className: "solvapay-auto-recharge-monthly-spend" }),
|
|
1115
|
+
/* @__PURE__ */ jsx11(AutoRecharge.Status, { className: "solvapay-auto-recharge-status" }),
|
|
1116
|
+
/* @__PURE__ */ jsx11(AutoRecharge.Trigger, { className: "solvapay-auto-recharge-trigger" })
|
|
778
1117
|
] }),
|
|
779
|
-
/* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
/* @__PURE__ */
|
|
785
|
-
/* @__PURE__ */
|
|
786
|
-
/* @__PURE__ */
|
|
787
|
-
/* @__PURE__ */
|
|
788
|
-
/* @__PURE__ */
|
|
1118
|
+
/* @__PURE__ */ jsx11(AutoRecharge.Error, { className: "solvapay-auto-recharge-error" }),
|
|
1119
|
+
/* @__PURE__ */ jsxs10(AutoRecharge.Content, { className: "solvapay-auto-recharge-content", children: [
|
|
1120
|
+
/* @__PURE__ */ jsx11(AutoRecharge.Title, { className: "solvapay-auto-recharge-title" }),
|
|
1121
|
+
/* @__PURE__ */ jsx11(AutoRecharge.EnableQuestion, { className: "solvapay-auto-recharge-question" }),
|
|
1122
|
+
/* @__PURE__ */ jsx11(AutoRecharge.EnableRow, { className: "solvapay-auto-recharge-enable-row" }),
|
|
1123
|
+
/* @__PURE__ */ jsxs10(AutoRecharge.Fields, { className: "solvapay-auto-recharge-fields", children: [
|
|
1124
|
+
/* @__PURE__ */ jsx11(AutoRecharge.ThresholdField, {}),
|
|
1125
|
+
/* @__PURE__ */ jsx11(AutoRecharge.TopupField, { className: "solvapay-auto-recharge-topup-field" }),
|
|
1126
|
+
/* @__PURE__ */ jsx11(AutoRecharge.MaxMonthlySpendField, {}),
|
|
1127
|
+
/* @__PURE__ */ jsx11(AutoRecharge.ValidationError, { className: "solvapay-auto-recharge-validation-error" })
|
|
789
1128
|
] }),
|
|
790
|
-
/* @__PURE__ */
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
/* @__PURE__ */
|
|
1129
|
+
/* @__PURE__ */ jsx11(AutoRecharge.Setup, {}),
|
|
1130
|
+
/* @__PURE__ */ jsxs10(AutoRecharge.Actions, { className: "solvapay-auto-recharge-actions", children: [
|
|
1131
|
+
/* @__PURE__ */ jsx11(AutoRecharge.CancelButton, { className: "solvapay-auto-recharge-cancel" }),
|
|
1132
|
+
/* @__PURE__ */ jsx11(AutoRecharge.SaveButton, { className: "solvapay-auto-recharge-save" })
|
|
794
1133
|
] })
|
|
795
1134
|
] })
|
|
796
1135
|
]
|
|
@@ -865,7 +1204,7 @@ export {
|
|
|
865
1204
|
AutoRecharge2 as AutoRecharge,
|
|
866
1205
|
BalanceBadge,
|
|
867
1206
|
CancelPlanButton,
|
|
868
|
-
CancelledPlanNotice,
|
|
1207
|
+
CancelledPlanNotice2 as CancelledPlanNotice,
|
|
869
1208
|
CheckoutLayout,
|
|
870
1209
|
CheckoutSteps,
|
|
871
1210
|
CheckoutSummary,
|
|
@@ -874,6 +1213,7 @@ export {
|
|
|
874
1213
|
CreditGate2 as CreditGate,
|
|
875
1214
|
CurrentPlanCard,
|
|
876
1215
|
DEFAULT_ROUTES,
|
|
1216
|
+
ExternalLinkProvider,
|
|
877
1217
|
LaunchCustomerPortalButton,
|
|
878
1218
|
MandateText,
|
|
879
1219
|
PaymentForm2 as PaymentForm,
|
|
@@ -925,9 +1265,11 @@ export {
|
|
|
925
1265
|
useCheckoutSteps as useCheckoutStepsContext,
|
|
926
1266
|
useCopy,
|
|
927
1267
|
useCustomer,
|
|
1268
|
+
useExternalLinkClick,
|
|
928
1269
|
useLimits,
|
|
929
1270
|
useLocale,
|
|
930
1271
|
useMerchant,
|
|
1272
|
+
useOpenExternal,
|
|
931
1273
|
usePaymentForm,
|
|
932
1274
|
usePaymentMethod,
|
|
933
1275
|
usePaywallResolver,
|