@superlogic/spree-pay 0.1.10 → 0.1.12
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 +71 -50
- package/build/index.css +986 -999
- package/build/index.d.cts +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +71 -50
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -187,14 +187,13 @@ var formatUSD = (amount, currency = "USD") => {
|
|
|
187
187
|
}).format(amount);
|
|
188
188
|
return formattedAmount;
|
|
189
189
|
};
|
|
190
|
-
var
|
|
191
|
-
var formatPoints = (amount) => {
|
|
190
|
+
var formatPoints = (amount, pointsTitle = "Pts") => {
|
|
192
191
|
const formattedAmount = new Intl.NumberFormat("en-US", {
|
|
193
192
|
style: "decimal",
|
|
194
193
|
maximumFractionDigits: 5,
|
|
195
194
|
minimumFractionDigits: 0
|
|
196
195
|
}).format(amount);
|
|
197
|
-
return `${formattedAmount}
|
|
196
|
+
return `${formattedAmount} ${pointsTitle}`;
|
|
198
197
|
};
|
|
199
198
|
var formatCoin = (amount, currency = "USDC") => {
|
|
200
199
|
const formattedAmount = new Intl.NumberFormat("en-US", {
|
|
@@ -211,8 +210,8 @@ var CheckoutButton = ({ isProcessing, amount, onCheckout }) => {
|
|
|
211
210
|
const { selectedPaymentMethod, isInternalProcessing } = useSpreePaymentMethod();
|
|
212
211
|
const isDisabled = !amount || !selectedPaymentMethod.method || !!isProcessing || isInternalProcessing;
|
|
213
212
|
const isUSD = selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */;
|
|
214
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex w-full flex-col overflow-hidden rounded-
|
|
215
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "px-7 py-5", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "text-
|
|
213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex w-full flex-col overflow-hidden rounded-3xl border border-black/25 bg-white text-xs font-medium", children: [
|
|
214
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "px-7 py-5", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "text-black/50", children: [
|
|
216
215
|
"By clicking on the button below I acknowledge that I have read and accepted the",
|
|
217
216
|
" ",
|
|
218
217
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { className: "underline", href: "/", children: "Property Policies" }),
|
|
@@ -251,7 +250,7 @@ var SpreeLegal = () => {
|
|
|
251
250
|
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"
|
|
252
251
|
}
|
|
253
252
|
) }),
|
|
254
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "text-xs text-
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "text-xs text-black/50", children: [
|
|
255
254
|
"Spree enables seamless crypto payments for real-world goods, travel, and experiences. Enjoy secure, fast transactions and earn rewards.",
|
|
256
255
|
" ",
|
|
257
256
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { className: "underline", href: "/", children: "Learn more" }),
|
|
@@ -562,13 +561,8 @@ var SlapiPaymentService = {
|
|
|
562
561
|
};
|
|
563
562
|
|
|
564
563
|
// src/services/cardPayment.ts
|
|
565
|
-
var cardPayment = async ({
|
|
566
|
-
card,
|
|
567
|
-
hash,
|
|
568
|
-
redirect3dsURI,
|
|
569
|
-
metadata,
|
|
570
|
-
capture
|
|
571
|
-
}) => {
|
|
564
|
+
var cardPayment = async (params) => {
|
|
565
|
+
const { card, redirect3dsURI, hash, capture, metadata } = params;
|
|
572
566
|
let cardId = card.id;
|
|
573
567
|
if ("token" in card) {
|
|
574
568
|
const { data: cardResData } = await SlapiPaymentService.addCard({ hash, source: card.token });
|
|
@@ -586,6 +580,7 @@ var cardPayment = async ({
|
|
|
586
580
|
if (paymentIntent) {
|
|
587
581
|
const { data: validateData } = await SlapiPaymentService.validate3DS({ paymentId: paymentResData.id });
|
|
588
582
|
return {
|
|
583
|
+
paymentType: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
589
584
|
status: validateData.status,
|
|
590
585
|
paymentId: paymentResData.id,
|
|
591
586
|
txId: paymentResData.txId,
|
|
@@ -594,6 +589,7 @@ var cardPayment = async ({
|
|
|
594
589
|
}
|
|
595
590
|
}
|
|
596
591
|
return {
|
|
592
|
+
paymentType: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
597
593
|
status: paymentResData.status,
|
|
598
594
|
paymentId: paymentResData.id,
|
|
599
595
|
txId: paymentResData.txId,
|
|
@@ -648,7 +644,7 @@ function Switch({ className, ...props }) {
|
|
|
648
644
|
// src/components/common/PointsSwitch.tsx
|
|
649
645
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
650
646
|
var PointsSwitch = (props) => {
|
|
651
|
-
const { disabled = false, value, onChange } = props;
|
|
647
|
+
const { pointsConversionRatio, disabled = false, value, onChange, pointsTitle } = props;
|
|
652
648
|
const { balance } = useSlapiBalance();
|
|
653
649
|
const id = (0, import_react4.useId)();
|
|
654
650
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
|
|
@@ -660,9 +656,9 @@ var PointsSwitch = (props) => {
|
|
|
660
656
|
] })
|
|
661
657
|
] }),
|
|
662
658
|
balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "text-sm font-medium text-black", children: [
|
|
663
|
-
formatPoints(balance.availablePoints),
|
|
659
|
+
formatPoints(balance.availablePoints, pointsTitle),
|
|
664
660
|
" ",
|
|
665
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-black/50", children: formatUSD(balance.availablePoints /
|
|
661
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-black/50", children: formatUSD(balance.availablePoints / pointsConversionRatio) })
|
|
666
662
|
] }) : null
|
|
667
663
|
] });
|
|
668
664
|
};
|
|
@@ -718,7 +714,7 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
718
714
|
children: [
|
|
719
715
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-sm font-medium text-black", children: card.schema }) }),
|
|
720
716
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
721
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "text-sm font-medium text-
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "text-sm font-medium text-black/50", children: [
|
|
722
718
|
"Ending in ",
|
|
723
719
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-black", children: card.lastFourNumbers })
|
|
724
720
|
] }),
|
|
@@ -998,7 +994,7 @@ var PointsSelector = ({ isSelected, onSelect, children }) => {
|
|
|
998
994
|
)
|
|
999
995
|
);
|
|
1000
996
|
};
|
|
1001
|
-
var CreditCardTab = () => {
|
|
997
|
+
var CreditCardTab = ({ pointsTitle, pointsConversionRatio }) => {
|
|
1002
998
|
const [usePoints, setUsePoints] = (0, import_react7.useState)(false);
|
|
1003
999
|
const [selectedPointsType, setSelectedPointsType] = (0, import_react7.useState)(null);
|
|
1004
1000
|
const { balance, isBalanceLoading } = useSlapiBalance();
|
|
@@ -1032,15 +1028,24 @@ var CreditCardTab = () => {
|
|
|
1032
1028
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
|
|
1033
1029
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "border-b-1 border-black/7 px-7 py-6", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CreditCard, {}) }),
|
|
1034
1030
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-6 px-7 py-6", children: [
|
|
1035
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1031
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1032
|
+
PointsSwitch,
|
|
1033
|
+
{
|
|
1034
|
+
disabled: true,
|
|
1035
|
+
value: usePoints,
|
|
1036
|
+
onChange: setUsePoints,
|
|
1037
|
+
pointsTitle,
|
|
1038
|
+
pointsConversionRatio
|
|
1039
|
+
}
|
|
1040
|
+
),
|
|
1036
1041
|
usePoints && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
1037
1042
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(PointsSelector, { onSelect: () => setSelectedPointsType("slapi"), isSelected: selectedPointsType === "slapi", children: [
|
|
1038
1043
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-sm font-medium text-black", children: "from [Brand] Balance" }) }),
|
|
1039
1044
|
isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-4 w-6 animate-pulse bg-gray-200" }) : !balance?.availablePoints && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-sm font-medium text-black", children: "No points available" }),
|
|
1040
1045
|
balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "text-sm font-medium text-black", children: [
|
|
1041
|
-
formatPoints(balance.availablePoints),
|
|
1046
|
+
formatPoints(balance.availablePoints, pointsTitle),
|
|
1042
1047
|
" ",
|
|
1043
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-black/50", children: formatUSD(balance.availablePoints /
|
|
1048
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-black/50", children: formatUSD(balance.availablePoints / pointsConversionRatio) })
|
|
1044
1049
|
] }) : null
|
|
1045
1050
|
] }),
|
|
1046
1051
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
@@ -1226,7 +1231,8 @@ var useCryptoPayment = () => {
|
|
|
1226
1231
|
txHash,
|
|
1227
1232
|
paymentId: paymentRes.data.id,
|
|
1228
1233
|
txId: paymentRes.data.txId,
|
|
1229
|
-
status: res.verified ? "AUTHORIZED" /* AUTHORIZED */ : "FAILED" /* FAILED
|
|
1234
|
+
status: res.verified ? "AUTHORIZED" /* AUTHORIZED */ : "FAILED" /* FAILED */,
|
|
1235
|
+
paymentType: "CRYPTO" /* CRYPTO */
|
|
1230
1236
|
};
|
|
1231
1237
|
};
|
|
1232
1238
|
return { cryptoPayment };
|
|
@@ -1243,7 +1249,7 @@ var ConnectButton = () => {
|
|
|
1243
1249
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1244
1250
|
"button",
|
|
1245
1251
|
{
|
|
1246
|
-
className: "h-[34px] rounded-md border-1 border-black px-3 text-sm font-medium",
|
|
1252
|
+
className: "h-[34px] rounded-md border-1 border-black px-3 text-sm font-medium text-black",
|
|
1247
1253
|
onClick: openConnectModal,
|
|
1248
1254
|
children: "Connect a Wallet"
|
|
1249
1255
|
}
|
|
@@ -1262,7 +1268,7 @@ var ConnectButton = () => {
|
|
|
1262
1268
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1263
1269
|
"button",
|
|
1264
1270
|
{
|
|
1265
|
-
className: "flex h-[34px] items-center gap-2 rounded-md border-1 border-black px-1.5 text-sm font-medium",
|
|
1271
|
+
className: "flex h-[34px] items-center gap-2 rounded-md border-1 border-black px-1.5 text-sm font-medium text-black",
|
|
1266
1272
|
onClick: openAccountModal,
|
|
1267
1273
|
children: [
|
|
1268
1274
|
chain.hasIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "h-6 w-6 overflow-hidden rounded-full", style: { background: chain.iconBackground }, children: chain.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { alt: chain.name ?? "Chain icon", src: chain.iconUrl }) }),
|
|
@@ -1507,7 +1513,7 @@ var CryptoSelectModal = import_nice_modal_react3.default.create(() => {
|
|
|
1507
1513
|
nativeBalance && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1508
1514
|
"button",
|
|
1509
1515
|
{
|
|
1510
|
-
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 hover:bg-gray-100",
|
|
1516
|
+
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-black hover:bg-gray-100",
|
|
1511
1517
|
onClick: () => handleSelect(nativeBalance),
|
|
1512
1518
|
children: [
|
|
1513
1519
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1536,7 +1542,7 @@ var CryptoSelectModal = import_nice_modal_react3.default.create(() => {
|
|
|
1536
1542
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1537
1543
|
"button",
|
|
1538
1544
|
{
|
|
1539
|
-
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",
|
|
1545
|
+
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",
|
|
1540
1546
|
onClick: () => handleSelect(coin),
|
|
1541
1547
|
children: [
|
|
1542
1548
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1582,10 +1588,10 @@ var SelectedCoin = (props) => {
|
|
|
1582
1588
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1583
1589
|
Icon,
|
|
1584
1590
|
!Icon && logoURI && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { className: "mr-1 h-8 w-8 shrink-0", src: logoURI, alt: `${coin} logo` }),
|
|
1585
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "font-semibold", children: coin }),
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "font-semibold text-black", children: coin }),
|
|
1586
1592
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M6 12.4341L10 8.43408L6 4.43408", stroke: "black", strokeLinecap: "round" }) })
|
|
1587
1593
|
] }),
|
|
1588
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "text-xs font-medium text-
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "text-xs font-medium text-black/50", children: [
|
|
1589
1595
|
"Wallet balance ",
|
|
1590
1596
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-black", children: balance })
|
|
1591
1597
|
] })
|
|
@@ -1662,10 +1668,11 @@ var CryptoWrapper = () => {
|
|
|
1662
1668
|
|
|
1663
1669
|
// src/components/CryptoTab/CryptoTab.tsx
|
|
1664
1670
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1665
|
-
var CryptoTab = () => {
|
|
1671
|
+
var CryptoTab = (props) => {
|
|
1672
|
+
const { pointsTitle, pointsConversionRatio } = props;
|
|
1666
1673
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
|
1667
1674
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "border-b-1 border-black/7 px-7 py-6", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CryptoWrapper, {}) }),
|
|
1668
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "px-7 py-6", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PointsSwitch, { disabled: true }) })
|
|
1675
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "px-7 py-6", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PointsSwitch, { disabled: true, pointsTitle, pointsConversionRatio }) })
|
|
1669
1676
|
] });
|
|
1670
1677
|
};
|
|
1671
1678
|
|
|
@@ -1728,24 +1735,25 @@ var TabButtons = (props) => {
|
|
|
1728
1735
|
|
|
1729
1736
|
// src/components/Tabs.tsx
|
|
1730
1737
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1731
|
-
var Tabs = () => {
|
|
1738
|
+
var Tabs = ({ config: config2 }) => {
|
|
1732
1739
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
1733
|
-
|
|
1740
|
+
const { pointsConversionRatio, pointsTitle } = config2;
|
|
1741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "mb-4 rounded-3xl border border-black/25 bg-white", children: [
|
|
1734
1742
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex w-full flex-col gap-4 border-b-1 border-black/7 px-7 py-6", children: [
|
|
1735
1743
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "text-primary text-2xl font-semibold", children: "Choose a Payment Method" }),
|
|
1736
1744
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TabButtons, { value: selectedPaymentMethod.type, onChange: setSelectedPaymentMethod })
|
|
1737
1745
|
] }),
|
|
1738
|
-
selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CreditCardTab, {}),
|
|
1739
|
-
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CryptoTab, {})
|
|
1746
|
+
selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CreditCardTab, { pointsTitle, pointsConversionRatio }),
|
|
1747
|
+
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CryptoTab, { pointsTitle, pointsConversionRatio })
|
|
1740
1748
|
] });
|
|
1741
1749
|
};
|
|
1742
1750
|
|
|
1743
1751
|
// src/SpreePayContent.tsx
|
|
1744
1752
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1745
1753
|
var SpreePayContent = (props) => {
|
|
1746
|
-
const { amount, onProcess, isProcessing } = props;
|
|
1754
|
+
const { config: config2, amount, onProcess, isProcessing } = props;
|
|
1747
1755
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "w-full", children: [
|
|
1748
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Tabs, {}),
|
|
1756
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Tabs, { config: config2 }),
|
|
1749
1757
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckoutButton, { isProcessing, onCheckout: onProcess, amount }),
|
|
1750
1758
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SpreeLegal, {})
|
|
1751
1759
|
] });
|
|
@@ -1820,41 +1828,53 @@ function useKeycloakSSO(config2) {
|
|
|
1820
1828
|
|
|
1821
1829
|
// src/SpreePay.tsx
|
|
1822
1830
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1823
|
-
var
|
|
1831
|
+
var CONFIG = {
|
|
1824
1832
|
dev: {
|
|
1825
1833
|
bookit: {
|
|
1826
1834
|
slapiUrl: "https://slapi.dev.superlogic.com",
|
|
1827
1835
|
keyklockUrl: "https://auth.dev.join.bookit.com",
|
|
1828
|
-
keyklockClientId: "oneof-next"
|
|
1836
|
+
keyklockClientId: "oneof-next",
|
|
1837
|
+
pointsConversionRatio: 100,
|
|
1838
|
+
pointsTitle: "AIR SP"
|
|
1829
1839
|
},
|
|
1830
1840
|
moca: {
|
|
1831
1841
|
slapiUrl: "https://slapi.dev.air.shop",
|
|
1832
1842
|
keyklockUrl: "https://login.dev.air.shop",
|
|
1833
|
-
keyklockClientId: "oneof-next"
|
|
1843
|
+
keyklockClientId: "oneof-next",
|
|
1844
|
+
pointsConversionRatio: 100,
|
|
1845
|
+
pointsTitle: "AIR SP"
|
|
1834
1846
|
}
|
|
1835
1847
|
},
|
|
1836
1848
|
stg: {
|
|
1837
1849
|
bookit: {
|
|
1838
1850
|
slapiUrl: "https://slapi.stg.superlogic.com",
|
|
1839
1851
|
keyklockUrl: "https://auth.stg.join.bookit.com",
|
|
1840
|
-
keyklockClientId: "oneof-next"
|
|
1852
|
+
keyklockClientId: "oneof-next",
|
|
1853
|
+
pointsConversionRatio: 100,
|
|
1854
|
+
pointsTitle: "AIR SP"
|
|
1841
1855
|
},
|
|
1842
1856
|
moca: {
|
|
1843
|
-
slapiUrl: "https://slapi.stg.
|
|
1857
|
+
slapiUrl: "https://slapi.stg.air.shop",
|
|
1844
1858
|
keyklockUrl: "https://login.stg.air.shop",
|
|
1845
|
-
keyklockClientId: "oneof-next"
|
|
1859
|
+
keyklockClientId: "oneof-next",
|
|
1860
|
+
pointsConversionRatio: 100,
|
|
1861
|
+
pointsTitle: "AIR SP"
|
|
1846
1862
|
}
|
|
1847
1863
|
},
|
|
1848
1864
|
prod: {
|
|
1849
1865
|
bookit: {
|
|
1850
1866
|
slapiUrl: "https://slapi.superlogic.com",
|
|
1851
1867
|
keyklockUrl: "https://auth.join.bookit.com",
|
|
1852
|
-
keyklockClientId: "oneof-next"
|
|
1868
|
+
keyklockClientId: "oneof-next",
|
|
1869
|
+
pointsConversionRatio: 100,
|
|
1870
|
+
pointsTitle: "AIR SP"
|
|
1853
1871
|
},
|
|
1854
1872
|
moca: {
|
|
1855
|
-
slapiUrl: "https://slapi.
|
|
1873
|
+
slapiUrl: "https://slapi.air.shop",
|
|
1856
1874
|
keyklockUrl: "https://login.air.shop",
|
|
1857
|
-
keyklockClientId: "oneof-next"
|
|
1875
|
+
keyklockClientId: "oneof-next",
|
|
1876
|
+
pointsConversionRatio: 100,
|
|
1877
|
+
pointsTitle: "AIR SP"
|
|
1858
1878
|
}
|
|
1859
1879
|
}
|
|
1860
1880
|
};
|
|
@@ -1869,10 +1889,11 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1869
1889
|
const { env } = useSpreePayEnv();
|
|
1870
1890
|
const environment = env?.environment || "dev";
|
|
1871
1891
|
const tenantId = env?.tenantId || "bookit";
|
|
1892
|
+
const config2 = CONFIG[environment]?.[tenantId];
|
|
1872
1893
|
const { isChecking, accessToken, error } = useKeycloakSSO({
|
|
1873
1894
|
realm: tenantId,
|
|
1874
|
-
url:
|
|
1875
|
-
clientId:
|
|
1895
|
+
url: config2.keyklockUrl,
|
|
1896
|
+
clientId: config2.keyklockClientId,
|
|
1876
1897
|
ssoPageURI: env?.ssoPageURI,
|
|
1877
1898
|
enabled: !env?.accessToken
|
|
1878
1899
|
});
|
|
@@ -1881,10 +1902,10 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1881
1902
|
return registerApi({
|
|
1882
1903
|
accessToken: env.accessToken || accessToken,
|
|
1883
1904
|
tenantId,
|
|
1884
|
-
baseUrl:
|
|
1905
|
+
baseUrl: config2.slapiUrl
|
|
1885
1906
|
});
|
|
1886
1907
|
}
|
|
1887
|
-
}, [env.accessToken,
|
|
1908
|
+
}, [env.accessToken, config2, tenantId, accessToken]);
|
|
1888
1909
|
const getContent = () => {
|
|
1889
1910
|
if (isChecking) {
|
|
1890
1911
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "w-full text-center text-sm", children: "Loading..." });
|
|
@@ -1904,7 +1925,7 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1904
1925
|
revalidateIfStale: false,
|
|
1905
1926
|
revalidateOnReconnect: false
|
|
1906
1927
|
},
|
|
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 }) }) })
|
|
1928
|
+
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, { config: config2, ...rest }) }) })
|
|
1908
1929
|
}
|
|
1909
1930
|
);
|
|
1910
1931
|
};
|