@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.d.cts
CHANGED
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -148,14 +148,13 @@ var formatUSD = (amount, currency = "USD") => {
|
|
|
148
148
|
}).format(amount);
|
|
149
149
|
return formattedAmount;
|
|
150
150
|
};
|
|
151
|
-
var
|
|
152
|
-
var formatPoints = (amount) => {
|
|
151
|
+
var formatPoints = (amount, pointsTitle = "Pts") => {
|
|
153
152
|
const formattedAmount = new Intl.NumberFormat("en-US", {
|
|
154
153
|
style: "decimal",
|
|
155
154
|
maximumFractionDigits: 5,
|
|
156
155
|
minimumFractionDigits: 0
|
|
157
156
|
}).format(amount);
|
|
158
|
-
return `${formattedAmount}
|
|
157
|
+
return `${formattedAmount} ${pointsTitle}`;
|
|
159
158
|
};
|
|
160
159
|
var formatCoin = (amount, currency = "USDC") => {
|
|
161
160
|
const formattedAmount = new Intl.NumberFormat("en-US", {
|
|
@@ -172,8 +171,8 @@ var CheckoutButton = ({ isProcessing, amount, onCheckout }) => {
|
|
|
172
171
|
const { selectedPaymentMethod, isInternalProcessing } = useSpreePaymentMethod();
|
|
173
172
|
const isDisabled = !amount || !selectedPaymentMethod.method || !!isProcessing || isInternalProcessing;
|
|
174
173
|
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-
|
|
174
|
+
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: [
|
|
175
|
+
/* @__PURE__ */ jsx3("div", { className: "px-7 py-5", children: /* @__PURE__ */ jsxs2("p", { className: "text-black/50", children: [
|
|
177
176
|
"By clicking on the button below I acknowledge that I have read and accepted the",
|
|
178
177
|
" ",
|
|
179
178
|
/* @__PURE__ */ jsx3("a", { className: "underline", href: "/", children: "Property Policies" }),
|
|
@@ -212,7 +211,7 @@ var SpreeLegal = () => {
|
|
|
212
211
|
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
212
|
}
|
|
214
213
|
) }),
|
|
215
|
-
/* @__PURE__ */ jsxs3("p", { className: "text-xs text-
|
|
214
|
+
/* @__PURE__ */ jsxs3("p", { className: "text-xs text-black/50", children: [
|
|
216
215
|
"Spree enables seamless crypto payments for real-world goods, travel, and experiences. Enjoy secure, fast transactions and earn rewards.",
|
|
217
216
|
" ",
|
|
218
217
|
/* @__PURE__ */ jsx4("a", { className: "underline", href: "/", children: "Learn more" }),
|
|
@@ -523,13 +522,8 @@ var SlapiPaymentService = {
|
|
|
523
522
|
};
|
|
524
523
|
|
|
525
524
|
// src/services/cardPayment.ts
|
|
526
|
-
var cardPayment = async ({
|
|
527
|
-
card,
|
|
528
|
-
hash,
|
|
529
|
-
redirect3dsURI,
|
|
530
|
-
metadata,
|
|
531
|
-
capture
|
|
532
|
-
}) => {
|
|
525
|
+
var cardPayment = async (params) => {
|
|
526
|
+
const { card, redirect3dsURI, hash, capture, metadata } = params;
|
|
533
527
|
let cardId = card.id;
|
|
534
528
|
if ("token" in card) {
|
|
535
529
|
const { data: cardResData } = await SlapiPaymentService.addCard({ hash, source: card.token });
|
|
@@ -547,6 +541,7 @@ var cardPayment = async ({
|
|
|
547
541
|
if (paymentIntent) {
|
|
548
542
|
const { data: validateData } = await SlapiPaymentService.validate3DS({ paymentId: paymentResData.id });
|
|
549
543
|
return {
|
|
544
|
+
paymentType: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
550
545
|
status: validateData.status,
|
|
551
546
|
paymentId: paymentResData.id,
|
|
552
547
|
txId: paymentResData.txId,
|
|
@@ -555,6 +550,7 @@ var cardPayment = async ({
|
|
|
555
550
|
}
|
|
556
551
|
}
|
|
557
552
|
return {
|
|
553
|
+
paymentType: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
558
554
|
status: paymentResData.status,
|
|
559
555
|
paymentId: paymentResData.id,
|
|
560
556
|
txId: paymentResData.txId,
|
|
@@ -609,7 +605,7 @@ function Switch({ className, ...props }) {
|
|
|
609
605
|
// src/components/common/PointsSwitch.tsx
|
|
610
606
|
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
611
607
|
var PointsSwitch = (props) => {
|
|
612
|
-
const { disabled = false, value, onChange } = props;
|
|
608
|
+
const { pointsConversionRatio, disabled = false, value, onChange, pointsTitle } = props;
|
|
613
609
|
const { balance } = useSlapiBalance();
|
|
614
610
|
const id = useId();
|
|
615
611
|
return /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-3", children: [
|
|
@@ -621,9 +617,9 @@ var PointsSwitch = (props) => {
|
|
|
621
617
|
] })
|
|
622
618
|
] }),
|
|
623
619
|
balance?.availablePoints ? /* @__PURE__ */ jsxs6("p", { className: "text-sm font-medium text-black", children: [
|
|
624
|
-
formatPoints(balance.availablePoints),
|
|
620
|
+
formatPoints(balance.availablePoints, pointsTitle),
|
|
625
621
|
" ",
|
|
626
|
-
/* @__PURE__ */ jsx9("span", { className: "text-black/50", children: formatUSD(balance.availablePoints /
|
|
622
|
+
/* @__PURE__ */ jsx9("span", { className: "text-black/50", children: formatUSD(balance.availablePoints / pointsConversionRatio) })
|
|
627
623
|
] }) : null
|
|
628
624
|
] });
|
|
629
625
|
};
|
|
@@ -679,7 +675,7 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
679
675
|
children: [
|
|
680
676
|
/* @__PURE__ */ jsx10("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx10("p", { className: "text-sm font-medium text-black", children: card.schema }) }),
|
|
681
677
|
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
|
|
682
|
-
/* @__PURE__ */ jsxs7("p", { className: "text-sm font-medium text-
|
|
678
|
+
/* @__PURE__ */ jsxs7("p", { className: "text-sm font-medium text-black/50", children: [
|
|
683
679
|
"Ending in ",
|
|
684
680
|
/* @__PURE__ */ jsx10("span", { className: "text-black", children: card.lastFourNumbers })
|
|
685
681
|
] }),
|
|
@@ -959,7 +955,7 @@ var PointsSelector = ({ isSelected, onSelect, children }) => {
|
|
|
959
955
|
)
|
|
960
956
|
);
|
|
961
957
|
};
|
|
962
|
-
var CreditCardTab = () => {
|
|
958
|
+
var CreditCardTab = ({ pointsTitle, pointsConversionRatio }) => {
|
|
963
959
|
const [usePoints, setUsePoints] = useState4(false);
|
|
964
960
|
const [selectedPointsType, setSelectedPointsType] = useState4(null);
|
|
965
961
|
const { balance, isBalanceLoading } = useSlapiBalance();
|
|
@@ -993,15 +989,24 @@ var CreditCardTab = () => {
|
|
|
993
989
|
return /* @__PURE__ */ jsxs10("div", { children: [
|
|
994
990
|
/* @__PURE__ */ jsx15("div", { className: "border-b-1 border-black/7 px-7 py-6", children: /* @__PURE__ */ jsx15(CreditCard, {}) }),
|
|
995
991
|
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-6 px-7 py-6", children: [
|
|
996
|
-
/* @__PURE__ */ jsx15(
|
|
992
|
+
/* @__PURE__ */ jsx15(
|
|
993
|
+
PointsSwitch,
|
|
994
|
+
{
|
|
995
|
+
disabled: true,
|
|
996
|
+
value: usePoints,
|
|
997
|
+
onChange: setUsePoints,
|
|
998
|
+
pointsTitle,
|
|
999
|
+
pointsConversionRatio
|
|
1000
|
+
}
|
|
1001
|
+
),
|
|
997
1002
|
usePoints && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1", children: [
|
|
998
1003
|
/* @__PURE__ */ jsxs10(PointsSelector, { onSelect: () => setSelectedPointsType("slapi"), isSelected: selectedPointsType === "slapi", children: [
|
|
999
1004
|
/* @__PURE__ */ jsx15("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx15("p", { className: "text-sm font-medium text-black", children: "from [Brand] Balance" }) }),
|
|
1000
1005
|
isBalanceLoading ? /* @__PURE__ */ jsx15("div", { className: "h-4 w-6 animate-pulse bg-gray-200" }) : !balance?.availablePoints && /* @__PURE__ */ jsx15("p", { className: "text-sm font-medium text-black", children: "No points available" }),
|
|
1001
1006
|
balance?.availablePoints ? /* @__PURE__ */ jsxs10("p", { className: "text-sm font-medium text-black", children: [
|
|
1002
|
-
formatPoints(balance.availablePoints),
|
|
1007
|
+
formatPoints(balance.availablePoints, pointsTitle),
|
|
1003
1008
|
" ",
|
|
1004
|
-
/* @__PURE__ */ jsx15("span", { className: "text-black/50", children: formatUSD(balance.availablePoints /
|
|
1009
|
+
/* @__PURE__ */ jsx15("span", { className: "text-black/50", children: formatUSD(balance.availablePoints / pointsConversionRatio) })
|
|
1005
1010
|
] }) : null
|
|
1006
1011
|
] }),
|
|
1007
1012
|
/* @__PURE__ */ jsxs10(
|
|
@@ -1187,7 +1192,8 @@ var useCryptoPayment = () => {
|
|
|
1187
1192
|
txHash,
|
|
1188
1193
|
paymentId: paymentRes.data.id,
|
|
1189
1194
|
txId: paymentRes.data.txId,
|
|
1190
|
-
status: res.verified ? "AUTHORIZED" /* AUTHORIZED */ : "FAILED" /* FAILED
|
|
1195
|
+
status: res.verified ? "AUTHORIZED" /* AUTHORIZED */ : "FAILED" /* FAILED */,
|
|
1196
|
+
paymentType: "CRYPTO" /* CRYPTO */
|
|
1191
1197
|
};
|
|
1192
1198
|
};
|
|
1193
1199
|
return { cryptoPayment };
|
|
@@ -1204,7 +1210,7 @@ var ConnectButton = () => {
|
|
|
1204
1210
|
return /* @__PURE__ */ jsx16(
|
|
1205
1211
|
"button",
|
|
1206
1212
|
{
|
|
1207
|
-
className: "h-[34px] rounded-md border-1 border-black px-3 text-sm font-medium",
|
|
1213
|
+
className: "h-[34px] rounded-md border-1 border-black px-3 text-sm font-medium text-black",
|
|
1208
1214
|
onClick: openConnectModal,
|
|
1209
1215
|
children: "Connect a Wallet"
|
|
1210
1216
|
}
|
|
@@ -1223,7 +1229,7 @@ var ConnectButton = () => {
|
|
|
1223
1229
|
return /* @__PURE__ */ jsxs11(
|
|
1224
1230
|
"button",
|
|
1225
1231
|
{
|
|
1226
|
-
className: "flex h-[34px] items-center gap-2 rounded-md border-1 border-black px-1.5 text-sm font-medium",
|
|
1232
|
+
className: "flex h-[34px] items-center gap-2 rounded-md border-1 border-black px-1.5 text-sm font-medium text-black",
|
|
1227
1233
|
onClick: openAccountModal,
|
|
1228
1234
|
children: [
|
|
1229
1235
|
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 }) }),
|
|
@@ -1468,7 +1474,7 @@ var CryptoSelectModal = NiceModal3.create(() => {
|
|
|
1468
1474
|
nativeBalance && /* @__PURE__ */ jsxs14(
|
|
1469
1475
|
"button",
|
|
1470
1476
|
{
|
|
1471
|
-
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 hover:bg-gray-100",
|
|
1477
|
+
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-black hover:bg-gray-100",
|
|
1472
1478
|
onClick: () => handleSelect(nativeBalance),
|
|
1473
1479
|
children: [
|
|
1474
1480
|
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1497,7 +1503,7 @@ var CryptoSelectModal = NiceModal3.create(() => {
|
|
|
1497
1503
|
return /* @__PURE__ */ jsxs14(
|
|
1498
1504
|
"button",
|
|
1499
1505
|
{
|
|
1500
|
-
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",
|
|
1506
|
+
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",
|
|
1501
1507
|
onClick: () => handleSelect(coin),
|
|
1502
1508
|
children: [
|
|
1503
1509
|
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1543,10 +1549,10 @@ var SelectedCoin = (props) => {
|
|
|
1543
1549
|
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
|
|
1544
1550
|
Icon,
|
|
1545
1551
|
!Icon && logoURI && /* @__PURE__ */ jsx21("img", { className: "mr-1 h-8 w-8 shrink-0", src: logoURI, alt: `${coin} logo` }),
|
|
1546
|
-
/* @__PURE__ */ jsx21("p", { className: "font-semibold", children: coin }),
|
|
1552
|
+
/* @__PURE__ */ jsx21("p", { className: "font-semibold text-black", children: coin }),
|
|
1547
1553
|
/* @__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" }) })
|
|
1548
1554
|
] }),
|
|
1549
|
-
/* @__PURE__ */ jsxs16("p", { className: "text-xs font-medium text-
|
|
1555
|
+
/* @__PURE__ */ jsxs16("p", { className: "text-xs font-medium text-black/50", children: [
|
|
1550
1556
|
"Wallet balance ",
|
|
1551
1557
|
/* @__PURE__ */ jsx21("span", { className: "text-black", children: balance })
|
|
1552
1558
|
] })
|
|
@@ -1623,10 +1629,11 @@ var CryptoWrapper = () => {
|
|
|
1623
1629
|
|
|
1624
1630
|
// src/components/CryptoTab/CryptoTab.tsx
|
|
1625
1631
|
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1626
|
-
var CryptoTab = () => {
|
|
1632
|
+
var CryptoTab = (props) => {
|
|
1633
|
+
const { pointsTitle, pointsConversionRatio } = props;
|
|
1627
1634
|
return /* @__PURE__ */ jsxs18("div", { children: [
|
|
1628
1635
|
/* @__PURE__ */ jsx24("div", { className: "border-b-1 border-black/7 px-7 py-6", children: /* @__PURE__ */ jsx24(CryptoWrapper, {}) }),
|
|
1629
|
-
/* @__PURE__ */ jsx24("div", { className: "px-7 py-6", children: /* @__PURE__ */ jsx24(PointsSwitch, { disabled: true }) })
|
|
1636
|
+
/* @__PURE__ */ jsx24("div", { className: "px-7 py-6", children: /* @__PURE__ */ jsx24(PointsSwitch, { disabled: true, pointsTitle, pointsConversionRatio }) })
|
|
1630
1637
|
] });
|
|
1631
1638
|
};
|
|
1632
1639
|
|
|
@@ -1689,24 +1696,25 @@ var TabButtons = (props) => {
|
|
|
1689
1696
|
|
|
1690
1697
|
// src/components/Tabs.tsx
|
|
1691
1698
|
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1692
|
-
var Tabs = () => {
|
|
1699
|
+
var Tabs = ({ config: config2 }) => {
|
|
1693
1700
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
1694
|
-
|
|
1701
|
+
const { pointsConversionRatio, pointsTitle } = config2;
|
|
1702
|
+
return /* @__PURE__ */ jsxs20("div", { className: "mb-4 rounded-3xl border border-black/25 bg-white", children: [
|
|
1695
1703
|
/* @__PURE__ */ jsxs20("div", { className: "flex w-full flex-col gap-4 border-b-1 border-black/7 px-7 py-6", children: [
|
|
1696
1704
|
/* @__PURE__ */ jsx26("h2", { className: "text-primary text-2xl font-semibold", children: "Choose a Payment Method" }),
|
|
1697
1705
|
/* @__PURE__ */ jsx26(TabButtons, { value: selectedPaymentMethod.type, onChange: setSelectedPaymentMethod })
|
|
1698
1706
|
] }),
|
|
1699
|
-
selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && /* @__PURE__ */ jsx26(CreditCardTab, {}),
|
|
1700
|
-
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && /* @__PURE__ */ jsx26(CryptoTab, {})
|
|
1707
|
+
selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && /* @__PURE__ */ jsx26(CreditCardTab, { pointsTitle, pointsConversionRatio }),
|
|
1708
|
+
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && /* @__PURE__ */ jsx26(CryptoTab, { pointsTitle, pointsConversionRatio })
|
|
1701
1709
|
] });
|
|
1702
1710
|
};
|
|
1703
1711
|
|
|
1704
1712
|
// src/SpreePayContent.tsx
|
|
1705
1713
|
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1706
1714
|
var SpreePayContent = (props) => {
|
|
1707
|
-
const { amount, onProcess, isProcessing } = props;
|
|
1715
|
+
const { config: config2, amount, onProcess, isProcessing } = props;
|
|
1708
1716
|
return /* @__PURE__ */ jsxs21("div", { className: "w-full", children: [
|
|
1709
|
-
/* @__PURE__ */ jsx27(Tabs, {}),
|
|
1717
|
+
/* @__PURE__ */ jsx27(Tabs, { config: config2 }),
|
|
1710
1718
|
/* @__PURE__ */ jsx27(CheckoutButton, { isProcessing, onCheckout: onProcess, amount }),
|
|
1711
1719
|
/* @__PURE__ */ jsx27(SpreeLegal, {})
|
|
1712
1720
|
] });
|
|
@@ -1781,41 +1789,53 @@ function useKeycloakSSO(config2) {
|
|
|
1781
1789
|
|
|
1782
1790
|
// src/SpreePay.tsx
|
|
1783
1791
|
import { jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1784
|
-
var
|
|
1792
|
+
var CONFIG = {
|
|
1785
1793
|
dev: {
|
|
1786
1794
|
bookit: {
|
|
1787
1795
|
slapiUrl: "https://slapi.dev.superlogic.com",
|
|
1788
1796
|
keyklockUrl: "https://auth.dev.join.bookit.com",
|
|
1789
|
-
keyklockClientId: "oneof-next"
|
|
1797
|
+
keyklockClientId: "oneof-next",
|
|
1798
|
+
pointsConversionRatio: 100,
|
|
1799
|
+
pointsTitle: "AIR SP"
|
|
1790
1800
|
},
|
|
1791
1801
|
moca: {
|
|
1792
1802
|
slapiUrl: "https://slapi.dev.air.shop",
|
|
1793
1803
|
keyklockUrl: "https://login.dev.air.shop",
|
|
1794
|
-
keyklockClientId: "oneof-next"
|
|
1804
|
+
keyklockClientId: "oneof-next",
|
|
1805
|
+
pointsConversionRatio: 100,
|
|
1806
|
+
pointsTitle: "AIR SP"
|
|
1795
1807
|
}
|
|
1796
1808
|
},
|
|
1797
1809
|
stg: {
|
|
1798
1810
|
bookit: {
|
|
1799
1811
|
slapiUrl: "https://slapi.stg.superlogic.com",
|
|
1800
1812
|
keyklockUrl: "https://auth.stg.join.bookit.com",
|
|
1801
|
-
keyklockClientId: "oneof-next"
|
|
1813
|
+
keyklockClientId: "oneof-next",
|
|
1814
|
+
pointsConversionRatio: 100,
|
|
1815
|
+
pointsTitle: "AIR SP"
|
|
1802
1816
|
},
|
|
1803
1817
|
moca: {
|
|
1804
|
-
slapiUrl: "https://slapi.stg.
|
|
1818
|
+
slapiUrl: "https://slapi.stg.air.shop",
|
|
1805
1819
|
keyklockUrl: "https://login.stg.air.shop",
|
|
1806
|
-
keyklockClientId: "oneof-next"
|
|
1820
|
+
keyklockClientId: "oneof-next",
|
|
1821
|
+
pointsConversionRatio: 100,
|
|
1822
|
+
pointsTitle: "AIR SP"
|
|
1807
1823
|
}
|
|
1808
1824
|
},
|
|
1809
1825
|
prod: {
|
|
1810
1826
|
bookit: {
|
|
1811
1827
|
slapiUrl: "https://slapi.superlogic.com",
|
|
1812
1828
|
keyklockUrl: "https://auth.join.bookit.com",
|
|
1813
|
-
keyklockClientId: "oneof-next"
|
|
1829
|
+
keyklockClientId: "oneof-next",
|
|
1830
|
+
pointsConversionRatio: 100,
|
|
1831
|
+
pointsTitle: "AIR SP"
|
|
1814
1832
|
},
|
|
1815
1833
|
moca: {
|
|
1816
|
-
slapiUrl: "https://slapi.
|
|
1834
|
+
slapiUrl: "https://slapi.air.shop",
|
|
1817
1835
|
keyklockUrl: "https://login.air.shop",
|
|
1818
|
-
keyklockClientId: "oneof-next"
|
|
1836
|
+
keyklockClientId: "oneof-next",
|
|
1837
|
+
pointsConversionRatio: 100,
|
|
1838
|
+
pointsTitle: "AIR SP"
|
|
1819
1839
|
}
|
|
1820
1840
|
}
|
|
1821
1841
|
};
|
|
@@ -1830,10 +1850,11 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1830
1850
|
const { env } = useSpreePayEnv();
|
|
1831
1851
|
const environment = env?.environment || "dev";
|
|
1832
1852
|
const tenantId = env?.tenantId || "bookit";
|
|
1853
|
+
const config2 = CONFIG[environment]?.[tenantId];
|
|
1833
1854
|
const { isChecking, accessToken, error } = useKeycloakSSO({
|
|
1834
1855
|
realm: tenantId,
|
|
1835
|
-
url:
|
|
1836
|
-
clientId:
|
|
1856
|
+
url: config2.keyklockUrl,
|
|
1857
|
+
clientId: config2.keyklockClientId,
|
|
1837
1858
|
ssoPageURI: env?.ssoPageURI,
|
|
1838
1859
|
enabled: !env?.accessToken
|
|
1839
1860
|
});
|
|
@@ -1842,10 +1863,10 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1842
1863
|
return registerApi({
|
|
1843
1864
|
accessToken: env.accessToken || accessToken,
|
|
1844
1865
|
tenantId,
|
|
1845
|
-
baseUrl:
|
|
1866
|
+
baseUrl: config2.slapiUrl
|
|
1846
1867
|
});
|
|
1847
1868
|
}
|
|
1848
|
-
}, [env.accessToken,
|
|
1869
|
+
}, [env.accessToken, config2, tenantId, accessToken]);
|
|
1849
1870
|
const getContent = () => {
|
|
1850
1871
|
if (isChecking) {
|
|
1851
1872
|
return /* @__PURE__ */ jsx28("p", { className: "w-full text-center text-sm", children: "Loading..." });
|
|
@@ -1865,7 +1886,7 @@ var SpreePay = ({ className, ...rest }) => {
|
|
|
1865
1886
|
revalidateIfStale: false,
|
|
1866
1887
|
revalidateOnReconnect: false
|
|
1867
1888
|
},
|
|
1868
|
-
children: /* @__PURE__ */ jsx28(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ jsx28(NiceModal6.Provider, { children: /* @__PURE__ */ jsx28(SpreePayContent, { ...rest }) }) })
|
|
1889
|
+
children: /* @__PURE__ */ jsx28(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ jsx28(NiceModal6.Provider, { children: /* @__PURE__ */ jsx28(SpreePayContent, { config: config2, ...rest }) }) })
|
|
1869
1890
|
}
|
|
1870
1891
|
);
|
|
1871
1892
|
};
|