cloudcommerce 0.22.4 → 0.23.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.
Files changed (136) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/ecomplus-stores/barra-doce/.eslintrc.cjs +1 -1
  3. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  4. package/ecomplus-stores/barra-doce/functions/ssr/.eslintrc.cjs +1 -1
  5. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  6. package/ecomplus-stores/barra-doce/functions/ssr/src/components/AccountMenu.vue +1 -1
  7. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ProductCard.vue +1 -4
  8. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopSidenav.vue +1 -1
  9. package/ecomplus-stores/barra-doce/functions/ssr/src/main/Home.astro +18 -10
  10. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  11. package/ecomplus-stores/barra-doce/package.json +4 -1
  12. package/ecomplus-stores/iluminim/.ecomplus.cd.json +3 -3
  13. package/ecomplus-stores/iluminim/.eslintrc.cjs +1 -1
  14. package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
  15. package/ecomplus-stores/iluminim/functions/ssr/.eslintrc.cjs +1 -1
  16. package/ecomplus-stores/iluminim/functions/ssr/package.json +6 -6
  17. package/ecomplus-stores/iluminim/functions/ssr/src/components/AccountMenu.vue +1 -1
  18. package/ecomplus-stores/iluminim/functions/ssr/src/components/ProductCard.vue +5 -5
  19. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopSidenav.vue +1 -1
  20. package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
  21. package/ecomplus-stores/iluminim/package.json +4 -1
  22. package/package.json +4 -4
  23. package/packages/api/package.json +1 -1
  24. package/packages/api/types/carts.d.ts +8 -0
  25. package/packages/api/types/orders.d.ts +8 -0
  26. package/packages/apps/affilate-program/package.json +1 -1
  27. package/packages/apps/correios/package.json +1 -1
  28. package/packages/apps/custom-payment/package.json +1 -1
  29. package/packages/apps/custom-shipping/package.json +1 -1
  30. package/packages/apps/datafrete/package.json +1 -1
  31. package/packages/apps/discounts/package.json +1 -1
  32. package/packages/apps/emails/package.json +1 -1
  33. package/packages/apps/fb-conversions/package.json +1 -1
  34. package/packages/apps/flash-courier/package.json +1 -1
  35. package/packages/apps/frenet/package.json +1 -1
  36. package/packages/apps/galaxpay/package.json +1 -1
  37. package/packages/apps/google-analytics/package.json +1 -1
  38. package/packages/apps/jadlog/package.json +1 -1
  39. package/packages/apps/loyalty-points/package.json +1 -1
  40. package/packages/apps/melhor-envio/package.json +1 -1
  41. package/packages/apps/mercadopago/package.json +1 -1
  42. package/packages/apps/pagarme/package.json +1 -1
  43. package/packages/apps/paghiper/package.json +1 -1
  44. package/packages/apps/pix/package.json +1 -1
  45. package/packages/apps/tiny-erp/package.json +1 -1
  46. package/packages/apps/webhooks/package.json +1 -1
  47. package/packages/cli/lib/build.js +1 -1
  48. package/packages/cli/package.json +1 -1
  49. package/packages/cli/src/build.ts +1 -1
  50. package/packages/config/package.json +1 -1
  51. package/packages/emails/package.json +1 -1
  52. package/packages/eslint/package.json +3 -3
  53. package/packages/events/package.json +1 -1
  54. package/packages/feeds/package.json +1 -1
  55. package/packages/firebase/package.json +1 -1
  56. package/packages/i18n/lib/en_us/i19minus.txt +1 -0
  57. package/packages/i18n/lib/en_us/i19plus.txt +1 -0
  58. package/packages/i18n/lib/en_us.d.ts +2 -0
  59. package/packages/i18n/lib/en_us.js +2 -0
  60. package/packages/i18n/lib/en_us.js.map +1 -1
  61. package/packages/i18n/lib/pt_br/i19minus.txt +1 -0
  62. package/packages/i18n/lib/pt_br/i19plus.txt +1 -0
  63. package/packages/i18n/lib/pt_br.d.ts +2 -0
  64. package/packages/i18n/lib/pt_br.js +2 -0
  65. package/packages/i18n/lib/pt_br.js.map +1 -1
  66. package/packages/i18n/package.json +1 -1
  67. package/packages/i18n/src/en_us.ts +2 -0
  68. package/packages/i18n/src/pt_br.ts +2 -0
  69. package/packages/modules/package.json +1 -1
  70. package/packages/passport/package.json +1 -1
  71. package/packages/ssr/cloudflare/README.md +3 -0
  72. package/packages/ssr/cloudflare/swr-worker.js +102 -0
  73. package/packages/ssr/lib/firebase/serve-storefront.js +0 -1
  74. package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
  75. package/packages/ssr/package.json +6 -4
  76. package/packages/ssr/src/cloudflare/swr-worker.ts +120 -0
  77. package/packages/ssr/src/cloudflare/tsconfig.json +8 -0
  78. package/packages/ssr/src/firebase/serve-storefront.ts +0 -1
  79. package/packages/ssr/tsconfig.json +2 -1
  80. package/packages/storefront/config/storefront.cms.js +1 -1
  81. package/packages/storefront/config/storefront.tailwind.cjs +1 -0
  82. package/packages/storefront/dist/client/_astro/Carousel.63d511ab.js +1 -0
  83. package/packages/storefront/dist/client/_astro/{HeroSlider.8a040a33.js → HeroSlider.8d2ea532.js} +1 -1
  84. package/packages/storefront/dist/client/_astro/{PitchBar.ab0c501e.js → PitchBar.c2a2ad79.js} +1 -1
  85. package/packages/storefront/dist/client/_astro/Prices.8572765c.js +1 -0
  86. package/packages/storefront/dist/client/_astro/ProductShelf.4a105932.js +1 -0
  87. package/packages/storefront/dist/client/_astro/ShopHeader.7ecb7597.js +4 -0
  88. package/packages/storefront/dist/client/_astro/{_...slug_.c13e0486.css → _...slug_.07c1fa58.css} +1 -1
  89. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.48e557ba.js +1 -0
  90. package/packages/storefront/dist/client/_astro/client.9dbf6b61.js +1 -0
  91. package/packages/storefront/dist/client/_astro/{img.abbe849f.js → img.7def76a1.js} +1 -1
  92. package/packages/storefront/dist/client/_astro/index.c0c35ead.js +1 -0
  93. package/packages/storefront/dist/client/sw.js +1 -1
  94. package/packages/storefront/dist/server/chunks/{_...1b951f6c.mjs → _...d3f15170.mjs} +3 -3
  95. package/packages/storefront/dist/server/chunks/{account@_@astro.f6aec583.mjs → account@_@astro.38a725e7.mjs} +3 -3
  96. package/packages/storefront/dist/server/chunks/{astro.b875de26.mjs → astro.6adaff02.mjs} +296 -1146
  97. package/packages/storefront/dist/server/chunks/{endpoint@_@js.5834ad4e.mjs → endpoint@_@js.a92a4584.mjs} +3 -3
  98. package/packages/storefront/dist/server/chunks/{fallback@_@astro.069ddb54.mjs → fallback@_@astro.4e98328e.mjs} +3 -3
  99. package/packages/storefront/dist/server/chunks/{index@_@astro.37e61ebe.mjs → index@_@astro.2dda826c.mjs} +3 -3
  100. package/packages/storefront/dist/server/chunks/{index@_@astro.485287a1.mjs → index@_@astro.db07fb09.mjs} +3 -3
  101. package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.95bf4c3b.mjs → _...slug_.astro.88866aae.mjs} +812 -150
  102. package/packages/storefront/dist/server/chunks/pages/{account.astro.4b8c2471.mjs → account.astro.53400a42.mjs} +1 -1
  103. package/packages/storefront/dist/server/chunks/pages/{endpoint.js.bd1232b7.mjs → endpoint.js.a11da4ad.mjs} +1 -1
  104. package/packages/storefront/dist/server/chunks/pages/{fallback.astro.b52164bc.mjs → fallback.astro.c1fd06ab.mjs} +2 -2
  105. package/packages/storefront/dist/server/chunks/pages/{index.astro.98167846.mjs → index.astro.c45cc893.mjs} +18 -344
  106. package/packages/storefront/dist/server/entry.mjs +31 -23
  107. package/packages/storefront/dist/server/renderers.mjs +2 -2
  108. package/packages/storefront/package.json +10 -10
  109. package/packages/storefront/src/helpers/sf-utils.ts +12 -0
  110. package/packages/storefront/src/lib/components/Carousel.vue +17 -8
  111. package/packages/storefront/src/lib/components/CarouselControl.vue +1 -1
  112. package/packages/storefront/src/lib/components/CheckoutLink.vue +23 -0
  113. package/packages/storefront/src/lib/components/Drawer.vue +1 -1
  114. package/packages/storefront/src/lib/components/QuantitySelector.vue +107 -0
  115. package/packages/storefront/src/lib/components/QuantitySelectorControl.vue +35 -0
  116. package/packages/storefront/src/lib/components/SocialNetworkIcon.vue +1 -1
  117. package/packages/storefront/src/lib/components/SocialNetworkLink.vue +1 -3
  118. package/packages/storefront/src/lib/composables/use-cart-item.ts +52 -0
  119. package/packages/storefront/src/lib/composables/use-sticky-header.ts +14 -2
  120. package/packages/storefront/src/lib/sf-lib.ts +7 -0
  121. package/packages/storefront/src/lib/state/customer-session.ts +2 -2
  122. package/packages/storefront/src/lib/state/modules-info.ts +1 -1
  123. package/packages/storefront/src/lib/state/shopping-cart/parse-product.ts +23 -21
  124. package/packages/storefront/src/lib/state/shopping-cart.ts +13 -4
  125. package/packages/types/package.json +1 -1
  126. package/packages/storefront/dist/client/_astro/Carousel.8af656b5.js +0 -1
  127. package/packages/storefront/dist/client/_astro/ProductShelf.6351b57b.js +0 -1
  128. package/packages/storefront/dist/client/_astro/ShopHeader.cfab20c7.js +0 -4
  129. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.4cb7dd76.js +0 -1
  130. package/packages/storefront/dist/client/_astro/api.4984c5be.js +0 -1
  131. package/packages/storefront/dist/client/_astro/client.0fb6b44e.js +0 -1
  132. package/packages/storefront/dist/client/_astro/index.7eac5494.js +0 -1
  133. package/packages/storefront/src/helpers/idle-callback.ts +0 -9
  134. package/packages/storefront/src/lib/components/_injection-keys.ts +0 -11
  135. /package/packages/storefront/src/{lib → helpers}/browser-env.ts +0 -0
  136. /package/packages/storefront/src/{lib → helpers}/server-data.ts +0 -0
@@ -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
 
@@ -186,7 +186,7 @@ global.__storefrontCMS = (fs, resolvePath) => {
186
186
 
187
187
  let settings;
188
188
  try {
189
- settings = getContent('settings');
189
+ settings = getContent('settings') || {};
190
190
  } catch (e) {
191
191
  settings = {};
192
192
  }
@@ -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.bd1232b7.mjs').then(n => n.s).catch(() => {
604
+ const { default: mod } = await import('./endpoint.js.a11da4ad.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
  );
@@ -983,6 +983,37 @@ const loadingGlobalInfoPreset = new Promise((resolve) => {
983
983
  }
984
984
  });
985
985
 
986
+ let userAgent;
987
+ {
988
+ userAgent = "";
989
+ }
990
+ userAgent.includes("Safari") && !userAgent.includes("Chrome");
991
+ const isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream;
992
+ const isMobile = isIOS || /Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
993
+
994
+ const {
995
+ settings,
996
+ apiContext
997
+ } = globalThis.$storefront;
998
+ const networkNames = [
999
+ "whatsapp",
1000
+ "instagram",
1001
+ "facebook",
1002
+ "twitter",
1003
+ "youtube",
1004
+ "tiktok",
1005
+ "pinterest"
1006
+ ];
1007
+ const socialNetworks = {};
1008
+ networkNames.forEach((network) => {
1009
+ if (settings[network]) {
1010
+ socialNetworks[network] = settings[network];
1011
+ }
1012
+ });
1013
+
1014
+ let id = -1;
1015
+ const useId = () => String(++id);
1016
+
986
1017
  const emptyInfo = {
987
1018
  list_payments: {},
988
1019
  calculate_shipping: {},
@@ -1103,9 +1134,7 @@ window.$storefront.data['${field}'] = ${JSON.stringify(value)};`
1103
1134
  };
1104
1135
  };
1105
1136
 
1106
- const carouselKey = Symbol("carousel");
1107
-
1108
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
1137
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
1109
1138
  __name: "CarouselControl",
1110
1139
  props: {
1111
1140
  isPrev: { type: Boolean, default: false }
@@ -1118,7 +1147,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
1118
1147
  return __returned__;
1119
1148
  }
1120
1149
  });
1121
- 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) {
1122
1151
  _push(`<button${ssrRenderAttrs(mergeProps({
1123
1152
  type: "button",
1124
1153
  "aria-label": !$props.isPrev ? "Pr\xF3ximo" : "Anterior",
@@ -1130,15 +1159,16 @@ function _sfc_ssrRender$e(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1130
1159
  }, _push, _parent);
1131
1160
  _push(`</button>`);
1132
1161
  }
1133
- const _sfc_setup$e = _sfc_main$e.setup;
1134
- _sfc_main$e.setup = (props, ctx) => {
1162
+ const _sfc_setup$j = _sfc_main$j.setup;
1163
+ _sfc_main$j.setup = (props, ctx) => {
1135
1164
  const ssrContext = useSSRContext();
1136
1165
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/CarouselControl.vue");
1137
- return _sfc_setup$e ? _sfc_setup$e(props, ctx) : void 0;
1166
+ return _sfc_setup$j ? _sfc_setup$j(props, ctx) : void 0;
1138
1167
  };
1139
- 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]]);
1140
1169
 
1141
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
1170
+ const carouselKey = Symbol("carousel");
1171
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
1142
1172
  __name: "Carousel",
1143
1173
  props: {
1144
1174
  as: { default: "ul" },
@@ -1151,10 +1181,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1151
1181
  setup(__props, { expose: __expose, emit }) {
1152
1182
  __expose();
1153
1183
  const props = __props;
1154
- const currentIndex = ref(props.modelValue - 1);
1184
+ const currentIndex = ref(0);
1155
1185
  watch(toRef(props, "modelValue"), (modelValue) => {
1156
1186
  currentIndex.value = modelValue - 1;
1157
- });
1187
+ }, { immediate: true });
1158
1188
  watch(currentIndex, (current, previous) => {
1159
1189
  if (current !== previous) {
1160
1190
  emit("update:modelValue", current + 1);
@@ -1242,9 +1272,6 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1242
1272
  direction = direction > 0 ? pageStep : -pageStep;
1243
1273
  }
1244
1274
  }
1245
- if (!props.autoplay) {
1246
- console.log({ direction }, currentIndex.value, slidesWidth.value.length);
1247
- }
1248
1275
  const nextOffsetLeft = calcNextOffsetLeft(direction);
1249
1276
  wrapper.value?.scrollTo({ left: nextOffsetLeft, behavior: "smooth" });
1250
1277
  restartAutoplay();
@@ -1293,7 +1320,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1293
1320
  isBoundLeft,
1294
1321
  isBoundRight
1295
1322
  });
1296
- const __returned__ = { props, emit, currentIndex, wrapper, currentPos, isScrolling, arrivedState, isBoundLeft, isBoundRight, slidesWidth, wrapperScrollWidth, wrapperVisibleWidth, indexCount, calcWrapperWidth, calcSlidesWidth, calcNextOffsetLeft, calcCurrentIndex, calcIndexCount, get autoplayTimer() {
1323
+ const __returned__ = { carouselKey, props, emit, currentIndex, wrapper, currentPos, isScrolling, arrivedState, isBoundLeft, isBoundRight, slidesWidth, wrapperScrollWidth, wrapperVisibleWidth, indexCount, calcWrapperWidth, calcSlidesWidth, calcNextOffsetLeft, calcCurrentIndex, calcIndexCount, get autoplayTimer() {
1297
1324
  return autoplayTimer;
1298
1325
  }, set autoplayTimer(v) {
1299
1326
  autoplayTimer = v;
@@ -1302,7 +1329,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1302
1329
  return __returned__;
1303
1330
  }
1304
1331
  });
1305
- 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) {
1306
1333
  _push(`<div${ssrRenderAttrs(mergeProps({
1307
1334
  ref: "carousel",
1308
1335
  class: "relative",
@@ -1359,15 +1386,15 @@ function _sfc_ssrRender$d(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1359
1386
  }, _push, _parent);
1360
1387
  _push(`</div>`);
1361
1388
  }
1362
- const _sfc_setup$d = _sfc_main$d.setup;
1363
- _sfc_main$d.setup = (props, ctx) => {
1389
+ const _sfc_setup$i = _sfc_main$i.setup;
1390
+ _sfc_main$i.setup = (props, ctx) => {
1364
1391
  const ssrContext = useSSRContext();
1365
1392
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Carousel.vue");
1366
- return _sfc_setup$d ? _sfc_setup$d(props, ctx) : void 0;
1393
+ return _sfc_setup$i ? _sfc_setup$i(props, ctx) : void 0;
1367
1394
  };
1368
- 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]]);
1369
1396
 
1370
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
1397
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
1371
1398
  __name: "PitchBar",
1372
1399
  props: {
1373
1400
  slides: {}
@@ -1384,7 +1411,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1384
1411
  return __returned__;
1385
1412
  }
1386
1413
  });
1387
- 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) {
1388
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">`);
1389
1416
  _push(ssrRenderComponent($setup["Carousel"], {
1390
1417
  autoplay: $setup.countValidSlides > 1 ? 7e3 : void 0
@@ -1474,13 +1501,13 @@ function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1474
1501
  }, _parent));
1475
1502
  _push(`</div></div>`);
1476
1503
  }
1477
- const _sfc_setup$c = _sfc_main$c.setup;
1478
- _sfc_main$c.setup = (props, ctx) => {
1504
+ const _sfc_setup$h = _sfc_main$h.setup;
1505
+ _sfc_main$h.setup = (props, ctx) => {
1479
1506
  const ssrContext = useSSRContext();
1480
1507
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/PitchBar.vue");
1481
- return _sfc_setup$c ? _sfc_setup$c(props, ctx) : void 0;
1508
+ return _sfc_setup$h ? _sfc_setup$h(props, ctx) : void 0;
1482
1509
  };
1483
- 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]]);
1484
1511
 
1485
1512
  const useStorage = (key, initialValue, storage = globalThis.localStorage) => {
1486
1513
  if (!storage) {
@@ -1551,30 +1578,30 @@ const parseProduct = (product, variationId, quantity) => {
1551
1578
  if (typeof quantity !== "number" || Number.isNaN(quantity)) {
1552
1579
  quantity = product.min_quantity || 1;
1553
1580
  }
1554
- const item = { ...product };
1555
- if (variationId && product.variations) {
1556
- Object.assign(item, product.variations.find(({ _id }) => _id === variationId));
1557
- delete item.variations;
1558
- }
1559
- item.product_id = product._id;
1560
- if (variationId) {
1561
- item.variation_id = variationId;
1562
- if (item.picture_id && product.pictures) {
1563
- const pictures = product.pictures.filter((picture) => {
1564
- return picture._id === item.picture_id;
1565
- });
1566
- if (pictures.length) {
1567
- [item.picture] = pictures;
1568
- }
1569
- }
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
+ });
1570
1601
  }
1571
1602
  if (!item.picture && product.pictures) {
1572
1603
  [item.picture] = product.pictures;
1573
1604
  }
1574
- item.max_quantity = item.quantity || product.quantity;
1575
- const minQuantity = item.min_quantity || product.min_quantity;
1576
- item.quantity = minQuantity > 0 ? Math.max(minQuantity, quantity) : quantity;
1577
- item.price = price(item) || price(product);
1578
1605
  return item;
1579
1606
  };
1580
1607
 
@@ -1635,6 +1662,15 @@ const addCartItem = (newItem) => {
1635
1662
  shoppingCart.value.items = cartObj.items;
1636
1663
  }
1637
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
+ };
1638
1674
  const addProductToCart = (product, variationId, quantity) => addCartItem(parseProduct(product, variationId, quantity));
1639
1675
 
1640
1676
  const useStickyHeader = (props) => {
@@ -1651,12 +1687,20 @@ const useStickyHeader = (props) => {
1651
1687
  const { ready, start } = useTimeout(100, { controls: true, immediate: false });
1652
1688
  const staticHeight = ref(0);
1653
1689
  const staticY = ref(0);
1654
- const { y } = { y: ref(0) };
1690
+ const { y: _y } = { y: ref(0) };
1691
+ const y = ref(0);
1692
+ watchDebounced(_y, (nextY) => {
1693
+ y.value = nextY;
1694
+ }, {
1695
+ debounce: isMobile ? 150 : 50,
1696
+ maxWait: 600
1697
+ });
1655
1698
  const isSticky = computed(() => ready.value && y.value > staticY.value * 1.2);
1656
1699
  const transition = ref("none");
1657
1700
  watch(isSticky, async (_isSticky) => {
1658
1701
  if (canSetStyles && header.value) {
1659
- header.value.style.position = _isSticky ? "sticky" : "";
1702
+ header.value.style.position = _isSticky ? "fixed" : "";
1703
+ header.value.style.width = _isSticky ? "100vw" : "";
1660
1704
  }
1661
1705
  if (!_isSticky) {
1662
1706
  start();
@@ -1772,7 +1816,7 @@ const useShopHeader = (props) => {
1772
1816
  };
1773
1817
  };
1774
1818
 
1775
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
1819
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
1776
1820
  __name: "Drawer",
1777
1821
  props: {
1778
1822
  modelValue: { type: Boolean, default: false },
@@ -1839,7 +1883,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1839
1883
  return __returned__;
1840
1884
  }
1841
1885
  });
1842
- function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1886
+ function _sfc_ssrRender$g(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1843
1887
  const _component_Fade = resolveComponent("Fade");
1844
1888
  _push(ssrRenderComponent(_component_Fade, mergeProps({
1845
1889
  slide: $setup.slideTo,
@@ -1861,7 +1905,7 @@ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1861
1905
  if ($props.hasCloseButton) {
1862
1906
  _push2(`<button type="button"${ssrRenderAttr("aria-label", "Fechar")} class="${ssrRenderClass([$props.placement === "end" ? "left-2" : "right-2", "absolute top-2"])}" data-drawer-close${_scopeId}>`);
1863
1907
  ssrRenderSlot(_ctx.$slots, "close", {}, () => {
1864
- _push2(`<i class="i-close text-base-400 text-3xl"${_scopeId}></i>`);
1908
+ _push2(`<i class="i-close text-base-400 hover:text-base-600 text-3xl"${_scopeId}></i>`);
1865
1909
  }, _push2, _parent2, _scopeId);
1866
1910
  _push2(`</button>`);
1867
1911
  } else {
@@ -1923,7 +1967,7 @@ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1923
1967
  "data-drawer-close": ""
1924
1968
  }, [
1925
1969
  renderSlot$1(_ctx.$slots, "close", {}, () => [
1926
- createVNode("i", { class: "i-close text-base-400 text-3xl" })
1970
+ createVNode("i", { class: "i-close text-base-400 hover:text-base-600 text-3xl" })
1927
1971
  ])
1928
1972
  ], 10, ["onClick"])) : createCommentVNode("", true),
1929
1973
  renderSlot$1(_ctx.$slots, "default")
@@ -1947,13 +1991,13 @@ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
1947
1991
  _: 3
1948
1992
  }, _parent));
1949
1993
  }
1950
- const _sfc_setup$b = _sfc_main$b.setup;
1951
- _sfc_main$b.setup = (props, ctx) => {
1994
+ const _sfc_setup$g = _sfc_main$g.setup;
1995
+ _sfc_main$g.setup = (props, ctx) => {
1952
1996
  const ssrContext = useSSRContext();
1953
1997
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Drawer.vue");
1954
- return _sfc_setup$b ? _sfc_setup$b(props, ctx) : void 0;
1998
+ return _sfc_setup$g ? _sfc_setup$g(props, ctx) : void 0;
1955
1999
  };
1956
- const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["ssrRender", _sfc_ssrRender$b]]);
2000
+ const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["ssrRender", _sfc_ssrRender$g]]);
1957
2001
 
1958
2002
  const storageKey = "ecomSession";
1959
2003
  const emptySession = {
@@ -1992,27 +2036,7 @@ const initializeFirebaseAuth = (canWaitIdle = !window.location.pathname.startsWi
1992
2036
  return;
1993
2037
  };
1994
2038
 
1995
- const {
1996
- settings,
1997
- apiContext
1998
- } = globalThis.$storefront;
1999
- const networkNames = [
2000
- "whatsapp",
2001
- "instagram",
2002
- "facebook",
2003
- "twitter",
2004
- "youtube",
2005
- "tiktok",
2006
- "pinterest"
2007
- ];
2008
- const socialNetworks = {};
2009
- networkNames.forEach((network) => {
2010
- if (settings[network]) {
2011
- socialNetworks[network] = settings[network];
2012
- }
2013
- });
2014
-
2015
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
2039
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2016
2040
  __name: "AccountLink",
2017
2041
  props: {
2018
2042
  to: {},
@@ -2047,28 +2071,20 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2047
2071
  return __returned__;
2048
2072
  }
2049
2073
  });
2050
- function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2074
+ function _sfc_ssrRender$f(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2051
2075
  _push(`<a${ssrRenderAttrs(mergeProps({ href: $setup.href }, _attrs))}>`);
2052
2076
  ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
2053
2077
  _push(`</a>`);
2054
2078
  }
2055
- const _sfc_setup$a = _sfc_main$a.setup;
2056
- _sfc_main$a.setup = (props, ctx) => {
2079
+ const _sfc_setup$f = _sfc_main$f.setup;
2080
+ _sfc_main$f.setup = (props, ctx) => {
2057
2081
  const ssrContext = useSSRContext();
2058
2082
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/AccountLink.vue");
2059
- return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
2083
+ return _sfc_setup$f ? _sfc_setup$f(props, ctx) : void 0;
2060
2084
  };
2061
- const AccountLink = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
2085
+ const AccountLink = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["ssrRender", _sfc_ssrRender$f]]);
2062
2086
 
2063
- let userAgent;
2064
- {
2065
- userAgent = "";
2066
- }
2067
- userAgent.includes("Safari") && !userAgent.includes("Chrome");
2068
- const isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream;
2069
- const isMobile = isIOS || /Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
2070
-
2071
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2087
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2072
2088
  __name: "SocialNetworkIcon",
2073
2089
  props: {
2074
2090
  as: { default: "i" },
@@ -2102,18 +2118,18 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2102
2118
  return __returned__;
2103
2119
  }
2104
2120
  });
2105
- function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2121
+ function _sfc_ssrRender$e(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2106
2122
  ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), mergeProps({ class: $setup.iconClassName }, _attrs), null), _parent);
2107
2123
  }
2108
- const _sfc_setup$9 = _sfc_main$9.setup;
2109
- _sfc_main$9.setup = (props, ctx) => {
2124
+ const _sfc_setup$e = _sfc_main$e.setup;
2125
+ _sfc_main$e.setup = (props, ctx) => {
2110
2126
  const ssrContext = useSSRContext();
2111
2127
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkIcon.vue");
2112
- return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
2128
+ return _sfc_setup$e ? _sfc_setup$e(props, ctx) : void 0;
2113
2129
  };
2114
- const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
2130
+ const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["ssrRender", _sfc_ssrRender$e]]);
2115
2131
 
2116
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2132
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2117
2133
  __name: "SocialNetworkLink",
2118
2134
  props: {
2119
2135
  network: {},
@@ -2139,7 +2155,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2139
2155
  return __returned__;
2140
2156
  }
2141
2157
  });
2142
- function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2158
+ function _sfc_ssrRender$d(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2143
2159
  const _component_ALink = resolveComponent("ALink");
2144
2160
  _push(ssrRenderComponent(_component_ALink, mergeProps({ href: $setup.fixedHref }, _attrs), {
2145
2161
  default: withCtx((_, _push2, _parent2, _scopeId) => {
@@ -2160,15 +2176,15 @@ function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2160
2176
  _: 3
2161
2177
  }, _parent));
2162
2178
  }
2163
- const _sfc_setup$8 = _sfc_main$8.setup;
2164
- _sfc_main$8.setup = (props, ctx) => {
2179
+ const _sfc_setup$d = _sfc_main$d.setup;
2180
+ _sfc_main$d.setup = (props, ctx) => {
2165
2181
  const ssrContext = useSSRContext();
2166
2182
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkLink.vue");
2167
- return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
2183
+ return _sfc_setup$d ? _sfc_setup$d(props, ctx) : void 0;
2168
2184
  };
2169
- const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["ssrRender", _sfc_ssrRender$8]]);
2185
+ const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["ssrRender", _sfc_ssrRender$d]]);
2170
2186
 
2171
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2187
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
2172
2188
  __name: "ShopSidenavCategory",
2173
2189
  props: {
2174
2190
  categoryTree: {}
@@ -2191,7 +2207,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2191
2207
  return __returned__;
2192
2208
  }
2193
2209
  });
2194
- function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2210
+ function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2195
2211
  const _component_AImg = resolveComponent("AImg");
2196
2212
  const _component_ShopSidenavCategory = resolveComponent("ShopSidenavCategory", true);
2197
2213
  _push(`<li${ssrRenderAttrs(mergeProps({ class: "text-lg text-base-800" }, _attrs))}>`);
@@ -2229,15 +2245,15 @@ function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2229
2245
  }
2230
2246
  _push(`</li>`);
2231
2247
  }
2232
- const _sfc_setup$7 = _sfc_main$7.setup;
2233
- _sfc_main$7.setup = (props, ctx) => {
2248
+ const _sfc_setup$c = _sfc_main$c.setup;
2249
+ _sfc_main$c.setup = (props, ctx) => {
2234
2250
  const ssrContext = useSSRContext();
2235
2251
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenavCategory.vue");
2236
- return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
2252
+ return _sfc_setup$c ? _sfc_setup$c(props, ctx) : void 0;
2237
2253
  };
2238
- const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
2254
+ const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["ssrRender", _sfc_ssrRender$c]]);
2239
2255
 
2240
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2256
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2241
2257
  __name: "ShopSidenav",
2242
2258
  props: {
2243
2259
  categoryTrees: {}
@@ -2258,7 +2274,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2258
2274
  return __returned__;
2259
2275
  }
2260
2276
  });
2261
- function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2277
+ function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2262
2278
  _push(`<aside${ssrRenderAttrs(mergeProps({ class: "flex flex-col h-full" }, _attrs))}><nav class="py-4 grow"><ul class="relative h-full"><!--[-->`);
2263
2279
  ssrRenderList($props.categoryTrees, (categoryTree, i) => {
2264
2280
  _push(ssrRenderComponent($setup["ShopSidenavCategory"], {
@@ -2299,13 +2315,13 @@ function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2299
2315
  });
2300
2316
  _push(`<!--]--></ul></footer></aside>`);
2301
2317
  }
2302
- const _sfc_setup$6 = _sfc_main$6.setup;
2303
- _sfc_main$6.setup = (props, ctx) => {
2318
+ const _sfc_setup$b = _sfc_main$b.setup;
2319
+ _sfc_main$b.setup = (props, ctx) => {
2304
2320
  const ssrContext = useSSRContext();
2305
2321
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenav.vue");
2306
- return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
2322
+ return _sfc_setup$b ? _sfc_setup$b(props, ctx) : void 0;
2307
2323
  };
2308
- const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
2324
+ const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["ssrRender", _sfc_ssrRender$b]]);
2309
2325
 
2310
2326
  const useShopHeaderSubmenu = (props) => {
2311
2327
  const categoryPicture = computed(() => {
@@ -2354,7 +2370,7 @@ const useShopHeaderSubmenu = (props) => {
2354
2370
  };
2355
2371
  };
2356
2372
 
2357
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2373
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2358
2374
  __name: "ShopHeaderSubmenu",
2359
2375
  props: {
2360
2376
  categoryTree: {},
@@ -2380,7 +2396,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2380
2396
  return __returned__;
2381
2397
  }
2382
2398
  });
2383
- function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2399
+ function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2384
2400
  const _component_Fade = resolveComponent("Fade");
2385
2401
  const _component_AImg = resolveComponent("AImg");
2386
2402
  _push(ssrRenderComponent($setup["Popover"], _attrs, {
@@ -2670,15 +2686,15 @@ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2670
2686
  _: 3
2671
2687
  }, _parent));
2672
2688
  }
2673
- const _sfc_setup$5 = _sfc_main$5.setup;
2674
- _sfc_main$5.setup = (props, ctx) => {
2689
+ const _sfc_setup$a = _sfc_main$a.setup;
2690
+ _sfc_main$a.setup = (props, ctx) => {
2675
2691
  const ssrContext = useSSRContext();
2676
2692
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderSubmenu.vue");
2677
- return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
2693
+ return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
2678
2694
  };
2679
- const ShopHeaderSubmenu = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
2695
+ const ShopHeaderSubmenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
2680
2696
 
2681
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2697
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2682
2698
  __name: "ShopHeaderMenu",
2683
2699
  props: {
2684
2700
  inlineMenuTrees: {}
@@ -2694,7 +2710,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2694
2710
  return __returned__;
2695
2711
  }
2696
2712
  });
2697
- function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2713
+ function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2698
2714
  _push(`<nav${ssrRenderAttrs(_attrs)}><ul class="${ssrRenderClass([$props.inlineMenuTrees.length < 7 ? "text-base" : "text-sm", "flex gap-4 xl:gap-5 text-base-700"])}"><!--[-->`);
2699
2715
  ssrRenderList($props.inlineMenuTrees, (categoryTree, i) => {
2700
2716
  _push(`<li>`);
@@ -2738,28 +2754,28 @@ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2738
2754
  });
2739
2755
  _push(`<!--]--></ul></nav>`);
2740
2756
  }
2741
- const _sfc_setup$4 = _sfc_main$4.setup;
2742
- _sfc_main$4.setup = (props, ctx) => {
2757
+ const _sfc_setup$9 = _sfc_main$9.setup;
2758
+ _sfc_main$9.setup = (props, ctx) => {
2743
2759
  const ssrContext = useSSRContext();
2744
2760
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderMenu.vue");
2745
- return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
2761
+ return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
2746
2762
  };
2747
- const ShopHeaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
2763
+ const ShopHeaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
2748
2764
 
2749
- const _sfc_main$3 = {};
2765
+ const _sfc_main$8 = {};
2750
2766
 
2751
- function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs) {
2767
+ function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs) {
2752
2768
  _push(`<div${ssrRenderAttrs(mergeProps({ class: "w-full h-40 bg-base-300" }, _attrs))}></div>`);
2753
2769
  }
2754
- const _sfc_setup$3 = _sfc_main$3.setup;
2755
- _sfc_main$3.setup = (props, ctx) => {
2770
+ const _sfc_setup$8 = _sfc_main$8.setup;
2771
+ _sfc_main$8.setup = (props, ctx) => {
2756
2772
  const ssrContext = useSSRContext()
2757
2773
  ;(ssrContext.modules || (ssrContext.modules = new Set())).add("src/components/SearchModal.vue");
2758
- return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : undefined
2774
+ return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : undefined
2759
2775
  };
2760
- const SearchModal = /*#__PURE__*/_export_sfc(_sfc_main$3, [['ssrRender',_sfc_ssrRender$3]]);
2776
+ const SearchModal = /*#__PURE__*/_export_sfc(_sfc_main$8, [['ssrRender',_sfc_ssrRender$8]]);
2761
2777
 
2762
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2778
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2763
2779
  __name: "AccountMenu",
2764
2780
  props: {
2765
2781
  serviceLinks: {}
@@ -2789,7 +2805,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2789
2805
  return __returned__;
2790
2806
  }
2791
2807
  });
2792
- function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2808
+ function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2793
2809
  const _component_Fade = resolveComponent("Fade");
2794
2810
  const _component_ALink = resolveComponent("ALink");
2795
2811
  _push(ssrRenderComponent($setup["Menu"], mergeProps({
@@ -3381,31 +3397,644 @@ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
3381
3397
  _: 3
3382
3398
  }, _parent));
3383
3399
  }
3400
+ const _sfc_setup$7 = _sfc_main$7.setup;
3401
+ _sfc_main$7.setup = (props, ctx) => {
3402
+ const ssrContext = useSSRContext();
3403
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/AccountMenu.vue");
3404
+ return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
3405
+ };
3406
+ const AccountMenu = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
3407
+
3408
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3409
+ __name: "CheckoutLink",
3410
+ props: {
3411
+ to: { default: "cart" },
3412
+ cartUrl: { default: globalThis.$storefront.settings.cart_url || "/app/#/cart" },
3413
+ checkoutUrl: { default: globalThis.$storefront.settings.checkout_url || "/app/#/checkout" }
3414
+ },
3415
+ setup(__props, { expose: __expose }) {
3416
+ __expose();
3417
+ const props = __props;
3418
+ const href = computed(() => {
3419
+ if (props.to === "cart")
3420
+ return props.cartUrl;
3421
+ return props.checkoutUrl;
3422
+ });
3423
+ const __returned__ = { props, href };
3424
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3425
+ return __returned__;
3426
+ }
3427
+ });
3428
+ function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3429
+ _push(`<a${ssrRenderAttrs(mergeProps({ href: $setup.href }, _attrs))}>`);
3430
+ ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
3431
+ _push(`</a>`);
3432
+ }
3433
+ const _sfc_setup$6 = _sfc_main$6.setup;
3434
+ _sfc_main$6.setup = (props, ctx) => {
3435
+ const ssrContext = useSSRContext();
3436
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/CheckoutLink.vue");
3437
+ return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
3438
+ };
3439
+ const CheckoutLink = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
3440
+
3441
+ const getPriceWithDiscount = (price, discount) => {
3442
+ const { type, value } = discount;
3443
+ let priceWithDiscount;
3444
+ if (value) {
3445
+ if (type === "percentage") {
3446
+ priceWithDiscount = price * ((100 - value) / 100);
3447
+ } else {
3448
+ priceWithDiscount = price - value;
3449
+ }
3450
+ return priceWithDiscount > 0 ? priceWithDiscount : 0;
3451
+ }
3452
+ return price;
3453
+ };
3454
+ const usePrices = (props) => {
3455
+ const _product = computed(() => {
3456
+ return props.product || {
3457
+ price: props.price || 0,
3458
+ base_price: props.basePrice
3459
+ };
3460
+ });
3461
+ const hasVariedPrices = computed(() => {
3462
+ const { variations } = _product.value;
3463
+ if (variations) {
3464
+ const productPrice = price(_product.value);
3465
+ for (let i = 0; i < variations.length; i++) {
3466
+ const price$1 = price({
3467
+ ..._product.value,
3468
+ ...variations[i]
3469
+ });
3470
+ if (price$1 > productPrice) {
3471
+ return true;
3472
+ }
3473
+ }
3474
+ }
3475
+ return false;
3476
+ });
3477
+ const salePrice = computed(() => {
3478
+ const price$1 = price(_product.value);
3479
+ const discount = availableExtraDiscount.value;
3480
+ if (discount && (!discount.min_amount || price$1 > discount.min_amount)) {
3481
+ return getPriceWithDiscount(price$1, discount);
3482
+ }
3483
+ return price$1;
3484
+ });
3485
+ const comparePrice = computed(() => {
3486
+ if (onPromotion(_product.value)) {
3487
+ return _product.value.base_price;
3488
+ }
3489
+ const price$1 = price(_product.value);
3490
+ if (price$1 > salePrice.value) {
3491
+ return price$1;
3492
+ }
3493
+ return 0;
3494
+ });
3495
+ const installmentsObject = computed(() => {
3496
+ return props.installmentsOption || installmentsOption.value || { max_number: 1 };
3497
+ });
3498
+ const installmentsNumber = computed(() => {
3499
+ if (installmentsObject.value.max_number <= 1) {
3500
+ return 1;
3501
+ }
3502
+ const minInstallment = installmentsObject.value.min_installment || 5;
3503
+ const maxInstallmentsNumber = Math.floor(salePrice.value / minInstallment);
3504
+ return Math.min(maxInstallmentsNumber, installmentsObject.value.max_number);
3505
+ });
3506
+ const monthlyInterest = computed(() => {
3507
+ return installmentsObject.value.monthly_interest || 0;
3508
+ });
3509
+ const installmentValue = computed(() => {
3510
+ if (installmentsNumber.value >= 2) {
3511
+ if (!monthlyInterest.value) {
3512
+ return salePrice.value / installmentsNumber.value;
3513
+ }
3514
+ const interest = monthlyInterest.value / 100;
3515
+ return salePrice.value * interest / (1 - (1 + interest) ** -installmentsNumber.value);
3516
+ }
3517
+ return 0;
3518
+ });
3519
+ const discountObject = computed(() => {
3520
+ const discount = props.discountOption || discountOption.value;
3521
+ if (discount && (!discount.min_amount || discount.min_amount <= salePrice.value) && (!props.isAmountTotal || discount.apply_at === "total")) {
3522
+ return discount;
3523
+ }
3524
+ return {};
3525
+ });
3526
+ const discountLabel = computed(() => {
3527
+ const { label } = discountObject.value;
3528
+ if (label) {
3529
+ if (label.includes(" ")) {
3530
+ return label;
3531
+ }
3532
+ return `via ${label}`;
3533
+ }
3534
+ return "";
3535
+ });
3536
+ const priceWithDiscount = computed(() => {
3537
+ return getPriceWithDiscount(salePrice.value, discountObject.value);
3538
+ });
3539
+ const pointsProgramObject = computed(() => {
3540
+ if (props.loyaltyPointsProgram) {
3541
+ return props.loyaltyPointsProgram;
3542
+ }
3543
+ const pointsPrograms = loyaltyPointsPrograms.value;
3544
+ if (pointsPrograms) {
3545
+ const programIds = Object.keys(pointsPrograms);
3546
+ for (let i = 0; i < programIds.length; i++) {
3547
+ const program = pointsPrograms[programIds[i]];
3548
+ if (program?.earn_percentage && program.earn_percentage > 0) {
3549
+ return program;
3550
+ }
3551
+ }
3552
+ }
3553
+ return { ratio: 0 };
3554
+ });
3555
+ const pointsMinPrice = computed(() => {
3556
+ return pointsProgramObject.value.min_subtotal_to_earn || 0;
3557
+ });
3558
+ const pointsProgramName = computed(() => {
3559
+ return pointsProgramObject.value.name || "";
3560
+ });
3561
+ const earnPointsPercentage = computed(() => {
3562
+ return pointsProgramObject.value.earn_percentage || 0;
3563
+ });
3564
+ const cashbackPercentage = computed(() => {
3565
+ return earnPointsPercentage.value * pointsProgramObject.value.ratio;
3566
+ });
3567
+ const cashbackValue = computed(() => {
3568
+ return cashbackPercentage.value >= 1 ? salePrice.value * (cashbackPercentage.value / 100) : 0;
3569
+ });
3570
+ return {
3571
+ hasVariedPrices,
3572
+ salePrice,
3573
+ comparePrice,
3574
+ installmentsObject,
3575
+ installmentsNumber,
3576
+ monthlyInterest,
3577
+ installmentValue,
3578
+ discountObject,
3579
+ discountLabel,
3580
+ priceWithDiscount,
3581
+ pointsProgramObject,
3582
+ pointsMinPrice,
3583
+ pointsProgramName,
3584
+ earnPointsPercentage,
3585
+ cashbackPercentage,
3586
+ cashbackValue
3587
+ };
3588
+ };
3589
+
3590
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3591
+ __name: "Prices",
3592
+ props: {
3593
+ isBig: { type: Boolean },
3594
+ isLiteral: { type: Boolean },
3595
+ hasCashback: { type: Boolean, default: true },
3596
+ hasPriceOptions: { type: Boolean, default: true },
3597
+ product: {},
3598
+ price: {},
3599
+ basePrice: {},
3600
+ isAmountTotal: { type: Boolean },
3601
+ installmentsOption: {},
3602
+ discountOption: {},
3603
+ loyaltyPointsProgram: {}
3604
+ },
3605
+ setup(__props, { expose: __expose }) {
3606
+ __expose();
3607
+ const props = __props;
3608
+ const {
3609
+ hasVariedPrices,
3610
+ salePrice,
3611
+ comparePrice,
3612
+ cashbackPercentage,
3613
+ cashbackValue,
3614
+ installmentsNumber,
3615
+ monthlyInterest,
3616
+ installmentValue,
3617
+ priceWithDiscount,
3618
+ discountLabel
3619
+ } = usePrices(props);
3620
+ const __returned__ = { props, hasVariedPrices, salePrice, comparePrice, cashbackPercentage, cashbackValue, installmentsNumber, monthlyInterest, installmentValue, priceWithDiscount, discountLabel };
3621
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3622
+ return __returned__;
3623
+ }
3624
+ });
3625
+ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3626
+ const _component_Fade = resolveComponent("Fade");
3627
+ _push(`<div${ssrRenderAttrs(mergeProps({
3628
+ class: ["text-base-600 [&>div]:[font-size:90%] [&_small]:lowercase [&_small]:[font-size:92%]", $props.isBig ? "text-lg" : null],
3629
+ "data-prices": ""
3630
+ }, _attrs))}>`);
3631
+ if ($setup.comparePrice) {
3632
+ _push(`<span class="text-base-500 mr-1 text-[87%]">`);
3633
+ if ($props.isLiteral) {
3634
+ _push(`<small>${ssrInterpolate(`${"De"} `)}</small>`);
3635
+ } else {
3636
+ _push(`<!---->`);
3637
+ }
3638
+ _push(`<s>${ssrInterpolate(_ctx.$money($setup.comparePrice))}</s>`);
3639
+ if ($props.isLiteral) {
3640
+ _push(`<small>${ssrInterpolate(` ${"Por"}`)}</small>`);
3641
+ } else {
3642
+ _push(`<!---->`);
3643
+ }
3644
+ _push(`</span>`);
3645
+ } else {
3646
+ _push(`<!---->`);
3647
+ }
3648
+ _push(`<strong class="${ssrRenderClass([$props.isBig ? "text-5xl block" : null, "inline-block text-base-800"])}">`);
3649
+ if ($setup.hasVariedPrices) {
3650
+ _push(`<small>${ssrInterpolate(`${"A partir de"} `)}</small>`);
3651
+ } else {
3652
+ _push(`<!---->`);
3653
+ }
3654
+ _push(` ${ssrInterpolate(_ctx.$money($setup.salePrice))}</strong>`);
3655
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
3656
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3657
+ if (_push2) {
3658
+ if ($setup.cashbackValue && $props.hasCashback) {
3659
+ _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>`);
3660
+ } else {
3661
+ _push2(`<!---->`);
3662
+ }
3663
+ } else {
3664
+ return [
3665
+ $setup.cashbackValue && $props.hasCashback ? (openBlock(), createBlock("div", {
3666
+ key: 0,
3667
+ class: "relative z-10"
3668
+ }, [
3669
+ createVNode("span", {
3670
+ "data-tooltip": "Receba $1 de volta".replace("$1", _ctx.$percentage($setup.cashbackPercentage))
3671
+ }, [
3672
+ createVNode("i", { class: "i-arrow-uturn-left mr-1" }),
3673
+ createVNode("span", { class: "font-medium" }, toDisplayString(_ctx.$money($setup.cashbackValue)), 1),
3674
+ createVNode("small", null, " cashback")
3675
+ ], 8, ["data-tooltip"])
3676
+ ])) : createCommentVNode("", true)
3677
+ ];
3678
+ }
3679
+ }),
3680
+ _: 1
3681
+ }, _parent));
3682
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
3683
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3684
+ if (_push2) {
3685
+ if ($setup.installmentValue && $props.hasPriceOptions) {
3686
+ _push2(`<div${_scopeId}>`);
3687
+ if ($props.isLiteral) {
3688
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"At\xE9"} `)}</small>`);
3689
+ } else {
3690
+ _push2(`<!---->`);
3691
+ }
3692
+ _push2(` ${ssrInterpolate($setup.installmentsNumber)}x `);
3693
+ if ($props.isLiteral) {
3694
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${"De"} `)}</small>`);
3695
+ } else {
3696
+ _push2(`<!---->`);
3697
+ }
3698
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money($setup.installmentValue))}</span>`);
3699
+ if (!$setup.monthlyInterest && $props.isLiteral) {
3700
+ _push2(`<small${_scopeId}>${ssrInterpolate("Sem juros")}</small>`);
3701
+ } else {
3702
+ _push2(`<!---->`);
3703
+ }
3704
+ _push2(`</div>`);
3705
+ } else {
3706
+ _push2(`<!---->`);
3707
+ }
3708
+ } else {
3709
+ return [
3710
+ $setup.installmentValue && $props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
3711
+ $props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"At\xE9"} `))) : createCommentVNode("", true),
3712
+ createTextVNode(" " + toDisplayString($setup.installmentsNumber) + "x ", 1),
3713
+ $props.isLiteral ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${"De"} `))) : createCommentVNode("", true),
3714
+ createVNode("span", null, toDisplayString(_ctx.$money($setup.installmentValue)), 1),
3715
+ !$setup.monthlyInterest && $props.isLiteral ? (openBlock(), createBlock("small", { key: 2 }, toDisplayString("Sem juros"))) : createCommentVNode("", true)
3716
+ ])) : createCommentVNode("", true)
3717
+ ];
3718
+ }
3719
+ }),
3720
+ _: 1
3721
+ }, _parent));
3722
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
3723
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3724
+ if (_push2) {
3725
+ if ($setup.priceWithDiscount < $setup.salePrice && $props.hasPriceOptions) {
3726
+ _push2(`<div${_scopeId}>`);
3727
+ if (!$setup.discountLabel) {
3728
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"A partir de"} `)}</small>`);
3729
+ } else {
3730
+ _push2(`<!---->`);
3731
+ }
3732
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money($setup.priceWithDiscount))}</span>`);
3733
+ if ($setup.discountLabel) {
3734
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${$setup.discountLabel}`)}</small>`);
3735
+ } else {
3736
+ _push2(`<!---->`);
3737
+ }
3738
+ _push2(`</div>`);
3739
+ } else {
3740
+ _push2(`<!---->`);
3741
+ }
3742
+ } else {
3743
+ return [
3744
+ $setup.priceWithDiscount < $setup.salePrice && $props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
3745
+ !$setup.discountLabel ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"A partir de"} `))) : createCommentVNode("", true),
3746
+ createVNode("span", null, toDisplayString(_ctx.$money($setup.priceWithDiscount)), 1),
3747
+ $setup.discountLabel ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${$setup.discountLabel}`), 1)) : createCommentVNode("", true)
3748
+ ])) : createCommentVNode("", true)
3749
+ ];
3750
+ }
3751
+ }),
3752
+ _: 1
3753
+ }, _parent));
3754
+ _push(`</div>`);
3755
+ }
3756
+ const _sfc_setup$5 = _sfc_main$5.setup;
3757
+ _sfc_main$5.setup = (props, ctx) => {
3758
+ const ssrContext = useSSRContext();
3759
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Prices.vue");
3760
+ return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
3761
+ };
3762
+ const Prices = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
3763
+
3764
+ const useCartItem = (props) => {
3765
+ const parsedItem = computed(() => {
3766
+ return !props.item && props.product ? parseProduct(props.product) : null;
3767
+ });
3768
+ const cartItem = computed(() => {
3769
+ return props.item || parsedItem.value;
3770
+ });
3771
+ const title = computed(() => {
3772
+ return name(cartItem.value);
3773
+ });
3774
+ const link = computed(() => {
3775
+ const { slug } = cartItem.value;
3776
+ if (typeof slug === "string") {
3777
+ return `/${slug}`;
3778
+ }
3779
+ return null;
3780
+ });
3781
+ const image = computed(() => {
3782
+ if (cartItem.value.picture) {
3783
+ return img(cartItem.value.picture, void 0, props.pictureSize || "small");
3784
+ }
3785
+ return void 0;
3786
+ });
3787
+ const finalPrice = computed(() => {
3788
+ return cartItem.value.final_price || cartItem.value.price;
3789
+ });
3790
+ return {
3791
+ cartItem,
3792
+ title,
3793
+ link,
3794
+ image,
3795
+ finalPrice
3796
+ };
3797
+ };
3798
+
3799
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3800
+ __name: "QuantitySelectorControl",
3801
+ props: {
3802
+ isMinus: { type: Boolean }
3803
+ },
3804
+ setup(__props, { expose: __expose }) {
3805
+ __expose();
3806
+ const {
3807
+ value,
3808
+ isBoundMin,
3809
+ isBoundMax
3810
+ } = inject(quantitySelectorKey);
3811
+ const __returned__ = { value, isBoundMin, isBoundMax };
3812
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3813
+ return __returned__;
3814
+ }
3815
+ });
3816
+ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3817
+ _push(`<button${ssrRenderAttrs(mergeProps({
3818
+ type: "button",
3819
+ class: "w-10 h-12 text-xl leading-12 enabled:text-primary enabled:hover:bg-primary-100/70 disabled:opacity-40",
3820
+ "data-quantity-selector-control": $props.isMinus ? "minus" : "plus",
3821
+ "aria-label": $props.isMinus ? "Menos" : "Mais",
3822
+ disabled: $props.isMinus ? $setup.isBoundMin : $setup.isBoundMax
3823
+ }, _attrs))}>`);
3824
+ ssrRenderSlot(_ctx.$slots, "default", {}, () => {
3825
+ if ($props.isMinus) {
3826
+ _push(`<!--[-->\u2212<!--]-->`);
3827
+ } else {
3828
+ _push(`<!--[-->+<!--]-->`);
3829
+ }
3830
+ }, _push, _parent);
3831
+ _push(`</button>`);
3832
+ }
3833
+ const _sfc_setup$4 = _sfc_main$4.setup;
3834
+ _sfc_main$4.setup = (props, ctx) => {
3835
+ const ssrContext = useSSRContext();
3836
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/QuantitySelectorControl.vue");
3837
+ return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
3838
+ };
3839
+ const QuantitySelectorControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
3840
+
3841
+ const quantitySelectorKey = Symbol("quantitySelector");
3842
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3843
+ __name: "QuantitySelector",
3844
+ props: {
3845
+ modelValue: { default: 1 },
3846
+ min: { default: 1 },
3847
+ max: {},
3848
+ step: {},
3849
+ disabled: { type: Boolean },
3850
+ readonly: { type: Boolean }
3851
+ },
3852
+ emits: ["update:modelValue"],
3853
+ setup(__props, { expose: __expose, emit }) {
3854
+ __expose();
3855
+ const props = __props;
3856
+ const input = ref(null);
3857
+ const inputId = `NInput${useId()}`;
3858
+ const value = computed({
3859
+ get() {
3860
+ return props.modelValue;
3861
+ },
3862
+ set(_value) {
3863
+ if (_value < props.min) {
3864
+ _value = props.min;
3865
+ input.value.value = `${_value}`;
3866
+ }
3867
+ if (props.max && _value > props.max) {
3868
+ _value = props.max;
3869
+ input.value.value = `${_value}`;
3870
+ }
3871
+ emit("update:modelValue", _value);
3872
+ }
3873
+ });
3874
+ const isBoundMin = computed(() => {
3875
+ return props.min >= value.value;
3876
+ });
3877
+ const isBoundMax = computed(() => {
3878
+ return props.max <= value.value;
3879
+ });
3880
+ provide(quantitySelectorKey, {
3881
+ value,
3882
+ isBoundMin,
3883
+ isBoundMax
3884
+ });
3885
+ const __returned__ = { quantitySelectorKey, props, emit, input, inputId, value, isBoundMin, isBoundMax, QuantitySelectorControl };
3886
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3887
+ return __returned__;
3888
+ }
3889
+ });
3890
+ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3891
+ _push(`<div${ssrRenderAttrs(mergeProps({ "data-quantity-selector": "" }, _attrs))}>`);
3892
+ ssrRenderSlot(_ctx.$slots, "label", { inputId: $setup.inputId, value: $setup.value }, () => {
3893
+ _push(`<label${ssrRenderAttr("for", $setup.inputId)} class="sr-only">${ssrInterpolate("Quantidade")}</label>`);
3894
+ }, _push, _parent);
3895
+ _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">`);
3896
+ ssrRenderSlot(_ctx.$slots, "controls", { value: $setup.value, isBoundMin: $setup.isBoundMin, isBoundMax: $setup.isBoundMax }, () => {
3897
+ _push(ssrRenderComponent($setup["QuantitySelectorControl"], {
3898
+ "is-minus": "",
3899
+ class: "order-first"
3900
+ }, {
3901
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3902
+ if (_push2) {
3903
+ ssrRenderSlot(_ctx.$slots, "minus", {}, null, _push2, _parent2, _scopeId);
3904
+ } else {
3905
+ return [
3906
+ renderSlot$1(_ctx.$slots, "minus")
3907
+ ];
3908
+ }
3909
+ }),
3910
+ _: 3
3911
+ }, _parent));
3912
+ _push(ssrRenderComponent($setup["QuantitySelectorControl"], { class: "order-last" }, {
3913
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3914
+ if (_push2) {
3915
+ ssrRenderSlot(_ctx.$slots, "plus", {}, null, _push2, _parent2, _scopeId);
3916
+ } else {
3917
+ return [
3918
+ renderSlot$1(_ctx.$slots, "plus")
3919
+ ];
3920
+ }
3921
+ }),
3922
+ _: 3
3923
+ }, _parent));
3924
+ }, _push, _parent);
3925
+ _push(`</div></div>`);
3926
+ }
3927
+ const _sfc_setup$3 = _sfc_main$3.setup;
3928
+ _sfc_main$3.setup = (props, ctx) => {
3929
+ const ssrContext = useSSRContext();
3930
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/QuantitySelector.vue");
3931
+ return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
3932
+ };
3933
+ const QuantitySelector = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["ssrRender", _sfc_ssrRender$3]]);
3934
+
3935
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3936
+ __name: "CartItem",
3937
+ props: {
3938
+ item: {},
3939
+ product: {},
3940
+ pictureSize: {}
3941
+ },
3942
+ setup(__props, { expose: __expose }) {
3943
+ __expose();
3944
+ const props = __props;
3945
+ const {
3946
+ cartItem,
3947
+ title,
3948
+ link,
3949
+ image,
3950
+ finalPrice
3951
+ } = useCartItem(props);
3952
+ const __returned__ = { props, cartItem, title, link, image, finalPrice, get removeCartItem() {
3953
+ return removeCartItem;
3954
+ }, QuantitySelector, Prices };
3955
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3956
+ return __returned__;
3957
+ }
3958
+ });
3959
+ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3960
+ const _component_AImg = resolveComponent("AImg");
3961
+ _push(`<article${ssrRenderAttrs(mergeProps({ class: "relative bg-white shadow-sm" }, _attrs))}>`);
3962
+ ssrRenderVNode(_push, createVNode(resolveDynamicComponent($setup.link ? "ALink" : "div"), {
3963
+ href: $setup.link,
3964
+ class: "flex items-center gap-5 p-4 group"
3965
+ }, {
3966
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
3967
+ if (_push2) {
3968
+ if ($setup.image) {
3969
+ _push2(ssrRenderComponent(_component_AImg, {
3970
+ picture: $setup.image,
3971
+ alt: $setup.title,
3972
+ class: "w-20 h-20 object-cover"
3973
+ }, null, _parent2, _scopeId));
3974
+ } else {
3975
+ _push2(`<!---->`);
3976
+ }
3977
+ _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>`);
3978
+ } else {
3979
+ return [
3980
+ $setup.image ? (openBlock(), createBlock(_component_AImg, {
3981
+ key: 0,
3982
+ picture: $setup.image,
3983
+ alt: $setup.title,
3984
+ class: "w-20 h-20 object-cover"
3985
+ }, null, 8, ["picture", "alt"])) : createCommentVNode("", true),
3986
+ createVNode("p", { class: "py-2 flex-auto text-sm text-base-700 group-hover:text-base-900 group-hover:underline" }, toDisplayString($setup.title), 1)
3987
+ ];
3988
+ }
3989
+ }),
3990
+ _: 1
3991
+ }), _parent);
3992
+ if ($setup.cartItem._id) {
3993
+ _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>`);
3994
+ } else {
3995
+ _push(`<!---->`);
3996
+ }
3997
+ _push(`<div class="flex justify-between items-center border-t-2 border-base-100"><div class="border-r-2 border-base-100">`);
3998
+ _push(ssrRenderComponent($setup["QuantitySelector"], {
3999
+ modelValue: $setup.cartItem.quantity,
4000
+ "onUpdate:modelValue": ($event) => $setup.cartItem.quantity = $event,
4001
+ min: $setup.cartItem.min_quantity,
4002
+ max: $setup.cartItem.max_quantity
4003
+ }, null, _parent));
4004
+ _push(`</div>`);
4005
+ _push(ssrRenderComponent($setup["Prices"], {
4006
+ "base-price": $setup.cartItem.base_price,
4007
+ price: $setup.finalPrice,
4008
+ class: "px-4 py-2.5 text-[95%]"
4009
+ }, null, _parent));
4010
+ _push(`</div></article>`);
4011
+ }
3384
4012
  const _sfc_setup$2 = _sfc_main$2.setup;
3385
4013
  _sfc_main$2.setup = (props, ctx) => {
3386
4014
  const ssrContext = useSSRContext();
3387
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/AccountMenu.vue");
4015
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/CartItem.vue");
3388
4016
  return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
3389
4017
  };
3390
- const AccountMenu = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
4018
+ const CartItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
3391
4019
 
3392
4020
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3393
4021
  __name: "CartSidebar",
3394
- setup(__props, { expose: __expose }) {
4022
+ emits: ["close"],
4023
+ setup(__props, { expose: __expose, emit }) {
3395
4024
  __expose();
3396
- const __returned__ = { get freeShippingFromValue() {
4025
+ const __returned__ = { emit, get freeShippingFromValue() {
3397
4026
  return freeShippingFromValue;
3398
4027
  }, get shoppingCart() {
3399
4028
  return shoppingCart;
3400
4029
  }, get totalItems() {
3401
4030
  return totalItems;
3402
- } };
4031
+ }, CheckoutLink, Prices, CartItem };
3403
4032
  Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3404
4033
  return __returned__;
3405
4034
  }
3406
4035
  });
3407
4036
  function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
3408
- _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">`);
4037
+ _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">`);
3409
4038
  if ($setup.freeShippingFromValue) {
3410
4039
  _push(`<div class="text-sm text-center">`);
3411
4040
  if ($setup.freeShippingFromValue > $setup.shoppingCart.subtotal) {
@@ -3420,7 +4049,36 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
3420
4049
  } else {
3421
4050
  _push(`<!---->`);
3422
4051
  }
3423
- _push(`</article><footer class="p-5 shadow"></footer></aside>`);
4052
+ _push(`<ul class="px-4 pt-4 pb-2"><!--[-->`);
4053
+ ssrRenderList($setup.shoppingCart.items, (item, i) => {
4054
+ _push(`<li>`);
4055
+ _push(ssrRenderComponent($setup["CartItem"], {
4056
+ item,
4057
+ class: "mb-3"
4058
+ }, null, _parent));
4059
+ _push(`</li>`);
4060
+ });
4061
+ _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>`);
4062
+ _push(ssrRenderComponent($setup["Prices"], {
4063
+ price: $setup.shoppingCart.subtotal,
4064
+ "is-literal": true,
4065
+ class: "text-lg"
4066
+ }, null, _parent));
4067
+ _push(`</div>`);
4068
+ _push(ssrRenderComponent($setup["CheckoutLink"], { class: "ui-btn-lg ui-btn-primary w-full text-right my-2.5" }, {
4069
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
4070
+ if (_push2) {
4071
+ _push2(`<i class="i-check mr-2"${_scopeId}></i> ${ssrInterpolate("Finalizar compra")}`);
4072
+ } else {
4073
+ return [
4074
+ createVNode("i", { class: "i-check mr-2" }),
4075
+ createTextVNode(" " + toDisplayString("Finalizar compra"))
4076
+ ];
4077
+ }
4078
+ }),
4079
+ _: 1
4080
+ }, _parent));
4081
+ _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>`);
3424
4082
  }
3425
4083
  const _sfc_setup$1 = _sfc_main$1.setup;
3426
4084
  _sfc_main$1.setup = (props, ctx) => {
@@ -3457,7 +4115,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3457
4115
  onMounted(() => {
3458
4116
  isMounted.value = true;
3459
4117
  watch(totalItems, (newTotalItems, prevTotalItems) => {
3460
- if (prevTotalItems && prevTotalItems < newTotalItems) {
4118
+ if (typeof prevTotalItems === "number" && prevTotalItems < newTotalItems) {
3461
4119
  isCartOpen.value = true;
3462
4120
  }
3463
4121
  delayedTotalItems.value = newTotalItems;
@@ -3549,10 +4207,14 @@ function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $op
3549
4207
  }, {
3550
4208
  default: withCtx((_, _push3, _parent2, _scopeId) => {
3551
4209
  if (_push3) {
3552
- _push3(ssrRenderComponent($setup["CartSidebar"], null, null, _parent2, _scopeId));
4210
+ _push3(ssrRenderComponent($setup["CartSidebar"], {
4211
+ onClose: ($event) => $setup.isCartOpen = false
4212
+ }, null, _parent2, _scopeId));
3553
4213
  } else {
3554
4214
  return [
3555
- createVNode($setup["CartSidebar"])
4215
+ createVNode($setup["CartSidebar"], {
4216
+ onClose: ($event) => $setup.isCartOpen = false
4217
+ }, null, 8, ["onClose"])
3556
4218
  ];
3557
4219
  }
3558
4220
  }),
@@ -3655,4 +4317,4 @@ const ____slug_ = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty(
3655
4317
  url: $$url
3656
4318
  }, Symbol.toStringTag, { value: 'Module' }));
3657
4319
 
3658
- 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 };
4320
+ 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 };