@cedros/pay-react 1.1.23 → 1.1.25
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/dist/{AISettingsSection-DAztmwnN.js → AISettingsSection-BvSSiK2G.js} +1 -1
- package/dist/{AISettingsSection-DpMIk431.mjs → AISettingsSection-Dg1kazTI.mjs} +2 -2
- package/dist/{AutosaveIndicator-BRCqAWqP.mjs → AutosaveIndicator-BHfkV59p.mjs} +1 -1
- package/dist/{AutosaveIndicator-BnQkKxzr.js → AutosaveIndicator-D2l7U8R1.js} +1 -1
- package/dist/CedrosContext-C2RjHLaQ.js +6 -0
- package/dist/{CedrosContext-BlArEF7k.mjs → CedrosContext-CY6zvjvJ.mjs} +768 -617
- package/dist/ComplianceSection-BSE2f3Wo.mjs +534 -0
- package/dist/ComplianceSection-D6ETKG6b.js +1 -0
- package/dist/{CryptoButton-CREryx1l.mjs → CryptoButton-BV9owVe2.mjs} +51 -51
- package/dist/{CryptoButton-C1AAOOfj.js → CryptoButton-DpiCnyXE.js} +1 -1
- package/dist/{FAQSection-yw64HLy3.js → FAQSection-6nGI0FK9.js} +1 -1
- package/dist/{FAQSection-Ruzs7a-0.mjs → FAQSection-uZG5V3pJ.mjs} +1 -1
- package/dist/{MessagingSection-Dp_SaXsv.js → MessagingSection-DrXb578q.js} +1 -1
- package/dist/{MessagingSection-BLRjfBQT.mjs → MessagingSection-M0lj5yo4.mjs} +2 -2
- package/dist/{OrdersSection-l-MtP9EN.mjs → OrdersSection-DteItv_O.mjs} +6 -6
- package/dist/{OrdersSection-C2dyWqrR.js → OrdersSection-_-rIw6XW.js} +1 -1
- package/dist/{PaymentSettingsSection-Bbq93UtC.mjs → PaymentSettingsSection-CdtdLFTg.mjs} +1 -1
- package/dist/{PaymentSettingsSection-C5bhLgU7.js → PaymentSettingsSection-enTbUI95.js} +1 -1
- package/dist/SettingsSection-DUTEd6uV.js +1 -0
- package/dist/{SettingsSection-DorqCFXE.mjs → SettingsSection-mcT4LEhO.mjs} +19 -13
- package/dist/{SingleCategorySettings-BAND8Zkw.mjs → SingleCategorySettings-BvHBVfSe.mjs} +4 -4
- package/dist/{SingleCategorySettings-Cg-zuJfr.js → SingleCategorySettings-D2LVM5mn.js} +1 -1
- package/dist/{StorefrontSection-FSOxBclu.mjs → StorefrontSection-BqQ36JIS.mjs} +2 -2
- package/dist/{StorefrontSection-QZPEZ6Lz.js → StorefrontSection-Du7hV2Gc.js} +1 -1
- package/dist/{SubscriptionsSection-C4TDXCX2.mjs → SubscriptionsSection-BYiCBwKZ.mjs} +7 -7
- package/dist/{SubscriptionsSection-DYr99VzB.js → SubscriptionsSection-C4BRN1dP.js} +1 -1
- package/dist/Token22Section-0c22NM5G.js +1 -0
- package/dist/Token22Section-BHvOhz5d.mjs +2260 -0
- package/dist/{WalletManager-Bwk3rgr1.js → WalletManager-B3UdQ5pQ.js} +1 -1
- package/dist/{WalletManager-peBN6RDH.mjs → WalletManager-BIwH8Dw_.mjs} +1 -1
- package/dist/{bn-CHdpZHQm.mjs → bn-Bv2sKQMU.mjs} +1 -1
- package/dist/{bn-RbgIlcHc.js → bn-CHyy7EgJ.js} +1 -1
- package/dist/{configApi-Ch0Rr7TD.mjs → configApi-6XhAJGKX.mjs} +31 -0
- package/dist/{configApi-CxEbCAgG.js → configApi-DkduMQg1.js} +1 -1
- package/dist/crypto-only.js +1 -1
- package/dist/crypto-only.mjs +85 -83
- package/dist/{index-CKNB7XsA.mjs → index-BkDimQDF.mjs} +7988 -7323
- package/dist/index-C7MWL6O8.js +84 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +42 -40
- package/dist/{sections-Cklkxd85.js → sections-5jO2aHAo.js} +1 -1
- package/dist/sections-By4H1baL.mjs +9 -0
- package/dist/src/admin/plugin.d.ts.map +1 -1
- package/dist/src/components/ComplianceGatePage.d.ts +38 -0
- package/dist/src/components/ComplianceGatePage.d.ts.map +1 -0
- package/dist/src/components/SubscribeButton.d.ts +1 -5
- package/dist/src/components/SubscribeButton.d.ts.map +1 -1
- package/dist/src/components/admin/AdminAuthManager.d.ts +7 -3
- package/dist/src/components/admin/AdminAuthManager.d.ts.map +1 -1
- package/dist/src/components/admin/AssetClassesTab.d.ts.map +1 -1
- package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +1 -1
- package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -1
- package/dist/src/components/admin/ComplianceSanctionsApi.d.ts +3 -0
- package/dist/src/components/admin/ComplianceSanctionsApi.d.ts.map +1 -0
- package/dist/src/components/admin/ComplianceSection.d.ts +3 -0
- package/dist/src/components/admin/ComplianceSection.d.ts.map +1 -0
- package/dist/src/components/admin/GiftCardAnalytics.d.ts +3 -0
- package/dist/src/components/admin/GiftCardAnalytics.d.ts.map +1 -0
- package/dist/src/components/admin/GiftCardManager.d.ts +3 -0
- package/dist/src/components/admin/GiftCardManager.d.ts.map +1 -0
- package/dist/src/components/admin/LiquidityPoolTab.d.ts.map +1 -1
- package/dist/src/components/admin/PoolManagementView.d.ts +14 -0
- package/dist/src/components/admin/PoolManagementView.d.ts.map +1 -0
- package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
- package/dist/src/components/admin/RefundsSection.d.ts.map +1 -1
- package/dist/src/components/admin/SettingsSection.d.ts.map +1 -1
- package/dist/src/components/admin/Token22Section.d.ts.map +1 -1
- package/dist/src/components/admin/complianceTypes.d.ts +60 -0
- package/dist/src/components/admin/complianceTypes.d.ts.map +1 -0
- package/dist/src/components/admin/configApi.d.ts.map +1 -1
- package/dist/src/components/admin/icons.d.ts +1 -0
- package/dist/src/components/admin/icons.d.ts.map +1 -1
- package/dist/src/components/admin/useAdminAuth.d.ts +1 -1
- package/dist/src/components/admin/useAdminAuth.d.ts.map +1 -1
- package/dist/src/context/CedrosContext.d.ts.map +1 -1
- package/dist/src/ecommerce/components/catalog/TokenDisplay.d.ts +36 -0
- package/dist/src/ecommerce/components/catalog/TokenDisplay.d.ts.map +1 -0
- package/dist/src/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -1
- package/dist/src/ecommerce/components/checkout/SendAsGiftSection.d.ts +15 -0
- package/dist/src/ecommerce/components/checkout/SendAsGiftSection.d.ts.map +1 -0
- package/dist/src/ecommerce/components/gift-cards/GiftCardBalanceChecker.d.ts +19 -0
- package/dist/src/ecommerce/components/gift-cards/GiftCardBalanceChecker.d.ts.map +1 -0
- package/dist/src/ecommerce/components/orders/MyRedemptionsPage.d.ts +13 -0
- package/dist/src/ecommerce/components/orders/MyRedemptionsPage.d.ts.map +1 -0
- package/dist/src/ecommerce/components/orders/MyTokensPage.d.ts +15 -0
- package/dist/src/ecommerce/components/orders/MyTokensPage.d.ts.map +1 -0
- package/dist/src/ecommerce/components/orders/OrderDetails.d.ts.map +1 -1
- package/dist/src/ecommerce/hooks/useCartInventory.d.ts.map +1 -1
- package/dist/src/ecommerce/index.d.ts +10 -0
- package/dist/src/ecommerce/index.d.ts.map +1 -1
- package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts +3 -0
- package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -1
- package/dist/src/ecommerce/state/checkout/useCheckout.d.ts.map +1 -1
- package/dist/src/ecommerce/types.d.ts +6 -0
- package/dist/src/ecommerce/types.d.ts.map +1 -1
- package/dist/src/ecommerce/utils/cartItemMetadata.d.ts.map +1 -1
- package/dist/src/hooks/useComplianceCheck.d.ts +30 -0
- package/dist/src/hooks/useComplianceCheck.d.ts.map +1 -0
- package/dist/src/hooks/useSubscriptionManagement.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/managers/CreditsManager.d.ts.map +1 -1
- package/dist/src/managers/ManagerCache.d.ts +2 -2
- package/dist/src/managers/ManagerCache.d.ts.map +1 -1
- package/dist/src/managers/StripeManager.d.ts +7 -1
- package/dist/src/managers/StripeManager.d.ts.map +1 -1
- package/dist/src/managers/SubscriptionChangeManager.d.ts.map +1 -1
- package/dist/src/managers/SubscriptionManager.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +14 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/subscription.d.ts +21 -33
- package/dist/src/types/subscription.d.ts.map +1 -1
- package/dist/src/utils/exponentialBackoff.d.ts +22 -0
- package/dist/src/utils/exponentialBackoff.d.ts.map +1 -1
- package/dist/stripe-only.js +1 -1
- package/dist/stripe-only.mjs +2 -2
- package/dist/styles-BT4bhFey.js +1 -0
- package/dist/{styles-2VMpwuaI.mjs → styles-D4SQkuV3.mjs} +647 -650
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.mjs +1 -1
- package/dist/{walletPool-DgQsh7Se.mjs → walletPool-DE-t1wSW.mjs} +1 -1
- package/dist/{walletPool-Ddv33tej.js → walletPool-IS7R3MR1.js} +1 -1
- package/package.json +6 -1
- package/dist/CedrosContext-7dwmEeUY.js +0 -6
- package/dist/SettingsSection-D_pKPRrP.js +0 -1
- package/dist/Token22Section-Cmn2lKcd.mjs +0 -1685
- package/dist/Token22Section-D3nnUyim.js +0 -1
- package/dist/index-vEe2Y39x.js +0 -84
- package/dist/sections-Dt6vxDU4.mjs +0 -8
- package/dist/styles-21F1-oqx.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as j, P as ke, u as re, o as be,
|
|
1
|
+
import { i as j, P as ke, u as re, o as be, j as V, m as pe } from "./CedrosContext-CY6zvjvJ.mjs";
|
|
2
2
|
import { jsxs as S, jsx as f, Fragment as me } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import U, { useState as Q, useRef as X, useCallback as R, useMemo as W, useEffect as te } from "react";
|
|
4
4
|
function xt(e) {
|
|
5
5
|
return !e || !e.coupon_codes ? [] : e.coupon_codes.split(",").map((t) => t.trim()).filter((t) => t.length > 0);
|
|
6
6
|
}
|
|
@@ -16,8 +16,8 @@ function _t(e, t) {
|
|
|
16
16
|
let r = e, n = 0;
|
|
17
17
|
for (const s of t)
|
|
18
18
|
if (s.discountType === "percentage") {
|
|
19
|
-
const
|
|
20
|
-
r = r *
|
|
19
|
+
const l = 1 - s.discountValue / 100;
|
|
20
|
+
r = r * l;
|
|
21
21
|
} else s.discountType === "fixed" && (n += s.discountValue);
|
|
22
22
|
return r = r - n, r < 0 && (r = 0), Math.ceil(r * 100) / 100;
|
|
23
23
|
}
|
|
@@ -72,17 +72,17 @@ function Ue(e) {
|
|
|
72
72
|
function Oe(e) {
|
|
73
73
|
return we.get(e) || null;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function We(e, t) {
|
|
76
76
|
we.set(e, t);
|
|
77
77
|
const r = () => {
|
|
78
78
|
we.delete(e), Ue(e);
|
|
79
79
|
};
|
|
80
80
|
return t.then(r, r), t;
|
|
81
81
|
}
|
|
82
|
-
async function
|
|
83
|
-
const { windowMs: n = Se, throwOnDuplicate: s = !0 } = r,
|
|
84
|
-
if (
|
|
85
|
-
return j().debug(`[Deduplication] Reusing in-flight request: ${e}`),
|
|
82
|
+
async function Fe(e, t, r = {}) {
|
|
83
|
+
const { windowMs: n = Se, throwOnDuplicate: s = !0 } = r, l = Oe(e);
|
|
84
|
+
if (l)
|
|
85
|
+
return j().debug(`[Deduplication] Reusing in-flight request: ${e}`), l;
|
|
86
86
|
if (ze(e, n)) {
|
|
87
87
|
if (s)
|
|
88
88
|
throw new Error(`Duplicate request blocked: ${e}`);
|
|
@@ -90,7 +90,7 @@ async function We(e, t, r = {}) {
|
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
const g = t();
|
|
93
|
-
return
|
|
93
|
+
return We(e, g);
|
|
94
94
|
}
|
|
95
95
|
function se(e, t, r = {}) {
|
|
96
96
|
const { cooldownMs: n = Re, deduplicationWindowMs: s = Se } = r;
|
|
@@ -101,18 +101,18 @@ function se(e, t, r = {}) {
|
|
|
101
101
|
}
|
|
102
102
|
qe(e, n);
|
|
103
103
|
try {
|
|
104
|
-
await
|
|
104
|
+
await Fe(
|
|
105
105
|
e,
|
|
106
106
|
async () => {
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const l = t();
|
|
108
|
+
l instanceof Promise && await l;
|
|
109
109
|
},
|
|
110
110
|
{ windowMs: s, throwOnDuplicate: !1 }
|
|
111
111
|
);
|
|
112
|
-
} catch (
|
|
113
|
-
if (
|
|
112
|
+
} catch (l) {
|
|
113
|
+
if (l instanceof Error && l.message.includes("Duplicate request"))
|
|
114
114
|
return;
|
|
115
|
-
throw
|
|
115
|
+
throw l;
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
}
|
|
@@ -233,34 +233,34 @@ function Ve(e = {}) {
|
|
|
233
233
|
solanaEndpoint: r,
|
|
234
234
|
customRpcProviders: n = [],
|
|
235
235
|
allowUnsafeScripts: s = !1,
|
|
236
|
-
additionalScriptSrc:
|
|
236
|
+
additionalScriptSrc: l = [],
|
|
237
237
|
additionalConnectSrc: g = [],
|
|
238
|
-
additionalFrameSrc:
|
|
239
|
-
includeStripe:
|
|
238
|
+
additionalFrameSrc: C = [],
|
|
239
|
+
includeStripe: b = !0,
|
|
240
240
|
includeSolana: c = !0
|
|
241
241
|
} = e;
|
|
242
242
|
s && console.warn(
|
|
243
243
|
"[CedrosPay] SECURITY WARNING: allowUnsafeScripts is enabled. This adds 'unsafe-inline' and 'unsafe-eval' to script-src, which significantly weakens CSP protection against XSS attacks. Only use this in development or if absolutely required by your framework."
|
|
244
244
|
);
|
|
245
245
|
const a = ["'self'"];
|
|
246
|
-
s && a.push("'unsafe-inline'", "'unsafe-eval'"),
|
|
246
|
+
s && a.push("'unsafe-inline'", "'unsafe-eval'"), b && a.push("https://js.stripe.com"), a.push(...l);
|
|
247
247
|
const o = ["'self'"];
|
|
248
|
-
if (
|
|
249
|
-
const
|
|
250
|
-
if (o.push(
|
|
251
|
-
const
|
|
252
|
-
o.includes(
|
|
248
|
+
if (b && o.push("https://api.stripe.com", "https://*.stripe.com"), c) {
|
|
249
|
+
const d = Ye(t);
|
|
250
|
+
if (o.push(d), r) {
|
|
251
|
+
const i = Qe(r);
|
|
252
|
+
o.includes(i) || o.push(i);
|
|
253
253
|
}
|
|
254
|
-
n.forEach((
|
|
255
|
-
o.includes(
|
|
254
|
+
n.forEach((i) => {
|
|
255
|
+
o.includes(i) || o.push(i);
|
|
256
256
|
});
|
|
257
257
|
}
|
|
258
258
|
o.push(...g);
|
|
259
|
-
const
|
|
260
|
-
return
|
|
259
|
+
const u = ["'self'"];
|
|
260
|
+
return b && u.push("https://js.stripe.com", "https://checkout.stripe.com"), u.push(...C), {
|
|
261
261
|
scriptSrc: a,
|
|
262
262
|
connectSrc: o,
|
|
263
|
-
frameSrc:
|
|
263
|
+
frameSrc: u
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
266
|
function Ge(e, t = "header") {
|
|
@@ -270,12 +270,12 @@ function Ge(e, t = "header") {
|
|
|
270
270
|
case "meta":
|
|
271
271
|
case "nextjs":
|
|
272
272
|
case "nginx": {
|
|
273
|
-
const
|
|
274
|
-
return r.length > 0 &&
|
|
273
|
+
const l = [];
|
|
274
|
+
return r.length > 0 && l.push(`script-src ${r.join(" ")}`), n.length > 0 && l.push(`connect-src ${n.join(" ")}`), s.length > 0 && l.push(`frame-src ${s.join(" ")}`), l.join("; ");
|
|
275
275
|
}
|
|
276
276
|
case "helmet": {
|
|
277
|
-
const
|
|
278
|
-
return r.length > 0 && (
|
|
277
|
+
const l = {};
|
|
278
|
+
return r.length > 0 && (l.scriptSrc = r), n.length > 0 && (l.connectSrc = n), s.length > 0 && (l.frameSrc = s), l;
|
|
279
279
|
}
|
|
280
280
|
case "directives":
|
|
281
281
|
return { scriptSrc: r, connectSrc: n, frameSrc: s };
|
|
@@ -340,8 +340,8 @@ function Ie() {
|
|
|
340
340
|
status: "idle",
|
|
341
341
|
error: null,
|
|
342
342
|
transactionId: null
|
|
343
|
-
}), n = X(!1), s =
|
|
344
|
-
async (
|
|
343
|
+
}), n = X(!1), s = R(
|
|
344
|
+
async (C, b, c, a, o, u) => {
|
|
345
345
|
if (n.current)
|
|
346
346
|
return { success: !1, error: "Payment already in progress" };
|
|
347
347
|
n.current = !0, r({
|
|
@@ -349,23 +349,23 @@ function Ie() {
|
|
|
349
349
|
error: null,
|
|
350
350
|
transactionId: null
|
|
351
351
|
});
|
|
352
|
-
const
|
|
353
|
-
resource:
|
|
354
|
-
successUrl:
|
|
352
|
+
const d = {
|
|
353
|
+
resource: C,
|
|
354
|
+
successUrl: b,
|
|
355
355
|
cancelUrl: c,
|
|
356
356
|
metadata: a,
|
|
357
357
|
customerEmail: o,
|
|
358
|
-
couponCode:
|
|
358
|
+
couponCode: u
|
|
359
359
|
};
|
|
360
360
|
try {
|
|
361
|
-
const
|
|
361
|
+
const i = await e.processPayment(d);
|
|
362
362
|
return r({
|
|
363
|
-
status:
|
|
364
|
-
error:
|
|
365
|
-
transactionId:
|
|
366
|
-
}),
|
|
367
|
-
} catch (
|
|
368
|
-
const p =
|
|
363
|
+
status: i.success ? "success" : "error",
|
|
364
|
+
error: i.success ? null : i.error || "Payment failed",
|
|
365
|
+
transactionId: i.success && i.transactionId || null
|
|
366
|
+
}), i;
|
|
367
|
+
} catch (i) {
|
|
368
|
+
const p = i instanceof Error ? i.message : "Payment failed";
|
|
369
369
|
return r({
|
|
370
370
|
status: "error",
|
|
371
371
|
error: p,
|
|
@@ -376,8 +376,8 @@ function Ie() {
|
|
|
376
376
|
}
|
|
377
377
|
},
|
|
378
378
|
[e]
|
|
379
|
-
),
|
|
380
|
-
async (
|
|
379
|
+
), l = R(
|
|
380
|
+
async (C, b, c, a, o, u, d, i, p, m, h, y, I) => {
|
|
381
381
|
if (n.current)
|
|
382
382
|
return { success: !1, error: "Payment already in progress" };
|
|
383
383
|
n.current = !0, r({
|
|
@@ -385,41 +385,41 @@ function Ie() {
|
|
|
385
385
|
error: null,
|
|
386
386
|
transactionId: null
|
|
387
387
|
});
|
|
388
|
-
const
|
|
388
|
+
const v = Ce(C);
|
|
389
389
|
try {
|
|
390
|
-
const
|
|
391
|
-
items:
|
|
392
|
-
successUrl:
|
|
390
|
+
const P = await e.processCartCheckout({
|
|
391
|
+
items: v,
|
|
392
|
+
successUrl: b,
|
|
393
393
|
cancelUrl: c,
|
|
394
394
|
metadata: a,
|
|
395
395
|
customerEmail: o,
|
|
396
|
-
customerName:
|
|
397
|
-
customerPhone:
|
|
396
|
+
customerName: d,
|
|
397
|
+
customerPhone: i,
|
|
398
398
|
shippingAddress: p,
|
|
399
399
|
billingAddress: m,
|
|
400
|
-
couponCode:
|
|
401
|
-
tipAmount:
|
|
400
|
+
couponCode: u,
|
|
401
|
+
tipAmount: h,
|
|
402
402
|
shippingMethodId: y,
|
|
403
|
-
paymentMethodId:
|
|
403
|
+
paymentMethodId: I
|
|
404
404
|
});
|
|
405
405
|
return r({
|
|
406
|
-
status:
|
|
407
|
-
error:
|
|
408
|
-
transactionId:
|
|
409
|
-
}),
|
|
410
|
-
} catch (
|
|
411
|
-
const
|
|
406
|
+
status: P.success ? "success" : "error",
|
|
407
|
+
error: P.success ? null : P.error || "Cart checkout failed",
|
|
408
|
+
transactionId: P.success && P.transactionId || null
|
|
409
|
+
}), P;
|
|
410
|
+
} catch (P) {
|
|
411
|
+
const N = P instanceof Error ? P.message : "Cart checkout failed";
|
|
412
412
|
return r({
|
|
413
413
|
status: "error",
|
|
414
|
-
error:
|
|
414
|
+
error: N,
|
|
415
415
|
transactionId: null
|
|
416
|
-
}), { success: !1, error:
|
|
416
|
+
}), { success: !1, error: N };
|
|
417
417
|
} finally {
|
|
418
418
|
n.current = !1;
|
|
419
419
|
}
|
|
420
420
|
},
|
|
421
421
|
[e]
|
|
422
|
-
), g =
|
|
422
|
+
), g = R(() => {
|
|
423
423
|
r({
|
|
424
424
|
status: "idle",
|
|
425
425
|
error: null,
|
|
@@ -429,12 +429,12 @@ function Ie() {
|
|
|
429
429
|
return {
|
|
430
430
|
...t,
|
|
431
431
|
processPayment: s,
|
|
432
|
-
processCartCheckout:
|
|
432
|
+
processCartCheckout: l,
|
|
433
433
|
reset: g
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
436
|
function he(e, t) {
|
|
437
|
-
return
|
|
437
|
+
return W(() => {
|
|
438
438
|
const r = $e(t), n = e || (t?.length === 1 ? t[0].resource : "");
|
|
439
439
|
return {
|
|
440
440
|
isCartMode: r,
|
|
@@ -444,8 +444,8 @@ function he(e, t) {
|
|
|
444
444
|
}
|
|
445
445
|
const Ke = (e, t, r) => {
|
|
446
446
|
const n = e[t];
|
|
447
|
-
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((s,
|
|
448
|
-
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
447
|
+
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((s, l) => {
|
|
448
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(l.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== r ? ". Note that variables only represent file names one level deep." : ""))));
|
|
449
449
|
});
|
|
450
450
|
}, ye = /* @__PURE__ */ new Map();
|
|
451
451
|
let de = null;
|
|
@@ -482,13 +482,13 @@ function Ze(e) {
|
|
|
482
482
|
return (t, r) => {
|
|
483
483
|
const n = t.split(".");
|
|
484
484
|
let s = e;
|
|
485
|
-
for (const
|
|
486
|
-
if (s && typeof s == "object" &&
|
|
487
|
-
s = s[
|
|
485
|
+
for (const l of n)
|
|
486
|
+
if (s && typeof s == "object" && l in s)
|
|
487
|
+
s = s[l];
|
|
488
488
|
else
|
|
489
489
|
return t;
|
|
490
490
|
return typeof s != "string" ? t : r ? Object.entries(r).reduce(
|
|
491
|
-
(
|
|
491
|
+
(l, [g, C]) => l.replace(new RegExp(`\\{${g}\\}`, "g"), C),
|
|
492
492
|
s
|
|
493
493
|
) : s;
|
|
494
494
|
};
|
|
@@ -502,22 +502,22 @@ function $t(e, t, r = !0) {
|
|
|
502
502
|
return r && n.action ? `${n.message} ${n.action}` : n.message;
|
|
503
503
|
}
|
|
504
504
|
function ne(e) {
|
|
505
|
-
const [t, r] = Q(null), [n, s] = Q(!0),
|
|
505
|
+
const [t, r] = Q(null), [n, s] = Q(!0), l = W(() => e || Xe(), [e]);
|
|
506
506
|
return te(() => {
|
|
507
|
-
let
|
|
507
|
+
let C = !1;
|
|
508
508
|
return (async () => {
|
|
509
509
|
s(!0);
|
|
510
510
|
try {
|
|
511
|
-
const c = await Je(
|
|
512
|
-
|
|
511
|
+
const c = await Je(l);
|
|
512
|
+
C || (r(c), s(!1));
|
|
513
513
|
} catch (c) {
|
|
514
|
-
console.error("[CedrosPay] Failed to load translations:", c),
|
|
514
|
+
console.error("[CedrosPay] Failed to load translations:", c), C || s(!1);
|
|
515
515
|
}
|
|
516
516
|
})(), () => {
|
|
517
|
-
|
|
517
|
+
C = !0;
|
|
518
518
|
};
|
|
519
|
-
}, [
|
|
520
|
-
t:
|
|
519
|
+
}, [l]), {
|
|
520
|
+
t: W(() => t ? Ze(t) : (C) => ({
|
|
521
521
|
"ui.purchase": "Purchase",
|
|
522
522
|
"ui.pay_with_card": "Pay with Card",
|
|
523
523
|
"ui.pay_with_crypto": "Pay with USDC",
|
|
@@ -529,8 +529,8 @@ function ne(e) {
|
|
|
529
529
|
"ui.loading": "Loading...",
|
|
530
530
|
"ui.connect_wallet": "Connect Wallet",
|
|
531
531
|
"ui.connecting": "Connecting..."
|
|
532
|
-
})[
|
|
533
|
-
locale:
|
|
532
|
+
})[C] || C, [t]),
|
|
533
|
+
locale: l,
|
|
534
534
|
isLoading: n,
|
|
535
535
|
translations: t
|
|
536
536
|
};
|
|
@@ -554,60 +554,60 @@ function Me({
|
|
|
554
554
|
successUrl: r,
|
|
555
555
|
cancelUrl: n,
|
|
556
556
|
metadata: s,
|
|
557
|
-
customerEmail:
|
|
557
|
+
customerEmail: l,
|
|
558
558
|
couponCode: g,
|
|
559
|
-
label:
|
|
560
|
-
disabled:
|
|
559
|
+
label: C,
|
|
560
|
+
disabled: b = !1,
|
|
561
561
|
onAttempt: c,
|
|
562
562
|
onSuccess: a,
|
|
563
563
|
onError: o,
|
|
564
|
-
className:
|
|
564
|
+
className: u = ""
|
|
565
565
|
}) {
|
|
566
|
-
const { status:
|
|
567
|
-
if (!x || !
|
|
568
|
-
const
|
|
569
|
-
return
|
|
570
|
-
})(
|
|
566
|
+
const { status: d, error: i, transactionId: p, processPayment: m, processCartCheckout: h } = Ie(), y = V(), { isCartMode: I, effectiveResource: v } = he(e, t), { t: P, translations: N } = ne(), A = C || P("ui.pay_with_card"), z = y.unstyled ? u : `${y.className} cedros-theme__stripe-button ${u}`.trim(), q = i && typeof i != "string" ? i?.code ?? null : null, w = i ? typeof i == "string" ? i : ((x) => {
|
|
567
|
+
if (!x || !N) return "";
|
|
568
|
+
const _ = N.errors[x];
|
|
569
|
+
return _ ? _.action ? `${_.message} ${_.action}` : _.message : "";
|
|
570
|
+
})(q) : null, E = R(async () => {
|
|
571
571
|
j().debug("[StripeButton] executePayment with couponCode:", g);
|
|
572
|
-
const x =
|
|
573
|
-
if (oe("stripe",
|
|
574
|
-
const
|
|
575
|
-
j().error("[StripeButton]",
|
|
572
|
+
const x = I && t ? ge(t) : void 0;
|
|
573
|
+
if (oe("stripe", v, x), c && c("stripe"), !I && !v) {
|
|
574
|
+
const F = "Invalid payment configuration: missing resource or items";
|
|
575
|
+
j().error("[StripeButton]", F), Y("stripe", F, v, x), o && o(F);
|
|
576
576
|
return;
|
|
577
577
|
}
|
|
578
|
-
let
|
|
579
|
-
ae("stripe",
|
|
578
|
+
let _;
|
|
579
|
+
ae("stripe", v, x), I && t ? (j().debug("[StripeButton] Processing cart checkout with coupon:", g), _ = await h(
|
|
580
580
|
t,
|
|
581
581
|
r,
|
|
582
582
|
n,
|
|
583
583
|
s,
|
|
584
|
-
|
|
584
|
+
l,
|
|
585
585
|
g
|
|
586
|
-
)) :
|
|
587
|
-
|
|
586
|
+
)) : v && (j().debug("[StripeButton] Processing single payment with coupon:", g), _ = await m(
|
|
587
|
+
v,
|
|
588
588
|
r,
|
|
589
589
|
n,
|
|
590
590
|
s,
|
|
591
|
-
|
|
591
|
+
l,
|
|
592
592
|
g
|
|
593
|
-
)),
|
|
594
|
-
}, [g,
|
|
595
|
-
() => se(
|
|
596
|
-
[
|
|
597
|
-
),
|
|
593
|
+
)), _ && _.success && _.transactionId ? (ie("stripe", _.transactionId, v, x), a && a(_.transactionId)) : _ && !_.success && _.error && (Y("stripe", _.error, v, x), o && o(_.error));
|
|
594
|
+
}, [g, I, v, t, r, n, s, l, h, m, c, a, o]), $ = W(() => I && t ? `stripe-cart-${t.map((x) => x.resource).join("-")}` : `stripe-${v || "unknown"}`, [I, t, v]), k = W(
|
|
595
|
+
() => se($, E),
|
|
596
|
+
[$, E]
|
|
597
|
+
), T = d === "loading", M = b || T;
|
|
598
598
|
return /* @__PURE__ */ S("div", { className: z, style: y.unstyled ? {} : y.style, children: [
|
|
599
599
|
/* @__PURE__ */ f(
|
|
600
600
|
"button",
|
|
601
601
|
{
|
|
602
|
-
onClick:
|
|
603
|
-
disabled:
|
|
604
|
-
className: y.unstyled ?
|
|
602
|
+
onClick: k,
|
|
603
|
+
disabled: M,
|
|
604
|
+
className: y.unstyled ? u : "cedros-theme__button cedros-theme__stripe",
|
|
605
605
|
type: "button",
|
|
606
|
-
children:
|
|
606
|
+
children: T ? P("ui.processing") : A
|
|
607
607
|
}
|
|
608
608
|
),
|
|
609
|
-
|
|
610
|
-
p && /* @__PURE__ */ f("div", { className: y.unstyled ? "" : "cedros-theme__success", children:
|
|
609
|
+
w && /* @__PURE__ */ f("div", { className: y.unstyled ? "" : "cedros-theme__error", children: w }),
|
|
610
|
+
p && /* @__PURE__ */ f("div", { className: y.unstyled ? "" : "cedros-theme__success", children: P("ui.payment_successful") })
|
|
611
611
|
] });
|
|
612
612
|
}
|
|
613
613
|
function et() {
|
|
@@ -617,7 +617,7 @@ function et() {
|
|
|
617
617
|
transactionId: null,
|
|
618
618
|
requirement: null,
|
|
619
619
|
holdId: null
|
|
620
|
-
}), n = X(!1), s =
|
|
620
|
+
}), n = X(!1), s = R(
|
|
621
621
|
async (c, a) => {
|
|
622
622
|
r((o) => ({
|
|
623
623
|
...o,
|
|
@@ -626,22 +626,22 @@ function et() {
|
|
|
626
626
|
}));
|
|
627
627
|
try {
|
|
628
628
|
const o = await e.requestQuote(c, a);
|
|
629
|
-
return r((
|
|
630
|
-
...
|
|
629
|
+
return r((u) => ({
|
|
630
|
+
...u,
|
|
631
631
|
status: "idle",
|
|
632
632
|
requirement: o
|
|
633
633
|
})), o;
|
|
634
634
|
} catch (o) {
|
|
635
|
-
const
|
|
636
|
-
return r((
|
|
637
|
-
...
|
|
635
|
+
const u = o instanceof Error ? o.message : "Failed to fetch credits quote";
|
|
636
|
+
return r((d) => ({
|
|
637
|
+
...d,
|
|
638
638
|
status: "error",
|
|
639
|
-
error:
|
|
639
|
+
error: u
|
|
640
640
|
})), null;
|
|
641
641
|
}
|
|
642
642
|
},
|
|
643
643
|
[e]
|
|
644
|
-
),
|
|
644
|
+
), l = R(
|
|
645
645
|
async (c, a) => {
|
|
646
646
|
r((o) => ({
|
|
647
647
|
...o,
|
|
@@ -649,23 +649,23 @@ function et() {
|
|
|
649
649
|
error: null
|
|
650
650
|
}));
|
|
651
651
|
try {
|
|
652
|
-
const o = Ce(c),
|
|
653
|
-
return r((
|
|
654
|
-
...
|
|
652
|
+
const o = Ce(c), u = await e.requestCartQuote(o, a);
|
|
653
|
+
return r((d) => ({
|
|
654
|
+
...d,
|
|
655
655
|
status: "idle"
|
|
656
|
-
})),
|
|
656
|
+
})), u;
|
|
657
657
|
} catch (o) {
|
|
658
|
-
const
|
|
659
|
-
return r((
|
|
660
|
-
...
|
|
658
|
+
const u = o instanceof Error ? o.message : "Failed to fetch cart credits quote";
|
|
659
|
+
return r((d) => ({
|
|
660
|
+
...d,
|
|
661
661
|
status: "error",
|
|
662
|
-
error:
|
|
662
|
+
error: u
|
|
663
663
|
})), null;
|
|
664
664
|
}
|
|
665
665
|
},
|
|
666
666
|
[e]
|
|
667
|
-
), g =
|
|
668
|
-
async (c, a, o,
|
|
667
|
+
), g = R(
|
|
668
|
+
async (c, a, o, u) => {
|
|
669
669
|
if (n.current)
|
|
670
670
|
return { success: !1, error: "Payment already in progress" };
|
|
671
671
|
n.current = !0, r({
|
|
@@ -676,30 +676,30 @@ function et() {
|
|
|
676
676
|
holdId: null
|
|
677
677
|
});
|
|
678
678
|
try {
|
|
679
|
-
const
|
|
679
|
+
const d = await e.processPayment(c, a, o, u);
|
|
680
680
|
return r({
|
|
681
|
-
status:
|
|
682
|
-
error:
|
|
683
|
-
transactionId:
|
|
681
|
+
status: d.success ? "success" : "error",
|
|
682
|
+
error: d.success ? null : d.error || "Credits payment failed",
|
|
683
|
+
transactionId: d.success && d.transactionId || null,
|
|
684
684
|
requirement: null,
|
|
685
685
|
holdId: null
|
|
686
|
-
}),
|
|
687
|
-
} catch (
|
|
688
|
-
const
|
|
686
|
+
}), d;
|
|
687
|
+
} catch (d) {
|
|
688
|
+
const i = d instanceof Error ? d.message : "Credits payment failed";
|
|
689
689
|
return r({
|
|
690
690
|
status: "error",
|
|
691
|
-
error:
|
|
691
|
+
error: i,
|
|
692
692
|
transactionId: null,
|
|
693
693
|
requirement: null,
|
|
694
694
|
holdId: null
|
|
695
|
-
}), { success: !1, error:
|
|
695
|
+
}), { success: !1, error: i };
|
|
696
696
|
} finally {
|
|
697
697
|
n.current = !1;
|
|
698
698
|
}
|
|
699
699
|
},
|
|
700
700
|
[e]
|
|
701
|
-
),
|
|
702
|
-
async (c, a, o,
|
|
701
|
+
), C = R(
|
|
702
|
+
async (c, a, o, u) => {
|
|
703
703
|
if (n.current)
|
|
704
704
|
return { success: !1, error: "Payment already in progress" };
|
|
705
705
|
n.current = !0, r({
|
|
@@ -709,9 +709,9 @@ function et() {
|
|
|
709
709
|
requirement: null,
|
|
710
710
|
holdId: null
|
|
711
711
|
});
|
|
712
|
-
let
|
|
712
|
+
let d = null;
|
|
713
713
|
try {
|
|
714
|
-
const
|
|
714
|
+
const i = Ce(c), p = await e.requestCartQuote(i, o);
|
|
715
715
|
if (!p)
|
|
716
716
|
return r({
|
|
717
717
|
status: "error",
|
|
@@ -720,47 +720,47 @@ function et() {
|
|
|
720
720
|
requirement: null,
|
|
721
721
|
holdId: null
|
|
722
722
|
}), { success: !1, error: "Credits payment not available" };
|
|
723
|
-
|
|
723
|
+
d = (await e.createCartHold({
|
|
724
724
|
cartId: p.cartId,
|
|
725
725
|
authToken: a
|
|
726
726
|
})).holdId, r((y) => ({
|
|
727
727
|
...y,
|
|
728
|
-
holdId:
|
|
728
|
+
holdId: d
|
|
729
729
|
}));
|
|
730
|
-
const
|
|
730
|
+
const h = await e.authorizeCartPayment({
|
|
731
731
|
cartId: p.cartId,
|
|
732
|
-
holdId:
|
|
732
|
+
holdId: d,
|
|
733
733
|
authToken: a,
|
|
734
|
-
metadata:
|
|
734
|
+
metadata: u
|
|
735
735
|
});
|
|
736
|
-
if (!
|
|
736
|
+
if (!h.success && d)
|
|
737
737
|
try {
|
|
738
|
-
await e.releaseHold(
|
|
738
|
+
await e.releaseHold(d, a);
|
|
739
739
|
} catch (y) {
|
|
740
740
|
j().warn("[useCreditsPayment] Hold release failed, will expire server-side", {
|
|
741
|
-
holdId:
|
|
741
|
+
holdId: d,
|
|
742
742
|
error: y instanceof Error ? y.message : String(y)
|
|
743
743
|
});
|
|
744
744
|
}
|
|
745
745
|
return r({
|
|
746
|
-
status:
|
|
747
|
-
error:
|
|
748
|
-
transactionId:
|
|
746
|
+
status: h.success ? "success" : "error",
|
|
747
|
+
error: h.success ? null : h.error || "Cart credits payment failed",
|
|
748
|
+
transactionId: h.success && h.transactionId || null,
|
|
749
749
|
requirement: null,
|
|
750
750
|
holdId: null
|
|
751
751
|
}), {
|
|
752
|
-
success:
|
|
753
|
-
transactionId:
|
|
754
|
-
error:
|
|
752
|
+
success: h.success,
|
|
753
|
+
transactionId: h.transactionId,
|
|
754
|
+
error: h.error
|
|
755
755
|
};
|
|
756
|
-
} catch (
|
|
757
|
-
const p =
|
|
758
|
-
if (
|
|
756
|
+
} catch (i) {
|
|
757
|
+
const p = i instanceof Error ? i.message : "Cart credits payment failed";
|
|
758
|
+
if (d)
|
|
759
759
|
try {
|
|
760
|
-
await e.releaseHold(
|
|
760
|
+
await e.releaseHold(d, a);
|
|
761
761
|
} catch (m) {
|
|
762
762
|
j().warn("[useCreditsPayment] Hold release failed, will expire server-side", {
|
|
763
|
-
holdId:
|
|
763
|
+
holdId: d,
|
|
764
764
|
error: m instanceof Error ? m.message : String(m)
|
|
765
765
|
});
|
|
766
766
|
}
|
|
@@ -776,7 +776,7 @@ function et() {
|
|
|
776
776
|
}
|
|
777
777
|
},
|
|
778
778
|
[e]
|
|
779
|
-
),
|
|
779
|
+
), b = R(() => {
|
|
780
780
|
r({
|
|
781
781
|
status: "idle",
|
|
782
782
|
error: null,
|
|
@@ -788,10 +788,10 @@ function et() {
|
|
|
788
788
|
return {
|
|
789
789
|
...t,
|
|
790
790
|
fetchQuote: s,
|
|
791
|
-
fetchCartQuote:
|
|
791
|
+
fetchCartQuote: l,
|
|
792
792
|
processPayment: g,
|
|
793
|
-
processCartPayment:
|
|
794
|
-
reset:
|
|
793
|
+
processCartPayment: C,
|
|
794
|
+
reset: b
|
|
795
795
|
};
|
|
796
796
|
}
|
|
797
797
|
function Te({
|
|
@@ -800,106 +800,106 @@ function Te({
|
|
|
800
800
|
authToken: r,
|
|
801
801
|
metadata: n,
|
|
802
802
|
couponCode: s,
|
|
803
|
-
label:
|
|
803
|
+
label: l,
|
|
804
804
|
disabled: g = !1,
|
|
805
|
-
onAttempt:
|
|
806
|
-
onSuccess:
|
|
805
|
+
onAttempt: C,
|
|
806
|
+
onSuccess: b,
|
|
807
807
|
onError: c,
|
|
808
808
|
className: a = ""
|
|
809
809
|
}) {
|
|
810
|
-
const { status: o, error:
|
|
811
|
-
if (!
|
|
812
|
-
const
|
|
813
|
-
return
|
|
814
|
-
})(
|
|
810
|
+
const { status: o, error: u, transactionId: d, processPayment: i, processCartPayment: p } = et(), m = V(), { isCartMode: h, effectiveResource: y } = he(e, t), { t: I, translations: v } = ne(), P = l || I("ui.pay_with_credits") || "Pay with Credits", N = m.unstyled ? a : `${m.className} cedros-theme__credits-button ${a}`.trim(), A = u && typeof u != "string" ? u?.code ?? null : null, q = u ? typeof u == "string" ? u : ((T) => {
|
|
811
|
+
if (!T || !v) return "";
|
|
812
|
+
const M = v.errors[T];
|
|
813
|
+
return M ? M.action ? `${M.message} ${M.action}` : M.message : "";
|
|
814
|
+
})(A) : null, D = R(async () => {
|
|
815
815
|
j().debug("[CreditsButton] executePayment");
|
|
816
|
-
const
|
|
817
|
-
if (oe("credits", y,
|
|
816
|
+
const T = h && t ? ge(t) : void 0;
|
|
817
|
+
if (oe("credits", y, T), C && C("credits"), !r) {
|
|
818
818
|
const x = "Authentication required: please log in to pay with credits";
|
|
819
|
-
j().error("[CreditsButton]", x), Y("credits", x, y,
|
|
819
|
+
j().error("[CreditsButton]", x), Y("credits", x, y, T), c && c(x);
|
|
820
820
|
return;
|
|
821
821
|
}
|
|
822
|
-
if (!
|
|
822
|
+
if (!h && !y) {
|
|
823
823
|
const x = "Invalid payment configuration: missing resource";
|
|
824
|
-
j().error("[CreditsButton]", x), Y("credits", x, y,
|
|
824
|
+
j().error("[CreditsButton]", x), Y("credits", x, y, T), c && c(x);
|
|
825
825
|
return;
|
|
826
826
|
}
|
|
827
|
-
let
|
|
828
|
-
ae("credits", y,
|
|
827
|
+
let M;
|
|
828
|
+
ae("credits", y, T), h && t ? (j().debug("[CreditsButton] Processing cart checkout"), M = await p(t, r, s, n)) : y && (j().debug("[CreditsButton] Processing single payment"), M = await i(y, r, s, n)), M && M.success && M.transactionId ? (ie("credits", M.transactionId, y, T), b && b(M.transactionId)) : M && !M.success && M.error && (Y("credits", M.error, y, T), c && c(M.error));
|
|
829
829
|
}, [
|
|
830
830
|
r,
|
|
831
|
-
|
|
831
|
+
h,
|
|
832
832
|
y,
|
|
833
833
|
t,
|
|
834
834
|
s,
|
|
835
835
|
n,
|
|
836
|
-
|
|
836
|
+
i,
|
|
837
837
|
p,
|
|
838
|
+
C,
|
|
838
839
|
b,
|
|
839
|
-
h,
|
|
840
840
|
c
|
|
841
|
-
]),
|
|
842
|
-
() => se(
|
|
843
|
-
[
|
|
844
|
-
),
|
|
845
|
-
return /* @__PURE__ */ S("div", { className:
|
|
841
|
+
]), w = W(() => h && t ? `credits-cart-${t.map((T) => T.resource).join("-")}` : `credits-${y || "unknown"}`, [h, t, y]), E = W(
|
|
842
|
+
() => se(w, D),
|
|
843
|
+
[w, D]
|
|
844
|
+
), $ = o === "loading", k = g || $;
|
|
845
|
+
return /* @__PURE__ */ S("div", { className: N, style: m.unstyled ? {} : m.style, children: [
|
|
846
846
|
/* @__PURE__ */ f(
|
|
847
847
|
"button",
|
|
848
848
|
{
|
|
849
|
-
onClick:
|
|
850
|
-
disabled:
|
|
849
|
+
onClick: E,
|
|
850
|
+
disabled: k,
|
|
851
851
|
className: m.unstyled ? a : "cedros-theme__button cedros-theme__credits",
|
|
852
852
|
type: "button",
|
|
853
|
-
children:
|
|
853
|
+
children: $ ? I("ui.processing") : P
|
|
854
854
|
}
|
|
855
855
|
),
|
|
856
|
-
|
|
857
|
-
|
|
856
|
+
q && /* @__PURE__ */ f("div", { className: m.unstyled ? "" : "cedros-theme__error", children: q }),
|
|
857
|
+
d && /* @__PURE__ */ f("div", { className: m.unstyled ? "" : "cedros-theme__success", children: I("ui.payment_successful") })
|
|
858
858
|
] });
|
|
859
859
|
}
|
|
860
|
-
const tt =
|
|
861
|
-
() => import("./CryptoButton-
|
|
860
|
+
const tt = U.lazy(
|
|
861
|
+
() => import("./CryptoButton-BV9owVe2.mjs").then((e) => e.a).then((e) => ({ default: e.CryptoButton }))
|
|
862
862
|
), rt = ({
|
|
863
863
|
isOpen: e,
|
|
864
864
|
onClose: t,
|
|
865
865
|
resource: r,
|
|
866
866
|
items: n,
|
|
867
867
|
cardLabel: s = "Card",
|
|
868
|
-
cryptoLabel:
|
|
868
|
+
cryptoLabel: l = "USDC (Solana)",
|
|
869
869
|
creditsLabel: g = "Pay with Credits",
|
|
870
|
-
showCard:
|
|
871
|
-
showCrypto:
|
|
870
|
+
showCard: C = !0,
|
|
871
|
+
showCrypto: b = !0,
|
|
872
872
|
showCredits: c = !1,
|
|
873
873
|
onPaymentAttempt: a,
|
|
874
874
|
onPaymentSuccess: o,
|
|
875
|
-
onPaymentError:
|
|
876
|
-
onStripeSuccess:
|
|
877
|
-
onCryptoSuccess:
|
|
875
|
+
onPaymentError: u,
|
|
876
|
+
onStripeSuccess: d,
|
|
877
|
+
onCryptoSuccess: i,
|
|
878
878
|
onCreditsSuccess: p,
|
|
879
879
|
onStripeError: m,
|
|
880
|
-
onCryptoError:
|
|
880
|
+
onCryptoError: h,
|
|
881
881
|
onCreditsError: y,
|
|
882
|
-
customerEmail:
|
|
883
|
-
successUrl:
|
|
884
|
-
cancelUrl:
|
|
885
|
-
metadata:
|
|
886
|
-
couponCode:
|
|
882
|
+
customerEmail: I,
|
|
883
|
+
successUrl: v,
|
|
884
|
+
cancelUrl: P,
|
|
885
|
+
metadata: N,
|
|
886
|
+
couponCode: A,
|
|
887
887
|
authToken: z,
|
|
888
|
-
testPageUrl:
|
|
888
|
+
testPageUrl: q,
|
|
889
889
|
hideMessages: D = !1
|
|
890
890
|
}) => {
|
|
891
|
-
const { tokens:
|
|
891
|
+
const { tokens: w } = V();
|
|
892
892
|
return te(() => {
|
|
893
|
-
const
|
|
894
|
-
|
|
893
|
+
const E = ($) => {
|
|
894
|
+
$.key === "Escape" && e && t();
|
|
895
895
|
};
|
|
896
|
-
return window.addEventListener("keydown",
|
|
896
|
+
return window.addEventListener("keydown", E), () => window.removeEventListener("keydown", E);
|
|
897
897
|
}, [e, t]), te(() => {
|
|
898
898
|
if (e) {
|
|
899
|
-
const
|
|
900
|
-
return document.body.style.position = "fixed", document.body.style.top = `-${
|
|
901
|
-
const
|
|
902
|
-
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", document.body.style.overflowY = "", window.scrollTo(0,
|
|
899
|
+
const E = window.scrollY;
|
|
900
|
+
return document.body.style.position = "fixed", document.body.style.top = `-${E}px`, document.body.style.width = "100%", document.body.style.overflowY = "scroll", () => {
|
|
901
|
+
const $ = document.body.style.top ? Math.abs(parseInt(document.body.style.top.replace("px", ""), 10)) : 0;
|
|
902
|
+
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", document.body.style.overflowY = "", window.scrollTo(0, $);
|
|
903
903
|
};
|
|
904
904
|
}
|
|
905
905
|
}, [e]), e ? /* @__PURE__ */ f(
|
|
@@ -912,7 +912,7 @@ const tt = q.lazy(
|
|
|
912
912
|
left: 0,
|
|
913
913
|
right: 0,
|
|
914
914
|
bottom: 0,
|
|
915
|
-
backgroundColor:
|
|
915
|
+
backgroundColor: w.modalOverlay,
|
|
916
916
|
display: "flex",
|
|
917
917
|
alignItems: "center",
|
|
918
918
|
justifyContent: "center",
|
|
@@ -925,15 +925,15 @@ const tt = q.lazy(
|
|
|
925
925
|
{
|
|
926
926
|
className: "cedros-modal-content",
|
|
927
927
|
style: {
|
|
928
|
-
backgroundColor:
|
|
928
|
+
backgroundColor: w.modalBackground,
|
|
929
929
|
borderRadius: "12px",
|
|
930
930
|
padding: "2rem",
|
|
931
931
|
maxWidth: "400px",
|
|
932
932
|
width: "100%",
|
|
933
933
|
boxShadow: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
|
|
934
|
-
border: `1px solid ${
|
|
934
|
+
border: `1px solid ${w.modalBorder}`
|
|
935
935
|
},
|
|
936
|
-
onClick: (
|
|
936
|
+
onClick: (E) => E.stopPropagation(),
|
|
937
937
|
children: [
|
|
938
938
|
/* @__PURE__ */ S(
|
|
939
939
|
"div",
|
|
@@ -952,7 +952,7 @@ const tt = q.lazy(
|
|
|
952
952
|
margin: 0,
|
|
953
953
|
fontSize: "1.25rem",
|
|
954
954
|
fontWeight: 600,
|
|
955
|
-
color:
|
|
955
|
+
color: w.surfaceText
|
|
956
956
|
},
|
|
957
957
|
children: "Choose Payment Method"
|
|
958
958
|
}
|
|
@@ -962,7 +962,7 @@ const tt = q.lazy(
|
|
|
962
962
|
{
|
|
963
963
|
type: "button",
|
|
964
964
|
onClick: t,
|
|
965
|
-
style: He(
|
|
965
|
+
style: He(w.surfaceText),
|
|
966
966
|
"aria-label": "Close modal",
|
|
967
967
|
children: "×"
|
|
968
968
|
}
|
|
@@ -971,35 +971,35 @@ const tt = q.lazy(
|
|
|
971
971
|
}
|
|
972
972
|
),
|
|
973
973
|
/* @__PURE__ */ S("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
|
|
974
|
-
|
|
974
|
+
C && /* @__PURE__ */ f(
|
|
975
975
|
Me,
|
|
976
976
|
{
|
|
977
977
|
resource: r,
|
|
978
978
|
items: n,
|
|
979
979
|
label: s,
|
|
980
980
|
onAttempt: a,
|
|
981
|
-
onSuccess:
|
|
982
|
-
onError: m ||
|
|
983
|
-
customerEmail:
|
|
984
|
-
successUrl:
|
|
985
|
-
cancelUrl:
|
|
986
|
-
metadata:
|
|
987
|
-
couponCode:
|
|
981
|
+
onSuccess: d || o,
|
|
982
|
+
onError: m || u,
|
|
983
|
+
customerEmail: I,
|
|
984
|
+
successUrl: v,
|
|
985
|
+
cancelUrl: P,
|
|
986
|
+
metadata: N,
|
|
987
|
+
couponCode: A
|
|
988
988
|
}
|
|
989
989
|
),
|
|
990
|
-
|
|
990
|
+
b && /* @__PURE__ */ f(U.Suspense, { fallback: null, children: /* @__PURE__ */ f(
|
|
991
991
|
tt,
|
|
992
992
|
{
|
|
993
993
|
resource: r,
|
|
994
994
|
items: n,
|
|
995
|
-
label:
|
|
995
|
+
label: l,
|
|
996
996
|
onAttempt: a,
|
|
997
|
-
onSuccess:
|
|
998
|
-
onError:
|
|
999
|
-
testPageUrl:
|
|
997
|
+
onSuccess: i || o,
|
|
998
|
+
onError: h || u,
|
|
999
|
+
testPageUrl: q,
|
|
1000
1000
|
hideMessages: D,
|
|
1001
|
-
metadata:
|
|
1002
|
-
couponCode:
|
|
1001
|
+
metadata: N,
|
|
1002
|
+
couponCode: A
|
|
1003
1003
|
}
|
|
1004
1004
|
) }),
|
|
1005
1005
|
c && /* @__PURE__ */ f(
|
|
@@ -1011,9 +1011,9 @@ const tt = q.lazy(
|
|
|
1011
1011
|
authToken: z,
|
|
1012
1012
|
onAttempt: a ? () => a("credits") : void 0,
|
|
1013
1013
|
onSuccess: p || o,
|
|
1014
|
-
onError: y ||
|
|
1015
|
-
metadata:
|
|
1016
|
-
couponCode:
|
|
1014
|
+
onError: y || u,
|
|
1015
|
+
metadata: N,
|
|
1016
|
+
couponCode: A
|
|
1017
1017
|
}
|
|
1018
1018
|
)
|
|
1019
1019
|
] })
|
|
@@ -1028,111 +1028,111 @@ const tt = q.lazy(
|
|
|
1028
1028
|
label: r,
|
|
1029
1029
|
cardLabel: n,
|
|
1030
1030
|
cryptoLabel: s,
|
|
1031
|
-
creditsLabel:
|
|
1031
|
+
creditsLabel: l,
|
|
1032
1032
|
showCard: g = !0,
|
|
1033
|
-
showCrypto:
|
|
1034
|
-
showCredits:
|
|
1033
|
+
showCrypto: C = !0,
|
|
1034
|
+
showCredits: b = !1,
|
|
1035
1035
|
onPaymentAttempt: c,
|
|
1036
1036
|
onPaymentSuccess: a,
|
|
1037
1037
|
onPaymentError: o,
|
|
1038
|
-
onStripeSuccess:
|
|
1039
|
-
onCryptoSuccess:
|
|
1040
|
-
onCreditsSuccess:
|
|
1038
|
+
onStripeSuccess: u,
|
|
1039
|
+
onCryptoSuccess: d,
|
|
1040
|
+
onCreditsSuccess: i,
|
|
1041
1041
|
onStripeError: p,
|
|
1042
1042
|
onCryptoError: m,
|
|
1043
|
-
onCreditsError:
|
|
1043
|
+
onCreditsError: h,
|
|
1044
1044
|
customerEmail: y,
|
|
1045
|
-
successUrl:
|
|
1046
|
-
cancelUrl:
|
|
1047
|
-
metadata:
|
|
1048
|
-
couponCode:
|
|
1049
|
-
authToken:
|
|
1045
|
+
successUrl: I,
|
|
1046
|
+
cancelUrl: v,
|
|
1047
|
+
metadata: P,
|
|
1048
|
+
couponCode: N,
|
|
1049
|
+
authToken: A,
|
|
1050
1050
|
autoDetectWallets: z = !0,
|
|
1051
|
-
testPageUrl:
|
|
1051
|
+
testPageUrl: q,
|
|
1052
1052
|
hideMessages: D = !1,
|
|
1053
|
-
renderModal:
|
|
1053
|
+
renderModal: w
|
|
1054
1054
|
}) => {
|
|
1055
|
-
const
|
|
1055
|
+
const E = V(), [$, k] = Q(!1), { status: T, processPayment: M, processCartCheckout: x } = Ie(), { isCartMode: _, effectiveResource: F } = he(e, t), { t: B } = ne(), H = r || B("ui.purchase"), De = n || B("ui.card"), je = s || B("ui.usdc_solana"), Be = l || B("ui.pay_with_credits") || "Pay with Credits", ve = R(async () => {
|
|
1056
1056
|
if (z && g) {
|
|
1057
1057
|
const { detectSolanaWallets: L } = await import("./walletDetection-JZR3UCOa.mjs");
|
|
1058
1058
|
if (!L()) {
|
|
1059
|
-
const le =
|
|
1059
|
+
const le = _ ? void 0 : F, ue = _ && t ? ge(t) : void 0;
|
|
1060
1060
|
oe("stripe", le, ue), c && c("stripe"), ae("stripe", le, ue);
|
|
1061
1061
|
let O;
|
|
1062
|
-
|
|
1062
|
+
_ && t ? O = await x(
|
|
1063
1063
|
t,
|
|
1064
|
-
|
|
1064
|
+
I,
|
|
1065
|
+
v,
|
|
1065
1066
|
P,
|
|
1066
|
-
E,
|
|
1067
1067
|
y,
|
|
1068
|
-
|
|
1069
|
-
) :
|
|
1070
|
-
|
|
1071
|
-
|
|
1068
|
+
N
|
|
1069
|
+
) : F && (O = await M(
|
|
1070
|
+
F,
|
|
1071
|
+
I,
|
|
1072
|
+
v,
|
|
1072
1073
|
P,
|
|
1073
|
-
E,
|
|
1074
1074
|
y,
|
|
1075
|
-
|
|
1076
|
-
)), O && O.success && O.transactionId ? (ie("stripe", O.transactionId, le, ue),
|
|
1075
|
+
N
|
|
1076
|
+
)), O && O.success && O.transactionId ? (ie("stripe", O.transactionId, le, ue), u ? u(O.transactionId) : a && a(O.transactionId)) : O && !O.success && O.error && (Y("stripe", O.error, le, ue), p ? p(O.error) : o && o(O.error));
|
|
1077
1077
|
return;
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
|
-
|
|
1081
|
-
}, [z, g,
|
|
1080
|
+
k(!0);
|
|
1081
|
+
}, [z, g, _, t, F, x, M, I, v, P, y, N, a, o, u, p, c]), Pe = W(() => _ && t ? `purchase-cart-${t.map((L) => L.resource).join("-")}` : `purchase-${F || "unknown"}`, [_, t, F]), Le = W(
|
|
1082
1082
|
() => se(Pe, ve),
|
|
1083
1083
|
[Pe, ve]
|
|
1084
|
-
), ce =
|
|
1085
|
-
isOpen:
|
|
1086
|
-
onClose: () =>
|
|
1087
|
-
resource:
|
|
1088
|
-
items:
|
|
1084
|
+
), ce = T === "loading", xe = {
|
|
1085
|
+
isOpen: $,
|
|
1086
|
+
onClose: () => k(!1),
|
|
1087
|
+
resource: _ ? void 0 : F,
|
|
1088
|
+
items: _ ? t : void 0,
|
|
1089
1089
|
cardLabel: De,
|
|
1090
1090
|
cryptoLabel: je,
|
|
1091
1091
|
creditsLabel: Be,
|
|
1092
1092
|
showCard: g,
|
|
1093
|
-
showCrypto:
|
|
1094
|
-
showCredits:
|
|
1093
|
+
showCrypto: C,
|
|
1094
|
+
showCredits: b,
|
|
1095
1095
|
onPaymentAttempt: c,
|
|
1096
1096
|
onPaymentSuccess: (L) => {
|
|
1097
|
-
|
|
1097
|
+
k(!1), a?.(L);
|
|
1098
1098
|
},
|
|
1099
1099
|
onPaymentError: (L) => {
|
|
1100
|
-
|
|
1100
|
+
k(!1), o?.(L);
|
|
1101
1101
|
},
|
|
1102
1102
|
onStripeSuccess: (L) => {
|
|
1103
|
-
|
|
1103
|
+
k(!1), u?.(L);
|
|
1104
1104
|
},
|
|
1105
1105
|
onCryptoSuccess: (L) => {
|
|
1106
|
-
|
|
1106
|
+
k(!1), d?.(L);
|
|
1107
1107
|
},
|
|
1108
1108
|
onCreditsSuccess: (L) => {
|
|
1109
|
-
|
|
1109
|
+
k(!1), i?.(L);
|
|
1110
1110
|
},
|
|
1111
1111
|
onStripeError: (L) => {
|
|
1112
|
-
|
|
1112
|
+
k(!1), p?.(L);
|
|
1113
1113
|
},
|
|
1114
1114
|
onCryptoError: (L) => {
|
|
1115
|
-
|
|
1115
|
+
k(!1), m?.(L);
|
|
1116
1116
|
},
|
|
1117
1117
|
onCreditsError: (L) => {
|
|
1118
|
-
|
|
1118
|
+
k(!1), h?.(L);
|
|
1119
1119
|
},
|
|
1120
1120
|
customerEmail: y,
|
|
1121
|
-
successUrl:
|
|
1122
|
-
cancelUrl:
|
|
1123
|
-
metadata:
|
|
1124
|
-
couponCode:
|
|
1125
|
-
authToken:
|
|
1126
|
-
testPageUrl:
|
|
1121
|
+
successUrl: I,
|
|
1122
|
+
cancelUrl: v,
|
|
1123
|
+
metadata: P,
|
|
1124
|
+
couponCode: N,
|
|
1125
|
+
authToken: A,
|
|
1126
|
+
testPageUrl: q,
|
|
1127
1127
|
hideMessages: D
|
|
1128
1128
|
};
|
|
1129
|
-
return /* @__PURE__ */ S("div", { className:
|
|
1129
|
+
return /* @__PURE__ */ S("div", { className: E.unstyled ? "" : E.className, style: E.unstyled ? {} : E.style, children: [
|
|
1130
1130
|
/* @__PURE__ */ f(
|
|
1131
1131
|
"button",
|
|
1132
1132
|
{
|
|
1133
1133
|
onClick: Le,
|
|
1134
1134
|
disabled: ce,
|
|
1135
|
-
className:
|
|
1135
|
+
className: E.unstyled ? "" : "cedros-theme__button cedros-theme__stripe",
|
|
1136
1136
|
style: {
|
|
1137
1137
|
width: "100%",
|
|
1138
1138
|
cursor: ce ? "not-allowed" : "pointer",
|
|
@@ -1142,7 +1142,7 @@ const tt = q.lazy(
|
|
|
1142
1142
|
children: ce ? B("ui.processing") : H
|
|
1143
1143
|
}
|
|
1144
1144
|
),
|
|
1145
|
-
|
|
1145
|
+
w ? w(xe) : /* @__PURE__ */ f(rt, { ...xe })
|
|
1146
1146
|
] });
|
|
1147
1147
|
}, st = {
|
|
1148
1148
|
"mainnet-beta": "https://api.mainnet-beta.solana.com",
|
|
@@ -1150,8 +1150,8 @@ const tt = q.lazy(
|
|
|
1150
1150
|
testnet: "https://api.testnet.solana.com"
|
|
1151
1151
|
};
|
|
1152
1152
|
function ot() {
|
|
1153
|
-
const [e, t] =
|
|
1154
|
-
return
|
|
1153
|
+
const [e, t] = U.useState(null);
|
|
1154
|
+
return U.useEffect(() => {
|
|
1155
1155
|
let r = !1;
|
|
1156
1156
|
return import("@solana/wallet-adapter-react").then((n) => {
|
|
1157
1157
|
r || t(n);
|
|
@@ -1167,51 +1167,51 @@ function at({
|
|
|
1167
1167
|
}) {
|
|
1168
1168
|
const n = ot();
|
|
1169
1169
|
if (!n) return /* @__PURE__ */ f(me, { children: r });
|
|
1170
|
-
const { ConnectionProvider: s, WalletProvider:
|
|
1171
|
-
return /* @__PURE__ */ f(s, { endpoint: e, children: /* @__PURE__ */ f(
|
|
1170
|
+
const { ConnectionProvider: s, WalletProvider: l } = n;
|
|
1171
|
+
return /* @__PURE__ */ f(s, { endpoint: e, children: /* @__PURE__ */ f(l, { wallets: t, autoConnect: !1, children: r }) });
|
|
1172
1172
|
}
|
|
1173
|
-
const it =
|
|
1174
|
-
() => import("./CryptoButton-
|
|
1173
|
+
const it = U.lazy(
|
|
1174
|
+
() => import("./CryptoButton-BV9owVe2.mjs").then((e) => e.a).then((e) => ({ default: e.CryptoButton }))
|
|
1175
1175
|
);
|
|
1176
1176
|
function qt(e) {
|
|
1177
|
-
const { resource: t, items: r, checkout: n = {}, display: s = {}, callbacks:
|
|
1177
|
+
const { resource: t, items: r, checkout: n = {}, display: s = {}, callbacks: l = {}, advanced: g = {} } = e, { config: C, walletPool: b } = re(), c = V(), { isCartMode: a } = he(t, r), o = s.showCrypto ?? !0, u = U.useMemo(() => ({
|
|
1178
1178
|
marginTop: "0.5rem",
|
|
1179
1179
|
fontSize: "0.875rem",
|
|
1180
1180
|
color: c.tokens.surfaceText,
|
|
1181
1181
|
opacity: 0.7,
|
|
1182
1182
|
textAlign: "center"
|
|
1183
|
-
}), [c.tokens.surfaceText]),
|
|
1184
|
-
() => o ? g.wallets && g.wallets.length > 0 ? g.wallets :
|
|
1185
|
-
[g.wallets,
|
|
1186
|
-
),
|
|
1183
|
+
}), [c.tokens.surfaceText]), d = U.useMemo(
|
|
1184
|
+
() => o ? g.wallets && g.wallets.length > 0 ? g.wallets : b.getAdapters() : [],
|
|
1185
|
+
[g.wallets, b, o]
|
|
1186
|
+
), i = U.useMemo(
|
|
1187
1187
|
() => r ? ge(r) : 0,
|
|
1188
1188
|
[r]
|
|
1189
|
-
), { onPaymentSuccess: p, onPaymentError: m, onPaymentAttempt:
|
|
1189
|
+
), { onPaymentSuccess: p, onPaymentError: m, onPaymentAttempt: h } = l, y = U.useCallback(
|
|
1190
1190
|
(x) => p?.({ transactionId: x, method: "stripe" }),
|
|
1191
1191
|
[p]
|
|
1192
|
-
),
|
|
1192
|
+
), I = U.useCallback(
|
|
1193
1193
|
(x) => p?.({ transactionId: x, method: "crypto" }),
|
|
1194
1194
|
[p]
|
|
1195
|
-
),
|
|
1195
|
+
), v = U.useCallback(
|
|
1196
1196
|
(x) => m?.({ message: x, method: "stripe" }),
|
|
1197
1197
|
[m]
|
|
1198
|
-
),
|
|
1198
|
+
), P = U.useCallback(
|
|
1199
1199
|
(x) => m?.({ message: x, method: "crypto" }),
|
|
1200
1200
|
[m]
|
|
1201
|
-
),
|
|
1201
|
+
), N = U.useCallback(
|
|
1202
1202
|
(x) => p?.({ transactionId: x, method: "credits" }),
|
|
1203
1203
|
[p]
|
|
1204
|
-
),
|
|
1204
|
+
), A = U.useCallback(
|
|
1205
1205
|
(x) => m?.({ message: x, method: "credits" }),
|
|
1206
1206
|
[m]
|
|
1207
|
-
), z =
|
|
1208
|
-
() =>
|
|
1209
|
-
[
|
|
1210
|
-
),
|
|
1207
|
+
), z = U.useCallback(
|
|
1208
|
+
() => h?.("credits"),
|
|
1209
|
+
[h]
|
|
1210
|
+
), q = o ? C.solanaEndpoint ?? st[C.solanaCluster] : "";
|
|
1211
1211
|
if (!t && (!r || r.length === 0))
|
|
1212
1212
|
return j().error('CedrosPay: Must provide either "resource" or "items" prop'), /* @__PURE__ */ f("div", { className: s.className, style: { color: c.tokens.errorText }, children: "Configuration error: No resource or items provided" });
|
|
1213
|
-
const D = s.showCard ?? !0,
|
|
1214
|
-
|
|
1213
|
+
const D = s.showCard ?? !0, w = s.showCredits ?? !1, E = s.showPurchaseButton ?? !1, $ = s.layout ?? "vertical", k = s.hideMessages ?? !1, T = g.autoDetectWallets ?? !0, M = /* @__PURE__ */ f("div", { className: c.unstyled ? s.className : `cedros-theme__pay ${s.className || ""}`, children: /* @__PURE__ */ S("div", { className: c.unstyled ? "" : `cedros-theme__pay-content cedros-theme__pay-content--${$}`, children: [
|
|
1214
|
+
E ? /* @__PURE__ */ f(
|
|
1215
1215
|
nt,
|
|
1216
1216
|
{
|
|
1217
1217
|
resource: a ? void 0 : t || r?.[0]?.resource,
|
|
@@ -1221,21 +1221,21 @@ function qt(e) {
|
|
|
1221
1221
|
cryptoLabel: s.cryptoLabel,
|
|
1222
1222
|
showCard: D,
|
|
1223
1223
|
showCrypto: o,
|
|
1224
|
-
onPaymentAttempt:
|
|
1224
|
+
onPaymentAttempt: l.onPaymentAttempt,
|
|
1225
1225
|
onPaymentSuccess: y,
|
|
1226
|
-
onPaymentError:
|
|
1226
|
+
onPaymentError: v,
|
|
1227
1227
|
onStripeSuccess: y,
|
|
1228
|
-
onCryptoSuccess:
|
|
1229
|
-
onStripeError:
|
|
1230
|
-
onCryptoError:
|
|
1228
|
+
onCryptoSuccess: I,
|
|
1229
|
+
onStripeError: v,
|
|
1230
|
+
onCryptoError: P,
|
|
1231
1231
|
customerEmail: n.customerEmail,
|
|
1232
1232
|
successUrl: n.successUrl,
|
|
1233
1233
|
cancelUrl: n.cancelUrl,
|
|
1234
1234
|
metadata: n.metadata,
|
|
1235
1235
|
couponCode: n.couponCode,
|
|
1236
|
-
autoDetectWallets:
|
|
1236
|
+
autoDetectWallets: T,
|
|
1237
1237
|
testPageUrl: g.testPageUrl,
|
|
1238
|
-
hideMessages:
|
|
1238
|
+
hideMessages: k,
|
|
1239
1239
|
renderModal: s.renderModal
|
|
1240
1240
|
}
|
|
1241
1241
|
) : /* @__PURE__ */ S(me, { children: [
|
|
@@ -1250,12 +1250,12 @@ function qt(e) {
|
|
|
1250
1250
|
metadata: n.metadata,
|
|
1251
1251
|
couponCode: n.couponCode,
|
|
1252
1252
|
label: s.cardLabel,
|
|
1253
|
-
onAttempt:
|
|
1253
|
+
onAttempt: l.onPaymentAttempt,
|
|
1254
1254
|
onSuccess: y,
|
|
1255
|
-
onError:
|
|
1255
|
+
onError: v
|
|
1256
1256
|
}
|
|
1257
1257
|
),
|
|
1258
|
-
o && /* @__PURE__ */ f(
|
|
1258
|
+
o && /* @__PURE__ */ f(U.Suspense, { fallback: null, children: /* @__PURE__ */ f(
|
|
1259
1259
|
it,
|
|
1260
1260
|
{
|
|
1261
1261
|
resource: a ? void 0 : t || r?.[0]?.resource,
|
|
@@ -1263,14 +1263,14 @@ function qt(e) {
|
|
|
1263
1263
|
metadata: n.metadata,
|
|
1264
1264
|
couponCode: n.couponCode,
|
|
1265
1265
|
label: s.cryptoLabel,
|
|
1266
|
-
onAttempt:
|
|
1267
|
-
onSuccess:
|
|
1268
|
-
onError:
|
|
1266
|
+
onAttempt: l.onPaymentAttempt,
|
|
1267
|
+
onSuccess: I,
|
|
1268
|
+
onError: P,
|
|
1269
1269
|
testPageUrl: g.testPageUrl,
|
|
1270
|
-
hideMessages:
|
|
1270
|
+
hideMessages: k
|
|
1271
1271
|
}
|
|
1272
1272
|
) }),
|
|
1273
|
-
|
|
1273
|
+
w && /* @__PURE__ */ f(
|
|
1274
1274
|
Te,
|
|
1275
1275
|
{
|
|
1276
1276
|
resource: a ? void 0 : t || r?.[0]?.resource,
|
|
@@ -1280,18 +1280,18 @@ function qt(e) {
|
|
|
1280
1280
|
couponCode: n.couponCode,
|
|
1281
1281
|
label: s.creditsLabel,
|
|
1282
1282
|
onAttempt: z,
|
|
1283
|
-
onSuccess:
|
|
1284
|
-
onError:
|
|
1283
|
+
onSuccess: N,
|
|
1284
|
+
onError: A
|
|
1285
1285
|
}
|
|
1286
1286
|
)
|
|
1287
1287
|
] }),
|
|
1288
|
-
a && r && r.length > 1 && !
|
|
1288
|
+
a && r && r.length > 1 && !k && /* @__PURE__ */ S("div", { style: u, children: [
|
|
1289
1289
|
"Checking out ",
|
|
1290
|
-
|
|
1290
|
+
i,
|
|
1291
1291
|
" items"
|
|
1292
1292
|
] })
|
|
1293
1293
|
] }) });
|
|
1294
|
-
return /* @__PURE__ */ f("div", { className: c.unstyled ? s.className : c.className, style: c.unstyled ? {} : c.style, children: /* @__PURE__ */ f(at, { endpoint:
|
|
1294
|
+
return /* @__PURE__ */ f("div", { className: c.unstyled ? s.className : c.className, style: c.unstyled ? {} : c.style, children: /* @__PURE__ */ f(at, { endpoint: q || "https://api.devnet.solana.com", wallets: d, children: M }) });
|
|
1295
1295
|
}
|
|
1296
1296
|
function zt({
|
|
1297
1297
|
product: e,
|
|
@@ -1300,7 +1300,7 @@ function zt({
|
|
|
1300
1300
|
className: n = "",
|
|
1301
1301
|
style: s = {}
|
|
1302
1302
|
}) {
|
|
1303
|
-
const
|
|
1303
|
+
const l = t === "stripe", g = l ? e.fiatAmount : e.cryptoAmount, C = l ? e.effectiveFiatAmount : e.effectiveCryptoAmount, b = l ? e.fiatCurrency.toUpperCase() : e.cryptoToken, c = l ? e.hasStripeCoupon : e.hasCryptoCoupon, a = l ? e.stripeDiscountPercent : e.cryptoDiscountPercent;
|
|
1304
1304
|
return /* @__PURE__ */ S("div", { className: n, style: s, children: [
|
|
1305
1305
|
r && c && /* @__PURE__ */ S(
|
|
1306
1306
|
"span",
|
|
@@ -1314,14 +1314,14 @@ function zt({
|
|
|
1314
1314
|
children: [
|
|
1315
1315
|
g.toFixed(2),
|
|
1316
1316
|
" ",
|
|
1317
|
-
|
|
1317
|
+
b
|
|
1318
1318
|
]
|
|
1319
1319
|
}
|
|
1320
1320
|
),
|
|
1321
1321
|
/* @__PURE__ */ S("span", { style: { fontWeight: 600 }, children: [
|
|
1322
|
-
|
|
1322
|
+
C.toFixed(2),
|
|
1323
1323
|
" ",
|
|
1324
|
-
|
|
1324
|
+
b
|
|
1325
1325
|
] }),
|
|
1326
1326
|
c && a > 0 && /* @__PURE__ */ S(
|
|
1327
1327
|
"span",
|
|
@@ -1349,10 +1349,10 @@ function Ut({
|
|
|
1349
1349
|
className: r = "",
|
|
1350
1350
|
style: n = {}
|
|
1351
1351
|
}) {
|
|
1352
|
-
const s = t === "stripe",
|
|
1353
|
-
if (!
|
|
1352
|
+
const s = t === "stripe", l = s ? e.hasStripeCoupon : e.hasCryptoCoupon, g = s ? e.stripeDiscountPercent : e.cryptoDiscountPercent, C = s ? e.stripeCouponCode : e.cryptoCouponCode;
|
|
1353
|
+
if (!l || g === 0)
|
|
1354
1354
|
return null;
|
|
1355
|
-
const
|
|
1355
|
+
const b = s ? `${g}% off with card!` : `${g}% off with crypto!`;
|
|
1356
1356
|
return /* @__PURE__ */ S(
|
|
1357
1357
|
"div",
|
|
1358
1358
|
{
|
|
@@ -1369,8 +1369,8 @@ function Ut({
|
|
|
1369
1369
|
...n
|
|
1370
1370
|
},
|
|
1371
1371
|
children: [
|
|
1372
|
-
|
|
1373
|
-
|
|
1372
|
+
b,
|
|
1373
|
+
C && /* @__PURE__ */ S(
|
|
1374
1374
|
"span",
|
|
1375
1375
|
{
|
|
1376
1376
|
style: {
|
|
@@ -1381,7 +1381,7 @@ function Ut({
|
|
|
1381
1381
|
},
|
|
1382
1382
|
children: [
|
|
1383
1383
|
"(",
|
|
1384
|
-
|
|
1384
|
+
C,
|
|
1385
1385
|
")"
|
|
1386
1386
|
]
|
|
1387
1387
|
}
|
|
@@ -1397,8 +1397,8 @@ function ct() {
|
|
|
1397
1397
|
sessionId: null,
|
|
1398
1398
|
subscriptionStatus: null,
|
|
1399
1399
|
expiresAt: null
|
|
1400
|
-
}), n = X(!1), s =
|
|
1401
|
-
async (
|
|
1400
|
+
}), n = X(!1), s = R(
|
|
1401
|
+
async (b) => {
|
|
1402
1402
|
if (n.current)
|
|
1403
1403
|
return { success: !1, error: "Payment already in progress" };
|
|
1404
1404
|
n.current = !0, r((c) => ({
|
|
@@ -1407,7 +1407,7 @@ function ct() {
|
|
|
1407
1407
|
error: null
|
|
1408
1408
|
}));
|
|
1409
1409
|
try {
|
|
1410
|
-
const c = await e.processSubscription(
|
|
1410
|
+
const c = await e.processSubscription(b);
|
|
1411
1411
|
return r((a) => ({
|
|
1412
1412
|
...a,
|
|
1413
1413
|
status: c.success ? "success" : "error",
|
|
@@ -1426,15 +1426,15 @@ function ct() {
|
|
|
1426
1426
|
}
|
|
1427
1427
|
},
|
|
1428
1428
|
[e]
|
|
1429
|
-
),
|
|
1430
|
-
async (
|
|
1429
|
+
), l = R(
|
|
1430
|
+
async (b) => {
|
|
1431
1431
|
r((c) => ({
|
|
1432
1432
|
...c,
|
|
1433
1433
|
status: "checking",
|
|
1434
1434
|
error: null
|
|
1435
1435
|
}));
|
|
1436
1436
|
try {
|
|
1437
|
-
const c = await e.checkSubscriptionStatus(
|
|
1437
|
+
const c = await e.checkSubscriptionStatus(b);
|
|
1438
1438
|
return r((a) => ({
|
|
1439
1439
|
...a,
|
|
1440
1440
|
status: c.active ? "success" : "idle",
|
|
@@ -1451,8 +1451,8 @@ function ct() {
|
|
|
1451
1451
|
}
|
|
1452
1452
|
},
|
|
1453
1453
|
[e]
|
|
1454
|
-
), g =
|
|
1455
|
-
async (
|
|
1454
|
+
), g = R(
|
|
1455
|
+
async (b, c, a) => {
|
|
1456
1456
|
r((o) => ({
|
|
1457
1457
|
...o,
|
|
1458
1458
|
status: "loading",
|
|
@@ -1460,25 +1460,25 @@ function ct() {
|
|
|
1460
1460
|
}));
|
|
1461
1461
|
try {
|
|
1462
1462
|
const o = await e.requestSubscriptionQuote(
|
|
1463
|
-
|
|
1463
|
+
b,
|
|
1464
1464
|
c,
|
|
1465
1465
|
a
|
|
1466
1466
|
);
|
|
1467
|
-
return r((
|
|
1468
|
-
...
|
|
1467
|
+
return r((u) => ({
|
|
1468
|
+
...u,
|
|
1469
1469
|
status: "idle"
|
|
1470
1470
|
})), o;
|
|
1471
1471
|
} catch (o) {
|
|
1472
|
-
const
|
|
1473
|
-
throw r((
|
|
1474
|
-
...
|
|
1472
|
+
const u = o instanceof Error ? o.message : "Failed to get subscription quote";
|
|
1473
|
+
throw r((d) => ({
|
|
1474
|
+
...d,
|
|
1475
1475
|
status: "error",
|
|
1476
|
-
error:
|
|
1476
|
+
error: u
|
|
1477
1477
|
})), o;
|
|
1478
1478
|
}
|
|
1479
1479
|
},
|
|
1480
1480
|
[e]
|
|
1481
|
-
),
|
|
1481
|
+
), C = R(() => {
|
|
1482
1482
|
r({
|
|
1483
1483
|
status: "idle",
|
|
1484
1484
|
error: null,
|
|
@@ -1490,9 +1490,9 @@ function ct() {
|
|
|
1490
1490
|
return {
|
|
1491
1491
|
...t,
|
|
1492
1492
|
processSubscription: s,
|
|
1493
|
-
checkStatus:
|
|
1493
|
+
checkStatus: l,
|
|
1494
1494
|
requestQuote: g,
|
|
1495
|
-
reset:
|
|
1495
|
+
reset: C
|
|
1496
1496
|
};
|
|
1497
1497
|
}
|
|
1498
1498
|
function Ot({
|
|
@@ -1501,72 +1501,65 @@ function Ot({
|
|
|
1501
1501
|
intervalDays: r,
|
|
1502
1502
|
trialDays: n,
|
|
1503
1503
|
successUrl: s,
|
|
1504
|
-
cancelUrl:
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
onError: i,
|
|
1513
|
-
className: l = ""
|
|
1504
|
+
cancelUrl: l,
|
|
1505
|
+
customerEmail: g,
|
|
1506
|
+
label: C,
|
|
1507
|
+
disabled: b = !1,
|
|
1508
|
+
onAttempt: c,
|
|
1509
|
+
onSuccess: a,
|
|
1510
|
+
onError: o,
|
|
1511
|
+
className: u = ""
|
|
1514
1512
|
}) {
|
|
1515
|
-
const { status:
|
|
1516
|
-
if (!
|
|
1517
|
-
const
|
|
1518
|
-
return
|
|
1519
|
-
})(
|
|
1513
|
+
const { status: d, error: i, sessionId: p, processSubscription: m } = ct(), h = V(), { t: y, translations: I } = ne(), v = C || y("ui.subscribe"), P = h.unstyled ? u : `${h.className} cedros-theme__stripe-button ${u}`.trim(), N = i && typeof i != "string" ? i?.code ?? null : null, z = i ? typeof i == "string" ? i : ((k) => {
|
|
1514
|
+
if (!k || !I) return "";
|
|
1515
|
+
const T = I.errors[k];
|
|
1516
|
+
return T ? T.action ? `${T.message} ${T.action}` : T.message : "";
|
|
1517
|
+
})(N) : null, q = R(async () => {
|
|
1520
1518
|
j().debug("[SubscribeButton] executeSubscription:", {
|
|
1521
1519
|
resource: e,
|
|
1522
1520
|
interval: t,
|
|
1523
1521
|
intervalDays: r,
|
|
1524
|
-
trialDays: n
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
const v = await y({
|
|
1522
|
+
trialDays: n
|
|
1523
|
+
}), oe("stripe", e), c && c("stripe"), ae("stripe", e);
|
|
1524
|
+
const k = await m({
|
|
1528
1525
|
resource: e,
|
|
1529
1526
|
interval: t,
|
|
1530
1527
|
intervalDays: r,
|
|
1531
1528
|
trialDays: n,
|
|
1532
|
-
customerEmail:
|
|
1533
|
-
metadata: g,
|
|
1534
|
-
couponCode: h,
|
|
1529
|
+
customerEmail: g,
|
|
1535
1530
|
successUrl: s,
|
|
1536
|
-
cancelUrl:
|
|
1531
|
+
cancelUrl: l
|
|
1537
1532
|
});
|
|
1538
|
-
|
|
1533
|
+
k.success && k.transactionId ? (ie("stripe", k.transactionId, e), a && a(k.transactionId)) : !k.success && k.error && (Y("stripe", k.error, e), o && o(k.error));
|
|
1539
1534
|
}, [
|
|
1540
1535
|
e,
|
|
1541
1536
|
t,
|
|
1542
1537
|
r,
|
|
1543
1538
|
n,
|
|
1544
|
-
b,
|
|
1545
1539
|
g,
|
|
1546
|
-
h,
|
|
1547
1540
|
s,
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
]),
|
|
1554
|
-
() => se(
|
|
1555
|
-
[
|
|
1556
|
-
),
|
|
1557
|
-
return /* @__PURE__ */ S("div", { className:
|
|
1541
|
+
l,
|
|
1542
|
+
m,
|
|
1543
|
+
c,
|
|
1544
|
+
a,
|
|
1545
|
+
o
|
|
1546
|
+
]), D = W(() => `subscribe-${e}-${t}`, [e, t]), w = W(
|
|
1547
|
+
() => se(D, q),
|
|
1548
|
+
[D, q]
|
|
1549
|
+
), E = d === "loading", $ = b || E;
|
|
1550
|
+
return /* @__PURE__ */ S("div", { className: P, style: h.unstyled ? {} : h.style, children: [
|
|
1558
1551
|
/* @__PURE__ */ f(
|
|
1559
1552
|
"button",
|
|
1560
1553
|
{
|
|
1561
|
-
onClick:
|
|
1562
|
-
disabled:
|
|
1563
|
-
className:
|
|
1554
|
+
onClick: w,
|
|
1555
|
+
disabled: $,
|
|
1556
|
+
className: h.unstyled ? u : "cedros-theme__button cedros-theme__stripe",
|
|
1564
1557
|
type: "button",
|
|
1565
|
-
children:
|
|
1558
|
+
children: E ? y("ui.processing") : v
|
|
1566
1559
|
}
|
|
1567
1560
|
),
|
|
1568
|
-
|
|
1569
|
-
|
|
1561
|
+
z && /* @__PURE__ */ f("div", { className: h.unstyled ? "" : "cedros-theme__error", children: z }),
|
|
1562
|
+
p && /* @__PURE__ */ f("div", { className: h.unstyled ? "" : "cedros-theme__success", children: y("ui.redirecting_to_checkout") })
|
|
1570
1563
|
] });
|
|
1571
1564
|
}
|
|
1572
1565
|
function lt() {
|
|
@@ -1577,7 +1570,7 @@ function lt() {
|
|
|
1577
1570
|
subscriptionStatus: null,
|
|
1578
1571
|
expiresAt: null,
|
|
1579
1572
|
creditsRequirement: null
|
|
1580
|
-
}), s = X(!1),
|
|
1573
|
+
}), s = X(!1), l = R(
|
|
1581
1574
|
async (c, a) => {
|
|
1582
1575
|
n((o) => ({
|
|
1583
1576
|
...o,
|
|
@@ -1589,98 +1582,98 @@ function lt() {
|
|
|
1589
1582
|
resource: c,
|
|
1590
1583
|
userId: a
|
|
1591
1584
|
});
|
|
1592
|
-
return n((
|
|
1593
|
-
...
|
|
1585
|
+
return n((u) => ({
|
|
1586
|
+
...u,
|
|
1594
1587
|
status: o.active ? "success" : "idle",
|
|
1595
1588
|
subscriptionStatus: o.status,
|
|
1596
1589
|
expiresAt: o.expiresAt || o.currentPeriodEnd || null
|
|
1597
1590
|
})), o;
|
|
1598
1591
|
} catch (o) {
|
|
1599
|
-
const
|
|
1600
|
-
return n((
|
|
1601
|
-
...
|
|
1592
|
+
const u = pe(o, "Failed to check subscription status");
|
|
1593
|
+
return n((d) => ({
|
|
1594
|
+
...d,
|
|
1602
1595
|
status: "error",
|
|
1603
|
-
error:
|
|
1596
|
+
error: u
|
|
1604
1597
|
})), null;
|
|
1605
1598
|
}
|
|
1606
1599
|
},
|
|
1607
1600
|
[e]
|
|
1608
|
-
), g =
|
|
1601
|
+
), g = R(
|
|
1609
1602
|
async (c, a, o) => {
|
|
1610
|
-
n((
|
|
1611
|
-
...
|
|
1603
|
+
n((u) => ({
|
|
1604
|
+
...u,
|
|
1612
1605
|
status: "loading",
|
|
1613
1606
|
error: null
|
|
1614
1607
|
}));
|
|
1615
1608
|
try {
|
|
1616
|
-
const
|
|
1609
|
+
const u = await t.requestQuote(
|
|
1617
1610
|
c,
|
|
1618
1611
|
o?.couponCode
|
|
1619
1612
|
);
|
|
1613
|
+
return n((d) => ({
|
|
1614
|
+
...d,
|
|
1615
|
+
status: "idle",
|
|
1616
|
+
creditsRequirement: u
|
|
1617
|
+
})), u;
|
|
1618
|
+
} catch (u) {
|
|
1619
|
+
const d = pe(u, "Failed to get subscription quote");
|
|
1620
1620
|
return n((i) => ({
|
|
1621
1621
|
...i,
|
|
1622
|
-
status: "idle",
|
|
1623
|
-
creditsRequirement: d
|
|
1624
|
-
})), d;
|
|
1625
|
-
} catch (d) {
|
|
1626
|
-
const i = pe(d, "Failed to get subscription quote");
|
|
1627
|
-
return n((l) => ({
|
|
1628
|
-
...l,
|
|
1629
1622
|
status: "error",
|
|
1630
|
-
error:
|
|
1623
|
+
error: d
|
|
1631
1624
|
})), null;
|
|
1632
1625
|
}
|
|
1633
1626
|
},
|
|
1634
1627
|
[t]
|
|
1635
|
-
),
|
|
1636
|
-
async (c, a, o,
|
|
1628
|
+
), C = R(
|
|
1629
|
+
async (c, a, o, u) => {
|
|
1637
1630
|
if (s.current)
|
|
1638
1631
|
return { success: !1, error: "Payment already in progress" };
|
|
1639
1632
|
if (!o) {
|
|
1640
|
-
const
|
|
1641
|
-
return n((
|
|
1633
|
+
const d = "Authentication required for credits payment";
|
|
1634
|
+
return n((i) => ({ ...i, status: "error", error: d })), { success: !1, error: d };
|
|
1642
1635
|
}
|
|
1643
|
-
s.current = !0, n((
|
|
1644
|
-
...
|
|
1636
|
+
s.current = !0, n((d) => ({
|
|
1637
|
+
...d,
|
|
1645
1638
|
status: "loading",
|
|
1646
1639
|
error: null
|
|
1647
1640
|
}));
|
|
1648
1641
|
try {
|
|
1649
|
-
const
|
|
1642
|
+
const d = await t.processPayment(
|
|
1650
1643
|
c,
|
|
1651
1644
|
o,
|
|
1652
|
-
|
|
1645
|
+
u?.couponCode,
|
|
1653
1646
|
{
|
|
1654
1647
|
interval: a,
|
|
1655
|
-
...
|
|
1648
|
+
...u?.intervalDays && { intervalDays: String(u.intervalDays) }
|
|
1656
1649
|
}
|
|
1657
1650
|
);
|
|
1658
|
-
return
|
|
1651
|
+
return d.success ? n({
|
|
1659
1652
|
status: "success",
|
|
1660
1653
|
error: null,
|
|
1661
|
-
sessionId:
|
|
1654
|
+
sessionId: d.transactionId || null,
|
|
1662
1655
|
subscriptionStatus: "active",
|
|
1663
1656
|
expiresAt: null,
|
|
1664
1657
|
// Will be updated on next status check
|
|
1665
1658
|
creditsRequirement: null
|
|
1666
|
-
}) : n((
|
|
1667
|
-
...
|
|
1659
|
+
}) : n((i) => ({
|
|
1660
|
+
...i,
|
|
1668
1661
|
status: "error",
|
|
1669
|
-
error:
|
|
1670
|
-
})),
|
|
1671
|
-
} catch (
|
|
1672
|
-
const
|
|
1662
|
+
error: d.error || "Credits subscription payment failed"
|
|
1663
|
+
})), d;
|
|
1664
|
+
} catch (d) {
|
|
1665
|
+
const i = pe(d, "Credits subscription payment failed");
|
|
1673
1666
|
return n((p) => ({
|
|
1674
1667
|
...p,
|
|
1675
1668
|
status: "error",
|
|
1676
|
-
error:
|
|
1677
|
-
})), { success: !1, error:
|
|
1669
|
+
error: i
|
|
1670
|
+
})), { success: !1, error: i };
|
|
1678
1671
|
} finally {
|
|
1679
1672
|
s.current = !1;
|
|
1680
1673
|
}
|
|
1681
1674
|
},
|
|
1682
1675
|
[t]
|
|
1683
|
-
),
|
|
1676
|
+
), b = R(() => {
|
|
1684
1677
|
n({
|
|
1685
1678
|
status: "idle",
|
|
1686
1679
|
error: null,
|
|
@@ -1692,59 +1685,59 @@ function lt() {
|
|
|
1692
1685
|
}, []);
|
|
1693
1686
|
return {
|
|
1694
1687
|
...r,
|
|
1695
|
-
checkStatus:
|
|
1688
|
+
checkStatus: l,
|
|
1696
1689
|
requestQuote: g,
|
|
1697
|
-
processPayment:
|
|
1698
|
-
reset:
|
|
1690
|
+
processPayment: C,
|
|
1691
|
+
reset: b
|
|
1699
1692
|
};
|
|
1700
1693
|
}
|
|
1701
|
-
function
|
|
1694
|
+
function Wt({
|
|
1702
1695
|
resource: e,
|
|
1703
1696
|
interval: t,
|
|
1704
1697
|
intervalDays: r,
|
|
1705
1698
|
authToken: n,
|
|
1706
1699
|
userId: s,
|
|
1707
|
-
couponCode:
|
|
1700
|
+
couponCode: l,
|
|
1708
1701
|
label: g,
|
|
1709
|
-
disabled:
|
|
1710
|
-
onAttempt:
|
|
1702
|
+
disabled: C = !1,
|
|
1703
|
+
onAttempt: b,
|
|
1711
1704
|
onSuccess: c,
|
|
1712
1705
|
onError: a,
|
|
1713
1706
|
className: o = "",
|
|
1714
|
-
hideMessages:
|
|
1715
|
-
autoCheckStatus:
|
|
1707
|
+
hideMessages: u = !1,
|
|
1708
|
+
autoCheckStatus: d = !1
|
|
1716
1709
|
}) {
|
|
1717
1710
|
const {
|
|
1718
|
-
status:
|
|
1711
|
+
status: i,
|
|
1719
1712
|
error: p,
|
|
1720
1713
|
subscriptionStatus: m,
|
|
1721
|
-
expiresAt:
|
|
1714
|
+
expiresAt: h,
|
|
1722
1715
|
checkStatus: y,
|
|
1723
|
-
processPayment:
|
|
1724
|
-
} = lt(),
|
|
1716
|
+
processPayment: I
|
|
1717
|
+
} = lt(), v = V(), { t: P, translations: N } = ne(), A = X(y);
|
|
1725
1718
|
te(() => {
|
|
1726
|
-
|
|
1719
|
+
A.current = y;
|
|
1727
1720
|
}, [y]), te(() => {
|
|
1728
|
-
|
|
1729
|
-
}, [
|
|
1730
|
-
const z = g ||
|
|
1731
|
-
if (!B || !
|
|
1732
|
-
const H =
|
|
1721
|
+
d && s && (j().debug("[CreditsSubscribeButton] Auto-checking subscription status", { resource: e, userId: s }), A.current(e, s));
|
|
1722
|
+
}, [d, s, e]);
|
|
1723
|
+
const z = g || P("ui.subscribe_with_credits") || "Subscribe with Credits", q = p && typeof p != "string" ? p?.code ?? null : null, w = p ? typeof p == "string" ? p : ((B) => {
|
|
1724
|
+
if (!B || !N) return "";
|
|
1725
|
+
const H = N.errors[B];
|
|
1733
1726
|
return H ? H.action ? `${H.message} ${H.action}` : H.message : "";
|
|
1734
|
-
})(
|
|
1727
|
+
})(q) : null, E = R(async () => {
|
|
1735
1728
|
if (j().debug("[CreditsSubscribeButton] executeSubscriptionFlow", {
|
|
1736
1729
|
resource: e,
|
|
1737
1730
|
interval: t,
|
|
1738
1731
|
intervalDays: r,
|
|
1739
1732
|
hasAuthToken: !!n
|
|
1740
|
-
}), oe("credits", e),
|
|
1733
|
+
}), oe("credits", e), b && b("credits"), !n) {
|
|
1741
1734
|
const H = "Authentication required: please log in to subscribe with credits";
|
|
1742
1735
|
j().error("[CreditsSubscribeButton]", H), Y("credits", H, e), a && a(H);
|
|
1743
1736
|
return;
|
|
1744
1737
|
}
|
|
1745
1738
|
ae("credits", e);
|
|
1746
|
-
const B = await
|
|
1747
|
-
couponCode:
|
|
1739
|
+
const B = await I(e, t, n, {
|
|
1740
|
+
couponCode: l,
|
|
1748
1741
|
intervalDays: r
|
|
1749
1742
|
});
|
|
1750
1743
|
B.success && B.transactionId ? (ie("credits", B.transactionId, e), c && c(B.transactionId)) : !B.success && B.error && (Y("credits", B.error, e), a && a(B.error));
|
|
@@ -1753,39 +1746,39 @@ function Ft({
|
|
|
1753
1746
|
t,
|
|
1754
1747
|
r,
|
|
1755
1748
|
n,
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1749
|
+
l,
|
|
1750
|
+
I,
|
|
1751
|
+
b,
|
|
1759
1752
|
c,
|
|
1760
1753
|
a
|
|
1761
|
-
]),
|
|
1762
|
-
() => se(
|
|
1754
|
+
]), $ = W(() => `credits-subscribe-${e}-${t}`, [e, t]), k = W(
|
|
1755
|
+
() => se($, E, {
|
|
1763
1756
|
cooldownMs: 200,
|
|
1764
1757
|
deduplicationWindowMs: 0
|
|
1765
1758
|
}),
|
|
1766
|
-
[
|
|
1767
|
-
),
|
|
1768
|
-
let
|
|
1769
|
-
if (
|
|
1770
|
-
|
|
1771
|
-
else if (
|
|
1772
|
-
const B = new Date(
|
|
1773
|
-
|
|
1774
|
-
} else
|
|
1775
|
-
const
|
|
1776
|
-
return /* @__PURE__ */ S("div", { className:
|
|
1759
|
+
[$, E]
|
|
1760
|
+
), T = i === "loading" || i === "checking", M = m === "active" || m === "trialing", x = C || T || M;
|
|
1761
|
+
let _ = z;
|
|
1762
|
+
if (T)
|
|
1763
|
+
_ = P("ui.processing");
|
|
1764
|
+
else if (M && h) {
|
|
1765
|
+
const B = new Date(h).toLocaleDateString();
|
|
1766
|
+
_ = `${P("ui.subscribed_until")} ${B}`;
|
|
1767
|
+
} else M && (_ = P("ui.subscribed"));
|
|
1768
|
+
const F = v.unstyled ? o : `${v.className} cedros-theme__credits-button ${o}`.trim();
|
|
1769
|
+
return /* @__PURE__ */ S("div", { className: F, style: v.unstyled ? {} : v.style, children: [
|
|
1777
1770
|
/* @__PURE__ */ f(
|
|
1778
1771
|
"button",
|
|
1779
1772
|
{
|
|
1780
|
-
onClick:
|
|
1773
|
+
onClick: k,
|
|
1781
1774
|
disabled: x,
|
|
1782
|
-
className:
|
|
1775
|
+
className: v.unstyled ? o : "cedros-theme__button cedros-theme__credits",
|
|
1783
1776
|
type: "button",
|
|
1784
|
-
children:
|
|
1777
|
+
children: _
|
|
1785
1778
|
}
|
|
1786
1779
|
),
|
|
1787
|
-
!
|
|
1788
|
-
!
|
|
1780
|
+
!u && w && /* @__PURE__ */ f("div", { className: v.unstyled ? "" : "cedros-theme__error", children: w }),
|
|
1781
|
+
!u && M && /* @__PURE__ */ f("div", { className: v.unstyled ? "" : "cedros-theme__success", children: P("ui.subscription_active") })
|
|
1789
1782
|
] });
|
|
1790
1783
|
}
|
|
1791
1784
|
function ut() {
|
|
@@ -1797,67 +1790,65 @@ function ut() {
|
|
|
1797
1790
|
userId: null
|
|
1798
1791
|
}), n = X(t);
|
|
1799
1792
|
n.current = t;
|
|
1800
|
-
const s =
|
|
1801
|
-
async (o,
|
|
1802
|
-
r((
|
|
1793
|
+
const s = R(
|
|
1794
|
+
async (o, u) => {
|
|
1795
|
+
r((d) => ({ ...d, status: "loading", error: null }));
|
|
1803
1796
|
try {
|
|
1804
|
-
const
|
|
1805
|
-
return r((
|
|
1806
|
-
...
|
|
1797
|
+
const d = await e.getDetails(o, u);
|
|
1798
|
+
return r((i) => ({
|
|
1799
|
+
...i,
|
|
1807
1800
|
status: "success",
|
|
1808
|
-
subscription:
|
|
1809
|
-
userId:
|
|
1810
|
-
})),
|
|
1811
|
-
} catch (
|
|
1812
|
-
const
|
|
1813
|
-
return r((p) => ({ ...p, status: "error", error:
|
|
1801
|
+
subscription: d,
|
|
1802
|
+
userId: u
|
|
1803
|
+
})), d;
|
|
1804
|
+
} catch (d) {
|
|
1805
|
+
const i = d instanceof Error ? d.message : "Failed to load subscription";
|
|
1806
|
+
return r((p) => ({ ...p, status: "error", error: i })), null;
|
|
1814
1807
|
}
|
|
1815
1808
|
},
|
|
1816
1809
|
[e]
|
|
1817
|
-
),
|
|
1818
|
-
async (o, d, i
|
|
1810
|
+
), l = R(
|
|
1811
|
+
async (o, u, d, i) => {
|
|
1819
1812
|
r((p) => ({ ...p, status: "loading", error: null }));
|
|
1820
1813
|
try {
|
|
1821
1814
|
const p = {
|
|
1822
1815
|
currentResource: o,
|
|
1823
|
-
newResource:
|
|
1824
|
-
userId:
|
|
1825
|
-
newInterval:
|
|
1816
|
+
newResource: u,
|
|
1817
|
+
userId: d,
|
|
1818
|
+
newInterval: i
|
|
1826
1819
|
}, m = await e.previewChange(p);
|
|
1827
|
-
return r((
|
|
1828
|
-
...
|
|
1820
|
+
return r((h) => ({
|
|
1821
|
+
...h,
|
|
1829
1822
|
status: "idle",
|
|
1830
1823
|
changePreview: m
|
|
1831
1824
|
})), m;
|
|
1832
1825
|
} catch (p) {
|
|
1833
1826
|
const m = p instanceof Error ? p.message : "Failed to preview change";
|
|
1834
|
-
return r((
|
|
1827
|
+
return r((h) => ({ ...h, status: "error", error: m })), null;
|
|
1835
1828
|
}
|
|
1836
1829
|
},
|
|
1837
1830
|
[e]
|
|
1838
|
-
), g =
|
|
1831
|
+
), g = R(
|
|
1839
1832
|
async (o) => {
|
|
1840
|
-
const { subscription:
|
|
1841
|
-
if (!
|
|
1842
|
-
return r((
|
|
1843
|
-
r((
|
|
1833
|
+
const { subscription: u, userId: d } = n.current;
|
|
1834
|
+
if (!u || !d)
|
|
1835
|
+
return r((i) => ({ ...i, status: "error", error: "No subscription loaded" })), null;
|
|
1836
|
+
r((i) => ({ ...i, status: "loading", error: null }));
|
|
1844
1837
|
try {
|
|
1845
|
-
const
|
|
1846
|
-
|
|
1838
|
+
const i = {
|
|
1839
|
+
subscriptionId: u.id,
|
|
1847
1840
|
newResource: o.newResource,
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
prorationBehavior: o.prorationBehavior,
|
|
1851
|
-
immediate: o.immediate
|
|
1852
|
-
}, p = await e.changeSubscription(l);
|
|
1841
|
+
prorationBehavior: o.prorationBehavior
|
|
1842
|
+
}, p = await e.changeSubscription(i);
|
|
1853
1843
|
return p.success ? r((m) => ({
|
|
1854
1844
|
...m,
|
|
1855
1845
|
status: "success",
|
|
1856
1846
|
subscription: m.subscription ? {
|
|
1857
1847
|
...m.subscription,
|
|
1858
1848
|
resource: p.newResource,
|
|
1859
|
-
interval:
|
|
1860
|
-
status: p.status
|
|
1849
|
+
interval: m.subscription.interval,
|
|
1850
|
+
status: p.status,
|
|
1851
|
+
currentPeriodEnd: p.currentPeriodEnd
|
|
1861
1852
|
} : null,
|
|
1862
1853
|
changePreview: null
|
|
1863
1854
|
})) : r((m) => ({
|
|
@@ -1865,33 +1856,32 @@ function ut() {
|
|
|
1865
1856
|
status: "error",
|
|
1866
1857
|
error: p.error || "Failed to change subscription"
|
|
1867
1858
|
})), p;
|
|
1868
|
-
} catch (
|
|
1869
|
-
const p =
|
|
1859
|
+
} catch (i) {
|
|
1860
|
+
const p = i instanceof Error ? i.message : "Failed to change subscription";
|
|
1870
1861
|
return r((m) => ({ ...m, status: "error", error: p })), null;
|
|
1871
1862
|
}
|
|
1872
1863
|
},
|
|
1873
1864
|
[e]
|
|
1874
|
-
),
|
|
1865
|
+
), C = R(
|
|
1875
1866
|
async (o) => {
|
|
1876
|
-
const { subscription:
|
|
1877
|
-
if (!
|
|
1878
|
-
return r((
|
|
1879
|
-
r((
|
|
1867
|
+
const { subscription: u, userId: d } = n.current;
|
|
1868
|
+
if (!u || !d)
|
|
1869
|
+
return r((i) => ({ ...i, status: "error", error: "No subscription loaded" })), null;
|
|
1870
|
+
r((i) => ({ ...i, status: "loading", error: null }));
|
|
1880
1871
|
try {
|
|
1881
|
-
const
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
}, p = await e.cancel(l);
|
|
1872
|
+
const i = {
|
|
1873
|
+
subscriptionId: u.id,
|
|
1874
|
+
atPeriodEnd: !o
|
|
1875
|
+
}, p = await e.cancel(i);
|
|
1886
1876
|
if (p.success) {
|
|
1887
|
-
const m =
|
|
1888
|
-
r((
|
|
1889
|
-
...
|
|
1877
|
+
const m = p.atPeriodEnd ? u.status : "canceled";
|
|
1878
|
+
r((h) => ({
|
|
1879
|
+
...h,
|
|
1890
1880
|
status: "success",
|
|
1891
|
-
subscription:
|
|
1892
|
-
...
|
|
1881
|
+
subscription: h.subscription ? {
|
|
1882
|
+
...h.subscription,
|
|
1893
1883
|
status: m,
|
|
1894
|
-
cancelAtPeriodEnd:
|
|
1884
|
+
cancelAtPeriodEnd: p.atPeriodEnd
|
|
1895
1885
|
} : null
|
|
1896
1886
|
}));
|
|
1897
1887
|
} else
|
|
@@ -1901,19 +1891,26 @@ function ut() {
|
|
|
1901
1891
|
error: p.error || "Failed to cancel subscription"
|
|
1902
1892
|
}));
|
|
1903
1893
|
return p;
|
|
1904
|
-
} catch (
|
|
1905
|
-
const p =
|
|
1894
|
+
} catch (i) {
|
|
1895
|
+
const p = i instanceof Error ? i.message : "Failed to cancel subscription";
|
|
1906
1896
|
return r((m) => ({ ...m, status: "error", error: p })), null;
|
|
1907
1897
|
}
|
|
1908
1898
|
},
|
|
1909
1899
|
[e]
|
|
1910
|
-
),
|
|
1911
|
-
async (o,
|
|
1900
|
+
), b = R(
|
|
1901
|
+
async (o, u) => {
|
|
1902
|
+
const d = n.current.subscription?.customerId ?? (o.startsWith("cus_") ? o : null);
|
|
1903
|
+
if (!d)
|
|
1904
|
+
return r((i) => ({
|
|
1905
|
+
...i,
|
|
1906
|
+
status: "error",
|
|
1907
|
+
error: "No Stripe customer ID available for billing portal"
|
|
1908
|
+
})), null;
|
|
1912
1909
|
r((i) => ({ ...i, status: "loading", error: null }));
|
|
1913
1910
|
try {
|
|
1914
1911
|
const i = await e.getBillingPortalUrl({
|
|
1915
|
-
|
|
1916
|
-
returnUrl:
|
|
1912
|
+
customerId: d,
|
|
1913
|
+
returnUrl: u
|
|
1917
1914
|
});
|
|
1918
1915
|
try {
|
|
1919
1916
|
if (new URL(i.url).protocol !== "https:")
|
|
@@ -1923,14 +1920,14 @@ function ut() {
|
|
|
1923
1920
|
}
|
|
1924
1921
|
return window.location.href = i.url, i;
|
|
1925
1922
|
} catch (i) {
|
|
1926
|
-
const
|
|
1927
|
-
return r((
|
|
1923
|
+
const p = i instanceof Error ? i.message : "Failed to open billing portal";
|
|
1924
|
+
return r((m) => ({ ...m, status: "error", error: p })), null;
|
|
1928
1925
|
}
|
|
1929
1926
|
},
|
|
1930
1927
|
[e]
|
|
1931
|
-
), c =
|
|
1928
|
+
), c = R(() => {
|
|
1932
1929
|
r((o) => ({ ...o, changePreview: null }));
|
|
1933
|
-
}, []), a =
|
|
1930
|
+
}, []), a = R(() => {
|
|
1934
1931
|
r({
|
|
1935
1932
|
status: "idle",
|
|
1936
1933
|
error: null,
|
|
@@ -1942,10 +1939,10 @@ function ut() {
|
|
|
1942
1939
|
return {
|
|
1943
1940
|
...t,
|
|
1944
1941
|
loadSubscription: s,
|
|
1945
|
-
previewChange:
|
|
1942
|
+
previewChange: l,
|
|
1946
1943
|
changeSubscription: g,
|
|
1947
|
-
cancelSubscription:
|
|
1948
|
-
openBillingPortal:
|
|
1944
|
+
cancelSubscription: C,
|
|
1945
|
+
openBillingPortal: b,
|
|
1949
1946
|
clearPreview: c,
|
|
1950
1947
|
reset: a
|
|
1951
1948
|
};
|
|
@@ -2231,7 +2228,7 @@ function gt({
|
|
|
2231
2228
|
isLoading: n,
|
|
2232
2229
|
styles: s
|
|
2233
2230
|
}) {
|
|
2234
|
-
const
|
|
2231
|
+
const l = e.immediateAmount < 0;
|
|
2235
2232
|
return /* @__PURE__ */ S("div", { className: "cedros-proration-preview", style: s.prorationPreview, children: [
|
|
2236
2233
|
/* @__PURE__ */ f("h4", { style: s.previewTitle, children: "Change Preview" }),
|
|
2237
2234
|
/* @__PURE__ */ S("div", { style: s.previewDetails, children: [
|
|
@@ -2270,8 +2267,8 @@ function gt({
|
|
|
2270
2267
|
] })
|
|
2271
2268
|
] }),
|
|
2272
2269
|
/* @__PURE__ */ S("div", { style: { ...s.previewRow, ...s.previewTotal }, children: [
|
|
2273
|
-
/* @__PURE__ */ f("span", { children:
|
|
2274
|
-
/* @__PURE__ */ f("span", { style: { color:
|
|
2270
|
+
/* @__PURE__ */ f("span", { children: l ? "Credit to account:" : "Amount due now:" }),
|
|
2271
|
+
/* @__PURE__ */ f("span", { style: { color: l ? "#22c55e" : "#ef4444" }, children: K(Math.abs(e.immediateAmount), e.currency) })
|
|
2275
2272
|
] }),
|
|
2276
2273
|
/* @__PURE__ */ S("div", { style: s.previewRow, children: [
|
|
2277
2274
|
/* @__PURE__ */ f("span", { children: "Effective date:" }),
|
|
@@ -2284,55 +2281,55 @@ function gt({
|
|
|
2284
2281
|
] })
|
|
2285
2282
|
] });
|
|
2286
2283
|
}
|
|
2287
|
-
function
|
|
2284
|
+
function Ft({
|
|
2288
2285
|
resource: e,
|
|
2289
2286
|
userId: t,
|
|
2290
2287
|
availablePlans: r = [],
|
|
2291
2288
|
onSubscriptionChanged: n,
|
|
2292
2289
|
onSubscriptionCanceled: s,
|
|
2293
|
-
billingPortalReturnUrl:
|
|
2290
|
+
billingPortalReturnUrl: l,
|
|
2294
2291
|
showBillingPortal: g = !1,
|
|
2295
|
-
className:
|
|
2296
|
-
style:
|
|
2292
|
+
className: C,
|
|
2293
|
+
style: b
|
|
2297
2294
|
}) {
|
|
2298
|
-
const { mode: c } = V(), a =
|
|
2295
|
+
const { mode: c } = V(), a = W(() => ft(c === "dark"), [c]), {
|
|
2299
2296
|
subscription: o,
|
|
2300
|
-
changePreview:
|
|
2301
|
-
status:
|
|
2302
|
-
error:
|
|
2297
|
+
changePreview: u,
|
|
2298
|
+
status: d,
|
|
2299
|
+
error: i,
|
|
2303
2300
|
loadSubscription: p,
|
|
2304
2301
|
previewChange: m,
|
|
2305
|
-
changeSubscription:
|
|
2302
|
+
changeSubscription: h,
|
|
2306
2303
|
cancelSubscription: y,
|
|
2307
|
-
openBillingPortal:
|
|
2308
|
-
clearPreview:
|
|
2304
|
+
openBillingPortal: I,
|
|
2305
|
+
clearPreview: v
|
|
2309
2306
|
} = ut();
|
|
2310
2307
|
te(() => {
|
|
2311
2308
|
p(e, t);
|
|
2312
2309
|
}, [e, t, p]);
|
|
2313
|
-
const
|
|
2314
|
-
async (
|
|
2315
|
-
|
|
2310
|
+
const P = X(null), N = R(
|
|
2311
|
+
async (w, E) => {
|
|
2312
|
+
P.current = { resource: w, interval: E }, await m(e, w, t, E);
|
|
2316
2313
|
},
|
|
2317
2314
|
[e, t, m]
|
|
2318
|
-
),
|
|
2319
|
-
if (!
|
|
2320
|
-
const
|
|
2321
|
-
(await
|
|
2322
|
-
newResource:
|
|
2323
|
-
newInterval:
|
|
2315
|
+
), A = R(async () => {
|
|
2316
|
+
if (!u) return;
|
|
2317
|
+
const w = P.current;
|
|
2318
|
+
(await h({
|
|
2319
|
+
newResource: w?.resource || e,
|
|
2320
|
+
newInterval: w?.interval,
|
|
2324
2321
|
immediate: !0
|
|
2325
|
-
}))?.success &&
|
|
2326
|
-
}, [
|
|
2327
|
-
async (
|
|
2328
|
-
(await y(
|
|
2322
|
+
}))?.success && w && w.interval && (n?.(w.resource, w.interval), P.current = null);
|
|
2323
|
+
}, [u, e, h, n]), z = R(
|
|
2324
|
+
async (w) => {
|
|
2325
|
+
(await y(w))?.success && s?.();
|
|
2329
2326
|
},
|
|
2330
2327
|
[y, s]
|
|
2331
|
-
),
|
|
2332
|
-
|
|
2333
|
-
}, [t,
|
|
2334
|
-
return /* @__PURE__ */ S("div", { className: `cedros-subscription-panel ${
|
|
2335
|
-
|
|
2328
|
+
), q = R(() => {
|
|
2329
|
+
I(t, l);
|
|
2330
|
+
}, [t, l, I]), D = d === "loading";
|
|
2331
|
+
return /* @__PURE__ */ S("div", { className: `cedros-subscription-panel ${C || ""}`, style: { ...a.container, ...b }, children: [
|
|
2332
|
+
i && /* @__PURE__ */ f("div", { className: "cedros-subscription-error", style: a.error, children: i }),
|
|
2336
2333
|
D && !o && /* @__PURE__ */ f("div", { className: "cedros-subscription-loading", style: a.loading, children: "Loading subscription..." }),
|
|
2337
2334
|
o && /* @__PURE__ */ S(me, { children: [
|
|
2338
2335
|
/* @__PURE__ */ S("div", { className: "cedros-subscription-details", style: a.details, children: [
|
|
@@ -2368,52 +2365,52 @@ function Wt({
|
|
|
2368
2365
|
] }),
|
|
2369
2366
|
o.cancelAtPeriodEnd && /* @__PURE__ */ f("div", { style: a.cancelNotice, children: "Subscription will cancel at end of current period" })
|
|
2370
2367
|
] }),
|
|
2371
|
-
|
|
2368
|
+
u && /* @__PURE__ */ f(
|
|
2372
2369
|
gt,
|
|
2373
2370
|
{
|
|
2374
|
-
preview:
|
|
2375
|
-
onConfirm:
|
|
2376
|
-
onCancel:
|
|
2371
|
+
preview: u,
|
|
2372
|
+
onConfirm: A,
|
|
2373
|
+
onCancel: v,
|
|
2377
2374
|
isLoading: D,
|
|
2378
2375
|
styles: a
|
|
2379
2376
|
}
|
|
2380
2377
|
),
|
|
2381
|
-
r.length > 0 && !
|
|
2378
|
+
r.length > 0 && !u && /* @__PURE__ */ S("div", { className: "cedros-available-plans", style: a.plansSection, children: [
|
|
2382
2379
|
/* @__PURE__ */ f("h4", { style: a.plansTitle, children: "Available Plans" }),
|
|
2383
|
-
/* @__PURE__ */ f("div", { style: a.plansList, children: r.map((
|
|
2384
|
-
const
|
|
2380
|
+
/* @__PURE__ */ f("div", { style: a.plansList, children: r.map((w) => {
|
|
2381
|
+
const E = w.resource === o.resource;
|
|
2385
2382
|
return /* @__PURE__ */ S(
|
|
2386
2383
|
"div",
|
|
2387
2384
|
{
|
|
2388
2385
|
style: {
|
|
2389
2386
|
...a.planCard,
|
|
2390
|
-
...
|
|
2387
|
+
...E ? a.currentPlan : {}
|
|
2391
2388
|
},
|
|
2392
2389
|
children: [
|
|
2393
|
-
/* @__PURE__ */ f("div", { style: a.planName, children:
|
|
2390
|
+
/* @__PURE__ */ f("div", { style: a.planName, children: w.name }),
|
|
2394
2391
|
/* @__PURE__ */ S("div", { style: a.planPrice, children: [
|
|
2395
|
-
K(
|
|
2392
|
+
K(w.price, w.currency),
|
|
2396
2393
|
"/",
|
|
2397
|
-
|
|
2394
|
+
w.interval
|
|
2398
2395
|
] }),
|
|
2399
|
-
|
|
2400
|
-
|
|
2396
|
+
w.description && /* @__PURE__ */ f("div", { style: a.planDescription, children: w.description }),
|
|
2397
|
+
E ? /* @__PURE__ */ f("span", { style: a.currentBadge, children: "Current Plan" }) : /* @__PURE__ */ f(
|
|
2401
2398
|
"button",
|
|
2402
2399
|
{
|
|
2403
|
-
onClick: () =>
|
|
2400
|
+
onClick: () => N(w.resource, w.interval),
|
|
2404
2401
|
style: a.changePlanButton,
|
|
2405
2402
|
disabled: D,
|
|
2406
|
-
children:
|
|
2403
|
+
children: w.price > o.pricePerPeriod ? "Upgrade" : "Downgrade"
|
|
2407
2404
|
}
|
|
2408
2405
|
)
|
|
2409
2406
|
]
|
|
2410
2407
|
},
|
|
2411
|
-
|
|
2408
|
+
w.resource
|
|
2412
2409
|
);
|
|
2413
2410
|
}) })
|
|
2414
2411
|
] }),
|
|
2415
2412
|
/* @__PURE__ */ S("div", { className: "cedros-subscription-actions", style: a.actions, children: [
|
|
2416
|
-
g && o.paymentMethod === "stripe" && /* @__PURE__ */ f("button", { onClick:
|
|
2413
|
+
g && o.paymentMethod === "stripe" && /* @__PURE__ */ f("button", { onClick: q, style: a.portalButton, disabled: D, children: "Manage Billing" }),
|
|
2417
2414
|
o.status === "active" && !o.cancelAtPeriodEnd && /* @__PURE__ */ f(
|
|
2418
2415
|
"button",
|
|
2419
2416
|
{
|
|
@@ -2503,7 +2500,7 @@ function Ht() {
|
|
|
2503
2500
|
bt(),
|
|
2504
2501
|
Ct(),
|
|
2505
2502
|
wt()
|
|
2506
|
-
], t = e.some((
|
|
2503
|
+
], t = e.some((l) => l.severity === "error" && !l.passed), r = e.some((l) => l.severity === "warning" && !l.passed);
|
|
2507
2504
|
let n, s;
|
|
2508
2505
|
return t ? (n = "vulnerable", s = "Security issues detected. Review errors and apply recommendations.") : r ? (n = "warnings", s = "Minor security warnings detected. Consider applying recommendations.") : (n = "secure", s = "All security checks passed."), {
|
|
2509
2506
|
checks: e,
|
|
@@ -2526,53 +2523,53 @@ const Qt = {
|
|
|
2526
2523
|
NO_SRI: "Do NOT use SRI hashes for Stripe.js - use CSP instead"
|
|
2527
2524
|
};
|
|
2528
2525
|
export {
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2526
|
+
Nt as A,
|
|
2527
|
+
Tt as B,
|
|
2528
|
+
J as C,
|
|
2529
|
+
Je as D,
|
|
2530
|
+
Yt as E,
|
|
2531
|
+
xt as F,
|
|
2532
|
+
_t as G,
|
|
2533
|
+
et as H,
|
|
2534
|
+
lt as I,
|
|
2535
|
+
At as J,
|
|
2536
|
+
he as K,
|
|
2537
|
+
Ie as L,
|
|
2538
|
+
ct as M,
|
|
2539
|
+
ut as N,
|
|
2543
2540
|
ne as O,
|
|
2544
|
-
|
|
2545
|
-
|
|
2541
|
+
Ut as P,
|
|
2542
|
+
Ht as Q,
|
|
2546
2543
|
jt as R,
|
|
2547
|
-
|
|
2544
|
+
Qt as S,
|
|
2548
2545
|
Ce as T,
|
|
2549
2546
|
ge as U,
|
|
2550
2547
|
se as V,
|
|
2551
2548
|
He as W,
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2549
|
+
Bt as a,
|
|
2550
|
+
qt as b,
|
|
2551
|
+
Te as c,
|
|
2552
|
+
Wt as d,
|
|
2553
|
+
rt as e,
|
|
2554
|
+
zt as f,
|
|
2555
|
+
nt as g,
|
|
2556
|
+
Me as h,
|
|
2557
|
+
Ot as i,
|
|
2558
|
+
Ft as j,
|
|
2559
|
+
kt as k,
|
|
2560
|
+
Ze as l,
|
|
2561
|
+
Xe as m,
|
|
2562
|
+
Y as n,
|
|
2563
|
+
ae as o,
|
|
2564
|
+
oe as p,
|
|
2565
|
+
ie as q,
|
|
2566
|
+
Rt as r,
|
|
2567
|
+
It as s,
|
|
2568
|
+
Mt as t,
|
|
2569
|
+
Ge as u,
|
|
2570
|
+
Et as v,
|
|
2571
|
+
Dt as w,
|
|
2572
|
+
Ve as x,
|
|
2573
|
+
Lt as y,
|
|
2574
|
+
$t as z
|
|
2578
2575
|
};
|