cloudcommerce 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/package.json +10 -10
- package/packages/api/lib/types/carts.d.ts +72 -20
- package/packages/api/lib/types/orders.d.ts +72 -20
- package/packages/api/lib/types/products.d.ts +82 -11
- package/packages/api/package.json +1 -1
- package/packages/api/src/types/carts.d.ts +72 -20
- package/packages/api/src/types/orders.d.ts +72 -20
- package/packages/api/src/types/products.d.ts +82 -11
- package/packages/apps/correios/package.json +2 -2
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +2 -2
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/frenet/package.json +2 -2
- package/packages/apps/galaxpay/package.json +2 -2
- package/packages/apps/google-analytics/package.json +2 -2
- package/packages/apps/infinitepay/package.json +2 -2
- package/packages/apps/jadlog/package.json +2 -2
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +2 -2
- package/packages/apps/mercadopago/package.json +2 -2
- package/packages/apps/pagarme/package.json +2 -2
- package/packages/apps/paghiper/package.json +2 -2
- package/packages/apps/pix/package.json +2 -2
- package/packages/apps/tiny-erp/package.json +2 -2
- package/packages/apps/webhooks/package.json +2 -2
- package/packages/cli/package.json +2 -2
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +3 -3
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +3 -3
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/firebase/serve-storefront.js +3 -2
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/package.json +5 -5
- package/packages/ssr/src/firebase/serve-storefront.ts +3 -2
- package/packages/storefront/dist/client/_astro/PitchBar.b3636d56.js +1 -0
- package/packages/storefront/dist/client/_astro/{Prices.a1302bf9.js → Prices.2bd87845.js} +1 -1
- package/packages/storefront/dist/client/_astro/{ProductCard.1a45764a.js → ProductCard.48f0f5ba.js} +1 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.44e0873d.js +4 -0
- package/packages/storefront/dist/client/_astro/_...slug_.cd49465e.css +1 -0
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.43eaff51.js +1 -0
- package/packages/storefront/dist/client/_astro/client.14d15518.js +1 -0
- package/packages/storefront/dist/client/_astro/{format-money.6f464cee.js → format-money.060d67ef.js} +1 -1
- package/packages/storefront/dist/client/_astro/{index.a500792d.js → index.3243538d.js} +1 -1
- package/packages/storefront/dist/client/_astro/{modules-info.80ae4e30.js → modules-info.01f8d523.js} +1 -1
- package/packages/storefront/dist/client/_astro/{runtime-dom.esm-bundler.acde10ec.js → runtime-dom.esm-bundler.cb4db78a.js} +1 -1
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/{astro.7d9d5f6e.mjs → astro.a9f695c0.mjs} +16 -3
- package/packages/storefront/dist/server/chunks/pages/{all.42c985c2.mjs → all.7f368e08.mjs} +638 -101
- package/packages/storefront/dist/server/entry.mjs +59 -16
- package/packages/storefront/package.json +10 -10
- package/packages/storefront/src/lib/components/CarouselControl.vue +4 -1
- package/packages/storefront/src/lib/components/globals/AImg.vue +53 -0
- package/packages/storefront/src/lib/composables/use-shop-header-submenu.ts +53 -0
- package/packages/storefront/src/lib/composables/use-shop-header.ts +55 -7
- package/packages/storefront/src/lib/layouts/BaseHead.astro +3 -1
- package/packages/storefront/src/lib/layouts/PagesHeader.astro +3 -0
- package/packages/storefront/src/lib/pages/_vue.ts +2 -0
- package/packages/storefront/src/lib/ssr-context.ts +4 -2
- package/packages/storefront/src/vue-globals.d.ts +1 -0
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/PitchBar.457658a3.js +0 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.d36e6752.js +0 -1
- package/packages/storefront/dist/client/_astro/_...slug_.6721f699.css +0 -1
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.6da04e63.js +0 -1
- package/packages/storefront/dist/client/_astro/client.b854166f.js +0 -1
- package/packages/storefront/dist/client/fallback/index.html +0 -79
- package/packages/storefront/dist/server/chunks/prerender.6899569d.mjs +0 -2
|
@@ -2,7 +2,7 @@ import { performance } from 'node:perf_hooks';
|
|
|
2
2
|
import { ReadableStream, ByteLengthQueuingStrategy, CountQueuingStrategy, ReadableByteStreamController, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, TransformStream, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from 'node:stream/web';
|
|
3
3
|
import * as undici from 'undici';
|
|
4
4
|
import { setTimeout as setTimeout$1, clearTimeout as clearTimeout$1 } from 'node:timers';
|
|
5
|
-
import { N as NodeApp, g as server_default, h as deserializeManifest } from './chunks/astro.
|
|
5
|
+
import { N as NodeApp, g as server_default, h as deserializeManifest } from './chunks/astro.a9f695c0.mjs';
|
|
6
6
|
import { Readable } from 'stream';
|
|
7
7
|
import https from 'https';
|
|
8
8
|
import path from 'path';
|
|
@@ -13,9 +13,8 @@ import send from 'send';
|
|
|
13
13
|
import enableDestroy from 'server-destroy';
|
|
14
14
|
import { defineComponent, useCssVars, unref, computed, useSSRContext, mergeProps, h as h$2, createSSRApp } from 'vue';
|
|
15
15
|
import { ssrRenderSlotInner, ssrRenderAttrs, ssrRenderSlot, renderToString } from 'vue/server-renderer';
|
|
16
|
-
import { i18n, formatMoney } from '@ecomplus/utils';
|
|
17
|
-
/* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as
|
|
18
|
-
import { _ as _page2 } from './chunks/prerender.6899569d.mjs';
|
|
16
|
+
import { img, imgSizes, i18n, formatMoney } from '@ecomplus/utils';
|
|
17
|
+
/* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page2, d as _page3, e as _page4, f as _page5 } from './chunks/pages/all.7f368e08.mjs';
|
|
19
18
|
import 'path-to-regexp';
|
|
20
19
|
import 'tls';
|
|
21
20
|
import 'mime';
|
|
@@ -38,6 +37,7 @@ import '@cloudcommerce/api';
|
|
|
38
37
|
import 'node:fs';
|
|
39
38
|
import '@cloudcommerce/config';
|
|
40
39
|
/* empty css */import '@vueuse/core';
|
|
40
|
+
import '@headlessui/vue';
|
|
41
41
|
|
|
42
42
|
/** Returns the function bound to the given object. */
|
|
43
43
|
const __function_bind = Function.bind.bind(Function.call);
|
|
@@ -3125,7 +3125,7 @@ const adapter = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
3125
3125
|
start
|
|
3126
3126
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
3127
3127
|
|
|
3128
|
-
const _sfc_main$
|
|
3128
|
+
const _sfc_main$2 = defineComponent({
|
|
3129
3129
|
__name: "Fade",
|
|
3130
3130
|
props: {
|
|
3131
3131
|
speed: { default: "default" },
|
|
@@ -3260,7 +3260,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
3260
3260
|
return __returned__;
|
|
3261
3261
|
}
|
|
3262
3262
|
});
|
|
3263
|
-
function _sfc_ssrRender$
|
|
3263
|
+
function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
3264
3264
|
({ style: {
|
|
3265
3265
|
"--68e3b484": $setup.willChange,
|
|
3266
3266
|
"--17a22876": $setup.duration,
|
|
@@ -3273,15 +3273,15 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
3273
3273
|
} });
|
|
3274
3274
|
ssrRenderSlotInner(_ctx.$slots, "default", {}, null, _push, _parent, null, true);
|
|
3275
3275
|
}
|
|
3276
|
-
const _sfc_setup$
|
|
3277
|
-
_sfc_main$
|
|
3276
|
+
const _sfc_setup$2 = _sfc_main$2.setup;
|
|
3277
|
+
_sfc_main$2.setup = (props, ctx) => {
|
|
3278
3278
|
const ssrContext = useSSRContext();
|
|
3279
3279
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/globals/Fade.vue");
|
|
3280
|
-
return _sfc_setup$
|
|
3280
|
+
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
|
|
3281
3281
|
};
|
|
3282
|
-
const Fade = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3282
|
+
const Fade = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2], ["__scopeId", "data-v-d3912920"]]);
|
|
3283
3283
|
|
|
3284
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3284
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3285
3285
|
__name: "ALink",
|
|
3286
3286
|
props: {
|
|
3287
3287
|
href: null,
|
|
@@ -3305,7 +3305,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3305
3305
|
return __returned__;
|
|
3306
3306
|
}
|
|
3307
3307
|
});
|
|
3308
|
-
function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
3308
|
+
function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
3309
3309
|
_push(`<a${ssrRenderAttrs(mergeProps({
|
|
3310
3310
|
href: $props.href,
|
|
3311
3311
|
target: $setup.linkTarget,
|
|
@@ -3314,13 +3314,55 @@ function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $op
|
|
|
3314
3314
|
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
|
|
3315
3315
|
_push(`</a>`);
|
|
3316
3316
|
}
|
|
3317
|
+
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
3318
|
+
_sfc_main$1.setup = (props, ctx) => {
|
|
3319
|
+
const ssrContext = useSSRContext();
|
|
3320
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/globals/ALink.vue");
|
|
3321
|
+
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
3322
|
+
};
|
|
3323
|
+
const ALink = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender$1]]);
|
|
3324
|
+
|
|
3325
|
+
const _sfc_main = defineComponent({
|
|
3326
|
+
__name: "AImg",
|
|
3327
|
+
props: {
|
|
3328
|
+
picture: null,
|
|
3329
|
+
loading: { default: "lazy" }
|
|
3330
|
+
},
|
|
3331
|
+
setup(__props, { expose }) {
|
|
3332
|
+
expose();
|
|
3333
|
+
const props = __props;
|
|
3334
|
+
const image = computed(() => {
|
|
3335
|
+
if (props.picture.url) {
|
|
3336
|
+
return props.picture;
|
|
3337
|
+
}
|
|
3338
|
+
return img(props.picture);
|
|
3339
|
+
});
|
|
3340
|
+
const dimensions = computed(() => {
|
|
3341
|
+
return imgSizes(image.value);
|
|
3342
|
+
});
|
|
3343
|
+
const attrs = computed(() => ({
|
|
3344
|
+
...props,
|
|
3345
|
+
width: dimensions.value.width || null,
|
|
3346
|
+
height: dimensions.value.height || null,
|
|
3347
|
+
src: image.value.url,
|
|
3348
|
+
alt: image.value.alt,
|
|
3349
|
+
picture: null
|
|
3350
|
+
}));
|
|
3351
|
+
const __returned__ = { props, image, dimensions, attrs };
|
|
3352
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
3353
|
+
return __returned__;
|
|
3354
|
+
}
|
|
3355
|
+
});
|
|
3356
|
+
function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
3357
|
+
_push(`<img${ssrRenderAttrs(mergeProps($setup.attrs, _attrs))}>`);
|
|
3358
|
+
}
|
|
3317
3359
|
const _sfc_setup = _sfc_main.setup;
|
|
3318
3360
|
_sfc_main.setup = (props, ctx) => {
|
|
3319
3361
|
const ssrContext = useSSRContext();
|
|
3320
|
-
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/globals/
|
|
3362
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/globals/AImg.vue");
|
|
3321
3363
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
3322
3364
|
};
|
|
3323
|
-
const
|
|
3365
|
+
const AImg = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
|
|
3324
3366
|
|
|
3325
3367
|
const formatPercentage = (value, digits = 1) => {
|
|
3326
3368
|
return Number.isInteger(value) ? `${value}%` : `${value.toFixed(digits)}%`;
|
|
@@ -3338,6 +3380,7 @@ const createApp = (app) => {
|
|
|
3338
3380
|
});
|
|
3339
3381
|
app.component("Fade", Fade);
|
|
3340
3382
|
app.component("ALink", ALink);
|
|
3383
|
+
app.component("AImg", AImg);
|
|
3341
3384
|
};
|
|
3342
3385
|
|
|
3343
3386
|
/**
|
|
@@ -3377,10 +3420,10 @@ const _renderer1 = {
|
|
|
3377
3420
|
renderToStaticMarkup,
|
|
3378
3421
|
};
|
|
3379
3422
|
|
|
3380
|
-
const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.
|
|
3423
|
+
const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.15.0_astro@2.0.14+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js", _page0],["src/pages/index.astro", _page1],["src/pages/fallback.astro", _page2],["src/pages/app/index.astro", _page3],["src/pages/app/account.astro", _page4],["src/pages/[...slug].astro", _page5],]);
|
|
3381
3424
|
const renderers = [Object.assign({"name":"astro:jsx","serverEntrypoint":"astro/jsx/server.js","jsxImportSource":"astro"}, { ssr: server_default }),Object.assign({"name":"@astrojs/vue","clientEntrypoint":"@astrojs/vue/client.js","serverEntrypoint":"@astrojs/vue/server.js"}, { ssr: _renderer1 }),];
|
|
3382
3425
|
|
|
3383
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"
|
|
3426
|
+
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.15.0_astro@2.0.14+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.cd49465e.css","_astro/index.0c833781.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.cd49465e.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app/account","type":"page","pattern":"^\\/app\\/account\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}],[{"content":"account","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/account.astro","pathname":"/app/account","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.cd49465e.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-002.web.app","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true,"contentDir":"file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/content/"},"pageMap":null,"propagation":[["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseStateJson.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/scripts/InlineScripts.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/@astrojs/image/components/Image.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/@astrojs/image/components/Picture.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/ssr/Picture.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/PagesHeader.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Pages.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Home.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Fallback.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/account.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Wildcard.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro","in-tree"]],"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","~/components/Prices.vue":"_astro/Prices.2bd87845.js","@astrojs/vue/client.js":"_astro/client.14d15518.js","/astro/hoisted.js?q=0":"_astro/hoisted.721ad75d.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.295a6886.js","~/components/PitchBar.vue":"_astro/PitchBar.b3636d56.js","@@sf/components/ProductCard.vue":"_astro/ProductCard.48f0f5ba.js","~/components/ShopHeader.vue":"_astro/ShopHeader.44e0873d.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.7ce2ebb1.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/index.0c833781.css","/_astro/server.60de185d.css","/_astro/_...slug_.cd49465e.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-e2ee76b5.js","/_astro/PitchBar.b3636d56.js","/_astro/Prices.2bd87845.js","/_astro/ProductCard.48f0f5ba.js","/_astro/ShopHeader.44e0873d.js","/_astro/_plugin-vue_export-helper.43eaff51.js","/_astro/client.14d15518.js","/_astro/firebase-app.7ce2ebb1.js","/_astro/format-money.060d67ef.js","/_astro/hoisted.721ad75d.js","/_astro/idle-callback.889bf0ea.js","/_astro/index.3243538d.js","/_astro/modules-info.01f8d523.js","/_astro/preload-helper.101896b7.js","/_astro/runtime-dom.esm-bundler.cb4db78a.js","/_astro/session-utm.72684b84.js","/_astro/workbox-window.prod.es5.295a6886.js","/admin/config.json","/assets/cms-preview.css","/assets/cms.css","/assets/cvv.png","/assets/img-placeholder.png","/assets/payments.png","/assets/ssl-safe.png","/img/icon.png","/img/large-icon.png","/img/uploads/banner1.png","/img/uploads/banner2.png","/img/uploads/banner2.webp","/img/uploads/favicon.png","/img/uploads/headless.png","/img/uploads/headphone.png","/img/uploads/headphone.webp","/img/uploads/icon.png","/img/uploads/large-icon.png","/img/uploads/logo.png","/img/uploads/logo.webp","/img/uploads/og-image.png","/img/uploads/passion.png","/img/uploads/passion.webp","/img/uploads/pwa-reliable.png","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.png","/img/uploads/rect89.webp","/img/uploads/ssl-safe.png","/assets/icons/bootstrap-icons/font/storefront-icons.woff2","/assets/icons/feather-icons/font/storefront-icons.woff2","/assets/icons/font-awesome/font/storefront-icons.woff2","/assets/icons/line-awesome/font/storefront-icons.woff2","/assets/icons/tabler-icons/font/storefront-icons.woff2"]}), {
|
|
3384
3427
|
pageMap: pageMap,
|
|
3385
3428
|
renderers: renderers
|
|
3386
3429
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.4",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"prepare-monorepo": "sh scripts/prepare-monorepo.sh"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@astrojs/image": "^0.
|
|
28
|
+
"@astrojs/image": "^0.15.0",
|
|
29
29
|
"@astrojs/node": "^5.0.3",
|
|
30
30
|
"@astrojs/partytown": "^1.0.3",
|
|
31
31
|
"@astrojs/prefetch": "^0.1.2",
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
"@cloudcommerce/i18n": "workspace:*",
|
|
36
36
|
"@ecomplus/utils": "1.5.0-rc.3",
|
|
37
37
|
"@fastify/deepmerge": "^1.3.0",
|
|
38
|
-
"@headlessui/vue": "^1.7.
|
|
38
|
+
"@headlessui/vue": "^1.7.10",
|
|
39
39
|
"@iconify-json/fa6-brands": "^1.1.10",
|
|
40
|
-
"@iconify-json/heroicons": "^1.1.
|
|
40
|
+
"@iconify-json/heroicons": "^1.1.10",
|
|
41
41
|
"@iconify-json/logos": "^1.1.23",
|
|
42
|
-
"@vite-pwa/astro": "^0.0.
|
|
43
|
-
"@vueuse/core": "
|
|
44
|
-
"astro": "^2.0.
|
|
42
|
+
"@vite-pwa/astro": "^0.0.3",
|
|
43
|
+
"@vueuse/core": "9.12.0 || ^9.13.1",
|
|
44
|
+
"astro": "^2.0.14",
|
|
45
45
|
"chroma-js": "^2.4.2",
|
|
46
46
|
"dotenv": "^16.0.3",
|
|
47
47
|
"firebase": "^9.17.1",
|
|
48
48
|
"image-size": "^1.0.2",
|
|
49
49
|
"semver": "^7.3.8",
|
|
50
50
|
"sharp": "^0.31.3",
|
|
51
|
-
"tailwindcss": "^3.2.
|
|
52
|
-
"unocss": "^0.49.
|
|
53
|
-
"vite": "^4.1.
|
|
51
|
+
"tailwindcss": "^3.2.7",
|
|
52
|
+
"unocss": "^0.49.7",
|
|
53
|
+
"vite": "^4.1.3",
|
|
54
54
|
"vite-plugin-pwa": "^0.14.4",
|
|
55
55
|
"vue": "^3.2.47"
|
|
56
56
|
},
|
|
@@ -18,11 +18,14 @@ const { changeSlide } = inject(carouselKey);
|
|
|
18
18
|
:aria-label="direction > 0 ? $t.i19next : $t.i19previous"
|
|
19
19
|
@click="changeSlide(direction)"
|
|
20
20
|
:data-carousel-control="direction > 0 ? 'next' : 'previous'"
|
|
21
|
+
class="group"
|
|
21
22
|
>
|
|
22
23
|
<slot>
|
|
23
24
|
<i
|
|
24
25
|
class="m-0"
|
|
25
|
-
:class="direction > 0
|
|
26
|
+
:class="direction > 0
|
|
27
|
+
? 'i-chevron-right group-active:translate-x-1'
|
|
28
|
+
: 'i-chevron-left group-active:-translate-x-1'"
|
|
26
29
|
></i>
|
|
27
30
|
</slot>
|
|
28
31
|
</button>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type ImgHTMLAttributes, computed } from 'vue';
|
|
3
|
+
import {
|
|
4
|
+
img as getImg,
|
|
5
|
+
imgSizes as getImgSizes,
|
|
6
|
+
} from '@ecomplus/utils';
|
|
7
|
+
|
|
8
|
+
export interface PictureSize {
|
|
9
|
+
url: string;
|
|
10
|
+
alt?: string;
|
|
11
|
+
size?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Props {
|
|
15
|
+
picture: {
|
|
16
|
+
url: string;
|
|
17
|
+
alt?: string;
|
|
18
|
+
size?: string;
|
|
19
|
+
normal?: PictureSize;
|
|
20
|
+
big?: PictureSize;
|
|
21
|
+
zoom?: PictureSize;
|
|
22
|
+
small?: PictureSize;
|
|
23
|
+
_id?: string;
|
|
24
|
+
tag?: string;
|
|
25
|
+
};
|
|
26
|
+
loading?: 'lazy' | 'eager';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
+
loading: 'lazy',
|
|
31
|
+
});
|
|
32
|
+
const image = computed(() => {
|
|
33
|
+
if ((props.picture as PictureSize).url) {
|
|
34
|
+
return props.picture;
|
|
35
|
+
}
|
|
36
|
+
return getImg(props.picture) as PictureSize;
|
|
37
|
+
});
|
|
38
|
+
const dimensions = computed(() => {
|
|
39
|
+
return getImgSizes(image.value) as { width: number, height: number };
|
|
40
|
+
});
|
|
41
|
+
const attrs = computed<ImgHTMLAttributes>(() => ({
|
|
42
|
+
...props,
|
|
43
|
+
width: dimensions.value.width || null,
|
|
44
|
+
height: dimensions.value.height || null,
|
|
45
|
+
src: image.value.url,
|
|
46
|
+
alt: image.value.alt,
|
|
47
|
+
picture: null,
|
|
48
|
+
}));
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<img v-bind="attrs" />
|
|
53
|
+
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CategoryTree } from '@@sf/composables/use-shop-header';
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
categoryTree: CategoryTree;
|
|
6
|
+
megaMenuMaxCols?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const useShopHeaderSubmenu = (props: Props) => {
|
|
10
|
+
const categoryPicture = computed(() => props.categoryTree.pictures?.[0]);
|
|
11
|
+
const subcategoriesWithChild = computed(() => {
|
|
12
|
+
return props.categoryTree.subcategories
|
|
13
|
+
.filter(({ subcategories }) => subcategories.length);
|
|
14
|
+
});
|
|
15
|
+
const maxMenuCols = computed(() => {
|
|
16
|
+
let _maxMenuCols = subcategoriesWithChild.value.length;
|
|
17
|
+
if (categoryPicture.value) {
|
|
18
|
+
_maxMenuCols += 1;
|
|
19
|
+
}
|
|
20
|
+
if (subcategoriesWithChild.value.length < props.categoryTree.subcategories.length) {
|
|
21
|
+
_maxMenuCols += 1;
|
|
22
|
+
}
|
|
23
|
+
return _maxMenuCols;
|
|
24
|
+
});
|
|
25
|
+
const isMegaMenu = computed(() => {
|
|
26
|
+
return (props.megaMenuMaxCols || 7) >= maxMenuCols.value;
|
|
27
|
+
});
|
|
28
|
+
const subcategoryLinks = computed(() => {
|
|
29
|
+
return isMegaMenu.value
|
|
30
|
+
? props.categoryTree.subcategories
|
|
31
|
+
.filter(({ subcategories }) => !subcategories.length)
|
|
32
|
+
: props.categoryTree.subcategories;
|
|
33
|
+
});
|
|
34
|
+
const subcategoryCols = computed(() => {
|
|
35
|
+
return isMegaMenu.value
|
|
36
|
+
? props.categoryTree.subcategories
|
|
37
|
+
.filter(({ subcategories }) => subcategories.length)
|
|
38
|
+
: props.categoryTree.subcategories;
|
|
39
|
+
});
|
|
40
|
+
const countMenuCols = computed(() => {
|
|
41
|
+
if (isMegaMenu.value) return maxMenuCols.value;
|
|
42
|
+
return categoryPicture.value ? 2 : 1;
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
categoryPicture,
|
|
46
|
+
isMegaMenu,
|
|
47
|
+
subcategoryLinks,
|
|
48
|
+
subcategoryCols,
|
|
49
|
+
countMenuCols,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default useShopHeaderSubmenu;
|
|
@@ -6,33 +6,65 @@ import useStickyHeader from '@@sf/composables/use-sticky-header';
|
|
|
6
6
|
export interface Props {
|
|
7
7
|
header: Ref<HTMLElement>;
|
|
8
8
|
categories: CategoriesList;
|
|
9
|
+
menuCategorySlugs?: string[];
|
|
10
|
+
menuRandomCategories?: number;
|
|
11
|
+
isAlphabeticalSortSubmenu?: boolean;
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
type CategoryTree = CategoriesList[0] & {
|
|
12
15
|
subcategories: Array<CategoryTree>,
|
|
13
16
|
};
|
|
14
17
|
|
|
15
|
-
const filterMainCategories = (
|
|
16
|
-
|
|
18
|
+
const filterMainCategories = (
|
|
19
|
+
categories: CategoriesList,
|
|
20
|
+
featuredSlugs?: string[],
|
|
21
|
+
) => {
|
|
22
|
+
const mainCategories = categories.filter(({ slug, parent }) => {
|
|
17
23
|
return slug && !parent;
|
|
18
24
|
});
|
|
25
|
+
if (featuredSlugs?.length) {
|
|
26
|
+
mainCategories.sort((a, b) => {
|
|
27
|
+
const indexA = featuredSlugs.indexOf(a.slug);
|
|
28
|
+
const indexB = featuredSlugs.indexOf(b.slug);
|
|
29
|
+
if (indexA > -1) {
|
|
30
|
+
if (indexB === -1 || indexA < indexB) return -1;
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
if (indexB > -1) return 1;
|
|
34
|
+
return 0;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return mainCategories;
|
|
19
38
|
};
|
|
20
39
|
|
|
21
40
|
const filterSubcategories = (
|
|
22
41
|
categories: CategoriesList,
|
|
23
42
|
parentCategory: CategoriesList[0],
|
|
43
|
+
isAlphabeticalSort = false,
|
|
24
44
|
) => {
|
|
25
|
-
|
|
45
|
+
const subcategories = categories.filter(({ slug, parent }) => {
|
|
26
46
|
if (slug && parent) {
|
|
27
47
|
return parent._id === parentCategory._id
|
|
28
48
|
|| (parent.slug && parent.slug === parentCategory.slug);
|
|
29
49
|
}
|
|
30
50
|
return false;
|
|
31
51
|
});
|
|
52
|
+
if (isAlphabeticalSort) {
|
|
53
|
+
subcategories.sort((a, b) => {
|
|
54
|
+
if (a.name < b.name) return -1;
|
|
55
|
+
return 1;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return subcategories;
|
|
32
59
|
};
|
|
33
60
|
|
|
34
|
-
const useShopHeader = (
|
|
35
|
-
|
|
61
|
+
const useShopHeader = ({
|
|
62
|
+
header,
|
|
63
|
+
categories,
|
|
64
|
+
menuCategorySlugs,
|
|
65
|
+
menuRandomCategories = 7,
|
|
66
|
+
isAlphabeticalSortSubmenu,
|
|
67
|
+
}: Props) => {
|
|
36
68
|
const {
|
|
37
69
|
isSticky,
|
|
38
70
|
staticHeight,
|
|
@@ -41,9 +73,13 @@ const useShopHeader = (props: Props) => {
|
|
|
41
73
|
const positionY = computed(() => {
|
|
42
74
|
return isSticky.value ? header.value.offsetHeight : staticY.value;
|
|
43
75
|
});
|
|
44
|
-
const mainCategories = filterMainCategories(
|
|
76
|
+
const mainCategories = filterMainCategories(categories, menuCategorySlugs);
|
|
45
77
|
const getSubcategories = (parentCategory: CategoriesList[0]) => {
|
|
46
|
-
return filterSubcategories(
|
|
78
|
+
return filterSubcategories(
|
|
79
|
+
categories,
|
|
80
|
+
parentCategory,
|
|
81
|
+
!!isAlphabeticalSortSubmenu,
|
|
82
|
+
);
|
|
47
83
|
};
|
|
48
84
|
const getCategoryTree = (parentCategory: CategoriesList[0]): CategoryTree => {
|
|
49
85
|
return {
|
|
@@ -54,6 +90,17 @@ const useShopHeader = (props: Props) => {
|
|
|
54
90
|
};
|
|
55
91
|
};
|
|
56
92
|
const categoryTrees = mainCategories.map(getCategoryTree);
|
|
93
|
+
let countRandom = 0;
|
|
94
|
+
const inlineMenuTrees = categoryTrees.filter(({ slug }) => {
|
|
95
|
+
if (menuCategorySlugs?.includes(slug)) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
if (countRandom < menuRandomCategories) {
|
|
99
|
+
countRandom += 1;
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
});
|
|
57
104
|
const isSidenavOpen = ref(false);
|
|
58
105
|
return {
|
|
59
106
|
isSticky,
|
|
@@ -64,6 +111,7 @@ const useShopHeader = (props: Props) => {
|
|
|
64
111
|
getSubcategories,
|
|
65
112
|
getCategoryTree,
|
|
66
113
|
categoryTrees,
|
|
114
|
+
inlineMenuTrees,
|
|
67
115
|
isSidenavOpen,
|
|
68
116
|
};
|
|
69
117
|
};
|
|
@@ -73,8 +73,10 @@ if (!ogImage) {
|
|
|
73
73
|
{cmsMetatags?.twitter_username &&
|
|
74
74
|
<meta name="twitter:site" content={cmsMetatags.twitter_username} />}
|
|
75
75
|
<meta name="ecom-store-id" content={String(storeId)}>
|
|
76
|
-
{pwaInfo && <Fragment set:html={pwaInfo.webManifest.linkTag} />}
|
|
77
76
|
<script>
|
|
78
77
|
import { registerSW } from 'virtual:pwa-register';
|
|
79
78
|
registerSW({ immediate: true });
|
|
80
79
|
</script>
|
|
80
|
+
{pwaInfo && <Fragment set:html={pwaInfo.webManifest.linkTag} />}
|
|
81
|
+
{(!pwaInfo && !import.meta.env.DEV) &&
|
|
82
|
+
<link rel="manifest" href="/manifest.webmanifest" />}
|
|
@@ -22,6 +22,9 @@ if (cmsHeader?.pitch_bar) {
|
|
|
22
22
|
}
|
|
23
23
|
const shopHeader: ShopHeaderProps = {
|
|
24
24
|
categories: apiState.categories,
|
|
25
|
+
menuCategorySlugs: cmsHeader.inline_menu_categories?.featured,
|
|
26
|
+
menuRandomCategories: cmsHeader.inline_menu_categories?.random,
|
|
27
|
+
isAlphabeticalSortSubmenu: cmsHeader.alphabetical_sort_submenu,
|
|
25
28
|
};
|
|
26
29
|
const LogoHeading = Astro.props.logoHeading || (isHomepage ? 'h1' : 'h2');
|
|
27
30
|
---
|
|
@@ -2,6 +2,7 @@ import type { App } from 'vue';
|
|
|
2
2
|
import { i18n, formatMoney } from '@ecomplus/utils';
|
|
3
3
|
import Fade from '@@sf/components/globals/Fade.vue';
|
|
4
4
|
import ALink from '@@sf/components/globals/ALink.vue';
|
|
5
|
+
import AImg from '@@sf/components/globals/AImg.vue';
|
|
5
6
|
|
|
6
7
|
const formatPercentage = (value: number, digits = 1) => {
|
|
7
8
|
return Number.isInteger(value) ? `${value}%` : `${value.toFixed(digits)}%`;
|
|
@@ -22,6 +23,7 @@ export default (app: App) => {
|
|
|
22
23
|
});
|
|
23
24
|
app.component('Fade', Fade);
|
|
24
25
|
app.component('ALink', ALink);
|
|
26
|
+
app.component('AImg', AImg);
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
export type FormatPercentage = typeof formatPercentage;
|
|
@@ -29,7 +29,9 @@ declare global {
|
|
|
29
29
|
var api_prefetch_endpoints: ApiEndpoint[];
|
|
30
30
|
}
|
|
31
31
|
if (!globalThis.api_prefetch_endpoints) {
|
|
32
|
-
globalThis.api_prefetch_endpoints = [
|
|
32
|
+
globalThis.api_prefetch_endpoints = [
|
|
33
|
+
'categories?fields=_id,name,slug,parent,icon,pictures.0',
|
|
34
|
+
];
|
|
33
35
|
}
|
|
34
36
|
if (!globalThis.storefront) {
|
|
35
37
|
globalThis.storefront = {
|
|
@@ -95,7 +97,7 @@ const loadPageContext = async (Astro: AstroGlobal, {
|
|
|
95
97
|
apiState[`${apiResource}/${apiDoc._id}`] = apiDoc;
|
|
96
98
|
}
|
|
97
99
|
prefetchResponses.forEach(({ config: { endpoint }, data }) => {
|
|
98
|
-
apiState[endpoint] = data.result || data;
|
|
100
|
+
apiState[endpoint.replace(/\?.*$/, '')] = data.result || data;
|
|
99
101
|
});
|
|
100
102
|
} catch (err: any) {
|
|
101
103
|
const error: ApiError = err;
|
|
@@ -23,6 +23,7 @@ declare module '@vue/runtime-core' {
|
|
|
23
23
|
export interface GlobalComponents {
|
|
24
24
|
Fade: typeof import('@@sf/components/globals/Fade.vue')['default'];
|
|
25
25
|
ALink: typeof import('@@sf/components/globals/ALink.vue')['default'];
|
|
26
|
+
AImg: typeof import('@@sf/components/globals/AImg.vue')['default'];
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as G}from"./runtime-dom.esm-bundler.acde10ec.js";import{p as J}from"./modules-info.80ae4e30.js";import{c as g,d as z,_ as R,m as Q,o as u,a as p,p as x,e as I,n as D,j as d,q as b,s as O,u as X,v as Y,x as Z,y as ee,k as $,w as m,l as q,g as C,z as te,A as ae,B as oe,F as ne,C as re,b as se}from"./_plugin-vue_export-helper.6da04e63.js";import{u as le,a as ie,b as ue}from"./index.a500792d.js";/* empty css */import"./session-utm.72684b84.js";import"./idle-callback.889bf0ea.js";import"./format-money.6f464cee.js";const ce=o=>{const r=g(()=>o.slides.map(({html:e})=>J(e).value)),a=g(()=>r.value.filter(e=>e).length);return{parsedContents:r,countValidSlides:a}},K=Symbol("carousel"),de=z({__name:"CarouselControl",props:{direction:{default:1}},setup(o,{expose:r}){r();const{changeSlide:a}=Q(K),e={changeSlide:a};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),fe=["aria-label","data-carousel-control"];function pe(o,r,a,e,s,n){return u(),p("button",{type:"button","aria-label":a.direction>0?"Próximo":"Anterior",onClick:r[0]||(r[0]=i=>e.changeSlide(a.direction)),"data-carousel-control":a.direction>0?"next":"previous"},[x(o.$slots,"default",{},()=>[I("i",{class:D(["m-0",a.direction>0?"i-chevron-right":"i-chevron-left"])},null,2)])],8,fe)}const U=R(de,[["render",pe]]),me=z({__name:"Carousel",props:{as:{default:"ul"},modelValue:{default:1},autoplay:null},emits:["update:modelValue"],setup(o,{expose:r,emit:a}){r();const e=o,s=d(e.modelValue-1);b(O(e,"modelValue"),t=>{s.value=t-1}),b(s,(t,l)=>{t!==l&&a("update:modelValue",t+1)});const n=d(null),{x:i,isScrolling:f,arrivedState:S}=le(n),y=g(()=>S.left),w=g(()=>S.right),h=d([]),B=d(0),P=d(0),V=d(0),j=()=>{B.value=n.value.scrollWidth,P.value=n.value.offsetWidth},A=()=>{const t=[...n.value.children];h.value=t.map(l=>({offsetLeft:l.offsetLeft,width:l.offsetWidth}))},E=t=>{const l=t>0?s.value:s.value+t,M=h.value[l]?.width||0;return M?M*t:0},L=()=>{const t=h.value.findIndex(l=>Math.abs(l.offsetLeft-i.value)<=5);t>-1&&(s.value=t||0)},T=()=>{const t=B.value-P.value;V.value=h.value.findIndex(({offsetLeft:l})=>l>=t-5)};let c=null;const v=()=>{e.autoplay&&(clearTimeout(c),c=setTimeout(()=>{_(1)},e.autoplay))},_=t=>{if(t<0){if(y.value){T(),s.value=V.value-1,_(1);return}}else if(w.value){s.value=1,_(-1);return}const l=E(t);l&&(n.value.scrollBy({left:l,behavior:"smooth"}),v())};b(f,t=>{t?clearTimeout(c):(L(),v())});const N=d(null),F=ie(N);b(F,t=>{t?clearTimeout(c):v()});const W=()=>{n.value&&(j(),A(),L(),T())},k=ue(W,400);X(()=>{W(),Y(()=>{[...n.value.children].forEach(t=>{t.setAttribute("tabindex","0")})}),v(),window.addEventListener("resize",k)}),Z(()=>{window.removeEventListener("resize",k),clearTimeout(c)}),ee(K,{autoplay:O(e,"autoplay"),changeSlide:_,isBoundLeft:y,isBoundRight:w});const H={props:e,emit:a,currentIndex:s,wrapper:n,currentPos:i,isScrolling:f,arrivedState:S,isBoundLeft:y,isBoundRight:w,slidesWidth:h,wrapperScrollWidth:B,wrapperVisibleWidth:P,indexCount:V,calcWrapperWidth:j,calcSlidesWidth:A,calcNextWidth:E,calcCurrentIndex:L,calcIndexCount:T,get autoplayTimer(){return c},set autoplayTimer(t){c=t},restartAutoplay:v,changeSlide:_,carousel:N,isHovered:F,calcOnInit:W,onResize:k,CarouselControl:U};return Object.defineProperty(H,"__isScriptSetup",{enumerable:!1,value:!0}),H}}),he={ref:"carousel","data-carousel":""};function ve(o,r,a,e,s,n){return u(),p("div",he,[(u(),$(q(a.as),{ref:"wrapper","data-carousel-wrapper":""},{default:m(()=>[x(o.$slots,"default")]),_:3},512)),x(o.$slots,"controls",te(ae({changeSlide:e.changeSlide,isBoundLeft:e.isBoundLeft,isBoundRight:e.isBoundRight,currentPage:e.currentIndex+1,pageCount:e.indexCount+1})),()=>[C(e.CarouselControl,{direction:-1},{default:m(()=>[x(o.$slots,"previous")]),_:3}),C(e.CarouselControl,null,{default:m(()=>[x(o.$slots,"next")]),_:3})])],512)}const _e=R(me,[["render",ve]]),xe=z({__name:"PitchBar",props:{slides:null},setup(o,{expose:r}){r();const a=o,{parsedContents:e,countValidSlides:s}=ce(a),n={props:a,parsedContents:e,countValidSlides:s,Carousel:_e,CarouselControl:U};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),Ce={class:"bg-base-100 relative z-1"},be={class:"container md:w-2/3 mx-auto px-3 py-1"},ge=["innerHTML"],Se={class:"text-xl leading-none text-base-400"};function ye(o,r,a,e,s,n){return u(),p("div",Ce,[I("div",be,[C(e.Carousel,{autoplay:e.countValidSlides>1?7e3:null},{controls:m(()=>[oe(I("div",Se,[C(e.CarouselControl,{direction:-1,class:"pr-2 bg-base-100 hover:text-base-700"}),C(e.CarouselControl,{class:"pl-2 bg-base-100 hover:text-base-700"})],512),[[G,e.countValidSlides>1]])]),default:m(()=>[(u(!0),p(ne,null,re(a.slides,(i,f)=>(u(),p("li",{key:f},[(u(),$(q(i.href?"ALink":"span"),{href:i.href,target:i.target,class:D(["inline-block px-8",i.href?"hover:underline":null])},{default:m(()=>[e.parsedContents[f]?(u(),p("span",{key:0,innerHTML:e.parsedContents[f],class:"prose text-sm text-base-800"},null,8,ge)):se("",!0)]),_:2},1032,["href","target","class"]))]))),128))]),_:1},8,["autoplay"])])])}const Ie=R(xe,[["render",ye]]);export{Ie as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as ne,u as re,p as ie,b as le}from"./index.a500792d.js";import{j as k,c as b,q as C,u as Z,d as L,s as ce,_ as P,r as U,o as c,k as $,w as M,a as p,n as x,e as l,p as V,b as I,a3 as ue,g as B,h as q,l as de,t as E,F as z,C as H,f as me,a4 as he,a5 as pe,a6 as fe}from"./_plugin-vue_export-helper.6da04e63.js";import{w as _e}from"./runtime-dom.esm-bundler.acde10ec.js";import{_ as ge}from"./preload-helper.101896b7.js";import{i as ye}from"./idle-callback.889bf0ea.js";const we=e=>{if(e){if(e.display_name)return e.display_name;if(e.name&&e.name.given_name)return e.name.given_name}return""},be=we,ve=e=>{const{header:s,canSetStyles:t,canCreateHeightDiv:a,isShownOnScrollDown:n}={canSetStyles:!0,canCreateHeightDiv:!0,...e},{ready:r,start:o}=ne(100,{controls:!0,immediate:!1}),i=k(0),u=k(0);let f;const{y:S}=re(document),m=b(()=>r.value&&S.value>u.value*1.2),h=k("none");C(m,async y=>{t&&(s.value.style.position=y?"sticky":null),f&&(f.style.height=y?`${i.value}px`:null),y?(await ie(300),h.value="opacity var(--transition-slow), transform var(--transition)"):(o(),h.value="none")});const A=k(!1);return C(S,(y,d)=>{A.value=y>0&&y<d}),Z(()=>{const y=()=>{i.value=s.value.offsetHeight,u.value=i.value+window.pageYOffset+s.value.getBoundingClientRect().top,o()},d=s.value.getElementsByTagName("IMG");let w=!0;for(let _=0;_<d.length;_++){const T=d[_];(!T.complete||T.naturalHeight===0)&&(w=!1,T.onload=y)}w&&y(),window.addEventListener("resize",le(y,300)),t&&(s.value.style.willChange="transform",C([m,A],([_,T])=>{let j=null,K=null;_&&(!T||n)&&(j="0",K="translateY(-100%)"),s.value.style.opacity=j,s.value.style.transform=K}),C(h,_=>{s.value.style.transition=_})),a&&(f=document.createElement("div"),s.value.parentElement.insertBefore(f,s.value))}),{staticHeight:i,staticY:u,isSticky:m,isScrollUp:A,transition:h}},Se=e=>e.filter(({slug:s,parent:t})=>s&&!t),ke=(e,s)=>e.filter(({slug:t,parent:a})=>t&&a?a._id===s._id||a.slug&&a.slug===s.slug:!1),xe=e=>{const{header:s}=e,{isSticky:t,staticHeight:a,staticY:n}=ve({header:s}),r=b(()=>t.value?s.value.offsetHeight:n.value),o=Se(e.categories),i=m=>ke(e.categories,m),u=m=>({...m,subcategories:i(m).map(h=>u(h))}),f=o.map(u),S=k(!1);return{isSticky:t,staticHeight:a,staticY:n,positionY:r,mainCategories:o,getSubcategories:i,getCategoryTree:u,categoryTrees:f,isSidenavOpen:S}},Te=L({__name:"Drawer",props:{modelValue:{type:Boolean,default:!1},placement:{default:"start"},position:{default:"fixed"},hasCloseButton:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(e,{expose:s,emit:t}){s();const a=e,n=()=>t("update:modelValue",!1),r=k(null),o=h=>{r.value?.contains(h.target)||n()},i=h=>{h.key==="Escape"&&n()};C(ce(a,"modelValue"),async h=>{h?(document.body.style.overflow="hidden",setTimeout(()=>{document.addEventListener("click",o,{passive:!0}),document.addEventListener("keydown",i,{passive:!0})},500)):(document.body.style.overflow=null,document.removeEventListener("click",o),document.removeEventListener("keydown",i))});const u=b(()=>{switch(a.placement){case"start":return"left";case"end":return"right";case"top":return"up";default:return"down"}}),f=b(()=>a.position==="fixed"),S=b(()=>a.placement==="start"||a.placement==="end"),m={props:a,emit:t,close:n,drawer:r,outsideClickListener:o,escClickListener:i,slideTo:u,isFixed:f,isPlacementX:S};return Object.defineProperty(m,"__isScriptSetup",{enumerable:!1,value:!0}),m}}),Ce=["open","data-drawer"],Oe={class:"relative h-full"},Ee=["onClick"],Ae=l("i",{class:"i-close text-base-400 text-3xl"},null,-1),Ne={key:0,class:"fixed top-0 left-0 w-screen h-screen bg-black/50 z-40","data-drawer-backdrop":""};function Ie(e,s,t,a,n,r){const o=U("Fade");return c(),$(o,{slide:a.slideTo,speed:"slow","is-floating":""},{default:M(()=>[t.modelValue?(c(),p("dialog",{key:0,ref:"drawer",class:x(["w-screen max-w-sm shadow p-0 m-0 z-50",[t.position,a.isFixed?`top-0 left-0 ${a.isPlacementX?"h-screen":""}`:null]]),open:t.modelValue,"data-drawer":t.placement},[l("div",Oe,[t.hasCloseButton?(c(),p("button",{key:0,type:"button","aria-label":"Fechar",onClick:_e(a.close,["prevent"]),class:x(["absolute top-2",t.placement==="end"?"left-2":"right-2"]),"data-drawer-close":""},[V(e.$slots,"close",{},()=>[Ae])],10,Ee)):I("",!0),V(e.$slots,"default")]),(c(),$(ue,{to:"#teleported-top"},[B(o,null,{default:M(()=>[t.modelValue?(c(),p("div",Ne)):I("",!0)]),_:1})]))],10,Ce)):I("",!0)]),_:3},8,["slide"])}const $e=P(Te,[["render",Ie]]);globalThis.__apiCache||(globalThis.__apiCache={});const N={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0};class G extends Error{constructor(s,t,a,n=!1){t?(super(t.statusText),this.data=t.data,this.statusCode=t.status):super(a||"Request error"),this.config=s,this.response=t,this.isTimeout=n}}const Le={middleware(e){const s={...e.headers};if(!e.isNoAuth)if(e.accessToken)s.Authorization=`Bearer ${e.accessToken}`;else{const r=e.authenticationId||N.ECOM_AUTHENTICATION_ID,o=e.apiKey||N.ECOM_API_KEY;if(r&&o){const i=`${r}:${o}`,u=typeof Buffer=="function"?Buffer.from(i).toString("base64"):btoa(i);s.Authorization=`Basic ${u}`}}let t=e.baseUrl||N.API_BASE_URL||"https://ecomplus.io/v2";const{endpoint:a,params:n}=e;if(a!=="login"&&a!=="authenticate"&&a!=="ask-auth-callback"&&a!=="check-username"){const r=e.storeId||N.ECOM_STORE_ID;if(!r)throw new Error("`storeId` must be set in config or `ECOM_STORE_ID` env var");t+=`/:${r}`;const o=e.lang||N.ECOM_LANG;o&&(t+=`,lang:${o}`)}if(t+=`/${a}`,n){if(typeof n=="string")t+=`?${n}`;else if(typeof n=="object"){const r=new URLSearchParams;Object.keys(n).forEach(o=>{const i=n[o];Array.isArray(i)?i.forEach(u=>{r.append(o,u)}):r.append(o,i)}),t+=`?${r.toString()}`}}return{url:t,headers:s}}},g=async(e,s=0)=>{const{url:t,headers:a}=Le.middleware(e),{method:n="get",timeout:r=2e4,maxRetries:o=3,cacheMaxAge:i=6e5}=e,u=n==="get"&&(e.canCache||e.canCache===void 0&&N.SSR);let f;if(u){f=`${t}${JSON.stringify(a)}`;const w=globalThis.__apiCache[f];if(w&&Date.now()-w.timestamp<=i)return{...w.res,config:e}}const S=e.body||e.data;let m;S&&(m=JSON.stringify(S),a["Content-Type"]="application/json",a["Content-Length"]=m.length.toString());const h=new AbortController;let A=!1;const y=setTimeout(()=>{h.abort(),A=!0},r);let d;try{d=await(e.fetch||fetch)(t,{method:n,headers:a,body:m,signal:h.signal})}catch(w){throw new G(e,d,w.message,A)}if(clearTimeout(y),d){if(d.ok){const _={...d,data:await d.json()};return u&&f&&(globalThis.__apiCache[f]={timestamp:Date.now(),res:_}),{..._,config:e}}const{status:w}=d;if(o<s&&(w===429||w>=500)){const _=d.headers.get("retry-after");return new Promise((T,j)=>{setTimeout(()=>{g(e,s+1).then(T).catch(j)},_&&parseInt(_,10)||5e3)})}}try{d.data=await d?.json()}catch{}throw new G(e,d)},Pe=(e,s)=>g({...s,endpoint:e}),Ve=(e,s,t)=>g({...t,method:"post",endpoint:e,body:s}),Be=(e,s,t)=>g({...t,method:"put",endpoint:e,body:s}),De=(e,s,t)=>g({...t,method:"patch",endpoint:e,body:s}),ee=(e,s)=>g({...s,method:"delete",endpoint:e});g.get=Pe;g.post=Ve;g.put=Be;g.patch=De;g.del=ee;g.delete=ee;const je=(e,s,t=globalThis.localStorage)=>{if(!t)return q(s);let a;const n=t.getItem(e);if(n)try{a=JSON.parse(n)}catch{a=null,t.removeItem(e)}const r=q(a||s);return C(r,()=>{t.setItem(e,JSON.stringify(r))}),r},te="SESSION",R={customer:{display_name:"",main_email:""},auth:null},v=je(te,R),Y=b(()=>{const{auth:e}=v;return e&&new Date(e.expires).getTime()-Date.now()>1e3*10}),ae=b(()=>v.customer),F=b(()=>be(ae.value)),W=b({get(){return ae.value.main_email},set(e){v.customer.main_email=e}});let O;const Me=b(()=>Y.value||!!O?.currentUser?.emailVerified),se=()=>{v.auth=R.auth,v.customer=R.customer,localStorage.removeItem(te),O.signOut()},oe=async()=>{const e=await O.currentUser.getIdToken(),{domain:s}=window.storefront.settings;try{const t=await fetch(`https://${s}/api/passport/token`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});v.auth=await t.json()}catch(t){console.error(t)}},ze=async()=>(Y.value||await oe(),v.auth.access_token),He=async()=>{const e=await ze(),{data:s}=await g.get(`customers/${v.auth.customer_id}`,{accessToken:e});return v.customer=s,s};let X=!1;const Re=(e=!window.location.pathname.startsWith("/app/"))=>{if(X)return;X=!0;const s=()=>ge(()=>import("./firebase-app.7ce2ebb1.js"),[]).then(({getAuth:t,onAuthStateChanged:a,isSignInWithEmailLink:n,signInWithEmailLink:r})=>{if(O=t(),a(O,async o=>{if(o){if(o.displayName&&!F.value&&(v.customer.display_name=o.displayName),o.email&&(!W.value||o.emailVerified)&&(v.customer.main_email=o.email),o.emailVerified){const i=o.email!==W.value;(i||!Y.value)&&(await oe(),(i||!F.value)&&await He())}}else se()}),n(O,window.location.href)){const i=new URLSearchParams(window.location.search).get("email");i&&r(O,i,window.location.href).then(()=>window.localStorage.removeItem("emailForSignIn")).catch(console.error)}}).catch(console.error);e?ye(s):s()},{settings:Q,context:Lt}=globalThis.storefront,Fe=["whatsapp","instagram","facebook","twitter","youtube","tiktok","pinterest"],J={};Fe.forEach(e=>{Q[e]&&(J[e]=Q[e])});let D;D=navigator.userAgent,document.body?document.body.offsetWidth:window.screen.width;D.includes("Safari")&&D.includes("Chrome");const Ue=/iPad|iPhone|iPod/.test(D)&&!window.MSStream,Ye=Ue||/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(D),Je=L({__name:"SocialNetworkIcon",props:{as:{default:"i"},network:null},setup(e,{expose:s}){s();const t=e,a=b(()=>{switch(t.network){case"facebook":return"i-facebook";case"instagram":return"i-instagram";case"whatsapp":return"i-whatsapp";case"youtube":return"i-youtube";case"pinterest":return"i-pinterest";case"tiktok":return"i-tiktok";case"twitter":return"i-twitter";default:return""}}),n={props:t,iconClassName:a};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}});function Ke(e,s,t,a,n,r){return c(),$(de(t.as),{class:x(a.iconClassName)},null,8,["class"])}const qe=P(Je,[["render",Ke]]),Ge=L({__name:"SocialNetworkLink",props:{network:null,href:null,message:null},setup(e,{expose:s}){s();const t=e,a=b(()=>{let r=t.href||J[t.network];if(t.network==="whatsapp"){const o=r.replace(/[^+\d]/g,"");r=`https://${Ye?"api":"web"}.whatsapp.com/send?phone=`+encodeURIComponent(o.charAt(0)==="+"?o:`+55${o}`),t.message&&(r+=`&text=${encodeURIComponent(t.message)}`)}return r}),n={props:t,fixedHref:a,SocialNetworkIcon:qe};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}});function We(e,s,t,a,n,r){const o=U("ALink");return c(),$(o,{href:a.fixedHref},{default:M(()=>[V(e.$slots,"default",{},()=>[B(a.SocialNetworkIcon,{network:t.network},null,8,["network"]),V(e.$slots,"append")])]),_:3},8,["href"])}const Xe=P(Ge,[["render",We]]),Qe=L({__name:"ShopSidenavCategory",props:{categoryTree:null},setup(e,{expose:s}){s();const t=k(!1),a=k(!0);C(t,r=>{r?setTimeout(()=>{a.value=!1},25):a.value=!0});const n={isOpen:t,isFaded:a};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),Ze={class:"text-lg text-base-800"},et=["src"],tt=["href"],at=["href"],st=["src"],ot={class:"inline"};function nt(e,s,t,a,n,r){const o=U("ShopSidenavCategory",!0);return c(),p("li",Ze,[t.categoryTree.subcategories.length?(c(),p("details",{key:0,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",onToggle:s[0]||(s[0]=i=>a.isOpen=!a.isOpen)},[l("summary",{class:x(["cursor-pointer list-none px-6 py-3 active:bg-base-100 transition-colors",a.isOpen?"bg-base-100":null])},[l("i",{class:x(a.isOpen?"i-arrow-left text-lg":"i-arrow-right float-right mb-0 mt-1 text-xl text-base-500")},null,2),!a.isOpen&&t.categoryTree.icon?(c(),p("img",{key:0,loading:"lazy",src:t.categoryTree.icon.url,class:"w-auto h-5 inline mr-3"},null,8,et)):I("",!0),l("h3",{class:x(["inline",a.isOpen?"ml-4 text-base":null])},E(t.categoryTree.name),3)],2),l("ul",{class:x(["mt-2 transition-opacity",a.isFaded?"opacity-20":"opacity-100"]),tabindex:"-1"},[(c(!0),p(z,null,H(t.categoryTree.subcategories,i=>(c(),$(o,{key:i._id,"category-tree":i},null,8,["category-tree"]))),128)),l("li",null,[l("a",{href:`/${t.categoryTree.slug}`,class:"block px-6 py-3 text-base underline active:bg-base-200"},E("Ver toda a categoria $1".replace("$1",t.categoryTree.name)),9,tt)])],2)],32)):(c(),p("a",{key:1,href:`/${t.categoryTree.slug}`,class:"block px-6 py-3 active:bg-base-200"},[!a.isOpen&&t.categoryTree.icon?(c(),p("img",{key:0,loading:"lazy",src:t.categoryTree.icon.url,class:"w-auto h-5 inline mr-3"},null,8,st)):I("",!0),l("h3",ot,E(t.categoryTree.name),1)],8,at))])}const rt=P(Qe,[["render",nt]]),it=L({__name:"ShopSidenav",props:{categoryTrees:null},setup(e,{expose:s}){s(),Z(()=>Re());const t={get customerName(){return F},get isLogged(){return Me},get logout(){return se},get socialNetworks(){return J},SocialNetworkLink:Xe,ShopSidenavCategory:rt};return Object.defineProperty(t,"__isScriptSetup",{enumerable:!1,value:!0}),t}}),lt={class:"flex flex-col h-full"},ct={class:"py-4 grow"},ut={class:"relative h-full"},dt={class:"text-base"},mt={class:"flex items-center px-2 py-4 bg-base-100"},ht={href:"/app/account",class:"p-2 grow flex items-center gap-3"},pt=l("i",{class:"i-account text-4xl text-base-500 m-0"},null,-1),ft={class:"leading-tight"},_t=l("small",{class:"block lowercase font-semibold text-primary"},E("Meus pedidos")+", "+E("Minha conta"),-1),gt=l("span",{class:"text-base-600"},E("Sair"),-1),yt=l("i",{class:"i-logout text-lg ml-1"},null,-1),wt=[gt,yt],bt={class:"flex gap-3 p-4 bg-base-200 text-xl text-base-700"};function vt(e,s,t,a,n,r){return c(),p("aside",lt,[l("nav",ct,[l("ul",ut,[(c(!0),p(z,null,H(t.categoryTrees,o=>(c(),$(a.ShopSidenavCategory,{key:o._id,"category-tree":o},null,8,["category-tree"]))),128))])]),l("footer",dt,[l("div",mt,[l("a",ht,[pt,l("span",ft,[me(E(`Olá ${a.customerName||"Visitante"}`)+" ",1),_t])]),a.isLogged?(c(),p("button",{key:0,onClick:s[0]||(s[0]=(...o)=>a.logout&&a.logout(...o)),class:"p-2 text-right text-base-800"},wt)):I("",!0)]),l("ul",bt,[(c(!0),p(z,null,H(a.socialNetworks,(o,i)=>(c(),p("li",{key:i},[B(a.SocialNetworkLink,{network:i,class:"p-1 active:text-primary"},null,8,["network"])]))),128))])])])}const St=P(it,[["render",vt]]),kt=L({__name:"ShopHeader",props:{categories:null},setup(e,{expose:s}){s();const t=e,a=k(null),{isSticky:n,positionY:r,categoryTrees:o,isSidenavOpen:i}=xe({...t,header:a}),u={props:t,header:a,isSticky:n,positionY:r,categoryTrees:o,isSidenavOpen:i,Drawer:$e,ShopSidenav:St};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),xt={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"},Tt={class:"md:hidden"},Ct=pe('<nav class="hidden md:block"></nav><div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800"><button 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" aria-label="Minha conta"><i class="i-account w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button 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>',2);function Ot(e,s,t,a,n,r){return c(),p("header",{ref:"header",class:x(["top-0 z-50 transition-colors",[a.isSticky&&!a.isSidenavOpen?"bg-white/80":"bg-white",a.isSticky?"backdrop-blur-md shadow py-2 md:py-3":"py-3 sm:py-4 md:py-5"]])},[l("div",xt,[l("div",Tt,[l("button",{class:"px-2 my-1","aria-label":"Abrir/fechar menu",onClick:s[0]||(s[0]=o=>a.isSidenavOpen=!a.isSidenavOpen)},[l("i",{class:x(["text-base-500 text-3xl",a.isSidenavOpen?"i-close":"i-menu"])},null,2)])]),V(e.$slots,"logo"),Ct]),B(a.Drawer,{modelValue:a.isSidenavOpen,"onUpdate:modelValue":s[1]||(s[1]=o=>a.isSidenavOpen=o),"has-close-button":!1,position:"absolute",class:"mt-3 -z-1",style:he({height:`calc(100vh - ${a.positionY}px + .5rem)`})},{default:M(()=>[B(a.ShopSidenav,fe({class:"bg-white pt-6"},{categoryTrees:a.categoryTrees}),null,16)]),_:1},8,["modelValue","style"])],2)}const Pt=P(kt,[["render",Ot]]);export{Pt as default};
|