cloudcommerce 0.3.0 → 0.4.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 (71) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/package.json +1 -1
  3. package/packages/api/package.json +1 -1
  4. package/packages/apps/correios/package.json +1 -1
  5. package/packages/apps/custom-payment/package.json +1 -1
  6. package/packages/apps/custom-shipping/package.json +1 -1
  7. package/packages/apps/datafrete/package.json +1 -1
  8. package/packages/apps/discounts/package.json +1 -1
  9. package/packages/apps/emails/package.json +1 -1
  10. package/packages/apps/fb-conversions/package.json +1 -1
  11. package/packages/apps/frenet/package.json +1 -1
  12. package/packages/apps/galaxpay/package.json +1 -1
  13. package/packages/apps/google-analytics/package.json +1 -1
  14. package/packages/apps/infinitepay/package.json +1 -1
  15. package/packages/apps/jadlog/package.json +1 -1
  16. package/packages/apps/loyalty-points/package.json +1 -1
  17. package/packages/apps/melhor-envio/package.json +1 -1
  18. package/packages/apps/mercadopago/package.json +1 -1
  19. package/packages/apps/pagarme/package.json +1 -1
  20. package/packages/apps/paghiper/package.json +1 -1
  21. package/packages/apps/pix/package.json +1 -1
  22. package/packages/apps/tiny-erp/package.json +1 -1
  23. package/packages/cli/package.json +1 -1
  24. package/packages/config/package.json +1 -1
  25. package/packages/emails/package.json +1 -1
  26. package/packages/events/package.json +1 -1
  27. package/packages/firebase/package.json +1 -1
  28. package/packages/i18n/package.json +1 -1
  29. package/packages/modules/package.json +1 -1
  30. package/packages/passport/package.json +1 -1
  31. package/packages/ssr/package.json +1 -1
  32. package/packages/storefront/dist/client/_astro/PitchBar.103168e6.js +1 -0
  33. package/packages/storefront/dist/client/_astro/Prices.b75d44d6.js +1 -0
  34. package/packages/storefront/dist/client/_astro/Prices.vue_vue_type_script_setup_true_lang.054033ef.js +1 -0
  35. package/packages/storefront/dist/client/_astro/ProductCard.9138ec25.js +1 -0
  36. package/packages/storefront/dist/client/_astro/ShopHeader.65213f83.js +1 -0
  37. package/packages/storefront/dist/client/_astro/{_...slug_.32968ccf.css → _...slug_.39c46f54.css} +1 -1
  38. package/packages/storefront/dist/client/_astro/{client.5a46cc02.js → client.eba0daa7.js} +1 -1
  39. package/packages/storefront/dist/client/_astro/index.0c833781.css +1 -0
  40. package/packages/storefront/dist/client/_astro/index.7577af70.js +1 -0
  41. package/packages/storefront/dist/client/_astro/{modules-info.d9373e21.js → modules-info.0c999f60.js} +1 -1
  42. package/packages/storefront/dist/client/_astro/runtime-core.esm-bundler.4da3640b.js +1 -0
  43. package/packages/storefront/dist/client/_astro/{runtime-dom.esm-bundler.00313542.js → runtime-dom.esm-bundler.0869e112.js} +1 -1
  44. package/packages/storefront/dist/client/fallback/index.html +8 -9
  45. package/packages/storefront/dist/client/sw.js +1 -1
  46. package/packages/storefront/dist/server/chunks/pages/{all.23de4e5c.mjs → all.6379e666.mjs} +326 -463
  47. package/packages/storefront/dist/server/chunks/{prerender.f40361a3.mjs → prerender.a1ec39e0.mjs} +0 -0
  48. package/packages/storefront/dist/server/entry.mjs +3 -3
  49. package/packages/storefront/package.json +1 -1
  50. package/packages/storefront/src/lib/components/Drawer.vue +39 -45
  51. package/packages/storefront/src/lib/components/ProductCard.vue +1 -1
  52. package/packages/storefront/src/lib/components/ShopHeader.vue +41 -13
  53. package/packages/storefront/src/lib/components/ShopSidenav.vue +26 -0
  54. package/packages/storefront/src/lib/composables/use-pitch-bar.ts +27 -0
  55. package/packages/storefront/src/lib/composables/use-sticky-header.ts +111 -0
  56. package/packages/storefront/src/lib/layouts/BaseBody.astro +2 -1
  57. package/packages/storefront/src/lib/layouts/PagesHeader.astro +16 -25
  58. package/packages/types/package.json +1 -1
  59. package/packages/storefront/dist/client/_astro/PitchBar.209c6645.js +0 -1
  60. package/packages/storefront/dist/client/_astro/Prices.6fbcb5ac.js +0 -1
  61. package/packages/storefront/dist/client/_astro/Prices.vue_vue_type_script_setup_true_lang.44f23680.js +0 -1
  62. package/packages/storefront/dist/client/_astro/ProductCard.ee5eee91.js +0 -1
  63. package/packages/storefront/dist/client/_astro/ShopHeader.b801c785.js +0 -1
  64. package/packages/storefront/dist/client/_astro/index.844a4059.js +0 -1
  65. package/packages/storefront/dist/client/_astro/index.90df622b.css +0 -1
  66. package/packages/storefront/dist/client/_astro/runtime-core.esm-bundler.f04cee62.js +0 -1
  67. package/packages/storefront/dist/client/_astro/use-component-variant.58788b6e.js +0 -1
  68. package/packages/storefront/src/lib/components/PitchBar.vue +0 -66
  69. package/packages/storefront/src/lib/components/Prices.vue +0 -176
  70. package/packages/storefront/src/lib/components/StickyHeader.vue +0 -84
  71. package/packages/storefront/src/lib/composables/use-component-variant.ts +0 -17
@@ -12,8 +12,8 @@ import 'node:stream';
12
12
  import 'slash';
13
13
  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.89bd9221.mjs';
14
14
  import api from '@cloudcommerce/api';
15
- 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, createTextVNode, toDisplayString } from 'vue';
16
- import { ssrRenderAttrs, ssrRenderSlot, ssrRenderClass, ssrRenderVNode, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrRenderTeleport, ssrIncludeBooleanAttr, ssrRenderAttr, ssrInterpolate } from 'vue/server-renderer';
15
+ 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, toDisplayString, createTextVNode } from 'vue';
16
+ import { ssrRenderAttrs, ssrRenderSlot, ssrRenderClass, ssrRenderVNode, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrIncludeBooleanAttr, ssrRenderAttr, ssrInterpolate } from 'vue/server-renderer';
17
17
  import { img, price, formatMoney, onPromotion } from '@ecomplus/utils';
18
18
  /* empty css */import { EventEmitter } from 'node:events';
19
19
  import fs, { readFileSync } from 'node:fs';
@@ -797,9 +797,10 @@ const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
797
797
  const Astro2 = $$result.createAstro($$Astro$e, $$props, $$slots);
798
798
  Astro2.self = $$BaseBody;
799
799
  return renderTemplate`${maybeRenderHead($$result)}<body>
800
+ <div id="teleported-top"></div>
800
801
  ${renderSlot($$result, $$slots["default"])}
801
802
  ${renderSlot($$result, $$slots["before-body-end"])}
802
- <div id="teleported"></div>
803
+ <div id="teleported-bottom"></div>
803
804
  </body>`;
804
805
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro");
805
806
 
@@ -993,6 +994,21 @@ const parseShippingPhrase = (phrase) => {
993
994
  return parsePhrase(phrase, "calculate_shipping", "free_shipping_from_value");
994
995
  };
995
996
 
997
+ const usePitchBar = (props) => {
998
+ const parsedContents = computed(() => {
999
+ return props.slides.map(({ html }) => {
1000
+ return parseShippingPhrase(html).value;
1001
+ });
1002
+ });
1003
+ const countValidSlides = computed(() => {
1004
+ return parsedContents.value.filter((html) => html).length;
1005
+ });
1006
+ return {
1007
+ parsedContents,
1008
+ countValidSlides
1009
+ };
1010
+ };
1011
+
996
1012
  const carouselKey = Symbol("carousel");
997
1013
 
998
1014
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
@@ -1226,48 +1242,34 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1226
1242
  },
1227
1243
  setup(__props) {
1228
1244
  const props = __props;
1229
- const parsedContents = computed(() => {
1230
- return props.slides.map(({ html }) => {
1231
- return parseShippingPhrase(html).value;
1232
- });
1233
- });
1234
- const countValidSlides = computed(() => {
1235
- return parsedContents.value.filter((html) => html).length;
1236
- });
1245
+ const {
1246
+ parsedContents,
1247
+ countValidSlides
1248
+ } = usePitchBar(props);
1237
1249
  return (_ctx, _push, _parent, _attrs) => {
1238
- _push(`<div${ssrRenderAttrs(mergeProps({
1239
- class: "bg-base-100",
1240
- "data-pitch-bar": ""
1241
- }, _attrs))}><div class="container md:w-2/3 mx-auto px-3 py-1">`);
1250
+ _push(`<div${ssrRenderAttrs(mergeProps({ class: "bg-base-100" }, _attrs))}><div class="container md:w-2/3 mx-auto px-3 py-1">`);
1242
1251
  _push(ssrRenderComponent(_sfc_main$6, {
1243
1252
  autoplay: unref(countValidSlides) > 1 ? 7e3 : null
1244
1253
  }, {
1245
1254
  controls: withCtx((_, _push2, _parent2, _scopeId) => {
1246
1255
  if (_push2) {
1247
- ssrRenderSlot(_ctx.$slots, "controls", { countValidSlides: unref(countValidSlides) }, () => {
1248
- _push2(`<div style="${ssrRenderStyle(unref(countValidSlides) > 1 ? null : { display: "none" })}" class="text-xl leading-none text-base-400" data-pitch-bar-controls${_scopeId}>`);
1249
- _push2(ssrRenderComponent(_sfc_main$7, {
1250
- direction: -1,
1251
- class: "pr-2 bg-base-100 hover:text-base-700"
1252
- }, null, _parent2, _scopeId));
1253
- _push2(ssrRenderComponent(_sfc_main$7, { class: "pl-2 bg-base-100 hover:text-base-700" }, null, _parent2, _scopeId));
1254
- _push2(`</div>`);
1255
- }, _push2, _parent2, _scopeId);
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, {
1258
+ direction: -1,
1259
+ 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>`);
1256
1263
  } else {
1257
1264
  return [
1258
- renderSlot$1(_ctx.$slots, "controls", { countValidSlides: unref(countValidSlides) }, () => [
1259
- withDirectives(createVNode("div", {
1260
- class: "text-xl leading-none text-base-400",
1261
- "data-pitch-bar-controls": ""
1262
- }, [
1263
- createVNode(_sfc_main$7, {
1264
- direction: -1,
1265
- class: "pr-2 bg-base-100 hover:text-base-700"
1266
- }),
1267
- createVNode(_sfc_main$7, { class: "pl-2 bg-base-100 hover:text-base-700" })
1268
- ], 512), [
1269
- [vShow, unref(countValidSlides) > 1]
1270
- ])
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]
1271
1273
  ])
1272
1274
  ];
1273
1275
  }
@@ -1284,23 +1286,18 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1284
1286
  }, {
1285
1287
  default: withCtx((_2, _push3, _parent3, _scopeId2) => {
1286
1288
  if (_push3) {
1287
- ssrRenderSlot(_ctx.$slots, "slide", { slide, i, parsedContents: unref(parsedContents) }, () => {
1288
- if (unref(parsedContents)[i]) {
1289
- _push3(`<span class="prose text-sm text-base-800" data-pitch-bar-slide${_scopeId2}>${unref(parsedContents)[i]}</span>`);
1290
- } else {
1291
- _push3(`<!---->`);
1292
- }
1293
- }, _push3, _parent3, _scopeId2);
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
1294
  } else {
1295
1295
  return [
1296
- renderSlot$1(_ctx.$slots, "slide", { slide, i, parsedContents: unref(parsedContents) }, () => [
1297
- unref(parsedContents)[i] ? (openBlock(), createBlock("span", {
1298
- key: 0,
1299
- innerHTML: unref(parsedContents)[i],
1300
- class: "prose text-sm text-base-800",
1301
- "data-pitch-bar-slide": ""
1302
- }, null, 8, ["innerHTML"])) : createCommentVNode("", true)
1303
- ])
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)
1304
1301
  ];
1305
1302
  }
1306
1303
  }),
@@ -1319,14 +1316,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1319
1316
  class: ["inline-block px-8", slide.href ? "hover:underline" : null]
1320
1317
  }, {
1321
1318
  default: withCtx(() => [
1322
- renderSlot$1(_ctx.$slots, "slide", { slide, i, parsedContents: unref(parsedContents) }, () => [
1323
- unref(parsedContents)[i] ? (openBlock(), createBlock("span", {
1324
- key: 0,
1325
- innerHTML: unref(parsedContents)[i],
1326
- class: "prose text-sm text-base-800",
1327
- "data-pitch-bar-slide": ""
1328
- }, null, 8, ["innerHTML"])) : createCommentVNode("", true)
1329
- ])
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)
1330
1324
  ]),
1331
1325
  _: 2
1332
1326
  }, 1032, ["href", "target", "class"]))
@@ -1335,7 +1329,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1335
1329
  ];
1336
1330
  }
1337
1331
  }),
1338
- _: 3
1332
+ _: 1
1339
1333
  }, _parent));
1340
1334
  _push(`</div></div>`);
1341
1335
  };
@@ -1345,7 +1339,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1345
1339
  const _sfc_setup$5 = _sfc_main$5.setup;
1346
1340
  _sfc_main$5.setup = (props, ctx) => {
1347
1341
  const ssrContext = useSSRContext();
1348
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/PitchBar.vue");
1342
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/PitchBar.vue");
1349
1343
  return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
1350
1344
  };
1351
1345
 
@@ -1353,18 +1347,46 @@ const i19myAccount = "Minha conta";
1353
1347
  const i19openCart = "Abrir carrinho";
1354
1348
  const i19searchProducts = "Buscar produtos";
1355
1349
 
1356
- const useComponentVariant = (props, stringProps) => {
1357
- return computed(() => {
1358
- let variantName = "";
1359
- Object.keys(props).forEach((prop) => {
1360
- if (props[prop] === true && prop !== "modelValue") {
1361
- variantName += ` ${prop.replace(/^(is|has)/, "")}`;
1362
- } else if (stringProps && stringProps.includes(prop)) {
1363
- variantName += ` ${prop}:${props[prop]}`;
1364
- }
1365
- });
1366
- return variantName.slice(1);
1350
+ const useStickyHeader = (props) => {
1351
+ const {
1352
+ header,
1353
+ canSetStyles,
1354
+ canCreateHeightDiv,
1355
+ isShownOnScrollDown
1356
+ } = {
1357
+ canSetStyles: true,
1358
+ canCreateHeightDiv: true,
1359
+ ...props
1360
+ };
1361
+ const { ready, start } = useTimeout(100, { controls: true, immediate: false });
1362
+ const staticHeight = ref(0);
1363
+ const staticY = ref(0);
1364
+ const { y } = { y: ref(0) };
1365
+ const isSticky = computed(() => ready.value && y.value > staticY.value * 1.2);
1366
+ const transition = ref("none");
1367
+ watch(isSticky, async (_isSticky) => {
1368
+ if (canSetStyles) {
1369
+ header.value.style.position = _isSticky ? "sticky" : null;
1370
+ }
1371
+ if (!_isSticky) {
1372
+ start();
1373
+ transition.value = "none";
1374
+ } else {
1375
+ await promiseTimeout(300);
1376
+ transition.value = "opacity var(--transition-slow), transform var(--transition)";
1377
+ }
1367
1378
  });
1379
+ const isScrollUp = ref(false);
1380
+ watch(y, (newY, oldY) => {
1381
+ isScrollUp.value = newY > 0 && newY < oldY;
1382
+ });
1383
+ return {
1384
+ staticHeight,
1385
+ staticY,
1386
+ isSticky,
1387
+ isScrollUp,
1388
+ transition
1389
+ };
1368
1390
  };
1369
1391
 
1370
1392
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
@@ -1373,7 +1395,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1373
1395
  props: {
1374
1396
  modelValue: { type: Boolean, default: false },
1375
1397
  placement: { default: "start" },
1376
- isTeleported: { type: Boolean, default: false },
1398
+ position: { default: "fixed" },
1377
1399
  hasCloseButton: { type: Boolean, default: true }
1378
1400
  },
1379
1401
  emits: [
@@ -1382,10 +1404,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1382
1404
  setup(__props, { emit }) {
1383
1405
  const props = __props;
1384
1406
  const close = () => emit("update:modelValue", false);
1385
- const anchor = ref(null);
1386
- const canvas = ref(null);
1407
+ const drawer = ref(null);
1387
1408
  const outsideClickListener = (ev) => {
1388
- if (!canvas.value?.contains(ev.target)) {
1409
+ if (!drawer.value?.contains(ev.target)) {
1389
1410
  close();
1390
1411
  }
1391
1412
  };
@@ -1395,23 +1416,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1395
1416
  }
1396
1417
  };
1397
1418
  watch(toRef(props, "modelValue"), async (isOpen) => {
1398
- const header = anchor.value.closest('[class*="backdrop-"]');
1399
1419
  if (isOpen) {
1400
1420
  document.body.style.overflow = "hidden";
1401
- if (header) {
1402
- header.style.backdropFilter = "none";
1403
- }
1404
1421
  setTimeout(() => {
1405
1422
  document.addEventListener("click", outsideClickListener, { passive: true });
1406
1423
  document.addEventListener("keydown", escClickListener, { passive: true });
1407
1424
  }, 500);
1408
1425
  } else {
1409
1426
  document.body.style.overflow = null;
1410
- if (header) {
1411
- setTimeout(() => {
1412
- header.style.backdropFilter = null;
1413
- }, 500);
1414
- }
1415
1427
  document.removeEventListener("click", outsideClickListener);
1416
1428
  document.removeEventListener("keydown", escClickListener);
1417
1429
  }
@@ -1428,73 +1440,74 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1428
1440
  return "down";
1429
1441
  }
1430
1442
  });
1431
- const componentVariant = useComponentVariant(props, ["placement"]);
1443
+ const isFixed = computed(() => {
1444
+ return props.position === "fixed";
1445
+ });
1446
+ const isPlacementX = computed(() => {
1447
+ return props.placement === "start" || props.placement === "end";
1448
+ });
1432
1449
  return (_ctx, _push, _parent, _attrs) => {
1433
1450
  const _component_Fade = resolveComponent("Fade");
1434
- _push(`<div${ssrRenderAttrs(mergeProps({
1435
- ref_key: "anchor",
1436
- ref: anchor,
1437
- class: "relative"
1438
- }, _attrs))}>`);
1439
- ssrRenderTeleport(_push, (_push2) => {
1440
- _push2(ssrRenderComponent(_component_Fade, {
1441
- slide: unref(slideTo),
1442
- speed: "slow",
1443
- "is-floating": ""
1444
- }, {
1445
- default: withCtx((_, _push3, _parent2, _scopeId) => {
1446
- if (_push3) {
1447
- if (__props.modelValue) {
1448
- _push3(`<dialog class="${ssrRenderClass([__props.isTeleported ? "fixed top-0 left-0" : "absolute", "w-screen max-w-sm p-0 z-50"])}"${ssrIncludeBooleanAttr(__props.modelValue) ? " open" : ""}${ssrRenderAttr("data-drawer", unref(componentVariant))}${_scopeId}><div class="relative"${_scopeId}>`);
1449
- if (__props.hasCloseButton) {
1450
- _push3(`<button type="button"${ssrRenderAttr("aria-label", "Fechar")} class="${ssrRenderClass([__props.placement === "end" ? "left-2" : "right-2", "absolute top-2"])}" data-drawer-close${_scopeId}>`);
1451
- ssrRenderSlot(_ctx.$slots, "close", {}, () => {
1452
- _push3(`<i class="i-close text-base-400 text-3xl"${_scopeId}></i>`);
1453
- }, _push3, _parent2, _scopeId);
1454
- _push3(`</button>`);
1455
- } else {
1456
- _push3(`<!---->`);
1457
- }
1458
- ssrRenderSlot(_ctx.$slots, "default", {}, null, _push3, _parent2, _scopeId);
1459
- _push3(`</div></dialog>`);
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>`);
1460
1469
  } else {
1461
- _push3(`<!---->`);
1470
+ _push2(`<!---->`);
1462
1471
  }
1472
+ ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
1473
+ _push2(`</div></dialog>`);
1463
1474
  } else {
1464
- return [
1465
- __props.modelValue ? (openBlock(), createBlock("dialog", {
1466
- key: 0,
1467
- class: ["w-screen max-w-sm p-0 z-50", __props.isTeleported ? "fixed top-0 left-0" : "absolute"],
1468
- open: __props.modelValue,
1469
- "data-drawer": unref(componentVariant)
1470
- }, [
1471
- createVNode("div", {
1472
- ref_key: "canvas",
1473
- ref: canvas,
1474
- class: "relative"
1475
- }, [
1476
- __props.hasCloseButton ? (openBlock(), createBlock("button", {
1477
- key: 0,
1478
- type: "button",
1479
- "aria-label": "Fechar",
1480
- onClick: withModifiers(close, ["prevent"]),
1481
- class: ["absolute top-2", __props.placement === "end" ? "left-2" : "right-2"],
1482
- "data-drawer-close": ""
1483
- }, [
1484
- renderSlot$1(_ctx.$slots, "close", {}, () => [
1485
- createVNode("i", { class: "i-close text-base-400 text-3xl" })
1486
- ])
1487
- ], 10, ["onClick"])) : createCommentVNode("", true),
1488
- renderSlot$1(_ctx.$slots, "default")
1489
- ], 512)
1490
- ], 10, ["open", "data-drawer"])) : createCommentVNode("", true)
1491
- ];
1475
+ _push2(`<!---->`);
1492
1476
  }
1493
- }),
1494
- _: 3
1495
- }, _parent));
1496
- }, "#teleported", !__props.isTeleported, _parent);
1497
- _push(`</div>`);
1477
+ } else {
1478
+ return [
1479
+ __props.modelValue ? (openBlock(), createBlock("dialog", {
1480
+ key: 0,
1481
+ ref_key: "drawer",
1482
+ ref: drawer,
1483
+ class: ["w-screen max-w-sm shadow p-0 m-0 z-50", [
1484
+ __props.position,
1485
+ unref(isFixed) ? `top-0 left-0 ${unref(isPlacementX) ? "h-screen" : ""}` : null
1486
+ ]],
1487
+ open: __props.modelValue,
1488
+ "data-drawer": __props.placement
1489
+ }, [
1490
+ createVNode("div", { class: "relative" }, [
1491
+ __props.hasCloseButton ? (openBlock(), createBlock("button", {
1492
+ key: 0,
1493
+ type: "button",
1494
+ "aria-label": "Fechar",
1495
+ onClick: withModifiers(close, ["prevent"]),
1496
+ class: ["absolute top-2", __props.placement === "end" ? "left-2" : "right-2"],
1497
+ "data-drawer-close": ""
1498
+ }, [
1499
+ renderSlot$1(_ctx.$slots, "close", {}, () => [
1500
+ createVNode("i", { class: "i-close text-base-400 text-3xl" })
1501
+ ])
1502
+ ], 10, ["onClick"])) : createCommentVNode("", true),
1503
+ renderSlot$1(_ctx.$slots, "default")
1504
+ ])
1505
+ ], 10, ["open", "data-drawer"])) : createCommentVNode("", true)
1506
+ ];
1507
+ }
1508
+ }),
1509
+ _: 3
1510
+ }, _parent));
1498
1511
  };
1499
1512
  }
1500
1513
  });
@@ -1507,45 +1520,22 @@ _sfc_main$4.setup = (props, ctx) => {
1507
1520
  };
1508
1521
 
1509
1522
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1510
- __name: "StickyHeader",
1523
+ __name: "ShopSidenav",
1511
1524
  __ssrInlineRender: true,
1512
1525
  props: {
1513
- isShownOnScrollDown: { type: Boolean }
1526
+ categories: null
1514
1527
  },
1515
1528
  setup(__props) {
1516
1529
  const props = __props;
1517
- ref(null);
1518
- const { ready, start } = useTimeout(100, { controls: true, immediate: false });
1519
- const height = ref(0);
1520
- const { y } = { y: ref(0) };
1521
- const isSticky = computed(() => ready.value && y.value > height.value * 1.5);
1522
- const transition = ref("none");
1523
- watch(isSticky, async (isSetSticky) => {
1524
- if (!isSetSticky) {
1525
- start();
1526
- transition.value = "none";
1527
- } else {
1528
- await promiseTimeout(300);
1529
- transition.value = "opacity var(--transition-slow), transform var(--transition)";
1530
- }
1530
+ const mainCategories = props.categories.filter(({ slug, parent }) => {
1531
+ return slug && !parent;
1531
1532
  });
1532
- const isScrollUp = ref(false);
1533
- watch(y, (newY, oldY) => {
1534
- isScrollUp.value = newY > 0 && newY < oldY;
1535
- });
1536
- const componentVariant = useComponentVariant(reactive({
1537
- ...props,
1538
- isSticky,
1539
- isScrollUp
1540
- }));
1541
1533
  return (_ctx, _push, _parent, _attrs) => {
1542
- _push(`<!--[--><div style="${ssrRenderStyle(unref(isSticky) ? `height: ${height.value}px` : null)}"></div><header class="${ssrRenderClass([{
1543
- "sticky bg-white/80 backdrop-blur-md shadow py-2 md:py-3": unref(isSticky),
1544
- "opacity-0 -translate-y-full": unref(isSticky) && (!isScrollUp.value || __props.isShownOnScrollDown),
1545
- "py-3 sm:py-4 md:py-5": !unref(isSticky)
1546
- }, "z-50 top-0 will-change-transform"])}" style="${ssrRenderStyle({ transition: transition.value })}"${ssrRenderAttr("data-sticky-header", unref(componentVariant))}>`);
1547
- ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
1548
- _push(`</header><!--]-->`);
1534
+ _push(`<aside${ssrRenderAttrs(mergeProps({ "data-sidenav": "" }, _attrs))}><nav class="py-5" data-sidenav-nav><ul><!--[-->`);
1535
+ ssrRenderList(unref(mainCategories), (mainCategory) => {
1536
+ _push(`<li><a${ssrRenderAttr("href", `/${mainCategory.slug}`)}>${ssrInterpolate(mainCategory.name)}</a></li>`);
1537
+ });
1538
+ _push(`<!--]--></ul></nav></aside>`);
1549
1539
  };
1550
1540
  }
1551
1541
  });
@@ -1553,13 +1543,16 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1553
1543
  const _sfc_setup$3 = _sfc_main$3.setup;
1554
1544
  _sfc_main$3.setup = (props, ctx) => {
1555
1545
  const ssrContext = useSSRContext();
1556
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/StickyHeader.vue");
1546
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/ShopSidenav.vue");
1557
1547
  return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
1558
1548
  };
1559
1549
 
1560
1550
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1561
1551
  __name: "ShopHeader",
1562
1552
  __ssrInlineRender: true,
1553
+ props: {
1554
+ categories: null
1555
+ },
1563
1556
  setup(__props) {
1564
1557
  const buttons = ref({
1565
1558
  search: {
@@ -1582,114 +1575,70 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1582
1575
  }
1583
1576
  });
1584
1577
  const isSidenavOpen = ref(false);
1578
+ const header = ref(null);
1579
+ const {
1580
+ isSticky,
1581
+ staticHeight,
1582
+ staticY
1583
+ } = useStickyHeader({ header });
1584
+ const sidenavHeight = computed(() => {
1585
+ return isSticky.value ? staticHeight.value : staticY.value;
1586
+ });
1585
1587
  return (_ctx, _push, _parent, _attrs) => {
1586
- _push(ssrRenderComponent(_sfc_main$3, _attrs, {
1588
+ _push(`<header${ssrRenderAttrs(mergeProps({
1589
+ ref_key: "header",
1590
+ ref: header,
1591
+ class: ["top-0 z-50", unref(isSticky) ? "bg-white/80 backdrop-blur-md shadow py-2 md:py-3" : "bg-white py-3 sm:py-4 md:py-5"]
1592
+ }, _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">`);
1593
+ ssrRenderSlot(_ctx.$slots, "sidenav-toggle", {}, () => {
1594
+ _push(`<div class="md:hidden" data-sidenav-toggle><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}>`);
1595
+ ssrRenderSlot(_ctx.$slots, "sidenav-toggle-content", {}, () => {
1596
+ _push(`<i class="${ssrRenderClass([isSidenavOpen.value ? "i-close" : "i-menu", "text-base-500 text-3xl"])}"></i>`);
1597
+ }, _push, _parent);
1598
+ _push(`</button></div>`);
1599
+ }, _push, _parent);
1600
+ ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push, _parent);
1601
+ ssrRenderSlot(_ctx.$slots, "nav", {}, null, _push, _parent);
1602
+ ssrRenderSlot(_ctx.$slots, "buttons", {}, () => {
1603
+ _push(`<div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800" data-header-buttons><!--[-->`);
1604
+ ssrRenderList(buttons.value, ({ icon, onClick, label }, name) => {
1605
+ ssrRenderSlot(_ctx.$slots, "button", mergeProps({ key: name }, { name, icon, onClick }), () => {
1606
+ _push(`<button class="${ssrRenderClass(name === "account" ? "hidden sm:block" : null)}"${ssrRenderAttr("aria-label", label)}${ssrRenderAttr("data-header-button", name)}>`);
1607
+ ssrRenderSlot(_ctx.$slots, "button-content", { name, icon }, () => {
1608
+ _push(`<i class="${ssrRenderClass([icon, "hover:text-primary w-7 h-7 hover:scale-110 active:scale-125"])}"></i>`);
1609
+ }, _push, _parent);
1610
+ _push(`</button>`);
1611
+ }, _push, _parent);
1612
+ });
1613
+ _push(`<!--]--></div>`);
1614
+ }, _push, _parent);
1615
+ _push(`</div>`);
1616
+ _push(ssrRenderComponent(_sfc_main$4, {
1617
+ modelValue: isSidenavOpen.value,
1618
+ "onUpdate:modelValue": ($event) => isSidenavOpen.value = $event,
1619
+ "has-close-button": false,
1620
+ position: "absolute",
1621
+ class: "mt-3",
1622
+ style: { height: `calc(100vh - ${unref(sidenavHeight)}px)` }
1623
+ }, {
1587
1624
  default: withCtx((_, _push2, _parent2, _scopeId) => {
1588
1625
  if (_push2) {
1589
- _push2(`<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" data-header${_scopeId}>`);
1590
- ssrRenderSlot(_ctx.$slots, "sidenav-toggle", {}, () => {
1591
- _push2(`<div class="md:hidden" data-sidenav-toggle${_scopeId}><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}${_scopeId}>`);
1592
- ssrRenderSlot(_ctx.$slots, "sidenav-toggle-content", {}, () => {
1593
- _push2(`<i class="i-menu text-base-500 text-3xl"${_scopeId}></i>`);
1594
- }, _push2, _parent2, _scopeId);
1595
- _push2(`</button>`);
1596
- _push2(ssrRenderComponent(_sfc_main$4, {
1597
- modelValue: isSidenavOpen.value,
1598
- "onUpdate:modelValue": ($event) => isSidenavOpen.value = $event,
1599
- class: "-ml-1 lg:-ml-3"
1600
- }, {
1601
- default: withCtx((_2, _push3, _parent3, _scopeId2) => {
1602
- if (_push3) {
1603
- _push3(` MENU `);
1604
- } else {
1605
- return [
1606
- createTextVNode(" MENU ")
1607
- ];
1608
- }
1609
- }),
1610
- _: 1
1611
- }, _parent2, _scopeId));
1612
- _push2(`</div>`);
1613
- }, _push2, _parent2, _scopeId);
1614
- ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push2, _parent2, _scopeId);
1615
- ssrRenderSlot(_ctx.$slots, "nav", {}, null, _push2, _parent2, _scopeId);
1616
- ssrRenderSlot(_ctx.$slots, "buttons", {}, () => {
1617
- _push2(`<div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800" data-header-buttons${_scopeId}><!--[-->`);
1618
- ssrRenderList(buttons.value, ({ icon, onClick, label }, name) => {
1619
- ssrRenderSlot(_ctx.$slots, "button", mergeProps({ key: name }, { name, icon, onClick }), () => {
1620
- _push2(`<button class="${ssrRenderClass(name === "account" ? "hidden sm:block" : null)}"${ssrRenderAttr("aria-label", label)}${ssrRenderAttr("data-header-button", name)}${_scopeId}>`);
1621
- ssrRenderSlot(_ctx.$slots, "button-content", { name, icon }, () => {
1622
- _push2(`<i class="${ssrRenderClass([icon, "hover:text-primary w-7 h-7 hover:scale-110 active:scale-125"])}"${_scopeId}></i>`);
1623
- }, _push2, _parent2, _scopeId);
1624
- _push2(`</button>`);
1625
- }, _push2, _parent2, _scopeId);
1626
- });
1627
- _push2(`<!--]--></div>`);
1628
- }, _push2, _parent2, _scopeId);
1629
- _push2(`</div>`);
1626
+ _push2(ssrRenderComponent(_sfc_main$3, {
1627
+ class: "pt-6",
1628
+ categories: __props.categories
1629
+ }, null, _parent2, _scopeId));
1630
1630
  } else {
1631
1631
  return [
1632
- createVNode("div", {
1633
- 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",
1634
- "data-header": ""
1635
- }, [
1636
- renderSlot$1(_ctx.$slots, "sidenav-toggle", {}, () => [
1637
- createVNode("div", {
1638
- class: "md:hidden",
1639
- "data-sidenav-toggle": ""
1640
- }, [
1641
- createVNode("button", {
1642
- class: "px-2 my-1",
1643
- "aria-label": "Abrir/fechar menu",
1644
- onClick: ($event) => isSidenavOpen.value = !isSidenavOpen.value
1645
- }, [
1646
- renderSlot$1(_ctx.$slots, "sidenav-toggle-content", {}, () => [
1647
- createVNode("i", { class: "i-menu text-base-500 text-3xl" })
1648
- ])
1649
- ], 8, ["onClick"]),
1650
- createVNode(_sfc_main$4, {
1651
- modelValue: isSidenavOpen.value,
1652
- "onUpdate:modelValue": ($event) => isSidenavOpen.value = $event,
1653
- class: "-ml-1 lg:-ml-3"
1654
- }, {
1655
- default: withCtx(() => [
1656
- createTextVNode(" MENU ")
1657
- ]),
1658
- _: 1
1659
- }, 8, ["modelValue", "onUpdate:modelValue"])
1660
- ])
1661
- ]),
1662
- renderSlot$1(_ctx.$slots, "logo"),
1663
- renderSlot$1(_ctx.$slots, "nav"),
1664
- renderSlot$1(_ctx.$slots, "buttons", {}, () => [
1665
- createVNode("div", {
1666
- class: "px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800",
1667
- "data-header-buttons": ""
1668
- }, [
1669
- (openBlock(true), createBlock(Fragment$1, null, renderList(buttons.value, ({ icon, onClick, label }, name) => {
1670
- return renderSlot$1(_ctx.$slots, "button", mergeProps({ key: name }, { name, icon, onClick }), () => [
1671
- createVNode("button", {
1672
- class: name === "account" ? "hidden sm:block" : null,
1673
- "aria-label": label,
1674
- onClick,
1675
- "data-header-button": name
1676
- }, [
1677
- renderSlot$1(_ctx.$slots, "button-content", { name, icon }, () => [
1678
- createVNode("i", {
1679
- class: [icon, "hover:text-primary w-7 h-7 hover:scale-110 active:scale-125"]
1680
- }, null, 2)
1681
- ])
1682
- ], 10, ["aria-label", "onClick", "data-header-button"])
1683
- ]);
1684
- }), 128))
1685
- ])
1686
- ])
1687
- ])
1632
+ createVNode(_sfc_main$3, {
1633
+ class: "pt-6",
1634
+ categories: __props.categories
1635
+ }, null, 8, ["categories"])
1688
1636
  ];
1689
1637
  }
1690
1638
  }),
1691
- _: 3
1639
+ _: 1
1692
1640
  }, _parent));
1641
+ _push(`</header>`);
1693
1642
  };
1694
1643
  }
1695
1644
  });
@@ -1723,20 +1672,22 @@ const $$PagesHeader = createComponent(async ($$result, $$props, $$slots) => {
1723
1672
  html: header.marketing_stripe.text
1724
1673
  }];
1725
1674
  }
1726
- const logoSrc = header.logo || settings.logo;
1675
+ const shopHeader = {
1676
+ categories: apiState.categories
1677
+ };
1727
1678
  const LogoHeading = Astro2.props.logoHeading || (isHomepage ? "h1" : "h2");
1728
1679
  return renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${renderSlot($$result, $$slots["pitch-bar"], renderTemplate`
1729
- ${pitchBar.slides.length > 1 && renderTemplate`${renderComponent($$result, "PitchBar", _sfc_main$5, { ...pitchBar, "client:idle": true, "client:component-hydration": "idle", "client:component-path": "@@sf/components/PitchBar.vue", "client:component-export": "default" })}`}
1680
+ ${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" })}`}
1730
1681
  ${pitchBar.slides.length === 1 && renderTemplate`${renderComponent($$result, "PitchBar", _sfc_main$5, { ...pitchBar })}`}
1731
1682
  `)}${renderSlot($$result, $$slots["sticky-header"], renderTemplate`
1732
- ${renderComponent($$result, "ShopHeader", _sfc_main$2, { "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`
1683
+ ${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`
1733
1684
  ${maybeRenderHead($$result)}<a href="/">
1734
- ${renderComponent($$result, "LogoHeading", LogoHeading, {}, { "default": () => renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": logoSrc, "alt": settings.name, "widths": [300], "sizes": "150px", "fetchpriority": "high", "class": "hover:drop-shadow-sm" })}` })}
1685
+ ${renderComponent($$result, "LogoHeading", LogoHeading, {}, { "default": () => renderTemplate`${renderSlot($$result, $$slots["logo-picture"], renderTemplate`
1686
+ ${renderComponent($$result, "Picture", $$Picture, { "src": header.logo || settings.logo, "alt": settings.name, "widths": [300], "sizes": "150px", "fetchpriority": "high", "class": "hover:drop-shadow-sm" })}
1687
+ `)}` })}
1735
1688
  </a>
1736
1689
  `)}` })}` })}
1737
- `)}` })}
1738
-
1739
- `;
1690
+ `)}` })}`;
1740
1691
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/PagesHeader.astro");
1741
1692
 
1742
1693
  const $$Astro$6 = createAstro("https://ecom2-002.web.app");
@@ -1744,8 +1695,9 @@ const $$Pages = createComponent(async ($$result, $$props, $$slots) => {
1744
1695
  const Astro2 = $$result.createAstro($$Astro$6, $$props, $$slots);
1745
1696
  Astro2.self = $$Pages;
1746
1697
  const { pageContext, title } = Astro2.props;
1698
+ const { settings } = pageContext;
1747
1699
  return renderTemplate`${renderComponent($$result, "Base", $$Base, { "pageContext": pageContext, "title": title }, { "default": () => renderTemplate`${renderSlot($$result, $$slots["header"], renderTemplate`
1748
- ${renderComponent($$result, "Header", $$PagesHeader, { "pageContext": pageContext })}
1700
+ ${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" })}` })}
1749
1701
  `)}${renderSlot($$result, $$slots["default"])}` })}`;
1750
1702
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Pages.astro");
1751
1703
 
@@ -1918,7 +1870,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1918
1870
  },
1919
1871
  setup(__props) {
1920
1872
  const props = __props;
1921
- const prices = usePrices(props);
1922
1873
  const {
1923
1874
  hasVariedPrices,
1924
1875
  salePrice,
@@ -1930,223 +1881,135 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1930
1881
  installmentValue,
1931
1882
  priceWithDiscount,
1932
1883
  discountLabel
1933
- } = prices;
1934
- const componentVariant = useComponentVariant(props);
1884
+ } = usePrices(props);
1935
1885
  return (_ctx, _push, _parent, _attrs) => {
1936
1886
  const _component_Fade = resolveComponent("Fade");
1937
1887
  _push(`<div${ssrRenderAttrs(mergeProps({
1938
- class: "text-base-600",
1939
- "data-prices": unref(componentVariant)
1888
+ class: ["text-base-600", __props.isBig ? "text-lg" : null],
1889
+ "data-prices": ""
1940
1890
  }, _attrs))}>`);
1941
1891
  if (unref(comparePrice)) {
1942
- ssrRenderSlot(_ctx.$slots, "compare", { salePrice: unref(salePrice), comparePrice: unref(comparePrice) }, () => {
1943
- _push(`<span class="text-base-500 mr-1" data-prices-compare>`);
1944
- ssrRenderSlot(_ctx.$slots, "compare-pre", {}, () => {
1945
- if (__props.isLiteral) {
1946
- _push(`<small>${ssrInterpolate(`${"De"} `)}</small>`);
1947
- } else {
1948
- _push(`<!---->`);
1949
- }
1950
- }, _push, _parent);
1951
- ssrRenderSlot(_ctx.$slots, "compare-value", { salePrice: unref(salePrice), comparePrice: unref(comparePrice) }, () => {
1952
- _push(`<s>${ssrInterpolate(_ctx.$money(unref(comparePrice)))}</s>`);
1953
- }, _push, _parent);
1954
- ssrRenderSlot(_ctx.$slots, "compare-post", {}, () => {
1955
- if (__props.isLiteral) {
1956
- _push(`<small>${ssrInterpolate(` ${"Por"}`)}</small>`);
1957
- } else {
1958
- _push(`<!---->`);
1959
- }
1960
- }, _push, _parent);
1961
- _push(`</span>`);
1962
- }, _push, _parent);
1892
+ _push(`<span class="text-base-500 mr-1">`);
1893
+ if (__props.isLiteral) {
1894
+ _push(`<small>${ssrInterpolate(`${"De"} `)}</small>`);
1895
+ } else {
1896
+ _push(`<!---->`);
1897
+ }
1898
+ _push(`<s>${ssrInterpolate(_ctx.$money(unref(comparePrice)))}</s>`);
1899
+ if (__props.isLiteral) {
1900
+ _push(`<small>${ssrInterpolate(` ${"Por"}`)}</small>`);
1901
+ } else {
1902
+ _push(`<!---->`);
1903
+ }
1904
+ _push(`</span>`);
1963
1905
  } else {
1964
1906
  _push(`<!---->`);
1965
1907
  }
1966
- ssrRenderSlot(_ctx.$slots, "sale", { salePrice: unref(salePrice) }, () => {
1967
- _push(`<strong class="inline-block text-base-800" data-prices-sale>`);
1968
- ssrRenderSlot(_ctx.$slots, "sale-pre", {}, () => {
1969
- if (unref(hasVariedPrices)) {
1970
- _push(`<small>${ssrInterpolate(`${"A partir de"} `)}</small>`);
1971
- } else {
1972
- _push(`<!---->`);
1973
- }
1974
- }, _push, _parent);
1975
- ssrRenderSlot(_ctx.$slots, "sale-value", { salePrice: unref(salePrice) }, () => {
1976
- _push(`${ssrInterpolate(_ctx.$money(unref(salePrice)))}`);
1977
- }, _push, _parent);
1978
- ssrRenderSlot(_ctx.$slots, "sale-post", {}, null, _push, _parent);
1979
- _push(`</strong>`);
1980
- }, _push, _parent);
1908
+ _push(`<strong class="${ssrRenderClass([__props.isBig ? "text-5xl block" : null, "inline-block text-base-800"])}">`);
1909
+ if (unref(hasVariedPrices)) {
1910
+ _push(`<small>${ssrInterpolate(`${"A partir de"} `)}</small>`);
1911
+ } else {
1912
+ _push(`<!---->`);
1913
+ }
1914
+ _push(` ${ssrInterpolate(_ctx.$money(unref(salePrice)))}</strong>`);
1981
1915
  _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
1982
1916
  default: withCtx((_, _push2, _parent2, _scopeId) => {
1983
1917
  if (_push2) {
1984
- if (unref(cashbackValue)) {
1985
- ssrRenderSlot(_ctx.$slots, "cashback", { salePrice: unref(salePrice), cashbackValue: unref(cashbackValue), cashbackPercentage: unref(cashbackPercentage) }, () => {
1986
- if (__props.hasCashback) {
1987
- _push2(`<div class="relative z-10" data-prices-cashback${_scopeId}><span${ssrRenderAttr("data-tooltip", "Receba $1 de volta".replace("$1", _ctx.$percentage(unref(cashbackPercentage))))}${_scopeId}>`);
1988
- ssrRenderSlot(_ctx.$slots, "cashback-pre", {}, () => {
1989
- _push2(`<i class="i-cashback mr-1"${_scopeId}></i>`);
1990
- }, _push2, _parent2, _scopeId);
1991
- ssrRenderSlot(_ctx.$slots, "cashback-value", { salePrice: unref(salePrice), cashbackValue: unref(cashbackValue), cashbackPercentage: unref(cashbackPercentage) }, () => {
1992
- _push2(`<span class="font-medium"${_scopeId}>${ssrInterpolate(_ctx.$money(unref(cashbackValue)))}</span>`);
1993
- }, _push2, _parent2, _scopeId);
1994
- ssrRenderSlot(_ctx.$slots, "cashback-post", {}, () => {
1995
- _push2(`<small${_scopeId}> cashback</small>`);
1996
- }, _push2, _parent2, _scopeId);
1997
- _push2(`</span></div>`);
1998
- } else {
1999
- _push2(`<!---->`);
2000
- }
2001
- }, _push2, _parent2, _scopeId);
1918
+ if (unref(cashbackValue) && __props.hasCashback) {
1919
+ _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>`);
2002
1920
  } else {
2003
1921
  _push2(`<!---->`);
2004
1922
  }
2005
1923
  } else {
2006
1924
  return [
2007
- unref(cashbackValue) ? renderSlot$1(_ctx.$slots, "cashback", mergeProps({ key: 0 }, { salePrice: unref(salePrice), cashbackValue: unref(cashbackValue), cashbackPercentage: unref(cashbackPercentage) }), () => [
2008
- __props.hasCashback ? (openBlock(), createBlock("div", {
2009
- key: 0,
2010
- class: "relative z-10",
2011
- "data-prices-cashback": ""
1925
+ unref(cashbackValue) && __props.hasCashback ? (openBlock(), createBlock("div", {
1926
+ key: 0,
1927
+ class: "relative z-10"
1928
+ }, [
1929
+ createVNode("span", {
1930
+ "data-tooltip": "Receba $1 de volta".replace("$1", _ctx.$percentage(unref(cashbackPercentage)))
2012
1931
  }, [
2013
- createVNode("span", {
2014
- "data-tooltip": "Receba $1 de volta".replace("$1", _ctx.$percentage(unref(cashbackPercentage)))
2015
- }, [
2016
- renderSlot$1(_ctx.$slots, "cashback-pre", {}, () => [
2017
- createVNode("i", { class: "i-cashback mr-1" })
2018
- ]),
2019
- renderSlot$1(_ctx.$slots, "cashback-value", { salePrice: unref(salePrice), cashbackValue: unref(cashbackValue), cashbackPercentage: unref(cashbackPercentage) }, () => [
2020
- createVNode("span", { class: "font-medium" }, toDisplayString(_ctx.$money(unref(cashbackValue))), 1)
2021
- ]),
2022
- renderSlot$1(_ctx.$slots, "cashback-post", {}, () => [
2023
- createVNode("small", null, " cashback")
2024
- ])
2025
- ], 8, ["data-tooltip"])
2026
- ])) : createCommentVNode("", true)
2027
- ]) : createCommentVNode("", true)
1932
+ createVNode("i", { class: "i-cashback mr-1" }),
1933
+ createVNode("span", { class: "font-medium" }, toDisplayString(_ctx.$money(unref(cashbackValue))), 1),
1934
+ createVNode("small", null, " cashback")
1935
+ ], 8, ["data-tooltip"])
1936
+ ])) : createCommentVNode("", true)
2028
1937
  ];
2029
1938
  }
2030
1939
  }),
2031
- _: 3
1940
+ _: 1
2032
1941
  }, _parent));
2033
1942
  _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
2034
1943
  default: withCtx((_, _push2, _parent2, _scopeId) => {
2035
1944
  if (_push2) {
2036
- if (unref(installmentValue)) {
2037
- ssrRenderSlot(_ctx.$slots, "installment", { salePrice: unref(salePrice), installmentValue: unref(installmentValue), installmentsNumber: unref(installmentsNumber), monthlyInterest: unref(monthlyInterest) }, () => {
2038
- if (__props.hasPriceOptions) {
2039
- _push2(`<div data-prices-installment${_scopeId}>`);
2040
- ssrRenderSlot(_ctx.$slots, "installment-pre", {}, () => {
2041
- if (__props.isLiteral) {
2042
- _push2(`<small${_scopeId}>${ssrInterpolate(`${"Até"} `)}</small>`);
2043
- } else {
2044
- _push2(`<!---->`);
2045
- }
2046
- }, _push2, _parent2, _scopeId);
2047
- ssrRenderSlot(_ctx.$slots, "installment-value", { salePrice: unref(salePrice), installmentValue: unref(installmentValue), installmentsNumber: unref(installmentsNumber), monthlyInterest: unref(monthlyInterest) }, () => {
2048
- _push2(`${ssrInterpolate(unref(installmentsNumber))}x `);
2049
- if (__props.isLiteral) {
2050
- _push2(`<small${_scopeId}>${ssrInterpolate(` ${"De"} `)}</small>`);
2051
- } else {
2052
- _push2(`<!---->`);
2053
- }
2054
- _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money(unref(installmentValue)))}</span>`);
2055
- }, _push2, _parent2, _scopeId);
2056
- ssrRenderSlot(_ctx.$slots, "installment-post", {}, () => {
2057
- if (!unref(monthlyInterest) && __props.isLiteral) {
2058
- _push2(`<small${_scopeId}>${ssrInterpolate("Sem juros")}</small>`);
2059
- } else {
2060
- _push2(`<!---->`);
2061
- }
2062
- }, _push2, _parent2, _scopeId);
2063
- _push2(`</div>`);
2064
- } else {
2065
- _push2(`<!---->`);
2066
- }
2067
- }, _push2, _parent2, _scopeId);
1945
+ if (unref(installmentValue) && __props.hasPriceOptions) {
1946
+ _push2(`<div${_scopeId}>`);
1947
+ if (__props.isLiteral) {
1948
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"Até"} `)}</small>`);
1949
+ } else {
1950
+ _push2(`<!---->`);
1951
+ }
1952
+ _push2(` ${ssrInterpolate(unref(installmentsNumber))}x `);
1953
+ if (__props.isLiteral) {
1954
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${"De"} `)}</small>`);
1955
+ } else {
1956
+ _push2(`<!---->`);
1957
+ }
1958
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money(unref(installmentValue)))}</span>`);
1959
+ if (!unref(monthlyInterest) && __props.isLiteral) {
1960
+ _push2(`<small${_scopeId}>${ssrInterpolate("Sem juros")}</small>`);
1961
+ } else {
1962
+ _push2(`<!---->`);
1963
+ }
1964
+ _push2(`</div>`);
2068
1965
  } else {
2069
1966
  _push2(`<!---->`);
2070
1967
  }
2071
1968
  } else {
2072
1969
  return [
2073
- unref(installmentValue) ? renderSlot$1(_ctx.$slots, "installment", mergeProps({ key: 0 }, { salePrice: unref(salePrice), installmentValue: unref(installmentValue), installmentsNumber: unref(installmentsNumber), monthlyInterest: unref(monthlyInterest) }), () => [
2074
- __props.hasPriceOptions ? (openBlock(), createBlock("div", {
2075
- key: 0,
2076
- "data-prices-installment": ""
2077
- }, [
2078
- renderSlot$1(_ctx.$slots, "installment-pre", {}, () => [
2079
- __props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"Até"} `))) : createCommentVNode("", true)
2080
- ]),
2081
- renderSlot$1(_ctx.$slots, "installment-value", { salePrice: unref(salePrice), installmentValue: unref(installmentValue), installmentsNumber: unref(installmentsNumber), monthlyInterest: unref(monthlyInterest) }, () => [
2082
- createTextVNode(toDisplayString(unref(installmentsNumber)) + "x ", 1),
2083
- __props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(` ${"De"} `))) : createCommentVNode("", true),
2084
- createVNode("span", null, toDisplayString(_ctx.$money(unref(installmentValue))), 1)
2085
- ]),
2086
- renderSlot$1(_ctx.$slots, "installment-post", {}, () => [
2087
- !unref(monthlyInterest) && __props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString("Sem juros"))) : createCommentVNode("", true)
2088
- ])
2089
- ])) : createCommentVNode("", true)
2090
- ]) : createCommentVNode("", true)
1970
+ unref(installmentValue) && __props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
1971
+ __props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"Até"} `))) : createCommentVNode("", true),
1972
+ createTextVNode(" " + toDisplayString(unref(installmentsNumber)) + "x ", 1),
1973
+ __props.isLiteral ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${"De"} `))) : createCommentVNode("", true),
1974
+ createVNode("span", null, toDisplayString(_ctx.$money(unref(installmentValue))), 1),
1975
+ !unref(monthlyInterest) && __props.isLiteral ? (openBlock(), createBlock("small", { key: 2 }, toDisplayString("Sem juros"))) : createCommentVNode("", true)
1976
+ ])) : createCommentVNode("", true)
2091
1977
  ];
2092
1978
  }
2093
1979
  }),
2094
- _: 3
1980
+ _: 1
2095
1981
  }, _parent));
2096
1982
  _push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
2097
1983
  default: withCtx((_, _push2, _parent2, _scopeId) => {
2098
1984
  if (_push2) {
2099
- if (unref(priceWithDiscount) < unref(salePrice)) {
2100
- ssrRenderSlot(_ctx.$slots, "discount", { salePrice: unref(salePrice), priceWithDiscount: unref(priceWithDiscount), discountLabel: unref(discountLabel) }, () => {
2101
- if (__props.hasPriceOptions) {
2102
- _push2(`<div data-prices-discount${_scopeId}>`);
2103
- ssrRenderSlot(_ctx.$slots, "discount-pre", {}, () => {
2104
- if (!unref(discountLabel)) {
2105
- _push2(`<small${_scopeId}>${ssrInterpolate(`${"A partir de"} `)}</small>`);
2106
- } else {
2107
- _push2(`<!---->`);
2108
- }
2109
- }, _push2, _parent2, _scopeId);
2110
- ssrRenderSlot(_ctx.$slots, "discount-value", { salePrice: unref(salePrice), priceWithDiscount: unref(priceWithDiscount), discountLabel: unref(discountLabel) }, () => {
2111
- _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money(unref(priceWithDiscount)))}</span>`);
2112
- }, _push2, _parent2, _scopeId);
2113
- ssrRenderSlot(_ctx.$slots, "discount-post", {}, () => {
2114
- if (unref(discountLabel)) {
2115
- _push2(`<small${_scopeId}>${ssrInterpolate(` ${unref(discountLabel)}`)}</small>`);
2116
- } else {
2117
- _push2(`<!---->`);
2118
- }
2119
- }, _push2, _parent2, _scopeId);
2120
- _push2(`</div>`);
2121
- } else {
2122
- _push2(`<!---->`);
2123
- }
2124
- }, _push2, _parent2, _scopeId);
1985
+ if (unref(priceWithDiscount) < unref(salePrice) && __props.hasPriceOptions) {
1986
+ _push2(`<div${_scopeId}>`);
1987
+ if (!unref(discountLabel)) {
1988
+ _push2(`<small${_scopeId}>${ssrInterpolate(`${"A partir de"} `)}</small>`);
1989
+ } else {
1990
+ _push2(`<!---->`);
1991
+ }
1992
+ _push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money(unref(priceWithDiscount)))}</span>`);
1993
+ if (unref(discountLabel)) {
1994
+ _push2(`<small${_scopeId}>${ssrInterpolate(` ${unref(discountLabel)}`)}</small>`);
1995
+ } else {
1996
+ _push2(`<!---->`);
1997
+ }
1998
+ _push2(`</div>`);
2125
1999
  } else {
2126
2000
  _push2(`<!---->`);
2127
2001
  }
2128
2002
  } else {
2129
2003
  return [
2130
- unref(priceWithDiscount) < unref(salePrice) ? renderSlot$1(_ctx.$slots, "discount", mergeProps({ key: 0 }, { salePrice: unref(salePrice), priceWithDiscount: unref(priceWithDiscount), discountLabel: unref(discountLabel) }), () => [
2131
- __props.hasPriceOptions ? (openBlock(), createBlock("div", {
2132
- key: 0,
2133
- "data-prices-discount": ""
2134
- }, [
2135
- renderSlot$1(_ctx.$slots, "discount-pre", {}, () => [
2136
- !unref(discountLabel) ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"A partir de"} `))) : createCommentVNode("", true)
2137
- ]),
2138
- renderSlot$1(_ctx.$slots, "discount-value", { salePrice: unref(salePrice), priceWithDiscount: unref(priceWithDiscount), discountLabel: unref(discountLabel) }, () => [
2139
- createVNode("span", null, toDisplayString(_ctx.$money(unref(priceWithDiscount))), 1)
2140
- ]),
2141
- renderSlot$1(_ctx.$slots, "discount-post", {}, () => [
2142
- unref(discountLabel) ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(` ${unref(discountLabel)}`), 1)) : createCommentVNode("", true)
2143
- ])
2144
- ])) : createCommentVNode("", true)
2145
- ]) : createCommentVNode("", true)
2004
+ unref(priceWithDiscount) < unref(salePrice) && __props.hasPriceOptions ? (openBlock(), createBlock("div", { key: 0 }, [
2005
+ !unref(discountLabel) ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"A partir de"} `))) : createCommentVNode("", true),
2006
+ createVNode("span", null, toDisplayString(_ctx.$money(unref(priceWithDiscount))), 1),
2007
+ unref(discountLabel) ? (openBlock(), createBlock("small", { key: 1 }, toDisplayString(` ${unref(discountLabel)}`), 1)) : createCommentVNode("", true)
2008
+ ])) : createCommentVNode("", true)
2146
2009
  ];
2147
2010
  }
2148
2011
  }),
2149
- _: 3
2012
+ _: 1
2150
2013
  }, _parent));
2151
2014
  _push(`</div>`);
2152
2015
  };
@@ -2156,7 +2019,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2156
2019
  const _sfc_setup$1 = _sfc_main$1.setup;
2157
2020
  _sfc_main$1.setup = (props, ctx) => {
2158
2021
  const ssrContext = useSSRContext();
2159
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Prices.vue");
2022
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Prices.vue");
2160
2023
  return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
2161
2024
  };
2162
2025
 
@@ -2326,7 +2189,7 @@ const $$Home = createComponent(async ($$result, $$props, $$slots) => {
2326
2189
  </label>
2327
2190
  </div>
2328
2191
  </div>
2329
- ${renderComponent($$result, "Prices", _sfc_main$1, { "price": 10, "client:load": true, "client:component-hydration": "load", "client:component-path": "@@sf/components/Prices.vue", "client:component-export": "default" })}
2192
+ ${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" })}
2330
2193
  ${renderComponent($$result, "ProductCard", _sfc_main, { "client:load": true, "client:component-hydration": "load", "client:component-path": "@@sf/components/ProductCard.vue", "client:component-export": "default" })}
2331
2194
  </main>`;
2332
2195
  }, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Home.astro");