bitsnap-react 1.0.0 → 1.2.1

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.js CHANGED
@@ -102,7 +102,6 @@ var PublicApiClient;
102
102
  // src/components/checkout/CartProvider.tsx
103
103
  var import_protobuf = require("@bufbuild/protobuf");
104
104
  var import_react = require("react");
105
- var import_react_query = require("react-query");
106
105
  var import_zod = __toESM(require("zod"));
107
106
 
108
107
  // src/components/checkout/constants.ts
@@ -143,7 +142,7 @@ function formatCurrency(amount, currency) {
143
142
  var import_zustand = require("zustand");
144
143
  var useCheckoutStore = (0, import_zustand.create)((set) => ({
145
144
  isCartVisible: false,
146
- numberOfProductsInCart: 2,
145
+ numberOfProductsInCart: 0,
147
146
  showCart: () => set((state) => ({ ...state, isCartVisible: true })),
148
147
  hideCart: () => set((state) => ({ ...state, isCartVisible: false })),
149
148
  setNumberOfProductsInCart: (numberOfProductsInCart) => set((state) => ({ ...state, numberOfProductsInCart }))
@@ -360,6 +359,7 @@ function mapGooglePayDisplayItems(items, methods, deliveryMethod, couponCode, co
360
359
  }
361
360
 
362
361
  // src/components/checkout/CartProvider.tsx
362
+ var import_react_query = require("@tanstack/react-query");
363
363
  var import_jsx_runtime = require("react/jsx-runtime");
364
364
  var MARKETING_AGREEMENT_ID = "__m_a";
365
365
  var CartProviderContext = (0, import_react.createContext)(void 0);
@@ -386,6 +386,9 @@ function getNewHostIfExist() {
386
386
  }
387
387
  var CartProvider = ({ children }) => {
388
388
  const queryClient = new import_react_query.QueryClient();
389
+ (0, import_react.useEffect)(() => {
390
+ updateNumberOfProductsInCart();
391
+ }, []);
389
392
  const projectID = getProjectID();
390
393
  if (projectID == null) {
391
394
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
@@ -498,6 +501,7 @@ function addProducts(products) {
498
501
  metadata: el.metadata
499
502
  })));
500
503
  saveCheckout(checkout);
504
+ updateNumberOfProductsInCart();
501
505
  }
502
506
  function removeProductFromCheckout(ids) {
503
507
  var _a;
@@ -509,6 +513,7 @@ function removeProductFromCheckout(ids) {
509
513
  )
510
514
  };
511
515
  saveCheckout(newCheckout);
516
+ updateNumberOfProductsInCart();
512
517
  }
513
518
  function saveCheckout(model) {
514
519
  localStorage.setItem(checkoutKey, JSON.stringify(model));
@@ -616,6 +621,7 @@ var getCheckoutMethods = (projectID) => {
616
621
  const empty = structuredClone(emptyCheckout);
617
622
  empty.country = (_a = getCheckout()) == null ? void 0 : _a.country;
618
623
  saveCheckout(empty);
624
+ updateNumberOfProductsInCart();
619
625
  },
620
626
  async getAvailableCountries() {
621
627
  const result = await fetch(buildURL(projectID, "/countries"), {
@@ -697,6 +703,7 @@ var getCheckoutMethods = (projectID) => {
697
703
  return product;
698
704
  });
699
705
  saveCheckout(checkout);
706
+ updateNumberOfProductsInCart();
700
707
  },
701
708
  async redirectToNextStep() {
702
709
  const checkout = getCheckout();
@@ -1082,9 +1089,20 @@ function resolveProductDetailsFromSingleProduct(id, product) {
1082
1089
  images: (_d = variant.images) != null ? _d : product.images
1083
1090
  };
1084
1091
  }
1092
+ function updateNumberOfProductsInCart() {
1093
+ var _a, _b;
1094
+ const checkout = getCheckout();
1095
+ let numberOfProductsInCart = 0;
1096
+ if (checkout == null) {
1097
+ useCheckoutStore.setState((state) => ({ ...state, numberOfProductsInCart }));
1098
+ return;
1099
+ }
1100
+ numberOfProductsInCart = (_b = (_a = checkout.products) == null ? void 0 : _a.reduce((acc, product) => acc + product.quantity, 0)) != null ? _b : 0;
1101
+ useCheckoutStore.setState((state) => ({ ...state, numberOfProductsInCart }));
1102
+ }
1085
1103
 
1086
1104
  // src/components/checkout/ApplePay.tsx
1087
- var import_react_query2 = require("react-query");
1105
+ var import_react_query2 = require("@tanstack/react-query");
1088
1106
  var import_jsx_runtime2 = require("react/jsx-runtime");
1089
1107
  function ApplePayButtonComponent({ style, buttonType, colorType, items, onClick }) {
1090
1108
  const {
@@ -1098,7 +1116,10 @@ function ApplePayButtonComponent({ style, buttonType, colorType, items, onClick
1098
1116
  setPostalCode,
1099
1117
  clearCart
1100
1118
  } = useCartProvider();
1101
- const { data: isApplePayAvailable } = (0, import_react_query2.useQuery)("is-apple-pay-available", checkIfApplePayIsAvailable);
1119
+ const { data: isApplePayAvailable } = (0, import_react_query2.useQuery)({
1120
+ queryKey: ["is-apple-pay-available"],
1121
+ queryFn: checkIfApplePayIsAvailable
1122
+ });
1102
1123
  if (isApplePayAvailable != true) {
1103
1124
  return null;
1104
1125
  }
@@ -1271,8 +1292,34 @@ var ApplePay_default = Wrapper;
1271
1292
 
1272
1293
  // src/components/checkout/GooglePay.tsx
1273
1294
  var import_button_react = __toESM(require("@google-pay/button-react"));
1274
- var import_react_query3 = require("react-query");
1295
+
1296
+ // src/ui/spinner.tsx
1297
+ var import_lucide_react = require("lucide-react");
1298
+
1299
+ // src/lib/utils.ts
1300
+ var import_clsx = require("clsx");
1301
+ var import_tailwind_merge = require("tailwind-merge");
1302
+ function cn(...inputs) {
1303
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
1304
+ }
1305
+
1306
+ // src/ui/spinner.tsx
1275
1307
  var import_jsx_runtime3 = require("react/jsx-runtime");
1308
+ function Spinner({ className, ...props }) {
1309
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1310
+ import_lucide_react.Loader2Icon,
1311
+ {
1312
+ role: "status",
1313
+ "aria-label": "Loading",
1314
+ className: cn("size-4 animate-spin", className),
1315
+ ...props
1316
+ }
1317
+ );
1318
+ }
1319
+
1320
+ // src/components/checkout/GooglePay.tsx
1321
+ var import_react_query3 = require("@tanstack/react-query");
1322
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1276
1323
  function GooglePayButtonComponent({ items, style, buttonColor, buttonSizeMode, test }) {
1277
1324
  const {
1278
1325
  getGooglePayConfiguration,
@@ -1284,20 +1331,25 @@ function GooglePayButtonComponent({ items, style, buttonColor, buttonSizeMode, t
1284
1331
  setPostalCode,
1285
1332
  clearCart
1286
1333
  } = useCartProvider();
1287
- const { data: googlePayConfiguration } = (0, import_react_query3.useQuery)(["get-google-pay-configuration", items.map((el) => el.id).join(",")], () => getGooglePayConfiguration({
1288
- items: items.map((el) => ({
1289
- ...el,
1290
- id: void 0,
1291
- productID: el.id
1292
- }))
1293
- }));
1294
- const { mutateAsync: completeGooglePayPaymentAsync, isLoading } = (0, import_react_query3.useMutation)(completeGooglePayPayment);
1334
+ const { data: googlePayConfiguration } = (0, import_react_query3.useQuery)({
1335
+ queryKey: ["get-google-pay-configuration", items.map((el) => el.id).join(",")],
1336
+ queryFn: () => getGooglePayConfiguration({
1337
+ items: items.map((el) => ({
1338
+ ...el,
1339
+ id: void 0,
1340
+ productID: el.id
1341
+ }))
1342
+ })
1343
+ });
1344
+ const { mutateAsync: completeGooglePayPaymentAsync, isPending } = (0, import_react_query3.useMutation)({
1345
+ mutationFn: completeGooglePayPayment
1346
+ });
1295
1347
  if (googlePayConfiguration == null || googlePayConfiguration.isAvailable != true) {
1296
1348
  console.log("google pay configuration is not available", googlePayConfiguration);
1297
1349
  return null;
1298
1350
  }
1299
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1300
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1351
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1352
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1301
1353
  import_button_react.default,
1302
1354
  {
1303
1355
  buttonSizeMode,
@@ -1350,11 +1402,11 @@ function GooglePayButtonComponent({ items, style, buttonColor, buttonSizeMode, t
1350
1402
  }
1351
1403
  }
1352
1404
  ),
1353
- isLoading ? "\u0141adowanie..." : null
1405
+ isPending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spinner, {}) : null
1354
1406
  ] });
1355
1407
  }
1356
1408
  function Wrapper2(props) {
1357
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CartProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GooglePayButtonComponent, { ...props }) }) });
1409
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CartProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GooglePayButtonComponent, { ...props }) }) });
1358
1410
  }
1359
1411
  var GooglePay_default = Wrapper2;
1360
1412
 
@@ -1369,12 +1421,11 @@ var import_react_dom = require("react-dom");
1369
1421
  // src/components/checkout/CartComponentContent.tsx
1370
1422
  var import_react4 = require("@formkit/auto-animate/react");
1371
1423
  var import_react5 = __toESM(require("react"));
1372
- var import_react_query4 = require("react-query");
1373
1424
 
1374
1425
  // src/components/checkout/CountrySelector.tsx
1375
1426
  var import_framer_motion = require("framer-motion");
1376
1427
  var import_react2 = require("react");
1377
- var import_jsx_runtime4 = require("react/jsx-runtime");
1428
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1378
1429
  function CountrySelector({
1379
1430
  id,
1380
1431
  open: open2,
@@ -1407,8 +1458,8 @@ function CountrySelector({
1407
1458
  }
1408
1459
  }, []);
1409
1460
  const [query, setQuery] = (0, import_react2.useState)("");
1410
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative", children: [
1411
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1461
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
1462
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1412
1463
  "button",
1413
1464
  {
1414
1465
  type: "button",
@@ -1419,8 +1470,8 @@ function CountrySelector({
1419
1470
  onClick: onToggle,
1420
1471
  disabled,
1421
1472
  children: [
1422
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "truncate flex items-center", children: [
1423
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1473
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "truncate flex items-center", children: [
1474
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1424
1475
  "img",
1425
1476
  {
1426
1477
  alt: `${selectedValue}`,
@@ -1430,11 +1481,11 @@ function CountrySelector({
1430
1481
  ),
1431
1482
  (_a = countries.find((el) => el.code === selectedValue)) == null ? void 0 : _a.name
1432
1483
  ] }),
1433
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1484
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1434
1485
  "span",
1435
1486
  {
1436
1487
  className: `absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none ${disabled ? "hidden" : ""}`,
1437
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1488
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1438
1489
  "svg",
1439
1490
  {
1440
1491
  className: "h-5 w-5 text-light-purple",
@@ -1442,7 +1493,7 @@ function CountrySelector({
1442
1493
  viewBox: "0 0 20 20",
1443
1494
  fill: "currentColor",
1444
1495
  "aria-hidden": "true",
1445
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1496
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1446
1497
  "path",
1447
1498
  {
1448
1499
  fillRule: "evenodd",
@@ -1457,7 +1508,7 @@ function CountrySelector({
1457
1508
  ]
1458
1509
  }
1459
1510
  ),
1460
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_framer_motion.AnimatePresence, { children: open2 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1511
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_framer_motion.AnimatePresence, { children: open2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1461
1512
  import_framer_motion.motion.ul,
1462
1513
  {
1463
1514
  initial: { opacity: 0 },
@@ -1470,8 +1521,8 @@ function CountrySelector({
1470
1521
  "aria-labelledby": "listbox-label",
1471
1522
  "aria-activedescendant": "listbox-option-3",
1472
1523
  children: [
1473
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sticky top-0 z-10 bg-white dark:bg-neutral-800", children: [
1474
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { className: "dark:text-neutral-200 text-neutral-900 cursor-default select-none relative py-2 px-3", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1524
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sticky top-0 z-10 bg-white dark:bg-neutral-800", children: [
1525
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { className: "dark:text-neutral-200 text-neutral-900 cursor-default select-none relative py-2 px-3", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1475
1526
  "input",
1476
1527
  {
1477
1528
  type: "search",
@@ -1482,18 +1533,18 @@ function CountrySelector({
1482
1533
  onChange: (e) => setQuery(e.target.value)
1483
1534
  }
1484
1535
  ) }),
1485
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("hr", {})
1536
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("hr", {})
1486
1537
  ] }),
1487
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1538
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1488
1539
  "div",
1489
1540
  {
1490
1541
  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",
1491
1542
  children: countries.filter(
1492
1543
  (country) => country.name.toLowerCase().startsWith(query.toLowerCase())
1493
- ).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { className: "text-light-purple cursor-default select-none relative py-2 pl-3 pr-9", children: "No countries found" }) : countries.filter(
1544
+ ).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { className: "text-light-purple cursor-default select-none relative py-2 pl-3 pr-9", children: "No countries found" }) : countries.filter(
1494
1545
  (country) => country.name.toLowerCase().startsWith(query.toLowerCase())
1495
1546
  ).map((value, index) => {
1496
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1547
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1497
1548
  "li",
1498
1549
  {
1499
1550
  className: "text-dark-blue cursor-default select-none relative py-2 pl-3 pr-9 flex items-center hover:bg-extra-light-white transition",
@@ -1505,7 +1556,7 @@ function CountrySelector({
1505
1556
  onToggle();
1506
1557
  },
1507
1558
  children: [
1508
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1559
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1509
1560
  "img",
1510
1561
  {
1511
1562
  alt: `${value.code}`,
@@ -1513,12 +1564,12 @@ function CountrySelector({
1513
1564
  className: "inline mr-2 h-4 rounded-sm"
1514
1565
  }
1515
1566
  ),
1516
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "font-normal truncate", children: value.name }),
1517
- value.code === selectedValue ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1567
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "font-normal truncate", children: value.name }),
1568
+ value.code === selectedValue ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1518
1569
  "span",
1519
1570
  {
1520
1571
  className: "text-blue-600 absolute inset-y-0 right-0 flex items-center pr-8",
1521
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1572
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1522
1573
  "svg",
1523
1574
  {
1524
1575
  className: "h-5 w-5",
@@ -1526,7 +1577,7 @@ function CountrySelector({
1526
1577
  viewBox: "0 0 20 20",
1527
1578
  fill: "currentColor",
1528
1579
  "aria-hidden": "true",
1529
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1580
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1530
1581
  "path",
1531
1582
  {
1532
1583
  fillRule: "evenodd",
@@ -1554,17 +1605,17 @@ var CountrySelector_default = CountrySelector;
1554
1605
 
1555
1606
  // src/components/checkout/SingleProduct.tsx
1556
1607
  var import_react3 = require("react");
1557
- var import_jsx_runtime5 = require("react/jsx-runtime");
1608
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1558
1609
  var SingleProduct = ({ quantity, details, shouldUpdate }) => {
1559
1610
  var _a;
1560
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-3", children: [
1561
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("img", { className: "aspect-auto max-w-[30%] max-w-32 max-h-32", src: (_a = details.image_url) != null ? _a : "", alt: details.name }),
1562
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col", children: [
1563
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "font-medium", children: details.name }),
1564
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm", children: formatCurrency(details.price, details.currency) }),
1565
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex justify-between", children: [
1566
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuantityComponent, { className: "", quantity, shouldUpdate }),
1567
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "text-sm font-medium", onClick: () => shouldUpdate(0), children: "Usu\u0144" })
1611
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-3", children: [
1612
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { className: "aspect-auto max-w-[30%] max-w-32 max-h-32", src: (_a = details.image_url) != null ? _a : "", alt: details.name }),
1613
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col", children: [
1614
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "font-medium", children: details.name }),
1615
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm", children: formatCurrency(details.price, details.currency) }),
1616
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex justify-between", children: [
1617
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(QuantityComponent, { className: "", quantity, shouldUpdate }),
1618
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "text-sm font-medium", onClick: () => shouldUpdate(0), children: "Usu\u0144" })
1568
1619
  ] })
1569
1620
  ] })
1570
1621
  ] });
@@ -1612,9 +1663,9 @@ var QuantityComponent = ({
1612
1663
  setQuantityString(quantity.toString());
1613
1664
  setQuantityValue(quantity);
1614
1665
  }
1615
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `flex ${className} items-center border dark:border-neutral-400 border-neutral-700 rounded-md my-1`, children: [
1616
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: decreaseQuantity, className: "px-2 py-1", children: "-" }),
1617
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1666
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `flex ${className} items-center border dark:border-neutral-400 border-neutral-700 rounded-md my-1`, children: [
1667
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { onClick: decreaseQuantity, className: "px-2 py-1", children: "-" }),
1668
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1618
1669
  "input",
1619
1670
  {
1620
1671
  className: "w-8 bg-transparent text-center",
@@ -1625,14 +1676,14 @@ var QuantityComponent = ({
1625
1676
  type: "text"
1626
1677
  }
1627
1678
  ),
1628
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: increaseQuantity, className: "px-2 py-1", children: "+" })
1679
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { onClick: increaseQuantity, className: "px-2 py-1", children: "+" })
1629
1680
  ] });
1630
1681
  };
1631
1682
 
1632
1683
  // src/components/checkout/Skeleton.tsx
1633
- var import_jsx_runtime6 = require("react/jsx-runtime");
1684
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1634
1685
  function Skeleton({ className, ...props }) {
1635
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1686
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1636
1687
  "div",
1637
1688
  {
1638
1689
  "data-slot": "skeleton",
@@ -1643,32 +1694,47 @@ function Skeleton({ className, ...props }) {
1643
1694
  }
1644
1695
 
1645
1696
  // src/components/checkout/CartComponentContent.tsx
1646
- var import_jsx_runtime7 = require("react/jsx-runtime");
1697
+ var import_react_query4 = require("@tanstack/react-query");
1698
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1647
1699
  var CartComponentContent = ({ className }) => {
1648
1700
  var _a, _b, _c, _d, _e;
1649
1701
  const provider = useCartProvider();
1650
- const { mutateAsync: removeProduct } = (0, import_react_query4.useMutation)(
1651
- provider.removeProductFromCart
1652
- );
1653
- const { mutateAsync: updateQuantity } = (0, import_react_query4.useMutation)(provider.updateQuantity);
1654
- const { mutateAsync: setCountryAsync } = (0, import_react_query4.useMutation)(provider.setCountry);
1655
- const { mutateAsync: clearCart } = (0, import_react_query4.useMutation)(provider.clearCart);
1702
+ const { mutateAsync: removeProduct } = (0, import_react_query4.useMutation)({
1703
+ mutationFn: provider.removeProductFromCart
1704
+ });
1705
+ const { mutateAsync: updateQuantity } = (0, import_react_query4.useMutation)({
1706
+ mutationFn: provider.updateQuantity
1707
+ });
1708
+ const { mutateAsync: setCountryAsync } = (0, import_react_query4.useMutation)({
1709
+ mutationFn: provider.setCountry
1710
+ });
1711
+ const { mutateAsync: clearCart } = (0, import_react_query4.useMutation)({
1712
+ mutationFn: provider.clearCart
1713
+ });
1656
1714
  const [errMsg, setErrMsg] = import_react5.default.useState("");
1657
1715
  const [isCountryOpen, setIsCountryOpen] = import_react5.default.useState(false);
1658
1716
  const {
1659
1717
  mutateAsync: continueToCheckoutAsync,
1660
- isLoading: isContinueToCheckoutLoading
1661
- } = (0, import_react_query4.useMutation)(provider.redirectToNextStep);
1662
- const { data: availableCountries } = (0, import_react_query4.useQuery)(
1663
- "cart-available-countries",
1664
- provider.getAvailableCountries
1665
- );
1666
- const { data: isApplePayAvailable } = (0, import_react_query4.useQuery)("cart-one-click-payment", provider.checkIfApplePayIsAvailable);
1667
- const { data, isLoading, refetch } = (0, import_react_query4.useQuery)("cart", provider.getProducts);
1668
- const { data: countryData, refetch: refetchCountry } = (0, import_react_query4.useQuery)(
1669
- "cart-country",
1670
- provider.getCountry
1671
- );
1718
+ isPending: isContinueToCheckoutLoading
1719
+ } = (0, import_react_query4.useMutation)({
1720
+ mutationFn: provider.redirectToNextStep
1721
+ });
1722
+ const { data: availableCountries } = (0, import_react_query4.useQuery)({
1723
+ queryKey: ["cart-available-countries"],
1724
+ queryFn: provider.getAvailableCountries
1725
+ });
1726
+ const { data: isApplePayAvailable } = (0, import_react_query4.useQuery)({
1727
+ queryKey: ["cart-one-click-payment"],
1728
+ queryFn: provider.checkIfApplePayIsAvailable
1729
+ });
1730
+ const { data, isLoading, refetch } = (0, import_react_query4.useQuery)({
1731
+ queryKey: ["cart"],
1732
+ queryFn: provider.getProducts
1733
+ });
1734
+ const { data: countryData, refetch: refetchCountry } = (0, import_react_query4.useQuery)({
1735
+ queryKey: ["cart-country"],
1736
+ queryFn: provider.getCountry
1737
+ });
1672
1738
  const [productsParent] = (0, import_react4.useAutoAnimate)(
1673
1739
  /* optional config */
1674
1740
  );
@@ -1715,18 +1781,18 @@ var CartComponentContent = ({ className }) => {
1715
1781
  setErrMsg(`${e}`);
1716
1782
  }
1717
1783
  }
1718
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `${className} flex flex-col`, ref: productsParent, children: [
1719
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative flex w-full justify-center flex-col gap-4", children: [
1720
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Skeleton, { className: "w-full h-32" }),
1721
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Skeleton, { className: "w-full h-32" })
1784
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `${className} flex flex-col`, ref: productsParent, children: [
1785
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative flex w-full justify-center flex-col gap-4", children: [
1786
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Skeleton, { className: "w-full h-32" }),
1787
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Skeleton, { className: "w-full h-32" })
1722
1788
  ] }),
1723
- !isLoading && (products == null || products.length == 0) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex flex-col gap-4 p-4", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "dark:text-neutral-400 text-neutral-700", children: "Brak produkt\xF3w w koszyku." }) }),
1724
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1789
+ !isLoading && (products == null || products.length == 0) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col gap-4 p-4", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "dark:text-neutral-400 text-neutral-700", children: "Brak produkt\xF3w w koszyku." }) }),
1790
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1725
1791
  "div",
1726
1792
  {
1727
1793
  className: "max-h-[70vh] overflow-clip overflow-y-scroll",
1728
- children: products != null && products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "mt-5", children: products.map((product) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react5.default.Fragment, { children: product.details != null && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { className: "mb-3", children: [
1729
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1794
+ children: products != null && products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "mt-5", children: products.map((product) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react5.default.Fragment, { children: product.details != null && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { className: "mb-3", children: [
1795
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1730
1796
  SingleProduct_default,
1731
1797
  {
1732
1798
  quantity: product.quantity,
@@ -1736,46 +1802,46 @@ var CartComponentContent = ({ className }) => {
1736
1802
  }
1737
1803
  }
1738
1804
  ),
1739
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("hr", { className: "h-1 dark:border-neutral-700 border-neutral-400" })
1805
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("hr", { className: "h-1 dark:border-neutral-700 border-neutral-400" })
1740
1806
  ] }) }, product.id)) })
1741
1807
  }
1742
1808
  ),
1743
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "grow" }),
1744
- sumOfProducts > 0 && currency != null && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1745
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mx-3 flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1809
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "grow" }),
1810
+ sumOfProducts > 0 && currency != null && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1811
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mx-3 flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1746
1812
  "div",
1747
1813
  {
1748
1814
  className: "flex flex-row justify-between text-lg",
1749
1815
  children: [
1750
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1816
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1751
1817
  "p",
1752
1818
  {
1753
1819
  className: "dark:text-neutral-200 text-neutral-800 text-xl",
1754
1820
  children: "Suma:"
1755
1821
  }
1756
1822
  ),
1757
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col items-end", children: [
1758
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1823
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col items-end", children: [
1824
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1759
1825
  "p",
1760
1826
  {
1761
1827
  className: "dark:text-neutral-200 text-neutral-800 font-medium",
1762
1828
  children: formatCurrency(sumOfProducts, currency)
1763
1829
  }
1764
1830
  ),
1765
- isSomeProductDeliverable && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "opacity-70 text-right text-base", children: "+ dostawa" })
1831
+ isSomeProductDeliverable && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "opacity-70 text-right text-base", children: "+ dostawa" })
1766
1832
  ] })
1767
1833
  ]
1768
1834
  }
1769
1835
  ) }),
1770
- countries && (countries == null ? void 0 : countries.length) > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
1771
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1836
+ countries && (countries == null ? void 0 : countries.length) > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
1837
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1772
1838
  "h4",
1773
1839
  {
1774
1840
  className: "ml-3 text-sm dark:text-neutral-400 text-neutral-700",
1775
1841
  children: "Wybierz kraj"
1776
1842
  }
1777
1843
  ),
1778
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1844
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1779
1845
  CountrySelector_default,
1780
1846
  {
1781
1847
  id: Math.random().toString(),
@@ -1793,8 +1859,8 @@ var CartComponentContent = ({ className }) => {
1793
1859
  }
1794
1860
  )
1795
1861
  ] }),
1796
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mb-3 flex flex-col", children: [
1797
- isApplePayAvailable && products != null && products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ApplePay_default, { colorType: "white", style: { width: "100%" }, items: products == null ? void 0 : products.map((el) => {
1862
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "mb-3 flex flex-col", children: [
1863
+ isApplePayAvailable && products != null && products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ApplePay_default, { colorType: "white", style: { width: "100%" }, items: products == null ? void 0 : products.map((el) => {
1798
1864
  var _a2, _b2, _c2, _d2, _e2, _f;
1799
1865
  return {
1800
1866
  name: (_b2 = (_a2 = el.details) == null ? void 0 : _a2.name) != null ? _b2 : "",
@@ -1805,7 +1871,7 @@ var CartComponentContent = ({ className }) => {
1805
1871
  metadata: el.metadata
1806
1872
  };
1807
1873
  }) }) }),
1808
- products != null && products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(GooglePay_default, { buttonSizeMode: "fill", buttonColor: "white", style: { width: "100%" }, items: products == null ? void 0 : products.map((el) => {
1874
+ products != null && products.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(GooglePay_default, { buttonSizeMode: "fill", buttonColor: "white", style: { width: "100%" }, items: products == null ? void 0 : products.map((el) => {
1809
1875
  var _a2, _b2, _c2, _d2, _e2, _f;
1810
1876
  return {
1811
1877
  name: (_b2 = (_a2 = el.details) == null ? void 0 : _a2.name) != null ? _b2 : "",
@@ -1816,16 +1882,16 @@ var CartComponentContent = ({ className }) => {
1816
1882
  metadata: el.metadata
1817
1883
  };
1818
1884
  }) }) }),
1819
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1885
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1820
1886
  "button",
1821
1887
  {
1822
1888
  onClick: continueToCheckout,
1823
1889
  disabled: isLoading || isContinueToCheckoutLoading || selectedCountry == null,
1824
1890
  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",
1825
- children: isContinueToCheckoutLoading ? "\u0141adowanie..." : "Nast\u0119pny krok"
1891
+ children: isContinueToCheckoutLoading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner, {}) : "Nast\u0119pny krok"
1826
1892
  }
1827
1893
  ),
1828
- errMsg.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-red-500 text-sm text-center", children: errMsg })
1894
+ errMsg.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-red-500 text-sm text-center", children: errMsg })
1829
1895
  ] })
1830
1896
  ] })
1831
1897
  ] });
@@ -1833,36 +1899,36 @@ var CartComponentContent = ({ className }) => {
1833
1899
  var CartComponentContent_default = CartComponentContent;
1834
1900
 
1835
1901
  // src/components/checkout/CartComponent.tsx
1836
- var import_jsx_runtime8 = require("react/jsx-runtime");
1902
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1837
1903
  function CartComponent({ isVisible, shouldHide }) {
1838
1904
  const [parent] = (0, import_react6.useAutoAnimate)(
1839
1905
  /* optional config */
1840
1906
  );
1841
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: parent, className: "z-[999999]", children: isVisible && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1842
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1907
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref: parent, className: "bitsnap-checkout dark", style: { zIndex: 999999 }, children: isVisible && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1908
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1843
1909
  "div",
1844
1910
  {
1845
- className: "fixed top-0 right-0 left-0 bottom-0 bg-black/30 cursor-pointer",
1911
+ className: "fixed top-0 right-0 left-0 bottom-0 bg-black/30 cursor-pointer z-10",
1846
1912
  onClick: shouldHide
1847
1913
  }
1848
1914
  ),
1849
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1915
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1850
1916
  "div",
1851
1917
  {
1852
- 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",
1918
+ 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",
1853
1919
  children: [
1854
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1920
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1855
1921
  "div",
1856
1922
  {
1857
1923
  className: "mx-3 mt-7 flex justify-between items-center",
1858
1924
  children: [
1859
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h1", { className: "text-2xl font-medium", children: "Koszyk" }),
1860
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1925
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { className: "text-2xl font-medium", children: "Koszyk" }),
1926
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1861
1927
  "button",
1862
1928
  {
1863
1929
  className: "rounded-full dark:hover:bg-neutral-700 hover:bg-neutral-400 p-2 transition",
1864
1930
  onClick: shouldHide,
1865
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1931
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1866
1932
  "svg",
1867
1933
  {
1868
1934
  xmlns: "http://www.w3.org/2000/svg",
@@ -1876,8 +1942,8 @@ function CartComponent({ isVisible, shouldHide }) {
1876
1942
  strokeLinejoin: "round",
1877
1943
  className: "lucide lucide-x",
1878
1944
  children: [
1879
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1880
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1945
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1946
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1881
1947
  ]
1882
1948
  }
1883
1949
  )
@@ -1886,7 +1952,7 @@ function CartComponent({ isVisible, shouldHide }) {
1886
1952
  ]
1887
1953
  }
1888
1954
  ),
1889
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CartComponentContent_default, { className: "grow" })
1955
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CartComponentContent_default, { className: "grow" })
1890
1956
  ]
1891
1957
  }
1892
1958
  )
@@ -1897,14 +1963,14 @@ var WrapperCartComponent = (props) => {
1897
1963
  return null;
1898
1964
  }
1899
1965
  return (0, import_react_dom.createPortal)(
1900
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CartProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CartComponent, { ...props }) }),
1966
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CartProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CartComponent, { ...props }) }),
1901
1967
  document.body
1902
1968
  );
1903
1969
  };
1904
1970
  var CartComponent_default = WrapperCartComponent;
1905
1971
 
1906
1972
  // src/components/checkout/BitsnapCart.tsx
1907
- var import_jsx_runtime9 = require("react/jsx-runtime");
1973
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1908
1974
  var cartAddToCartSchema = import_zod2.default.object({
1909
1975
  id: import_zod2.default.string(),
1910
1976
  isSubscription: import_zod2.default.boolean().default(false),
@@ -1915,9 +1981,10 @@ function BitsnapCart({
1915
1981
  projectID,
1916
1982
  children,
1917
1983
  onVisibleChange,
1918
- className
1984
+ className,
1985
+ numberOfProductsInCartOptions
1919
1986
  }) {
1920
- const { isCartVisible, showCart, hideCart } = useCheckoutStore();
1987
+ const { isCartVisible, showCart, hideCart, numberOfProductsInCart } = useCheckoutStore();
1921
1988
  function sentPostMessageToIframe(msg) {
1922
1989
  const iframes = document.querySelectorAll("iframe");
1923
1990
  iframes.forEach((iframe) => {
@@ -2031,35 +2098,61 @@ function BitsnapCart({
2031
2098
  }
2032
2099
  }
2033
2100
  }, []);
2034
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "bitsnap-checkout", children: [
2035
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2101
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
2102
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2036
2103
  "button",
2037
2104
  {
2038
2105
  onClick: () => isCartVisible ? hideCart() : showCart(),
2039
- className: className != null ? className : "relative rounded-full hover:bg-neutral-300 transition p-1",
2040
- children: children ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2041
- "svg",
2042
- {
2043
- xmlns: "http://www.w3.org/2000/svg",
2044
- width: "24",
2045
- height: "24",
2046
- viewBox: "0 0 24 24",
2047
- fill: "none",
2048
- stroke: "currentColor",
2049
- strokeWidth: "2",
2050
- strokeLinecap: "round",
2051
- strokeLinejoin: "round",
2052
- className: "lucide lucide-shopping-cart",
2053
- children: [
2054
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "8", cy: "21", r: "1" }),
2055
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "19", cy: "21", r: "1" }),
2056
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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" })
2057
- ]
2058
- }
2059
- )
2106
+ style: { position: "relative" },
2107
+ className: ["bitsnap-checkout", className != null ? className : "rounded-full hover:bg-neutral-300 transition p-1"].join(" "),
2108
+ children: [
2109
+ children ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2110
+ "svg",
2111
+ {
2112
+ xmlns: "http://www.w3.org/2000/svg",
2113
+ width: "24",
2114
+ height: "24",
2115
+ viewBox: "0 0 24 24",
2116
+ fill: "none",
2117
+ stroke: "currentColor",
2118
+ strokeWidth: "2",
2119
+ strokeLinecap: "round",
2120
+ strokeLinejoin: "round",
2121
+ className: "lucide lucide-shopping-cart",
2122
+ children: [
2123
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "8", cy: "21", r: "1" }),
2124
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "19", cy: "21", r: "1" }),
2125
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" })
2126
+ ]
2127
+ }
2128
+ ),
2129
+ (numberOfProductsInCartOptions == null ? void 0 : numberOfProductsInCartOptions.isVisible) != false && numberOfProductsInCart > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2130
+ "div",
2131
+ {
2132
+ style: {
2133
+ position: "absolute",
2134
+ bottom: -5,
2135
+ right: -5,
2136
+ background: "black",
2137
+ color: "white",
2138
+ borderRadius: "50%",
2139
+ width: "22px",
2140
+ height: "22px",
2141
+ display: "flex",
2142
+ alignItems: "center",
2143
+ justifyContent: "center",
2144
+ fontSize: "13px",
2145
+ fontWeight: 600,
2146
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.25)",
2147
+ ...numberOfProductsInCartOptions == null ? void 0 : numberOfProductsInCartOptions.style
2148
+ },
2149
+ children: numberOfProductsInCart
2150
+ }
2151
+ )
2152
+ ]
2060
2153
  }
2061
2154
  ),
2062
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2155
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2063
2156
  CartComponent_default,
2064
2157
  {
2065
2158
  isVisible: isCartVisible,