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
|
@@ -9,7 +9,7 @@ import 'node:os';
|
|
|
9
9
|
import sizeOf from 'image-size';
|
|
10
10
|
import 'magic-string';
|
|
11
11
|
import 'node:stream';
|
|
12
|
-
import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, u as unescapeHTML, m as maybeRenderHead, d as renderSlot, e as renderComponent, f as renderHead, F as Fragment, s as spreadAttributes } from '../astro.
|
|
12
|
+
import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, u as unescapeHTML, m as maybeRenderHead, d as renderSlot, e as renderComponent, f as renderHead, F as Fragment, s as spreadAttributes } from '../astro.a9f695c0.mjs';
|
|
13
13
|
import api from '@cloudcommerce/api';
|
|
14
14
|
import { reactive, computed, defineComponent, inject, useSSRContext, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, resolveComponent, withModifiers, Teleport, toDisplayString, createTextVNode } from 'vue';
|
|
15
15
|
import { img, price, formatMoney, nickname, onPromotion } from '@ecomplus/utils';
|
|
@@ -19,6 +19,7 @@ import fs, { readFileSync } from 'node:fs';
|
|
|
19
19
|
import config from '@cloudcommerce/config';
|
|
20
20
|
import { resolve as resolve$1 } from 'path';
|
|
21
21
|
/* empty css */import { useScroll, useElementHover, useDebounceFn, useTimeout, promiseTimeout } from '@vueuse/core';
|
|
22
|
+
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue';
|
|
22
23
|
|
|
23
24
|
const _export_sfc = (sfc, props) => {
|
|
24
25
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -29,7 +30,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
function isOutputFormat(value) {
|
|
32
|
-
return ["avif", "jpeg", "jpg", "png", "webp"].includes(value);
|
|
33
|
+
return ["avif", "jpeg", "jpg", "png", "webp", "svg"].includes(value);
|
|
33
34
|
}
|
|
34
35
|
function isOutputFormatSupportsAlpha(value) {
|
|
35
36
|
return ["avif", "png", "webp"].includes(value);
|
|
@@ -132,6 +133,12 @@ class BaseSSRService {
|
|
|
132
133
|
|
|
133
134
|
class SharpService extends BaseSSRService {
|
|
134
135
|
async transform(inputBuffer, transform) {
|
|
136
|
+
if (transform.format === "svg") {
|
|
137
|
+
return {
|
|
138
|
+
data: inputBuffer,
|
|
139
|
+
format: transform.format
|
|
140
|
+
};
|
|
141
|
+
}
|
|
135
142
|
const sharpImage = sharp$1(inputBuffer, { failOnError: false, pages: -1 });
|
|
136
143
|
sharpImage.rotate();
|
|
137
144
|
if (transform.width || transform.height) {
|
|
@@ -304,7 +311,7 @@ const getCMS = () => {
|
|
|
304
311
|
};
|
|
305
312
|
|
|
306
313
|
const _getConfig = () => {
|
|
307
|
-
const { VITE_ECOM_STORE_ID } = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true},{ECOM_STORE_ID:process.env.ECOM_STORE_ID,})) || process.env;
|
|
314
|
+
const { VITE_ECOM_STORE_ID } = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SITE":"\"https://ecom2-002.web.app\"","SSR":true},{ECOM_STORE_ID:process.env.ECOM_STORE_ID,})) || process.env;
|
|
308
315
|
if (VITE_ECOM_STORE_ID) {
|
|
309
316
|
config.set({ storeId: Number(VITE_ECOM_STORE_ID) });
|
|
310
317
|
}
|
|
@@ -353,7 +360,9 @@ const _getConfig = () => {
|
|
|
353
360
|
const emitter = new EventEmitter();
|
|
354
361
|
const getConfig = _getConfig;
|
|
355
362
|
if (!globalThis.api_prefetch_endpoints) {
|
|
356
|
-
globalThis.api_prefetch_endpoints = [
|
|
363
|
+
globalThis.api_prefetch_endpoints = [
|
|
364
|
+
"categories?fields=_id,name,slug,parent,icon,pictures.0"
|
|
365
|
+
];
|
|
357
366
|
}
|
|
358
367
|
if (!globalThis.storefront) {
|
|
359
368
|
globalThis.storefront = {
|
|
@@ -409,7 +418,7 @@ const loadPageContext = async (Astro, {
|
|
|
409
418
|
apiState[`${apiResource}/${apiDoc._id}`] = apiDoc;
|
|
410
419
|
}
|
|
411
420
|
prefetchResponses.forEach(({ config: { endpoint }, data }) => {
|
|
412
|
-
apiState[endpoint] = data.result || data;
|
|
421
|
+
apiState[endpoint.replace(/\?.*$/, "")] = data.result || data;
|
|
413
422
|
});
|
|
414
423
|
} catch (err) {
|
|
415
424
|
const error = err;
|
|
@@ -560,7 +569,7 @@ async function getImage$1(transform) {
|
|
|
560
569
|
}
|
|
561
570
|
const resolved = await resolveTransform(transform);
|
|
562
571
|
const attributes = await loader.getImageAttributes(resolved);
|
|
563
|
-
const isDev = (_b = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true},{SSR:true,}))) == null ? void 0 : _b.DEV;
|
|
572
|
+
const isDev = (_b = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SITE":"\"https://ecom2-002.web.app\"","SSR":true},{SSR:true,}))) == null ? void 0 : _b.DEV;
|
|
564
573
|
const isLocalImage = !isRemoteImage(resolved.src);
|
|
565
574
|
const _loader = isDev && isLocalImage ? globalThis.astroImage.defaultLoader : loader;
|
|
566
575
|
if (!_loader) {
|
|
@@ -652,7 +661,7 @@ async function getPicture(params) {
|
|
|
652
661
|
const tryImageSize = (src) => {
|
|
653
662
|
let dimensions = {};
|
|
654
663
|
if (typeof src === "string" && src.startsWith("/")) {
|
|
655
|
-
const { STOREFRONT_BASE_DIR } = Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true}, { STOREFRONT_BASE_DIR: process.env.STOREFRONT_BASE_DIR });
|
|
664
|
+
const { STOREFRONT_BASE_DIR } = Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SITE":"\"https://ecom2-002.web.app\"","SSR":true}, { STOREFRONT_BASE_DIR: process.env.STOREFRONT_BASE_DIR });
|
|
656
665
|
try {
|
|
657
666
|
dimensions = sizeOf(resolve$1(STOREFRONT_BASE_DIR, `public${src}`));
|
|
658
667
|
} catch (e) {
|
|
@@ -700,9 +709,9 @@ const getImage = async (options) => {
|
|
|
700
709
|
return imgAttrs;
|
|
701
710
|
};
|
|
702
711
|
|
|
703
|
-
const $$Astro$
|
|
712
|
+
const $$Astro$i = createAstro("https://ecom2-002.web.app");
|
|
704
713
|
const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
|
|
705
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
714
|
+
const Astro2 = $$result.createAstro($$Astro$i, $$props, $$slots);
|
|
706
715
|
Astro2.self = $$BaseHead;
|
|
707
716
|
const {
|
|
708
717
|
storeId,
|
|
@@ -762,17 +771,18 @@ ${cmsMetatags?.fb_app_id && renderTemplate`<meta property="fb:app_id"${addAttrib
|
|
|
762
771
|
<meta name="twitter:card" content="summary">
|
|
763
772
|
${cmsMetatags?.twitter_username && renderTemplate`<meta name="twitter:site"${addAttribute(cmsMetatags.twitter_username, "content")}>`}
|
|
764
773
|
<meta name="ecom-store-id"${addAttribute(String(storeId), "content")}>
|
|
774
|
+
|
|
765
775
|
${pwaInfo }
|
|
766
|
-
`;
|
|
776
|
+
${renderTemplate`<link rel="manifest" href="/manifest.webmanifest">`}`;
|
|
767
777
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro");
|
|
768
778
|
|
|
769
779
|
var __freeze$1 = Object.freeze;
|
|
770
780
|
var __defProp$1 = Object.defineProperty;
|
|
771
781
|
var __template$1 = (cooked, raw) => __freeze$1(__defProp$1(cooked, "raw", { value: __freeze$1(raw || cooked.slice()) }));
|
|
772
782
|
var _a$1;
|
|
773
|
-
const $$Astro$
|
|
783
|
+
const $$Astro$h = createAstro("https://ecom2-002.web.app");
|
|
774
784
|
const $$BaseStateJson = createComponent(async ($$result, $$props, $$slots) => {
|
|
775
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
785
|
+
const Astro2 = $$result.createAstro($$Astro$h, $$props, $$slots);
|
|
776
786
|
Astro2.self = $$BaseStateJson;
|
|
777
787
|
const {
|
|
778
788
|
pageContext: {
|
|
@@ -832,9 +842,9 @@ window.storefront.context = ${JSON.stringify({
|
|
|
832
842
|
return renderTemplate(_a$1 || (_a$1 = __template$1(["<script>", '<\/script>\n<script type="application/ld+json">', "<\/script>"])), unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd));
|
|
833
843
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseStateJson.astro");
|
|
834
844
|
|
|
835
|
-
const $$Astro$
|
|
845
|
+
const $$Astro$g = createAstro("https://ecom2-002.web.app");
|
|
836
846
|
const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
|
|
837
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
847
|
+
const Astro2 = $$result.createAstro($$Astro$g, $$props, $$slots);
|
|
838
848
|
Astro2.self = $$BaseBody;
|
|
839
849
|
return renderTemplate`${maybeRenderHead($$result)}<body>
|
|
840
850
|
<div id="teleported-overlap" class="relative z-50"></div>
|
|
@@ -845,9 +855,9 @@ const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
845
855
|
</body>`;
|
|
846
856
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro");
|
|
847
857
|
|
|
848
|
-
const $$Astro$
|
|
858
|
+
const $$Astro$f = createAstro("https://ecom2-002.web.app");
|
|
849
859
|
const $$Base$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
850
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
860
|
+
const Astro2 = $$result.createAstro($$Astro$f, $$props, $$slots);
|
|
851
861
|
Astro2.self = $$Base$1;
|
|
852
862
|
const { pageContext, title } = Astro2.props;
|
|
853
863
|
const { cms } = pageContext;
|
|
@@ -867,24 +877,24 @@ var __freeze = Object.freeze;
|
|
|
867
877
|
var __defProp = Object.defineProperty;
|
|
868
878
|
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
|
869
879
|
var _a;
|
|
870
|
-
const $$Astro$
|
|
880
|
+
const $$Astro$e = createAstro("https://ecom2-002.web.app");
|
|
871
881
|
const $$InlineScripts = createComponent(async ($$result, $$props, $$slots) => {
|
|
872
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
882
|
+
const Astro2 = $$result.createAstro($$Astro$e, $$props, $$slots);
|
|
873
883
|
Astro2.self = $$InlineScripts;
|
|
874
884
|
return renderTemplate(_a || (_a = __template(["<script>\n window.firebaseConfig = {\n apiKey: 'AIzaSyCrVzemDgpyp9i6ni7Yc5ZuEVfXYwl-4J0',\n authDomain: 'ecom2-002.firebaseapp.com',\n projectId: 'ecom2-002',\n storageBucket: 'ecom2-002.appspot.com',\n messagingSenderId: '402807248219',\n appId: '1:402807248219:web:cf7d57759751e74776367e',\n measurementId: 'G-SC592CE0GB',\n };\n<\/script>"])));
|
|
875
885
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/scripts/InlineScripts.astro");
|
|
876
886
|
|
|
877
|
-
const $$Astro$
|
|
887
|
+
const $$Astro$d = createAstro("https://ecom2-002.web.app");
|
|
878
888
|
const $$Base = createComponent(async ($$result, $$props, $$slots) => {
|
|
879
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
889
|
+
const Astro2 = $$result.createAstro($$Astro$d, $$props, $$slots);
|
|
880
890
|
Astro2.self = $$Base;
|
|
881
891
|
const { pageContext, title } = Astro2.props;
|
|
882
892
|
return renderTemplate`${renderComponent($$result, "Base", $$Base$1, { "pageContext": pageContext, "title": title }, { "before-head-end": ($$result2) => renderTemplate`${renderComponent($$result2, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["default"])}` })}`;
|
|
883
893
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro");
|
|
884
894
|
|
|
885
|
-
const $$Astro$
|
|
895
|
+
const $$Astro$c = createAstro("https://ecom2-002.web.app");
|
|
886
896
|
const $$Image = createComponent(async ($$result, $$props, $$slots) => {
|
|
887
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
897
|
+
const Astro2 = $$result.createAstro($$Astro$c, $$props, $$slots);
|
|
888
898
|
Astro2.self = $$Image;
|
|
889
899
|
const { loading = "lazy", decoding = "async", ...props } = Astro2.props;
|
|
890
900
|
if (props.alt === void 0 || props.alt === null) {
|
|
@@ -894,9 +904,9 @@ const $$Image = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
894
904
|
return renderTemplate`${maybeRenderHead($$result)}<img${spreadAttributes(attrs)}${addAttribute(loading, "loading")}${addAttribute(decoding, "decoding")}>`;
|
|
895
905
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/@astrojs/image/components/Image.astro");
|
|
896
906
|
|
|
897
|
-
const $$Astro$
|
|
907
|
+
const $$Astro$b = createAstro("https://ecom2-002.web.app");
|
|
898
908
|
const $$Picture$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
899
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
909
|
+
const Astro2 = $$result.createAstro($$Astro$b, $$props, $$slots);
|
|
900
910
|
Astro2.self = $$Picture$1;
|
|
901
911
|
const {
|
|
902
912
|
src,
|
|
@@ -948,9 +958,9 @@ The "alt" attribute holds a text description of the image, which isn't mandatory
|
|
|
948
958
|
`);
|
|
949
959
|
}
|
|
950
960
|
|
|
951
|
-
const $$Astro$
|
|
961
|
+
const $$Astro$a = createAstro("https://ecom2-002.web.app");
|
|
952
962
|
const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
|
|
953
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
963
|
+
const Astro2 = $$result.createAstro($$Astro$a, $$props, $$slots);
|
|
954
964
|
Astro2.self = $$Picture;
|
|
955
965
|
const props = Astro2.props;
|
|
956
966
|
if (!props.aspectRatio && typeof props.src === "string") {
|
|
@@ -1052,7 +1062,7 @@ const usePitchBar = (props) => {
|
|
|
1052
1062
|
|
|
1053
1063
|
const carouselKey = Symbol("carousel");
|
|
1054
1064
|
|
|
1055
|
-
const _sfc_main$
|
|
1065
|
+
const _sfc_main$c = defineComponent({
|
|
1056
1066
|
__name: "CarouselControl",
|
|
1057
1067
|
props: {
|
|
1058
1068
|
direction: { default: 1 }
|
|
@@ -1065,26 +1075,27 @@ const _sfc_main$a = defineComponent({
|
|
|
1065
1075
|
return __returned__;
|
|
1066
1076
|
}
|
|
1067
1077
|
});
|
|
1068
|
-
function _sfc_ssrRender$
|
|
1078
|
+
function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1069
1079
|
_push(`<button${ssrRenderAttrs(mergeProps({
|
|
1070
1080
|
type: "button",
|
|
1071
1081
|
"aria-label": $props.direction > 0 ? "Pr\xF3ximo" : "Anterior",
|
|
1072
|
-
"data-carousel-control": $props.direction > 0 ? "next" : "previous"
|
|
1082
|
+
"data-carousel-control": $props.direction > 0 ? "next" : "previous",
|
|
1083
|
+
class: "group"
|
|
1073
1084
|
}, _attrs))}>`);
|
|
1074
1085
|
ssrRenderSlot(_ctx.$slots, "default", {}, () => {
|
|
1075
|
-
_push(`<i class="${ssrRenderClass([$props.direction > 0 ? "i-chevron-right" : "i-chevron-left", "m-0"])}"></i>`);
|
|
1086
|
+
_push(`<i class="${ssrRenderClass([$props.direction > 0 ? "i-chevron-right group-active:translate-x-1" : "i-chevron-left group-active:-translate-x-1", "m-0"])}"></i>`);
|
|
1076
1087
|
}, _push, _parent);
|
|
1077
1088
|
_push(`</button>`);
|
|
1078
1089
|
}
|
|
1079
|
-
const _sfc_setup$
|
|
1080
|
-
_sfc_main$
|
|
1090
|
+
const _sfc_setup$c = _sfc_main$c.setup;
|
|
1091
|
+
_sfc_main$c.setup = (props, ctx) => {
|
|
1081
1092
|
const ssrContext = useSSRContext();
|
|
1082
1093
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/CarouselControl.vue");
|
|
1083
|
-
return _sfc_setup$
|
|
1094
|
+
return _sfc_setup$c ? _sfc_setup$c(props, ctx) : void 0;
|
|
1084
1095
|
};
|
|
1085
|
-
const CarouselControl = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1096
|
+
const CarouselControl = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["ssrRender", _sfc_ssrRender$c]]);
|
|
1086
1097
|
|
|
1087
|
-
const _sfc_main$
|
|
1098
|
+
const _sfc_main$b = defineComponent({
|
|
1088
1099
|
__name: "Carousel",
|
|
1089
1100
|
props: {
|
|
1090
1101
|
as: { default: "ul" },
|
|
@@ -1221,7 +1232,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
1221
1232
|
return __returned__;
|
|
1222
1233
|
}
|
|
1223
1234
|
});
|
|
1224
|
-
function _sfc_ssrRender$
|
|
1235
|
+
function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1225
1236
|
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
1226
1237
|
ref: "carousel",
|
|
1227
1238
|
"data-carousel": ""
|
|
@@ -1275,15 +1286,15 @@ function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
1275
1286
|
}, _push, _parent);
|
|
1276
1287
|
_push(`</div>`);
|
|
1277
1288
|
}
|
|
1278
|
-
const _sfc_setup$
|
|
1279
|
-
_sfc_main$
|
|
1289
|
+
const _sfc_setup$b = _sfc_main$b.setup;
|
|
1290
|
+
_sfc_main$b.setup = (props, ctx) => {
|
|
1280
1291
|
const ssrContext = useSSRContext();
|
|
1281
1292
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Carousel.vue");
|
|
1282
|
-
return _sfc_setup$
|
|
1293
|
+
return _sfc_setup$b ? _sfc_setup$b(props, ctx) : void 0;
|
|
1283
1294
|
};
|
|
1284
|
-
const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1295
|
+
const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["ssrRender", _sfc_ssrRender$b]]);
|
|
1285
1296
|
|
|
1286
|
-
const _sfc_main$
|
|
1297
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
1287
1298
|
__name: "PitchBar",
|
|
1288
1299
|
props: {
|
|
1289
1300
|
slides: null
|
|
@@ -1300,7 +1311,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1300
1311
|
return __returned__;
|
|
1301
1312
|
}
|
|
1302
1313
|
});
|
|
1303
|
-
function _sfc_ssrRender$
|
|
1314
|
+
function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1304
1315
|
_push(`<div${ssrRenderAttrs(mergeProps({ class: "bg-base-100 relative z-1" }, _attrs))}><div class="container md:w-2/3 mx-auto px-3 py-1">`);
|
|
1305
1316
|
_push(ssrRenderComponent($setup["Carousel"], {
|
|
1306
1317
|
autoplay: $setup.countValidSlides > 1 ? 7e3 : null
|
|
@@ -1387,13 +1398,13 @@ function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
1387
1398
|
}, _parent));
|
|
1388
1399
|
_push(`</div></div>`);
|
|
1389
1400
|
}
|
|
1390
|
-
const _sfc_setup$
|
|
1391
|
-
_sfc_main$
|
|
1401
|
+
const _sfc_setup$a = _sfc_main$a.setup;
|
|
1402
|
+
_sfc_main$a.setup = (props, ctx) => {
|
|
1392
1403
|
const ssrContext = useSSRContext();
|
|
1393
1404
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/PitchBar.vue");
|
|
1394
|
-
return _sfc_setup$
|
|
1405
|
+
return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
|
|
1395
1406
|
};
|
|
1396
|
-
const PitchBar = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1407
|
+
const PitchBar = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
|
|
1397
1408
|
|
|
1398
1409
|
const useStickyHeader = (props) => {
|
|
1399
1410
|
const {
|
|
@@ -1437,21 +1448,49 @@ const useStickyHeader = (props) => {
|
|
|
1437
1448
|
};
|
|
1438
1449
|
};
|
|
1439
1450
|
|
|
1440
|
-
const filterMainCategories = (categories) => {
|
|
1441
|
-
|
|
1451
|
+
const filterMainCategories = (categories, featuredSlugs) => {
|
|
1452
|
+
const mainCategories = categories.filter(({ slug, parent }) => {
|
|
1442
1453
|
return slug && !parent;
|
|
1443
1454
|
});
|
|
1455
|
+
if (featuredSlugs?.length) {
|
|
1456
|
+
mainCategories.sort((a, b) => {
|
|
1457
|
+
const indexA = featuredSlugs.indexOf(a.slug);
|
|
1458
|
+
const indexB = featuredSlugs.indexOf(b.slug);
|
|
1459
|
+
if (indexA > -1) {
|
|
1460
|
+
if (indexB === -1 || indexA < indexB)
|
|
1461
|
+
return -1;
|
|
1462
|
+
return 1;
|
|
1463
|
+
}
|
|
1464
|
+
if (indexB > -1)
|
|
1465
|
+
return 1;
|
|
1466
|
+
return 0;
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1469
|
+
return mainCategories;
|
|
1444
1470
|
};
|
|
1445
|
-
const filterSubcategories = (categories, parentCategory) => {
|
|
1446
|
-
|
|
1471
|
+
const filterSubcategories = (categories, parentCategory, isAlphabeticalSort = false) => {
|
|
1472
|
+
const subcategories = categories.filter(({ slug, parent }) => {
|
|
1447
1473
|
if (slug && parent) {
|
|
1448
1474
|
return parent._id === parentCategory._id || parent.slug && parent.slug === parentCategory.slug;
|
|
1449
1475
|
}
|
|
1450
1476
|
return false;
|
|
1451
1477
|
});
|
|
1478
|
+
if (isAlphabeticalSort) {
|
|
1479
|
+
subcategories.sort((a, b) => {
|
|
1480
|
+
if (a.name < b.name)
|
|
1481
|
+
return -1;
|
|
1482
|
+
return 1;
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
return subcategories;
|
|
1452
1486
|
};
|
|
1453
|
-
const useShopHeader = (
|
|
1454
|
-
|
|
1487
|
+
const useShopHeader = ({
|
|
1488
|
+
header,
|
|
1489
|
+
categories,
|
|
1490
|
+
menuCategorySlugs,
|
|
1491
|
+
menuRandomCategories = 7,
|
|
1492
|
+
isAlphabeticalSortSubmenu
|
|
1493
|
+
}) => {
|
|
1455
1494
|
const {
|
|
1456
1495
|
isSticky,
|
|
1457
1496
|
staticHeight,
|
|
@@ -1460,9 +1499,13 @@ const useShopHeader = (props) => {
|
|
|
1460
1499
|
const positionY = computed(() => {
|
|
1461
1500
|
return isSticky.value ? header.value.offsetHeight : staticY.value;
|
|
1462
1501
|
});
|
|
1463
|
-
const mainCategories = filterMainCategories(
|
|
1502
|
+
const mainCategories = filterMainCategories(categories, menuCategorySlugs);
|
|
1464
1503
|
const getSubcategories = (parentCategory) => {
|
|
1465
|
-
return filterSubcategories(
|
|
1504
|
+
return filterSubcategories(
|
|
1505
|
+
categories,
|
|
1506
|
+
parentCategory,
|
|
1507
|
+
!!isAlphabeticalSortSubmenu
|
|
1508
|
+
);
|
|
1466
1509
|
};
|
|
1467
1510
|
const getCategoryTree = (parentCategory) => {
|
|
1468
1511
|
return {
|
|
@@ -1473,6 +1516,17 @@ const useShopHeader = (props) => {
|
|
|
1473
1516
|
};
|
|
1474
1517
|
};
|
|
1475
1518
|
const categoryTrees = mainCategories.map(getCategoryTree);
|
|
1519
|
+
let countRandom = 0;
|
|
1520
|
+
const inlineMenuTrees = categoryTrees.filter(({ slug }) => {
|
|
1521
|
+
if (menuCategorySlugs?.includes(slug)) {
|
|
1522
|
+
return true;
|
|
1523
|
+
}
|
|
1524
|
+
if (countRandom < menuRandomCategories) {
|
|
1525
|
+
countRandom += 1;
|
|
1526
|
+
return true;
|
|
1527
|
+
}
|
|
1528
|
+
return false;
|
|
1529
|
+
});
|
|
1476
1530
|
const isSidenavOpen = ref(false);
|
|
1477
1531
|
return {
|
|
1478
1532
|
isSticky,
|
|
@@ -1483,11 +1537,12 @@ const useShopHeader = (props) => {
|
|
|
1483
1537
|
getSubcategories,
|
|
1484
1538
|
getCategoryTree,
|
|
1485
1539
|
categoryTrees,
|
|
1540
|
+
inlineMenuTrees,
|
|
1486
1541
|
isSidenavOpen
|
|
1487
1542
|
};
|
|
1488
1543
|
};
|
|
1489
1544
|
|
|
1490
|
-
const _sfc_main$
|
|
1545
|
+
const _sfc_main$9 = defineComponent({
|
|
1491
1546
|
__name: "Drawer",
|
|
1492
1547
|
props: {
|
|
1493
1548
|
modelValue: { type: Boolean, default: false },
|
|
@@ -1549,7 +1604,7 @@ const _sfc_main$7 = defineComponent({
|
|
|
1549
1604
|
return __returned__;
|
|
1550
1605
|
}
|
|
1551
1606
|
});
|
|
1552
|
-
function _sfc_ssrRender$
|
|
1607
|
+
function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1553
1608
|
const _component_Fade = resolveComponent("Fade");
|
|
1554
1609
|
_push(ssrRenderComponent(_component_Fade, mergeProps({
|
|
1555
1610
|
slide: $setup.slideTo,
|
|
@@ -1646,13 +1701,13 @@ function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
1646
1701
|
_: 3
|
|
1647
1702
|
}, _parent));
|
|
1648
1703
|
}
|
|
1649
|
-
const _sfc_setup$
|
|
1650
|
-
_sfc_main$
|
|
1704
|
+
const _sfc_setup$9 = _sfc_main$9.setup;
|
|
1705
|
+
_sfc_main$9.setup = (props, ctx) => {
|
|
1651
1706
|
const ssrContext = useSSRContext();
|
|
1652
1707
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Drawer.vue");
|
|
1653
|
-
return _sfc_setup$
|
|
1708
|
+
return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
|
|
1654
1709
|
};
|
|
1655
|
-
const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1710
|
+
const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
|
|
1656
1711
|
|
|
1657
1712
|
const useStorage = (key, initialValue, storage = globalThis.localStorage) => {
|
|
1658
1713
|
if (!storage) {
|
|
@@ -1740,7 +1795,7 @@ userAgent.includes("Safari") && !userAgent.includes("Chrome");
|
|
|
1740
1795
|
const isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream;
|
|
1741
1796
|
const isMobile = isIOS || /Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
|
|
1742
1797
|
|
|
1743
|
-
const _sfc_main$
|
|
1798
|
+
const _sfc_main$8 = defineComponent({
|
|
1744
1799
|
__name: "SocialNetworkIcon",
|
|
1745
1800
|
props: {
|
|
1746
1801
|
as: { default: "i" },
|
|
@@ -1774,18 +1829,18 @@ const _sfc_main$6 = defineComponent({
|
|
|
1774
1829
|
return __returned__;
|
|
1775
1830
|
}
|
|
1776
1831
|
});
|
|
1777
|
-
function _sfc_ssrRender$
|
|
1832
|
+
function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1778
1833
|
ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), mergeProps({ class: $setup.iconClassName }, _attrs), null), _parent);
|
|
1779
1834
|
}
|
|
1780
|
-
const _sfc_setup$
|
|
1781
|
-
_sfc_main$
|
|
1835
|
+
const _sfc_setup$8 = _sfc_main$8.setup;
|
|
1836
|
+
_sfc_main$8.setup = (props, ctx) => {
|
|
1782
1837
|
const ssrContext = useSSRContext();
|
|
1783
1838
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkIcon.vue");
|
|
1784
|
-
return _sfc_setup$
|
|
1839
|
+
return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
|
|
1785
1840
|
};
|
|
1786
|
-
const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1841
|
+
const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["ssrRender", _sfc_ssrRender$8]]);
|
|
1787
1842
|
|
|
1788
|
-
const _sfc_main$
|
|
1843
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1789
1844
|
__name: "SocialNetworkLink",
|
|
1790
1845
|
props: {
|
|
1791
1846
|
network: null,
|
|
@@ -1811,7 +1866,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1811
1866
|
return __returned__;
|
|
1812
1867
|
}
|
|
1813
1868
|
});
|
|
1814
|
-
function _sfc_ssrRender$
|
|
1869
|
+
function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1815
1870
|
const _component_ALink = resolveComponent("ALink");
|
|
1816
1871
|
_push(ssrRenderComponent(_component_ALink, mergeProps({ href: $setup.fixedHref }, _attrs), {
|
|
1817
1872
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
@@ -1832,15 +1887,15 @@ function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
1832
1887
|
_: 3
|
|
1833
1888
|
}, _parent));
|
|
1834
1889
|
}
|
|
1835
|
-
const _sfc_setup$
|
|
1836
|
-
_sfc_main$
|
|
1890
|
+
const _sfc_setup$7 = _sfc_main$7.setup;
|
|
1891
|
+
_sfc_main$7.setup = (props, ctx) => {
|
|
1837
1892
|
const ssrContext = useSSRContext();
|
|
1838
1893
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkLink.vue");
|
|
1839
|
-
return _sfc_setup$
|
|
1894
|
+
return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
|
|
1840
1895
|
};
|
|
1841
|
-
const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1896
|
+
const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
|
|
1842
1897
|
|
|
1843
|
-
const _sfc_main$
|
|
1898
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1844
1899
|
__name: "ShopSidenavCategory",
|
|
1845
1900
|
props: {
|
|
1846
1901
|
categoryTree: null
|
|
@@ -1863,13 +1918,17 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1863
1918
|
return __returned__;
|
|
1864
1919
|
}
|
|
1865
1920
|
});
|
|
1866
|
-
function _sfc_ssrRender$
|
|
1921
|
+
function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1922
|
+
const _component_AImg = resolveComponent("AImg");
|
|
1867
1923
|
const _component_ShopSidenavCategory = resolveComponent("ShopSidenavCategory", true);
|
|
1868
1924
|
_push(`<li${ssrRenderAttrs(mergeProps({ class: "text-lg text-base-800" }, _attrs))}>`);
|
|
1869
1925
|
if ($props.categoryTree.subcategories.length) {
|
|
1870
1926
|
_push(`<details class="bg-white overflow-y-auto overflow-x-hidden z-10 open:absolute open:top-0 open:left-0 open:w-full open:h-full"><summary class="${ssrRenderClass([$setup.isOpen ? "bg-base-100" : null, "cursor-pointer list-none px-6 py-3 active:bg-base-100 transition-colors"])}"><i class="${ssrRenderClass(!$setup.isOpen ? "i-arrow-right float-right mb-0 mt-1 text-xl text-base-500" : "i-arrow-left text-lg")}"></i>`);
|
|
1871
1927
|
if (!$setup.isOpen && $props.categoryTree.icon) {
|
|
1872
|
-
_push(
|
|
1928
|
+
_push(ssrRenderComponent(_component_AImg, {
|
|
1929
|
+
picture: $props.categoryTree.icon,
|
|
1930
|
+
class: "w-auto h-5 inline mr-3"
|
|
1931
|
+
}, null, _parent));
|
|
1873
1932
|
} else {
|
|
1874
1933
|
_push(`<!---->`);
|
|
1875
1934
|
}
|
|
@@ -1884,7 +1943,10 @@ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
1884
1943
|
} else {
|
|
1885
1944
|
_push(`<a${ssrRenderAttr("href", `/${$props.categoryTree.slug}`)} class="block px-6 py-3 active:bg-base-200">`);
|
|
1886
1945
|
if (!$setup.isOpen && $props.categoryTree.icon) {
|
|
1887
|
-
_push(
|
|
1946
|
+
_push(ssrRenderComponent(_component_AImg, {
|
|
1947
|
+
picture: $props.categoryTree.icon,
|
|
1948
|
+
class: "w-auto h-5 inline mr-3"
|
|
1949
|
+
}, null, _parent));
|
|
1888
1950
|
} else {
|
|
1889
1951
|
_push(`<!---->`);
|
|
1890
1952
|
}
|
|
@@ -1892,15 +1954,15 @@ function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
1892
1954
|
}
|
|
1893
1955
|
_push(`</li>`);
|
|
1894
1956
|
}
|
|
1895
|
-
const _sfc_setup$
|
|
1896
|
-
_sfc_main$
|
|
1957
|
+
const _sfc_setup$6 = _sfc_main$6.setup;
|
|
1958
|
+
_sfc_main$6.setup = (props, ctx) => {
|
|
1897
1959
|
const ssrContext = useSSRContext();
|
|
1898
1960
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenavCategory.vue");
|
|
1899
|
-
return _sfc_setup$
|
|
1961
|
+
return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
|
|
1900
1962
|
};
|
|
1901
|
-
const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1963
|
+
const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
|
|
1902
1964
|
|
|
1903
|
-
const _sfc_main$
|
|
1965
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1904
1966
|
__name: "ShopSidenav",
|
|
1905
1967
|
props: {
|
|
1906
1968
|
categoryTrees: null
|
|
@@ -1921,7 +1983,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
1921
1983
|
return __returned__;
|
|
1922
1984
|
}
|
|
1923
1985
|
});
|
|
1924
|
-
function _sfc_ssrRender$
|
|
1986
|
+
function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1925
1987
|
_push(`<aside${ssrRenderAttrs(mergeProps({ class: "flex flex-col h-full" }, _attrs))}><nav class="py-4 grow"><ul class="relative h-full"><!--[-->`);
|
|
1926
1988
|
ssrRenderList($props.categoryTrees, (categoryTree) => {
|
|
1927
1989
|
_push(ssrRenderComponent($setup["ShopSidenavCategory"], {
|
|
@@ -1946,18 +2008,450 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
1946
2008
|
});
|
|
1947
2009
|
_push(`<!--]--></ul></footer></aside>`);
|
|
1948
2010
|
}
|
|
2011
|
+
const _sfc_setup$5 = _sfc_main$5.setup;
|
|
2012
|
+
_sfc_main$5.setup = (props, ctx) => {
|
|
2013
|
+
const ssrContext = useSSRContext();
|
|
2014
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenav.vue");
|
|
2015
|
+
return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
|
|
2016
|
+
};
|
|
2017
|
+
const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
|
|
2018
|
+
|
|
2019
|
+
const useShopHeaderSubmenu = (props) => {
|
|
2020
|
+
const categoryPicture = computed(() => props.categoryTree.pictures?.[0]);
|
|
2021
|
+
const subcategoriesWithChild = computed(() => {
|
|
2022
|
+
return props.categoryTree.subcategories.filter(({ subcategories }) => subcategories.length);
|
|
2023
|
+
});
|
|
2024
|
+
const maxMenuCols = computed(() => {
|
|
2025
|
+
let _maxMenuCols = subcategoriesWithChild.value.length;
|
|
2026
|
+
if (categoryPicture.value) {
|
|
2027
|
+
_maxMenuCols += 1;
|
|
2028
|
+
}
|
|
2029
|
+
if (subcategoriesWithChild.value.length < props.categoryTree.subcategories.length) {
|
|
2030
|
+
_maxMenuCols += 1;
|
|
2031
|
+
}
|
|
2032
|
+
return _maxMenuCols;
|
|
2033
|
+
});
|
|
2034
|
+
const isMegaMenu = computed(() => {
|
|
2035
|
+
return (props.megaMenuMaxCols || 7) >= maxMenuCols.value;
|
|
2036
|
+
});
|
|
2037
|
+
const subcategoryLinks = computed(() => {
|
|
2038
|
+
return isMegaMenu.value ? props.categoryTree.subcategories.filter(({ subcategories }) => !subcategories.length) : props.categoryTree.subcategories;
|
|
2039
|
+
});
|
|
2040
|
+
const subcategoryCols = computed(() => {
|
|
2041
|
+
return isMegaMenu.value ? props.categoryTree.subcategories.filter(({ subcategories }) => subcategories.length) : props.categoryTree.subcategories;
|
|
2042
|
+
});
|
|
2043
|
+
const countMenuCols = computed(() => {
|
|
2044
|
+
if (isMegaMenu.value)
|
|
2045
|
+
return maxMenuCols.value;
|
|
2046
|
+
return categoryPicture.value ? 2 : 1;
|
|
2047
|
+
});
|
|
2048
|
+
return {
|
|
2049
|
+
categoryPicture,
|
|
2050
|
+
isMegaMenu,
|
|
2051
|
+
subcategoryLinks,
|
|
2052
|
+
subcategoryCols,
|
|
2053
|
+
countMenuCols
|
|
2054
|
+
};
|
|
2055
|
+
};
|
|
2056
|
+
|
|
2057
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2058
|
+
__name: "ShopHeaderSubmenu",
|
|
2059
|
+
props: {
|
|
2060
|
+
categoryTree: null
|
|
2061
|
+
},
|
|
2062
|
+
setup(__props, { expose }) {
|
|
2063
|
+
expose();
|
|
2064
|
+
const props = __props;
|
|
2065
|
+
const {
|
|
2066
|
+
categoryPicture,
|
|
2067
|
+
subcategoryLinks,
|
|
2068
|
+
subcategoryCols,
|
|
2069
|
+
countMenuCols
|
|
2070
|
+
} = useShopHeaderSubmenu(props);
|
|
2071
|
+
const __returned__ = { props, categoryPicture, subcategoryLinks, subcategoryCols, countMenuCols, get Popover() {
|
|
2072
|
+
return Popover;
|
|
2073
|
+
}, get PopoverButton() {
|
|
2074
|
+
return PopoverButton;
|
|
2075
|
+
}, get PopoverPanel() {
|
|
2076
|
+
return PopoverPanel;
|
|
2077
|
+
} };
|
|
2078
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2079
|
+
return __returned__;
|
|
2080
|
+
}
|
|
2081
|
+
});
|
|
2082
|
+
function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
2083
|
+
const _component_Fade = resolveComponent("Fade");
|
|
2084
|
+
const _component_AImg = resolveComponent("AImg");
|
|
2085
|
+
_push(ssrRenderComponent($setup["Popover"], _attrs, {
|
|
2086
|
+
default: withCtx(({ open }, _push2, _parent2, _scopeId) => {
|
|
2087
|
+
if (_push2) {
|
|
2088
|
+
_push2(ssrRenderComponent($setup["PopoverButton"], { class: "outline-none" }, {
|
|
2089
|
+
default: withCtx((_, _push3, _parent3, _scopeId2) => {
|
|
2090
|
+
if (_push3) {
|
|
2091
|
+
ssrRenderSlot(_ctx.$slots, "button", { open }, null, _push3, _parent3, _scopeId2);
|
|
2092
|
+
} else {
|
|
2093
|
+
return [
|
|
2094
|
+
renderSlot$1(_ctx.$slots, "button", { open })
|
|
2095
|
+
];
|
|
2096
|
+
}
|
|
2097
|
+
}),
|
|
2098
|
+
_: 2
|
|
2099
|
+
}, _parent2, _scopeId));
|
|
2100
|
+
_push2(`<div class="relative"${_scopeId}>`);
|
|
2101
|
+
_push2(ssrRenderComponent(_component_Fade, null, {
|
|
2102
|
+
default: withCtx((_, _push3, _parent3, _scopeId2) => {
|
|
2103
|
+
if (_push3) {
|
|
2104
|
+
_push3(ssrRenderComponent($setup["PopoverPanel"], {
|
|
2105
|
+
class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded-md shadow bg-white text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
|
|
2106
|
+
}, {
|
|
2107
|
+
default: withCtx((_2, _push4, _parent4, _scopeId3) => {
|
|
2108
|
+
if (_push4) {
|
|
2109
|
+
_push4(`<div class="flex gap-6 w-full"${_scopeId3}>`);
|
|
2110
|
+
if ($setup.subcategoryLinks.length) {
|
|
2111
|
+
_push4(`<ul class="flex-1"${_scopeId3}><!--[-->`);
|
|
2112
|
+
ssrRenderList($setup.subcategoryLinks, (subcategory, i) => {
|
|
2113
|
+
_push4(`<li class="${ssrRenderClass($setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2")}"${_scopeId3}><a${ssrRenderAttr("href", `/${subcategory.slug}`)} class="hover:text-primary"${_scopeId3}><h3${_scopeId3}>${ssrInterpolate(subcategory.name)}</h3></a></li>`);
|
|
2114
|
+
});
|
|
2115
|
+
_push4(`<!--]--></ul>`);
|
|
2116
|
+
} else {
|
|
2117
|
+
_push4(`<!---->`);
|
|
2118
|
+
}
|
|
2119
|
+
_push4(`<!--[-->`);
|
|
2120
|
+
ssrRenderList($setup.subcategoryCols, (subcategory, i) => {
|
|
2121
|
+
_push4(`<div class="flex-1"${_scopeId3}><a${ssrRenderAttr("href", `/${subcategory.slug}`)} class="hover:text-primary"${_scopeId3}><h3${_scopeId3}>${ssrInterpolate(subcategory.name)}</h3></a><ul class="text-sm text-base-600 mt-1 mb-1.5"${_scopeId3}><!--[-->`);
|
|
2122
|
+
ssrRenderList(subcategory.subcategories, (nestedSubcategory, ii) => {
|
|
2123
|
+
_push4(`<li class="mb-0.5"${_scopeId3}><a${ssrRenderAttr("href", `/${nestedSubcategory.slug}`)} class="hover:text-primary hover:underline"${_scopeId3}><h3${_scopeId3}>${ssrInterpolate(nestedSubcategory.name)}</h3></a></li>`);
|
|
2124
|
+
});
|
|
2125
|
+
_push4(`<!--]--></ul></div>`);
|
|
2126
|
+
});
|
|
2127
|
+
_push4(`<!--]-->`);
|
|
2128
|
+
if ($setup.categoryPicture) {
|
|
2129
|
+
_push4(`<div class="${ssrRenderClass($setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3")}"${_scopeId3}>`);
|
|
2130
|
+
_push4(ssrRenderComponent(_component_AImg, {
|
|
2131
|
+
picture: $setup.categoryPicture,
|
|
2132
|
+
class: "ml-auto rounded"
|
|
2133
|
+
}, null, _parent4, _scopeId3));
|
|
2134
|
+
_push4(`</div>`);
|
|
2135
|
+
} else {
|
|
2136
|
+
_push4(`<!---->`);
|
|
2137
|
+
}
|
|
2138
|
+
_push4(`</div><a${ssrRenderAttr("href", `/${$props.categoryTree.slug}`)} class="block mt-1 text-xs text-base-600 leading-snug underline"${_scopeId3}>${ssrInterpolate("Ver toda a categoria $1".replace("$1", $props.categoryTree.name))}</a>`);
|
|
2139
|
+
} else {
|
|
2140
|
+
return [
|
|
2141
|
+
createVNode("div", { class: "flex gap-6 w-full" }, [
|
|
2142
|
+
$setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
|
|
2143
|
+
key: 0,
|
|
2144
|
+
class: "flex-1"
|
|
2145
|
+
}, [
|
|
2146
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryLinks, (subcategory, i) => {
|
|
2147
|
+
return openBlock(), createBlock("li", {
|
|
2148
|
+
key: `link-${i}`,
|
|
2149
|
+
class: $setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2"
|
|
2150
|
+
}, [
|
|
2151
|
+
createVNode("a", {
|
|
2152
|
+
href: `/${subcategory.slug}`,
|
|
2153
|
+
class: "hover:text-primary"
|
|
2154
|
+
}, [
|
|
2155
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2156
|
+
], 8, ["href"])
|
|
2157
|
+
], 2);
|
|
2158
|
+
}), 128))
|
|
2159
|
+
])) : createCommentVNode("", true),
|
|
2160
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryCols, (subcategory, i) => {
|
|
2161
|
+
return openBlock(), createBlock("div", {
|
|
2162
|
+
key: subcategory._id,
|
|
2163
|
+
class: "flex-1"
|
|
2164
|
+
}, [
|
|
2165
|
+
createVNode("a", {
|
|
2166
|
+
href: `/${subcategory.slug}`,
|
|
2167
|
+
class: "hover:text-primary"
|
|
2168
|
+
}, [
|
|
2169
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2170
|
+
], 8, ["href"]),
|
|
2171
|
+
createVNode("ul", { class: "text-sm text-base-600 mt-1 mb-1.5" }, [
|
|
2172
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(subcategory.subcategories, (nestedSubcategory, ii) => {
|
|
2173
|
+
return openBlock(), createBlock("li", {
|
|
2174
|
+
key: `${i}-${ii}`,
|
|
2175
|
+
class: "mb-0.5"
|
|
2176
|
+
}, [
|
|
2177
|
+
createVNode("a", {
|
|
2178
|
+
href: `/${nestedSubcategory.slug}`,
|
|
2179
|
+
class: "hover:text-primary hover:underline"
|
|
2180
|
+
}, [
|
|
2181
|
+
createVNode("h3", null, toDisplayString(nestedSubcategory.name), 1)
|
|
2182
|
+
], 8, ["href"])
|
|
2183
|
+
]);
|
|
2184
|
+
}), 128))
|
|
2185
|
+
])
|
|
2186
|
+
]);
|
|
2187
|
+
}), 128)),
|
|
2188
|
+
$setup.categoryPicture ? (openBlock(), createBlock("div", {
|
|
2189
|
+
key: 1,
|
|
2190
|
+
class: $setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3"
|
|
2191
|
+
}, [
|
|
2192
|
+
createVNode(_component_AImg, {
|
|
2193
|
+
picture: $setup.categoryPicture,
|
|
2194
|
+
class: "ml-auto rounded"
|
|
2195
|
+
}, null, 8, ["picture"])
|
|
2196
|
+
], 2)) : createCommentVNode("", true)
|
|
2197
|
+
]),
|
|
2198
|
+
createVNode("a", {
|
|
2199
|
+
href: `/${$props.categoryTree.slug}`,
|
|
2200
|
+
class: "block mt-1 text-xs text-base-600 leading-snug underline"
|
|
2201
|
+
}, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
|
|
2202
|
+
];
|
|
2203
|
+
}
|
|
2204
|
+
}),
|
|
2205
|
+
_: 2
|
|
2206
|
+
}, _parent3, _scopeId2));
|
|
2207
|
+
} else {
|
|
2208
|
+
return [
|
|
2209
|
+
createVNode($setup["PopoverPanel"], {
|
|
2210
|
+
class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded-md shadow bg-white text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
|
|
2211
|
+
}, {
|
|
2212
|
+
default: withCtx(() => [
|
|
2213
|
+
createVNode("div", { class: "flex gap-6 w-full" }, [
|
|
2214
|
+
$setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
|
|
2215
|
+
key: 0,
|
|
2216
|
+
class: "flex-1"
|
|
2217
|
+
}, [
|
|
2218
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryLinks, (subcategory, i) => {
|
|
2219
|
+
return openBlock(), createBlock("li", {
|
|
2220
|
+
key: `link-${i}`,
|
|
2221
|
+
class: $setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2"
|
|
2222
|
+
}, [
|
|
2223
|
+
createVNode("a", {
|
|
2224
|
+
href: `/${subcategory.slug}`,
|
|
2225
|
+
class: "hover:text-primary"
|
|
2226
|
+
}, [
|
|
2227
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2228
|
+
], 8, ["href"])
|
|
2229
|
+
], 2);
|
|
2230
|
+
}), 128))
|
|
2231
|
+
])) : createCommentVNode("", true),
|
|
2232
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryCols, (subcategory, i) => {
|
|
2233
|
+
return openBlock(), createBlock("div", {
|
|
2234
|
+
key: subcategory._id,
|
|
2235
|
+
class: "flex-1"
|
|
2236
|
+
}, [
|
|
2237
|
+
createVNode("a", {
|
|
2238
|
+
href: `/${subcategory.slug}`,
|
|
2239
|
+
class: "hover:text-primary"
|
|
2240
|
+
}, [
|
|
2241
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2242
|
+
], 8, ["href"]),
|
|
2243
|
+
createVNode("ul", { class: "text-sm text-base-600 mt-1 mb-1.5" }, [
|
|
2244
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(subcategory.subcategories, (nestedSubcategory, ii) => {
|
|
2245
|
+
return openBlock(), createBlock("li", {
|
|
2246
|
+
key: `${i}-${ii}`,
|
|
2247
|
+
class: "mb-0.5"
|
|
2248
|
+
}, [
|
|
2249
|
+
createVNode("a", {
|
|
2250
|
+
href: `/${nestedSubcategory.slug}`,
|
|
2251
|
+
class: "hover:text-primary hover:underline"
|
|
2252
|
+
}, [
|
|
2253
|
+
createVNode("h3", null, toDisplayString(nestedSubcategory.name), 1)
|
|
2254
|
+
], 8, ["href"])
|
|
2255
|
+
]);
|
|
2256
|
+
}), 128))
|
|
2257
|
+
])
|
|
2258
|
+
]);
|
|
2259
|
+
}), 128)),
|
|
2260
|
+
$setup.categoryPicture ? (openBlock(), createBlock("div", {
|
|
2261
|
+
key: 1,
|
|
2262
|
+
class: $setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3"
|
|
2263
|
+
}, [
|
|
2264
|
+
createVNode(_component_AImg, {
|
|
2265
|
+
picture: $setup.categoryPicture,
|
|
2266
|
+
class: "ml-auto rounded"
|
|
2267
|
+
}, null, 8, ["picture"])
|
|
2268
|
+
], 2)) : createCommentVNode("", true)
|
|
2269
|
+
]),
|
|
2270
|
+
createVNode("a", {
|
|
2271
|
+
href: `/${$props.categoryTree.slug}`,
|
|
2272
|
+
class: "block mt-1 text-xs text-base-600 leading-snug underline"
|
|
2273
|
+
}, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
|
|
2274
|
+
]),
|
|
2275
|
+
_: 1
|
|
2276
|
+
}, 8, ["class"])
|
|
2277
|
+
];
|
|
2278
|
+
}
|
|
2279
|
+
}),
|
|
2280
|
+
_: 2
|
|
2281
|
+
}, _parent2, _scopeId));
|
|
2282
|
+
_push2(`</div>`);
|
|
2283
|
+
} else {
|
|
2284
|
+
return [
|
|
2285
|
+
createVNode($setup["PopoverButton"], { class: "outline-none" }, {
|
|
2286
|
+
default: withCtx(() => [
|
|
2287
|
+
renderSlot$1(_ctx.$slots, "button", { open })
|
|
2288
|
+
]),
|
|
2289
|
+
_: 2
|
|
2290
|
+
}, 1024),
|
|
2291
|
+
createVNode("div", { class: "relative" }, [
|
|
2292
|
+
createVNode(_component_Fade, null, {
|
|
2293
|
+
default: withCtx(() => [
|
|
2294
|
+
createVNode($setup["PopoverPanel"], {
|
|
2295
|
+
class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded-md shadow bg-white text-base text-base-700", $setup.countMenuCols === 1 ? "w-60" : $setup.countMenuCols === 2 ? `w-screen ${$setup.categoryPicture ? "max-w-lg" : "max-w-sm"}` : $setup.countMenuCols === 3 ? `w-screen ${$setup.categoryPicture ? "max-w-xl" : "max-w-md"}` : $setup.countMenuCols < 6 ? "w-screen max-w-3xl" : "w-screen max-w-5xl"]
|
|
2296
|
+
}, {
|
|
2297
|
+
default: withCtx(() => [
|
|
2298
|
+
createVNode("div", { class: "flex gap-6 w-full" }, [
|
|
2299
|
+
$setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
|
|
2300
|
+
key: 0,
|
|
2301
|
+
class: "flex-1"
|
|
2302
|
+
}, [
|
|
2303
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryLinks, (subcategory, i) => {
|
|
2304
|
+
return openBlock(), createBlock("li", {
|
|
2305
|
+
key: `link-${i}`,
|
|
2306
|
+
class: $setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2"
|
|
2307
|
+
}, [
|
|
2308
|
+
createVNode("a", {
|
|
2309
|
+
href: `/${subcategory.slug}`,
|
|
2310
|
+
class: "hover:text-primary"
|
|
2311
|
+
}, [
|
|
2312
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2313
|
+
], 8, ["href"])
|
|
2314
|
+
], 2);
|
|
2315
|
+
}), 128))
|
|
2316
|
+
])) : createCommentVNode("", true),
|
|
2317
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryCols, (subcategory, i) => {
|
|
2318
|
+
return openBlock(), createBlock("div", {
|
|
2319
|
+
key: subcategory._id,
|
|
2320
|
+
class: "flex-1"
|
|
2321
|
+
}, [
|
|
2322
|
+
createVNode("a", {
|
|
2323
|
+
href: `/${subcategory.slug}`,
|
|
2324
|
+
class: "hover:text-primary"
|
|
2325
|
+
}, [
|
|
2326
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2327
|
+
], 8, ["href"]),
|
|
2328
|
+
createVNode("ul", { class: "text-sm text-base-600 mt-1 mb-1.5" }, [
|
|
2329
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(subcategory.subcategories, (nestedSubcategory, ii) => {
|
|
2330
|
+
return openBlock(), createBlock("li", {
|
|
2331
|
+
key: `${i}-${ii}`,
|
|
2332
|
+
class: "mb-0.5"
|
|
2333
|
+
}, [
|
|
2334
|
+
createVNode("a", {
|
|
2335
|
+
href: `/${nestedSubcategory.slug}`,
|
|
2336
|
+
class: "hover:text-primary hover:underline"
|
|
2337
|
+
}, [
|
|
2338
|
+
createVNode("h3", null, toDisplayString(nestedSubcategory.name), 1)
|
|
2339
|
+
], 8, ["href"])
|
|
2340
|
+
]);
|
|
2341
|
+
}), 128))
|
|
2342
|
+
])
|
|
2343
|
+
]);
|
|
2344
|
+
}), 128)),
|
|
2345
|
+
$setup.categoryPicture ? (openBlock(), createBlock("div", {
|
|
2346
|
+
key: 1,
|
|
2347
|
+
class: $setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3"
|
|
2348
|
+
}, [
|
|
2349
|
+
createVNode(_component_AImg, {
|
|
2350
|
+
picture: $setup.categoryPicture,
|
|
2351
|
+
class: "ml-auto rounded"
|
|
2352
|
+
}, null, 8, ["picture"])
|
|
2353
|
+
], 2)) : createCommentVNode("", true)
|
|
2354
|
+
]),
|
|
2355
|
+
createVNode("a", {
|
|
2356
|
+
href: `/${$props.categoryTree.slug}`,
|
|
2357
|
+
class: "block mt-1 text-xs text-base-600 leading-snug underline"
|
|
2358
|
+
}, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
|
|
2359
|
+
]),
|
|
2360
|
+
_: 1
|
|
2361
|
+
}, 8, ["class"])
|
|
2362
|
+
]),
|
|
2363
|
+
_: 1
|
|
2364
|
+
})
|
|
2365
|
+
])
|
|
2366
|
+
];
|
|
2367
|
+
}
|
|
2368
|
+
}),
|
|
2369
|
+
_: 3
|
|
2370
|
+
}, _parent));
|
|
2371
|
+
}
|
|
2372
|
+
const _sfc_setup$4 = _sfc_main$4.setup;
|
|
2373
|
+
_sfc_main$4.setup = (props, ctx) => {
|
|
2374
|
+
const ssrContext = useSSRContext();
|
|
2375
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderSubmenu.vue");
|
|
2376
|
+
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
|
|
2377
|
+
};
|
|
2378
|
+
const ShopHeaderSubmenu = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
|
|
2379
|
+
|
|
2380
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
2381
|
+
__name: "ShopHeaderMenu",
|
|
2382
|
+
props: {
|
|
2383
|
+
inlineMenuTrees: null
|
|
2384
|
+
},
|
|
2385
|
+
setup(__props, { expose }) {
|
|
2386
|
+
expose();
|
|
2387
|
+
const props = __props;
|
|
2388
|
+
const hasOneLevelSubcategories = computed(() => {
|
|
2389
|
+
return !!props.inlineMenuTrees.find(({ subcategories }) => !subcategories.length);
|
|
2390
|
+
});
|
|
2391
|
+
const __returned__ = { props, hasOneLevelSubcategories, ShopHeaderSubmenu };
|
|
2392
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2393
|
+
return __returned__;
|
|
2394
|
+
}
|
|
2395
|
+
});
|
|
2396
|
+
function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
2397
|
+
_push(`<nav${ssrRenderAttrs(_attrs)}><ul class="${ssrRenderClass([$props.inlineMenuTrees.length < 7 ? "text-base" : "text-sm", "flex gap-4 xl:gap-5 text-base-700"])}"><!--[-->`);
|
|
2398
|
+
ssrRenderList($props.inlineMenuTrees, (categoryTree, i) => {
|
|
2399
|
+
_push(`<li>`);
|
|
2400
|
+
if (categoryTree.subcategories.length) {
|
|
2401
|
+
_push(ssrRenderComponent($setup["ShopHeaderSubmenu"], { "category-tree": categoryTree }, {
|
|
2402
|
+
button: withCtx(({ open }, _push2, _parent2, _scopeId) => {
|
|
2403
|
+
if (_push2) {
|
|
2404
|
+
_push2(`<span class="hover:text-primary group"${_scopeId}><h3 class="${ssrRenderClass([[
|
|
2405
|
+
$props.inlineMenuTrees.length < 7 ? "decoration-2" : null,
|
|
2406
|
+
open ? "underline" : null
|
|
2407
|
+
], "group-hover:underline inline"])}"${_scopeId}>${ssrInterpolate(categoryTree.name)}</h3>`);
|
|
2408
|
+
if ($setup.hasOneLevelSubcategories) {
|
|
2409
|
+
_push2(`<i class="${ssrRenderClass([open ? "rotate-180" : null, "i-chevron-down ml-1 transition-transform text-base-400 group-hover:text-primary-subtle"])}"${_scopeId}></i>`);
|
|
2410
|
+
} else {
|
|
2411
|
+
_push2(`<!---->`);
|
|
2412
|
+
}
|
|
2413
|
+
_push2(`</span>`);
|
|
2414
|
+
} else {
|
|
2415
|
+
return [
|
|
2416
|
+
createVNode("span", { class: "hover:text-primary group" }, [
|
|
2417
|
+
createVNode("h3", {
|
|
2418
|
+
class: ["group-hover:underline inline", [
|
|
2419
|
+
$props.inlineMenuTrees.length < 7 ? "decoration-2" : null,
|
|
2420
|
+
open ? "underline" : null
|
|
2421
|
+
]]
|
|
2422
|
+
}, toDisplayString(categoryTree.name), 3),
|
|
2423
|
+
$setup.hasOneLevelSubcategories ? (openBlock(), createBlock("i", {
|
|
2424
|
+
key: 0,
|
|
2425
|
+
class: ["i-chevron-down ml-1 transition-transform text-base-400 group-hover:text-primary-subtle", open ? "rotate-180" : null]
|
|
2426
|
+
}, null, 2)) : createCommentVNode("", true)
|
|
2427
|
+
])
|
|
2428
|
+
];
|
|
2429
|
+
}
|
|
2430
|
+
}),
|
|
2431
|
+
_: 2
|
|
2432
|
+
}, _parent));
|
|
2433
|
+
} else {
|
|
2434
|
+
_push(`<a${ssrRenderAttr("href", `/${categoryTree.slug}`)} class="hover:text-primary hover:underline decoration-2"><h3 class="inline">${ssrInterpolate(categoryTree.name)}</h3></a>`);
|
|
2435
|
+
}
|
|
2436
|
+
_push(`</li>`);
|
|
2437
|
+
});
|
|
2438
|
+
_push(`<!--]--></ul></nav>`);
|
|
2439
|
+
}
|
|
1949
2440
|
const _sfc_setup$3 = _sfc_main$3.setup;
|
|
1950
2441
|
_sfc_main$3.setup = (props, ctx) => {
|
|
1951
2442
|
const ssrContext = useSSRContext();
|
|
1952
|
-
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/
|
|
2443
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderMenu.vue");
|
|
1953
2444
|
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
|
|
1954
2445
|
};
|
|
1955
|
-
const
|
|
2446
|
+
const ShopHeaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["ssrRender", _sfc_ssrRender$3]]);
|
|
1956
2447
|
|
|
1957
2448
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1958
2449
|
__name: "ShopHeader",
|
|
1959
2450
|
props: {
|
|
1960
|
-
categories: null
|
|
2451
|
+
categories: null,
|
|
2452
|
+
menuCategorySlugs: null,
|
|
2453
|
+
menuRandomCategories: null,
|
|
2454
|
+
isAlphabeticalSortSubmenu: { type: Boolean }
|
|
1961
2455
|
},
|
|
1962
2456
|
setup(__props, { expose }) {
|
|
1963
2457
|
expose();
|
|
@@ -1967,9 +2461,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1967
2461
|
isSticky,
|
|
1968
2462
|
positionY,
|
|
1969
2463
|
categoryTrees,
|
|
2464
|
+
inlineMenuTrees,
|
|
1970
2465
|
isSidenavOpen
|
|
1971
2466
|
} = useShopHeader({ ...props, header });
|
|
1972
|
-
const __returned__ = { props, header, isSticky, positionY, categoryTrees, isSidenavOpen, Drawer, ShopSidenav };
|
|
2467
|
+
const __returned__ = { props, header, isSticky, positionY, categoryTrees, inlineMenuTrees, isSidenavOpen, Drawer, ShopSidenav, ShopHeaderMenu };
|
|
1973
2468
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1974
2469
|
return __returned__;
|
|
1975
2470
|
}
|
|
@@ -1981,9 +2476,10 @@ function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
1981
2476
|
$setup.isSticky && !$setup.isSidenavOpen ? "bg-white/80" : "bg-white",
|
|
1982
2477
|
$setup.isSticky ? "backdrop-blur-md shadow py-2 md:py-3" : "py-3 sm:py-4 md:py-5"
|
|
1983
2478
|
]]
|
|
1984
|
-
}, _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
|
|
2479
|
+
}, _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 lg:grid-cols-none lg:auto-cols-max"><div class="lg:hidden"><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}><i class="${ssrRenderClass([$setup.isSidenavOpen ? "i-close" : "i-menu", "text-base-500 text-3xl"])}"></i></button></div>`);
|
|
1985
2480
|
ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push, _parent);
|
|
1986
|
-
_push(
|
|
2481
|
+
_push(ssrRenderComponent($setup["ShopHeaderMenu"], mergeProps({ class: "hidden lg:block" }, { inlineMenuTrees: $setup.inlineMenuTrees }), null, _parent));
|
|
2482
|
+
_push(`<div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800"><button${ssrRenderAttr("aria-label", "Buscar produtos")}><i class="i-search w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button class="hidden sm:block"${ssrRenderAttr("aria-label", "Minha conta")}><i class="i-account w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button${ssrRenderAttr("aria-label", "Abrir carrinho")}><i class="i-shopping-cart w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button></div></div>`);
|
|
1987
2483
|
_push(ssrRenderComponent($setup["Drawer"], {
|
|
1988
2484
|
modelValue: $setup.isSidenavOpen,
|
|
1989
2485
|
"onUpdate:modelValue": ($event) => $setup.isSidenavOpen = $event,
|
|
@@ -2013,9 +2509,9 @@ _sfc_main$2.setup = (props, ctx) => {
|
|
|
2013
2509
|
};
|
|
2014
2510
|
const ShopHeader = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
|
|
2015
2511
|
|
|
2016
|
-
const $$Astro$
|
|
2512
|
+
const $$Astro$9 = createAstro("https://ecom2-002.web.app");
|
|
2017
2513
|
const $$PagesHeader = createComponent(async ($$result, $$props, $$slots) => {
|
|
2018
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
2514
|
+
const Astro2 = $$result.createAstro($$Astro$9, $$props, $$slots);
|
|
2019
2515
|
Astro2.self = $$PagesHeader;
|
|
2020
2516
|
const {
|
|
2021
2517
|
pageContext: {
|
|
@@ -2030,7 +2526,10 @@ const $$PagesHeader = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
2030
2526
|
pitchBar.slides = cmsHeader.pitch_bar;
|
|
2031
2527
|
}
|
|
2032
2528
|
const shopHeader = {
|
|
2033
|
-
categories: apiState.categories
|
|
2529
|
+
categories: apiState.categories,
|
|
2530
|
+
menuCategorySlugs: cmsHeader.inline_menu_categories?.featured,
|
|
2531
|
+
menuRandomCategories: cmsHeader.inline_menu_categories?.random,
|
|
2532
|
+
isAlphabeticalSortSubmenu: cmsHeader.alphabetical_sort_submenu
|
|
2034
2533
|
};
|
|
2035
2534
|
const LogoHeading = Astro2.props.logoHeading || (isHomepage ? "h1" : "h2");
|
|
2036
2535
|
return renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["pitch-bar"], renderTemplate`
|
|
@@ -2045,14 +2544,14 @@ const $$PagesHeader = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
2045
2544
|
`)}` })}`;
|
|
2046
2545
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/PagesHeader.astro");
|
|
2047
2546
|
|
|
2048
|
-
const $$Astro$
|
|
2547
|
+
const $$Astro$8 = createAstro("https://ecom2-002.web.app");
|
|
2049
2548
|
const $$Pages = createComponent(async ($$result, $$props, $$slots) => {
|
|
2050
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
2549
|
+
const Astro2 = $$result.createAstro($$Astro$8, $$props, $$slots);
|
|
2051
2550
|
Astro2.self = $$Pages;
|
|
2052
2551
|
const { pageContext, title } = Astro2.props;
|
|
2053
2552
|
const { settings } = pageContext;
|
|
2054
2553
|
return renderTemplate`${renderComponent($$result, "Base", $$Base, { "pageContext": pageContext, "title": title }, { "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["header"], renderTemplate`
|
|
2055
|
-
${renderComponent($$result2, "Header", $$PagesHeader, { "pageContext": pageContext }, { "logo-picture": ($$result3) => renderTemplate`${renderComponent($$result3, "Picture", $$Picture, { "slot": "logo-picture", "src": settings.logo, "alt": settings.name, "widths": [300], "sizes": "150px", "fetchpriority": "high", "class": "hover:drop-shadow-sm" })}` })}
|
|
2554
|
+
${renderComponent($$result2, "Header", $$PagesHeader, { "pageContext": pageContext }, { "logo-picture": ($$result3) => renderTemplate`${renderComponent($$result3, "Picture", $$Picture, { "slot": "logo-picture", "src": settings.logo, "alt": settings.name, "widths": [300], "sizes": "150px", "fetchpriority": "high", "loading": "eager", "class": "hover:drop-shadow-sm" })}` })}
|
|
2056
2555
|
`)}${renderSlot($$result2, $$slots["default"])}` })}`;
|
|
2057
2556
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Pages.astro");
|
|
2058
2557
|
|
|
@@ -2505,9 +3004,9 @@ _sfc_main.setup = (props, ctx) => {
|
|
|
2505
3004
|
};
|
|
2506
3005
|
const ProductCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
|
|
2507
3006
|
|
|
2508
|
-
const $$Astro$
|
|
3007
|
+
const $$Astro$7 = createAstro("https://ecom2-002.web.app");
|
|
2509
3008
|
const $$Home = createComponent(async ($$result, $$props, $$slots) => {
|
|
2510
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
3009
|
+
const Astro2 = $$result.createAstro($$Astro$7, $$props, $$slots);
|
|
2511
3010
|
Astro2.self = $$Home;
|
|
2512
3011
|
const products = (await api.get("products")).data.result;
|
|
2513
3012
|
return renderTemplate`${maybeRenderHead($$result)}<main>
|
|
@@ -2555,9 +3054,9 @@ const $$Home = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
2555
3054
|
</main>`;
|
|
2556
3055
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Home.astro");
|
|
2557
3056
|
|
|
2558
|
-
const $$Astro$
|
|
3057
|
+
const $$Astro$6 = createAstro("https://ecom2-002.web.app");
|
|
2559
3058
|
const $$Index$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
2560
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
3059
|
+
const Astro2 = $$result.createAstro($$Astro$6, $$props, $$slots);
|
|
2561
3060
|
Astro2.self = $$Index$1;
|
|
2562
3061
|
let pageContext;
|
|
2563
3062
|
let loadError;
|
|
@@ -2575,12 +3074,50 @@ ${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment,
|
|
|
2575
3074
|
</html>`;
|
|
2576
3075
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro");
|
|
2577
3076
|
|
|
2578
|
-
const $$file$
|
|
2579
|
-
const $$url$
|
|
3077
|
+
const $$file$4 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro";
|
|
3078
|
+
const $$url$4 = "";
|
|
2580
3079
|
|
|
2581
3080
|
const _page1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2582
3081
|
__proto__: null,
|
|
2583
3082
|
default: $$Index$1,
|
|
3083
|
+
file: $$file$4,
|
|
3084
|
+
url: $$url$4
|
|
3085
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
3086
|
+
|
|
3087
|
+
const $$Astro$5 = createAstro("https://ecom2-002.web.app");
|
|
3088
|
+
const $$Fallback$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
3089
|
+
const Astro2 = $$result.createAstro($$Astro$5, $$props, $$slots);
|
|
3090
|
+
Astro2.self = $$Fallback$1;
|
|
3091
|
+
return renderTemplate`${maybeRenderHead($$result)}<main>
|
|
3092
|
+
<h1>Error :/</h1>
|
|
3093
|
+
<p class="instructions">
|
|
3094
|
+
Check out the <code>src/pages</code> directory to get started.<br>
|
|
3095
|
+
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
|
|
3096
|
+
</p>
|
|
3097
|
+
</main>`;
|
|
3098
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Fallback.astro");
|
|
3099
|
+
|
|
3100
|
+
const $$Astro$4 = createAstro("https://ecom2-002.web.app");
|
|
3101
|
+
const $$Fallback = createComponent(async ($$result, $$props, $$slots) => {
|
|
3102
|
+
const Astro2 = $$result.createAstro($$Astro$4, $$props, $$slots);
|
|
3103
|
+
Astro2.self = $$Fallback;
|
|
3104
|
+
let pageContext;
|
|
3105
|
+
try {
|
|
3106
|
+
pageContext = await loadPageContext(Astro2);
|
|
3107
|
+
} catch (err) {
|
|
3108
|
+
return err.astroResponse;
|
|
3109
|
+
}
|
|
3110
|
+
return renderTemplate`<html${addAttribute(pageContext?.lang.replace("_", "-"), "lang")}>
|
|
3111
|
+
${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext }, { "default": ($$result2) => renderTemplate`${renderComponent($$result2, "FallbackMain", $$Fallback$1, { "pageContext": pageContext })}` })}
|
|
3112
|
+
</html>`;
|
|
3113
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro");
|
|
3114
|
+
|
|
3115
|
+
const $$file$3 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro";
|
|
3116
|
+
const $$url$3 = "/fallback";
|
|
3117
|
+
|
|
3118
|
+
const _page2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
3119
|
+
__proto__: null,
|
|
3120
|
+
default: $$Fallback,
|
|
2584
3121
|
file: $$file$3,
|
|
2585
3122
|
url: $$url$3
|
|
2586
3123
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
@@ -2674,4 +3211,4 @@ const _page5 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
2674
3211
|
url: $$url
|
|
2675
3212
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2676
3213
|
|
|
2677
|
-
export {
|
|
3214
|
+
export { _export_sfc as _, _page0 as a, _page1 as b, _page2 as c, _page3 as d, _page4 as e, _page5 as f };
|