bitsnap-react 1.0.0 → 1.2.0

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/dist/index.mjs CHANGED
@@ -59,7 +59,6 @@ var PublicApiClient;
59
59
  // src/components/checkout/CartProvider.tsx
60
60
  import { create as create2 } from "@bufbuild/protobuf";
61
61
  import { createContext, useContext } from "react";
62
- import { QueryClient, QueryClientProvider } from "react-query";
63
62
  import zod from "zod";
64
63
 
65
64
  // src/components/checkout/constants.ts
@@ -317,6 +316,7 @@ function mapGooglePayDisplayItems(items, methods, deliveryMethod, couponCode, co
317
316
  }
318
317
 
319
318
  // src/components/checkout/CartProvider.tsx
319
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
320
320
  import { Fragment, jsx } from "react/jsx-runtime";
321
321
  var MARKETING_AGREEMENT_ID = "__m_a";
322
322
  var CartProviderContext = createContext(void 0);
@@ -1041,7 +1041,7 @@ function resolveProductDetailsFromSingleProduct(id, product) {
1041
1041
  }
1042
1042
 
1043
1043
  // src/components/checkout/ApplePay.tsx
1044
- import { useQuery } from "react-query";
1044
+ import { useQuery } from "@tanstack/react-query";
1045
1045
  import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
1046
1046
  function ApplePayButtonComponent({ style, buttonType, colorType, items, onClick }) {
1047
1047
  const {
@@ -1055,7 +1055,10 @@ function ApplePayButtonComponent({ style, buttonType, colorType, items, onClick
1055
1055
  setPostalCode,
1056
1056
  clearCart
1057
1057
  } = useCartProvider();
1058
- const { data: isApplePayAvailable } = useQuery("is-apple-pay-available", checkIfApplePayIsAvailable);
1058
+ const { data: isApplePayAvailable } = useQuery({
1059
+ queryKey: ["is-apple-pay-available"],
1060
+ queryFn: checkIfApplePayIsAvailable
1061
+ });
1059
1062
  if (isApplePayAvailable != true) {
1060
1063
  return null;
1061
1064
  }
@@ -1228,8 +1231,34 @@ var ApplePay_default = Wrapper;
1228
1231
 
1229
1232
  // src/components/checkout/GooglePay.tsx
1230
1233
  import GooglePayButton from "@google-pay/button-react";
1231
- import { useMutation, useQuery as useQuery2 } from "react-query";
1232
- import { Fragment as Fragment3, jsx as jsx3, jsxs } from "react/jsx-runtime";
1234
+
1235
+ // src/ui/spinner.tsx
1236
+ import { Loader2Icon } from "lucide-react";
1237
+
1238
+ // src/lib/utils.ts
1239
+ import { clsx } from "clsx";
1240
+ import { twMerge } from "tailwind-merge";
1241
+ function cn(...inputs) {
1242
+ return twMerge(clsx(inputs));
1243
+ }
1244
+
1245
+ // src/ui/spinner.tsx
1246
+ import { jsx as jsx3 } from "react/jsx-runtime";
1247
+ function Spinner({ className, ...props }) {
1248
+ return /* @__PURE__ */ jsx3(
1249
+ Loader2Icon,
1250
+ {
1251
+ role: "status",
1252
+ "aria-label": "Loading",
1253
+ className: cn("size-4 animate-spin", className),
1254
+ ...props
1255
+ }
1256
+ );
1257
+ }
1258
+
1259
+ // src/components/checkout/GooglePay.tsx
1260
+ import { useQuery as useQuery2, useMutation } from "@tanstack/react-query";
1261
+ import { Fragment as Fragment3, jsx as jsx4, jsxs } from "react/jsx-runtime";
1233
1262
  function GooglePayButtonComponent({ items, style, buttonColor, buttonSizeMode, test }) {
1234
1263
  const {
1235
1264
  getGooglePayConfiguration,
@@ -1241,20 +1270,25 @@ function GooglePayButtonComponent({ items, style, buttonColor, buttonSizeMode, t
1241
1270
  setPostalCode,
1242
1271
  clearCart
1243
1272
  } = useCartProvider();
1244
- const { data: googlePayConfiguration } = useQuery2(["get-google-pay-configuration", items.map((el) => el.id).join(",")], () => getGooglePayConfiguration({
1245
- items: items.map((el) => ({
1246
- ...el,
1247
- id: void 0,
1248
- productID: el.id
1249
- }))
1250
- }));
1251
- const { mutateAsync: completeGooglePayPaymentAsync, isLoading } = useMutation(completeGooglePayPayment);
1273
+ const { data: googlePayConfiguration } = useQuery2({
1274
+ queryKey: ["get-google-pay-configuration", items.map((el) => el.id).join(",")],
1275
+ queryFn: () => getGooglePayConfiguration({
1276
+ items: items.map((el) => ({
1277
+ ...el,
1278
+ id: void 0,
1279
+ productID: el.id
1280
+ }))
1281
+ })
1282
+ });
1283
+ const { mutateAsync: completeGooglePayPaymentAsync, isPending } = useMutation({
1284
+ mutationFn: completeGooglePayPayment
1285
+ });
1252
1286
  if (googlePayConfiguration == null || googlePayConfiguration.isAvailable != true) {
1253
1287
  console.log("google pay configuration is not available", googlePayConfiguration);
1254
1288
  return null;
1255
1289
  }
1256
1290
  return /* @__PURE__ */ jsxs(Fragment3, { children: [
1257
- /* @__PURE__ */ jsx3(
1291
+ /* @__PURE__ */ jsx4(
1258
1292
  GooglePayButton,
1259
1293
  {
1260
1294
  buttonSizeMode,
@@ -1307,11 +1341,11 @@ function GooglePayButtonComponent({ items, style, buttonColor, buttonSizeMode, t
1307
1341
  }
1308
1342
  }
1309
1343
  ),
1310
- isLoading ? "\u0141adowanie..." : null
1344
+ isPending ? /* @__PURE__ */ jsx4(Spinner, {}) : null
1311
1345
  ] });
1312
1346
  }
1313
1347
  function Wrapper2(props) {
1314
- return /* @__PURE__ */ jsx3(Fragment3, { children: /* @__PURE__ */ jsx3(CartProvider_default, { children: /* @__PURE__ */ jsx3(GooglePayButtonComponent, { ...props }) }) });
1348
+ return /* @__PURE__ */ jsx4(Fragment3, { children: /* @__PURE__ */ jsx4(CartProvider_default, { children: /* @__PURE__ */ jsx4(GooglePayButtonComponent, { ...props }) }) });
1315
1349
  }
1316
1350
  var GooglePay_default = Wrapper2;
1317
1351
 
@@ -1326,12 +1360,11 @@ import { createPortal } from "react-dom";
1326
1360
  // src/components/checkout/CartComponentContent.tsx
1327
1361
  import { useAutoAnimate } from "@formkit/auto-animate/react";
1328
1362
  import React from "react";
1329
- import { useMutation as useMutation2, useQuery as useQuery3 } from "react-query";
1330
1363
 
1331
1364
  // src/components/checkout/CountrySelector.tsx
1332
1365
  import { AnimatePresence, motion } from "framer-motion";
1333
1366
  import { useEffect, useRef, useState } from "react";
1334
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
1367
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
1335
1368
  function CountrySelector({
1336
1369
  id,
1337
1370
  open: open2,
@@ -1364,7 +1397,7 @@ function CountrySelector({
1364
1397
  }
1365
1398
  }, []);
1366
1399
  const [query, setQuery] = useState("");
1367
- return /* @__PURE__ */ jsx4("div", { ref, children: /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
1400
+ return /* @__PURE__ */ jsx5("div", { ref, children: /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
1368
1401
  /* @__PURE__ */ jsxs2(
1369
1402
  "button",
1370
1403
  {
@@ -1377,7 +1410,7 @@ function CountrySelector({
1377
1410
  disabled,
1378
1411
  children: [
1379
1412
  /* @__PURE__ */ jsxs2("span", { className: "truncate flex items-center", children: [
1380
- /* @__PURE__ */ jsx4(
1413
+ /* @__PURE__ */ jsx5(
1381
1414
  "img",
1382
1415
  {
1383
1416
  alt: `${selectedValue}`,
@@ -1387,11 +1420,11 @@ function CountrySelector({
1387
1420
  ),
1388
1421
  (_a = countries.find((el) => el.code === selectedValue)) == null ? void 0 : _a.name
1389
1422
  ] }),
1390
- /* @__PURE__ */ jsx4(
1423
+ /* @__PURE__ */ jsx5(
1391
1424
  "span",
1392
1425
  {
1393
1426
  className: `absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none ${disabled ? "hidden" : ""}`,
1394
- children: /* @__PURE__ */ jsx4(
1427
+ children: /* @__PURE__ */ jsx5(
1395
1428
  "svg",
1396
1429
  {
1397
1430
  className: "h-5 w-5 text-light-purple",
@@ -1399,7 +1432,7 @@ function CountrySelector({
1399
1432
  viewBox: "0 0 20 20",
1400
1433
  fill: "currentColor",
1401
1434
  "aria-hidden": "true",
1402
- children: /* @__PURE__ */ jsx4(
1435
+ children: /* @__PURE__ */ jsx5(
1403
1436
  "path",
1404
1437
  {
1405
1438
  fillRule: "evenodd",
@@ -1414,7 +1447,7 @@ function CountrySelector({
1414
1447
  ]
1415
1448
  }
1416
1449
  ),
1417
- /* @__PURE__ */ jsx4(AnimatePresence, { children: open2 && /* @__PURE__ */ jsxs2(
1450
+ /* @__PURE__ */ jsx5(AnimatePresence, { children: open2 && /* @__PURE__ */ jsxs2(
1418
1451
  motion.ul,
1419
1452
  {
1420
1453
  initial: { opacity: 0 },
@@ -1428,7 +1461,7 @@ function CountrySelector({
1428
1461
  "aria-activedescendant": "listbox-option-3",
1429
1462
  children: [
1430
1463
  /* @__PURE__ */ jsxs2("div", { className: "sticky top-0 z-10 bg-white dark:bg-neutral-800", children: [
1431
- /* @__PURE__ */ jsx4("li", { className: "dark:text-neutral-200 text-neutral-900 cursor-default select-none relative py-2 px-3", children: /* @__PURE__ */ jsx4(
1464
+ /* @__PURE__ */ jsx5("li", { className: "dark:text-neutral-200 text-neutral-900 cursor-default select-none relative py-2 px-3", children: /* @__PURE__ */ jsx5(
1432
1465
  "input",
1433
1466
  {
1434
1467
  type: "search",
@@ -1439,15 +1472,15 @@ function CountrySelector({
1439
1472
  onChange: (e) => setQuery(e.target.value)
1440
1473
  }
1441
1474
  ) }),
1442
- /* @__PURE__ */ jsx4("hr", {})
1475
+ /* @__PURE__ */ jsx5("hr", {})
1443
1476
  ] }),
1444
- /* @__PURE__ */ jsx4(
1477
+ /* @__PURE__ */ jsx5(
1445
1478
  "div",
1446
1479
  {
1447
1480
  className: "max-h-64 scrollbar scrollbar-track-gray-100 scrollbar-thumb-gray-300 hover:scrollbar-thumb-gray-600 scrollbar-thumb-rounded scrollbar-thin overflow-y-scroll",
1448
1481
  children: countries.filter(
1449
1482
  (country) => country.name.toLowerCase().startsWith(query.toLowerCase())
1450
- ).length === 0 ? /* @__PURE__ */ jsx4("li", { className: "text-light-purple cursor-default select-none relative py-2 pl-3 pr-9", children: "No countries found" }) : countries.filter(
1483
+ ).length === 0 ? /* @__PURE__ */ jsx5("li", { className: "text-light-purple cursor-default select-none relative py-2 pl-3 pr-9", children: "No countries found" }) : countries.filter(
1451
1484
  (country) => country.name.toLowerCase().startsWith(query.toLowerCase())
1452
1485
  ).map((value, index) => {
1453
1486
  return /* @__PURE__ */ jsxs2(
@@ -1462,7 +1495,7 @@ function CountrySelector({
1462
1495
  onToggle();
1463
1496
  },
1464
1497
  children: [
1465
- /* @__PURE__ */ jsx4(
1498
+ /* @__PURE__ */ jsx5(
1466
1499
  "img",
1467
1500
  {
1468
1501
  alt: `${value.code}`,
@@ -1470,12 +1503,12 @@ function CountrySelector({
1470
1503
  className: "inline mr-2 h-4 rounded-sm"
1471
1504
  }
1472
1505
  ),
1473
- /* @__PURE__ */ jsx4("span", { className: "font-normal truncate", children: value.name }),
1474
- value.code === selectedValue ? /* @__PURE__ */ jsx4(
1506
+ /* @__PURE__ */ jsx5("span", { className: "font-normal truncate", children: value.name }),
1507
+ value.code === selectedValue ? /* @__PURE__ */ jsx5(
1475
1508
  "span",
1476
1509
  {
1477
1510
  className: "text-blue-600 absolute inset-y-0 right-0 flex items-center pr-8",
1478
- children: /* @__PURE__ */ jsx4(
1511
+ children: /* @__PURE__ */ jsx5(
1479
1512
  "svg",
1480
1513
  {
1481
1514
  className: "h-5 w-5",
@@ -1483,7 +1516,7 @@ function CountrySelector({
1483
1516
  viewBox: "0 0 20 20",
1484
1517
  fill: "currentColor",
1485
1518
  "aria-hidden": "true",
1486
- children: /* @__PURE__ */ jsx4(
1519
+ children: /* @__PURE__ */ jsx5(
1487
1520
  "path",
1488
1521
  {
1489
1522
  fillRule: "evenodd",
@@ -1511,17 +1544,17 @@ var CountrySelector_default = CountrySelector;
1511
1544
 
1512
1545
  // src/components/checkout/SingleProduct.tsx
1513
1546
  import { useEffect as useEffect2, useState as useState2 } from "react";
1514
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1547
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
1515
1548
  var SingleProduct = ({ quantity, details, shouldUpdate }) => {
1516
1549
  var _a;
1517
1550
  return /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
1518
- /* @__PURE__ */ jsx5("img", { className: "aspect-auto max-w-[30%] max-w-32 max-h-32", src: (_a = details.image_url) != null ? _a : "", alt: details.name }),
1551
+ /* @__PURE__ */ jsx6("img", { className: "aspect-auto max-w-[30%] max-w-32 max-h-32", src: (_a = details.image_url) != null ? _a : "", alt: details.name }),
1519
1552
  /* @__PURE__ */ jsxs3("div", { className: "flex flex-col", children: [
1520
- /* @__PURE__ */ jsx5("p", { className: "font-medium", children: details.name }),
1521
- /* @__PURE__ */ jsx5("p", { className: "text-sm", children: formatCurrency(details.price, details.currency) }),
1553
+ /* @__PURE__ */ jsx6("p", { className: "font-medium", children: details.name }),
1554
+ /* @__PURE__ */ jsx6("p", { className: "text-sm", children: formatCurrency(details.price, details.currency) }),
1522
1555
  /* @__PURE__ */ jsxs3("div", { className: "flex justify-between", children: [
1523
- /* @__PURE__ */ jsx5(QuantityComponent, { className: "", quantity, shouldUpdate }),
1524
- /* @__PURE__ */ jsx5("button", { className: "text-sm font-medium", onClick: () => shouldUpdate(0), children: "Usu\u0144" })
1556
+ /* @__PURE__ */ jsx6(QuantityComponent, { className: "", quantity, shouldUpdate }),
1557
+ /* @__PURE__ */ jsx6("button", { className: "text-sm font-medium", onClick: () => shouldUpdate(0), children: "Usu\u0144" })
1525
1558
  ] })
1526
1559
  ] })
1527
1560
  ] });
@@ -1570,8 +1603,8 @@ var QuantityComponent = ({
1570
1603
  setQuantityValue(quantity);
1571
1604
  }
1572
1605
  return /* @__PURE__ */ jsxs3("div", { className: `flex ${className} items-center border dark:border-neutral-400 border-neutral-700 rounded-md my-1`, children: [
1573
- /* @__PURE__ */ jsx5("button", { onClick: decreaseQuantity, className: "px-2 py-1", children: "-" }),
1574
- /* @__PURE__ */ jsx5(
1606
+ /* @__PURE__ */ jsx6("button", { onClick: decreaseQuantity, className: "px-2 py-1", children: "-" }),
1607
+ /* @__PURE__ */ jsx6(
1575
1608
  "input",
1576
1609
  {
1577
1610
  className: "w-8 bg-transparent text-center",
@@ -1582,14 +1615,14 @@ var QuantityComponent = ({
1582
1615
  type: "text"
1583
1616
  }
1584
1617
  ),
1585
- /* @__PURE__ */ jsx5("button", { onClick: increaseQuantity, className: "px-2 py-1", children: "+" })
1618
+ /* @__PURE__ */ jsx6("button", { onClick: increaseQuantity, className: "px-2 py-1", children: "+" })
1586
1619
  ] });
1587
1620
  };
1588
1621
 
1589
1622
  // src/components/checkout/Skeleton.tsx
1590
- import { jsx as jsx6 } from "react/jsx-runtime";
1623
+ import { jsx as jsx7 } from "react/jsx-runtime";
1591
1624
  function Skeleton({ className, ...props }) {
1592
- return /* @__PURE__ */ jsx6(
1625
+ return /* @__PURE__ */ jsx7(
1593
1626
  "div",
1594
1627
  {
1595
1628
  "data-slot": "skeleton",
@@ -1600,32 +1633,47 @@ function Skeleton({ className, ...props }) {
1600
1633
  }
1601
1634
 
1602
1635
  // src/components/checkout/CartComponentContent.tsx
1603
- import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1636
+ import { useMutation as useMutation2, useQuery as useQuery3 } from "@tanstack/react-query";
1637
+ import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1604
1638
  var CartComponentContent = ({ className }) => {
1605
1639
  var _a, _b, _c, _d, _e;
1606
1640
  const provider = useCartProvider();
1607
- const { mutateAsync: removeProduct } = useMutation2(
1608
- provider.removeProductFromCart
1609
- );
1610
- const { mutateAsync: updateQuantity } = useMutation2(provider.updateQuantity);
1611
- const { mutateAsync: setCountryAsync } = useMutation2(provider.setCountry);
1612
- const { mutateAsync: clearCart } = useMutation2(provider.clearCart);
1641
+ const { mutateAsync: removeProduct } = useMutation2({
1642
+ mutationFn: provider.removeProductFromCart
1643
+ });
1644
+ const { mutateAsync: updateQuantity } = useMutation2({
1645
+ mutationFn: provider.updateQuantity
1646
+ });
1647
+ const { mutateAsync: setCountryAsync } = useMutation2({
1648
+ mutationFn: provider.setCountry
1649
+ });
1650
+ const { mutateAsync: clearCart } = useMutation2({
1651
+ mutationFn: provider.clearCart
1652
+ });
1613
1653
  const [errMsg, setErrMsg] = React.useState("");
1614
1654
  const [isCountryOpen, setIsCountryOpen] = React.useState(false);
1615
1655
  const {
1616
1656
  mutateAsync: continueToCheckoutAsync,
1617
- isLoading: isContinueToCheckoutLoading
1618
- } = useMutation2(provider.redirectToNextStep);
1619
- const { data: availableCountries } = useQuery3(
1620
- "cart-available-countries",
1621
- provider.getAvailableCountries
1622
- );
1623
- const { data: isApplePayAvailable } = useQuery3("cart-one-click-payment", provider.checkIfApplePayIsAvailable);
1624
- const { data, isLoading, refetch } = useQuery3("cart", provider.getProducts);
1625
- const { data: countryData, refetch: refetchCountry } = useQuery3(
1626
- "cart-country",
1627
- provider.getCountry
1628
- );
1657
+ isPending: isContinueToCheckoutLoading
1658
+ } = useMutation2({
1659
+ mutationFn: provider.redirectToNextStep
1660
+ });
1661
+ const { data: availableCountries } = useQuery3({
1662
+ queryKey: ["cart-available-countries"],
1663
+ queryFn: provider.getAvailableCountries
1664
+ });
1665
+ const { data: isApplePayAvailable } = useQuery3({
1666
+ queryKey: ["cart-one-click-payment"],
1667
+ queryFn: provider.checkIfApplePayIsAvailable
1668
+ });
1669
+ const { data, isLoading, refetch } = useQuery3({
1670
+ queryKey: ["cart"],
1671
+ queryFn: provider.getProducts
1672
+ });
1673
+ const { data: countryData, refetch: refetchCountry } = useQuery3({
1674
+ queryKey: ["cart-country"],
1675
+ queryFn: provider.getCountry
1676
+ });
1629
1677
  const [productsParent] = useAutoAnimate(
1630
1678
  /* optional config */
1631
1679
  );
@@ -1674,16 +1722,16 @@ var CartComponentContent = ({ className }) => {
1674
1722
  }
1675
1723
  return /* @__PURE__ */ jsxs4("div", { className: `${className} flex flex-col`, ref: productsParent, children: [
1676
1724
  isLoading && /* @__PURE__ */ jsxs4("div", { className: "relative flex w-full justify-center flex-col gap-4", children: [
1677
- /* @__PURE__ */ jsx7(Skeleton, { className: "w-full h-32" }),
1678
- /* @__PURE__ */ jsx7(Skeleton, { className: "w-full h-32" })
1725
+ /* @__PURE__ */ jsx8(Skeleton, { className: "w-full h-32" }),
1726
+ /* @__PURE__ */ jsx8(Skeleton, { className: "w-full h-32" })
1679
1727
  ] }),
1680
- !isLoading && (products == null || products.length == 0) && /* @__PURE__ */ jsx7("div", { className: "flex flex-col gap-4 p-4", children: /* @__PURE__ */ jsx7("p", { className: "dark:text-neutral-400 text-neutral-700", children: "Brak produkt\xF3w w koszyku." }) }),
1681
- /* @__PURE__ */ jsx7(
1728
+ !isLoading && (products == null || products.length == 0) && /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-4 p-4", children: /* @__PURE__ */ jsx8("p", { className: "dark:text-neutral-400 text-neutral-700", children: "Brak produkt\xF3w w koszyku." }) }),
1729
+ /* @__PURE__ */ jsx8(
1682
1730
  "div",
1683
1731
  {
1684
1732
  className: "max-h-[70vh] overflow-clip overflow-y-scroll",
1685
- children: products != null && products.length > 0 && /* @__PURE__ */ jsx7("ul", { className: "mt-5", children: products.map((product) => /* @__PURE__ */ jsx7(React.Fragment, { children: product.details != null && /* @__PURE__ */ jsxs4("li", { className: "mb-3", children: [
1686
- /* @__PURE__ */ jsx7(
1733
+ children: products != null && products.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "mt-5", children: products.map((product) => /* @__PURE__ */ jsx8(React.Fragment, { children: product.details != null && /* @__PURE__ */ jsxs4("li", { className: "mb-3", children: [
1734
+ /* @__PURE__ */ jsx8(
1687
1735
  SingleProduct_default,
1688
1736
  {
1689
1737
  quantity: product.quantity,
@@ -1693,18 +1741,18 @@ var CartComponentContent = ({ className }) => {
1693
1741
  }
1694
1742
  }
1695
1743
  ),
1696
- /* @__PURE__ */ jsx7("hr", { className: "h-1 dark:border-neutral-700 border-neutral-400" })
1744
+ /* @__PURE__ */ jsx8("hr", { className: "h-1 dark:border-neutral-700 border-neutral-400" })
1697
1745
  ] }) }, product.id)) })
1698
1746
  }
1699
1747
  ),
1700
- /* @__PURE__ */ jsx7("div", { className: "grow" }),
1748
+ /* @__PURE__ */ jsx8("div", { className: "grow" }),
1701
1749
  sumOfProducts > 0 && currency != null && /* @__PURE__ */ jsxs4(Fragment4, { children: [
1702
- /* @__PURE__ */ jsx7("div", { className: "mx-3 flex flex-col", children: /* @__PURE__ */ jsxs4(
1750
+ /* @__PURE__ */ jsx8("div", { className: "mx-3 flex flex-col", children: /* @__PURE__ */ jsxs4(
1703
1751
  "div",
1704
1752
  {
1705
1753
  className: "flex flex-row justify-between text-lg",
1706
1754
  children: [
1707
- /* @__PURE__ */ jsx7(
1755
+ /* @__PURE__ */ jsx8(
1708
1756
  "p",
1709
1757
  {
1710
1758
  className: "dark:text-neutral-200 text-neutral-800 text-xl",
@@ -1712,27 +1760,27 @@ var CartComponentContent = ({ className }) => {
1712
1760
  }
1713
1761
  ),
1714
1762
  /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-end", children: [
1715
- /* @__PURE__ */ jsx7(
1763
+ /* @__PURE__ */ jsx8(
1716
1764
  "p",
1717
1765
  {
1718
1766
  className: "dark:text-neutral-200 text-neutral-800 font-medium",
1719
1767
  children: formatCurrency(sumOfProducts, currency)
1720
1768
  }
1721
1769
  ),
1722
- isSomeProductDeliverable && /* @__PURE__ */ jsx7("p", { className: "opacity-70 text-right text-base", children: "+ dostawa" })
1770
+ isSomeProductDeliverable && /* @__PURE__ */ jsx8("p", { className: "opacity-70 text-right text-base", children: "+ dostawa" })
1723
1771
  ] })
1724
1772
  ]
1725
1773
  }
1726
1774
  ) }),
1727
1775
  countries && (countries == null ? void 0 : countries.length) > 1 && /* @__PURE__ */ jsxs4("div", { children: [
1728
- /* @__PURE__ */ jsx7(
1776
+ /* @__PURE__ */ jsx8(
1729
1777
  "h4",
1730
1778
  {
1731
1779
  className: "ml-3 text-sm dark:text-neutral-400 text-neutral-700",
1732
1780
  children: "Wybierz kraj"
1733
1781
  }
1734
1782
  ),
1735
- /* @__PURE__ */ jsx7(
1783
+ /* @__PURE__ */ jsx8(
1736
1784
  CountrySelector_default,
1737
1785
  {
1738
1786
  id: Math.random().toString(),
@@ -1751,7 +1799,7 @@ var CartComponentContent = ({ className }) => {
1751
1799
  )
1752
1800
  ] }),
1753
1801
  /* @__PURE__ */ jsxs4("div", { className: "mb-3 flex flex-col", children: [
1754
- isApplePayAvailable && products != null && products.length > 0 && /* @__PURE__ */ jsx7("div", { className: "w-full px-2", children: /* @__PURE__ */ jsx7(ApplePay_default, { colorType: "white", style: { width: "100%" }, items: products == null ? void 0 : products.map((el) => {
1802
+ isApplePayAvailable && products != null && products.length > 0 && /* @__PURE__ */ jsx8("div", { className: "w-full px-2", children: /* @__PURE__ */ jsx8(ApplePay_default, { colorType: "white", style: { width: "100%" }, items: products == null ? void 0 : products.map((el) => {
1755
1803
  var _a2, _b2, _c2, _d2, _e2, _f;
1756
1804
  return {
1757
1805
  name: (_b2 = (_a2 = el.details) == null ? void 0 : _a2.name) != null ? _b2 : "",
@@ -1762,7 +1810,7 @@ var CartComponentContent = ({ className }) => {
1762
1810
  metadata: el.metadata
1763
1811
  };
1764
1812
  }) }) }),
1765
- products != null && products.length > 0 && /* @__PURE__ */ jsx7("div", { className: "w-full px-2", children: /* @__PURE__ */ jsx7(GooglePay_default, { buttonSizeMode: "fill", buttonColor: "white", style: { width: "100%" }, items: products == null ? void 0 : products.map((el) => {
1813
+ products != null && products.length > 0 && /* @__PURE__ */ jsx8("div", { className: "w-full px-2", children: /* @__PURE__ */ jsx8(GooglePay_default, { buttonSizeMode: "fill", buttonColor: "white", style: { width: "100%" }, items: products == null ? void 0 : products.map((el) => {
1766
1814
  var _a2, _b2, _c2, _d2, _e2, _f;
1767
1815
  return {
1768
1816
  name: (_b2 = (_a2 = el.details) == null ? void 0 : _a2.name) != null ? _b2 : "",
@@ -1773,16 +1821,16 @@ var CartComponentContent = ({ className }) => {
1773
1821
  metadata: el.metadata
1774
1822
  };
1775
1823
  }) }) }),
1776
- /* @__PURE__ */ jsx7(
1824
+ /* @__PURE__ */ jsx8(
1777
1825
  "button",
1778
1826
  {
1779
1827
  onClick: continueToCheckout,
1780
1828
  disabled: isLoading || isContinueToCheckoutLoading || selectedCountry == null,
1781
1829
  className: "px-3 py-2 my-2 mx-2 rounded-md disabled:opacity-40 disabled:cursor-not-allowed dark:bg-neutral-300 dark:hover:bg-neutral-100 dark:text-neutral-800 hover:bg-neutral-900 text-neutral-200 bg-neutral-800 transition font-bold",
1782
- children: isContinueToCheckoutLoading ? "\u0141adowanie..." : "Nast\u0119pny krok"
1830
+ children: isContinueToCheckoutLoading ? /* @__PURE__ */ jsx8(Spinner, {}) : "Nast\u0119pny krok"
1783
1831
  }
1784
1832
  ),
1785
- errMsg.length > 0 && /* @__PURE__ */ jsx7("p", { className: "text-red-500 text-sm text-center", children: errMsg })
1833
+ errMsg.length > 0 && /* @__PURE__ */ jsx8("p", { className: "text-red-500 text-sm text-center", children: errMsg })
1786
1834
  ] })
1787
1835
  ] })
1788
1836
  ] });
@@ -1790,31 +1838,31 @@ var CartComponentContent = ({ className }) => {
1790
1838
  var CartComponentContent_default = CartComponentContent;
1791
1839
 
1792
1840
  // src/components/checkout/CartComponent.tsx
1793
- import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1841
+ import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
1794
1842
  function CartComponent({ isVisible, shouldHide }) {
1795
1843
  const [parent] = useAutoAnimate2(
1796
1844
  /* optional config */
1797
1845
  );
1798
- return /* @__PURE__ */ jsx8("div", { ref: parent, className: "z-[999999]", children: isVisible && /* @__PURE__ */ jsxs5(Fragment5, { children: [
1799
- /* @__PURE__ */ jsx8(
1846
+ return /* @__PURE__ */ jsx9("div", { ref: parent, className: "bitsnap-checkout dark", style: { zIndex: 999999 }, children: isVisible && /* @__PURE__ */ jsxs5(Fragment5, { children: [
1847
+ /* @__PURE__ */ jsx9(
1800
1848
  "div",
1801
1849
  {
1802
- className: "fixed top-0 right-0 left-0 bottom-0 bg-black/30 cursor-pointer",
1850
+ className: "fixed top-0 right-0 left-0 bottom-0 bg-black/30 cursor-pointer z-10",
1803
1851
  onClick: shouldHide
1804
1852
  }
1805
1853
  ),
1806
1854
  /* @__PURE__ */ jsxs5(
1807
1855
  "div",
1808
1856
  {
1809
- className: "fixed top-0 right-0 bottom-0 w-full md:w-[350px] xl:w-[420px] dark:bg-neutral-900 bg-neutral-300 dark:text-neutral-200 text-neutral-900 flex flex-col",
1857
+ className: "fixed z-20 top-0 right-0 bottom-0 w-full md:w-[350px] xl:w-[420px] dark:bg-neutral-900 bg-neutral-300 dark:text-neutral-200 text-neutral-900 flex flex-col",
1810
1858
  children: [
1811
1859
  /* @__PURE__ */ jsxs5(
1812
1860
  "div",
1813
1861
  {
1814
1862
  className: "mx-3 mt-7 flex justify-between items-center",
1815
1863
  children: [
1816
- /* @__PURE__ */ jsx8("h1", { className: "text-2xl font-medium", children: "Koszyk" }),
1817
- /* @__PURE__ */ jsx8(
1864
+ /* @__PURE__ */ jsx9("h1", { className: "text-2xl font-medium", children: "Koszyk" }),
1865
+ /* @__PURE__ */ jsx9(
1818
1866
  "button",
1819
1867
  {
1820
1868
  className: "rounded-full dark:hover:bg-neutral-700 hover:bg-neutral-400 p-2 transition",
@@ -1833,8 +1881,8 @@ function CartComponent({ isVisible, shouldHide }) {
1833
1881
  strokeLinejoin: "round",
1834
1882
  className: "lucide lucide-x",
1835
1883
  children: [
1836
- /* @__PURE__ */ jsx8("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1837
- /* @__PURE__ */ jsx8("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1884
+ /* @__PURE__ */ jsx9("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1885
+ /* @__PURE__ */ jsx9("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1838
1886
  ]
1839
1887
  }
1840
1888
  )
@@ -1843,7 +1891,7 @@ function CartComponent({ isVisible, shouldHide }) {
1843
1891
  ]
1844
1892
  }
1845
1893
  ),
1846
- /* @__PURE__ */ jsx8(CartComponentContent_default, { className: "grow" })
1894
+ /* @__PURE__ */ jsx9(CartComponentContent_default, { className: "grow" })
1847
1895
  ]
1848
1896
  }
1849
1897
  )
@@ -1854,14 +1902,14 @@ var WrapperCartComponent = (props) => {
1854
1902
  return null;
1855
1903
  }
1856
1904
  return createPortal(
1857
- /* @__PURE__ */ jsx8(CartProvider_default, { children: /* @__PURE__ */ jsx8(CartComponent, { ...props }) }),
1905
+ /* @__PURE__ */ jsx9(CartProvider_default, { children: /* @__PURE__ */ jsx9(CartComponent, { ...props }) }),
1858
1906
  document.body
1859
1907
  );
1860
1908
  };
1861
1909
  var CartComponent_default = WrapperCartComponent;
1862
1910
 
1863
1911
  // src/components/checkout/BitsnapCart.tsx
1864
- import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1912
+ import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1865
1913
  var cartAddToCartSchema = zod2.object({
1866
1914
  id: zod2.string(),
1867
1915
  isSubscription: zod2.boolean().default(false),
@@ -1988,13 +2036,13 @@ function BitsnapCart({
1988
2036
  }
1989
2037
  }
1990
2038
  }, []);
1991
- return /* @__PURE__ */ jsxs6("span", { className: "bitsnap-checkout", children: [
1992
- /* @__PURE__ */ jsx9(
2039
+ return /* @__PURE__ */ jsxs6(Fragment6, { children: [
2040
+ /* @__PURE__ */ jsx10(
1993
2041
  "button",
1994
2042
  {
1995
2043
  onClick: () => isCartVisible ? hideCart() : showCart(),
1996
- className: className != null ? className : "relative rounded-full hover:bg-neutral-300 transition p-1",
1997
- children: children ? /* @__PURE__ */ jsx9(Fragment6, { children }) : /* @__PURE__ */ jsxs6(
2044
+ className: ["bitsnap-checkout", className != null ? className : "relative rounded-full hover:bg-neutral-300 transition p-1"].join(" "),
2045
+ children: children ? /* @__PURE__ */ jsx10(Fragment6, { children }) : /* @__PURE__ */ jsxs6(
1998
2046
  "svg",
1999
2047
  {
2000
2048
  xmlns: "http://www.w3.org/2000/svg",
@@ -2008,15 +2056,15 @@ function BitsnapCart({
2008
2056
  strokeLinejoin: "round",
2009
2057
  className: "lucide lucide-shopping-cart",
2010
2058
  children: [
2011
- /* @__PURE__ */ jsx9("circle", { cx: "8", cy: "21", r: "1" }),
2012
- /* @__PURE__ */ jsx9("circle", { cx: "19", cy: "21", r: "1" }),
2013
- /* @__PURE__ */ jsx9("path", { d: "M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12" })
2059
+ /* @__PURE__ */ jsx10("circle", { cx: "8", cy: "21", r: "1" }),
2060
+ /* @__PURE__ */ jsx10("circle", { cx: "19", cy: "21", r: "1" }),
2061
+ /* @__PURE__ */ jsx10("path", { d: "M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12" })
2014
2062
  ]
2015
2063
  }
2016
2064
  )
2017
2065
  }
2018
2066
  ),
2019
- /* @__PURE__ */ jsx9(
2067
+ /* @__PURE__ */ jsx10(
2020
2068
  CartComponent_default,
2021
2069
  {
2022
2070
  isVisible: isCartVisible,