cloudcommerce 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/.github/renovate.json +1 -1
  2. package/CHANGELOG.md +52 -0
  3. package/action.yml +1 -2
  4. package/package.json +7 -7
  5. package/packages/api/package.json +1 -1
  6. package/packages/apps/correios/package.json +1 -1
  7. package/packages/apps/custom-payment/package.json +1 -1
  8. package/packages/apps/custom-shipping/package.json +1 -1
  9. package/packages/apps/datafrete/package.json +1 -1
  10. package/packages/apps/discounts/package.json +1 -1
  11. package/packages/apps/emails/package.json +1 -1
  12. package/packages/apps/fb-conversions/package.json +1 -1
  13. package/packages/apps/frenet/package.json +1 -1
  14. package/packages/apps/galaxpay/package.json +1 -1
  15. package/packages/apps/google-analytics/package.json +1 -1
  16. package/packages/apps/infinitepay/package.json +1 -1
  17. package/packages/apps/jadlog/package.json +1 -1
  18. package/packages/apps/loyalty-points/package.json +1 -1
  19. package/packages/apps/melhor-envio/package.json +1 -1
  20. package/packages/apps/mercadopago/package.json +1 -1
  21. package/packages/apps/pagarme/package.json +2 -2
  22. package/packages/apps/paghiper/package.json +1 -1
  23. package/packages/apps/pix/package.json +1 -1
  24. package/packages/apps/tiny-erp/package.json +1 -1
  25. package/packages/apps/webhooks/package.json +3 -3
  26. package/packages/cli/package.json +1 -1
  27. package/packages/config/package.json +1 -1
  28. package/packages/emails/package.json +1 -1
  29. package/packages/events/package.json +1 -1
  30. package/packages/firebase/package.json +1 -1
  31. package/packages/i18n/package.json +1 -1
  32. package/packages/modules/lib/firebase/checkout.js +4 -1
  33. package/packages/modules/lib/firebase/checkout.js.map +1 -1
  34. package/packages/modules/package.json +1 -1
  35. package/packages/modules/src/firebase/checkout.ts +4 -1
  36. package/packages/passport/package.json +1 -1
  37. package/packages/ssr/package.json +3 -3
  38. package/packages/storefront/client.d.ts +23 -3
  39. package/packages/storefront/config/storefront.cms.cjs +31 -5
  40. package/packages/storefront/config/storefront.cms.mjs +31 -5
  41. package/packages/storefront/dist/client/_astro/PitchBar.457658a3.js +1 -0
  42. package/packages/storefront/dist/client/_astro/Prices.a1302bf9.js +1 -0
  43. package/packages/storefront/dist/client/_astro/ProductCard.1a45764a.js +1 -0
  44. package/packages/storefront/dist/client/_astro/ShopHeader.0a6766ac.js +1 -0
  45. package/packages/storefront/dist/client/_astro/_...slug_.6721f699.css +1 -0
  46. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.6da04e63.js +1 -0
  47. package/packages/storefront/dist/client/_astro/client.b854166f.js +1 -0
  48. package/packages/storefront/dist/client/_astro/firebase-app.7ce2ebb1.js +1426 -0
  49. package/packages/storefront/dist/client/_astro/format-money.6f464cee.js +1 -0
  50. package/packages/storefront/dist/client/_astro/hoisted.721ad75d.js +1 -0
  51. package/packages/storefront/dist/client/_astro/idle-callback.889bf0ea.js +1 -0
  52. package/packages/storefront/dist/client/_astro/index.a500792d.js +1 -0
  53. package/packages/storefront/dist/client/_astro/modules-info.80ae4e30.js +1 -0
  54. package/packages/storefront/dist/client/_astro/preload-helper.101896b7.js +1 -0
  55. package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.acde10ec.js +1 -0
  56. package/packages/storefront/dist/client/fallback/index.html +8 -8
  57. package/packages/storefront/dist/client/sw.js +1 -1
  58. package/packages/storefront/dist/server/chunks/{astro.0f5b754a.mjs → astro.7d9d5f6e.mjs} +100 -38
  59. package/packages/storefront/dist/server/chunks/pages/{all.671e6bc1.mjs → all.e0f284c9.mjs} +980 -660
  60. package/packages/storefront/dist/server/chunks/{prerender.fd8cdc24.mjs → prerender.9f6cbb00.mjs} +0 -0
  61. package/packages/storefront/dist/server/entry.mjs +100 -48
  62. package/packages/storefront/package.json +8 -8
  63. package/packages/storefront/server.d.ts +34 -0
  64. package/packages/storefront/src/env.d.ts +1 -0
  65. package/packages/storefront/src/helpers/afetch.ts +3 -1
  66. package/packages/storefront/src/helpers/idle-callback.ts +9 -0
  67. package/packages/storefront/src/lib/assets/base.css +6 -0
  68. package/packages/storefront/src/lib/browser-env.ts +22 -0
  69. package/packages/storefront/src/lib/cms.d.ts +25 -0
  70. package/packages/storefront/src/lib/components/Drawer.vue +1 -1
  71. package/packages/storefront/src/lib/components/LoginForm.vue +13 -9
  72. package/packages/storefront/src/lib/components/SocialNetworkIcon.vue +29 -0
  73. package/packages/storefront/src/lib/components/SocialNetworkLink.vue +37 -0
  74. package/packages/storefront/src/lib/components/globals/ALink.vue +2 -2
  75. package/packages/storefront/src/lib/composables/use-shop-header.ts +79 -0
  76. package/packages/storefront/src/lib/layouts/Base.astro +4 -5
  77. package/packages/storefront/src/lib/layouts/BaseHead.astro +7 -7
  78. package/packages/storefront/src/lib/layouts/BaseStateJson.astro +1 -1
  79. package/packages/storefront/src/lib/layouts/PagesHeader.astro +5 -23
  80. package/packages/storefront/src/lib/scripts/firebase-app.ts +16 -3
  81. package/packages/storefront/src/lib/server-data.ts +25 -0
  82. package/packages/storefront/src/lib/ssr-context.ts +11 -10
  83. package/packages/storefront/src/lib/state/customer-session.ts +51 -30
  84. package/packages/storefront/src/lib/state/modules-info.ts +3 -6
  85. package/packages/storefront/tailwind.config.cjs +1 -4
  86. package/packages/types/index.ts +7 -0
  87. package/packages/types/package.json +1 -1
  88. package/pnpm-workspace.yaml +3 -3
  89. package/packages/storefront/dist/client/_astro/PitchBar.004b6ea4.js +0 -1
  90. package/packages/storefront/dist/client/_astro/Prices.f311909a.js +0 -1
  91. package/packages/storefront/dist/client/_astro/Prices.vue_vue_type_script_setup_true_lang.ef47de70.js +0 -1
  92. package/packages/storefront/dist/client/_astro/ProductCard.34de5097.js +0 -1
  93. package/packages/storefront/dist/client/_astro/ShopHeader.cbfee289.js +0 -1
  94. package/packages/storefront/dist/client/_astro/_...slug_.bcc33d9d.css +0 -1
  95. package/packages/storefront/dist/client/_astro/client.56d86c9b.js +0 -1
  96. package/packages/storefront/dist/client/_astro/ecom-utils.92f137f6.js +0 -1
  97. package/packages/storefront/dist/client/_astro/hoisted.6edd7364.js +0 -1
  98. package/packages/storefront/dist/client/_astro/index.2d12be6c.js +0 -1
  99. package/packages/storefront/dist/client/_astro/modules-info.0debb0b0.js +0 -1
  100. package/packages/storefront/dist/client/_astro/runtime-core.esm-bundler.a0432a8e.js +0 -1
  101. package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.0e5774ce.js +0 -1
  102. package/packages/storefront/src/lib/components/ADrawer.vue +0 -110
  103. package/packages/storefront/src/lib/components/LoginDrawer.vue +0 -82
  104. package/packages/storefront/src/lib/components/ShopHeader.vue +0 -111
  105. package/packages/storefront/src/lib/components/ShopSidenav.vue +0 -26
  106. package/packages/storefront/src/lib/types/cms-code.d.ts +0 -5
  107. package/packages/storefront/src/lib/types/cms-contacts.d.ts +0 -5
  108. package/packages/storefront/src/lib/types/cms-header.d.ts +0 -5
  109. package/packages/storefront/src/lib/types/cms-settings.d.ts +0 -8
  110. package/packages/storefront/src/lib/types/cms-social.d.ts +0 -5
@@ -9,17 +9,25 @@ import 'node:os';
9
9
  import sizeOf from 'image-size';
10
10
  import 'magic-string';
11
11
  import 'node:stream';
12
- import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, d as renderComponent, u as unescapeHTML, F as Fragment, m as maybeRenderHead, e as renderSlot, f as renderHead, s as spreadAttributes } from '../astro.0f5b754a.mjs';
12
+ import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, u as unescapeHTML, m as maybeRenderHead, d as renderSlot, e as renderComponent, f as renderHead, F as Fragment, s as spreadAttributes } from '../astro.7d9d5f6e.mjs';
13
13
  import api from '@cloudcommerce/api';
14
- import { reactive, computed, defineComponent, inject, mergeProps, useSSRContext, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, unref, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, resolveComponent, withModifiers, Teleport, toDisplayString, createTextVNode } from 'vue';
14
+ import { reactive, computed, defineComponent, inject, useSSRContext, 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, toDisplayString, createTextVNode } from 'vue';
15
+ import { img, price, formatMoney, nickname, onPromotion } from '@ecomplus/utils';
15
16
  import { ssrRenderAttrs, ssrRenderSlot, ssrRenderClass, ssrRenderVNode, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrIncludeBooleanAttr, ssrRenderAttr, ssrRenderTeleport, ssrInterpolate } from 'vue/server-renderer';
16
- import { img, price, formatMoney, onPromotion } from '@ecomplus/utils';
17
17
  /* empty css */import { EventEmitter } from 'node:events';
18
18
  import fs, { readFileSync } from 'node:fs';
19
19
  import config from '@cloudcommerce/config';
20
20
  import { resolve as resolve$1 } from 'path';
21
21
  /* empty css */import { useScroll, useElementHover, useDebounceFn, useTimeout, promiseTimeout } from '@vueuse/core';
22
22
 
23
+ const _export_sfc = (sfc, props) => {
24
+ const target = sfc.__vccOpts || sfc;
25
+ for (const [key, val] of props) {
26
+ target[key] = val;
27
+ }
28
+ return target;
29
+ };
30
+
23
31
  function isOutputFormat(value) {
24
32
  return ["avif", "jpeg", "jpg", "png", "webp"].includes(value);
25
33
  }
@@ -242,12 +250,38 @@ const getCMS = () => {
242
250
  const dirContent = resolve(baseDir, 'content');
243
251
 
244
252
  const cms = (filename) => {
245
- if (filename.endsWith('/')) {
246
- const dirColl = resolve(dirContent, filename);
247
- return fs.readdirSync(dirColl).map((_filename) => _filename.replace('.json', ''));
253
+ // MUST be sync for 'settings'
254
+ // Async with other content to support external CMS integration
255
+ const loadLocal = () => {
256
+ if (filename.endsWith('/')) {
257
+ const dirColl = resolve(dirContent, filename);
258
+ return new Promise((resolve) => {
259
+ const slugs = fs.existsSync(dirColl)
260
+ ? fs.readdirSync(dirColl).map((file) => file.replace('.json', ''))
261
+ : [];
262
+ resolve(slugs);
263
+ });
264
+ }
265
+ const filepath = resolve(dirContent, `${filename}.json`);
266
+ const content = fs.existsSync(filepath)
267
+ ? JSON.parse(fs.readFileSync(filepath, 'utf8'))
268
+ : null;
269
+ return filename === 'settings'
270
+ ? content
271
+ : new Promise((resolve) => { resolve(content); });
272
+ };
273
+ const handler = globalThis.storefront_cms_handler;
274
+ if (typeof handler === 'function') {
275
+ try {
276
+ const content = handler({ dirContent, filename, loadLocal });
277
+ if (content) {
278
+ return content;
279
+ }
280
+ } catch {
281
+ //
282
+ }
248
283
  }
249
- const filepath = resolve(dirContent, `${filename}.json`);
250
- return JSON.parse(fs.readFileSync(filepath, 'utf8'));
284
+ return loadLocal();
251
285
  };
252
286
 
253
287
  let settings;
@@ -362,7 +396,7 @@ const loadPageContext = async (Astro, {
362
396
  ];
363
397
  if (slug) {
364
398
  if (cmsCollection) {
365
- cmsContent = config.cms(`${cmsCollection}/${slug}`);
399
+ cmsContent = await config.cms(`${cmsCollection}/${slug}`);
366
400
  } else {
367
401
  apiFetchings[0] = api.get(`slugs/${slug}`, apiOptions);
368
402
  }
@@ -408,6 +442,13 @@ const loadPageContext = async (Astro, {
408
442
  } else {
409
443
  setResponseCache(Astro, 120, 300);
410
444
  }
445
+ if (apiDoc) {
446
+ globalThis.storefront.context = {
447
+ resource: apiResource,
448
+ doc: apiDoc,
449
+ timestamp: Date.now()
450
+ };
451
+ }
411
452
  const pageContext = {
412
453
  ...config,
413
454
  isHomepage,
@@ -420,7 +461,7 @@ const loadPageContext = async (Astro, {
420
461
  return pageContext;
421
462
  };
422
463
 
423
- const pwaInfo = {"pwaInDevEnvironment":false,"webManifest":{"href":"/manifest.webmanifest","useCredentials":false,"linkTag":"<link rel=\"manifest\" href=\"/manifest.webmanifest\">"}};
464
+ const pwaInfo = undefined;
424
465
 
425
466
  function isRemoteImage(src) {
426
467
  return /^(https?:)?\/\//.test(src);
@@ -684,7 +725,7 @@ const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
684
725
  isLowResolution: true
685
726
  })).src : "/favicon.ico";
686
727
  const canonicalUrl = new URL(Astro2.url.pathname, Astro2.site || `https://${domain}`);
687
- const cmsSocial = cms("social");
728
+ const cmsMetatags = await cms("metatags");
688
729
  const ogLocale = lang.length === 2 ? lang : lang.substring(0, 2) + lang.slice(3).toUpperCase();
689
730
  let ogImage;
690
731
  if (apiDoc) {
@@ -692,8 +733,8 @@ const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
692
733
  ogImage = picture && picture.url;
693
734
  }
694
735
  if (!ogImage) {
695
- if (cmsSocial.og_image) {
696
- ogImage = cmsSocial.og_image.charAt(0) === "/" ? `https://${domain}${cmsSocial.og_image}` : cmsSocial.og_image;
736
+ if (cmsMetatags?.og_image) {
737
+ ogImage = cmsMetatags.og_image.charAt(0) === "/" ? `https://${domain}${cmsMetatags.og_image}` : cmsMetatags.og_image;
697
738
  }
698
739
  } else {
699
740
  ogImage = ogImage.replace(/(\w+\.)?(ecoms\d)\.com/i, "$2-nyc3.nyc3.cdn.digitaloceanspaces.com");
@@ -717,11 +758,11 @@ const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
717
758
  <meta property="og:type" content="website">
718
759
  <meta property="og:locale"${addAttribute(ogLocale, "content")}>
719
760
  ${ogImage && renderTemplate`<meta property="og:image"${addAttribute(ogImage, "content")}>`}
720
- ${cmsSocial.fb_app_id && renderTemplate`<meta property="fb:app_id"${addAttribute(cmsSocial.fb_app_id, "content")}>`}
761
+ ${cmsMetatags?.fb_app_id && renderTemplate`<meta property="fb:app_id"${addAttribute(cmsMetatags.fb_app_id, "content")}>`}
721
762
  <meta name="twitter:card" content="summary">
722
- ${cmsSocial.twitter_username && renderTemplate`<meta name="twitter:site"${addAttribute(cmsSocial.twitter_username, "content")}>`}
763
+ ${cmsMetatags?.twitter_username && renderTemplate`<meta name="twitter:site"${addAttribute(cmsMetatags.twitter_username, "content")}>`}
723
764
  <meta name="ecom-store-id"${addAttribute(String(storeId), "content")}>
724
- ${pwaInfo && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(pwaInfo.webManifest.linkTag)}` })}`}
765
+ ${pwaInfo }
725
766
  `;
726
767
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro");
727
768
 
@@ -757,7 +798,7 @@ window.storefront = ${JSON.stringify({ settings })};`;
757
798
  if (typeof apiDoc.price === "number") {
758
799
  apiDoc.price = price(apiDoc);
759
800
  }
760
- const slimDocRegex = globalThis.storefront_slim_doc_regex || /body|meta|records|description|i18n/;
801
+ const slimDocRegex = globalThis.storefront_slim_doc_regex || /body_|meta_|metafields|_records|i18n/;
761
802
  const minifyApiDoc = (nestedDoc) => {
762
803
  if (typeof nestedDoc === "object" && nestedDoc) {
763
804
  if (Array.isArray(nestedDoc)) {
@@ -810,16 +851,16 @@ const $$Base$1 = createComponent(async ($$result, $$props, $$slots) => {
810
851
  Astro2.self = $$Base$1;
811
852
  const { pageContext, title } = Astro2.props;
812
853
  const { cms } = pageContext;
813
- const cmsCustomCode = cms("code");
854
+ const cmsCustomCode = await cms("code");
814
855
  return renderTemplate`<head>
815
856
  ${renderComponent($$result, "BaseHead", $$BaseHead, { "pageContext": pageContext, "title": title })}
816
857
  ${renderComponent($$result, "BaseStateJson", $$BaseStateJson, { "pageContext": pageContext })}
817
- ${cmsCustomCode.css && renderTemplate`<style>{cmsCustomCode.css}</style>`}
818
- ${cmsCustomCode.html_head && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(cmsCustomCode.html_head)}` })}`}
858
+ ${cmsCustomCode?.css && renderTemplate`<style>{cmsCustomCode.css}</style>`}
859
+ ${cmsCustomCode?.html_head && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(cmsCustomCode.html_head)}` })}`}
819
860
  ${renderSlot($$result, $$slots["base-head-scripts"])}
820
861
  ${renderSlot($$result, $$slots["before-head-end"])}
821
862
  ${renderHead($$result)}</head>
822
- ${renderComponent($$result, "BaseBody", $$BaseBody, { "pageContext": pageContext }, { "default": () => renderTemplate`${renderSlot($$result, $$slots["default"])}${cmsCustomCode.html_body && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(cmsCustomCode.html_body)}` })}`}${renderSlot($$result, $$slots["base-body-scripts"])}${renderSlot($$result, $$slots["before-body-end"])}` })}`;
863
+ ${renderComponent($$result, "BaseBody", $$BaseBody, { "pageContext": pageContext }, { "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["default"])}${cmsCustomCode?.html_body && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(cmsCustomCode.html_body)}` })}`}${renderSlot($$result2, $$slots["base-body-scripts"])}${renderSlot($$result2, $$slots["before-body-end"])}` })}`;
823
864
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro");
824
865
 
825
866
  var __freeze = Object.freeze;
@@ -838,7 +879,7 @@ const $$Base = createComponent(async ($$result, $$props, $$slots) => {
838
879
  const Astro2 = $$result.createAstro($$Astro$b, $$props, $$slots);
839
880
  Astro2.self = $$Base;
840
881
  const { pageContext, title } = Astro2.props;
841
- return renderTemplate`${renderComponent($$result, "Base", $$Base$1, { "pageContext": pageContext, "title": title }, { "before-head-end": () => renderTemplate`${renderComponent($$result, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": () => renderTemplate`${renderSlot($$result, $$slots["default"])}` })}`;
882
+ return renderTemplate`${renderComponent($$result, "Base", $$Base$1, { "pageContext": pageContext, "title": title }, { "before-head-end": ($$result2) => renderTemplate`${renderComponent($$result2, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["default"])}` })}`;
842
883
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro");
843
884
 
844
885
  const $$Astro$a = createAstro("https://ecom2-002.web.app");
@@ -888,7 +929,7 @@ const $$Picture$1 = createComponent(async ($$result, $$props, $$slots) => {
888
929
  delete image.height;
889
930
  return renderTemplate`${maybeRenderHead($$result)}<picture>
890
931
  ${sources.map((attrs2) => renderTemplate`<source${spreadAttributes(attrs2)}${addAttribute(sizes, "sizes")}>`)}
891
- <img${spreadAttributes(image)}${addAttribute(loading, "loading")}${addAttribute(decoding, "decoding")}${addAttribute(alt, "alt")}${spreadAttributes(attrs)}>
932
+ <img${spreadAttributes(image)}${addAttribute(loading, "loading")}${addAttribute(decoding, "decoding")}${spreadAttributes(attrs)}>
892
933
  </picture>`;
893
934
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/@astrojs/image/components/Picture.astro");
894
935
 
@@ -977,7 +1018,7 @@ loadingGlobalInfoPreset.then((modulesInfoPreset) => {
977
1018
  });
978
1019
  const parsePhrase = (phrase, modName, varName, formatValue = formatMoney) => {
979
1020
  return computed(() => {
980
- const searchString = `{{${varName}}}`;
1021
+ const searchString = `{${varName}}`;
981
1022
  const index = phrase.indexOf(searchString);
982
1023
  if (index > -1) {
983
1024
  const fieldValue = modulesInfo[modName][varName];
@@ -1011,38 +1052,40 @@ const usePitchBar = (props) => {
1011
1052
 
1012
1053
  const carouselKey = Symbol("carousel");
1013
1054
 
1014
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1055
+ const _sfc_main$a = defineComponent({
1015
1056
  __name: "CarouselControl",
1016
- __ssrInlineRender: true,
1017
1057
  props: {
1018
1058
  direction: { default: 1 }
1019
1059
  },
1020
- setup(__props) {
1021
- inject(carouselKey);
1022
- return (_ctx, _push, _parent, _attrs) => {
1023
- _push(`<button${ssrRenderAttrs(mergeProps({
1024
- type: "button",
1025
- "aria-label": __props.direction > 0 ? "Próximo" : "Anterior",
1026
- "data-carousel-control": __props.direction > 0 ? "next" : "previous"
1027
- }, _attrs))}>`);
1028
- ssrRenderSlot(_ctx.$slots, "default", {}, () => {
1029
- _push(`<i class="${ssrRenderClass([__props.direction > 0 ? "i-chevron-right" : "i-chevron-left", "m-0"])}"></i>`);
1030
- }, _push, _parent);
1031
- _push(`</button>`);
1032
- };
1060
+ setup(__props, { expose }) {
1061
+ expose();
1062
+ const { changeSlide } = inject(carouselKey);
1063
+ const __returned__ = { changeSlide };
1064
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1065
+ return __returned__;
1033
1066
  }
1034
1067
  });
1035
-
1036
- const _sfc_setup$7 = _sfc_main$7.setup;
1037
- _sfc_main$7.setup = (props, ctx) => {
1068
+ function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1069
+ _push(`<button${ssrRenderAttrs(mergeProps({
1070
+ type: "button",
1071
+ "aria-label": $props.direction > 0 ? "Pr\xF3ximo" : "Anterior",
1072
+ "data-carousel-control": $props.direction > 0 ? "next" : "previous"
1073
+ }, _attrs))}>`);
1074
+ ssrRenderSlot(_ctx.$slots, "default", {}, () => {
1075
+ _push(`<i class="${ssrRenderClass([$props.direction > 0 ? "i-chevron-right" : "i-chevron-left", "m-0"])}"></i>`);
1076
+ }, _push, _parent);
1077
+ _push(`</button>`);
1078
+ }
1079
+ const _sfc_setup$a = _sfc_main$a.setup;
1080
+ _sfc_main$a.setup = (props, ctx) => {
1038
1081
  const ssrContext = useSSRContext();
1039
1082
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/CarouselControl.vue");
1040
- return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
1083
+ return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
1041
1084
  };
1085
+ const CarouselControl = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
1042
1086
 
1043
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1087
+ const _sfc_main$9 = defineComponent({
1044
1088
  __name: "Carousel",
1045
- __ssrInlineRender: true,
1046
1089
  props: {
1047
1090
  as: { default: "ul" },
1048
1091
  modelValue: { default: 1 },
@@ -1051,7 +1094,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1051
1094
  emits: [
1052
1095
  "update:modelValue"
1053
1096
  ],
1054
- setup(__props, { emit }) {
1097
+ setup(__props, { expose, emit }) {
1098
+ expose();
1055
1099
  const props = __props;
1056
1100
  const currentIndex = ref(props.modelValue - 1);
1057
1101
  watch(toRef(props, "modelValue"), (modelValue) => {
@@ -1155,7 +1199,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1155
1199
  calcCurrentIndex();
1156
1200
  calcIndexCount();
1157
1201
  };
1158
- useDebounceFn(calcOnInit, 400);
1202
+ const onResize = useDebounceFn(calcOnInit, 400);
1159
1203
  onMounted(() => {
1160
1204
  calcOnInit();
1161
1205
  });
@@ -1168,184 +1212,188 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1168
1212
  isBoundLeft,
1169
1213
  isBoundRight
1170
1214
  });
1171
- return (_ctx, _push, _parent, _attrs) => {
1172
- _push(`<div${ssrRenderAttrs(mergeProps({
1173
- ref_key: "carousel",
1174
- ref: carousel,
1175
- "data-carousel": ""
1176
- }, _attrs))}>`);
1177
- ssrRenderVNode(_push, createVNode(resolveDynamicComponent(__props.as), {
1178
- ref_key: "wrapper",
1179
- ref: wrapper,
1180
- "data-carousel-wrapper": ""
1181
- }, {
1182
- default: withCtx((_, _push2, _parent2, _scopeId) => {
1183
- if (_push2) {
1184
- ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
1185
- } else {
1186
- return [
1187
- renderSlot$1(_ctx.$slots, "default")
1188
- ];
1189
- }
1190
- }),
1191
- _: 3
1192
- }), _parent);
1193
- ssrRenderSlot(_ctx.$slots, "controls", {
1194
- changeSlide,
1195
- isBoundLeft: unref(isBoundLeft),
1196
- isBoundRight: unref(isBoundRight),
1197
- currentPage: currentIndex.value + 1,
1198
- pageCount: indexCount.value + 1
1199
- }, () => {
1200
- _push(ssrRenderComponent(_sfc_main$7, { direction: -1 }, {
1201
- default: withCtx((_, _push2, _parent2, _scopeId) => {
1202
- if (_push2) {
1203
- ssrRenderSlot(_ctx.$slots, "previous", {}, null, _push2, _parent2, _scopeId);
1204
- } else {
1205
- return [
1206
- renderSlot$1(_ctx.$slots, "previous")
1207
- ];
1208
- }
1209
- }),
1210
- _: 3
1211
- }, _parent));
1212
- _push(ssrRenderComponent(_sfc_main$7, null, {
1213
- default: withCtx((_, _push2, _parent2, _scopeId) => {
1214
- if (_push2) {
1215
- ssrRenderSlot(_ctx.$slots, "next", {}, null, _push2, _parent2, _scopeId);
1216
- } else {
1217
- return [
1218
- renderSlot$1(_ctx.$slots, "next")
1219
- ];
1220
- }
1221
- }),
1222
- _: 3
1223
- }, _parent));
1224
- }, _push, _parent);
1225
- _push(`</div>`);
1226
- };
1215
+ const __returned__ = { props, emit, currentIndex, wrapper, currentPos, isScrolling, arrivedState, isBoundLeft, isBoundRight, slidesWidth, wrapperScrollWidth, wrapperVisibleWidth, indexCount, calcWrapperWidth, calcSlidesWidth, calcNextWidth, calcCurrentIndex, calcIndexCount, get autoplayTimer() {
1216
+ return autoplayTimer;
1217
+ }, set autoplayTimer(v) {
1218
+ autoplayTimer = v;
1219
+ }, restartAutoplay, changeSlide, carousel, isHovered, calcOnInit, onResize, CarouselControl };
1220
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1221
+ return __returned__;
1227
1222
  }
1228
1223
  });
1229
-
1230
- const _sfc_setup$6 = _sfc_main$6.setup;
1231
- _sfc_main$6.setup = (props, ctx) => {
1224
+ function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1225
+ _push(`<div${ssrRenderAttrs(mergeProps({
1226
+ ref: "carousel",
1227
+ "data-carousel": ""
1228
+ }, _attrs))}>`);
1229
+ ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), {
1230
+ ref: "wrapper",
1231
+ "data-carousel-wrapper": ""
1232
+ }, {
1233
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1234
+ if (_push2) {
1235
+ ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
1236
+ } else {
1237
+ return [
1238
+ renderSlot$1(_ctx.$slots, "default")
1239
+ ];
1240
+ }
1241
+ }),
1242
+ _: 3
1243
+ }), _parent);
1244
+ ssrRenderSlot(_ctx.$slots, "controls", {
1245
+ changeSlide: $setup.changeSlide,
1246
+ isBoundLeft: $setup.isBoundLeft,
1247
+ isBoundRight: $setup.isBoundRight,
1248
+ currentPage: $setup.currentIndex + 1,
1249
+ pageCount: $setup.indexCount + 1
1250
+ }, () => {
1251
+ _push(ssrRenderComponent($setup["CarouselControl"], { direction: -1 }, {
1252
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1253
+ if (_push2) {
1254
+ ssrRenderSlot(_ctx.$slots, "previous", {}, null, _push2, _parent2, _scopeId);
1255
+ } else {
1256
+ return [
1257
+ renderSlot$1(_ctx.$slots, "previous")
1258
+ ];
1259
+ }
1260
+ }),
1261
+ _: 3
1262
+ }, _parent));
1263
+ _push(ssrRenderComponent($setup["CarouselControl"], null, {
1264
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1265
+ if (_push2) {
1266
+ ssrRenderSlot(_ctx.$slots, "next", {}, null, _push2, _parent2, _scopeId);
1267
+ } else {
1268
+ return [
1269
+ renderSlot$1(_ctx.$slots, "next")
1270
+ ];
1271
+ }
1272
+ }),
1273
+ _: 3
1274
+ }, _parent));
1275
+ }, _push, _parent);
1276
+ _push(`</div>`);
1277
+ }
1278
+ const _sfc_setup$9 = _sfc_main$9.setup;
1279
+ _sfc_main$9.setup = (props, ctx) => {
1232
1280
  const ssrContext = useSSRContext();
1233
1281
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Carousel.vue");
1234
- return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
1282
+ return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
1235
1283
  };
1284
+ const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
1236
1285
 
1237
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1286
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1238
1287
  __name: "PitchBar",
1239
- __ssrInlineRender: true,
1240
1288
  props: {
1241
1289
  slides: null
1242
1290
  },
1243
- setup(__props) {
1291
+ setup(__props, { expose }) {
1292
+ expose();
1244
1293
  const props = __props;
1245
1294
  const {
1246
1295
  parsedContents,
1247
1296
  countValidSlides
1248
1297
  } = usePitchBar(props);
1249
- return (_ctx, _push, _parent, _attrs) => {
1250
- _push(`<div${ssrRenderAttrs(mergeProps({ class: "bg-base-100 relative z-1" }, _attrs))}><div class="container md:w-2/3 mx-auto px-3 py-1">`);
1251
- _push(ssrRenderComponent(_sfc_main$6, {
1252
- autoplay: unref(countValidSlides) > 1 ? 7e3 : null
1253
- }, {
1254
- controls: withCtx((_, _push2, _parent2, _scopeId) => {
1255
- if (_push2) {
1256
- _push2(`<div style="${ssrRenderStyle(unref(countValidSlides) > 1 ? null : { display: "none" })}" class="text-xl leading-none text-base-400"${_scopeId}>`);
1257
- _push2(ssrRenderComponent(_sfc_main$7, {
1298
+ const __returned__ = { props, parsedContents, countValidSlides, Carousel, CarouselControl };
1299
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1300
+ return __returned__;
1301
+ }
1302
+ });
1303
+ function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1304
+ _push(`<div${ssrRenderAttrs(mergeProps({ class: "bg-base-100 relative z-1" }, _attrs))}><div class="container md:w-2/3 mx-auto px-3 py-1">`);
1305
+ _push(ssrRenderComponent($setup["Carousel"], {
1306
+ autoplay: $setup.countValidSlides > 1 ? 7e3 : null
1307
+ }, {
1308
+ controls: withCtx((_, _push2, _parent2, _scopeId) => {
1309
+ if (_push2) {
1310
+ _push2(`<div style="${ssrRenderStyle($setup.countValidSlides > 1 ? null : { display: "none" })}" class="text-xl leading-none text-base-400"${_scopeId}>`);
1311
+ _push2(ssrRenderComponent($setup["CarouselControl"], {
1312
+ direction: -1,
1313
+ class: "pr-2 bg-base-100 hover:text-base-700"
1314
+ }, null, _parent2, _scopeId));
1315
+ _push2(ssrRenderComponent($setup["CarouselControl"], { class: "pl-2 bg-base-100 hover:text-base-700" }, null, _parent2, _scopeId));
1316
+ _push2(`</div>`);
1317
+ } else {
1318
+ return [
1319
+ withDirectives(createVNode("div", { class: "text-xl leading-none text-base-400" }, [
1320
+ createVNode($setup["CarouselControl"], {
1258
1321
  direction: -1,
1259
1322
  class: "pr-2 bg-base-100 hover:text-base-700"
1260
- }, null, _parent2, _scopeId));
1261
- _push2(ssrRenderComponent(_sfc_main$7, { class: "pl-2 bg-base-100 hover:text-base-700" }, null, _parent2, _scopeId));
1262
- _push2(`</div>`);
1263
- } else {
1264
- return [
1265
- withDirectives(createVNode("div", { class: "text-xl leading-none text-base-400" }, [
1266
- createVNode(_sfc_main$7, {
1267
- direction: -1,
1268
- class: "pr-2 bg-base-100 hover:text-base-700"
1269
- }),
1270
- createVNode(_sfc_main$7, { class: "pl-2 bg-base-100 hover:text-base-700" })
1271
- ], 512), [
1272
- [vShow, unref(countValidSlides) > 1]
1273
- ])
1274
- ];
1275
- }
1276
- }),
1277
- default: withCtx((_, _push2, _parent2, _scopeId) => {
1278
- if (_push2) {
1279
- _push2(`<!--[-->`);
1280
- ssrRenderList(__props.slides, (slide, i) => {
1281
- _push2(`<li${_scopeId}>`);
1282
- ssrRenderVNode(_push2, createVNode(resolveDynamicComponent(slide.href ? "ALink" : "span"), {
1323
+ }),
1324
+ createVNode($setup["CarouselControl"], { class: "pl-2 bg-base-100 hover:text-base-700" })
1325
+ ], 512), [
1326
+ [vShow, $setup.countValidSlides > 1]
1327
+ ])
1328
+ ];
1329
+ }
1330
+ }),
1331
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1332
+ if (_push2) {
1333
+ _push2(`<!--[-->`);
1334
+ ssrRenderList($props.slides, (slide, i) => {
1335
+ _push2(`<li${_scopeId}>`);
1336
+ ssrRenderVNode(_push2, createVNode(resolveDynamicComponent(slide.href ? "ALink" : "span"), {
1337
+ href: slide.href,
1338
+ target: slide.target,
1339
+ class: ["inline-block px-8", slide.href ? "hover:underline" : null]
1340
+ }, {
1341
+ default: withCtx((_2, _push3, _parent3, _scopeId2) => {
1342
+ if (_push3) {
1343
+ if ($setup.parsedContents[i]) {
1344
+ _push3(`<span class="prose text-sm text-base-800"${_scopeId2}>${$setup.parsedContents[i]}</span>`);
1345
+ } else {
1346
+ _push3(`<!---->`);
1347
+ }
1348
+ } else {
1349
+ return [
1350
+ $setup.parsedContents[i] ? (openBlock(), createBlock("span", {
1351
+ key: 0,
1352
+ innerHTML: $setup.parsedContents[i],
1353
+ class: "prose text-sm text-base-800"
1354
+ }, null, 8, ["innerHTML"])) : createCommentVNode("", true)
1355
+ ];
1356
+ }
1357
+ }),
1358
+ _: 2
1359
+ }), _parent2, _scopeId);
1360
+ _push2(`</li>`);
1361
+ });
1362
+ _push2(`<!--]-->`);
1363
+ } else {
1364
+ return [
1365
+ (openBlock(true), createBlock(Fragment$1, null, renderList($props.slides, (slide, i) => {
1366
+ return openBlock(), createBlock("li", { key: i }, [
1367
+ (openBlock(), createBlock(resolveDynamicComponent(slide.href ? "ALink" : "span"), {
1283
1368
  href: slide.href,
1284
1369
  target: slide.target,
1285
1370
  class: ["inline-block px-8", slide.href ? "hover:underline" : null]
1286
1371
  }, {
1287
- default: withCtx((_2, _push3, _parent3, _scopeId2) => {
1288
- if (_push3) {
1289
- if (unref(parsedContents)[i]) {
1290
- _push3(`<span class="prose text-sm text-base-800"${_scopeId2}>${unref(parsedContents)[i]}</span>`);
1291
- } else {
1292
- _push3(`<!---->`);
1293
- }
1294
- } else {
1295
- return [
1296
- unref(parsedContents)[i] ? (openBlock(), createBlock("span", {
1297
- key: 0,
1298
- innerHTML: unref(parsedContents)[i],
1299
- class: "prose text-sm text-base-800"
1300
- }, null, 8, ["innerHTML"])) : createCommentVNode("", true)
1301
- ];
1302
- }
1303
- }),
1372
+ default: withCtx(() => [
1373
+ $setup.parsedContents[i] ? (openBlock(), createBlock("span", {
1374
+ key: 0,
1375
+ innerHTML: $setup.parsedContents[i],
1376
+ class: "prose text-sm text-base-800"
1377
+ }, null, 8, ["innerHTML"])) : createCommentVNode("", true)
1378
+ ]),
1304
1379
  _: 2
1305
- }), _parent2, _scopeId);
1306
- _push2(`</li>`);
1307
- });
1308
- _push2(`<!--]-->`);
1309
- } else {
1310
- return [
1311
- (openBlock(true), createBlock(Fragment$1, null, renderList(__props.slides, (slide, i) => {
1312
- return openBlock(), createBlock("li", { key: i }, [
1313
- (openBlock(), createBlock(resolveDynamicComponent(slide.href ? "ALink" : "span"), {
1314
- href: slide.href,
1315
- target: slide.target,
1316
- class: ["inline-block px-8", slide.href ? "hover:underline" : null]
1317
- }, {
1318
- default: withCtx(() => [
1319
- unref(parsedContents)[i] ? (openBlock(), createBlock("span", {
1320
- key: 0,
1321
- innerHTML: unref(parsedContents)[i],
1322
- class: "prose text-sm text-base-800"
1323
- }, null, 8, ["innerHTML"])) : createCommentVNode("", true)
1324
- ]),
1325
- _: 2
1326
- }, 1032, ["href", "target", "class"]))
1327
- ]);
1328
- }), 128))
1329
- ];
1330
- }
1331
- }),
1332
- _: 1
1333
- }, _parent));
1334
- _push(`</div></div>`);
1335
- };
1336
- }
1337
- });
1338
-
1339
- const _sfc_setup$5 = _sfc_main$5.setup;
1340
- _sfc_main$5.setup = (props, ctx) => {
1380
+ }, 1032, ["href", "target", "class"]))
1381
+ ]);
1382
+ }), 128))
1383
+ ];
1384
+ }
1385
+ }),
1386
+ _: 1
1387
+ }, _parent));
1388
+ _push(`</div></div>`);
1389
+ }
1390
+ const _sfc_setup$8 = _sfc_main$8.setup;
1391
+ _sfc_main$8.setup = (props, ctx) => {
1341
1392
  const ssrContext = useSSRContext();
1342
1393
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/PitchBar.vue");
1343
- return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
1394
+ return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
1344
1395
  };
1345
-
1346
- const i19myAccount = "Minha conta";
1347
- const i19openCart = "Abrir carrinho";
1348
- const i19searchProducts = "Buscar produtos";
1396
+ const PitchBar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["ssrRender", _sfc_ssrRender$8]]);
1349
1397
 
1350
1398
  const useStickyHeader = (props) => {
1351
1399
  const {
@@ -1389,9 +1437,58 @@ const useStickyHeader = (props) => {
1389
1437
  };
1390
1438
  };
1391
1439
 
1392
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1440
+ const filterMainCategories = (categories) => {
1441
+ return categories.filter(({ slug, parent }) => {
1442
+ return slug && !parent;
1443
+ });
1444
+ };
1445
+ const filterSubcategories = (categories, parentCategory) => {
1446
+ return categories.filter(({ slug, parent }) => {
1447
+ if (slug && parent) {
1448
+ return parent._id === parentCategory._id || parent.slug && parent.slug === parentCategory.slug;
1449
+ }
1450
+ return false;
1451
+ });
1452
+ };
1453
+ const useShopHeader = (props) => {
1454
+ const { header } = props;
1455
+ const {
1456
+ isSticky,
1457
+ staticHeight,
1458
+ staticY
1459
+ } = useStickyHeader({ header });
1460
+ const positionY = computed(() => {
1461
+ return isSticky.value ? header.value.offsetHeight : staticY.value;
1462
+ });
1463
+ const mainCategories = filterMainCategories(props.categories);
1464
+ const getSubcategories = (parentCategory) => {
1465
+ return filterSubcategories(props.categories, parentCategory);
1466
+ };
1467
+ const getCategoryTree = (parentCategory) => {
1468
+ return {
1469
+ ...parentCategory,
1470
+ subcategories: getSubcategories(parentCategory).map((subcategory) => {
1471
+ return getCategoryTree(subcategory);
1472
+ })
1473
+ };
1474
+ };
1475
+ const categoryTrees = mainCategories.map(getCategoryTree);
1476
+ const isSidenavOpen = ref(false);
1477
+ return {
1478
+ isSticky,
1479
+ staticHeight,
1480
+ staticY,
1481
+ positionY,
1482
+ mainCategories,
1483
+ getSubcategories,
1484
+ getCategoryTree,
1485
+ categoryTrees,
1486
+ isSidenavOpen
1487
+ };
1488
+ };
1489
+
1490
+ const _sfc_main$7 = defineComponent({
1393
1491
  __name: "Drawer",
1394
- __ssrInlineRender: true,
1395
1492
  props: {
1396
1493
  modelValue: { type: Boolean, default: false },
1397
1494
  placement: { default: "start" },
@@ -1401,7 +1498,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1401
1498
  emits: [
1402
1499
  "update:modelValue"
1403
1500
  ],
1404
- setup(__props, { emit }) {
1501
+ setup(__props, { expose, emit }) {
1502
+ expose();
1405
1503
  const props = __props;
1406
1504
  const close = () => emit("update:modelValue", false);
1407
1505
  const drawer = ref(null);
@@ -1446,247 +1544,471 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1446
1544
  const isPlacementX = computed(() => {
1447
1545
  return props.placement === "start" || props.placement === "end";
1448
1546
  });
1449
- return (_ctx, _push, _parent, _attrs) => {
1450
- const _component_Fade = resolveComponent("Fade");
1451
- _push(ssrRenderComponent(_component_Fade, mergeProps({
1452
- slide: unref(slideTo),
1453
- speed: "slow",
1454
- "is-floating": ""
1455
- }, _attrs), {
1456
- default: withCtx((_, _push2, _parent2, _scopeId) => {
1457
- if (_push2) {
1458
- if (__props.modelValue) {
1459
- _push2(`<dialog class="${ssrRenderClass([[
1460
- __props.position,
1461
- unref(isFixed) ? `top-0 left-0 ${unref(isPlacementX) ? "h-screen" : ""}` : null
1462
- ], "w-screen max-w-sm shadow p-0 m-0 z-50"])}"${ssrIncludeBooleanAttr(__props.modelValue) ? " open" : ""}${ssrRenderAttr("data-drawer", __props.placement)}${_scopeId}><div class="relative"${_scopeId}>`);
1463
- if (__props.hasCloseButton) {
1464
- _push2(`<button type="button"${ssrRenderAttr("aria-label", "Fechar")} class="${ssrRenderClass([__props.placement === "end" ? "left-2" : "right-2", "absolute top-2"])}" data-drawer-close${_scopeId}>`);
1465
- ssrRenderSlot(_ctx.$slots, "close", {}, () => {
1466
- _push2(`<i class="i-close text-base-400 text-3xl"${_scopeId}></i>`);
1467
- }, _push2, _parent2, _scopeId);
1468
- _push2(`</button>`);
1469
- } else {
1470
- _push2(`<!---->`);
1471
- }
1472
- ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
1473
- _push2(`</div>`);
1474
- ssrRenderTeleport(_push2, (_push3) => {
1475
- _push3(ssrRenderComponent(_component_Fade, null, {
1476
- default: withCtx((_2, _push4, _parent3, _scopeId2) => {
1477
- if (_push4) {
1478
- if (__props.modelValue) {
1479
- _push4(`<div class="fixed top-0 left-0 w-screen h-screen bg-black/50 z-40" data-drawer-backdrop${_scopeId2}></div>`);
1480
- } else {
1481
- _push4(`<!---->`);
1482
- }
1483
- } else {
1484
- return [
1485
- __props.modelValue ? (openBlock(), createBlock("div", {
1486
- key: 0,
1487
- class: "fixed top-0 left-0 w-screen h-screen bg-black/50 z-40",
1488
- "data-drawer-backdrop": ""
1489
- })) : createCommentVNode("", true)
1490
- ];
1491
- }
1492
- }),
1493
- _: 1
1494
- }, _parent2, _scopeId));
1495
- }, "#teleported-top", false, _parent2);
1496
- _push2(`</dialog>`);
1497
- } else {
1498
- _push2(`<!---->`);
1499
- }
1547
+ const __returned__ = { props, emit, close, drawer, outsideClickListener, escClickListener, slideTo, isFixed, isPlacementX };
1548
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1549
+ return __returned__;
1550
+ }
1551
+ });
1552
+ function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1553
+ const _component_Fade = resolveComponent("Fade");
1554
+ _push(ssrRenderComponent(_component_Fade, mergeProps({
1555
+ slide: $setup.slideTo,
1556
+ speed: "slow",
1557
+ "is-floating": ""
1558
+ }, _attrs), {
1559
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1560
+ if (_push2) {
1561
+ if ($props.modelValue) {
1562
+ _push2(`<dialog class="${ssrRenderClass([[
1563
+ $props.position,
1564
+ $setup.isFixed ? `top-0 left-0 ${$setup.isPlacementX ? "h-screen" : ""}` : null
1565
+ ], "w-screen max-w-sm shadow p-0 m-0 z-50"])}"${ssrIncludeBooleanAttr($props.modelValue) ? " open" : ""}${ssrRenderAttr("data-drawer", $props.placement)}${_scopeId}><div class="relative h-full"${_scopeId}>`);
1566
+ if ($props.hasCloseButton) {
1567
+ _push2(`<button type="button"${ssrRenderAttr("aria-label", "Fechar")} class="${ssrRenderClass([$props.placement === "end" ? "left-2" : "right-2", "absolute top-2"])}" data-drawer-close${_scopeId}>`);
1568
+ ssrRenderSlot(_ctx.$slots, "close", {}, () => {
1569
+ _push2(`<i class="i-close text-base-400 text-3xl"${_scopeId}></i>`);
1570
+ }, _push2, _parent2, _scopeId);
1571
+ _push2(`</button>`);
1500
1572
  } else {
1501
- return [
1502
- __props.modelValue ? (openBlock(), createBlock("dialog", {
1573
+ _push2(`<!---->`);
1574
+ }
1575
+ ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
1576
+ _push2(`</div>`);
1577
+ ssrRenderTeleport(_push2, (_push3) => {
1578
+ _push3(ssrRenderComponent(_component_Fade, null, {
1579
+ default: withCtx((_2, _push4, _parent3, _scopeId2) => {
1580
+ if (_push4) {
1581
+ if ($props.modelValue) {
1582
+ _push4(`<div class="fixed top-0 left-0 w-screen h-screen bg-black/50 z-40" data-drawer-backdrop${_scopeId2}></div>`);
1583
+ } else {
1584
+ _push4(`<!---->`);
1585
+ }
1586
+ } else {
1587
+ return [
1588
+ $props.modelValue ? (openBlock(), createBlock("div", {
1589
+ key: 0,
1590
+ class: "fixed top-0 left-0 w-screen h-screen bg-black/50 z-40",
1591
+ "data-drawer-backdrop": ""
1592
+ })) : createCommentVNode("", true)
1593
+ ];
1594
+ }
1595
+ }),
1596
+ _: 1
1597
+ }, _parent2, _scopeId));
1598
+ }, "#teleported-top", false, _parent2);
1599
+ _push2(`</dialog>`);
1600
+ } else {
1601
+ _push2(`<!---->`);
1602
+ }
1603
+ } else {
1604
+ return [
1605
+ $props.modelValue ? (openBlock(), createBlock("dialog", {
1606
+ key: 0,
1607
+ ref: "drawer",
1608
+ class: ["w-screen max-w-sm shadow p-0 m-0 z-50", [
1609
+ $props.position,
1610
+ $setup.isFixed ? `top-0 left-0 ${$setup.isPlacementX ? "h-screen" : ""}` : null
1611
+ ]],
1612
+ open: $props.modelValue,
1613
+ "data-drawer": $props.placement
1614
+ }, [
1615
+ createVNode("div", { class: "relative h-full" }, [
1616
+ $props.hasCloseButton ? (openBlock(), createBlock("button", {
1503
1617
  key: 0,
1504
- ref_key: "drawer",
1505
- ref: drawer,
1506
- class: ["w-screen max-w-sm shadow p-0 m-0 z-50", [
1507
- __props.position,
1508
- unref(isFixed) ? `top-0 left-0 ${unref(isPlacementX) ? "h-screen" : ""}` : null
1509
- ]],
1510
- open: __props.modelValue,
1511
- "data-drawer": __props.placement
1618
+ type: "button",
1619
+ "aria-label": "Fechar",
1620
+ onClick: withModifiers($setup.close, ["prevent"]),
1621
+ class: ["absolute top-2", $props.placement === "end" ? "left-2" : "right-2"],
1622
+ "data-drawer-close": ""
1512
1623
  }, [
1513
- createVNode("div", { class: "relative" }, [
1514
- __props.hasCloseButton ? (openBlock(), createBlock("button", {
1624
+ renderSlot$1(_ctx.$slots, "close", {}, () => [
1625
+ createVNode("i", { class: "i-close text-base-400 text-3xl" })
1626
+ ])
1627
+ ], 10, ["onClick"])) : createCommentVNode("", true),
1628
+ renderSlot$1(_ctx.$slots, "default")
1629
+ ]),
1630
+ (openBlock(), createBlock(Teleport, { to: "#teleported-top" }, [
1631
+ createVNode(_component_Fade, null, {
1632
+ default: withCtx(() => [
1633
+ $props.modelValue ? (openBlock(), createBlock("div", {
1515
1634
  key: 0,
1516
- type: "button",
1517
- "aria-label": "Fechar",
1518
- onClick: withModifiers(close, ["prevent"]),
1519
- class: ["absolute top-2", __props.placement === "end" ? "left-2" : "right-2"],
1520
- "data-drawer-close": ""
1521
- }, [
1522
- renderSlot$1(_ctx.$slots, "close", {}, () => [
1523
- createVNode("i", { class: "i-close text-base-400 text-3xl" })
1524
- ])
1525
- ], 10, ["onClick"])) : createCommentVNode("", true),
1526
- renderSlot$1(_ctx.$slots, "default")
1635
+ class: "fixed top-0 left-0 w-screen h-screen bg-black/50 z-40",
1636
+ "data-drawer-backdrop": ""
1637
+ })) : createCommentVNode("", true)
1527
1638
  ]),
1528
- (openBlock(), createBlock(Teleport, { to: "#teleported-top" }, [
1529
- createVNode(_component_Fade, null, {
1530
- default: withCtx(() => [
1531
- __props.modelValue ? (openBlock(), createBlock("div", {
1532
- key: 0,
1533
- class: "fixed top-0 left-0 w-screen h-screen bg-black/50 z-40",
1534
- "data-drawer-backdrop": ""
1535
- })) : createCommentVNode("", true)
1536
- ]),
1537
- _: 1
1538
- })
1539
- ]))
1540
- ], 10, ["open", "data-drawer"])) : createCommentVNode("", true)
1541
- ];
1542
- }
1543
- }),
1544
- _: 3
1545
- }, _parent));
1546
- };
1639
+ _: 1
1640
+ })
1641
+ ]))
1642
+ ], 10, ["open", "data-drawer"])) : createCommentVNode("", true)
1643
+ ];
1644
+ }
1645
+ }),
1646
+ _: 3
1647
+ }, _parent));
1648
+ }
1649
+ const _sfc_setup$7 = _sfc_main$7.setup;
1650
+ _sfc_main$7.setup = (props, ctx) => {
1651
+ const ssrContext = useSSRContext();
1652
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Drawer.vue");
1653
+ return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
1654
+ };
1655
+ const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
1656
+
1657
+ const useStorage = (key, initialValue, storage = localStorage) => {
1658
+ let persistedValue;
1659
+ const sessionJson = storage.getItem(key);
1660
+ if (sessionJson) {
1661
+ try {
1662
+ persistedValue = JSON.parse(sessionJson);
1663
+ } catch (e) {
1664
+ persistedValue = null;
1665
+ storage.removeItem(key);
1666
+ }
1547
1667
  }
1668
+ const state = reactive(persistedValue || initialValue);
1669
+ watch(state, () => {
1670
+ storage.setItem(key, JSON.stringify(state));
1671
+ });
1672
+ return state;
1673
+ };
1674
+
1675
+ const storageKey = "SESSION";
1676
+ const emptySession = {
1677
+ customer: {
1678
+ display_name: "",
1679
+ main_email: ""
1680
+ },
1681
+ auth: null
1682
+ };
1683
+ const session = useStorage(storageKey, emptySession);
1684
+ const isAuthenticated = computed(() => {
1685
+ const { auth } = session;
1686
+ return auth && new Date(auth.expires).getTime() - Date.now() > 1e3 * 10;
1548
1687
  });
1688
+ const customer = computed(() => session.customer);
1689
+ const customerName = computed(() => nickname(customer.value));
1690
+ computed({
1691
+ get() {
1692
+ return customer.value.main_email;
1693
+ },
1694
+ set(email) {
1695
+ session.customer.main_email = email;
1696
+ }
1697
+ });
1698
+ let firebaseAuth;
1699
+ const isLogged = computed(() => {
1700
+ return isAuthenticated.value || !!firebaseAuth?.currentUser?.emailVerified;
1701
+ });
1702
+ const logout = () => {
1703
+ session.auth = emptySession.auth;
1704
+ session.customer = emptySession.customer;
1705
+ localStorage.removeItem(storageKey);
1706
+ firebaseAuth.signOut();
1707
+ };
1708
+ const initializeFirebaseAuth = (canWaitIdle = !window.location.pathname.startsWith("/app/")) => {
1709
+ return;
1710
+ };
1549
1711
 
1712
+ const {
1713
+ settings,
1714
+ context: apiContext
1715
+ } = globalThis.storefront;
1716
+ const networkNames = [
1717
+ "whatsapp",
1718
+ "instagram",
1719
+ "facebook",
1720
+ "twitter",
1721
+ "youtube",
1722
+ "tiktok",
1723
+ "pinterest"
1724
+ ];
1725
+ const socialNetworks = {};
1726
+ networkNames.forEach((network) => {
1727
+ if (settings[network]) {
1728
+ socialNetworks[network] = settings[network];
1729
+ }
1730
+ });
1731
+
1732
+ let userAgent;
1733
+ {
1734
+ userAgent = "";
1735
+ }
1736
+ userAgent.includes("Safari") && !userAgent.includes("Chrome");
1737
+ const isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream;
1738
+ const isMobile = isIOS || /Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
1739
+
1740
+ const _sfc_main$6 = defineComponent({
1741
+ __name: "SocialNetworkIcon",
1742
+ props: {
1743
+ as: { default: "i" },
1744
+ network: null
1745
+ },
1746
+ setup(__props, { expose }) {
1747
+ expose();
1748
+ const props = __props;
1749
+ const iconClassName = computed(() => {
1750
+ switch (props.network) {
1751
+ case "facebook":
1752
+ return "i-facebook";
1753
+ case "instagram":
1754
+ return "i-instagram";
1755
+ case "whatsapp":
1756
+ return "i-whatsapp";
1757
+ case "youtube":
1758
+ return "i-youtube";
1759
+ case "pinterest":
1760
+ return "i-pinterest";
1761
+ case "tiktok":
1762
+ return "i-tiktok";
1763
+ case "twitter":
1764
+ return "i-twitter";
1765
+ default:
1766
+ return "";
1767
+ }
1768
+ });
1769
+ const __returned__ = { props, iconClassName };
1770
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1771
+ return __returned__;
1772
+ }
1773
+ });
1774
+ function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1775
+ ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), mergeProps({ class: $setup.iconClassName }, _attrs), null), _parent);
1776
+ }
1777
+ const _sfc_setup$6 = _sfc_main$6.setup;
1778
+ _sfc_main$6.setup = (props, ctx) => {
1779
+ const ssrContext = useSSRContext();
1780
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkIcon.vue");
1781
+ return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
1782
+ };
1783
+ const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
1784
+
1785
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1786
+ __name: "SocialNetworkLink",
1787
+ props: {
1788
+ network: null,
1789
+ href: null,
1790
+ message: null
1791
+ },
1792
+ setup(__props, { expose }) {
1793
+ expose();
1794
+ const props = __props;
1795
+ const fixedHref = computed(() => {
1796
+ let href = props.href || socialNetworks[props.network];
1797
+ if (props.network === "whatsapp") {
1798
+ const tel = href.replace(/[^+\d]/g, "");
1799
+ href = `https://${isMobile ? "api" : "web"}.whatsapp.com/send?phone=` + encodeURIComponent(tel.charAt(0) === "+" ? tel : `+55${tel}`);
1800
+ if (props.message) {
1801
+ href += `&text=${encodeURIComponent(props.message)}`;
1802
+ }
1803
+ }
1804
+ return href;
1805
+ });
1806
+ const __returned__ = { props, fixedHref, SocialNetworkIcon };
1807
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1808
+ return __returned__;
1809
+ }
1810
+ });
1811
+ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1812
+ const _component_ALink = resolveComponent("ALink");
1813
+ _push(ssrRenderComponent(_component_ALink, mergeProps({ href: $setup.fixedHref }, _attrs), {
1814
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1815
+ if (_push2) {
1816
+ ssrRenderSlot(_ctx.$slots, "default", {}, () => {
1817
+ _push2(ssrRenderComponent($setup["SocialNetworkIcon"], { network: $props.network }, null, _parent2, _scopeId));
1818
+ ssrRenderSlot(_ctx.$slots, "append", {}, null, _push2, _parent2, _scopeId);
1819
+ }, _push2, _parent2, _scopeId);
1820
+ } else {
1821
+ return [
1822
+ renderSlot$1(_ctx.$slots, "default", {}, () => [
1823
+ createVNode($setup["SocialNetworkIcon"], { network: $props.network }, null, 8, ["network"]),
1824
+ renderSlot$1(_ctx.$slots, "append")
1825
+ ])
1826
+ ];
1827
+ }
1828
+ }),
1829
+ _: 3
1830
+ }, _parent));
1831
+ }
1832
+ const _sfc_setup$5 = _sfc_main$5.setup;
1833
+ _sfc_main$5.setup = (props, ctx) => {
1834
+ const ssrContext = useSSRContext();
1835
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkLink.vue");
1836
+ return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
1837
+ };
1838
+ const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
1839
+
1840
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1841
+ __name: "ShopSidenavCategory",
1842
+ props: {
1843
+ categoryTree: null
1844
+ },
1845
+ setup(__props, { expose }) {
1846
+ expose();
1847
+ const isOpen = ref(false);
1848
+ const isFaded = ref(true);
1849
+ watch(isOpen, (_isOpen) => {
1850
+ if (_isOpen) {
1851
+ setTimeout(() => {
1852
+ isFaded.value = false;
1853
+ }, 25);
1854
+ } else {
1855
+ isFaded.value = true;
1856
+ }
1857
+ });
1858
+ const __returned__ = { isOpen, isFaded };
1859
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1860
+ return __returned__;
1861
+ }
1862
+ });
1863
+ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1864
+ const _component_ShopSidenavCategory = resolveComponent("ShopSidenavCategory", true);
1865
+ _push(`<li${ssrRenderAttrs(mergeProps({ class: "text-lg text-base-800" }, _attrs))}>`);
1866
+ if ($props.categoryTree.subcategories.length) {
1867
+ _push(`<details class="bg-white overflow-y-auto overflow-x-hidden z-10 open:absolute open:top-0 open:left-0 open:w-full open:h-full"><summary class="${ssrRenderClass([$setup.isOpen ? "bg-base-100" : null, "cursor-pointer list-none px-6 py-3 active:bg-base-100 transition-colors"])}"><i class="${ssrRenderClass(!$setup.isOpen ? "i-arrow-right float-right mb-0 mt-1 text-xl text-base-500" : "i-arrow-left text-lg")}"></i>`);
1868
+ if (!$setup.isOpen && $props.categoryTree.icon) {
1869
+ _push(`<img loading="lazy"${ssrRenderAttr("src", $props.categoryTree.icon.url)} class="w-auto h-5 inline mr-3">`);
1870
+ } else {
1871
+ _push(`<!---->`);
1872
+ }
1873
+ _push(`<h3 class="${ssrRenderClass([$setup.isOpen ? "ml-4 text-base" : null, "inline"])}">${ssrInterpolate($props.categoryTree.name)}</h3></summary><ul class="${ssrRenderClass([$setup.isFaded ? "opacity-20" : "opacity-100", "mt-2 transition-opacity"])}" tabindex="-1"><!--[-->`);
1874
+ ssrRenderList($props.categoryTree.subcategories, (subcategoryTree) => {
1875
+ _push(ssrRenderComponent(_component_ShopSidenavCategory, {
1876
+ key: subcategoryTree._id,
1877
+ "category-tree": subcategoryTree
1878
+ }, null, _parent));
1879
+ });
1880
+ _push(`<!--]--><li><a${ssrRenderAttr("href", `/${$props.categoryTree.slug}`)} class="block px-6 py-3 text-base underline active:bg-base-200">${ssrInterpolate("Ver toda a categoria $1".replace("$1", $props.categoryTree.name))}</a></li></ul></details>`);
1881
+ } else {
1882
+ _push(`<a${ssrRenderAttr("href", `/${$props.categoryTree.slug}`)} class="block px-6 py-3 active:bg-base-200">`);
1883
+ if (!$setup.isOpen && $props.categoryTree.icon) {
1884
+ _push(`<img loading="lazy"${ssrRenderAttr("src", $props.categoryTree.icon.url)} class="w-auto h-5 inline mr-3">`);
1885
+ } else {
1886
+ _push(`<!---->`);
1887
+ }
1888
+ _push(`<h3 class="inline">${ssrInterpolate($props.categoryTree.name)}</h3></a>`);
1889
+ }
1890
+ _push(`</li>`);
1891
+ }
1550
1892
  const _sfc_setup$4 = _sfc_main$4.setup;
1551
1893
  _sfc_main$4.setup = (props, ctx) => {
1552
1894
  const ssrContext = useSSRContext();
1553
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Drawer.vue");
1895
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenavCategory.vue");
1554
1896
  return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
1555
1897
  };
1898
+ const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
1556
1899
 
1557
1900
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1558
1901
  __name: "ShopSidenav",
1559
- __ssrInlineRender: true,
1560
1902
  props: {
1561
- categories: null
1903
+ categoryTrees: null
1562
1904
  },
1563
- setup(__props) {
1564
- const props = __props;
1565
- const mainCategories = props.categories.filter(({ slug, parent }) => {
1566
- return slug && !parent;
1567
- });
1568
- return (_ctx, _push, _parent, _attrs) => {
1569
- _push(`<aside${ssrRenderAttrs(mergeProps({ "data-sidenav": "" }, _attrs))}><nav class="py-5" data-sidenav-nav><ul><!--[-->`);
1570
- ssrRenderList(unref(mainCategories), (mainCategory) => {
1571
- _push(`<li><a${ssrRenderAttr("href", `/${mainCategory.slug}`)}>${ssrInterpolate(mainCategory.name)}</a></li>`);
1572
- });
1573
- _push(`<!--]--></ul></nav></aside>`);
1574
- };
1905
+ setup(__props, { expose }) {
1906
+ expose();
1907
+ onMounted(() => initializeFirebaseAuth());
1908
+ const __returned__ = { get customerName() {
1909
+ return customerName;
1910
+ }, get isLogged() {
1911
+ return isLogged;
1912
+ }, get logout() {
1913
+ return logout;
1914
+ }, get socialNetworks() {
1915
+ return socialNetworks;
1916
+ }, SocialNetworkLink, ShopSidenavCategory };
1917
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1918
+ return __returned__;
1575
1919
  }
1576
1920
  });
1577
-
1921
+ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1922
+ _push(`<aside${ssrRenderAttrs(mergeProps({ class: "flex flex-col h-full" }, _attrs))}><nav class="py-4 grow"><ul class="relative h-full"><!--[-->`);
1923
+ ssrRenderList($props.categoryTrees, (categoryTree) => {
1924
+ _push(ssrRenderComponent($setup["ShopSidenavCategory"], {
1925
+ key: categoryTree._id,
1926
+ "category-tree": categoryTree
1927
+ }, null, _parent));
1928
+ });
1929
+ _push(`<!--]--></ul></nav><footer class="text-base"><div class="flex items-center px-2 py-4 bg-base-100"><a href="/app/account" class="p-2 grow flex items-center gap-3"><i class="i-account text-4xl text-base-500 m-0"></i><span class="leading-tight">${ssrInterpolate(`${"Ol\xE1"} ${$setup.customerName || "Visitante"}`)} <small class="block lowercase font-semibold text-primary">${ssrInterpolate("Meus pedidos")}, ${ssrInterpolate("Minha conta")}</small></span></a>`);
1930
+ if ($setup.isLogged) {
1931
+ _push(`<button class="p-2 text-right text-base-800"><span class="text-base-600">${ssrInterpolate("Sair")}</span><i class="i-logout text-lg ml-1"></i></button>`);
1932
+ } else {
1933
+ _push(`<!---->`);
1934
+ }
1935
+ _push(`</div><ul class="flex gap-3 p-4 bg-base-200 text-xl text-base-700"><!--[-->`);
1936
+ ssrRenderList($setup.socialNetworks, (href, network) => {
1937
+ _push(`<li>`);
1938
+ _push(ssrRenderComponent($setup["SocialNetworkLink"], {
1939
+ network,
1940
+ class: "p-1 active:text-primary"
1941
+ }, null, _parent));
1942
+ _push(`</li>`);
1943
+ });
1944
+ _push(`<!--]--></ul></footer></aside>`);
1945
+ }
1578
1946
  const _sfc_setup$3 = _sfc_main$3.setup;
1579
1947
  _sfc_main$3.setup = (props, ctx) => {
1580
1948
  const ssrContext = useSSRContext();
1581
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/ShopSidenav.vue");
1949
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenav.vue");
1582
1950
  return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
1583
1951
  };
1952
+ const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["ssrRender", _sfc_ssrRender$3]]);
1584
1953
 
1585
1954
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1586
1955
  __name: "ShopHeader",
1587
- __ssrInlineRender: true,
1588
1956
  props: {
1589
1957
  categories: null
1590
1958
  },
1591
- setup(__props) {
1592
- const buttons = ref({
1593
- search: {
1594
- icon: "i-search",
1595
- onClick: () => {
1596
- },
1597
- label: i19searchProducts
1598
- },
1599
- account: {
1600
- icon: "i-account",
1601
- onClick: () => {
1602
- },
1603
- label: i19myAccount
1604
- },
1605
- cart: {
1606
- icon: "i-shopping-cart",
1607
- onClick: () => {
1608
- },
1609
- label: i19openCart
1610
- }
1611
- });
1612
- const isSidenavOpen = ref(false);
1959
+ setup(__props, { expose }) {
1960
+ expose();
1961
+ const props = __props;
1613
1962
  const header = ref(null);
1614
1963
  const {
1615
1964
  isSticky,
1616
- staticHeight,
1617
- staticY
1618
- } = useStickyHeader({ header });
1619
- const sidenavHeight = computed(() => {
1620
- return isSticky.value ? staticHeight.value : staticY.value;
1621
- });
1622
- return (_ctx, _push, _parent, _attrs) => {
1623
- _push(`<header${ssrRenderAttrs(mergeProps({
1624
- ref_key: "header",
1625
- ref: header,
1626
- class: ["top-0 z-50 transition-colors", [
1627
- unref(isSticky) && !isSidenavOpen.value ? "bg-white/80" : "bg-white",
1628
- unref(isSticky) ? "backdrop-blur-md shadow py-2 md:py-3" : "py-3 sm:py-4 md:py-5"
1629
- ]]
1630
- }, _attrs))}><div class="container lg:max-w-7xl mx-auto px-1 lg:pl-3 grid grid-flow-col grid-cols-3 justify-between items-center md:grid-cols-none md:auto-cols-max">`);
1631
- ssrRenderSlot(_ctx.$slots, "sidenav-toggle", {}, () => {
1632
- _push(`<div class="md:hidden" data-sidenav-toggle><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}>`);
1633
- ssrRenderSlot(_ctx.$slots, "sidenav-toggle-content", {}, () => {
1634
- _push(`<i class="${ssrRenderClass([isSidenavOpen.value ? "i-close" : "i-menu", "text-base-500 text-3xl"])}"></i>`);
1635
- }, _push, _parent);
1636
- _push(`</button></div>`);
1637
- }, _push, _parent);
1638
- ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push, _parent);
1639
- ssrRenderSlot(_ctx.$slots, "nav", {}, null, _push, _parent);
1640
- ssrRenderSlot(_ctx.$slots, "buttons", {}, () => {
1641
- _push(`<div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800" data-header-buttons><!--[-->`);
1642
- ssrRenderList(buttons.value, ({ icon, onClick, label }, name) => {
1643
- ssrRenderSlot(_ctx.$slots, "button", mergeProps({ key: name }, { name, icon, onClick }), () => {
1644
- _push(`<button class="${ssrRenderClass(name === "account" ? "hidden sm:block" : null)}"${ssrRenderAttr("aria-label", label)}${ssrRenderAttr("data-header-button", name)}>`);
1645
- ssrRenderSlot(_ctx.$slots, "button-content", { name, icon }, () => {
1646
- _push(`<i class="${ssrRenderClass([icon, "hover:text-primary w-7 h-7 hover:scale-110 active:scale-125"])}"></i>`);
1647
- }, _push, _parent);
1648
- _push(`</button>`);
1649
- }, _push, _parent);
1650
- });
1651
- _push(`<!--]--></div>`);
1652
- }, _push, _parent);
1653
- _push(`</div>`);
1654
- _push(ssrRenderComponent(_sfc_main$4, {
1655
- modelValue: isSidenavOpen.value,
1656
- "onUpdate:modelValue": ($event) => isSidenavOpen.value = $event,
1657
- "has-close-button": false,
1658
- position: "absolute",
1659
- class: "mt-2 -z-1",
1660
- style: { height: `calc(100vh - ${unref(sidenavHeight)}px + .5rem)` }
1661
- }, {
1662
- default: withCtx((_, _push2, _parent2, _scopeId) => {
1663
- if (_push2) {
1664
- _push2(ssrRenderComponent(_sfc_main$3, {
1665
- class: "bg-white pt-6",
1666
- categories: __props.categories
1667
- }, null, _parent2, _scopeId));
1668
- } else {
1669
- return [
1670
- createVNode(_sfc_main$3, {
1671
- class: "bg-white pt-6",
1672
- categories: __props.categories
1673
- }, null, 8, ["categories"])
1674
- ];
1675
- }
1676
- }),
1677
- _: 1
1678
- }, _parent));
1679
- _push(`</header>`);
1680
- };
1965
+ positionY,
1966
+ categoryTrees,
1967
+ isSidenavOpen
1968
+ } = useShopHeader({ ...props, header });
1969
+ const __returned__ = { props, header, isSticky, positionY, categoryTrees, isSidenavOpen, Drawer, ShopSidenav };
1970
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1971
+ return __returned__;
1681
1972
  }
1682
1973
  });
1683
-
1974
+ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
1975
+ _push(`<header${ssrRenderAttrs(mergeProps({
1976
+ ref: "header",
1977
+ class: ["top-0 z-50 transition-colors", [
1978
+ $setup.isSticky && !$setup.isSidenavOpen ? "bg-white/80" : "bg-white",
1979
+ $setup.isSticky ? "backdrop-blur-md shadow py-2 md:py-3" : "py-3 sm:py-4 md:py-5"
1980
+ ]]
1981
+ }, _attrs))}><div class="container lg:max-w-7xl mx-auto px-1 lg:pl-3 grid grid-flow-col grid-cols-3 justify-between items-center md:grid-cols-none md:auto-cols-max"><div class="md:hidden"><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}><i class="${ssrRenderClass([$setup.isSidenavOpen ? "i-close" : "i-menu", "text-base-500 text-3xl"])}"></i></button></div>`);
1982
+ ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push, _parent);
1983
+ _push(`<nav class="hidden md:block"></nav><div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800"><button${ssrRenderAttr("aria-label", "Buscar produtos")}><i class="i-search w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button class="hidden sm:block"${ssrRenderAttr("aria-label", "Minha conta")}><i class="i-account w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button${ssrRenderAttr("aria-label", "Abrir carrinho")}><i class="i-shopping-cart w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button></div></div>`);
1984
+ _push(ssrRenderComponent($setup["Drawer"], {
1985
+ modelValue: $setup.isSidenavOpen,
1986
+ "onUpdate:modelValue": ($event) => $setup.isSidenavOpen = $event,
1987
+ "has-close-button": false,
1988
+ position: "absolute",
1989
+ class: "mt-3 -z-1",
1990
+ style: { height: `calc(100vh - ${$setup.positionY}px + .5rem)` }
1991
+ }, {
1992
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
1993
+ if (_push2) {
1994
+ _push2(ssrRenderComponent($setup["ShopSidenav"], mergeProps({ class: "bg-white pt-6" }, { categoryTrees: $setup.categoryTrees }), null, _parent2, _scopeId));
1995
+ } else {
1996
+ return [
1997
+ createVNode($setup["ShopSidenav"], mergeProps({ class: "bg-white pt-6" }, { categoryTrees: $setup.categoryTrees }), null, 16)
1998
+ ];
1999
+ }
2000
+ }),
2001
+ _: 1
2002
+ }, _parent));
2003
+ _push(`</header>`);
2004
+ }
1684
2005
  const _sfc_setup$2 = _sfc_main$2.setup;
1685
2006
  _sfc_main$2.setup = (props, ctx) => {
1686
2007
  const ssrContext = useSSRContext();
1687
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/ShopHeader.vue");
2008
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeader.vue");
1688
2009
  return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
1689
2010
  };
2011
+ const ShopHeader = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
1690
2012
 
1691
2013
  const $$Astro$7 = createAstro("https://ecom2-002.web.app");
1692
2014
  const $$PagesHeader = createComponent(async ($$result, $$props, $$slots) => {
@@ -1696,33 +2018,25 @@ const $$PagesHeader = createComponent(async ($$result, $$props, $$slots) => {
1696
2018
  pageContext: {
1697
2019
  isHomepage,
1698
2020
  apiState,
1699
- settings,
1700
2021
  cms
1701
2022
  }
1702
2023
  } = Astro2.props;
1703
- const header = cms("header");
2024
+ const cmsHeader = await cms("header");
1704
2025
  const pitchBar = { slides: [] };
1705
- if (header.pitch_bar) {
1706
- pitchBar.slides = header.pitch_bar;
1707
- } else if (header.marketing_stripe) {
1708
- pitchBar.slides = [{
1709
- href: header.marketing_stripe.link,
1710
- html: header.marketing_stripe.text
1711
- }];
2026
+ if (cmsHeader?.pitch_bar) {
2027
+ pitchBar.slides = cmsHeader.pitch_bar;
1712
2028
  }
1713
2029
  const shopHeader = {
1714
2030
  categories: apiState.categories
1715
2031
  };
1716
2032
  const LogoHeading = Astro2.props.logoHeading || (isHomepage ? "h1" : "h2");
1717
- return renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${renderSlot($$result, $$slots["pitch-bar"], renderTemplate`
1718
- ${pitchBar.slides.length > 1 && renderTemplate`${renderComponent($$result, "PitchBar", _sfc_main$5, { ...pitchBar, "client:idle": true, "client:component-hydration": "idle", "client:component-path": "~/components/PitchBar.vue", "client:component-export": "default" })}`}
1719
- ${pitchBar.slides.length === 1 && renderTemplate`${renderComponent($$result, "PitchBar", _sfc_main$5, { ...pitchBar })}`}
1720
- `)}${renderSlot($$result, $$slots["sticky-header"], renderTemplate`
1721
- ${renderComponent($$result, "ShopHeader", _sfc_main$2, { ...shopHeader, "client:load": true, "client:component-hydration": "load", "client:component-path": "@@sf/components/ShopHeader.vue", "client:component-export": "default" }, { "logo": () => renderTemplate`${renderComponent($$result, "Fragment", Fragment, { "slot": "logo" }, { "default": () => renderTemplate`${renderSlot($$result, $$slots["logo"], renderTemplate`
1722
- ${maybeRenderHead($$result)}<a href="/">
1723
- ${renderComponent($$result, "LogoHeading", LogoHeading, {}, { "default": () => renderTemplate`${renderSlot($$result, $$slots["logo-picture"], renderTemplate`
1724
- ${renderComponent($$result, "Picture", $$Picture, { "src": header.logo || settings.logo, "alt": settings.name, "widths": [300], "sizes": "150px", "fetchpriority": "high", "class": "hover:drop-shadow-sm" })}
1725
- `)}` })}
2033
+ return renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["pitch-bar"], renderTemplate`
2034
+ ${pitchBar.slides.length > 1 && renderTemplate`${renderComponent($$result2, "PitchBar", PitchBar, { ...pitchBar, "client:idle": true, "client:component-hydration": "idle", "client:component-path": "~/components/PitchBar.vue", "client:component-export": "default" })}`}
2035
+ ${pitchBar.slides.length === 1 && renderTemplate`${renderComponent($$result2, "PitchBar", PitchBar, { ...pitchBar })}`}
2036
+ `)}${renderSlot($$result2, $$slots["sticky-header"], renderTemplate`
2037
+ ${renderComponent($$result2, "ShopHeader", ShopHeader, { ...shopHeader, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/ShopHeader.vue", "client:component-export": "default" }, { "logo": ($$result3) => renderTemplate`${renderComponent($$result3, "Fragment", Fragment, { "slot": "logo" }, { "default": ($$result4) => renderTemplate`${renderSlot($$result4, $$slots["logo"], renderTemplate`
2038
+ ${maybeRenderHead($$result4)}<a href="/">
2039
+ ${renderComponent($$result4, "LogoHeading", LogoHeading, {}, { "default": ($$result5) => renderTemplate`${renderSlot($$result5, $$slots["logo-picture"])}` })}
1726
2040
  </a>
1727
2041
  `)}` })}` })}
1728
2042
  `)}` })}`;
@@ -1734,9 +2048,9 @@ const $$Pages = createComponent(async ($$result, $$props, $$slots) => {
1734
2048
  Astro2.self = $$Pages;
1735
2049
  const { pageContext, title } = Astro2.props;
1736
2050
  const { settings } = pageContext;
1737
- return renderTemplate`${renderComponent($$result, "Base", $$Base, { "pageContext": pageContext, "title": title }, { "default": () => renderTemplate`${renderSlot($$result, $$slots["header"], renderTemplate`
1738
- ${renderComponent($$result, "Header", $$PagesHeader, { "pageContext": pageContext }, { "logo-picture": () => renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "slot": "logo-picture", "src": settings.logo, "alt": settings.name, "widths": [300], "sizes": "150px", "fetchpriority": "high", "class": "hover:drop-shadow-sm" })}` })}
1739
- `)}${renderSlot($$result, $$slots["default"])}` })}`;
2051
+ return renderTemplate`${renderComponent($$result, "Base", $$Base, { "pageContext": pageContext, "title": title }, { "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["header"], renderTemplate`
2052
+ ${renderComponent($$result2, "Header", $$PagesHeader, { "pageContext": pageContext }, { "logo-picture": ($$result3) => renderTemplate`${renderComponent($$result3, "Picture", $$Picture, { "slot": "logo-picture", "src": settings.logo, "alt": settings.name, "widths": [300], "sizes": "150px", "fetchpriority": "high", "class": "hover:drop-shadow-sm" })}` })}
2053
+ `)}${renderSlot($$result2, $$slots["default"])}` })}`;
1740
2054
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Pages.astro");
1741
2055
 
1742
2056
  const getPriceWithDiscount = (price, discount) => {
@@ -1891,9 +2205,8 @@ const usePrices = (props) => {
1891
2205
  };
1892
2206
  };
1893
2207
 
1894
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2208
+ const _sfc_main$1 = defineComponent({
1895
2209
  __name: "Prices",
1896
- __ssrInlineRender: true,
1897
2210
  props: {
1898
2211
  product: null,
1899
2212
  price: null,
@@ -1906,7 +2219,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1906
2219
  hasCashback: { type: Boolean, default: true },
1907
2220
  hasPriceOptions: { type: Boolean, default: true }
1908
2221
  },
1909
- setup(__props) {
2222
+ setup(__props, { expose }) {
2223
+ expose();
1910
2224
  const props = __props;
1911
2225
  const {
1912
2226
  hasVariedPrices,
@@ -1920,267 +2234,273 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1920
2234
  priceWithDiscount,
1921
2235
  discountLabel
1922
2236
  } = usePrices(props);
1923
- return (_ctx, _push, _parent, _attrs) => {
1924
- const _component_Fade = resolveComponent("Fade");
1925
- _push(`<div${ssrRenderAttrs(mergeProps({
1926
- class: ["text-base-600", __props.isBig ? "text-lg" : null],
1927
- "data-prices": ""
1928
- }, _attrs))}>`);
1929
- if (unref(comparePrice)) {
1930
- _push(`<span class="text-base-500 mr-1">`);
1931
- if (__props.isLiteral) {
1932
- _push(`<small>${ssrInterpolate(`${"De"} `)}</small>`);
1933
- } else {
1934
- _push(`<!---->`);
1935
- }
1936
- _push(`<s>${ssrInterpolate(_ctx.$money(unref(comparePrice)))}</s>`);
1937
- if (__props.isLiteral) {
1938
- _push(`<small>${ssrInterpolate(` ${"Por"}`)}</small>`);
2237
+ const __returned__ = { props, hasVariedPrices, salePrice, comparePrice, cashbackPercentage, cashbackValue, installmentsNumber, monthlyInterest, installmentValue, priceWithDiscount, discountLabel };
2238
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
2239
+ return __returned__;
2240
+ }
2241
+ });
2242
+ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2243
+ const _component_Fade = resolveComponent("Fade");
2244
+ _push(`<div${ssrRenderAttrs(mergeProps({
2245
+ class: ["text-base-600", $props.isBig ? "text-lg" : null],
2246
+ "data-prices": ""
2247
+ }, _attrs))}>`);
2248
+ if ($setup.comparePrice) {
2249
+ _push(`<span class="text-base-500 mr-1">`);
2250
+ if ($props.isLiteral) {
2251
+ _push(`<small>${ssrInterpolate(`${"De"} `)}</small>`);
2252
+ } else {
2253
+ _push(`<!---->`);
2254
+ }
2255
+ _push(`<s>${ssrInterpolate(_ctx.$money($setup.comparePrice))}</s>`);
2256
+ if ($props.isLiteral) {
2257
+ _push(`<small>${ssrInterpolate(` ${"Por"}`)}</small>`);
2258
+ } else {
2259
+ _push(`<!---->`);
2260
+ }
2261
+ _push(`</span>`);
2262
+ } else {
2263
+ _push(`<!---->`);
2264
+ }
2265
+ _push(`<strong class="${ssrRenderClass([$props.isBig ? "text-5xl block" : null, "inline-block text-base-800"])}">`);
2266
+ if ($setup.hasVariedPrices) {
2267
+ _push(`<small>${ssrInterpolate(`${"A partir de"} `)}</small>`);
2268
+ } else {
2269
+ _push(`<!---->`);
2270
+ }
2271
+ _push(` ${ssrInterpolate(_ctx.$money($setup.salePrice))}</strong>`);
2272
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
2273
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
2274
+ if (_push2) {
2275
+ if ($setup.cashbackValue && $props.hasCashback) {
2276
+ _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-cashback mr-1"${_scopeId}></i><span class="font-medium"${_scopeId}>${ssrInterpolate(_ctx.$money($setup.cashbackValue))}</span><small${_scopeId}> cashback</small></span></div>`);
1939
2277
  } else {
1940
- _push(`<!---->`);
2278
+ _push2(`<!---->`);
1941
2279
  }
1942
- _push(`</span>`);
1943
- } else {
1944
- _push(`<!---->`);
1945
- }
1946
- _push(`<strong class="${ssrRenderClass([__props.isBig ? "text-5xl block" : null, "inline-block text-base-800"])}">`);
1947
- if (unref(hasVariedPrices)) {
1948
- _push(`<small>${ssrInterpolate(`${"A partir de"} `)}</small>`);
1949
2280
  } else {
1950
- _push(`<!---->`);
2281
+ return [
2282
+ $setup.cashbackValue && $props.hasCashback ? (openBlock(), createBlock("div", {
2283
+ key: 0,
2284
+ class: "relative z-10"
2285
+ }, [
2286
+ createVNode("span", {
2287
+ "data-tooltip": "Receba $1 de volta".replace("$1", _ctx.$percentage($setup.cashbackPercentage))
2288
+ }, [
2289
+ createVNode("i", { class: "i-cashback mr-1" }),
2290
+ createVNode("span", { class: "font-medium" }, toDisplayString(_ctx.$money($setup.cashbackValue)), 1),
2291
+ createVNode("small", null, " cashback")
2292
+ ], 8, ["data-tooltip"])
2293
+ ])) : createCommentVNode("", true)
2294
+ ];
1951
2295
  }
1952
- _push(` ${ssrInterpolate(_ctx.$money(unref(salePrice)))}</strong>`);
1953
- _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
1954
- default: withCtx((_, _push2, _parent2, _scopeId) => {
1955
- if (_push2) {
1956
- if (unref(cashbackValue) && __props.hasCashback) {
1957
- _push2(`<div class="relative z-10"${_scopeId}><span${ssrRenderAttr("data-tooltip", "Receba $1 de volta".replace("$1", _ctx.$percentage(unref(cashbackPercentage))))}${_scopeId}><i class="i-cashback mr-1"${_scopeId}></i><span class="font-medium"${_scopeId}>${ssrInterpolate(_ctx.$money(unref(cashbackValue)))}</span><small${_scopeId}> cashback</small></span></div>`);
1958
- } else {
1959
- _push2(`<!---->`);
1960
- }
2296
+ }),
2297
+ _: 1
2298
+ }, _parent));
2299
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
2300
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
2301
+ if (_push2) {
2302
+ if ($setup.installmentValue && $props.hasPriceOptions) {
2303
+ _push2(`<div${_scopeId}>`);
2304
+ if ($props.isLiteral) {
2305
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"At\xE9"} `)}</small>`);
1961
2306
  } else {
1962
- return [
1963
- unref(cashbackValue) && __props.hasCashback ? (openBlock(), createBlock("div", {
1964
- key: 0,
1965
- class: "relative z-10"
1966
- }, [
1967
- createVNode("span", {
1968
- "data-tooltip": "Receba $1 de volta".replace("$1", _ctx.$percentage(unref(cashbackPercentage)))
1969
- }, [
1970
- createVNode("i", { class: "i-cashback mr-1" }),
1971
- createVNode("span", { class: "font-medium" }, toDisplayString(_ctx.$money(unref(cashbackValue))), 1),
1972
- createVNode("small", null, " cashback")
1973
- ], 8, ["data-tooltip"])
1974
- ])) : createCommentVNode("", true)
1975
- ];
2307
+ _push2(`<!---->`);
1976
2308
  }
1977
- }),
1978
- _: 1
1979
- }, _parent));
1980
- _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
1981
- default: withCtx((_, _push2, _parent2, _scopeId) => {
1982
- if (_push2) {
1983
- if (unref(installmentValue) && __props.hasPriceOptions) {
1984
- _push2(`<div${_scopeId}>`);
1985
- if (__props.isLiteral) {
1986
- _push2(`<small${_scopeId}>${ssrInterpolate(`${"Até"} `)}</small>`);
1987
- } else {
1988
- _push2(`<!---->`);
1989
- }
1990
- _push2(` ${ssrInterpolate(unref(installmentsNumber))}x `);
1991
- if (__props.isLiteral) {
1992
- _push2(`<small${_scopeId}>${ssrInterpolate(` ${"De"} `)}</small>`);
1993
- } else {
1994
- _push2(`<!---->`);
1995
- }
1996
- _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money(unref(installmentValue)))}</span>`);
1997
- if (!unref(monthlyInterest) && __props.isLiteral) {
1998
- _push2(`<small${_scopeId}>${ssrInterpolate("Sem juros")}</small>`);
1999
- } else {
2000
- _push2(`<!---->`);
2001
- }
2002
- _push2(`</div>`);
2003
- } else {
2004
- _push2(`<!---->`);
2005
- }
2309
+ _push2(` ${ssrInterpolate($setup.installmentsNumber)}x `);
2310
+ if ($props.isLiteral) {
2311
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${"De"} `)}</small>`);
2006
2312
  } else {
2007
- return [
2008
- unref(installmentValue) && __props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
2009
- __props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"Até"} `))) : createCommentVNode("", true),
2010
- createTextVNode(" " + toDisplayString(unref(installmentsNumber)) + "x ", 1),
2011
- __props.isLiteral ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${"De"} `))) : createCommentVNode("", true),
2012
- createVNode("span", null, toDisplayString(_ctx.$money(unref(installmentValue))), 1),
2013
- !unref(monthlyInterest) && __props.isLiteral ? (openBlock(), createBlock("small", { key: 2 }, toDisplayString("Sem juros"))) : createCommentVNode("", true)
2014
- ])) : createCommentVNode("", true)
2015
- ];
2313
+ _push2(`<!---->`);
2016
2314
  }
2017
- }),
2018
- _: 1
2019
- }, _parent));
2020
- _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
2021
- default: withCtx((_, _push2, _parent2, _scopeId) => {
2022
- if (_push2) {
2023
- if (unref(priceWithDiscount) < unref(salePrice) && __props.hasPriceOptions) {
2024
- _push2(`<div${_scopeId}>`);
2025
- if (!unref(discountLabel)) {
2026
- _push2(`<small${_scopeId}>${ssrInterpolate(`${"A partir de"} `)}</small>`);
2027
- } else {
2028
- _push2(`<!---->`);
2029
- }
2030
- _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money(unref(priceWithDiscount)))}</span>`);
2031
- if (unref(discountLabel)) {
2032
- _push2(`<small${_scopeId}>${ssrInterpolate(` ${unref(discountLabel)}`)}</small>`);
2033
- } else {
2034
- _push2(`<!---->`);
2035
- }
2036
- _push2(`</div>`);
2037
- } else {
2038
- _push2(`<!---->`);
2039
- }
2315
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money($setup.installmentValue))}</span>`);
2316
+ if (!$setup.monthlyInterest && $props.isLiteral) {
2317
+ _push2(`<small${_scopeId}>${ssrInterpolate("Sem juros")}</small>`);
2040
2318
  } else {
2041
- return [
2042
- unref(priceWithDiscount) < unref(salePrice) && __props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
2043
- !unref(discountLabel) ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"A partir de"} `))) : createCommentVNode("", true),
2044
- createVNode("span", null, toDisplayString(_ctx.$money(unref(priceWithDiscount))), 1),
2045
- unref(discountLabel) ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${unref(discountLabel)}`), 1)) : createCommentVNode("", true)
2046
- ])) : createCommentVNode("", true)
2047
- ];
2319
+ _push2(`<!---->`);
2048
2320
  }
2049
- }),
2050
- _: 1
2051
- }, _parent));
2052
- _push(`</div>`);
2053
- };
2054
- }
2055
- });
2056
-
2321
+ _push2(`</div>`);
2322
+ } else {
2323
+ _push2(`<!---->`);
2324
+ }
2325
+ } else {
2326
+ return [
2327
+ $setup.installmentValue && $props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
2328
+ $props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"At\xE9"} `))) : createCommentVNode("", true),
2329
+ createTextVNode(" " + toDisplayString($setup.installmentsNumber) + "x ", 1),
2330
+ $props.isLiteral ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${"De"} `))) : createCommentVNode("", true),
2331
+ createVNode("span", null, toDisplayString(_ctx.$money($setup.installmentValue)), 1),
2332
+ !$setup.monthlyInterest && $props.isLiteral ? (openBlock(), createBlock("small", { key: 2 }, toDisplayString("Sem juros"))) : createCommentVNode("", true)
2333
+ ])) : createCommentVNode("", true)
2334
+ ];
2335
+ }
2336
+ }),
2337
+ _: 1
2338
+ }, _parent));
2339
+ _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
2340
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
2341
+ if (_push2) {
2342
+ if ($setup.priceWithDiscount < $setup.salePrice && $props.hasPriceOptions) {
2343
+ _push2(`<div${_scopeId}>`);
2344
+ if (!$setup.discountLabel) {
2345
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"A partir de"} `)}</small>`);
2346
+ } else {
2347
+ _push2(`<!---->`);
2348
+ }
2349
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money($setup.priceWithDiscount))}</span>`);
2350
+ if ($setup.discountLabel) {
2351
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${$setup.discountLabel}`)}</small>`);
2352
+ } else {
2353
+ _push2(`<!---->`);
2354
+ }
2355
+ _push2(`</div>`);
2356
+ } else {
2357
+ _push2(`<!---->`);
2358
+ }
2359
+ } else {
2360
+ return [
2361
+ $setup.priceWithDiscount < $setup.salePrice && $props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
2362
+ !$setup.discountLabel ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"A partir de"} `))) : createCommentVNode("", true),
2363
+ createVNode("span", null, toDisplayString(_ctx.$money($setup.priceWithDiscount)), 1),
2364
+ $setup.discountLabel ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${$setup.discountLabel}`), 1)) : createCommentVNode("", true)
2365
+ ])) : createCommentVNode("", true)
2366
+ ];
2367
+ }
2368
+ }),
2369
+ _: 1
2370
+ }, _parent));
2371
+ _push(`</div>`);
2372
+ }
2057
2373
  const _sfc_setup$1 = _sfc_main$1.setup;
2058
2374
  _sfc_main$1.setup = (props, ctx) => {
2059
2375
  const ssrContext = useSSRContext();
2060
2376
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Prices.vue");
2061
2377
  return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
2062
2378
  };
2379
+ const Prices = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender$1]]);
2063
2380
 
2064
- const _sfc_main = /* @__PURE__ */ defineComponent({
2381
+ const _sfc_main = defineComponent({
2065
2382
  __name: "ProductCard",
2066
- __ssrInlineRender: true,
2067
2383
  props: {
2068
2384
  as: { default: "div" }
2069
2385
  },
2070
- setup(__props) {
2386
+ setup(__props, { expose }) {
2387
+ expose();
2071
2388
  const price = ref(12);
2072
2389
  const isBig = ref(false);
2073
2390
  setTimeout(() => {
2074
2391
  price.value = 8;
2075
2392
  isBig.value = true;
2076
2393
  }, 5e3);
2077
- return (_ctx, _push, _parent, _attrs) => {
2078
- ssrRenderVNode(_push, createVNode(resolveDynamicComponent(__props.as), _attrs, {
2079
- default: withCtx((_, _push2, _parent2, _scopeId) => {
2080
- if (_push2) {
2081
- _push2(ssrRenderComponent(_sfc_main$1, null, {
2082
- default: withCtx(({ salePrice }, _push3, _parent3, _scopeId2) => {
2083
- if (_push3) {
2084
- _push3(` ProductCard ${ssrInterpolate(salePrice)}`);
2085
- } else {
2086
- return [
2087
- createTextVNode(" ProductCard " + toDisplayString(salePrice), 1)
2088
- ];
2089
- }
2090
- }),
2091
- _: 1
2092
- }, _parent2, _scopeId));
2093
- _push2(ssrRenderComponent(_sfc_main$1, {
2094
- product: { price: price.value }
2095
- }, null, _parent2, _scopeId));
2096
- _push2(ssrRenderComponent(_sfc_main$1, {
2097
- price: 12,
2098
- "base-price": 17
2099
- }, null, _parent2, _scopeId));
2100
- _push2(ssrRenderComponent(_sfc_main$1, {
2101
- price: 12,
2102
- "base-price": 16,
2103
- "is-literal": true
2104
- }, null, _parent2, _scopeId));
2105
- _push2(ssrRenderComponent(_sfc_main$1, {
2106
- price: 12,
2107
- "is-big": isBig.value
2108
- }, null, _parent2, _scopeId));
2109
- _push2(ssrRenderComponent(_sfc_main$1, {
2110
- price: 14,
2111
- "base-price": 18,
2112
- "is-big": isBig.value,
2113
- "is-literal": true
2114
- }, null, _parent2, _scopeId));
2115
- _push2(ssrRenderComponent(_sfc_main$1, {
2116
- price: 12,
2117
- "base-price": 16
2118
- }, {
2119
- "compare-value": withCtx(({ comparePrice }, _push3, _parent3, _scopeId2) => {
2120
- if (_push3) {
2121
- _push3(` x${ssrInterpolate(comparePrice)}`);
2122
- } else {
2123
- return [
2124
- createTextVNode(" x" + toDisplayString(comparePrice), 1)
2125
- ];
2126
- }
2127
- }),
2128
- _: 1
2129
- }, _parent2, _scopeId));
2130
- } else {
2131
- return [
2132
- createVNode(_sfc_main$1, null, {
2133
- default: withCtx(({ salePrice }) => [
2134
- createTextVNode(" ProductCard " + toDisplayString(salePrice), 1)
2135
- ]),
2136
- _: 1
2137
- }),
2138
- createVNode(_sfc_main$1, {
2139
- product: { price: price.value }
2140
- }, null, 8, ["product"]),
2141
- createVNode(_sfc_main$1, {
2142
- price: 12,
2143
- "base-price": 17
2144
- }),
2145
- createVNode(_sfc_main$1, {
2146
- price: 12,
2147
- "base-price": 16,
2148
- "is-literal": true
2149
- }),
2150
- createVNode(_sfc_main$1, {
2151
- price: 12,
2152
- "is-big": isBig.value
2153
- }, null, 8, ["is-big"]),
2154
- createVNode(_sfc_main$1, {
2155
- price: 14,
2156
- "base-price": 18,
2157
- "is-big": isBig.value,
2158
- "is-literal": true
2159
- }, null, 8, ["is-big"]),
2160
- createVNode(_sfc_main$1, {
2161
- price: 12,
2162
- "base-price": 16
2163
- }, {
2164
- "compare-value": withCtx(({ comparePrice }) => [
2165
- createTextVNode(" x" + toDisplayString(comparePrice), 1)
2166
- ]),
2167
- _: 1
2168
- })
2169
- ];
2170
- }
2171
- }),
2172
- _: 1
2173
- }), _parent);
2174
- };
2394
+ const __returned__ = { price, isBig, Prices };
2395
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
2396
+ return __returned__;
2175
2397
  }
2176
2398
  });
2177
-
2399
+ function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
2400
+ ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), _attrs, {
2401
+ default: withCtx((_, _push2, _parent2, _scopeId) => {
2402
+ if (_push2) {
2403
+ _push2(ssrRenderComponent($setup["Prices"], null, {
2404
+ default: withCtx(({ salePrice }, _push3, _parent3, _scopeId2) => {
2405
+ if (_push3) {
2406
+ _push3(` ProductCard ${ssrInterpolate(salePrice)}`);
2407
+ } else {
2408
+ return [
2409
+ createTextVNode(" ProductCard " + toDisplayString(salePrice), 1)
2410
+ ];
2411
+ }
2412
+ }),
2413
+ _: 1
2414
+ }, _parent2, _scopeId));
2415
+ _push2(ssrRenderComponent($setup["Prices"], {
2416
+ product: { price: $setup.price }
2417
+ }, null, _parent2, _scopeId));
2418
+ _push2(ssrRenderComponent($setup["Prices"], {
2419
+ price: 12,
2420
+ "base-price": 17
2421
+ }, null, _parent2, _scopeId));
2422
+ _push2(ssrRenderComponent($setup["Prices"], {
2423
+ price: 12,
2424
+ "base-price": 16,
2425
+ "is-literal": true
2426
+ }, null, _parent2, _scopeId));
2427
+ _push2(ssrRenderComponent($setup["Prices"], {
2428
+ price: 12,
2429
+ "is-big": $setup.isBig
2430
+ }, null, _parent2, _scopeId));
2431
+ _push2(ssrRenderComponent($setup["Prices"], {
2432
+ price: 14,
2433
+ "base-price": 18,
2434
+ "is-big": $setup.isBig,
2435
+ "is-literal": true
2436
+ }, null, _parent2, _scopeId));
2437
+ _push2(ssrRenderComponent($setup["Prices"], {
2438
+ price: 12,
2439
+ "base-price": 16
2440
+ }, {
2441
+ "compare-value": withCtx(({ comparePrice }, _push3, _parent3, _scopeId2) => {
2442
+ if (_push3) {
2443
+ _push3(` x${ssrInterpolate(comparePrice)}`);
2444
+ } else {
2445
+ return [
2446
+ createTextVNode(" x" + toDisplayString(comparePrice), 1)
2447
+ ];
2448
+ }
2449
+ }),
2450
+ _: 1
2451
+ }, _parent2, _scopeId));
2452
+ } else {
2453
+ return [
2454
+ createVNode($setup["Prices"], null, {
2455
+ default: withCtx(({ salePrice }) => [
2456
+ createTextVNode(" ProductCard " + toDisplayString(salePrice), 1)
2457
+ ]),
2458
+ _: 1
2459
+ }),
2460
+ createVNode($setup["Prices"], {
2461
+ product: { price: $setup.price }
2462
+ }, null, 8, ["product"]),
2463
+ createVNode($setup["Prices"], {
2464
+ price: 12,
2465
+ "base-price": 17
2466
+ }),
2467
+ createVNode($setup["Prices"], {
2468
+ price: 12,
2469
+ "base-price": 16,
2470
+ "is-literal": true
2471
+ }),
2472
+ createVNode($setup["Prices"], {
2473
+ price: 12,
2474
+ "is-big": $setup.isBig
2475
+ }, null, 8, ["is-big"]),
2476
+ createVNode($setup["Prices"], {
2477
+ price: 14,
2478
+ "base-price": 18,
2479
+ "is-big": $setup.isBig,
2480
+ "is-literal": true
2481
+ }, null, 8, ["is-big"]),
2482
+ createVNode($setup["Prices"], {
2483
+ price: 12,
2484
+ "base-price": 16
2485
+ }, {
2486
+ "compare-value": withCtx(({ comparePrice }) => [
2487
+ createTextVNode(" x" + toDisplayString(comparePrice), 1)
2488
+ ]),
2489
+ _: 1
2490
+ })
2491
+ ];
2492
+ }
2493
+ }),
2494
+ _: 1
2495
+ }), _parent);
2496
+ }
2178
2497
  const _sfc_setup = _sfc_main.setup;
2179
2498
  _sfc_main.setup = (props, ctx) => {
2180
2499
  const ssrContext = useSSRContext();
2181
2500
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/ProductCard.vue");
2182
2501
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
2183
2502
  };
2503
+ const ProductCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
2184
2504
 
2185
2505
  const $$Astro$5 = createAstro("https://ecom2-002.web.app");
2186
2506
  const $$Home = createComponent(async ($$result, $$props, $$slots) => {
@@ -2227,8 +2547,8 @@ const $$Home = createComponent(async ($$result, $$props, $$slots) => {
2227
2547
  </label>
2228
2548
  </div>
2229
2549
  </div>
2230
- ${renderComponent($$result, "Prices", _sfc_main$1, { "price": 10, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/Prices.vue", "client:component-export": "default" })}
2231
- ${renderComponent($$result, "ProductCard", _sfc_main, { "client:load": true, "client:component-hydration": "load", "client:component-path": "@@sf/components/ProductCard.vue", "client:component-export": "default" })}
2550
+ ${renderComponent($$result, "Prices", Prices, { "price": 10, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/Prices.vue", "client:component-export": "default" })}
2551
+ ${renderComponent($$result, "ProductCard", ProductCard, { "client:load": true, "client:component-hydration": "load", "client:component-path": "@@sf/components/ProductCard.vue", "client:component-export": "default" })}
2232
2552
  </main>`;
2233
2553
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Home.astro");
2234
2554
 
@@ -2247,8 +2567,8 @@ const $$Index$1 = createComponent(async ($$result, $$props, $$slots) => {
2247
2567
  loadError = err;
2248
2568
  }
2249
2569
  return renderTemplate`<html${addAttribute(pageContext?.lang.replace("_", "-"), "lang")}>
2250
- ${pageContext && renderTemplate`${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext }, { "default": () => renderTemplate`${renderComponent($$result, "HomeMain", $$Home, { "pageContext": pageContext })}` })}`}
2251
- ${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
2570
+ ${pageContext && renderTemplate`${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext }, { "default": ($$result2) => renderTemplate`${renderComponent($$result2, "HomeMain", $$Home, { "pageContext": pageContext })}` })}`}
2571
+ ${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
2252
2572
  </html>`;
2253
2573
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro");
2254
2574
 
@@ -2335,8 +2655,8 @@ const $$ = createComponent(async ($$result, $$props, $$slots) => {
2335
2655
  loadError = err;
2336
2656
  }
2337
2657
  return renderTemplate`<html${addAttribute(pageContext?.lang.replace("_", "-"), "lang")}>
2338
- ${pageContext && renderTemplate`${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext }, { "default": () => renderTemplate`${renderComponent($$result, "WildcardMain", $$Wildcard, { "pageContext": pageContext })}` })}`}
2339
- ${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
2658
+ ${pageContext && renderTemplate`${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext }, { "default": ($$result2) => renderTemplate`${renderComponent($$result2, "WildcardMain", $$Wildcard, { "pageContext": pageContext })}` })}`}
2659
+ ${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
2340
2660
  </html>`;
2341
2661
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro");
2342
2662
 
@@ -2351,4 +2671,4 @@ const _page5 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2351
2671
  url: $$url
2352
2672
  }, Symbol.toStringTag, { value: 'Module' }));
2353
2673
 
2354
- export { $$Pages as $, _page0 as _, _page1 as a, _page3 as b, _page4 as c, _page5 as d, loadPageContext as l };
2674
+ export { $$Pages as $, _export_sfc as _, _page0 as a, _page1 as b, _page3 as c, _page4 as d, _page5 as e, loadPageContext as l };