@superlogic/spree-pay 0.1.9 → 0.1.11
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/build/index.cjs +56 -41
- package/build/index.css +986 -999
- package/build/index.d.cts +9 -4
- package/build/index.d.ts +9 -4
- package/build/index.js +59 -44
- package/package.json +1 -1
package/build/index.d.cts
CHANGED
|
@@ -93,9 +93,16 @@ declare const enum SlapiPaymentStatus {
|
|
|
93
93
|
}
|
|
94
94
|
type PaymentMethodResult = {
|
|
95
95
|
status: SlapiPaymentStatus;
|
|
96
|
+
paymentId: string;
|
|
96
97
|
txHash: string | null;
|
|
97
|
-
|
|
98
|
+
txId: string | null;
|
|
98
99
|
};
|
|
100
|
+
type ProcessFnParams = {
|
|
101
|
+
hash: string;
|
|
102
|
+
capture?: boolean;
|
|
103
|
+
metadata?: Record<string, unknown>;
|
|
104
|
+
};
|
|
105
|
+
type ProcessFn = (data: ProcessFnParams) => Promise<PaymentMethodResult>;
|
|
99
106
|
|
|
100
107
|
type SpreePayProviderProps = {
|
|
101
108
|
children: ReactNode;
|
|
@@ -103,9 +110,7 @@ type SpreePayProviderProps = {
|
|
|
103
110
|
};
|
|
104
111
|
declare const SpreePayProvider: FC<SpreePayProviderProps>;
|
|
105
112
|
declare const useSpreePay: () => {
|
|
106
|
-
process:
|
|
107
|
-
hash: string;
|
|
108
|
-
}) => Promise<PaymentMethodResult>;
|
|
113
|
+
process: ProcessFn;
|
|
109
114
|
isProcessing: boolean;
|
|
110
115
|
enabled: boolean;
|
|
111
116
|
selectedPaymentMethod: SelectedPaymentMethod;
|
package/build/index.d.ts
CHANGED
|
@@ -93,9 +93,16 @@ declare const enum SlapiPaymentStatus {
|
|
|
93
93
|
}
|
|
94
94
|
type PaymentMethodResult = {
|
|
95
95
|
status: SlapiPaymentStatus;
|
|
96
|
+
paymentId: string;
|
|
96
97
|
txHash: string | null;
|
|
97
|
-
|
|
98
|
+
txId: string | null;
|
|
98
99
|
};
|
|
100
|
+
type ProcessFnParams = {
|
|
101
|
+
hash: string;
|
|
102
|
+
capture?: boolean;
|
|
103
|
+
metadata?: Record<string, unknown>;
|
|
104
|
+
};
|
|
105
|
+
type ProcessFn = (data: ProcessFnParams) => Promise<PaymentMethodResult>;
|
|
99
106
|
|
|
100
107
|
type SpreePayProviderProps = {
|
|
101
108
|
children: ReactNode;
|
|
@@ -103,9 +110,7 @@ type SpreePayProviderProps = {
|
|
|
103
110
|
};
|
|
104
111
|
declare const SpreePayProvider: FC<SpreePayProviderProps>;
|
|
105
112
|
declare const useSpreePay: () => {
|
|
106
|
-
process:
|
|
107
|
-
hash: string;
|
|
108
|
-
}) => Promise<PaymentMethodResult>;
|
|
113
|
+
process: ProcessFn;
|
|
109
114
|
isProcessing: boolean;
|
|
110
115
|
enabled: boolean;
|
|
111
116
|
selectedPaymentMethod: SelectedPaymentMethod;
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/SpreePay.tsx
|
|
2
|
-
import {
|
|
2
|
+
import { useLayoutEffect, useMemo as useMemo2, useRef as useRef3, useState as useState7 } from "react";
|
|
3
3
|
import NiceModal6 from "@ebay/nice-modal-react";
|
|
4
4
|
import { SWRConfig } from "swr";
|
|
5
5
|
|
|
@@ -172,8 +172,8 @@ var CheckoutButton = ({ isProcessing, amount, onCheckout }) => {
|
|
|
172
172
|
const { selectedPaymentMethod, isInternalProcessing } = useSpreePaymentMethod();
|
|
173
173
|
const isDisabled = !amount || !selectedPaymentMethod.method || !!isProcessing || isInternalProcessing;
|
|
174
174
|
const isUSD = selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */;
|
|
175
|
-
return /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col overflow-hidden rounded-
|
|
176
|
-
/* @__PURE__ */ jsx3("div", { className: "px-7 py-5", children: /* @__PURE__ */ jsxs2("p", { className: "text-
|
|
175
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col overflow-hidden rounded-3xl border border-black/25 bg-white text-xs font-medium", children: [
|
|
176
|
+
/* @__PURE__ */ jsx3("div", { className: "px-7 py-5", children: /* @__PURE__ */ jsxs2("p", { className: "text-black/50", children: [
|
|
177
177
|
"By clicking on the button below I acknowledge that I have read and accepted the",
|
|
178
178
|
" ",
|
|
179
179
|
/* @__PURE__ */ jsx3("a", { className: "underline", href: "/", children: "Property Policies" }),
|
|
@@ -212,7 +212,7 @@ var SpreeLegal = () => {
|
|
|
212
212
|
d: "M57.79 25.48a4.82 4.82 0 0 1-1.55-.25l.55-1.86c.34.1.65.15.92.15s.51-.1.72-.26c.21-.16.39-.43.53-.81l.2-.55-3.65-10.3h2.52l2.32 7.62h.1l2.34-7.62h2.53l-4.04 11.31c-.19.54-.44 1-.75 1.38-.31.38-.7.68-1.14.88-.45.2-.98.3-1.6.3ZM48.95 21.9a4.2 4.2 0 0 1-1.73-.35c-.5-.23-.9-.57-1.2-1.02a3 3 0 0 1-.44-1.67 2.44 2.44 0 0 1 1.18-2.3c.35-.23.76-.4 1.22-.5.46-.13.93-.21 1.42-.27l1.44-.16c.37-.05.64-.13.8-.24.18-.1.26-.27.26-.5v-.04c0-.5-.15-.88-.44-1.15-.3-.27-.72-.4-1.27-.4-.58 0-1.04.12-1.38.37-.34.26-.57.56-.69.9l-2.22-.31a3.54 3.54 0 0 1 2.35-2.47 6.29 6.29 0 0 1 3.38-.14c.48.1.92.3 1.32.56.4.26.72.6.96 1.06.25.44.37 1 .37 1.67v6.75h-2.29v-1.38h-.08a2.9 2.9 0 0 1-1.59 1.37c-.39.14-.84.22-1.37.22Zm.62-1.75c.48 0 .89-.1 1.24-.28.35-.2.62-.45.8-.77.2-.31.3-.65.3-1.03V16.9c-.08.06-.2.11-.38.17a18.34 18.34 0 0 1-1.8.32c-.36.05-.68.12-.96.23-.28.11-.5.27-.66.46-.16.2-.24.45-.24.75 0 .44.16.77.48 1 .32.22.72.33 1.22.33ZM34.43 21.7V8.23h5.05c1.03 0 1.9.2 2.6.58.7.38 1.23.91 1.6 1.59.36.67.54 1.43.54 2.28 0 .87-.18 1.63-.55 2.3a3.9 3.9 0 0 1-1.6 1.59c-.72.38-1.59.57-2.63.57H36.1v-2h3.01c.6 0 1.1-.11 1.49-.32.38-.21.67-.5.85-.87.2-.37.29-.79.29-1.27 0-.47-.1-.9-.29-1.26a1.92 1.92 0 0 0-.86-.84c-.38-.2-.88-.31-1.49-.31h-2.23v11.41h-2.44ZM14.54.46a14.54 14.54 0 1 1 0 29.08 14.54 14.54 0 0 1 0-29.08ZM5.59 18.12l-.84 3.35h.83l.84-3.35h-.83Zm1.66 0-.83 3.35h1.66l.84-3.35H7.25Zm3.35-9.58c-1.03 0-2.08.84-2.34 1.87l-1.1 4.4c-.26 1.03.37 1.87 1.4 1.87h9.64l-.34 1.44h-8.1l-.85 3.35h9.6c1.04 0 2.1-.85 2.35-1.89l1.05-4.4c.25-1.03-.38-1.85-1.4-1.85h-9.63l.36-1.44h8.13l.84-3.35H10.6Zm10.44 0-.84 3.35h1.67l.83-3.35h-1.66Zm2.5 0-.84 3.35h.83l.84-3.35h-.83Z"
|
|
213
213
|
}
|
|
214
214
|
) }),
|
|
215
|
-
/* @__PURE__ */ jsxs3("p", { className: "text-xs text-
|
|
215
|
+
/* @__PURE__ */ jsxs3("p", { className: "text-xs text-black/50", children: [
|
|
216
216
|
"Spree enables seamless crypto payments for real-world goods, travel, and experiences. Enjoy secure, fast transactions and earn rewards.",
|
|
217
217
|
" ",
|
|
218
218
|
/* @__PURE__ */ jsx4("a", { className: "underline", href: "/", children: "Learn more" }),
|
|
@@ -277,7 +277,8 @@ function Dialog({ ...props }) {
|
|
|
277
277
|
}
|
|
278
278
|
function DialogPortal({ ...props }) {
|
|
279
279
|
const container = usePortalContainer();
|
|
280
|
-
|
|
280
|
+
const safeContainer = container && document.body.contains(container) ? container : void 0;
|
|
281
|
+
return /* @__PURE__ */ jsx5(DialogPrimitive.Portal, { container: safeContainer, "data-slot": "dialog-portal", ...props });
|
|
281
282
|
}
|
|
282
283
|
function DialogOverlay({ className, ...props }) {
|
|
283
284
|
return /* @__PURE__ */ jsx5(
|
|
@@ -488,14 +489,14 @@ var SlapiPaymentService = {
|
|
|
488
489
|
// return coin.balance > outAmountNumber;
|
|
489
490
|
// },
|
|
490
491
|
createPayment: (params) => {
|
|
491
|
-
const { type, hash } = params;
|
|
492
|
+
const { type, hash, metadata, capture = false } = params;
|
|
492
493
|
let reqParams;
|
|
493
494
|
if (type === "CRYPTO" /* CRYPTO */) {
|
|
494
495
|
reqParams = { type, hash, crypto: params.crypto };
|
|
495
496
|
} else {
|
|
496
497
|
reqParams = { type, hash, card: params.card };
|
|
497
498
|
}
|
|
498
|
-
return slapiApi.post("/v1/payments", { ...reqParams, capture
|
|
499
|
+
return slapiApi.post("/v1/payments", { ...reqParams, capture, metadata }).then((data) => ({ data }));
|
|
499
500
|
},
|
|
500
501
|
baseVerify: ({ id, txHash }) => {
|
|
501
502
|
return slapiApi.post(`/v1/base-transactions/transactions/${id}/verify`, { txHash });
|
|
@@ -522,7 +523,13 @@ var SlapiPaymentService = {
|
|
|
522
523
|
};
|
|
523
524
|
|
|
524
525
|
// src/services/cardPayment.ts
|
|
525
|
-
var cardPayment = async ({
|
|
526
|
+
var cardPayment = async ({
|
|
527
|
+
card,
|
|
528
|
+
hash,
|
|
529
|
+
redirect3dsURI,
|
|
530
|
+
metadata,
|
|
531
|
+
capture
|
|
532
|
+
}) => {
|
|
526
533
|
let cardId = card.id;
|
|
527
534
|
if ("token" in card) {
|
|
528
535
|
const { data: cardResData } = await SlapiPaymentService.addCard({ hash, source: card.token });
|
|
@@ -531,6 +538,8 @@ var cardPayment = async ({ card, hash, redirect3dsURI }) => {
|
|
|
531
538
|
const { data: paymentResData } = await SlapiPaymentService.createPayment({
|
|
532
539
|
hash,
|
|
533
540
|
type: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
541
|
+
metadata,
|
|
542
|
+
capture,
|
|
534
543
|
card: { cardId, returnUrl: `${window.location.origin}${redirect3dsURI}` }
|
|
535
544
|
});
|
|
536
545
|
if (paymentResData.redirectUrl) {
|
|
@@ -539,15 +548,17 @@ var cardPayment = async ({ card, hash, redirect3dsURI }) => {
|
|
|
539
548
|
const { data: validateData } = await SlapiPaymentService.validate3DS({ paymentId: paymentResData.id });
|
|
540
549
|
return {
|
|
541
550
|
status: validateData.status,
|
|
542
|
-
|
|
543
|
-
|
|
551
|
+
paymentId: paymentResData.id,
|
|
552
|
+
txId: paymentResData.txId,
|
|
553
|
+
txHash: null
|
|
544
554
|
};
|
|
545
555
|
}
|
|
546
556
|
}
|
|
547
557
|
return {
|
|
548
558
|
status: paymentResData.status,
|
|
549
|
-
|
|
550
|
-
|
|
559
|
+
paymentId: paymentResData.id,
|
|
560
|
+
txId: paymentResData.txId,
|
|
561
|
+
txHash: null
|
|
551
562
|
};
|
|
552
563
|
};
|
|
553
564
|
|
|
@@ -668,7 +679,7 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
668
679
|
children: [
|
|
669
680
|
/* @__PURE__ */ jsx10("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx10("p", { className: "text-sm font-medium text-black", children: card.schema }) }),
|
|
670
681
|
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
|
|
671
|
-
/* @__PURE__ */ jsxs7("p", { className: "text-sm font-medium text-
|
|
682
|
+
/* @__PURE__ */ jsxs7("p", { className: "text-sm font-medium text-black/50", children: [
|
|
672
683
|
"Ending in ",
|
|
673
684
|
/* @__PURE__ */ jsx10("span", { className: "text-black", children: card.lastFourNumbers })
|
|
674
685
|
] }),
|
|
@@ -960,8 +971,8 @@ var CreditCardTab = () => {
|
|
|
960
971
|
try {
|
|
961
972
|
if (selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && selectedPaymentMethod.method) {
|
|
962
973
|
const res = await cardPayment({
|
|
974
|
+
...data,
|
|
963
975
|
card: selectedPaymentMethod.method,
|
|
964
|
-
hash: data.hash,
|
|
965
976
|
redirect3dsURI: env.redirect3dsURI
|
|
966
977
|
});
|
|
967
978
|
if (["AUTHORIZED" /* AUTHORIZED */, "CAPTURED" /* CAPTURED */].includes(res.status)) {
|
|
@@ -1121,7 +1132,7 @@ var useCryptoPayment = () => {
|
|
|
1121
1132
|
const { data: walletClient } = useWalletClient();
|
|
1122
1133
|
const config2 = useConfig2();
|
|
1123
1134
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
1124
|
-
const cryptoPayment = async (
|
|
1135
|
+
const cryptoPayment = async (params) => {
|
|
1125
1136
|
if (!walletClient) {
|
|
1126
1137
|
throw new Error("Wallet not connected");
|
|
1127
1138
|
}
|
|
@@ -1155,8 +1166,8 @@ var useCryptoPayment = () => {
|
|
|
1155
1166
|
}
|
|
1156
1167
|
}
|
|
1157
1168
|
const paymentRes = await SlapiPaymentService.createPayment({
|
|
1169
|
+
...params,
|
|
1158
1170
|
type: "CRYPTO" /* CRYPTO */,
|
|
1159
|
-
hash,
|
|
1160
1171
|
crypto: {
|
|
1161
1172
|
token: TOKEN,
|
|
1162
1173
|
publicKey: walletClient.account.address,
|
|
@@ -1174,7 +1185,8 @@ var useCryptoPayment = () => {
|
|
|
1174
1185
|
const res = await SlapiPaymentService.baseVerify({ id: paymentRes.data.txId, txHash });
|
|
1175
1186
|
return {
|
|
1176
1187
|
txHash,
|
|
1177
|
-
paymentId: paymentRes.data.
|
|
1188
|
+
paymentId: paymentRes.data.id,
|
|
1189
|
+
txId: paymentRes.data.txId,
|
|
1178
1190
|
status: res.verified ? "AUTHORIZED" /* AUTHORIZED */ : "FAILED" /* FAILED */
|
|
1179
1191
|
};
|
|
1180
1192
|
};
|
|
@@ -1192,7 +1204,7 @@ var ConnectButton = () => {
|
|
|
1192
1204
|
return /* @__PURE__ */ jsx16(
|
|
1193
1205
|
"button",
|
|
1194
1206
|
{
|
|
1195
|
-
className: "h-[34px] rounded-md border-1 border-black px-3 text-sm font-medium",
|
|
1207
|
+
className: "h-[34px] rounded-md border-1 border-black px-3 text-sm font-medium text-black",
|
|
1196
1208
|
onClick: openConnectModal,
|
|
1197
1209
|
children: "Connect a Wallet"
|
|
1198
1210
|
}
|
|
@@ -1211,7 +1223,7 @@ var ConnectButton = () => {
|
|
|
1211
1223
|
return /* @__PURE__ */ jsxs11(
|
|
1212
1224
|
"button",
|
|
1213
1225
|
{
|
|
1214
|
-
className: "flex h-[34px] items-center gap-2 rounded-md border-1 border-black px-1.5 text-sm font-medium",
|
|
1226
|
+
className: "flex h-[34px] items-center gap-2 rounded-md border-1 border-black px-1.5 text-sm font-medium text-black",
|
|
1215
1227
|
onClick: openAccountModal,
|
|
1216
1228
|
children: [
|
|
1217
1229
|
chain.hasIcon && /* @__PURE__ */ jsx16("div", { className: "h-6 w-6 overflow-hidden rounded-full", style: { background: chain.iconBackground }, children: chain.iconUrl && /* @__PURE__ */ jsx16("img", { alt: chain.name ?? "Chain icon", src: chain.iconUrl }) }),
|
|
@@ -1456,7 +1468,7 @@ var CryptoSelectModal = NiceModal3.create(() => {
|
|
|
1456
1468
|
nativeBalance && /* @__PURE__ */ jsxs14(
|
|
1457
1469
|
"button",
|
|
1458
1470
|
{
|
|
1459
|
-
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 hover:bg-gray-100",
|
|
1471
|
+
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-black hover:bg-gray-100",
|
|
1460
1472
|
onClick: () => handleSelect(nativeBalance),
|
|
1461
1473
|
children: [
|
|
1462
1474
|
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1485,7 +1497,7 @@ var CryptoSelectModal = NiceModal3.create(() => {
|
|
|
1485
1497
|
return /* @__PURE__ */ jsxs14(
|
|
1486
1498
|
"button",
|
|
1487
1499
|
{
|
|
1488
|
-
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1500
|
+
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-black hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1489
1501
|
onClick: () => handleSelect(coin),
|
|
1490
1502
|
children: [
|
|
1491
1503
|
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1531,10 +1543,10 @@ var SelectedCoin = (props) => {
|
|
|
1531
1543
|
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
|
|
1532
1544
|
Icon,
|
|
1533
1545
|
!Icon && logoURI && /* @__PURE__ */ jsx21("img", { className: "mr-1 h-8 w-8 shrink-0", src: logoURI, alt: `${coin} logo` }),
|
|
1534
|
-
/* @__PURE__ */ jsx21("p", { className: "font-semibold", children: coin }),
|
|
1546
|
+
/* @__PURE__ */ jsx21("p", { className: "font-semibold text-black", children: coin }),
|
|
1535
1547
|
/* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21("path", { d: "M6 12.4341L10 8.43408L6 4.43408", stroke: "black", strokeLinecap: "round" }) })
|
|
1536
1548
|
] }),
|
|
1537
|
-
/* @__PURE__ */ jsxs16("p", { className: "text-xs font-medium text-
|
|
1549
|
+
/* @__PURE__ */ jsxs16("p", { className: "text-xs font-medium text-black/50", children: [
|
|
1538
1550
|
"Wallet balance ",
|
|
1539
1551
|
/* @__PURE__ */ jsx21("span", { className: "text-black", children: balance })
|
|
1540
1552
|
] })
|
|
@@ -1553,7 +1565,7 @@ var Crypto = () => {
|
|
|
1553
1565
|
const handlePay = useCallback3(
|
|
1554
1566
|
async (data) => {
|
|
1555
1567
|
try {
|
|
1556
|
-
const res = await cryptoPayment(
|
|
1568
|
+
const res = await cryptoPayment(data);
|
|
1557
1569
|
if (["AUTHORIZED" /* AUTHORIZED */, "CAPTURED" /* CAPTURED */].includes(res.status)) {
|
|
1558
1570
|
return Promise.resolve(res);
|
|
1559
1571
|
}
|
|
@@ -1679,7 +1691,7 @@ var TabButtons = (props) => {
|
|
|
1679
1691
|
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1680
1692
|
var Tabs = () => {
|
|
1681
1693
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
1682
|
-
return /* @__PURE__ */ jsxs20("div", { className: "mb-4 rounded-
|
|
1694
|
+
return /* @__PURE__ */ jsxs20("div", { className: "mb-4 rounded-3xl border border-black/25 bg-white", children: [
|
|
1683
1695
|
/* @__PURE__ */ jsxs20("div", { className: "flex w-full flex-col gap-4 border-b-1 border-black/7 px-7 py-6", children: [
|
|
1684
1696
|
/* @__PURE__ */ jsx26("h2", { className: "text-primary text-2xl font-semibold", children: "Choose a Payment Method" }),
|
|
1685
1697
|
/* @__PURE__ */ jsx26(TabButtons, { value: selectedPaymentMethod.type, onChange: setSelectedPaymentMethod })
|
|
@@ -1810,7 +1822,7 @@ var envConfig = {
|
|
|
1810
1822
|
var SpreePay = ({ className, ...rest }) => {
|
|
1811
1823
|
const rootRef = useRef3(null);
|
|
1812
1824
|
const [portalEl, setPortalEl] = useState7(null);
|
|
1813
|
-
|
|
1825
|
+
useLayoutEffect(() => {
|
|
1814
1826
|
if (!rootRef.current) return;
|
|
1815
1827
|
const el = rootRef.current.querySelector(":scope > .sl-spreepay__portal");
|
|
1816
1828
|
setPortalEl(el ?? null);
|
|
@@ -1819,11 +1831,11 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1819
1831
|
const environment = env?.environment || "dev";
|
|
1820
1832
|
const tenantId = env?.tenantId || "bookit";
|
|
1821
1833
|
const { isChecking, accessToken, error } = useKeycloakSSO({
|
|
1822
|
-
realm:
|
|
1834
|
+
realm: tenantId,
|
|
1823
1835
|
url: envConfig[environment][tenantId].keyklockUrl,
|
|
1824
1836
|
clientId: envConfig[environment][tenantId].keyklockClientId,
|
|
1825
|
-
ssoPageURI: env
|
|
1826
|
-
enabled: !env
|
|
1837
|
+
ssoPageURI: env?.ssoPageURI,
|
|
1838
|
+
enabled: !env?.accessToken
|
|
1827
1839
|
});
|
|
1828
1840
|
const slapiFetcher = useMemo2(() => {
|
|
1829
1841
|
if (accessToken || env.accessToken) {
|
|
@@ -1834,18 +1846,17 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1834
1846
|
});
|
|
1835
1847
|
}
|
|
1836
1848
|
}, [env.accessToken, environment, tenantId, accessToken]);
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
"
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
/* @__PURE__ */ jsx28(
|
|
1848
|
-
/* @__PURE__ */ jsx28(
|
|
1849
|
+
const getContent = () => {
|
|
1850
|
+
if (isChecking) {
|
|
1851
|
+
return /* @__PURE__ */ jsx28("p", { className: "w-full text-center text-sm", children: "Loading..." });
|
|
1852
|
+
}
|
|
1853
|
+
if (error) {
|
|
1854
|
+
return /* @__PURE__ */ jsxs22("p", { className: "w-full text-center text-sm", children: [
|
|
1855
|
+
"Error: ",
|
|
1856
|
+
error.message
|
|
1857
|
+
] });
|
|
1858
|
+
}
|
|
1859
|
+
return /* @__PURE__ */ jsx28(
|
|
1849
1860
|
SWRConfig,
|
|
1850
1861
|
{
|
|
1851
1862
|
value: {
|
|
@@ -1856,14 +1867,18 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1856
1867
|
},
|
|
1857
1868
|
children: /* @__PURE__ */ jsx28(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ jsx28(NiceModal6.Provider, { children: /* @__PURE__ */ jsx28(SpreePayContent, { ...rest }) }) })
|
|
1858
1869
|
}
|
|
1859
|
-
)
|
|
1870
|
+
);
|
|
1871
|
+
};
|
|
1872
|
+
return /* @__PURE__ */ jsxs22("div", { ref: rootRef, className: cn("sl-spreepay", className), children: [
|
|
1873
|
+
/* @__PURE__ */ jsx28("div", { className: "sl-spreepay__portal" }),
|
|
1874
|
+
getContent()
|
|
1860
1875
|
] });
|
|
1861
1876
|
};
|
|
1862
1877
|
|
|
1863
1878
|
// src/hooks/useCapture3DS.ts
|
|
1864
|
-
import { useEffect as
|
|
1879
|
+
import { useEffect as useEffect6 } from "react";
|
|
1865
1880
|
var useCapture3DS = (searchParams) => {
|
|
1866
|
-
|
|
1881
|
+
useEffect6(() => {
|
|
1867
1882
|
if (window?.parent && searchParams?.paymentIntent) {
|
|
1868
1883
|
window.parent.SP_EVENT_BUS?.emit("paymentIntent", { paymentIntent: searchParams.paymentIntent });
|
|
1869
1884
|
}
|