cloudcommerce 0.23.0 → 0.23.2

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  3. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  4. package/ecomplus-stores/barra-doce/functions/ssr/src/main/Home.astro +18 -10
  5. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  6. package/ecomplus-stores/barra-doce/package.json +2 -3
  7. package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
  8. package/ecomplus-stores/iluminim/functions/ssr/package.json +6 -6
  9. package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
  10. package/ecomplus-stores/iluminim/package.json +2 -3
  11. package/package.json +4 -4
  12. package/packages/api/package.json +1 -1
  13. package/packages/api/types/carts.d.ts +8 -0
  14. package/packages/api/types/orders.d.ts +8 -0
  15. package/packages/apps/affilate-program/package.json +1 -1
  16. package/packages/apps/correios/package.json +1 -1
  17. package/packages/apps/custom-payment/package.json +1 -1
  18. package/packages/apps/custom-shipping/package.json +1 -1
  19. package/packages/apps/datafrete/package.json +1 -1
  20. package/packages/apps/discounts/package.json +1 -1
  21. package/packages/apps/emails/package.json +1 -1
  22. package/packages/apps/fb-conversions/package.json +1 -1
  23. package/packages/apps/flash-courier/package.json +1 -1
  24. package/packages/apps/frenet/package.json +1 -1
  25. package/packages/apps/galaxpay/package.json +1 -1
  26. package/packages/apps/google-analytics/package.json +1 -1
  27. package/packages/apps/jadlog/package.json +1 -1
  28. package/packages/apps/loyalty-points/package.json +1 -1
  29. package/packages/apps/melhor-envio/package.json +1 -1
  30. package/packages/apps/mercadopago/package.json +1 -1
  31. package/packages/apps/pagarme/package.json +1 -1
  32. package/packages/apps/paghiper/package.json +1 -1
  33. package/packages/apps/pix/package.json +1 -1
  34. package/packages/apps/tiny-erp/package.json +1 -1
  35. package/packages/apps/webhooks/package.json +1 -1
  36. package/packages/cli/package.json +1 -1
  37. package/packages/config/package.json +1 -1
  38. package/packages/emails/package.json +1 -1
  39. package/packages/eslint/package.json +3 -3
  40. package/packages/events/package.json +1 -1
  41. package/packages/feeds/package.json +1 -1
  42. package/packages/firebase/package.json +1 -1
  43. package/packages/i18n/lib/en_us/i19minus.txt +1 -0
  44. package/packages/i18n/lib/en_us/i19plus.txt +1 -0
  45. package/packages/i18n/lib/en_us.d.ts +2 -0
  46. package/packages/i18n/lib/en_us.js +2 -0
  47. package/packages/i18n/lib/en_us.js.map +1 -1
  48. package/packages/i18n/lib/pt_br/i19minus.txt +1 -0
  49. package/packages/i18n/lib/pt_br/i19plus.txt +1 -0
  50. package/packages/i18n/lib/pt_br.d.ts +2 -0
  51. package/packages/i18n/lib/pt_br.js +2 -0
  52. package/packages/i18n/lib/pt_br.js.map +1 -1
  53. package/packages/i18n/package.json +1 -1
  54. package/packages/i18n/src/en_us.ts +2 -0
  55. package/packages/i18n/src/pt_br.ts +2 -0
  56. package/packages/modules/package.json +1 -1
  57. package/packages/passport/package.json +1 -1
  58. package/packages/ssr/cloudflare/README.md +3 -0
  59. package/packages/ssr/cloudflare/swr-worker.js +110 -0
  60. package/packages/ssr/lib/firebase/serve-storefront.js +13 -0
  61. package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
  62. package/packages/ssr/package.json +6 -4
  63. package/packages/ssr/src/cloudflare/swr-worker.ts +128 -0
  64. package/packages/ssr/src/cloudflare/tsconfig.json +9 -0
  65. package/packages/ssr/src/firebase/serve-storefront.ts +14 -0
  66. package/packages/ssr/tsconfig.json +2 -1
  67. package/packages/storefront/config/storefront.tailwind.cjs +1 -0
  68. package/packages/storefront/dist/client/_astro/Carousel.63d511ab.js +1 -0
  69. package/packages/storefront/dist/client/_astro/{HeroSlider.794b113c.js → HeroSlider.8d2ea532.js} +1 -1
  70. package/packages/storefront/dist/client/_astro/{PitchBar.a0503ba1.js → PitchBar.c2a2ad79.js} +1 -1
  71. package/packages/storefront/dist/client/_astro/Prices.8572765c.js +1 -0
  72. package/packages/storefront/dist/client/_astro/ProductShelf.4a105932.js +1 -0
  73. package/packages/storefront/dist/client/_astro/ShopHeader.2400b065.js +4 -0
  74. package/packages/storefront/dist/client/_astro/{_...slug_.caa8cb90.css → _...slug_.07c1fa58.css} +1 -1
  75. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.48e557ba.js +1 -0
  76. package/packages/storefront/dist/client/_astro/client.9dbf6b61.js +1 -0
  77. package/packages/storefront/dist/client/_astro/{img.abbe849f.js → img.7def76a1.js} +1 -1
  78. package/packages/storefront/dist/client/_astro/index.c0c35ead.js +1 -0
  79. package/packages/storefront/dist/client/sw.js +1 -1
  80. package/packages/storefront/dist/server/chunks/{_...e1758019.mjs → _...c5a36021.mjs} +3 -3
  81. package/packages/storefront/dist/server/chunks/{account@_@astro.f568e384.mjs → account@_@astro.3e90f29a.mjs} +3 -3
  82. package/packages/storefront/dist/server/chunks/{astro.b875de26.mjs → astro.6adaff02.mjs} +296 -1146
  83. package/packages/storefront/dist/server/chunks/{endpoint@_@js.32b9ab50.mjs → endpoint@_@js.b79eed3b.mjs} +3 -3
  84. package/packages/storefront/dist/server/chunks/{fallback@_@astro.4d902266.mjs → fallback@_@astro.9f73db0f.mjs} +3 -3
  85. package/packages/storefront/dist/server/chunks/{index@_@astro.a80337aa.mjs → index@_@astro.0221a7bd.mjs} +3 -3
  86. package/packages/storefront/dist/server/chunks/{index@_@astro.2072e1c3.mjs → index@_@astro.66b84ac2.mjs} +3 -3
  87. package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.7c69d6fe.mjs → _...slug_.astro.501582b9.mjs} +779 -119
  88. package/packages/storefront/dist/server/chunks/pages/{account.astro.4b8c2471.mjs → account.astro.53400a42.mjs} +1 -1
  89. package/packages/storefront/dist/server/chunks/pages/{endpoint.js.64061d33.mjs → endpoint.js.4c130895.mjs} +1 -1
  90. package/packages/storefront/dist/server/chunks/pages/{fallback.astro.f225bb85.mjs → fallback.astro.8d1c6076.mjs} +2 -2
  91. package/packages/storefront/dist/server/chunks/pages/{index.astro.a972914a.mjs → index.astro.f1104ab2.mjs} +15 -338
  92. package/packages/storefront/dist/server/entry.mjs +31 -23
  93. package/packages/storefront/dist/server/renderers.mjs +2 -2
  94. package/packages/storefront/package.json +10 -10
  95. package/packages/storefront/src/lib/components/Carousel.vue +0 -3
  96. package/packages/storefront/src/lib/components/CheckoutLink.vue +23 -0
  97. package/packages/storefront/src/lib/components/Drawer.vue +1 -1
  98. package/packages/storefront/src/lib/components/QuantitySelector.vue +107 -0
  99. package/packages/storefront/src/lib/components/QuantitySelectorControl.vue +35 -0
  100. package/packages/storefront/src/lib/composables/use-cart-item.ts +20 -14
  101. package/packages/storefront/src/lib/composables/use-sticky-header.ts +18 -2
  102. package/packages/storefront/src/lib/state/customer-session.ts +2 -2
  103. package/packages/storefront/src/lib/state/modules-info.ts +1 -1
  104. package/packages/storefront/src/lib/state/shopping-cart/parse-product.ts +23 -21
  105. package/packages/storefront/src/lib/state/shopping-cart.ts +13 -4
  106. package/packages/types/package.json +1 -1
  107. package/packages/storefront/dist/client/_astro/Carousel.6824b5e2.js +0 -1
  108. package/packages/storefront/dist/client/_astro/ProductShelf.7fca4465.js +0 -1
  109. package/packages/storefront/dist/client/_astro/ShopHeader.fe08e043.js +0 -4
  110. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.4cb7dd76.js +0 -1
  111. package/packages/storefront/dist/client/_astro/api.4984c5be.js +0 -1
  112. package/packages/storefront/dist/client/_astro/client.0fb6b44e.js +0 -1
  113. package/packages/storefront/dist/client/_astro/index.c723d38d.js +0 -1
@@ -8,14 +8,14 @@ import sizeOf from 'image-size';
8
8
  import 'magic-string';
9
9
  import mime from 'mime';
10
10
  import 'node:stream';
11
- import { c as createAstro, a as createComponent, r as renderTemplate, u as unescapeHTML, b as renderComponent, d as addAttribute, F as Fragment, m as maybeRenderHead, s as spreadAttributes, e as renderSlot, f as renderHead } from '../astro.b875de26.mjs';
11
+ import { c as createAstro, a as createComponent, r as renderTemplate, u as unescapeHTML, b as renderComponent, d as addAttribute, F as Fragment, m as maybeRenderHead, s as spreadAttributes, e as renderSlot, f as renderHead } from '../astro.6adaff02.mjs';
12
12
  import api from '@cloudcommerce/api';
13
13
  import { EventEmitter } from 'node:events';
14
14
  import fs from 'node:fs';
15
15
  import config from '@cloudcommerce/config';
16
- import { img, price, formatMoney, randomObjectId, nickname } from '@ecomplus/utils';
16
+ import { img, price, formatMoney, randomObjectId, nickname, onPromotion, name } from '@ecomplus/utils';
17
17
  /* empty css */import { reactive, computed, shallowRef, useSSRContext, defineComponent, inject, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, resolveComponent, withModifiers, Teleport, createTextVNode, toDisplayString } from 'vue';
18
- import { useScroll, useElementHover, useDebounceFn, useTimeout, promiseTimeout } from '@vueuse/core';
18
+ import { useScroll, useElementHover, useDebounceFn, useTimeout, watchDebounced, promiseTimeout } from '@vueuse/core';
19
19
  import { ssrRenderAttrs, ssrRenderSlot, ssrRenderClass, ssrRenderVNode, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrIncludeBooleanAttr, ssrRenderAttr, ssrRenderTeleport, ssrInterpolate } from 'vue/server-renderer';
20
20
  import { Popover, PopoverButton, PopoverPanel, Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue';
21
21
 
@@ -601,7 +601,7 @@ async function getImage(transform) {
601
601
  }
602
602
  let loader = (_a = globalThis.astroImage) == null ? void 0 : _a.loader;
603
603
  if (!loader) {
604
- const { default: mod } = await import('./endpoint.js.64061d33.mjs').then(n => n.s).catch(() => {
604
+ const { default: mod } = await import('./endpoint.js.4c130895.mjs').then(n => n.s).catch(() => {
605
605
  throw new Error(
606
606
  "[@astrojs/image] Builtin image loader not found. (Did you remember to add the integration to your Astro config?)"
607
607
  );
@@ -1011,6 +1011,9 @@ networkNames.forEach((network) => {
1011
1011
  }
1012
1012
  });
1013
1013
 
1014
+ let id = -1;
1015
+ const useId = () => String(++id);
1016
+
1014
1017
  const emptyInfo = {
1015
1018
  list_payments: {},
1016
1019
  calculate_shipping: {},
@@ -1131,7 +1134,7 @@ window.$storefront.data['${field}'] = ${JSON.stringify(value)};`
1131
1134
  };
1132
1135
  };
1133
1136
 
1134
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
1137
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
1135
1138
  __name: "CarouselControl",
1136
1139
  props: {
1137
1140
  isPrev: { type: Boolean, default: false }
@@ -1144,7 +1147,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
1144
1147
  return __returned__;
1145
1148
  }
1146
1149
  });
1147
- function _sfc_ssrRender$e(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1150
+ function _sfc_ssrRender$j(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1148
1151
  _push(`<button${ssrRenderAttrs(mergeProps({
1149
1152
  type: "button",
1150
1153
  "aria-label": !$props.isPrev ? "Pr\xF3ximo" : "Anterior",
@@ -1156,16 +1159,16 @@ function _sfc_ssrRender$e(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1156
1159
  }, _push, _parent);
1157
1160
  _push(`</button>`);
1158
1161
  }
1159
- const _sfc_setup$e = _sfc_main$e.setup;
1160
- _sfc_main$e.setup = (props, ctx) => {
1162
+ const _sfc_setup$j = _sfc_main$j.setup;
1163
+ _sfc_main$j.setup = (props, ctx) => {
1161
1164
  const ssrContext = useSSRContext();
1162
1165
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/CarouselControl.vue");
1163
- return _sfc_setup$e ? _sfc_setup$e(props, ctx) : void 0;
1166
+ return _sfc_setup$j ? _sfc_setup$j(props, ctx) : void 0;
1164
1167
  };
1165
- const CarouselControl = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["ssrRender", _sfc_ssrRender$e]]);
1168
+ const CarouselControl = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["ssrRender", _sfc_ssrRender$j]]);
1166
1169
 
1167
1170
  const carouselKey = Symbol("carousel");
1168
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
1171
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
1169
1172
  __name: "Carousel",
1170
1173
  props: {
1171
1174
  as: { default: "ul" },
@@ -1269,9 +1272,6 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1269
1272
  direction = direction > 0 ? pageStep : -pageStep;
1270
1273
  }
1271
1274
  }
1272
- if (!props.autoplay) {
1273
- console.log({ direction }, currentIndex.value, slidesWidth.value.length);
1274
- }
1275
1275
  const nextOffsetLeft = calcNextOffsetLeft(direction);
1276
1276
  wrapper.value?.scrollTo({ left: nextOffsetLeft, behavior: "smooth" });
1277
1277
  restartAutoplay();
@@ -1329,7 +1329,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1329
1329
  return __returned__;
1330
1330
  }
1331
1331
  });
1332
- function _sfc_ssrRender$d(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1332
+ function _sfc_ssrRender$i(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1333
1333
  _push(`<div${ssrRenderAttrs(mergeProps({
1334
1334
  ref: "carousel",
1335
1335
  class: "relative",
@@ -1386,15 +1386,15 @@ function _sfc_ssrRender$d(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1386
1386
  }, _push, _parent);
1387
1387
  _push(`</div>`);
1388
1388
  }
1389
- const _sfc_setup$d = _sfc_main$d.setup;
1390
- _sfc_main$d.setup = (props, ctx) => {
1389
+ const _sfc_setup$i = _sfc_main$i.setup;
1390
+ _sfc_main$i.setup = (props, ctx) => {
1391
1391
  const ssrContext = useSSRContext();
1392
1392
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Carousel.vue");
1393
- return _sfc_setup$d ? _sfc_setup$d(props, ctx) : void 0;
1393
+ return _sfc_setup$i ? _sfc_setup$i(props, ctx) : void 0;
1394
1394
  };
1395
- const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["ssrRender", _sfc_ssrRender$d]]);
1395
+ const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["ssrRender", _sfc_ssrRender$i]]);
1396
1396
 
1397
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
1397
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
1398
1398
  __name: "PitchBar",
1399
1399
  props: {
1400
1400
  slides: {}
@@ -1411,7 +1411,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1411
1411
  return __returned__;
1412
1412
  }
1413
1413
  });
1414
- function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1414
+ function _sfc_ssrRender$h(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1415
1415
  _push(`<div${ssrRenderAttrs(mergeProps({ class: "bg-base-100 relative z-20" }, _attrs))}><div class="container md:w-2/3 mx-auto px-3 py-1">`);
1416
1416
  _push(ssrRenderComponent($setup["Carousel"], {
1417
1417
  autoplay: $setup.countValidSlides > 1 ? 7e3 : void 0
@@ -1501,13 +1501,13 @@ function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1501
1501
  }, _parent));
1502
1502
  _push(`</div></div>`);
1503
1503
  }
1504
- const _sfc_setup$c = _sfc_main$c.setup;
1505
- _sfc_main$c.setup = (props, ctx) => {
1504
+ const _sfc_setup$h = _sfc_main$h.setup;
1505
+ _sfc_main$h.setup = (props, ctx) => {
1506
1506
  const ssrContext = useSSRContext();
1507
1507
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/PitchBar.vue");
1508
- return _sfc_setup$c ? _sfc_setup$c(props, ctx) : void 0;
1508
+ return _sfc_setup$h ? _sfc_setup$h(props, ctx) : void 0;
1509
1509
  };
1510
- const PitchBar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["ssrRender", _sfc_ssrRender$c]]);
1510
+ const PitchBar = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["ssrRender", _sfc_ssrRender$h]]);
1511
1511
 
1512
1512
  const useStorage = (key, initialValue, storage = globalThis.localStorage) => {
1513
1513
  if (!storage) {
@@ -1578,30 +1578,30 @@ const parseProduct = (product, variationId, quantity) => {
1578
1578
  if (typeof quantity !== "number" || Number.isNaN(quantity)) {
1579
1579
  quantity = product.min_quantity || 1;
1580
1580
  }
1581
- const item = { ...product };
1582
- if (variationId && product.variations) {
1583
- Object.assign(item, product.variations.find(({ _id }) => _id === variationId));
1584
- delete item.variations;
1585
- }
1586
- item.product_id = product._id;
1587
- if (variationId) {
1588
- item.variation_id = variationId;
1589
- if (item.picture_id && product.pictures) {
1590
- const pictures = product.pictures.filter((picture) => {
1591
- return picture._id === item.picture_id;
1592
- });
1593
- if (pictures.length) {
1594
- [item.picture] = pictures;
1595
- }
1596
- }
1581
+ const minQuantity = product.min_quantity || 0;
1582
+ const variation = variationId && product.variations ? product.variations.find(({ _id }) => _id === variationId) : void 0;
1583
+ const item = {
1584
+ product_id: product._id,
1585
+ variation_id: variationId,
1586
+ sku: variation?.sku || product.sku,
1587
+ name: variation?.name || product.name,
1588
+ slug: product.slug,
1589
+ production_time: variation?.production_time || product.production_time,
1590
+ currency_id: product.currency_id,
1591
+ currency_symbol: product.currency_symbol,
1592
+ base_price: variation?.base_price || product.base_price,
1593
+ max_quantity: product.quantity,
1594
+ quantity: minQuantity > 0 ? Math.max(minQuantity, quantity) : quantity,
1595
+ price: price(product)
1596
+ };
1597
+ if (variation?.picture_id && product.pictures) {
1598
+ item.picture = product.pictures.find((_picture) => {
1599
+ return _picture._id === variation.picture_id;
1600
+ });
1597
1601
  }
1598
1602
  if (!item.picture && product.pictures) {
1599
1603
  [item.picture] = product.pictures;
1600
1604
  }
1601
- item.max_quantity = item.quantity || product.quantity;
1602
- const minQuantity = item.min_quantity || product.min_quantity;
1603
- item.quantity = minQuantity > 0 ? Math.max(minQuantity, quantity) : quantity;
1604
- item.price = price(item) || price(product);
1605
1605
  return item;
1606
1606
  };
1607
1607
 
@@ -1662,6 +1662,15 @@ const addCartItem = (newItem) => {
1662
1662
  shoppingCart.value.items = cartObj.items;
1663
1663
  }
1664
1664
  };
1665
+ const removeCartItem = (itemId) => {
1666
+ for (let i = 0; i < shoppingCart.value.items.length; i++) {
1667
+ const item = shoppingCart.value.items[i];
1668
+ if (item._id === itemId) {
1669
+ shoppingCart.value.items.splice(i, 1);
1670
+ break;
1671
+ }
1672
+ }
1673
+ };
1665
1674
  const addProductToCart = (product, variationId, quantity) => addCartItem(parseProduct(product, variationId, quantity));
1666
1675
 
1667
1676
  const useStickyHeader = (props) => {
@@ -1669,7 +1678,8 @@ const useStickyHeader = (props) => {
1669
1678
  header,
1670
1679
  canSetStyles,
1671
1680
  canCreateHeightDiv,
1672
- isShownOnScrollDown
1681
+ isShownOnScrollDown,
1682
+ isShownOnMobile
1673
1683
  } = {
1674
1684
  canSetStyles: true,
1675
1685
  canCreateHeightDiv: true,
@@ -1678,12 +1688,20 @@ const useStickyHeader = (props) => {
1678
1688
  const { ready, start } = useTimeout(100, { controls: true, immediate: false });
1679
1689
  const staticHeight = ref(0);
1680
1690
  const staticY = ref(0);
1681
- const { y } = { y: ref(0) };
1691
+ const { y: _y } = { y: ref(0) };
1692
+ const y = ref(0);
1693
+ watchDebounced(_y, (nextY) => {
1694
+ y.value = nextY;
1695
+ }, {
1696
+ debounce: isMobile ? 100 : 50,
1697
+ maxWait: isMobile ? 300 : 150
1698
+ });
1682
1699
  const isSticky = computed(() => ready.value && y.value > staticY.value * 1.2);
1683
1700
  const transition = ref("none");
1684
1701
  watch(isSticky, async (_isSticky) => {
1685
1702
  if (canSetStyles && header.value) {
1686
- header.value.style.position = _isSticky ? "sticky" : "";
1703
+ header.value.style.position = _isSticky ? "fixed" : "";
1704
+ header.value.style.width = _isSticky ? "100vw" : "";
1687
1705
  }
1688
1706
  if (!_isSticky) {
1689
1707
  start();
@@ -1799,7 +1817,7 @@ const useShopHeader = (props) => {
1799
1817
  };
1800
1818
  };
1801
1819
 
1802
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
1820
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
1803
1821
  __name: "Drawer",
1804
1822
  props: {
1805
1823
  modelValue: { type: Boolean, default: false },
@@ -1866,7 +1884,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1866
1884
  return __returned__;
1867
1885
  }
1868
1886
  });
1869
- function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1887
+ function _sfc_ssrRender$g(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1870
1888
  const _component_Fade = resolveComponent("Fade");
1871
1889
  _push(ssrRenderComponent(_component_Fade, mergeProps({
1872
1890
  slide: $setup.slideTo,
@@ -1888,7 +1906,7 @@ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1888
1906
  if ($props.hasCloseButton) {
1889
1907
  _push2(`<button type="button"${ssrRenderAttr("aria-label", "Fechar")} class="${ssrRenderClass([$props.placement === "end" ? "left-2" : "right-2", "absolute top-2"])}" data-drawer-close${_scopeId}>`);
1890
1908
  ssrRenderSlot(_ctx.$slots, "close", {}, () => {
1891
- _push2(`<i class="i-close text-base-400 text-3xl"${_scopeId}></i>`);
1909
+ _push2(`<i class="i-close text-base-400 hover:text-base-600 text-3xl"${_scopeId}></i>`);
1892
1910
  }, _push2, _parent2, _scopeId);
1893
1911
  _push2(`</button>`);
1894
1912
  } else {
@@ -1950,7 +1968,7 @@ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1950
1968
  "data-drawer-close": ""
1951
1969
  }, [
1952
1970
  renderSlot$1(_ctx.$slots, "close", {}, () => [
1953
- createVNode("i", { class: "i-close text-base-400 text-3xl" })
1971
+ createVNode("i", { class: "i-close text-base-400 hover:text-base-600 text-3xl" })
1954
1972
  ])
1955
1973
  ], 10, ["onClick"])) : createCommentVNode("", true),
1956
1974
  renderSlot$1(_ctx.$slots, "default")
@@ -1974,13 +1992,13 @@ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1974
1992
  _: 3
1975
1993
  }, _parent));
1976
1994
  }
1977
- const _sfc_setup$b = _sfc_main$b.setup;
1978
- _sfc_main$b.setup = (props, ctx) => {
1995
+ const _sfc_setup$g = _sfc_main$g.setup;
1996
+ _sfc_main$g.setup = (props, ctx) => {
1979
1997
  const ssrContext = useSSRContext();
1980
1998
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Drawer.vue");
1981
- return _sfc_setup$b ? _sfc_setup$b(props, ctx) : void 0;
1999
+ return _sfc_setup$g ? _sfc_setup$g(props, ctx) : void 0;
1982
2000
  };
1983
- const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["ssrRender", _sfc_ssrRender$b]]);
2001
+ const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["ssrRender", _sfc_ssrRender$g]]);
1984
2002
 
1985
2003
  const storageKey = "ecomSession";
1986
2004
  const emptySession = {
@@ -2019,7 +2037,7 @@ const initializeFirebaseAuth = (canWaitIdle = !window.location.pathname.startsWi
2019
2037
  return;
2020
2038
  };
2021
2039
 
2022
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
2040
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2023
2041
  __name: "AccountLink",
2024
2042
  props: {
2025
2043
  to: {},
@@ -2054,20 +2072,20 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2054
2072
  return __returned__;
2055
2073
  }
2056
2074
  });
2057
- function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2075
+ function _sfc_ssrRender$f(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2058
2076
  _push(`<a${ssrRenderAttrs(mergeProps({ href: $setup.href }, _attrs))}>`);
2059
2077
  ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
2060
2078
  _push(`</a>`);
2061
2079
  }
2062
- const _sfc_setup$a = _sfc_main$a.setup;
2063
- _sfc_main$a.setup = (props, ctx) => {
2080
+ const _sfc_setup$f = _sfc_main$f.setup;
2081
+ _sfc_main$f.setup = (props, ctx) => {
2064
2082
  const ssrContext = useSSRContext();
2065
2083
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/AccountLink.vue");
2066
- return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
2084
+ return _sfc_setup$f ? _sfc_setup$f(props, ctx) : void 0;
2067
2085
  };
2068
- const AccountLink = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
2086
+ const AccountLink = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["ssrRender", _sfc_ssrRender$f]]);
2069
2087
 
2070
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2088
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2071
2089
  __name: "SocialNetworkIcon",
2072
2090
  props: {
2073
2091
  as: { default: "i" },
@@ -2101,18 +2119,18 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2101
2119
  return __returned__;
2102
2120
  }
2103
2121
  });
2104
- function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2122
+ function _sfc_ssrRender$e(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2105
2123
  ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), mergeProps({ class: $setup.iconClassName }, _attrs), null), _parent);
2106
2124
  }
2107
- const _sfc_setup$9 = _sfc_main$9.setup;
2108
- _sfc_main$9.setup = (props, ctx) => {
2125
+ const _sfc_setup$e = _sfc_main$e.setup;
2126
+ _sfc_main$e.setup = (props, ctx) => {
2109
2127
  const ssrContext = useSSRContext();
2110
2128
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkIcon.vue");
2111
- return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
2129
+ return _sfc_setup$e ? _sfc_setup$e(props, ctx) : void 0;
2112
2130
  };
2113
- const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
2131
+ const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["ssrRender", _sfc_ssrRender$e]]);
2114
2132
 
2115
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2133
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2116
2134
  __name: "SocialNetworkLink",
2117
2135
  props: {
2118
2136
  network: {},
@@ -2138,7 +2156,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2138
2156
  return __returned__;
2139
2157
  }
2140
2158
  });
2141
- function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2159
+ function _sfc_ssrRender$d(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2142
2160
  const _component_ALink = resolveComponent("ALink");
2143
2161
  _push(ssrRenderComponent(_component_ALink, mergeProps({ href: $setup.fixedHref }, _attrs), {
2144
2162
  default: withCtx((_, _push2, _parent2, _scopeId) => {
@@ -2159,15 +2177,15 @@ function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2159
2177
  _: 3
2160
2178
  }, _parent));
2161
2179
  }
2162
- const _sfc_setup$8 = _sfc_main$8.setup;
2163
- _sfc_main$8.setup = (props, ctx) => {
2180
+ const _sfc_setup$d = _sfc_main$d.setup;
2181
+ _sfc_main$d.setup = (props, ctx) => {
2164
2182
  const ssrContext = useSSRContext();
2165
2183
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkLink.vue");
2166
- return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
2184
+ return _sfc_setup$d ? _sfc_setup$d(props, ctx) : void 0;
2167
2185
  };
2168
- const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["ssrRender", _sfc_ssrRender$8]]);
2186
+ const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["ssrRender", _sfc_ssrRender$d]]);
2169
2187
 
2170
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2188
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
2171
2189
  __name: "ShopSidenavCategory",
2172
2190
  props: {
2173
2191
  categoryTree: {}
@@ -2190,7 +2208,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2190
2208
  return __returned__;
2191
2209
  }
2192
2210
  });
2193
- function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2211
+ function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2194
2212
  const _component_AImg = resolveComponent("AImg");
2195
2213
  const _component_ShopSidenavCategory = resolveComponent("ShopSidenavCategory", true);
2196
2214
  _push(`<li${ssrRenderAttrs(mergeProps({ class: "text-lg text-base-800" }, _attrs))}>`);
@@ -2228,15 +2246,15 @@ function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2228
2246
  }
2229
2247
  _push(`</li>`);
2230
2248
  }
2231
- const _sfc_setup$7 = _sfc_main$7.setup;
2232
- _sfc_main$7.setup = (props, ctx) => {
2249
+ const _sfc_setup$c = _sfc_main$c.setup;
2250
+ _sfc_main$c.setup = (props, ctx) => {
2233
2251
  const ssrContext = useSSRContext();
2234
2252
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenavCategory.vue");
2235
- return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
2253
+ return _sfc_setup$c ? _sfc_setup$c(props, ctx) : void 0;
2236
2254
  };
2237
- const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
2255
+ const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["ssrRender", _sfc_ssrRender$c]]);
2238
2256
 
2239
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2257
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2240
2258
  __name: "ShopSidenav",
2241
2259
  props: {
2242
2260
  categoryTrees: {}
@@ -2257,7 +2275,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2257
2275
  return __returned__;
2258
2276
  }
2259
2277
  });
2260
- function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2278
+ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2261
2279
  _push(`<aside${ssrRenderAttrs(mergeProps({ class: "flex flex-col h-full" }, _attrs))}><nav class="py-4 grow"><ul class="relative h-full"><!--[-->`);
2262
2280
  ssrRenderList($props.categoryTrees, (categoryTree, i) => {
2263
2281
  _push(ssrRenderComponent($setup["ShopSidenavCategory"], {
@@ -2298,13 +2316,13 @@ function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2298
2316
  });
2299
2317
  _push(`<!--]--></ul></footer></aside>`);
2300
2318
  }
2301
- const _sfc_setup$6 = _sfc_main$6.setup;
2302
- _sfc_main$6.setup = (props, ctx) => {
2319
+ const _sfc_setup$b = _sfc_main$b.setup;
2320
+ _sfc_main$b.setup = (props, ctx) => {
2303
2321
  const ssrContext = useSSRContext();
2304
2322
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenav.vue");
2305
- return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
2323
+ return _sfc_setup$b ? _sfc_setup$b(props, ctx) : void 0;
2306
2324
  };
2307
- const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
2325
+ const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["ssrRender", _sfc_ssrRender$b]]);
2308
2326
 
2309
2327
  const useShopHeaderSubmenu = (props) => {
2310
2328
  const categoryPicture = computed(() => {
@@ -2353,7 +2371,7 @@ const useShopHeaderSubmenu = (props) => {
2353
2371
  };
2354
2372
  };
2355
2373
 
2356
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2374
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2357
2375
  __name: "ShopHeaderSubmenu",
2358
2376
  props: {
2359
2377
  categoryTree: {},
@@ -2379,7 +2397,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2379
2397
  return __returned__;
2380
2398
  }
2381
2399
  });
2382
- function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2400
+ function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2383
2401
  const _component_Fade = resolveComponent("Fade");
2384
2402
  const _component_AImg = resolveComponent("AImg");
2385
2403
  _push(ssrRenderComponent($setup["Popover"], _attrs, {
@@ -2669,15 +2687,15 @@ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2669
2687
  _: 3
2670
2688
  }, _parent));
2671
2689
  }
2672
- const _sfc_setup$5 = _sfc_main$5.setup;
2673
- _sfc_main$5.setup = (props, ctx) => {
2690
+ const _sfc_setup$a = _sfc_main$a.setup;
2691
+ _sfc_main$a.setup = (props, ctx) => {
2674
2692
  const ssrContext = useSSRContext();
2675
2693
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderSubmenu.vue");
2676
- return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
2694
+ return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
2677
2695
  };
2678
- const ShopHeaderSubmenu = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
2696
+ const ShopHeaderSubmenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
2679
2697
 
2680
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2698
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2681
2699
  __name: "ShopHeaderMenu",
2682
2700
  props: {
2683
2701
  inlineMenuTrees: {}
@@ -2693,7 +2711,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2693
2711
  return __returned__;
2694
2712
  }
2695
2713
  });
2696
- function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2714
+ function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2697
2715
  _push(`<nav${ssrRenderAttrs(_attrs)}><ul class="${ssrRenderClass([$props.inlineMenuTrees.length < 7 ? "text-base" : "text-sm", "flex gap-4 xl:gap-5 text-base-700"])}"><!--[-->`);
2698
2716
  ssrRenderList($props.inlineMenuTrees, (categoryTree, i) => {
2699
2717
  _push(`<li>`);
@@ -2737,28 +2755,28 @@ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2737
2755
  });
2738
2756
  _push(`<!--]--></ul></nav>`);
2739
2757
  }
2740
- const _sfc_setup$4 = _sfc_main$4.setup;
2741
- _sfc_main$4.setup = (props, ctx) => {
2758
+ const _sfc_setup$9 = _sfc_main$9.setup;
2759
+ _sfc_main$9.setup = (props, ctx) => {
2742
2760
  const ssrContext = useSSRContext();
2743
2761
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderMenu.vue");
2744
- return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
2762
+ return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
2745
2763
  };
2746
- const ShopHeaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
2764
+ const ShopHeaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
2747
2765
 
2748
- const _sfc_main$3 = {};
2766
+ const _sfc_main$8 = {};
2749
2767
 
2750
- function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs) {
2768
+ function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs) {
2751
2769
  _push(`<div${ssrRenderAttrs(mergeProps({ class: "w-full h-40 bg-base-300" }, _attrs))}></div>`);
2752
2770
  }
2753
- const _sfc_setup$3 = _sfc_main$3.setup;
2754
- _sfc_main$3.setup = (props, ctx) => {
2771
+ const _sfc_setup$8 = _sfc_main$8.setup;
2772
+ _sfc_main$8.setup = (props, ctx) => {
2755
2773
  const ssrContext = useSSRContext()
2756
2774
  ;(ssrContext.modules || (ssrContext.modules = new Set())).add("src/components/SearchModal.vue");
2757
- return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : undefined
2775
+ return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : undefined
2758
2776
  };
2759
- const SearchModal = /*#__PURE__*/_export_sfc(_sfc_main$3, [['ssrRender',_sfc_ssrRender$3]]);
2777
+ const SearchModal = /*#__PURE__*/_export_sfc(_sfc_main$8, [['ssrRender',_sfc_ssrRender$8]]);
2760
2778
 
2761
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2779
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2762
2780
  __name: "AccountMenu",
2763
2781
  props: {
2764
2782
  serviceLinks: {}
@@ -2788,7 +2806,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2788
2806
  return __returned__;
2789
2807
  }
2790
2808
  });
2791
- function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2809
+ function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2792
2810
  const _component_Fade = resolveComponent("Fade");
2793
2811
  const _component_ALink = resolveComponent("ALink");
2794
2812
  _push(ssrRenderComponent($setup["Menu"], mergeProps({
@@ -3380,31 +3398,644 @@ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
3380
3398
  _: 3
3381
3399
  }, _parent));
3382
3400
  }
3401
+ const _sfc_setup$7 = _sfc_main$7.setup;
3402
+ _sfc_main$7.setup = (props, ctx) => {
3403
+ const ssrContext = useSSRContext();
3404
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/AccountMenu.vue");
3405
+ return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
3406
+ };
3407
+ const AccountMenu = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
3408
+
3409
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3410
+ __name: "CheckoutLink",
3411
+ props: {
3412
+ to: { default: "cart" },
3413
+ cartUrl: { default: globalThis.$storefront.settings.cart_url || "/app/#/cart" },
3414
+ checkoutUrl: { default: globalThis.$storefront.settings.checkout_url || "/app/#/checkout" }
3415
+ },
3416
+ setup(__props, { expose: __expose }) {
3417
+ __expose();
3418
+ const props = __props;
3419
+ const href = computed(() => {
3420
+ if (props.to === "cart")
3421
+ return props.cartUrl;
3422
+ return props.checkoutUrl;
3423
+ });
3424
+ const __returned__ = { props, href };
3425
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3426
+ return __returned__;
3427
+ }
3428
+ });
3429
+ function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3430
+ _push(`<a${ssrRenderAttrs(mergeProps({ href: $setup.href }, _attrs))}>`);
3431
+ ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
3432
+ _push(`</a>`);
3433
+ }
3434
+ const _sfc_setup$6 = _sfc_main$6.setup;
3435
+ _sfc_main$6.setup = (props, ctx) => {
3436
+ const ssrContext = useSSRContext();
3437
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/CheckoutLink.vue");
3438
+ return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
3439
+ };
3440
+ const CheckoutLink = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
3441
+
3442
+ const getPriceWithDiscount = (price, discount) => {
3443
+ const { type, value } = discount;
3444
+ let priceWithDiscount;
3445
+ if (value) {
3446
+ if (type === "percentage") {
3447
+ priceWithDiscount = price * ((100 - value) / 100);
3448
+ } else {
3449
+ priceWithDiscount = price - value;
3450
+ }
3451
+ return priceWithDiscount > 0 ? priceWithDiscount : 0;
3452
+ }
3453
+ return price;
3454
+ };
3455
+ const usePrices = (props) => {
3456
+ const _product = computed(() => {
3457
+ return props.product || {
3458
+ price: props.price || 0,
3459
+ base_price: props.basePrice
3460
+ };
3461
+ });
3462
+ const hasVariedPrices = computed(() => {
3463
+ const { variations } = _product.value;
3464
+ if (variations) {
3465
+ const productPrice = price(_product.value);
3466
+ for (let i = 0; i < variations.length; i++) {
3467
+ const price$1 = price({
3468
+ ..._product.value,
3469
+ ...variations[i]
3470
+ });
3471
+ if (price$1 > productPrice) {
3472
+ return true;
3473
+ }
3474
+ }
3475
+ }
3476
+ return false;
3477
+ });
3478
+ const salePrice = computed(() => {
3479
+ const price$1 = price(_product.value);
3480
+ const discount = availableExtraDiscount.value;
3481
+ if (discount && (!discount.min_amount || price$1 > discount.min_amount)) {
3482
+ return getPriceWithDiscount(price$1, discount);
3483
+ }
3484
+ return price$1;
3485
+ });
3486
+ const comparePrice = computed(() => {
3487
+ if (onPromotion(_product.value)) {
3488
+ return _product.value.base_price;
3489
+ }
3490
+ const price$1 = price(_product.value);
3491
+ if (price$1 > salePrice.value) {
3492
+ return price$1;
3493
+ }
3494
+ return 0;
3495
+ });
3496
+ const installmentsObject = computed(() => {
3497
+ return props.installmentsOption || installmentsOption.value || { max_number: 1 };
3498
+ });
3499
+ const installmentsNumber = computed(() => {
3500
+ if (installmentsObject.value.max_number <= 1) {
3501
+ return 1;
3502
+ }
3503
+ const minInstallment = installmentsObject.value.min_installment || 5;
3504
+ const maxInstallmentsNumber = Math.floor(salePrice.value / minInstallment);
3505
+ return Math.min(maxInstallmentsNumber, installmentsObject.value.max_number);
3506
+ });
3507
+ const monthlyInterest = computed(() => {
3508
+ return installmentsObject.value.monthly_interest || 0;
3509
+ });
3510
+ const installmentValue = computed(() => {
3511
+ if (installmentsNumber.value >= 2) {
3512
+ if (!monthlyInterest.value) {
3513
+ return salePrice.value / installmentsNumber.value;
3514
+ }
3515
+ const interest = monthlyInterest.value / 100;
3516
+ return salePrice.value * interest / (1 - (1 + interest) ** -installmentsNumber.value);
3517
+ }
3518
+ return 0;
3519
+ });
3520
+ const discountObject = computed(() => {
3521
+ const discount = props.discountOption || discountOption.value;
3522
+ if (discount && (!discount.min_amount || discount.min_amount <= salePrice.value) && (!props.isAmountTotal || discount.apply_at === "total")) {
3523
+ return discount;
3524
+ }
3525
+ return {};
3526
+ });
3527
+ const discountLabel = computed(() => {
3528
+ const { label } = discountObject.value;
3529
+ if (label) {
3530
+ if (label.includes(" ")) {
3531
+ return label;
3532
+ }
3533
+ return `via ${label}`;
3534
+ }
3535
+ return "";
3536
+ });
3537
+ const priceWithDiscount = computed(() => {
3538
+ return getPriceWithDiscount(salePrice.value, discountObject.value);
3539
+ });
3540
+ const pointsProgramObject = computed(() => {
3541
+ if (props.loyaltyPointsProgram) {
3542
+ return props.loyaltyPointsProgram;
3543
+ }
3544
+ const pointsPrograms = loyaltyPointsPrograms.value;
3545
+ if (pointsPrograms) {
3546
+ const programIds = Object.keys(pointsPrograms);
3547
+ for (let i = 0; i < programIds.length; i++) {
3548
+ const program = pointsPrograms[programIds[i]];
3549
+ if (program?.earn_percentage && program.earn_percentage > 0) {
3550
+ return program;
3551
+ }
3552
+ }
3553
+ }
3554
+ return { ratio: 0 };
3555
+ });
3556
+ const pointsMinPrice = computed(() => {
3557
+ return pointsProgramObject.value.min_subtotal_to_earn || 0;
3558
+ });
3559
+ const pointsProgramName = computed(() => {
3560
+ return pointsProgramObject.value.name || "";
3561
+ });
3562
+ const earnPointsPercentage = computed(() => {
3563
+ return pointsProgramObject.value.earn_percentage || 0;
3564
+ });
3565
+ const cashbackPercentage = computed(() => {
3566
+ return earnPointsPercentage.value * pointsProgramObject.value.ratio;
3567
+ });
3568
+ const cashbackValue = computed(() => {
3569
+ return cashbackPercentage.value >= 1 ? salePrice.value * (cashbackPercentage.value / 100) : 0;
3570
+ });
3571
+ return {
3572
+ hasVariedPrices,
3573
+ salePrice,
3574
+ comparePrice,
3575
+ installmentsObject,
3576
+ installmentsNumber,
3577
+ monthlyInterest,
3578
+ installmentValue,
3579
+ discountObject,
3580
+ discountLabel,
3581
+ priceWithDiscount,
3582
+ pointsProgramObject,
3583
+ pointsMinPrice,
3584
+ pointsProgramName,
3585
+ earnPointsPercentage,
3586
+ cashbackPercentage,
3587
+ cashbackValue
3588
+ };
3589
+ };
3590
+
3591
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3592
+ __name: "Prices",
3593
+ props: {
3594
+ isBig: { type: Boolean },
3595
+ isLiteral: { type: Boolean },
3596
+ hasCashback: { type: Boolean, default: true },
3597
+ hasPriceOptions: { type: Boolean, default: true },
3598
+ product: {},
3599
+ price: {},
3600
+ basePrice: {},
3601
+ isAmountTotal: { type: Boolean },
3602
+ installmentsOption: {},
3603
+ discountOption: {},
3604
+ loyaltyPointsProgram: {}
3605
+ },
3606
+ setup(__props, { expose: __expose }) {
3607
+ __expose();
3608
+ const props = __props;
3609
+ const {
3610
+ hasVariedPrices,
3611
+ salePrice,
3612
+ comparePrice,
3613
+ cashbackPercentage,
3614
+ cashbackValue,
3615
+ installmentsNumber,
3616
+ monthlyInterest,
3617
+ installmentValue,
3618
+ priceWithDiscount,
3619
+ discountLabel
3620
+ } = usePrices(props);
3621
+ const __returned__ = { props, hasVariedPrices, salePrice, comparePrice, cashbackPercentage, cashbackValue, installmentsNumber, monthlyInterest, installmentValue, priceWithDiscount, discountLabel };
3622
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3623
+ return __returned__;
3624
+ }
3625
+ });
3626
+ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3627
+ const _component_Fade = resolveComponent("Fade");
3628
+ _push(`<div${ssrRenderAttrs(mergeProps({
3629
+ class: ["text-base-600 [&>div]:[font-size:90%] [&_small]:lowercase [&_small]:[font-size:92%]", $props.isBig ? "text-lg" : null],
3630
+ "data-prices": ""
3631
+ }, _attrs))}>`);
3632
+ if ($setup.comparePrice) {
3633
+ _push(`<span class="text-base-500 mr-1 text-[87%]">`);
3634
+ if ($props.isLiteral) {
3635
+ _push(`<small>${ssrInterpolate(`${"De"} `)}</small>`);
3636
+ } else {
3637
+ _push(`<!---->`);
3638
+ }
3639
+ _push(`<s>${ssrInterpolate(_ctx.$money($setup.comparePrice))}</s>`);
3640
+ if ($props.isLiteral) {
3641
+ _push(`<small>${ssrInterpolate(` ${"Por"}`)}</small>`);
3642
+ } else {
3643
+ _push(`<!---->`);
3644
+ }
3645
+ _push(`</span>`);
3646
+ } else {
3647
+ _push(`<!---->`);
3648
+ }
3649
+ _push(`<strong class="${ssrRenderClass([$props.isBig ? "text-5xl block" : null, "inline-block text-base-800"])}">`);
3650
+ if ($setup.hasVariedPrices) {
3651
+ _push(`<small>${ssrInterpolate(`${"A partir de"} `)}</small>`);
3652
+ } else {
3653
+ _push(`<!---->`);
3654
+ }
3655
+ _push(` ${ssrInterpolate(_ctx.$money($setup.salePrice))}</strong>`);
3656
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
3657
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3658
+ if (_push2) {
3659
+ if ($setup.cashbackValue && $props.hasCashback) {
3660
+ _push2(`<div class="relative z-10"${_scopeId}><span${ssrRenderAttr("data-tooltip", "Receba $1 de volta".replace("$1", _ctx.$percentage($setup.cashbackPercentage)))}${_scopeId}><i class="i-arrow-uturn-left mr-1"${_scopeId}></i><span class="font-medium"${_scopeId}>${ssrInterpolate(_ctx.$money($setup.cashbackValue))}</span><small${_scopeId}> cashback</small></span></div>`);
3661
+ } else {
3662
+ _push2(`<!---->`);
3663
+ }
3664
+ } else {
3665
+ return [
3666
+ $setup.cashbackValue && $props.hasCashback ? (openBlock(), createBlock("div", {
3667
+ key: 0,
3668
+ class: "relative z-10"
3669
+ }, [
3670
+ createVNode("span", {
3671
+ "data-tooltip": "Receba $1 de volta".replace("$1", _ctx.$percentage($setup.cashbackPercentage))
3672
+ }, [
3673
+ createVNode("i", { class: "i-arrow-uturn-left mr-1" }),
3674
+ createVNode("span", { class: "font-medium" }, toDisplayString(_ctx.$money($setup.cashbackValue)), 1),
3675
+ createVNode("small", null, " cashback")
3676
+ ], 8, ["data-tooltip"])
3677
+ ])) : createCommentVNode("", true)
3678
+ ];
3679
+ }
3680
+ }),
3681
+ _: 1
3682
+ }, _parent));
3683
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
3684
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3685
+ if (_push2) {
3686
+ if ($setup.installmentValue && $props.hasPriceOptions) {
3687
+ _push2(`<div${_scopeId}>`);
3688
+ if ($props.isLiteral) {
3689
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"At\xE9"} `)}</small>`);
3690
+ } else {
3691
+ _push2(`<!---->`);
3692
+ }
3693
+ _push2(` ${ssrInterpolate($setup.installmentsNumber)}x `);
3694
+ if ($props.isLiteral) {
3695
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${"De"} `)}</small>`);
3696
+ } else {
3697
+ _push2(`<!---->`);
3698
+ }
3699
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money($setup.installmentValue))}</span>`);
3700
+ if (!$setup.monthlyInterest && $props.isLiteral) {
3701
+ _push2(`<small${_scopeId}>${ssrInterpolate("Sem juros")}</small>`);
3702
+ } else {
3703
+ _push2(`<!---->`);
3704
+ }
3705
+ _push2(`</div>`);
3706
+ } else {
3707
+ _push2(`<!---->`);
3708
+ }
3709
+ } else {
3710
+ return [
3711
+ $setup.installmentValue && $props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
3712
+ $props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"At\xE9"} `))) : createCommentVNode("", true),
3713
+ createTextVNode(" " + toDisplayString($setup.installmentsNumber) + "x ", 1),
3714
+ $props.isLiteral ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${"De"} `))) : createCommentVNode("", true),
3715
+ createVNode("span", null, toDisplayString(_ctx.$money($setup.installmentValue)), 1),
3716
+ !$setup.monthlyInterest && $props.isLiteral ? (openBlock(), createBlock("small", { key: 2 }, toDisplayString("Sem juros"))) : createCommentVNode("", true)
3717
+ ])) : createCommentVNode("", true)
3718
+ ];
3719
+ }
3720
+ }),
3721
+ _: 1
3722
+ }, _parent));
3723
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
3724
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3725
+ if (_push2) {
3726
+ if ($setup.priceWithDiscount < $setup.salePrice && $props.hasPriceOptions) {
3727
+ _push2(`<div${_scopeId}>`);
3728
+ if (!$setup.discountLabel) {
3729
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"A partir de"} `)}</small>`);
3730
+ } else {
3731
+ _push2(`<!---->`);
3732
+ }
3733
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money($setup.priceWithDiscount))}</span>`);
3734
+ if ($setup.discountLabel) {
3735
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${$setup.discountLabel}`)}</small>`);
3736
+ } else {
3737
+ _push2(`<!---->`);
3738
+ }
3739
+ _push2(`</div>`);
3740
+ } else {
3741
+ _push2(`<!---->`);
3742
+ }
3743
+ } else {
3744
+ return [
3745
+ $setup.priceWithDiscount < $setup.salePrice && $props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
3746
+ !$setup.discountLabel ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"A partir de"} `))) : createCommentVNode("", true),
3747
+ createVNode("span", null, toDisplayString(_ctx.$money($setup.priceWithDiscount)), 1),
3748
+ $setup.discountLabel ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${$setup.discountLabel}`), 1)) : createCommentVNode("", true)
3749
+ ])) : createCommentVNode("", true)
3750
+ ];
3751
+ }
3752
+ }),
3753
+ _: 1
3754
+ }, _parent));
3755
+ _push(`</div>`);
3756
+ }
3757
+ const _sfc_setup$5 = _sfc_main$5.setup;
3758
+ _sfc_main$5.setup = (props, ctx) => {
3759
+ const ssrContext = useSSRContext();
3760
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Prices.vue");
3761
+ return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
3762
+ };
3763
+ const Prices = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
3764
+
3765
+ const useCartItem = (props) => {
3766
+ const parsedItem = computed(() => {
3767
+ return !props.item && props.product ? parseProduct(props.product) : null;
3768
+ });
3769
+ const cartItem = computed(() => {
3770
+ return props.item || parsedItem.value;
3771
+ });
3772
+ const title = computed(() => {
3773
+ return name(cartItem.value);
3774
+ });
3775
+ const link = computed(() => {
3776
+ const { slug } = cartItem.value;
3777
+ if (typeof slug === "string") {
3778
+ return `/${slug}`;
3779
+ }
3780
+ return null;
3781
+ });
3782
+ const image = computed(() => {
3783
+ if (cartItem.value.picture) {
3784
+ return img(cartItem.value.picture, void 0, props.pictureSize || "small");
3785
+ }
3786
+ return void 0;
3787
+ });
3788
+ const finalPrice = computed(() => {
3789
+ return cartItem.value.final_price || cartItem.value.price;
3790
+ });
3791
+ return {
3792
+ cartItem,
3793
+ title,
3794
+ link,
3795
+ image,
3796
+ finalPrice
3797
+ };
3798
+ };
3799
+
3800
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3801
+ __name: "QuantitySelectorControl",
3802
+ props: {
3803
+ isMinus: { type: Boolean }
3804
+ },
3805
+ setup(__props, { expose: __expose }) {
3806
+ __expose();
3807
+ const {
3808
+ value,
3809
+ isBoundMin,
3810
+ isBoundMax
3811
+ } = inject(quantitySelectorKey);
3812
+ const __returned__ = { value, isBoundMin, isBoundMax };
3813
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3814
+ return __returned__;
3815
+ }
3816
+ });
3817
+ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3818
+ _push(`<button${ssrRenderAttrs(mergeProps({
3819
+ type: "button",
3820
+ class: "w-10 h-12 text-xl leading-12 enabled:text-primary enabled:hover:bg-primary-100/70 disabled:opacity-40",
3821
+ "data-quantity-selector-control": $props.isMinus ? "minus" : "plus",
3822
+ "aria-label": $props.isMinus ? "Menos" : "Mais",
3823
+ disabled: $props.isMinus ? $setup.isBoundMin : $setup.isBoundMax
3824
+ }, _attrs))}>`);
3825
+ ssrRenderSlot(_ctx.$slots, "default", {}, () => {
3826
+ if ($props.isMinus) {
3827
+ _push(`<!--[-->\u2212<!--]-->`);
3828
+ } else {
3829
+ _push(`<!--[-->+<!--]-->`);
3830
+ }
3831
+ }, _push, _parent);
3832
+ _push(`</button>`);
3833
+ }
3834
+ const _sfc_setup$4 = _sfc_main$4.setup;
3835
+ _sfc_main$4.setup = (props, ctx) => {
3836
+ const ssrContext = useSSRContext();
3837
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/QuantitySelectorControl.vue");
3838
+ return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
3839
+ };
3840
+ const QuantitySelectorControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
3841
+
3842
+ const quantitySelectorKey = Symbol("quantitySelector");
3843
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3844
+ __name: "QuantitySelector",
3845
+ props: {
3846
+ modelValue: { default: 1 },
3847
+ min: { default: 1 },
3848
+ max: {},
3849
+ step: {},
3850
+ disabled: { type: Boolean },
3851
+ readonly: { type: Boolean }
3852
+ },
3853
+ emits: ["update:modelValue"],
3854
+ setup(__props, { expose: __expose, emit }) {
3855
+ __expose();
3856
+ const props = __props;
3857
+ const input = ref(null);
3858
+ const inputId = `NInput${useId()}`;
3859
+ const value = computed({
3860
+ get() {
3861
+ return props.modelValue;
3862
+ },
3863
+ set(_value) {
3864
+ if (_value < props.min) {
3865
+ _value = props.min;
3866
+ input.value.value = `${_value}`;
3867
+ }
3868
+ if (props.max && _value > props.max) {
3869
+ _value = props.max;
3870
+ input.value.value = `${_value}`;
3871
+ }
3872
+ emit("update:modelValue", _value);
3873
+ }
3874
+ });
3875
+ const isBoundMin = computed(() => {
3876
+ return props.min >= value.value;
3877
+ });
3878
+ const isBoundMax = computed(() => {
3879
+ return props.max <= value.value;
3880
+ });
3881
+ provide(quantitySelectorKey, {
3882
+ value,
3883
+ isBoundMin,
3884
+ isBoundMax
3885
+ });
3886
+ const __returned__ = { quantitySelectorKey, props, emit, input, inputId, value, isBoundMin, isBoundMax, QuantitySelectorControl };
3887
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3888
+ return __returned__;
3889
+ }
3890
+ });
3891
+ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3892
+ _push(`<div${ssrRenderAttrs(mergeProps({ "data-quantity-selector": "" }, _attrs))}>`);
3893
+ ssrRenderSlot(_ctx.$slots, "label", { inputId: $setup.inputId, value: $setup.value }, () => {
3894
+ _push(`<label${ssrRenderAttr("for", $setup.inputId)} class="sr-only">${ssrInterpolate("Quantidade")}</label>`);
3895
+ }, _push, _parent);
3896
+ _push(`<div class="flex items-center"><input type="number"${ssrRenderAttr("id", $setup.inputId)}${ssrRenderAttr("value", $setup.value)}${ssrRenderAttr("min", $props.min)}${ssrRenderAttr("max", $props.max)}${ssrRenderAttr("step", $props.step)}${ssrIncludeBooleanAttr($props.disabled) ? " disabled" : ""}${ssrIncludeBooleanAttr($props.readonly) ? " readonly" : ""} class="h-12 w-14 px-2 text-lg border-transparent text-center [-moz-appearance:_textfield] [&amp;::-webkit-outer-spin-button]:m-0 [&amp;::-webkit-outer-spin-button]:appearance-none [&amp;::-webkit-inner-spin-button]:m-0 [&amp;::-webkit-inner-spin-button]:appearance-none">`);
3897
+ ssrRenderSlot(_ctx.$slots, "controls", { value: $setup.value, isBoundMin: $setup.isBoundMin, isBoundMax: $setup.isBoundMax }, () => {
3898
+ _push(ssrRenderComponent($setup["QuantitySelectorControl"], {
3899
+ "is-minus": "",
3900
+ class: "order-first"
3901
+ }, {
3902
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3903
+ if (_push2) {
3904
+ ssrRenderSlot(_ctx.$slots, "minus", {}, null, _push2, _parent2, _scopeId);
3905
+ } else {
3906
+ return [
3907
+ renderSlot$1(_ctx.$slots, "minus")
3908
+ ];
3909
+ }
3910
+ }),
3911
+ _: 3
3912
+ }, _parent));
3913
+ _push(ssrRenderComponent($setup["QuantitySelectorControl"], { class: "order-last" }, {
3914
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3915
+ if (_push2) {
3916
+ ssrRenderSlot(_ctx.$slots, "plus", {}, null, _push2, _parent2, _scopeId);
3917
+ } else {
3918
+ return [
3919
+ renderSlot$1(_ctx.$slots, "plus")
3920
+ ];
3921
+ }
3922
+ }),
3923
+ _: 3
3924
+ }, _parent));
3925
+ }, _push, _parent);
3926
+ _push(`</div></div>`);
3927
+ }
3928
+ const _sfc_setup$3 = _sfc_main$3.setup;
3929
+ _sfc_main$3.setup = (props, ctx) => {
3930
+ const ssrContext = useSSRContext();
3931
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/QuantitySelector.vue");
3932
+ return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
3933
+ };
3934
+ const QuantitySelector = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["ssrRender", _sfc_ssrRender$3]]);
3935
+
3936
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3937
+ __name: "CartItem",
3938
+ props: {
3939
+ item: {},
3940
+ product: {},
3941
+ pictureSize: {}
3942
+ },
3943
+ setup(__props, { expose: __expose }) {
3944
+ __expose();
3945
+ const props = __props;
3946
+ const {
3947
+ cartItem,
3948
+ title,
3949
+ link,
3950
+ image,
3951
+ finalPrice
3952
+ } = useCartItem(props);
3953
+ const __returned__ = { props, cartItem, title, link, image, finalPrice, get removeCartItem() {
3954
+ return removeCartItem;
3955
+ }, QuantitySelector, Prices };
3956
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3957
+ return __returned__;
3958
+ }
3959
+ });
3960
+ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3961
+ const _component_AImg = resolveComponent("AImg");
3962
+ _push(`<article${ssrRenderAttrs(mergeProps({ class: "relative bg-white shadow-sm" }, _attrs))}>`);
3963
+ ssrRenderVNode(_push, createVNode(resolveDynamicComponent($setup.link ? "ALink" : "div"), {
3964
+ href: $setup.link,
3965
+ class: "flex items-center gap-5 p-4 group"
3966
+ }, {
3967
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3968
+ if (_push2) {
3969
+ if ($setup.image) {
3970
+ _push2(ssrRenderComponent(_component_AImg, {
3971
+ picture: $setup.image,
3972
+ alt: $setup.title,
3973
+ class: "w-20 h-20 object-cover"
3974
+ }, null, _parent2, _scopeId));
3975
+ } else {
3976
+ _push2(`<!---->`);
3977
+ }
3978
+ _push2(`<p class="py-2 flex-auto text-sm text-base-700 group-hover:text-base-900 group-hover:underline"${_scopeId}>${ssrInterpolate($setup.title)}</p>`);
3979
+ } else {
3980
+ return [
3981
+ $setup.image ? (openBlock(), createBlock(_component_AImg, {
3982
+ key: 0,
3983
+ picture: $setup.image,
3984
+ alt: $setup.title,
3985
+ class: "w-20 h-20 object-cover"
3986
+ }, null, 8, ["picture", "alt"])) : createCommentVNode("", true),
3987
+ createVNode("p", { class: "py-2 flex-auto text-sm text-base-700 group-hover:text-base-900 group-hover:underline" }, toDisplayString($setup.title), 1)
3988
+ ];
3989
+ }
3990
+ }),
3991
+ _: 1
3992
+ }), _parent);
3993
+ if ($setup.cartItem._id) {
3994
+ _push(`<button class="absolute top-0 right-0 p-2 opacity-70 hover:opacity-100"${ssrRenderAttr("aria-label", "Remover")}><span class="w-5 h-5 text-sm leading-none flex flex-col justify-center rounded-full border-3 text-danger-800 border-danger-700/30"><i class="i-close my-0 mx-auto"></i></span></button>`);
3995
+ } else {
3996
+ _push(`<!---->`);
3997
+ }
3998
+ _push(`<div class="flex justify-between items-center border-t-2 border-base-100"><div class="border-r-2 border-base-100">`);
3999
+ _push(ssrRenderComponent($setup["QuantitySelector"], {
4000
+ modelValue: $setup.cartItem.quantity,
4001
+ "onUpdate:modelValue": ($event) => $setup.cartItem.quantity = $event,
4002
+ min: $setup.cartItem.min_quantity,
4003
+ max: $setup.cartItem.max_quantity
4004
+ }, null, _parent));
4005
+ _push(`</div>`);
4006
+ _push(ssrRenderComponent($setup["Prices"], {
4007
+ "base-price": $setup.cartItem.base_price,
4008
+ price: $setup.finalPrice,
4009
+ class: "px-4 py-2.5 text-[95%]"
4010
+ }, null, _parent));
4011
+ _push(`</div></article>`);
4012
+ }
3383
4013
  const _sfc_setup$2 = _sfc_main$2.setup;
3384
4014
  _sfc_main$2.setup = (props, ctx) => {
3385
4015
  const ssrContext = useSSRContext();
3386
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/AccountMenu.vue");
4016
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/CartItem.vue");
3387
4017
  return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
3388
4018
  };
3389
- const AccountMenu = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
4019
+ const CartItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
3390
4020
 
3391
4021
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3392
4022
  __name: "CartSidebar",
3393
- setup(__props, { expose: __expose }) {
4023
+ emits: ["close"],
4024
+ setup(__props, { expose: __expose, emit }) {
3394
4025
  __expose();
3395
- const __returned__ = { get freeShippingFromValue() {
4026
+ const __returned__ = { emit, get freeShippingFromValue() {
3396
4027
  return freeShippingFromValue;
3397
4028
  }, get shoppingCart() {
3398
4029
  return shoppingCart;
3399
4030
  }, get totalItems() {
3400
4031
  return totalItems;
3401
- } };
4032
+ }, CheckoutLink, Prices, CartItem };
3402
4033
  Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3403
4034
  return __returned__;
3404
4035
  }
3405
4036
  });
3406
4037
  function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3407
- _push(`<aside${ssrRenderAttrs(mergeProps({ class: "flex flex-col h-full" }, _attrs))}><header class="px-6 py-4 flex justify-end items-center gap-3"><span class="text-right text-base text-base-600 font-medium">${ssrInterpolate("Meu carrinho de compras")}</span><span class="ui-badge-pill-lg">${ssrInterpolate($setup.totalItems)}</span></header><article class="grow bg-base-50 border-t-2 border-b-2 border-base-100">`);
4038
+ _push(`<aside${ssrRenderAttrs(mergeProps({ class: "flex flex-col h-screen bg-white" }, _attrs))}><header class="px-6 py-4 flex justify-end items-center gap-3 shadow ring-1 ring-black/5 z-10"><span class="text-right text-base text-base-600 font-medium">${ssrInterpolate("Meu carrinho de compras")}</span><span class="min-w-[3rem] text-right"><span class="ui-badge-pill-lg">${ssrInterpolate($setup.totalItems)}</span></span></header><article class="grow overflow-y-auto bg-base-50">`);
3408
4039
  if ($setup.freeShippingFromValue) {
3409
4040
  _push(`<div class="text-sm text-center">`);
3410
4041
  if ($setup.freeShippingFromValue > $setup.shoppingCart.subtotal) {
@@ -3419,11 +4050,36 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
3419
4050
  } else {
3420
4051
  _push(`<!---->`);
3421
4052
  }
3422
- _push(`<ul class="p-5"><!--[-->`);
4053
+ _push(`<ul class="px-4 pt-4 pb-2"><!--[-->`);
3423
4054
  ssrRenderList($setup.shoppingCart.items, (item, i) => {
3424
- _push(`<li></li>`);
4055
+ _push(`<li>`);
4056
+ _push(ssrRenderComponent($setup["CartItem"], {
4057
+ item,
4058
+ class: "mb-3"
4059
+ }, null, _parent));
4060
+ _push(`</li>`);
3425
4061
  });
3426
- _push(`<!--]--></ul></article><footer class="p-5 shadow"></footer></aside>`);
4062
+ _push(`<!--]--></ul></article><footer class="px-5 pt-4 pb-3 ring-2 ring-black/5 z-10"><div class="grid grid-cols-2 gap-3 items-center text-right"><div>${ssrInterpolate("Subtotal")}</div>`);
4063
+ _push(ssrRenderComponent($setup["Prices"], {
4064
+ price: $setup.shoppingCart.subtotal,
4065
+ "is-literal": true,
4066
+ class: "text-lg"
4067
+ }, null, _parent));
4068
+ _push(`</div>`);
4069
+ _push(ssrRenderComponent($setup["CheckoutLink"], { class: "ui-btn-lg ui-btn-primary w-full text-right my-2.5" }, {
4070
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
4071
+ if (_push2) {
4072
+ _push2(`<i class="i-check mr-2"${_scopeId}></i> ${ssrInterpolate("Finalizar compra")}`);
4073
+ } else {
4074
+ return [
4075
+ createVNode("i", { class: "i-check mr-2" }),
4076
+ createTextVNode(" " + toDisplayString("Finalizar compra"))
4077
+ ];
4078
+ }
4079
+ }),
4080
+ _: 1
4081
+ }, _parent));
4082
+ _push(`<a href="#" class="ui-link text-base-500 hover:text-base-700 text-sm"><i class="i-arrow-left mr-1"></i> ${ssrInterpolate("Continuar comprando")}</a></footer></aside>`);
3427
4083
  }
3428
4084
  const _sfc_setup$1 = _sfc_main$1.setup;
3429
4085
  _sfc_main$1.setup = (props, ctx) => {
@@ -3460,7 +4116,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3460
4116
  onMounted(() => {
3461
4117
  isMounted.value = true;
3462
4118
  watch(totalItems, (newTotalItems, prevTotalItems) => {
3463
- if (prevTotalItems && prevTotalItems < newTotalItems) {
4119
+ if (typeof prevTotalItems === "number" && prevTotalItems < newTotalItems) {
3464
4120
  isCartOpen.value = true;
3465
4121
  }
3466
4122
  delayedTotalItems.value = newTotalItems;
@@ -3552,10 +4208,14 @@ function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $op
3552
4208
  }, {
3553
4209
  default: withCtx((_, _push3, _parent2, _scopeId) => {
3554
4210
  if (_push3) {
3555
- _push3(ssrRenderComponent($setup["CartSidebar"], null, null, _parent2, _scopeId));
4211
+ _push3(ssrRenderComponent($setup["CartSidebar"], {
4212
+ onClose: ($event) => $setup.isCartOpen = false
4213
+ }, null, _parent2, _scopeId));
3556
4214
  } else {
3557
4215
  return [
3558
- createVNode($setup["CartSidebar"])
4216
+ createVNode($setup["CartSidebar"], {
4217
+ onClose: ($event) => $setup.isCartOpen = false
4218
+ }, null, 8, ["onClose"])
3559
4219
  ];
3560
4220
  }
3561
4221
  }),
@@ -3658,4 +4318,4 @@ const ____slug_ = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty(
3658
4318
  url: $$url
3659
4319
  }, Symbol.toStringTag, { value: 'Module' }));
3660
4320
 
3661
- export { $$BaseHead as $, BaseSSRService as B, Carousel as C, _export_sfc as _, $$PageHeader as a, $$Base as b, $$Picture as c, CarouselControl as d, availableExtraDiscount as e, installmentsOption as f, discountOption as g, loyaltyPointsPrograms as h, isOutputFormatSupportsAlpha as i, addProductToCart as j, ____slug_ as k, loadRouteContext as l, parseShippingPhrase as p };
4321
+ export { $$BaseHead as $, BaseSSRService as B, Carousel as C, Prices as P, _export_sfc as _, $$PageHeader as a, $$Base as b, $$Picture as c, CarouselControl as d, addProductToCart as e, ____slug_ as f, isOutputFormatSupportsAlpha as i, loadRouteContext as l, parseShippingPhrase as p };