@superlogic/spree-pay 0.1.9 → 0.1.10
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 +45 -30
- package/build/index.d.cts +9 -4
- package/build/index.d.ts +9 -4
- package/build/index.js +48 -33
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -316,7 +316,8 @@ function Dialog({ ...props }) {
|
|
|
316
316
|
}
|
|
317
317
|
function DialogPortal({ ...props }) {
|
|
318
318
|
const container = usePortalContainer();
|
|
319
|
-
|
|
319
|
+
const safeContainer = container && document.body.contains(container) ? container : void 0;
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DialogPrimitive.Portal, { container: safeContainer, "data-slot": "dialog-portal", ...props });
|
|
320
321
|
}
|
|
321
322
|
function DialogOverlay({ className, ...props }) {
|
|
322
323
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -527,14 +528,14 @@ var SlapiPaymentService = {
|
|
|
527
528
|
// return coin.balance > outAmountNumber;
|
|
528
529
|
// },
|
|
529
530
|
createPayment: (params) => {
|
|
530
|
-
const { type, hash } = params;
|
|
531
|
+
const { type, hash, metadata, capture = false } = params;
|
|
531
532
|
let reqParams;
|
|
532
533
|
if (type === "CRYPTO" /* CRYPTO */) {
|
|
533
534
|
reqParams = { type, hash, crypto: params.crypto };
|
|
534
535
|
} else {
|
|
535
536
|
reqParams = { type, hash, card: params.card };
|
|
536
537
|
}
|
|
537
|
-
return slapiApi.post("/v1/payments", { ...reqParams, capture
|
|
538
|
+
return slapiApi.post("/v1/payments", { ...reqParams, capture, metadata }).then((data) => ({ data }));
|
|
538
539
|
},
|
|
539
540
|
baseVerify: ({ id, txHash }) => {
|
|
540
541
|
return slapiApi.post(`/v1/base-transactions/transactions/${id}/verify`, { txHash });
|
|
@@ -561,7 +562,13 @@ var SlapiPaymentService = {
|
|
|
561
562
|
};
|
|
562
563
|
|
|
563
564
|
// src/services/cardPayment.ts
|
|
564
|
-
var cardPayment = async ({
|
|
565
|
+
var cardPayment = async ({
|
|
566
|
+
card,
|
|
567
|
+
hash,
|
|
568
|
+
redirect3dsURI,
|
|
569
|
+
metadata,
|
|
570
|
+
capture
|
|
571
|
+
}) => {
|
|
565
572
|
let cardId = card.id;
|
|
566
573
|
if ("token" in card) {
|
|
567
574
|
const { data: cardResData } = await SlapiPaymentService.addCard({ hash, source: card.token });
|
|
@@ -570,6 +577,8 @@ var cardPayment = async ({ card, hash, redirect3dsURI }) => {
|
|
|
570
577
|
const { data: paymentResData } = await SlapiPaymentService.createPayment({
|
|
571
578
|
hash,
|
|
572
579
|
type: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
580
|
+
metadata,
|
|
581
|
+
capture,
|
|
573
582
|
card: { cardId, returnUrl: `${window.location.origin}${redirect3dsURI}` }
|
|
574
583
|
});
|
|
575
584
|
if (paymentResData.redirectUrl) {
|
|
@@ -578,15 +587,17 @@ var cardPayment = async ({ card, hash, redirect3dsURI }) => {
|
|
|
578
587
|
const { data: validateData } = await SlapiPaymentService.validate3DS({ paymentId: paymentResData.id });
|
|
579
588
|
return {
|
|
580
589
|
status: validateData.status,
|
|
581
|
-
|
|
582
|
-
|
|
590
|
+
paymentId: paymentResData.id,
|
|
591
|
+
txId: paymentResData.txId,
|
|
592
|
+
txHash: null
|
|
583
593
|
};
|
|
584
594
|
}
|
|
585
595
|
}
|
|
586
596
|
return {
|
|
587
597
|
status: paymentResData.status,
|
|
588
|
-
|
|
589
|
-
|
|
598
|
+
paymentId: paymentResData.id,
|
|
599
|
+
txId: paymentResData.txId,
|
|
600
|
+
txHash: null
|
|
590
601
|
};
|
|
591
602
|
};
|
|
592
603
|
|
|
@@ -999,8 +1010,8 @@ var CreditCardTab = () => {
|
|
|
999
1010
|
try {
|
|
1000
1011
|
if (selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && selectedPaymentMethod.method) {
|
|
1001
1012
|
const res = await cardPayment({
|
|
1013
|
+
...data,
|
|
1002
1014
|
card: selectedPaymentMethod.method,
|
|
1003
|
-
hash: data.hash,
|
|
1004
1015
|
redirect3dsURI: env.redirect3dsURI
|
|
1005
1016
|
});
|
|
1006
1017
|
if (["AUTHORIZED" /* AUTHORIZED */, "CAPTURED" /* CAPTURED */].includes(res.status)) {
|
|
@@ -1160,7 +1171,7 @@ var useCryptoPayment = () => {
|
|
|
1160
1171
|
const { data: walletClient } = (0, import_wagmi.useWalletClient)();
|
|
1161
1172
|
const config2 = (0, import_wagmi.useConfig)();
|
|
1162
1173
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
1163
|
-
const cryptoPayment = async (
|
|
1174
|
+
const cryptoPayment = async (params) => {
|
|
1164
1175
|
if (!walletClient) {
|
|
1165
1176
|
throw new Error("Wallet not connected");
|
|
1166
1177
|
}
|
|
@@ -1194,8 +1205,8 @@ var useCryptoPayment = () => {
|
|
|
1194
1205
|
}
|
|
1195
1206
|
}
|
|
1196
1207
|
const paymentRes = await SlapiPaymentService.createPayment({
|
|
1208
|
+
...params,
|
|
1197
1209
|
type: "CRYPTO" /* CRYPTO */,
|
|
1198
|
-
hash,
|
|
1199
1210
|
crypto: {
|
|
1200
1211
|
token: TOKEN,
|
|
1201
1212
|
publicKey: walletClient.account.address,
|
|
@@ -1213,7 +1224,8 @@ var useCryptoPayment = () => {
|
|
|
1213
1224
|
const res = await SlapiPaymentService.baseVerify({ id: paymentRes.data.txId, txHash });
|
|
1214
1225
|
return {
|
|
1215
1226
|
txHash,
|
|
1216
|
-
paymentId: paymentRes.data.
|
|
1227
|
+
paymentId: paymentRes.data.id,
|
|
1228
|
+
txId: paymentRes.data.txId,
|
|
1217
1229
|
status: res.verified ? "AUTHORIZED" /* AUTHORIZED */ : "FAILED" /* FAILED */
|
|
1218
1230
|
};
|
|
1219
1231
|
};
|
|
@@ -1592,7 +1604,7 @@ var Crypto = () => {
|
|
|
1592
1604
|
const handlePay = (0, import_react8.useCallback)(
|
|
1593
1605
|
async (data) => {
|
|
1594
1606
|
try {
|
|
1595
|
-
const res = await cryptoPayment(
|
|
1607
|
+
const res = await cryptoPayment(data);
|
|
1596
1608
|
if (["AUTHORIZED" /* AUTHORIZED */, "CAPTURED" /* CAPTURED */].includes(res.status)) {
|
|
1597
1609
|
return Promise.resolve(res);
|
|
1598
1610
|
}
|
|
@@ -1849,7 +1861,7 @@ var envConfig = {
|
|
|
1849
1861
|
var SpreePay = ({ className, ...rest }) => {
|
|
1850
1862
|
const rootRef = (0, import_react10.useRef)(null);
|
|
1851
1863
|
const [portalEl, setPortalEl] = (0, import_react10.useState)(null);
|
|
1852
|
-
(0, import_react10.
|
|
1864
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
1853
1865
|
if (!rootRef.current) return;
|
|
1854
1866
|
const el = rootRef.current.querySelector(":scope > .sl-spreepay__portal");
|
|
1855
1867
|
setPortalEl(el ?? null);
|
|
@@ -1858,11 +1870,11 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1858
1870
|
const environment = env?.environment || "dev";
|
|
1859
1871
|
const tenantId = env?.tenantId || "bookit";
|
|
1860
1872
|
const { isChecking, accessToken, error } = useKeycloakSSO({
|
|
1861
|
-
realm:
|
|
1873
|
+
realm: tenantId,
|
|
1862
1874
|
url: envConfig[environment][tenantId].keyklockUrl,
|
|
1863
1875
|
clientId: envConfig[environment][tenantId].keyklockClientId,
|
|
1864
|
-
ssoPageURI: env
|
|
1865
|
-
enabled: !env
|
|
1876
|
+
ssoPageURI: env?.ssoPageURI,
|
|
1877
|
+
enabled: !env?.accessToken
|
|
1866
1878
|
});
|
|
1867
1879
|
const slapiFetcher = (0, import_react10.useMemo)(() => {
|
|
1868
1880
|
if (accessToken || env.accessToken) {
|
|
@@ -1873,18 +1885,17 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1873
1885
|
});
|
|
1874
1886
|
}
|
|
1875
1887
|
}, [env.accessToken, environment, tenantId, accessToken]);
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
"
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1887
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1888
|
+
const getContent = () => {
|
|
1889
|
+
if (isChecking) {
|
|
1890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "w-full text-center text-sm", children: "Loading..." });
|
|
1891
|
+
}
|
|
1892
|
+
if (error) {
|
|
1893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "w-full text-center text-sm", children: [
|
|
1894
|
+
"Error: ",
|
|
1895
|
+
error.message
|
|
1896
|
+
] });
|
|
1897
|
+
}
|
|
1898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1888
1899
|
import_swr4.SWRConfig,
|
|
1889
1900
|
{
|
|
1890
1901
|
value: {
|
|
@@ -1895,7 +1906,11 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1895
1906
|
},
|
|
1896
1907
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_nice_modal_react6.default.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SpreePayContent, { ...rest }) }) })
|
|
1897
1908
|
}
|
|
1898
|
-
)
|
|
1909
|
+
);
|
|
1910
|
+
};
|
|
1911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { ref: rootRef, className: cn("sl-spreepay", className), children: [
|
|
1912
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "sl-spreepay__portal" }),
|
|
1913
|
+
getContent()
|
|
1899
1914
|
] });
|
|
1900
1915
|
};
|
|
1901
1916
|
|
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
|
|
|
@@ -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
|
|
|
@@ -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
|
};
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|