@superlogic/spree-pay 0.1.12 → 0.1.14

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 CHANGED
@@ -206,24 +206,24 @@ var formatCoin = (amount, currency = "USDC") => {
206
206
 
207
207
  // src/components/CheckoutButton.tsx
208
208
  var import_jsx_runtime3 = require("react/jsx-runtime");
209
- var CheckoutButton = ({ isProcessing, amount, onCheckout }) => {
209
+ var CheckoutButton = ({ isLoggedIn, isProcessing, amount, onCheckout }) => {
210
210
  const { selectedPaymentMethod, isInternalProcessing } = useSpreePaymentMethod();
211
- const isDisabled = !amount || !selectedPaymentMethod.method || !!isProcessing || isInternalProcessing;
211
+ const isDisabled = !amount || !selectedPaymentMethod.method || !!isProcessing || isInternalProcessing || !isLoggedIn;
212
212
  const isUSD = selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */;
213
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: [
214
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "text-black/50", children: [
215
215
  "By clicking on the button below I acknowledge that I have read and accepted the",
216
216
  " ",
217
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { className: "underline", href: "/", children: "Property Policies" }),
218
- ",",
219
- " ",
220
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { className: "underline", href: "/", children: "Check-in Instructions" }),
221
- ",",
222
- " ",
223
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { className: "underline", href: "/", children: "Property Fees" }),
224
- ", and",
225
- " ",
226
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { className: "underline", href: "/", children: "Supplier Terms and Conditions" }),
217
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
218
+ "a",
219
+ {
220
+ className: "underline",
221
+ href: "https://uat.travel.air.shop/terms?locale=en-US&currency=USD",
222
+ target: "_blank",
223
+ rel: "noreferrer",
224
+ children: "Terms and Conditions"
225
+ }
226
+ ),
227
227
  "."
228
228
  ] }) }),
229
229
  onCheckout && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -253,7 +253,7 @@ var SpreeLegal = () => {
253
253
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "text-xs text-black/50", children: [
254
254
  "Spree enables seamless crypto payments for real-world goods, travel, and experiences. Enjoy secure, fast transactions and earn rewards.",
255
255
  " ",
256
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { className: "underline", href: "/", children: "Learn more" }),
256
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { className: "underline", href: "https://www.spree.finance/", target: "_blank", rel: "noreferrer", children: "Learn more" }),
257
257
  " ",
258
258
  "about Spree."
259
259
  ] })
@@ -650,12 +650,12 @@ var PointsSwitch = (props) => {
650
650
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
651
651
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
652
652
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Switch, { checked: value, onCheckedChange: onChange, disabled, id }),
653
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Label, { className: "items-baseline text-xl leading-[1.3] font-semibold text-black", htmlFor: id, children: [
653
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Label, { className: "text-md items-baseline leading-[1.3] font-semibold text-black md:text-xl", htmlFor: id, children: [
654
654
  "Use Points ",
655
655
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium", children: "Optional" })
656
656
  ] })
657
657
  ] }),
658
- balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "text-sm font-medium text-black", children: [
658
+ balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "flex-1 text-right text-sm font-medium text-black", children: [
659
659
  formatPoints(balance.availablePoints, pointsTitle),
660
660
  " ",
661
661
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-black/50", children: formatUSD(balance.availablePoints / pointsConversionRatio) })
@@ -688,15 +688,20 @@ var useConfig = () => {
688
688
 
689
689
  // src/components/CreditCardTab/CreditCard/CardsList.tsx
690
690
  var import_jsx_runtime10 = require("react/jsx-runtime");
691
+ var isRemoveDisabled = true;
691
692
  var CardListItem = ({ card, isSelected, onSelect }) => {
692
693
  const handleSelect = () => {
693
694
  onSelect(card);
694
695
  };
696
+ const handleRemoveCard = (e) => {
697
+ e.stopPropagation();
698
+ if (isSelected || isRemoveDisabled) return;
699
+ };
695
700
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", onClick: handleSelect, className: "bg-primary/8 flex h-11 w-full overflow-hidden rounded-md", children: [
696
701
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
697
702
  "div",
698
703
  {
699
- className: cn("flex w-11 items-center justify-center bg-black/10", {
704
+ className: cn("flex h-full w-11 items-center justify-center bg-black/10", {
700
705
  "bg-primary": isSelected
701
706
  }),
702
707
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white", children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "bg-primary h-2.5 w-2.5 rounded-full" }) })
@@ -706,7 +711,7 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
706
711
  "div",
707
712
  {
708
713
  className: cn(
709
- "flex w-full items-center justify-between rounded-r-md border-1 !border-l-0 border-transparent px-3",
714
+ "flex h-full w-full items-center justify-between rounded-r-md border-1 !border-l-0 border-transparent px-3",
710
715
  {
711
716
  "border-primary": isSelected
712
717
  }
@@ -718,17 +723,27 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
718
723
  "Ending in ",
719
724
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-black", children: card.lastFourNumbers })
720
725
  ] }),
721
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "cursor-not-allowed", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", fill: "none", children: [
722
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("mask", { id: "mask0_188_5407", width: "20", height: "21", x: "0", y: "-1", maskUnits: "userSpaceOnUse", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { fill: "#D9D9D9", d: "M0-.5h20v20H0z" }) }),
723
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { mask: "url(#mask0_188_5407)", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
724
- "path",
725
- {
726
- fill: "#000",
727
- fillOpacity: ".5",
728
- d: "M6.35 16.17c-.38 0-.7-.13-.96-.4a1.3 1.3 0 0 1-.39-.95V4.5h-.83v-.83H7.5v-.64h5v.64h3.33v.83H15v10.32c0 .39-.13.7-.39.96a1.3 1.3 0 0 1-.96.39h-7.3ZM14.17 4.5H5.83v10.32c0 .15.05.28.15.37.1.1.22.15.37.15h7.3c.13 0 .25-.06.36-.16.1-.11.16-.23.16-.36V4.5Zm-6 9.17h.84v-7.5h-.84v7.5Zm2.82 0h.84v-7.5h-.84v7.5Z"
729
- }
730
- ) })
731
- ] }) })
726
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
727
+ "div",
728
+ {
729
+ onClick: handleRemoveCard,
730
+ className: cn("rounded-md p-1 transition-all hover:bg-gray-300", {
731
+ "cursor-not-allowed opacity-50": isSelected || isRemoveDisabled
732
+ // 'cursor-pointer': !isSelected || !isRemoveDisabled,
733
+ }),
734
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", fill: "none", children: [
735
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("mask", { id: "mask0_188_5407", width: "20", height: "21", x: "0", y: "-1", maskUnits: "userSpaceOnUse", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { fill: "#D9D9D9", d: "M0-.5h20v20H0z" }) }),
736
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { mask: "url(#mask0_188_5407)", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
737
+ "path",
738
+ {
739
+ fill: "#000",
740
+ fillOpacity: ".5",
741
+ d: "M6.35 16.17c-.38 0-.7-.13-.96-.4a1.3 1.3 0 0 1-.39-.95V4.5h-.83v-.83H7.5v-.64h5v.64h3.33v.83H15v10.32c0 .39-.13.7-.39.96a1.3 1.3 0 0 1-.96.39h-7.3ZM14.17 4.5H5.83v10.32c0 .15.05.28.15.37.1.1.22.15.37.15h7.3c.13 0 .25-.06.36-.16.1-.11.16-.23.16-.36V4.5Zm-6 9.17h.84v-7.5h-.84v7.5Zm2.82 0h.84v-7.5h-.84v7.5Z"
742
+ }
743
+ ) })
744
+ ] })
745
+ }
746
+ )
732
747
  ] })
733
748
  ]
734
749
  }
@@ -739,7 +754,6 @@ var CardsList = ({ selectedCard, setCard }) => {
739
754
  const { cards, cardsIsLoading } = useCards();
740
755
  if (cardsIsLoading) {
741
756
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full flex-col gap-1", children: [
742
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "bg-primary/8 h-11 animate-pulse rounded-md" }),
743
757
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "bg-primary/8 h-11 animate-pulse rounded-md" }),
744
758
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "bg-primary/8 h-11 animate-pulse rounded-md" })
745
759
  ] });
@@ -980,13 +994,13 @@ var PointsSelector = ({ isSelected, onSelect, children }) => {
980
994
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
981
995
  "div",
982
996
  {
983
- className: cn("flex w-11 items-center justify-center bg-black/10", {
997
+ className: cn("flex h-full w-11 items-center justify-center bg-black/10", {
984
998
  "bg-primary": isSelected
985
999
  }),
986
1000
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white", children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "bg-primary h-2.5 w-2.5 rounded-full" }) })
987
1001
  }
988
1002
  ),
989
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn("flex w-full items-center justify-between gap-4 px-3"), children })
1003
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex h-full w-full items-center justify-between gap-4 px-3", children })
990
1004
  ] }),
991
1005
  isSelected && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-4 pt-6 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: "Card" }) })
992
1006
  ]
@@ -1026,8 +1040,8 @@ var CreditCardTab = ({ pointsTitle, pointsConversionRatio }) => {
1026
1040
  register(handlePay);
1027
1041
  }, [register, handlePay]);
1028
1042
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
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, {}) }),
1030
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-6 px-7 py-6", children: [
1043
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "border-b-1 border-black/7 px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CreditCard, {}) }),
1044
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-6 px-5 py-5 md:px-7 md:py-6", children: [
1031
1045
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1032
1046
  PointsSwitch,
1033
1047
  {
@@ -1231,7 +1245,7 @@ var useCryptoPayment = () => {
1231
1245
  txHash,
1232
1246
  paymentId: paymentRes.data.id,
1233
1247
  txId: paymentRes.data.txId,
1234
- status: res.verified ? "AUTHORIZED" /* AUTHORIZED */ : "FAILED" /* FAILED */,
1248
+ status: res.verified ? "CAPTURED" /* CAPTURED */ : "FAILED" /* FAILED */,
1235
1249
  paymentType: "CRYPTO" /* CRYPTO */
1236
1250
  };
1237
1251
  };
@@ -1494,7 +1508,7 @@ var CryptoSelectModal = import_nice_modal_react3.default.create(() => {
1494
1508
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Dialog, { open: modal.visible, onOpenChange: modal.remove, children: [
1495
1509
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogDescription, { className: "hidden", children: "Crypto Select Modal" }),
1496
1510
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DialogContent, { showCloseButton: false, className: "gap-0 p-0", children: [
1497
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-col gap-6 px-7 py-6", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
1511
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-col gap-6 px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
1498
1512
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { className: "rounded-md hover:bg-gray-100", onClick: modal.remove, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "25", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { stroke: "#000", d: "m15 6.5-6 6 6 6" }) }) }),
1499
1513
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogTitle, { className: "text-primary text-2xl font-semibold", children: "Select a token" }),
1500
1514
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { className: "rounded-md p-1 hover:bg-gray-100", onClick: modal.remove, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "17", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
@@ -1505,7 +1519,7 @@ var CryptoSelectModal = import_nice_modal_react3.default.create(() => {
1505
1519
  }
1506
1520
  ) }) })
1507
1521
  ] }) }),
1508
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-4 px-7 py-6", children: [
1522
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-4 px-5 py-5 md:px-7 md:py-6", children: [
1509
1523
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { className: "text-primary text-xl font-semibold", children: "Tokens with wallet balance" }),
1510
1524
  (error || nativeError) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-center text-sm text-red-500", children: "Something wrong" }),
1511
1525
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex w-full flex-col gap-1", children: [
@@ -1569,8 +1583,8 @@ var SelectCoinButton = () => {
1569
1583
  import_nice_modal_react4.default.show(CryptoSelectModal);
1570
1584
  };
1571
1585
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("button", { onClick: openModal, type: "button", className: "bg-primary/8 flex h-11 w-full overflow-hidden rounded-md", children: [
1572
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "bg-primary flex w-11 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white" }) }),
1573
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex w-full items-center justify-between px-3", children: [
1586
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "bg-primary flex h-full w-11 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white" }) }),
1587
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex h-full w-full items-center justify-between px-3", children: [
1574
1588
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "font-medium text-black/50", children: "Select a token" }) }),
1575
1589
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { stroke: "#000", strokeLinecap: "round", d: "m6 12.43 4-4-4-4" }) })
1576
1590
  ] })
@@ -1583,8 +1597,8 @@ var SelectedCoin = (props) => {
1583
1597
  const { coin, balance, logoURI } = props;
1584
1598
  const Icon = getSymbolLogo(coin);
1585
1599
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "bg-primary/8 flex h-11 w-full overflow-hidden rounded-md", children: [
1586
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "bg-primary flex w-11 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "bg-primary h-2.5 w-2.5 rounded-full" }) }) }),
1587
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "border-primary flex w-full items-center justify-between rounded-r-md border-1 !border-l-0 px-3", children: [
1600
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "bg-primary flex h-full w-11 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "bg-primary h-2.5 w-2.5 rounded-full" }) }) }),
1601
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "border-primary flex h-full w-full items-center justify-between rounded-r-md border-1 !border-l-0 px-3", children: [
1588
1602
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
1589
1603
  Icon,
1590
1604
  !Icon && logoURI && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { className: "mr-1 h-8 w-8 shrink-0", src: logoURI, alt: `${coin} logo` }),
@@ -1671,8 +1685,8 @@ var import_jsx_runtime24 = require("react/jsx-runtime");
1671
1685
  var CryptoTab = (props) => {
1672
1686
  const { pointsTitle, pointsConversionRatio } = props;
1673
1687
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
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, {}) }),
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 }) })
1688
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "border-b-1 border-black/7 px-5 py-5 md:px-7 md:py-5", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CryptoWrapper, {}) }),
1689
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PointsSwitch, { disabled: true, pointsTitle, pointsConversionRatio }) })
1676
1690
  ] });
1677
1691
  };
1678
1692
 
@@ -1684,7 +1698,7 @@ var TabButton = ({ isActive, children, onClick }) => {
1684
1698
  {
1685
1699
  onClick,
1686
1700
  className: cn(
1687
- "flex w-[132px] flex-col items-baseline rounded-sm border-1 border-black px-2.5 py-1.5 text-sm text-black",
1701
+ "flex w-[132px] flex-col items-baseline rounded-sm border-1 border-black/50 px-2.5 py-1.5 text-sm text-black",
1688
1702
  { "opacity-50": !isActive },
1689
1703
  { "bg-primary/7 border-primary text-primary": isActive }
1690
1704
  ),
@@ -1739,7 +1753,7 @@ var Tabs = ({ config: config2 }) => {
1739
1753
  const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
1740
1754
  const { pointsConversionRatio, pointsTitle } = config2;
1741
1755
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "mb-4 rounded-3xl border border-black/25 bg-white", children: [
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: [
1756
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex w-full flex-col gap-4 border-b-1 border-black/7 px-5 py-5 md:px-7 md:py-6", children: [
1743
1757
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "text-primary text-2xl font-semibold", children: "Choose a Payment Method" }),
1744
1758
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TabButtons, { value: selectedPaymentMethod.type, onChange: setSelectedPaymentMethod })
1745
1759
  ] }),
@@ -1751,10 +1765,10 @@ var Tabs = ({ config: config2 }) => {
1751
1765
  // src/SpreePayContent.tsx
1752
1766
  var import_jsx_runtime27 = require("react/jsx-runtime");
1753
1767
  var SpreePayContent = (props) => {
1754
- const { config: config2, amount, onProcess, isProcessing } = props;
1768
+ const { isLoggedIn, config: config2, amount, onProcess, isProcessing } = props;
1755
1769
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "w-full", children: [
1756
1770
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Tabs, { config: config2 }),
1757
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckoutButton, { isProcessing, onCheckout: onProcess, amount }),
1771
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckoutButton, { isLoggedIn, isProcessing, onCheckout: onProcess, amount }),
1758
1772
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SpreeLegal, {})
1759
1773
  ] });
1760
1774
  };
@@ -1769,7 +1783,7 @@ function useKeycloakSSO(config2) {
1769
1783
  const kcRef = (0, import_react9.useRef)(null);
1770
1784
  const refreshTimerRef = (0, import_react9.useRef)(null);
1771
1785
  const [error, setError] = (0, import_react9.useState)(null);
1772
- const [isChecking, setIsChecking] = (0, import_react9.useState)(false);
1786
+ const [isChecking, setIsChecking] = (0, import_react9.useState)(enabled);
1773
1787
  const [accessToken, setAccessToken] = (0, import_react9.useState)(null);
1774
1788
  const scheduleRefresh = (0, import_react9.useCallback)(() => {
1775
1789
  const kc = kcRef.current;
@@ -1813,7 +1827,7 @@ function useKeycloakSSO(config2) {
1813
1827
  silentCheckSsoRedirectUri: `${window.location.origin}${ssoPageURI}`,
1814
1828
  silentCheckSsoFallback: true
1815
1829
  }).then((auth) => {
1816
- console.warn("[Keycloak] init success, authenticated=", auth);
1830
+ console.info("[Keycloak] init success, authenticated=", auth);
1817
1831
  setAccessToken(kc.token ?? null);
1818
1832
  if (auth) scheduleRefresh();
1819
1833
  }).catch((err) => {
@@ -1890,7 +1904,7 @@ var SpreePay = ({ className, ...rest }) => {
1890
1904
  const environment = env?.environment || "dev";
1891
1905
  const tenantId = env?.tenantId || "bookit";
1892
1906
  const config2 = CONFIG[environment]?.[tenantId];
1893
- const { isChecking, accessToken, error } = useKeycloakSSO({
1907
+ const { isChecking, accessToken } = useKeycloakSSO({
1894
1908
  realm: tenantId,
1895
1909
  url: config2.keyklockUrl,
1896
1910
  clientId: config2.keyklockClientId,
@@ -1908,12 +1922,10 @@ var SpreePay = ({ className, ...rest }) => {
1908
1922
  }, [env.accessToken, config2, tenantId, accessToken]);
1909
1923
  const getContent = () => {
1910
1924
  if (isChecking) {
1911
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "w-full text-center text-sm", children: "Loading..." });
1912
- }
1913
- if (error) {
1914
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "w-full text-center text-sm", children: [
1915
- "Error: ",
1916
- error.message
1925
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex w-full flex-col", children: [
1926
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "bg-primary/8 mb-4 h-[315px] animate-pulse rounded-3xl" }),
1927
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "bg-primary/8 h-[135px] animate-pulse rounded-3xl" }),
1928
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SpreeLegal, {})
1917
1929
  ] });
1918
1930
  }
1919
1931
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
@@ -1921,11 +1933,11 @@ var SpreePay = ({ className, ...rest }) => {
1921
1933
  {
1922
1934
  value: {
1923
1935
  fetcher: slapiFetcher,
1936
+ errorRetryCount: 3,
1924
1937
  revalidateOnFocus: false,
1925
- revalidateIfStale: false,
1926
- revalidateOnReconnect: false
1938
+ revalidateIfStale: false
1927
1939
  },
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 }) }) })
1940
+ 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, { isLoggedIn: Boolean(accessToken || env.accessToken), config: config2, ...rest }) }) })
1929
1941
  }
1930
1942
  );
1931
1943
  };
package/build/index.css CHANGED
@@ -397,9 +397,18 @@
397
397
  .sl-spreepay .h-\[60px\] {
398
398
  height: 60px;
399
399
  }
400
+ .sl-spreepay .h-\[135px\] {
401
+ height: 135px;
402
+ }
403
+ .sl-spreepay .h-\[315px\] {
404
+ height: 315px;
405
+ }
400
406
  .sl-spreepay .h-\[500px\] {
401
407
  height: 500px;
402
408
  }
409
+ .sl-spreepay .h-full {
410
+ height: 100%;
411
+ }
403
412
  .sl-spreepay .max-h-\[600px\] {
404
413
  max-height: 600px;
405
414
  }
@@ -430,6 +439,9 @@
430
439
  .sl-spreepay .max-w-\[calc\(100\%-2rem\)\] {
431
440
  max-width: calc(100% - 2rem);
432
441
  }
442
+ .sl-spreepay .flex-1 {
443
+ flex: 1;
444
+ }
433
445
  .sl-spreepay .flex-shrink-0 {
434
446
  flex-shrink: 0;
435
447
  }
@@ -567,6 +579,12 @@
567
579
  border-color: color-mix(in oklab, var(--color-black) 25%, transparent);
568
580
  }
569
581
  }
582
+ .sl-spreepay .border-black\/50 {
583
+ border-color: color-mix(in srgb, #000 50%, transparent);
584
+ @supports (color: color-mix(in lab, red, red)) {
585
+ border-color: color-mix(in oklab, var(--color-black) 50%, transparent);
586
+ }
587
+ }
570
588
  .sl-spreepay .border-destructive {
571
589
  border-color: var(--destructive);
572
590
  }
@@ -663,9 +681,6 @@
663
681
  .sl-spreepay .px-6 {
664
682
  padding-inline: calc(var(--spacing) * 6);
665
683
  }
666
- .sl-spreepay .px-7 {
667
- padding-inline: calc(var(--spacing) * 7);
668
- }
669
684
  .sl-spreepay .px-8 {
670
685
  padding-inline: calc(var(--spacing) * 8);
671
686
  }
@@ -681,9 +696,6 @@
681
696
  .sl-spreepay .py-5 {
682
697
  padding-block: calc(var(--spacing) * 5);
683
698
  }
684
- .sl-spreepay .py-6 {
685
- padding-block: calc(var(--spacing) * 6);
686
- }
687
699
  .sl-spreepay .pt-6 {
688
700
  padding-top: calc(var(--spacing) * 6);
689
701
  }
@@ -693,6 +705,9 @@
693
705
  .sl-spreepay .text-center {
694
706
  text-align: center;
695
707
  }
708
+ .sl-spreepay .text-right {
709
+ text-align: right;
710
+ }
696
711
  .sl-spreepay .text-2xl {
697
712
  font-size: var(--text-2xl);
698
713
  line-height: var(--tw-leading, var(--text-2xl--line-height));
@@ -928,6 +943,13 @@
928
943
  }
929
944
  }
930
945
  }
946
+ .sl-spreepay .hover\:bg-gray-300 {
947
+ .sl-spreepay &:hover {
948
+ @media (hover: hover) {
949
+ background-color: var(--color-gray-300);
950
+ }
951
+ }
952
+ }
931
953
  .sl-spreepay .hover\:bg-primary {
932
954
  .sl-spreepay &:hover {
933
955
  @media (hover: hover) {
@@ -1229,6 +1251,27 @@
1229
1251
  display: block;
1230
1252
  }
1231
1253
  }
1254
+ .sl-spreepay .md\:px-7 {
1255
+ @media (width >= 48rem) {
1256
+ padding-inline: calc(var(--spacing) * 7);
1257
+ }
1258
+ }
1259
+ .sl-spreepay .md\:py-5 {
1260
+ @media (width >= 48rem) {
1261
+ padding-block: calc(var(--spacing) * 5);
1262
+ }
1263
+ }
1264
+ .sl-spreepay .md\:py-6 {
1265
+ @media (width >= 48rem) {
1266
+ padding-block: calc(var(--spacing) * 6);
1267
+ }
1268
+ }
1269
+ .sl-spreepay .md\:text-xl {
1270
+ @media (width >= 48rem) {
1271
+ font-size: var(--text-xl);
1272
+ line-height: var(--tw-leading, var(--text-xl--line-height));
1273
+ }
1274
+ }
1232
1275
  .sl-spreepay .dark\:border-input {
1233
1276
  .sl-spreepay &:is(.dark *) {
1234
1277
  border-color: var(--input);
@@ -1408,7 +1451,7 @@
1408
1451
  --accent-foreground: oklch(0.985 0 0);
1409
1452
  --destructive: oklch(0.396 0.141 25.723);
1410
1453
  --destructive-foreground: oklch(0.637 0.237 25.331);
1411
- --border: oklch(0.269 0 0);
1454
+ --border: rgba(0, 0, 0, 0.25);
1412
1455
  --input: oklch(0.269 0 0);
1413
1456
  --ring: oklch(0.556 0 0);
1414
1457
  --chart-1: oklch(0.488 0.243 264.376);
package/build/index.js CHANGED
@@ -167,24 +167,24 @@ var formatCoin = (amount, currency = "USDC") => {
167
167
 
168
168
  // src/components/CheckoutButton.tsx
169
169
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
170
- var CheckoutButton = ({ isProcessing, amount, onCheckout }) => {
170
+ var CheckoutButton = ({ isLoggedIn, isProcessing, amount, onCheckout }) => {
171
171
  const { selectedPaymentMethod, isInternalProcessing } = useSpreePaymentMethod();
172
- const isDisabled = !amount || !selectedPaymentMethod.method || !!isProcessing || isInternalProcessing;
172
+ const isDisabled = !amount || !selectedPaymentMethod.method || !!isProcessing || isInternalProcessing || !isLoggedIn;
173
173
  const isUSD = selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */;
174
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: [
175
+ /* @__PURE__ */ jsx3("div", { className: "px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ jsxs2("p", { className: "text-black/50", children: [
176
176
  "By clicking on the button below I acknowledge that I have read and accepted the",
177
177
  " ",
178
- /* @__PURE__ */ jsx3("a", { className: "underline", href: "/", children: "Property Policies" }),
179
- ",",
180
- " ",
181
- /* @__PURE__ */ jsx3("a", { className: "underline", href: "/", children: "Check-in Instructions" }),
182
- ",",
183
- " ",
184
- /* @__PURE__ */ jsx3("a", { className: "underline", href: "/", children: "Property Fees" }),
185
- ", and",
186
- " ",
187
- /* @__PURE__ */ jsx3("a", { className: "underline", href: "/", children: "Supplier Terms and Conditions" }),
178
+ /* @__PURE__ */ jsx3(
179
+ "a",
180
+ {
181
+ className: "underline",
182
+ href: "https://uat.travel.air.shop/terms?locale=en-US&currency=USD",
183
+ target: "_blank",
184
+ rel: "noreferrer",
185
+ children: "Terms and Conditions"
186
+ }
187
+ ),
188
188
  "."
189
189
  ] }) }),
190
190
  onCheckout && /* @__PURE__ */ jsx3(
@@ -214,7 +214,7 @@ var SpreeLegal = () => {
214
214
  /* @__PURE__ */ jsxs3("p", { className: "text-xs text-black/50", children: [
215
215
  "Spree enables seamless crypto payments for real-world goods, travel, and experiences. Enjoy secure, fast transactions and earn rewards.",
216
216
  " ",
217
- /* @__PURE__ */ jsx4("a", { className: "underline", href: "/", children: "Learn more" }),
217
+ /* @__PURE__ */ jsx4("a", { className: "underline", href: "https://www.spree.finance/", target: "_blank", rel: "noreferrer", children: "Learn more" }),
218
218
  " ",
219
219
  "about Spree."
220
220
  ] })
@@ -611,12 +611,12 @@ var PointsSwitch = (props) => {
611
611
  return /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-3", children: [
612
612
  /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3", children: [
613
613
  /* @__PURE__ */ jsx9(Switch, { checked: value, onCheckedChange: onChange, disabled, id }),
614
- /* @__PURE__ */ jsxs6(Label, { className: "items-baseline text-xl leading-[1.3] font-semibold text-black", htmlFor: id, children: [
614
+ /* @__PURE__ */ jsxs6(Label, { className: "text-md items-baseline leading-[1.3] font-semibold text-black md:text-xl", htmlFor: id, children: [
615
615
  "Use Points ",
616
616
  /* @__PURE__ */ jsx9("span", { className: "text-xs font-medium", children: "Optional" })
617
617
  ] })
618
618
  ] }),
619
- balance?.availablePoints ? /* @__PURE__ */ jsxs6("p", { className: "text-sm font-medium text-black", children: [
619
+ balance?.availablePoints ? /* @__PURE__ */ jsxs6("p", { className: "flex-1 text-right text-sm font-medium text-black", children: [
620
620
  formatPoints(balance.availablePoints, pointsTitle),
621
621
  " ",
622
622
  /* @__PURE__ */ jsx9("span", { className: "text-black/50", children: formatUSD(balance.availablePoints / pointsConversionRatio) })
@@ -649,15 +649,20 @@ var useConfig = () => {
649
649
 
650
650
  // src/components/CreditCardTab/CreditCard/CardsList.tsx
651
651
  import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
652
+ var isRemoveDisabled = true;
652
653
  var CardListItem = ({ card, isSelected, onSelect }) => {
653
654
  const handleSelect = () => {
654
655
  onSelect(card);
655
656
  };
657
+ const handleRemoveCard = (e) => {
658
+ e.stopPropagation();
659
+ if (isSelected || isRemoveDisabled) return;
660
+ };
656
661
  return /* @__PURE__ */ jsxs7("button", { type: "button", onClick: handleSelect, className: "bg-primary/8 flex h-11 w-full overflow-hidden rounded-md", children: [
657
662
  /* @__PURE__ */ jsx10(
658
663
  "div",
659
664
  {
660
- className: cn("flex w-11 items-center justify-center bg-black/10", {
665
+ className: cn("flex h-full w-11 items-center justify-center bg-black/10", {
661
666
  "bg-primary": isSelected
662
667
  }),
663
668
  children: /* @__PURE__ */ jsx10("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white", children: isSelected && /* @__PURE__ */ jsx10("div", { className: "bg-primary h-2.5 w-2.5 rounded-full" }) })
@@ -667,7 +672,7 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
667
672
  "div",
668
673
  {
669
674
  className: cn(
670
- "flex w-full items-center justify-between rounded-r-md border-1 !border-l-0 border-transparent px-3",
675
+ "flex h-full w-full items-center justify-between rounded-r-md border-1 !border-l-0 border-transparent px-3",
671
676
  {
672
677
  "border-primary": isSelected
673
678
  }
@@ -679,17 +684,27 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
679
684
  "Ending in ",
680
685
  /* @__PURE__ */ jsx10("span", { className: "text-black", children: card.lastFourNumbers })
681
686
  ] }),
682
- /* @__PURE__ */ jsx10("div", { className: "cursor-not-allowed", children: /* @__PURE__ */ jsxs7("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", fill: "none", children: [
683
- /* @__PURE__ */ jsx10("mask", { id: "mask0_188_5407", width: "20", height: "21", x: "0", y: "-1", maskUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx10("path", { fill: "#D9D9D9", d: "M0-.5h20v20H0z" }) }),
684
- /* @__PURE__ */ jsx10("g", { mask: "url(#mask0_188_5407)", children: /* @__PURE__ */ jsx10(
685
- "path",
686
- {
687
- fill: "#000",
688
- fillOpacity: ".5",
689
- d: "M6.35 16.17c-.38 0-.7-.13-.96-.4a1.3 1.3 0 0 1-.39-.95V4.5h-.83v-.83H7.5v-.64h5v.64h3.33v.83H15v10.32c0 .39-.13.7-.39.96a1.3 1.3 0 0 1-.96.39h-7.3ZM14.17 4.5H5.83v10.32c0 .15.05.28.15.37.1.1.22.15.37.15h7.3c.13 0 .25-.06.36-.16.1-.11.16-.23.16-.36V4.5Zm-6 9.17h.84v-7.5h-.84v7.5Zm2.82 0h.84v-7.5h-.84v7.5Z"
690
- }
691
- ) })
692
- ] }) })
687
+ /* @__PURE__ */ jsx10(
688
+ "div",
689
+ {
690
+ onClick: handleRemoveCard,
691
+ className: cn("rounded-md p-1 transition-all hover:bg-gray-300", {
692
+ "cursor-not-allowed opacity-50": isSelected || isRemoveDisabled
693
+ // 'cursor-pointer': !isSelected || !isRemoveDisabled,
694
+ }),
695
+ children: /* @__PURE__ */ jsxs7("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", fill: "none", children: [
696
+ /* @__PURE__ */ jsx10("mask", { id: "mask0_188_5407", width: "20", height: "21", x: "0", y: "-1", maskUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx10("path", { fill: "#D9D9D9", d: "M0-.5h20v20H0z" }) }),
697
+ /* @__PURE__ */ jsx10("g", { mask: "url(#mask0_188_5407)", children: /* @__PURE__ */ jsx10(
698
+ "path",
699
+ {
700
+ fill: "#000",
701
+ fillOpacity: ".5",
702
+ d: "M6.35 16.17c-.38 0-.7-.13-.96-.4a1.3 1.3 0 0 1-.39-.95V4.5h-.83v-.83H7.5v-.64h5v.64h3.33v.83H15v10.32c0 .39-.13.7-.39.96a1.3 1.3 0 0 1-.96.39h-7.3ZM14.17 4.5H5.83v10.32c0 .15.05.28.15.37.1.1.22.15.37.15h7.3c.13 0 .25-.06.36-.16.1-.11.16-.23.16-.36V4.5Zm-6 9.17h.84v-7.5h-.84v7.5Zm2.82 0h.84v-7.5h-.84v7.5Z"
703
+ }
704
+ ) })
705
+ ] })
706
+ }
707
+ )
693
708
  ] })
694
709
  ]
695
710
  }
@@ -700,7 +715,6 @@ var CardsList = ({ selectedCard, setCard }) => {
700
715
  const { cards, cardsIsLoading } = useCards();
701
716
  if (cardsIsLoading) {
702
717
  return /* @__PURE__ */ jsxs7("div", { className: "flex w-full flex-col gap-1", children: [
703
- /* @__PURE__ */ jsx10("div", { className: "bg-primary/8 h-11 animate-pulse rounded-md" }),
704
718
  /* @__PURE__ */ jsx10("div", { className: "bg-primary/8 h-11 animate-pulse rounded-md" }),
705
719
  /* @__PURE__ */ jsx10("div", { className: "bg-primary/8 h-11 animate-pulse rounded-md" })
706
720
  ] });
@@ -941,13 +955,13 @@ var PointsSelector = ({ isSelected, onSelect, children }) => {
941
955
  /* @__PURE__ */ jsx15(
942
956
  "div",
943
957
  {
944
- className: cn("flex w-11 items-center justify-center bg-black/10", {
958
+ className: cn("flex h-full w-11 items-center justify-center bg-black/10", {
945
959
  "bg-primary": isSelected
946
960
  }),
947
961
  children: /* @__PURE__ */ jsx15("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white", children: isSelected && /* @__PURE__ */ jsx15("div", { className: "bg-primary h-2.5 w-2.5 rounded-full" }) })
948
962
  }
949
963
  ),
950
- /* @__PURE__ */ jsx15("div", { className: cn("flex w-full items-center justify-between gap-4 px-3"), children })
964
+ /* @__PURE__ */ jsx15("div", { className: "flex h-full w-full items-center justify-between gap-4 px-3", children })
951
965
  ] }),
952
966
  isSelected && /* @__PURE__ */ jsx15("div", { className: "px-4 pt-6 pb-2", children: /* @__PURE__ */ jsx15("p", { children: "Card" }) })
953
967
  ]
@@ -987,8 +1001,8 @@ var CreditCardTab = ({ pointsTitle, pointsConversionRatio }) => {
987
1001
  register(handlePay);
988
1002
  }, [register, handlePay]);
989
1003
  return /* @__PURE__ */ jsxs10("div", { children: [
990
- /* @__PURE__ */ jsx15("div", { className: "border-b-1 border-black/7 px-7 py-6", children: /* @__PURE__ */ jsx15(CreditCard, {}) }),
991
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-6 px-7 py-6", children: [
1004
+ /* @__PURE__ */ jsx15("div", { className: "border-b-1 border-black/7 px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ jsx15(CreditCard, {}) }),
1005
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-6 px-5 py-5 md:px-7 md:py-6", children: [
992
1006
  /* @__PURE__ */ jsx15(
993
1007
  PointsSwitch,
994
1008
  {
@@ -1192,7 +1206,7 @@ var useCryptoPayment = () => {
1192
1206
  txHash,
1193
1207
  paymentId: paymentRes.data.id,
1194
1208
  txId: paymentRes.data.txId,
1195
- status: res.verified ? "AUTHORIZED" /* AUTHORIZED */ : "FAILED" /* FAILED */,
1209
+ status: res.verified ? "CAPTURED" /* CAPTURED */ : "FAILED" /* FAILED */,
1196
1210
  paymentType: "CRYPTO" /* CRYPTO */
1197
1211
  };
1198
1212
  };
@@ -1455,7 +1469,7 @@ var CryptoSelectModal = NiceModal3.create(() => {
1455
1469
  return /* @__PURE__ */ jsxs14(Dialog, { open: modal.visible, onOpenChange: modal.remove, children: [
1456
1470
  /* @__PURE__ */ jsx19(DialogDescription, { className: "hidden", children: "Crypto Select Modal" }),
1457
1471
  /* @__PURE__ */ jsxs14(DialogContent, { showCloseButton: false, className: "gap-0 p-0", children: [
1458
- /* @__PURE__ */ jsx19("div", { className: "flex flex-col gap-6 px-7 py-6", children: /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between gap-4", children: [
1472
+ /* @__PURE__ */ jsx19("div", { className: "flex flex-col gap-6 px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between gap-4", children: [
1459
1473
  /* @__PURE__ */ jsx19("button", { className: "rounded-md hover:bg-gray-100", onClick: modal.remove, children: /* @__PURE__ */ jsx19("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "25", fill: "none", children: /* @__PURE__ */ jsx19("path", { stroke: "#000", d: "m15 6.5-6 6 6 6" }) }) }),
1460
1474
  /* @__PURE__ */ jsx19(DialogTitle, { className: "text-primary text-2xl font-semibold", children: "Select a token" }),
1461
1475
  /* @__PURE__ */ jsx19("button", { className: "rounded-md p-1 hover:bg-gray-100", onClick: modal.remove, children: /* @__PURE__ */ jsx19("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "17", fill: "none", children: /* @__PURE__ */ jsx19(
@@ -1466,7 +1480,7 @@ var CryptoSelectModal = NiceModal3.create(() => {
1466
1480
  }
1467
1481
  ) }) })
1468
1482
  ] }) }),
1469
- /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-4 px-7 py-6", children: [
1483
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-4 px-5 py-5 md:px-7 md:py-6", children: [
1470
1484
  /* @__PURE__ */ jsx19("h3", { className: "text-primary text-xl font-semibold", children: "Tokens with wallet balance" }),
1471
1485
  (error || nativeError) && /* @__PURE__ */ jsx19("p", { className: "text-center text-sm text-red-500", children: "Something wrong" }),
1472
1486
  /* @__PURE__ */ jsxs14("div", { className: "flex w-full flex-col gap-1", children: [
@@ -1530,8 +1544,8 @@ var SelectCoinButton = () => {
1530
1544
  NiceModal4.show(CryptoSelectModal);
1531
1545
  };
1532
1546
  return /* @__PURE__ */ jsxs15("button", { onClick: openModal, type: "button", className: "bg-primary/8 flex h-11 w-full overflow-hidden rounded-md", children: [
1533
- /* @__PURE__ */ jsx20("div", { className: "bg-primary flex w-11 items-center justify-center", children: /* @__PURE__ */ jsx20("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white" }) }),
1534
- /* @__PURE__ */ jsxs15("div", { className: "flex w-full items-center justify-between px-3", children: [
1547
+ /* @__PURE__ */ jsx20("div", { className: "bg-primary flex h-full w-11 items-center justify-center", children: /* @__PURE__ */ jsx20("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white" }) }),
1548
+ /* @__PURE__ */ jsxs15("div", { className: "flex h-full w-full items-center justify-between px-3", children: [
1535
1549
  /* @__PURE__ */ jsx20("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx20("p", { className: "font-medium text-black/50", children: "Select a token" }) }),
1536
1550
  /* @__PURE__ */ jsx20("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none", children: /* @__PURE__ */ jsx20("path", { stroke: "#000", strokeLinecap: "round", d: "m6 12.43 4-4-4-4" }) })
1537
1551
  ] })
@@ -1544,8 +1558,8 @@ var SelectedCoin = (props) => {
1544
1558
  const { coin, balance, logoURI } = props;
1545
1559
  const Icon = getSymbolLogo(coin);
1546
1560
  return /* @__PURE__ */ jsxs16("div", { className: "bg-primary/8 flex h-11 w-full overflow-hidden rounded-md", children: [
1547
- /* @__PURE__ */ jsx21("div", { className: "bg-primary flex w-11 items-center justify-center", children: /* @__PURE__ */ jsx21("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white", children: /* @__PURE__ */ jsx21("div", { className: "bg-primary h-2.5 w-2.5 rounded-full" }) }) }),
1548
- /* @__PURE__ */ jsxs16("div", { className: "border-primary flex w-full items-center justify-between rounded-r-md border-1 !border-l-0 px-3", children: [
1561
+ /* @__PURE__ */ jsx21("div", { className: "bg-primary flex h-full w-11 items-center justify-center", children: /* @__PURE__ */ jsx21("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white", children: /* @__PURE__ */ jsx21("div", { className: "bg-primary h-2.5 w-2.5 rounded-full" }) }) }),
1562
+ /* @__PURE__ */ jsxs16("div", { className: "border-primary flex h-full w-full items-center justify-between rounded-r-md border-1 !border-l-0 px-3", children: [
1549
1563
  /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
1550
1564
  Icon,
1551
1565
  !Icon && logoURI && /* @__PURE__ */ jsx21("img", { className: "mr-1 h-8 w-8 shrink-0", src: logoURI, alt: `${coin} logo` }),
@@ -1632,8 +1646,8 @@ import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
1632
1646
  var CryptoTab = (props) => {
1633
1647
  const { pointsTitle, pointsConversionRatio } = props;
1634
1648
  return /* @__PURE__ */ jsxs18("div", { children: [
1635
- /* @__PURE__ */ jsx24("div", { className: "border-b-1 border-black/7 px-7 py-6", children: /* @__PURE__ */ jsx24(CryptoWrapper, {}) }),
1636
- /* @__PURE__ */ jsx24("div", { className: "px-7 py-6", children: /* @__PURE__ */ jsx24(PointsSwitch, { disabled: true, pointsTitle, pointsConversionRatio }) })
1649
+ /* @__PURE__ */ jsx24("div", { className: "border-b-1 border-black/7 px-5 py-5 md:px-7 md:py-5", children: /* @__PURE__ */ jsx24(CryptoWrapper, {}) }),
1650
+ /* @__PURE__ */ jsx24("div", { className: "px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ jsx24(PointsSwitch, { disabled: true, pointsTitle, pointsConversionRatio }) })
1637
1651
  ] });
1638
1652
  };
1639
1653
 
@@ -1645,7 +1659,7 @@ var TabButton = ({ isActive, children, onClick }) => {
1645
1659
  {
1646
1660
  onClick,
1647
1661
  className: cn(
1648
- "flex w-[132px] flex-col items-baseline rounded-sm border-1 border-black px-2.5 py-1.5 text-sm text-black",
1662
+ "flex w-[132px] flex-col items-baseline rounded-sm border-1 border-black/50 px-2.5 py-1.5 text-sm text-black",
1649
1663
  { "opacity-50": !isActive },
1650
1664
  { "bg-primary/7 border-primary text-primary": isActive }
1651
1665
  ),
@@ -1700,7 +1714,7 @@ var Tabs = ({ config: config2 }) => {
1700
1714
  const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
1701
1715
  const { pointsConversionRatio, pointsTitle } = config2;
1702
1716
  return /* @__PURE__ */ jsxs20("div", { className: "mb-4 rounded-3xl border border-black/25 bg-white", children: [
1703
- /* @__PURE__ */ jsxs20("div", { className: "flex w-full flex-col gap-4 border-b-1 border-black/7 px-7 py-6", children: [
1717
+ /* @__PURE__ */ jsxs20("div", { className: "flex w-full flex-col gap-4 border-b-1 border-black/7 px-5 py-5 md:px-7 md:py-6", children: [
1704
1718
  /* @__PURE__ */ jsx26("h2", { className: "text-primary text-2xl font-semibold", children: "Choose a Payment Method" }),
1705
1719
  /* @__PURE__ */ jsx26(TabButtons, { value: selectedPaymentMethod.type, onChange: setSelectedPaymentMethod })
1706
1720
  ] }),
@@ -1712,10 +1726,10 @@ var Tabs = ({ config: config2 }) => {
1712
1726
  // src/SpreePayContent.tsx
1713
1727
  import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
1714
1728
  var SpreePayContent = (props) => {
1715
- const { config: config2, amount, onProcess, isProcessing } = props;
1729
+ const { isLoggedIn, config: config2, amount, onProcess, isProcessing } = props;
1716
1730
  return /* @__PURE__ */ jsxs21("div", { className: "w-full", children: [
1717
1731
  /* @__PURE__ */ jsx27(Tabs, { config: config2 }),
1718
- /* @__PURE__ */ jsx27(CheckoutButton, { isProcessing, onCheckout: onProcess, amount }),
1732
+ /* @__PURE__ */ jsx27(CheckoutButton, { isLoggedIn, isProcessing, onCheckout: onProcess, amount }),
1719
1733
  /* @__PURE__ */ jsx27(SpreeLegal, {})
1720
1734
  ] });
1721
1735
  };
@@ -1730,7 +1744,7 @@ function useKeycloakSSO(config2) {
1730
1744
  const kcRef = useRef2(null);
1731
1745
  const refreshTimerRef = useRef2(null);
1732
1746
  const [error, setError] = useState6(null);
1733
- const [isChecking, setIsChecking] = useState6(false);
1747
+ const [isChecking, setIsChecking] = useState6(enabled);
1734
1748
  const [accessToken, setAccessToken] = useState6(null);
1735
1749
  const scheduleRefresh = useCallback4(() => {
1736
1750
  const kc = kcRef.current;
@@ -1774,7 +1788,7 @@ function useKeycloakSSO(config2) {
1774
1788
  silentCheckSsoRedirectUri: `${window.location.origin}${ssoPageURI}`,
1775
1789
  silentCheckSsoFallback: true
1776
1790
  }).then((auth) => {
1777
- console.warn("[Keycloak] init success, authenticated=", auth);
1791
+ console.info("[Keycloak] init success, authenticated=", auth);
1778
1792
  setAccessToken(kc.token ?? null);
1779
1793
  if (auth) scheduleRefresh();
1780
1794
  }).catch((err) => {
@@ -1851,7 +1865,7 @@ var SpreePay = ({ className, ...rest }) => {
1851
1865
  const environment = env?.environment || "dev";
1852
1866
  const tenantId = env?.tenantId || "bookit";
1853
1867
  const config2 = CONFIG[environment]?.[tenantId];
1854
- const { isChecking, accessToken, error } = useKeycloakSSO({
1868
+ const { isChecking, accessToken } = useKeycloakSSO({
1855
1869
  realm: tenantId,
1856
1870
  url: config2.keyklockUrl,
1857
1871
  clientId: config2.keyklockClientId,
@@ -1869,12 +1883,10 @@ var SpreePay = ({ className, ...rest }) => {
1869
1883
  }, [env.accessToken, config2, tenantId, accessToken]);
1870
1884
  const getContent = () => {
1871
1885
  if (isChecking) {
1872
- return /* @__PURE__ */ jsx28("p", { className: "w-full text-center text-sm", children: "Loading..." });
1873
- }
1874
- if (error) {
1875
- return /* @__PURE__ */ jsxs22("p", { className: "w-full text-center text-sm", children: [
1876
- "Error: ",
1877
- error.message
1886
+ return /* @__PURE__ */ jsxs22("div", { className: "flex w-full flex-col", children: [
1887
+ /* @__PURE__ */ jsx28("div", { className: "bg-primary/8 mb-4 h-[315px] animate-pulse rounded-3xl" }),
1888
+ /* @__PURE__ */ jsx28("div", { className: "bg-primary/8 h-[135px] animate-pulse rounded-3xl" }),
1889
+ /* @__PURE__ */ jsx28(SpreeLegal, {})
1878
1890
  ] });
1879
1891
  }
1880
1892
  return /* @__PURE__ */ jsx28(
@@ -1882,11 +1894,11 @@ var SpreePay = ({ className, ...rest }) => {
1882
1894
  {
1883
1895
  value: {
1884
1896
  fetcher: slapiFetcher,
1897
+ errorRetryCount: 3,
1885
1898
  revalidateOnFocus: false,
1886
- revalidateIfStale: false,
1887
- revalidateOnReconnect: false
1899
+ revalidateIfStale: false
1888
1900
  },
1889
- children: /* @__PURE__ */ jsx28(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ jsx28(NiceModal6.Provider, { children: /* @__PURE__ */ jsx28(SpreePayContent, { config: config2, ...rest }) }) })
1901
+ children: /* @__PURE__ */ jsx28(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ jsx28(NiceModal6.Provider, { children: /* @__PURE__ */ jsx28(SpreePayContent, { isLoggedIn: Boolean(accessToken || env.accessToken), config: config2, ...rest }) }) })
1890
1902
  }
1891
1903
  );
1892
1904
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superlogic/spree-pay",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Spree-pay React component and utilities",
5
5
  "private": false,
6
6
  "type": "module",