cloudcommerce 0.26.2 → 0.26.3
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 +13 -0
- package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
- package/ecomplus-stores/barra-doce/functions/ssr/index.js +0 -1
- package/ecomplus-stores/barra-doce/functions/ssr/package.json +8 -8
- package/ecomplus-stores/barra-doce/functions/ssr/src/components/CartItem.vue +64 -0
- package/ecomplus-stores/barra-doce/functions/ssr/src/components/CartSidebar.vue +38 -7
- package/ecomplus-stores/barra-doce/functions/ssr/src/components/Prices.vue +2 -3
- package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeader.vue +8 -4
- package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barra-doce/package.json +2 -2
- package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
- package/ecomplus-stores/iluminim/functions/ssr/package.json +8 -8
- package/ecomplus-stores/iluminim/functions/ssr/src/components/CartItem.vue +64 -0
- package/ecomplus-stores/iluminim/functions/ssr/src/components/CartSidebar.vue +37 -6
- package/ecomplus-stores/iluminim/functions/ssr/src/components/Prices.vue +2 -3
- package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopHeader.vue +6 -2
- package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/iluminim/package.json +2 -2
- package/package.json +3 -3
- package/packages/api/package.json +1 -1
- package/packages/apps/affilate-program/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +2 -2
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/eslint/package.json +3 -3
- package/packages/events/package.json +1 -1
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/lib/firebase/functions-checkout/request-to-module.js +2 -2
- package/packages/modules/lib/firebase/functions-checkout/request-to-module.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/utils.js +21 -9
- package/packages/modules/lib/firebase/functions-checkout/utils.js.map +1 -1
- package/packages/modules/package.json +2 -2
- package/packages/modules/schemas/@checkout.cjs +0 -1
- package/packages/modules/src/firebase/functions-checkout/request-to-module.ts +2 -2
- package/packages/modules/src/firebase/functions-checkout/utils.ts +23 -9
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +2 -2
- package/packages/storefront/dist/client/_astro/{Carousel.926668f2.js → Carousel.0b24e2cb.js} +1 -1
- package/packages/storefront/dist/client/_astro/CartSidebar.2731d333.js +1 -0
- package/packages/storefront/dist/client/_astro/{HeroSlider.1f0524aa.js → HeroSlider.a70b2582.js} +1 -1
- package/packages/storefront/dist/client/_astro/{PitchBar.7407eeaf.js → PitchBar.13991988.js} +1 -1
- package/packages/storefront/dist/client/_astro/{Prices.562a32ab.js → Prices.cdfa346a.js} +1 -1
- package/packages/storefront/dist/client/_astro/{ProductShelf.763cd2ca.js → ProductShelf.619c56a5.js} +1 -1
- package/packages/storefront/dist/client/_astro/SearchModal.117a477d.js +1 -0
- package/packages/storefront/dist/client/_astro/{ShopHeader.126900a6.js → ShopHeader.2c2fded7.js} +2 -2
- package/packages/storefront/dist/client/_astro/_...slug_.b693913e.css +1 -0
- package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.ee681fa8.js → _plugin-vue_export-helper.fc5e2f5b.js} +1 -1
- package/packages/storefront/dist/client/_astro/{api.a2eda23e.js → api.39f40cd8.js} +1 -1
- package/packages/storefront/dist/client/_astro/client.a5d2898b.js +1 -0
- package/packages/storefront/dist/client/_astro/{firebase-app.93857bfb.js → firebase-app.8c541cce.js} +3 -3
- package/packages/storefront/dist/client/_astro/{format-money.923559cc.js → format-money.86f14860.js} +1 -1
- package/packages/storefront/dist/client/_astro/hoisted.d90361ee.js +1 -0
- package/packages/storefront/dist/client/_astro/{img.ec6ba316.js → img.d4891d80.js} +1 -1
- package/packages/storefront/dist/client/_astro/index.33801818.js +1 -0
- package/packages/storefront/dist/client/_astro/{modules-info.48980668.js → modules-info.ec412b24.js} +1 -1
- package/packages/storefront/dist/client/_empty-middleware.mjs +3 -0
- package/packages/storefront/dist/client/chunks/CartSidebar.0ce1e999.mjs +382 -0
- package/packages/storefront/dist/client/chunks/SearchModal.f603145b.mjs +32 -0
- package/packages/storefront/dist/client/chunks/astro.11be33ee.mjs +1424 -0
- package/packages/storefront/dist/{server/chunks/pages/_...slug_.astro.fd8a229f.mjs → client/chunks/pages/_...slug_.astro.ec6517ba.mjs} +360 -274
- package/packages/storefront/dist/{server/chunks/pages/account.astro.3b21bff8.mjs → client/chunks/pages/account.astro.3d2605e6.mjs} +2 -10
- package/packages/storefront/dist/{server/chunks/pages/index.astro.dab642f5.mjs → client/chunks/pages/index.astro.8ad03206.mjs} +167 -17
- package/packages/storefront/dist/{server/chunks/pages/~fallback.astro.7630c0d6.mjs → client/chunks/pages/~fallback.astro.d31d20b4.mjs} +8 -20
- package/packages/storefront/dist/client/chunks/sharp.3f154e38.mjs +74 -0
- package/packages/storefront/dist/client/manifest.e39eb543.mjs +79 -0
- package/packages/storefront/dist/client/pages/_---slug_.astro.mjs +23 -0
- package/packages/storefront/dist/client/pages/app/account.astro.mjs +23 -0
- package/packages/storefront/dist/client/pages/app.astro.mjs +23 -0
- package/packages/storefront/dist/client/pages/index.astro.mjs +23 -0
- package/packages/storefront/dist/client/pages/~fallback.astro.mjs +23 -0
- package/packages/storefront/dist/client/registerSW.js +1 -0
- package/packages/storefront/dist/client/renderers.mjs +369 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/{CartSidebar.2b555408.mjs → CartSidebar.cca9fdd3.mjs} +14 -24
- package/packages/storefront/dist/server/chunks/{SearchModal.f418e188.mjs → SearchModal.a680efae.mjs} +8 -19
- package/packages/storefront/dist/server/chunks/_...f7cdc954.mjs +24 -0
- package/packages/storefront/dist/server/chunks/account@_@astro.fa8b921b.mjs +24 -0
- package/packages/storefront/dist/server/chunks/{astro.bb5b7191.mjs → astro.440a2e08.mjs} +149 -1859
- package/packages/storefront/dist/server/chunks/image-endpoint@_@js.802bf648.mjs +24 -0
- package/packages/storefront/dist/server/chunks/index@_@astro.a122f091.mjs +24 -0
- package/packages/storefront/dist/server/chunks/index@_@astro.da98dcbe.mjs +24 -0
- package/packages/storefront/dist/server/chunks/pages/_...slug_.astro.08ba5973.mjs +3930 -0
- package/packages/storefront/dist/server/chunks/pages/account.astro.f11f26f3.mjs +15 -0
- package/packages/storefront/dist/server/chunks/pages/image-endpoint.js.a9374d3e.mjs +238 -0
- package/packages/storefront/dist/server/chunks/pages/index.astro.079f316a.mjs +1650 -0
- package/packages/storefront/dist/server/chunks/pages/~fallback.astro.01594623.mjs +55 -0
- package/packages/storefront/dist/server/chunks/sharp.52841bb4.mjs +75 -0
- package/packages/storefront/dist/server/chunks/~fallback@_@astro.876a97c5.mjs +24 -0
- package/packages/storefront/dist/server/entry.mjs +1167 -2360
- package/packages/storefront/dist/server/manifest.12e7a10c.mjs +561 -0
- package/packages/storefront/dist/server/renderers.mjs +10 -21
- package/packages/storefront/package.json +6 -6
- package/packages/storefront/src/lib/layouts/BaseHead.astro +3 -2
- package/packages/test-base/package.json +1 -1
- package/packages/types/modules/@checkout:params.d.ts +1 -1
- package/packages/types/package.json +1 -1
- package/ecomplus-stores/iluminim/.ecomplus.cd.json +0 -5
- package/packages/storefront/dist/client/_astro/CartSidebar.eadba34f.js +0 -1
- package/packages/storefront/dist/client/_astro/SearchModal.cffd4c2d.js +0 -1
- package/packages/storefront/dist/client/_astro/_...slug_.36cd433d.css +0 -1
- package/packages/storefront/dist/client/_astro/client.e6d9439a.js +0 -1
- package/packages/storefront/dist/client/_astro/hoisted.572313d6.js +0 -1
- package/packages/storefront/dist/client/_astro/index.709ac149.js +0 -1
- package/packages/storefront/dist/server/chunks/_...d32bcc0c.mjs +0 -35
- package/packages/storefront/dist/server/chunks/account@_@astro.0106855f.mjs +0 -35
- package/packages/storefront/dist/server/chunks/endpoint@_@js.35807882.mjs +0 -35
- package/packages/storefront/dist/server/chunks/index@_@astro.477f5af1.mjs +0 -35
- package/packages/storefront/dist/server/chunks/index@_@astro.e5a61d6e.mjs +0 -35
- package/packages/storefront/dist/server/chunks/pages/endpoint.js.247079ba.mjs +0 -119
- package/packages/storefront/dist/server/chunks/~fallback@_@astro.65227dd7.mjs +0 -35
|
@@ -0,0 +1,3930 @@
|
|
|
1
|
+
import { joinPaths, isRemotePath } from '@astrojs/internal-helpers/path';
|
|
2
|
+
import { A as AstroError, E as ExpectedImage, L as LocalImageUsedWrongly, M as MissingImageDimension, U as UnsupportedImageFormat, a as ExpectedImageOptions, I as InvalidImageService, c as createAstro, b as createComponent, d as ImageMissingAlt, r as renderTemplate, m as maybeRenderHead, e as addAttribute, s as spreadAttributes, u as unescapeHTML, f as renderComponent, F as Fragment, g as renderSlotToString, h as renderAllHeadContent, i as renderSlot } from '../astro.440a2e08.mjs';
|
|
3
|
+
import api from '@cloudcommerce/api';
|
|
4
|
+
import { EventEmitter } from 'node:events';
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import { resolve, join } from 'node:path';
|
|
7
|
+
import config from '@cloudcommerce/config';
|
|
8
|
+
import { img, price, formatMoney, randomObjectId, nickname } from '@ecomplus/utils';
|
|
9
|
+
import 'clsx';
|
|
10
|
+
import { renderSync, parse, walkSync, ELEMENT_NODE } from 'ultrahtml';
|
|
11
|
+
/* empty css */import imageSize from 'image-size';
|
|
12
|
+
import mime from 'mime';
|
|
13
|
+
import { reactive, computed, shallowRef, useSSRContext, defineComponent, inject, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, resolveComponent, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, withModifiers, Teleport, createTextVNode, toDisplayString, defineAsyncComponent, Suspense } from 'vue';
|
|
14
|
+
import { useScroll, useElementHover, useDebounceFn, useTimeout, watchDebounced, promiseTimeout, watchOnce } from '@vueuse/core';
|
|
15
|
+
import { ssrRenderAttrs, ssrRenderSlot, ssrRenderClass, ssrRenderVNode, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrIncludeBooleanAttr, ssrRenderAttr, ssrRenderTeleport, ssrInterpolate, ssrRenderSuspense } from 'vue/server-renderer';
|
|
16
|
+
import { Popover, PopoverButton, PopoverPanel, Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue';
|
|
17
|
+
|
|
18
|
+
const _export_sfc = (sfc, props) => {
|
|
19
|
+
const target = sfc.__vccOpts || sfc;
|
|
20
|
+
for (const [key, val] of props) {
|
|
21
|
+
target[key] = val;
|
|
22
|
+
}
|
|
23
|
+
return target;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const VALID_SUPPORTED_FORMATS = [
|
|
27
|
+
"jpeg",
|
|
28
|
+
"jpg",
|
|
29
|
+
"png",
|
|
30
|
+
"tiff",
|
|
31
|
+
"webp",
|
|
32
|
+
"gif",
|
|
33
|
+
"svg"
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
function isLocalService(service) {
|
|
37
|
+
if (!service) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return "transform" in service;
|
|
41
|
+
}
|
|
42
|
+
function parseQuality(quality) {
|
|
43
|
+
let result = parseInt(quality);
|
|
44
|
+
if (Number.isNaN(result)) {
|
|
45
|
+
return quality;
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
const baseService = {
|
|
50
|
+
validateOptions(options) {
|
|
51
|
+
if (!options.src || typeof options.src !== "string" && typeof options.src !== "object") {
|
|
52
|
+
throw new AstroError({
|
|
53
|
+
...ExpectedImage,
|
|
54
|
+
message: ExpectedImage.message(JSON.stringify(options.src))
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (!isESMImportedImage(options.src)) {
|
|
58
|
+
if (options.src.startsWith("/@fs/")) {
|
|
59
|
+
throw new AstroError({
|
|
60
|
+
...LocalImageUsedWrongly,
|
|
61
|
+
message: LocalImageUsedWrongly.message(options.src)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
let missingDimension;
|
|
65
|
+
if (!options.width && !options.height) {
|
|
66
|
+
missingDimension = "both";
|
|
67
|
+
} else if (!options.width && options.height) {
|
|
68
|
+
missingDimension = "width";
|
|
69
|
+
} else if (options.width && !options.height) {
|
|
70
|
+
missingDimension = "height";
|
|
71
|
+
}
|
|
72
|
+
if (missingDimension) {
|
|
73
|
+
throw new AstroError({
|
|
74
|
+
...MissingImageDimension,
|
|
75
|
+
message: MissingImageDimension.message(missingDimension, options.src)
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
if (!VALID_SUPPORTED_FORMATS.includes(options.src.format)) {
|
|
80
|
+
throw new AstroError({
|
|
81
|
+
...UnsupportedImageFormat,
|
|
82
|
+
message: UnsupportedImageFormat.message(
|
|
83
|
+
options.src.format,
|
|
84
|
+
options.src.src,
|
|
85
|
+
VALID_SUPPORTED_FORMATS
|
|
86
|
+
)
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (options.src.format === "svg") {
|
|
90
|
+
options.format = "svg";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (!options.format) {
|
|
94
|
+
options.format = "webp";
|
|
95
|
+
}
|
|
96
|
+
return options;
|
|
97
|
+
},
|
|
98
|
+
getHTMLAttributes(options) {
|
|
99
|
+
let targetWidth = options.width;
|
|
100
|
+
let targetHeight = options.height;
|
|
101
|
+
if (isESMImportedImage(options.src)) {
|
|
102
|
+
const aspectRatio = options.src.width / options.src.height;
|
|
103
|
+
if (targetHeight && !targetWidth) {
|
|
104
|
+
targetWidth = Math.round(targetHeight * aspectRatio);
|
|
105
|
+
} else if (targetWidth && !targetHeight) {
|
|
106
|
+
targetHeight = Math.round(targetWidth / aspectRatio);
|
|
107
|
+
} else if (!targetWidth && !targetHeight) {
|
|
108
|
+
targetWidth = options.src.width;
|
|
109
|
+
targetHeight = options.src.height;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const { src, width, height, format, quality, ...attributes } = options;
|
|
113
|
+
return {
|
|
114
|
+
...attributes,
|
|
115
|
+
width: targetWidth,
|
|
116
|
+
height: targetHeight,
|
|
117
|
+
loading: attributes.loading ?? "lazy",
|
|
118
|
+
decoding: attributes.decoding ?? "async"
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
getURL(options, imageConfig) {
|
|
122
|
+
const searchParams = new URLSearchParams();
|
|
123
|
+
if (isESMImportedImage(options.src)) {
|
|
124
|
+
searchParams.append("href", options.src.src);
|
|
125
|
+
} else if (isRemoteAllowed(options.src, imageConfig)) {
|
|
126
|
+
searchParams.append("href", options.src);
|
|
127
|
+
} else {
|
|
128
|
+
return options.src;
|
|
129
|
+
}
|
|
130
|
+
const params = {
|
|
131
|
+
w: "width",
|
|
132
|
+
h: "height",
|
|
133
|
+
q: "quality",
|
|
134
|
+
f: "format"
|
|
135
|
+
};
|
|
136
|
+
Object.entries(params).forEach(([param, key]) => {
|
|
137
|
+
options[key] && searchParams.append(param, options[key].toString());
|
|
138
|
+
});
|
|
139
|
+
const imageEndpoint = joinPaths("/", "/_image");
|
|
140
|
+
return `${imageEndpoint}?${searchParams}`;
|
|
141
|
+
},
|
|
142
|
+
parseURL(url) {
|
|
143
|
+
const params = url.searchParams;
|
|
144
|
+
if (!params.has("href")) {
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
const transform = {
|
|
148
|
+
src: params.get("href"),
|
|
149
|
+
width: params.has("w") ? parseInt(params.get("w")) : void 0,
|
|
150
|
+
height: params.has("h") ? parseInt(params.get("h")) : void 0,
|
|
151
|
+
format: params.get("f"),
|
|
152
|
+
quality: params.get("q")
|
|
153
|
+
};
|
|
154
|
+
return transform;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
function matchPattern(url, remotePattern) {
|
|
159
|
+
return matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname, true);
|
|
160
|
+
}
|
|
161
|
+
function matchPort(url, port) {
|
|
162
|
+
return !port || port === url.port;
|
|
163
|
+
}
|
|
164
|
+
function matchProtocol(url, protocol) {
|
|
165
|
+
return !protocol || protocol === url.protocol.slice(0, -1);
|
|
166
|
+
}
|
|
167
|
+
function matchHostname(url, hostname, allowWildcard) {
|
|
168
|
+
if (!hostname) {
|
|
169
|
+
return true;
|
|
170
|
+
} else if (!allowWildcard || !hostname.startsWith("*")) {
|
|
171
|
+
return hostname === url.hostname;
|
|
172
|
+
} else if (hostname.startsWith("**.")) {
|
|
173
|
+
const slicedHostname = hostname.slice(2);
|
|
174
|
+
return slicedHostname !== url.hostname && url.hostname.endsWith(slicedHostname);
|
|
175
|
+
} else if (hostname.startsWith("*.")) {
|
|
176
|
+
const slicedHostname = hostname.slice(1);
|
|
177
|
+
const additionalSubdomains = url.hostname.replace(slicedHostname, "").split(".").filter(Boolean);
|
|
178
|
+
return additionalSubdomains.length === 1;
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
function matchPathname(url, pathname, allowWildcard) {
|
|
183
|
+
if (!pathname) {
|
|
184
|
+
return true;
|
|
185
|
+
} else if (!allowWildcard || !pathname.endsWith("*")) {
|
|
186
|
+
return pathname === url.pathname;
|
|
187
|
+
} else if (pathname.endsWith("/**")) {
|
|
188
|
+
const slicedPathname = pathname.slice(0, -2);
|
|
189
|
+
return slicedPathname !== url.pathname && url.pathname.startsWith(slicedPathname);
|
|
190
|
+
} else if (pathname.endsWith("/*")) {
|
|
191
|
+
const slicedPathname = pathname.slice(0, -1);
|
|
192
|
+
const additionalPathChunks = url.pathname.replace(slicedPathname, "").split("/").filter(Boolean);
|
|
193
|
+
return additionalPathChunks.length === 1;
|
|
194
|
+
}
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function isESMImportedImage(src) {
|
|
199
|
+
return typeof src === "object";
|
|
200
|
+
}
|
|
201
|
+
function isRemoteImage(src) {
|
|
202
|
+
return typeof src === "string";
|
|
203
|
+
}
|
|
204
|
+
function isRemoteAllowed(src, {
|
|
205
|
+
domains = [],
|
|
206
|
+
remotePatterns = []
|
|
207
|
+
}) {
|
|
208
|
+
if (!isRemotePath(src))
|
|
209
|
+
return true;
|
|
210
|
+
const url = new URL(src);
|
|
211
|
+
return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
|
|
212
|
+
}
|
|
213
|
+
async function getConfiguredImageService() {
|
|
214
|
+
if (!globalThis?.astroAsset?.imageService) {
|
|
215
|
+
const { default: service } = await import(
|
|
216
|
+
// @ts-expect-error
|
|
217
|
+
'../sharp.52841bb4.mjs'
|
|
218
|
+
).catch((e) => {
|
|
219
|
+
const error = new AstroError(InvalidImageService);
|
|
220
|
+
error.cause = e;
|
|
221
|
+
throw error;
|
|
222
|
+
});
|
|
223
|
+
if (!globalThis.astroAsset)
|
|
224
|
+
globalThis.astroAsset = {};
|
|
225
|
+
globalThis.astroAsset.imageService = service;
|
|
226
|
+
return service;
|
|
227
|
+
}
|
|
228
|
+
return globalThis.astroAsset.imageService;
|
|
229
|
+
}
|
|
230
|
+
async function getImage$1(options, imageConfig) {
|
|
231
|
+
if (!options || typeof options !== "object") {
|
|
232
|
+
throw new AstroError({
|
|
233
|
+
...ExpectedImageOptions,
|
|
234
|
+
message: ExpectedImageOptions.message(JSON.stringify(options))
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
const service = await getConfiguredImageService();
|
|
238
|
+
const resolvedOptions = {
|
|
239
|
+
...options,
|
|
240
|
+
src: typeof options.src === "object" && "then" in options.src ? (await options.src).default : options.src
|
|
241
|
+
};
|
|
242
|
+
const validatedOptions = service.validateOptions ? await service.validateOptions(resolvedOptions, imageConfig) : resolvedOptions;
|
|
243
|
+
let imageURL = await service.getURL(validatedOptions, imageConfig);
|
|
244
|
+
if (isLocalService(service) && globalThis.astroAsset.addStaticImage && // If `getURL` returned the same URL as the user provided, it means the service doesn't need to do anything
|
|
245
|
+
!(isRemoteImage(validatedOptions.src) && imageURL === validatedOptions.src)) {
|
|
246
|
+
imageURL = globalThis.astroAsset.addStaticImage(validatedOptions);
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
rawOptions: resolvedOptions,
|
|
250
|
+
options: validatedOptions,
|
|
251
|
+
src: imageURL,
|
|
252
|
+
attributes: service.getHTMLAttributes !== void 0 ? service.getHTMLAttributes(validatedOptions, imageConfig) : {}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const $$Astro$9 = createAstro("https://ecom2-demo.web.app");
|
|
257
|
+
const $$Image = createComponent(async ($$result, $$props, $$slots) => {
|
|
258
|
+
const Astro2 = $$result.createAstro($$Astro$9, $$props, $$slots);
|
|
259
|
+
Astro2.self = $$Image;
|
|
260
|
+
const props = Astro2.props;
|
|
261
|
+
if (props.alt === void 0 || props.alt === null) {
|
|
262
|
+
throw new AstroError(ImageMissingAlt);
|
|
263
|
+
}
|
|
264
|
+
if (typeof props.width === "string") {
|
|
265
|
+
props.width = parseInt(props.width);
|
|
266
|
+
}
|
|
267
|
+
if (typeof props.height === "string") {
|
|
268
|
+
props.height = parseInt(props.height);
|
|
269
|
+
}
|
|
270
|
+
const image = await getImage(props);
|
|
271
|
+
return renderTemplate`${maybeRenderHead()}<img${addAttribute(image.src, "src")}${spreadAttributes(image.attributes)}>`;
|
|
272
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/astro/components/Image.astro", void 0);
|
|
273
|
+
|
|
274
|
+
const imageConfig = {"service":{"entrypoint":"astro/assets/services/sharp","config":{}},"domains":[],"remotePatterns":[]};
|
|
275
|
+
const getImage = async (options) => await getImage$1(options, imageConfig);
|
|
276
|
+
|
|
277
|
+
global.__storefrontCMS = (fs, resolvePath) => {
|
|
278
|
+
const { STOREFRONT_BASE_DIR } = process.env;
|
|
279
|
+
let baseDir;
|
|
280
|
+
if (STOREFRONT_BASE_DIR) {
|
|
281
|
+
baseDir = resolvePath(process.cwd(), STOREFRONT_BASE_DIR);
|
|
282
|
+
} else {
|
|
283
|
+
baseDir = process.cwd();
|
|
284
|
+
}
|
|
285
|
+
process.env.STOREFRONT_BASE_DIR = baseDir;
|
|
286
|
+
const dirContent = resolvePath(baseDir, 'content');
|
|
287
|
+
|
|
288
|
+
const contentCache = {};
|
|
289
|
+
const getContent = (filename) => {
|
|
290
|
+
// MUST be sync for 'settings'
|
|
291
|
+
// Async with other content to support external CMS integration
|
|
292
|
+
const loadLocal = () => {
|
|
293
|
+
let content = contentCache[filename];
|
|
294
|
+
if (!content) {
|
|
295
|
+
if (filename.endsWith('/')) {
|
|
296
|
+
const dirColl = resolvePath(dirContent, filename);
|
|
297
|
+
return new Promise((resolve) => {
|
|
298
|
+
const slugs = fs.existsSync(dirColl)
|
|
299
|
+
? fs.readdirSync(dirColl)
|
|
300
|
+
.filter((file) => file.charAt(0) !== '.')
|
|
301
|
+
.map((file) => file.replace(/\.[^.]{0,5}$/, ''))
|
|
302
|
+
: [];
|
|
303
|
+
resolve(slugs);
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
// @TODO: Also parse Markdown with front matter
|
|
307
|
+
const filepath = resolvePath(dirContent, `${filename}.json`);
|
|
308
|
+
content = fs.existsSync(filepath)
|
|
309
|
+
? JSON.parse(fs.readFileSync(filepath, 'utf8'))
|
|
310
|
+
: null;
|
|
311
|
+
if (!filename.includes('/')) {
|
|
312
|
+
// Caching root content only (not collections)
|
|
313
|
+
contentCache[filename] = content;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return filename === 'settings'
|
|
317
|
+
? content
|
|
318
|
+
: new Promise((resolve) => { resolve(content); });
|
|
319
|
+
};
|
|
320
|
+
const handler = globalThis.$storefrontCmsHandler;
|
|
321
|
+
if (typeof handler === 'function') {
|
|
322
|
+
try {
|
|
323
|
+
const content = handler({ dirContent, filename, loadLocal });
|
|
324
|
+
if (content) {
|
|
325
|
+
return content;
|
|
326
|
+
}
|
|
327
|
+
} catch {
|
|
328
|
+
//
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return loadLocal();
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
let settings;
|
|
335
|
+
try {
|
|
336
|
+
settings = getContent('settings') || {};
|
|
337
|
+
} catch (e) {
|
|
338
|
+
settings = {};
|
|
339
|
+
}
|
|
340
|
+
const { domain } = settings;
|
|
341
|
+
const primaryColor = settings.primary_color || '#137c5c';
|
|
342
|
+
const secondaryColor = settings.secondary_color || primaryColor;
|
|
343
|
+
|
|
344
|
+
return {
|
|
345
|
+
domain,
|
|
346
|
+
primaryColor,
|
|
347
|
+
secondaryColor,
|
|
348
|
+
settings,
|
|
349
|
+
getContent,
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const _getConfig = () => {
|
|
354
|
+
const {
|
|
355
|
+
ECOM_STORE_ID,
|
|
356
|
+
VITE_ECOM_STORE_ID,
|
|
357
|
+
PROD,
|
|
358
|
+
} = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true,"SSR":true,"SITE":"https://ecom2-demo.web.app","ASSETS_PREFIX":undefined},{ECOM_STORE_ID:process.env.ECOM_STORE_ID,})) || process.env;
|
|
359
|
+
if (VITE_ECOM_STORE_ID) {
|
|
360
|
+
config.set({ storeId: Number(VITE_ECOM_STORE_ID) });
|
|
361
|
+
} else if (ECOM_STORE_ID) {
|
|
362
|
+
config.set({ storeId: Number(ECOM_STORE_ID) });
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const {
|
|
366
|
+
domain,
|
|
367
|
+
primaryColor,
|
|
368
|
+
secondaryColor,
|
|
369
|
+
settings,
|
|
370
|
+
getContent,
|
|
371
|
+
} = global.__storefrontCMS(fs, resolve);
|
|
372
|
+
config.set({ settingsContent: settings });
|
|
373
|
+
|
|
374
|
+
let { storeId } = config.get();
|
|
375
|
+
if (!storeId) {
|
|
376
|
+
const configFilepath = join(process.cwd(), 'config.json');
|
|
377
|
+
try {
|
|
378
|
+
const mergeConfig = JSON.parse(fs.readFileSync(configFilepath), 'utf8');
|
|
379
|
+
if (mergeConfig.storeId) {
|
|
380
|
+
storeId = mergeConfig.storeId;
|
|
381
|
+
}
|
|
382
|
+
} catch {
|
|
383
|
+
//
|
|
384
|
+
}
|
|
385
|
+
if (!storeId && !PROD) {
|
|
386
|
+
storeId = 1011;
|
|
387
|
+
console.warn('> `storeId` is not set, using fallback 1011 for dev only\n');
|
|
388
|
+
}
|
|
389
|
+
if (storeId) {
|
|
390
|
+
config.set({ storeId });
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
const {
|
|
394
|
+
lang,
|
|
395
|
+
countryCode,
|
|
396
|
+
currency,
|
|
397
|
+
currencySymbol,
|
|
398
|
+
} = config.get();
|
|
399
|
+
|
|
400
|
+
return {
|
|
401
|
+
storeId,
|
|
402
|
+
lang,
|
|
403
|
+
countryCode,
|
|
404
|
+
currency,
|
|
405
|
+
currencySymbol,
|
|
406
|
+
domain,
|
|
407
|
+
primaryColor,
|
|
408
|
+
secondaryColor,
|
|
409
|
+
settings,
|
|
410
|
+
getContent,
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
const emitter$1 = new EventEmitter();
|
|
415
|
+
const getConfig = _getConfig;
|
|
416
|
+
if (!globalThis.$apiMergeConfig) {
|
|
417
|
+
globalThis.$apiMergeConfig = {
|
|
418
|
+
isNoAuth: true,
|
|
419
|
+
canCache: true
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
if (!globalThis.$apiPrefetchEndpoints) {
|
|
423
|
+
globalThis.$apiPrefetchEndpoints = [];
|
|
424
|
+
}
|
|
425
|
+
if (!globalThis.$storefront) {
|
|
426
|
+
globalThis.$storefront = {
|
|
427
|
+
settings: {},
|
|
428
|
+
onLoad(callback) {
|
|
429
|
+
emitter$1.once("load", callback);
|
|
430
|
+
},
|
|
431
|
+
data: {}
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
const setResponseCache = (Astro, maxAge, sMaxAge) => {
|
|
435
|
+
const headerName = "Cache-Control" ;
|
|
436
|
+
let cacheControl = `public, max-age=${maxAge}, must-revalidate`;
|
|
437
|
+
if (sMaxAge) {
|
|
438
|
+
cacheControl += `, s-maxage=${sMaxAge}, stale-while-revalidate=604800`;
|
|
439
|
+
}
|
|
440
|
+
Astro.response.headers.set(headerName, cacheControl);
|
|
441
|
+
};
|
|
442
|
+
const loadRouteContext = async (Astro, {
|
|
443
|
+
contentCollection,
|
|
444
|
+
apiPrefetchEndpoints = globalThis.$apiPrefetchEndpoints
|
|
445
|
+
} = {}) => {
|
|
446
|
+
const startedAt = Date.now();
|
|
447
|
+
let urlPath = Astro.url.pathname;
|
|
448
|
+
const isPreview = urlPath.startsWith("/~preview");
|
|
449
|
+
if (isPreview) {
|
|
450
|
+
urlPath = urlPath.replace("/~preview", "");
|
|
451
|
+
}
|
|
452
|
+
const isHomepage = urlPath === "/";
|
|
453
|
+
const config = getConfig();
|
|
454
|
+
globalThis.$storefront.settings = config.settings;
|
|
455
|
+
let cmsContent;
|
|
456
|
+
const apiState = {};
|
|
457
|
+
const apiPrefetchings = [
|
|
458
|
+
...apiPrefetchEndpoints.map((endpoint) => {
|
|
459
|
+
if (endpoint === ":slug")
|
|
460
|
+
return null;
|
|
461
|
+
return api.get(endpoint);
|
|
462
|
+
})
|
|
463
|
+
];
|
|
464
|
+
let fetchingApiContext = null;
|
|
465
|
+
const apiContext = {
|
|
466
|
+
error: null
|
|
467
|
+
};
|
|
468
|
+
const { slug } = Astro.params;
|
|
469
|
+
if (isHomepage) {
|
|
470
|
+
cmsContent = await config.getContent("pages/home");
|
|
471
|
+
} else if (slug) {
|
|
472
|
+
if (contentCollection) {
|
|
473
|
+
cmsContent = await config.getContent(`${contentCollection}/${slug}`);
|
|
474
|
+
} else if (slug.startsWith("api/")) {
|
|
475
|
+
const err = new Error("/api/* routes not implemented on SSR directly");
|
|
476
|
+
Astro.response.status = 501;
|
|
477
|
+
err.responseHTML = `<head></head><body>${err.message}</body>`;
|
|
478
|
+
throw err;
|
|
479
|
+
} else {
|
|
480
|
+
const prefetchingsIndex = apiPrefetchings.findIndex((pr) => pr === null);
|
|
481
|
+
fetchingApiContext = new Promise((resolve, reject) => {
|
|
482
|
+
api.get(`slugs/${slug}`).then((response) => {
|
|
483
|
+
Object.assign(apiContext, response.data);
|
|
484
|
+
const apiResource = apiContext.resource;
|
|
485
|
+
const apiDoc = apiContext.doc;
|
|
486
|
+
apiState[`${apiResource}/${apiDoc._id}`] = apiDoc;
|
|
487
|
+
globalThis.$storefront.apiContext = {
|
|
488
|
+
resource: apiResource,
|
|
489
|
+
doc: apiDoc,
|
|
490
|
+
timestamp: Date.now()
|
|
491
|
+
};
|
|
492
|
+
resolve(null);
|
|
493
|
+
}).catch((err) => {
|
|
494
|
+
if (prefetchingsIndex > -1) {
|
|
495
|
+
reject(err);
|
|
496
|
+
} else {
|
|
497
|
+
apiContext.error = err;
|
|
498
|
+
resolve(null);
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
if (prefetchingsIndex > -1) {
|
|
503
|
+
apiPrefetchings[prefetchingsIndex] = fetchingApiContext;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
try {
|
|
508
|
+
(await Promise.all(apiPrefetchings)).forEach((response) => {
|
|
509
|
+
if (response) {
|
|
510
|
+
const { config: { endpoint }, data } = response;
|
|
511
|
+
const apiStateKey = endpoint.replace(/\?.*$/, "");
|
|
512
|
+
if (!apiState[apiStateKey]) {
|
|
513
|
+
apiState[apiStateKey] = data.result || data;
|
|
514
|
+
}
|
|
515
|
+
} else if (slug && apiContext.doc) {
|
|
516
|
+
apiState[`slugs/${slug}`] = apiContext;
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
} catch (err) {
|
|
520
|
+
const error = err;
|
|
521
|
+
const status = error.statusCode || 500;
|
|
522
|
+
if (status === 404) {
|
|
523
|
+
if (urlPath.endsWith("/")) {
|
|
524
|
+
err.redirectUrl = urlPath.slice(0, -1);
|
|
525
|
+
err.astroResponse = Astro.redirect(err.redirectUrl);
|
|
526
|
+
throw err;
|
|
527
|
+
}
|
|
528
|
+
setResponseCache(Astro, 120, 300);
|
|
529
|
+
} else {
|
|
530
|
+
console.error(error);
|
|
531
|
+
setResponseCache(Astro, 30);
|
|
532
|
+
Astro.response.headers.set("X-SSR-Error", error.message);
|
|
533
|
+
}
|
|
534
|
+
Astro.response.status = status;
|
|
535
|
+
err.responseHTML = `<head>
|
|
536
|
+
<meta http-equiv="refresh" content="0;
|
|
537
|
+
url=/~fallback?status=${status}&url=${encodeURIComponent(urlPath)}"/>
|
|
538
|
+
</head>
|
|
539
|
+
<body></body>`;
|
|
540
|
+
throw err;
|
|
541
|
+
}
|
|
542
|
+
Astro.response.headers.set("X-Load-Took", String(Date.now() - startedAt));
|
|
543
|
+
if (urlPath === "/~fallback") {
|
|
544
|
+
setResponseCache(Astro, 3600, 86400);
|
|
545
|
+
} else if (isHomepage) {
|
|
546
|
+
setResponseCache(Astro, 180, 300);
|
|
547
|
+
} else {
|
|
548
|
+
setResponseCache(Astro, 120, 300);
|
|
549
|
+
}
|
|
550
|
+
const routeContext = {
|
|
551
|
+
...config,
|
|
552
|
+
isHomepage,
|
|
553
|
+
cmsContent,
|
|
554
|
+
fetchingApiContext,
|
|
555
|
+
apiContext,
|
|
556
|
+
apiState,
|
|
557
|
+
isPreview
|
|
558
|
+
};
|
|
559
|
+
Astro.locals.routeContext = routeContext;
|
|
560
|
+
emitter$1.emit("load", routeContext);
|
|
561
|
+
return routeContext;
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
const pwaInfo = {"pwaInDevEnvironment":false,"webManifest":{"href":"/manifest.webmanifest","useCredentials":false,"linkTag":"<link rel=\"manifest\" href=\"/manifest.webmanifest\">"}};
|
|
565
|
+
|
|
566
|
+
var __freeze$2 = Object.freeze;
|
|
567
|
+
var __defProp$2 = Object.defineProperty;
|
|
568
|
+
var __template$2 = (cooked, raw) => __freeze$2(__defProp$2(cooked, "raw", { value: __freeze$2(raw || cooked.slice()) }));
|
|
569
|
+
var _a$2;
|
|
570
|
+
const $$Astro$8 = createAstro("https://ecom2-demo.web.app");
|
|
571
|
+
const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
|
|
572
|
+
const Astro2 = $$result.createAstro($$Astro$8, $$props, $$slots);
|
|
573
|
+
Astro2.self = $$BaseHead;
|
|
574
|
+
const deployRand = ({}).DEPLOY_RAND || "_";
|
|
575
|
+
const getIconUrl = (size) => {
|
|
576
|
+
return `/_image?f=png&w=${size}&h=${size}&href=${encodeURIComponent(settings.icon)}&V=${deployRand}`;
|
|
577
|
+
};
|
|
578
|
+
const {
|
|
579
|
+
storeId,
|
|
580
|
+
cmsContent,
|
|
581
|
+
fetchingApiContext,
|
|
582
|
+
apiContext,
|
|
583
|
+
lang,
|
|
584
|
+
countryCode,
|
|
585
|
+
currency,
|
|
586
|
+
currencySymbol,
|
|
587
|
+
domain,
|
|
588
|
+
primaryColor,
|
|
589
|
+
settings,
|
|
590
|
+
isPreview,
|
|
591
|
+
getContent
|
|
592
|
+
} = Astro2.locals.routeContext;
|
|
593
|
+
if (fetchingApiContext) {
|
|
594
|
+
await fetchingApiContext;
|
|
595
|
+
}
|
|
596
|
+
const apiDoc = apiContext.doc;
|
|
597
|
+
const state = apiDoc || cmsContent || {};
|
|
598
|
+
const title = state.meta_title || state.name || state.title || settings.name;
|
|
599
|
+
const description = state.meta_description || state.short_description || settings.description;
|
|
600
|
+
const favicon = settings.icon ? getIconUrl(32) : "/favicon.ico";
|
|
601
|
+
const shortcutIcon = settings.icon ? getIconUrl(192) : null;
|
|
602
|
+
const canonicalUrl = new URL(Astro2.url.pathname, Astro2.site || `https://${domain}`);
|
|
603
|
+
const { metatags: metatagsContent } = await getContent("layout");
|
|
604
|
+
const ogLocale = lang.length === 2 ? lang : lang.substring(0, 2) + lang.slice(3).toUpperCase();
|
|
605
|
+
let ogImage;
|
|
606
|
+
if (apiDoc) {
|
|
607
|
+
const picture = img(state, void 0, "zoom");
|
|
608
|
+
ogImage = picture && picture.url;
|
|
609
|
+
}
|
|
610
|
+
if (!ogImage) {
|
|
611
|
+
if (metatagsContent?.og_image) {
|
|
612
|
+
ogImage = metatagsContent.og_image.charAt(0) === "/" ? `https://${domain}${metatagsContent.og_image}` : metatagsContent.og_image;
|
|
613
|
+
}
|
|
614
|
+
} else {
|
|
615
|
+
ogImage = ogImage.replace(/(\w+\.)?(ecoms\d)\.com/i, "$2-nyc3.nyc3.cdn.digitaloceanspaces.com");
|
|
616
|
+
}
|
|
617
|
+
let inlineClientJS = `
|
|
618
|
+
window.ECOM_STORE_ID = ${storeId};
|
|
619
|
+
window.ECOM_LANG = '${lang}';
|
|
620
|
+
window.ECOM_CURRENCY = '${currency}';
|
|
621
|
+
window.ECOM_CURRENCY_SYMBOL = '${currencySymbol}';
|
|
622
|
+
window.ECOM_COUNTRY_CODE = '${countryCode}';
|
|
623
|
+
window.$storefront = ${JSON.stringify({ settings, data: {} })};`;
|
|
624
|
+
if (apiContext.error) {
|
|
625
|
+
const { message, statusCode } = apiContext.error;
|
|
626
|
+
const url = Astro2.url.pathname;
|
|
627
|
+
inlineClientJS += `
|
|
628
|
+
console.error(${JSON.stringify(message)});
|
|
629
|
+
setTimeout(() => {
|
|
630
|
+
window.location.replace("/~fallback?status=${statusCode}&url=${encodeURIComponent(url)}");
|
|
631
|
+
}, 1);`;
|
|
632
|
+
}
|
|
633
|
+
if (apiDoc) {
|
|
634
|
+
if (typeof apiDoc.price === "number") {
|
|
635
|
+
apiDoc.price = price(apiDoc);
|
|
636
|
+
}
|
|
637
|
+
const slimDocRegex = globalThis.$storefrontSlimDocRegex || /body_|meta_|metafields|_records|i18n/;
|
|
638
|
+
const minifyApiDoc = (nestedDoc) => {
|
|
639
|
+
if (typeof nestedDoc === "object" && nestedDoc) {
|
|
640
|
+
if (Array.isArray(nestedDoc)) {
|
|
641
|
+
nestedDoc.forEach((item) => minifyApiDoc(item));
|
|
642
|
+
} else {
|
|
643
|
+
Object.keys(nestedDoc).forEach((field) => {
|
|
644
|
+
if (slimDocRegex.test(field)) {
|
|
645
|
+
delete nestedDoc[field];
|
|
646
|
+
} else {
|
|
647
|
+
minifyApiDoc(nestedDoc[field]);
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return nestedDoc;
|
|
653
|
+
};
|
|
654
|
+
inlineClientJS += `
|
|
655
|
+
window.$storefront.apiContext = ${JSON.stringify({
|
|
656
|
+
resource: apiContext.resource,
|
|
657
|
+
doc: minifyApiDoc({ ...apiDoc }),
|
|
658
|
+
timestamp: Date.now()
|
|
659
|
+
})};
|
|
660
|
+
window.$storefront.context /* DEPRECATED */ = window.$storefront.apiContext`;
|
|
661
|
+
}
|
|
662
|
+
if (isPreview) {
|
|
663
|
+
inlineClientJS += `
|
|
664
|
+
window.$isCmsPreview = true;`;
|
|
665
|
+
}
|
|
666
|
+
const inlineJSONLd = JSON.stringify({
|
|
667
|
+
"@context": "http://schema.org",
|
|
668
|
+
"@type": "Organization",
|
|
669
|
+
name: settings.name,
|
|
670
|
+
url: `https://${domain}/`,
|
|
671
|
+
logo: `https://${domain}${settings.logo}`
|
|
672
|
+
});
|
|
673
|
+
return renderTemplate(_a$2 || (_a$2 = __template$2(['<meta charset="UTF-8">\n<meta name="viewport" content="width=device-width">\n<meta name="theme-color"', '>\n<link rel="icon" type="image/png"', ' sizes="32x32">\n', "\n<title>", '</title>\n<meta name="description"', '>\n<meta name="author"', '>\n<meta name="generator"', '>\n<link rel="canonical"', ">\n", '\n<meta name="apple-mobile-web-app-capable" content="yes">\n<meta name="apple-mobile-web-app-status-bar-style" content="default">\n<meta property="og:site_name"', '>\n<meta property="og:url"', '>\n<meta property="og:title"', '>\n<meta property="og:description"', '>\n<meta property="og:type" content="website">\n<meta property="og:locale"', ">\n", "\n", '\n<meta name="twitter:card" content="summary">\n', '\n<meta name="ecom-store-id"', ">\n\n\n", "\n", "\n\n<script>", '<\/script>\n<script type="application/ld+json">', "<\/script>"])), addAttribute(primaryColor, "content"), addAttribute(favicon, "href"), shortcutIcon && renderTemplate`<link rel="icon" type="image/png"${addAttribute(shortcutIcon, "href")} sizes="192x192">`, title, addAttribute(description, "content"), addAttribute(settings.name, "content"), addAttribute(Astro2.generator, "content"), addAttribute(canonicalUrl, "href"), shortcutIcon && renderTemplate`<link rel="apple-touch-icon"${addAttribute(shortcutIcon, "href")}>`, addAttribute(settings.name, "content"), addAttribute(canonicalUrl, "content"), addAttribute(title, "content"), addAttribute(description, "content"), addAttribute(ogLocale, "content"), ogImage && renderTemplate`<meta property="og:image"${addAttribute(ogImage, "content")}>`, metatagsContent?.fb_app_id && renderTemplate`<meta property="fb:app_id"${addAttribute(metatagsContent.fb_app_id, "content")}>`, metatagsContent?.twitter_username && renderTemplate`<meta name="twitter:site"${addAttribute(metatagsContent.twitter_username, "content")}>`, addAttribute(String(storeId), "content"), pwaInfo && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(pwaInfo.webManifest.linkTag)}` })}`, !pwaInfo && !false && renderTemplate`<link rel="manifest" href="/manifest.webmanifest">`, unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd));
|
|
674
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro", void 0);
|
|
675
|
+
|
|
676
|
+
function has(value) {
|
|
677
|
+
return typeof value === "string";
|
|
678
|
+
}
|
|
679
|
+
function is(a, b) {
|
|
680
|
+
return a === b;
|
|
681
|
+
}
|
|
682
|
+
function any(a, b) {
|
|
683
|
+
return has(a) && b.includes(a.toLowerCase());
|
|
684
|
+
}
|
|
685
|
+
const ElementWeights = {
|
|
686
|
+
META: 10,
|
|
687
|
+
TITLE: 9,
|
|
688
|
+
PRECONNECT: 8,
|
|
689
|
+
ASYNC_SCRIPT: 7,
|
|
690
|
+
IMPORT_STYLES: 6,
|
|
691
|
+
SYNC_SCRIPT: 5,
|
|
692
|
+
SYNC_STYLES: 4,
|
|
693
|
+
PRELOAD: 3,
|
|
694
|
+
DEFER_SCRIPT: 2,
|
|
695
|
+
PREFETCH_PRERENDER: 1,
|
|
696
|
+
OTHER: 0
|
|
697
|
+
};
|
|
698
|
+
const ElementDetectors = {
|
|
699
|
+
META: isMeta,
|
|
700
|
+
TITLE: isTitle,
|
|
701
|
+
PRECONNECT: isPreconnect,
|
|
702
|
+
DEFER_SCRIPT: isDeferScript,
|
|
703
|
+
ASYNC_SCRIPT: isAsyncScript,
|
|
704
|
+
IMPORT_STYLES: isImportStyles,
|
|
705
|
+
SYNC_SCRIPT: isSyncScript,
|
|
706
|
+
SYNC_STYLES: isSyncStyles,
|
|
707
|
+
PRELOAD: isPreload,
|
|
708
|
+
PREFETCH_PRERENDER: isPrefetchPrerender
|
|
709
|
+
};
|
|
710
|
+
const META_HTTP_EQUIV_KEYWORDS = [
|
|
711
|
+
"accept-ch",
|
|
712
|
+
"content-security-policy",
|
|
713
|
+
"content-type",
|
|
714
|
+
"default-style",
|
|
715
|
+
"delegate-ch",
|
|
716
|
+
"origin-trial",
|
|
717
|
+
"x-dns-prefetch-control"
|
|
718
|
+
];
|
|
719
|
+
function isMeta(name, a) {
|
|
720
|
+
if (name === "base")
|
|
721
|
+
return true;
|
|
722
|
+
if (name !== "meta")
|
|
723
|
+
return false;
|
|
724
|
+
return has(a.charset) || is(a.name, "viewport") || any(a["http-equiv"], META_HTTP_EQUIV_KEYWORDS);
|
|
725
|
+
}
|
|
726
|
+
function isTitle(name) {
|
|
727
|
+
return name === "title";
|
|
728
|
+
}
|
|
729
|
+
function isPreconnect(name, { rel }) {
|
|
730
|
+
return name === "link" && is(rel, "preconnect");
|
|
731
|
+
}
|
|
732
|
+
function isAsyncScript(name, { src, async }) {
|
|
733
|
+
return name === "script" && has(src) && has(async);
|
|
734
|
+
}
|
|
735
|
+
function isImportStyles(name, a, children) {
|
|
736
|
+
const importRe = /@import/;
|
|
737
|
+
if (name === "style") {
|
|
738
|
+
return importRe.test(children);
|
|
739
|
+
}
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
function isSyncScript(name, { src, defer, async, type = "" }) {
|
|
743
|
+
if (name !== "script")
|
|
744
|
+
return false;
|
|
745
|
+
return !(has(src) && (has(defer) || has(async) || is(type, "module")) || type.includes("json"));
|
|
746
|
+
}
|
|
747
|
+
function isSyncStyles(name, { rel }) {
|
|
748
|
+
if (name === "style")
|
|
749
|
+
return true;
|
|
750
|
+
return name === "link" && is(rel, "stylesheet");
|
|
751
|
+
}
|
|
752
|
+
function isPreload(name, { rel }) {
|
|
753
|
+
return name === "link" && any(rel, ["preload", "modulepreload"]);
|
|
754
|
+
}
|
|
755
|
+
function isDeferScript(name, { src, defer, async, type }) {
|
|
756
|
+
if (name !== "script")
|
|
757
|
+
return false;
|
|
758
|
+
return has(src) && has(defer) || has(src) && is(type, "module") && !has(async);
|
|
759
|
+
}
|
|
760
|
+
function isPrefetchPrerender(name, { rel }) {
|
|
761
|
+
return name === "link" && any(rel, ["prefetch", "dns-prefetch", "prerender"]);
|
|
762
|
+
}
|
|
763
|
+
function getWeight(element) {
|
|
764
|
+
for (const [id, detector] of Object.entries(ElementDetectors)) {
|
|
765
|
+
const children = element.name === "style" && element.children.length > 0 ? renderSync(element) : "";
|
|
766
|
+
if (detector(element.name, element.attributes, children)) {
|
|
767
|
+
return ElementWeights[id];
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
return ElementWeights.OTHER;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
function capo(html) {
|
|
774
|
+
const ast = parse(html);
|
|
775
|
+
try {
|
|
776
|
+
walkSync(ast, (node, parent, index) => {
|
|
777
|
+
if (node.type === ELEMENT_NODE && node.name === "head") {
|
|
778
|
+
if (parent) {
|
|
779
|
+
parent.children.splice(index, 1, getSortedHead(node));
|
|
780
|
+
throw "done";
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
} catch (e) {
|
|
785
|
+
if (e !== "done")
|
|
786
|
+
throw e;
|
|
787
|
+
}
|
|
788
|
+
return renderSync(ast);
|
|
789
|
+
}
|
|
790
|
+
function getSortedHead(head) {
|
|
791
|
+
const weightedChildren = head.children.map((node) => {
|
|
792
|
+
if (node.type === ELEMENT_NODE) {
|
|
793
|
+
const weight = getWeight(node);
|
|
794
|
+
return [weight, node];
|
|
795
|
+
}
|
|
796
|
+
}).filter(Boolean);
|
|
797
|
+
const children = weightedChildren.sort((a, b) => b[0] - a[0]).map(([_, element]) => element);
|
|
798
|
+
return { ...head, children };
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
const Head = createComponent({
|
|
802
|
+
factory: async (result, props, slots) => {
|
|
803
|
+
let head = "";
|
|
804
|
+
head += `<head${spreadAttributes(props)} data-capo>`;
|
|
805
|
+
head += await renderSlotToString(result, slots.default);
|
|
806
|
+
head += renderAllHeadContent(result);
|
|
807
|
+
head += "</head>";
|
|
808
|
+
return unescapeHTML(capo(head));
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
function removeQueryString(src) {
|
|
813
|
+
const index = src.lastIndexOf("?");
|
|
814
|
+
return index > 0 ? src.substring(0, index) : src;
|
|
815
|
+
}
|
|
816
|
+
function basename(src) {
|
|
817
|
+
return removeQueryString(src.replace(/^.*[\\\/]/, ""));
|
|
818
|
+
}
|
|
819
|
+
const extname = (src) => {
|
|
820
|
+
const base = basename(src);
|
|
821
|
+
const index = base.lastIndexOf(".");
|
|
822
|
+
if (index <= 0) {
|
|
823
|
+
return "";
|
|
824
|
+
}
|
|
825
|
+
return base.substring(index);
|
|
826
|
+
};
|
|
827
|
+
function parseAspectRatio(aspectRatio) {
|
|
828
|
+
if (!aspectRatio) {
|
|
829
|
+
return void 0;
|
|
830
|
+
}
|
|
831
|
+
if (typeof aspectRatio === "number") {
|
|
832
|
+
return aspectRatio;
|
|
833
|
+
}
|
|
834
|
+
const [width, height] = aspectRatio.split(":");
|
|
835
|
+
return parseInt(width, 10) / parseInt(height, 10);
|
|
836
|
+
}
|
|
837
|
+
async function resolveAspectRatio({ src, aspectRatio }) {
|
|
838
|
+
if (typeof src === "string") {
|
|
839
|
+
return parseAspectRatio(aspectRatio);
|
|
840
|
+
}
|
|
841
|
+
throw new Error('Custom (faster) `Picture.runtime.astro` works only with string ("remote") src');
|
|
842
|
+
}
|
|
843
|
+
async function resolveFormats({ src, formats }) {
|
|
844
|
+
const unique = new Set(formats);
|
|
845
|
+
if (typeof src === "string") {
|
|
846
|
+
unique.add(extname(src).replace(".", ""));
|
|
847
|
+
} else {
|
|
848
|
+
throw new Error("Custom `Picture.ssr.astro` works only with string src");
|
|
849
|
+
}
|
|
850
|
+
return Array.from(unique).filter(Boolean);
|
|
851
|
+
}
|
|
852
|
+
const createPictureGetter = (getImage) => {
|
|
853
|
+
return async (params) => {
|
|
854
|
+
const {
|
|
855
|
+
src,
|
|
856
|
+
alt,
|
|
857
|
+
widths,
|
|
858
|
+
fit,
|
|
859
|
+
position,
|
|
860
|
+
background
|
|
861
|
+
} = params;
|
|
862
|
+
if (!src) {
|
|
863
|
+
throw new Error("[@astrojs/image] `src` is required");
|
|
864
|
+
}
|
|
865
|
+
if (!widths || !Array.isArray(widths)) {
|
|
866
|
+
throw new Error("[@astrojs/image] at least one `width` is required. ex: `widths={[100]}`");
|
|
867
|
+
}
|
|
868
|
+
const aspectRatio = await resolveAspectRatio(params);
|
|
869
|
+
if (!aspectRatio) {
|
|
870
|
+
throw new Error("`aspectRatio` must be provided for remote images");
|
|
871
|
+
}
|
|
872
|
+
const allFormats = await resolveFormats(params);
|
|
873
|
+
const lastFormat = allFormats[allFormats.length - 1];
|
|
874
|
+
const maxWidth = Math.max(...widths);
|
|
875
|
+
let image;
|
|
876
|
+
async function getSource(format) {
|
|
877
|
+
const imgs = await Promise.all(
|
|
878
|
+
widths.map(async (width) => {
|
|
879
|
+
const img = await getImage({
|
|
880
|
+
src,
|
|
881
|
+
alt,
|
|
882
|
+
format,
|
|
883
|
+
width,
|
|
884
|
+
height: width / aspectRatio,
|
|
885
|
+
fit,
|
|
886
|
+
position,
|
|
887
|
+
background,
|
|
888
|
+
aspectRatio
|
|
889
|
+
});
|
|
890
|
+
if (format === lastFormat && width === maxWidth) {
|
|
891
|
+
image = img;
|
|
892
|
+
}
|
|
893
|
+
return `${img.src} ${width}w`;
|
|
894
|
+
})
|
|
895
|
+
);
|
|
896
|
+
return {
|
|
897
|
+
type: mime.getType(format) || format,
|
|
898
|
+
srcset: imgs.join(",")
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
const sources = await Promise.all(allFormats.map((format) => getSource(format)));
|
|
902
|
+
return {
|
|
903
|
+
sources,
|
|
904
|
+
// @ts-ignore
|
|
905
|
+
image
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
const getAspectRatio = (src, tryImageSize) => {
|
|
911
|
+
if (typeof src === "string") {
|
|
912
|
+
src = tryImageSize(src);
|
|
913
|
+
} else if (src.width) {
|
|
914
|
+
return src.height ? src.width / src.height : 1;
|
|
915
|
+
}
|
|
916
|
+
return 0;
|
|
917
|
+
};
|
|
918
|
+
const useSSRPicture = async (params) => {
|
|
919
|
+
const {
|
|
920
|
+
src,
|
|
921
|
+
alt,
|
|
922
|
+
sizes: propSizes,
|
|
923
|
+
widths,
|
|
924
|
+
aspectRatio: propAspectRatio,
|
|
925
|
+
fit,
|
|
926
|
+
background,
|
|
927
|
+
position,
|
|
928
|
+
formats = ["avif", "webp"],
|
|
929
|
+
loading = "lazy",
|
|
930
|
+
decoding = "async",
|
|
931
|
+
hasImg = true,
|
|
932
|
+
tryImageSize,
|
|
933
|
+
getPicture,
|
|
934
|
+
...attrs
|
|
935
|
+
} = params;
|
|
936
|
+
let aspectRatio;
|
|
937
|
+
if (propAspectRatio) {
|
|
938
|
+
if (typeof propAspectRatio === "number") {
|
|
939
|
+
aspectRatio = propAspectRatio;
|
|
940
|
+
} else {
|
|
941
|
+
const [width, height] = propAspectRatio.split(":");
|
|
942
|
+
aspectRatio = Number(width) / Number(height);
|
|
943
|
+
}
|
|
944
|
+
} else if ((!attrs.width || !attrs.height) && typeof src === "string") {
|
|
945
|
+
const { width, height } = tryImageSize(src);
|
|
946
|
+
if (width && height) {
|
|
947
|
+
aspectRatio = getAspectRatio({ width, height }, tryImageSize);
|
|
948
|
+
let hasSplicedWidths = false;
|
|
949
|
+
for (let i = widths.length - 1; i >= 0; i--) {
|
|
950
|
+
if (widths[i] > width) {
|
|
951
|
+
widths.splice(i, 1);
|
|
952
|
+
hasSplicedWidths = true;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
if (hasSplicedWidths) {
|
|
956
|
+
attrs.width = width;
|
|
957
|
+
attrs.height = height;
|
|
958
|
+
if (!widths.find((w) => w === width)) {
|
|
959
|
+
widths.push(width);
|
|
960
|
+
}
|
|
961
|
+
} else {
|
|
962
|
+
attrs.width = Math.max(...widths);
|
|
963
|
+
attrs.height = Math.round(attrs.width / aspectRatio);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
let sizes = propSizes || "";
|
|
968
|
+
if (!sizes && attrs.class) {
|
|
969
|
+
const classNames = attrs.class.split(" ");
|
|
970
|
+
let nextSize;
|
|
971
|
+
const breakpoints = {
|
|
972
|
+
sm: 640,
|
|
973
|
+
md: 768,
|
|
974
|
+
lg: 1024,
|
|
975
|
+
xl: 1280,
|
|
976
|
+
"2xl": 1536
|
|
977
|
+
};
|
|
978
|
+
[
|
|
979
|
+
["", 0],
|
|
980
|
+
...Object.entries(breakpoints)
|
|
981
|
+
].forEach(([breakpoint, minWidth]) => {
|
|
982
|
+
const classRegex = breakpoint ? new RegExp(`^${breakpoint}:max-w-(\\[\\w+\\]|screen-\\w+)$`) : /^max-w-(\[\w+\]|screen-\w+)$/;
|
|
983
|
+
let classMaxW;
|
|
984
|
+
classNames.find((_class) => {
|
|
985
|
+
const maxW = _class.replace(classRegex, "$1");
|
|
986
|
+
if (maxW !== _class) {
|
|
987
|
+
classMaxW = maxW;
|
|
988
|
+
return true;
|
|
989
|
+
}
|
|
990
|
+
return false;
|
|
991
|
+
});
|
|
992
|
+
if (classMaxW) {
|
|
993
|
+
if (nextSize) {
|
|
994
|
+
if (sizes)
|
|
995
|
+
sizes += ", ";
|
|
996
|
+
sizes += `(max-width: ${minWidth - 1}px) ${nextSize}`;
|
|
997
|
+
}
|
|
998
|
+
if (classMaxW.charAt(0) === "[") {
|
|
999
|
+
nextSize = classMaxW.slice(1, classMaxW.length - 1);
|
|
1000
|
+
} else {
|
|
1001
|
+
const screenSize = breakpoints[classMaxW.slice(7)];
|
|
1002
|
+
if (screenSize) {
|
|
1003
|
+
nextSize = `${screenSize}px`;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
if (nextSize) {
|
|
1009
|
+
if (sizes)
|
|
1010
|
+
sizes += ", ";
|
|
1011
|
+
sizes += nextSize;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
if (!sizes && widths.length === 1) {
|
|
1015
|
+
sizes = `${widths[0] / 2}px`;
|
|
1016
|
+
}
|
|
1017
|
+
const { image, sources } = await getPicture({
|
|
1018
|
+
src,
|
|
1019
|
+
widths,
|
|
1020
|
+
formats,
|
|
1021
|
+
aspectRatio,
|
|
1022
|
+
fit,
|
|
1023
|
+
background,
|
|
1024
|
+
position,
|
|
1025
|
+
alt
|
|
1026
|
+
});
|
|
1027
|
+
delete image.width;
|
|
1028
|
+
delete image.height;
|
|
1029
|
+
const pictureAttrs = {};
|
|
1030
|
+
if (!hasImg) {
|
|
1031
|
+
pictureAttrs["data-alt"] = alt;
|
|
1032
|
+
Object.assign(pictureAttrs, attrs);
|
|
1033
|
+
delete pictureAttrs.width;
|
|
1034
|
+
delete pictureAttrs.height;
|
|
1035
|
+
}
|
|
1036
|
+
return {
|
|
1037
|
+
sizes,
|
|
1038
|
+
aspectRatio,
|
|
1039
|
+
sources,
|
|
1040
|
+
pictureAttrs,
|
|
1041
|
+
imgAttrs: !hasImg ? null : {
|
|
1042
|
+
...image,
|
|
1043
|
+
alt,
|
|
1044
|
+
loading,
|
|
1045
|
+
decoding,
|
|
1046
|
+
...attrs
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
const $$Astro$7 = createAstro("https://ecom2-demo.web.app");
|
|
1052
|
+
const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
|
|
1053
|
+
const Astro2 = $$result.createAstro($$Astro$7, $$props, $$slots);
|
|
1054
|
+
Astro2.self = $$Picture;
|
|
1055
|
+
const deployRand = ({}).DEPLOY_RAND;
|
|
1056
|
+
const versionSuffix = ({}).BUILD_OUTPUT !== "static" && deployRand ? `&V=${deployRand}` : "";
|
|
1057
|
+
const getImageFilepath = (src) => {
|
|
1058
|
+
return resolve(process.env.STOREFRONT_BASE_DIR, `public${src}`);
|
|
1059
|
+
};
|
|
1060
|
+
const tryImageSize = (src) => {
|
|
1061
|
+
let dimensions = {};
|
|
1062
|
+
if (typeof src === "string" && src.startsWith("/")) {
|
|
1063
|
+
try {
|
|
1064
|
+
dimensions = imageSize(getImageFilepath(src));
|
|
1065
|
+
} catch (e) {
|
|
1066
|
+
dimensions = {};
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
return dimensions;
|
|
1070
|
+
};
|
|
1071
|
+
const {
|
|
1072
|
+
sizes,
|
|
1073
|
+
sources,
|
|
1074
|
+
pictureAttrs,
|
|
1075
|
+
imgAttrs
|
|
1076
|
+
} = await useSSRPicture({
|
|
1077
|
+
...Astro2.props,
|
|
1078
|
+
tryImageSize,
|
|
1079
|
+
getPicture: createPictureGetter(async (imageOptions) => {
|
|
1080
|
+
const {
|
|
1081
|
+
options,
|
|
1082
|
+
src,
|
|
1083
|
+
attributes: { width, height }
|
|
1084
|
+
} = await getImage(imageOptions);
|
|
1085
|
+
return { src, width, height };
|
|
1086
|
+
})
|
|
1087
|
+
});
|
|
1088
|
+
if (imgAttrs) {
|
|
1089
|
+
imgAttrs.src += versionSuffix;
|
|
1090
|
+
}
|
|
1091
|
+
return renderTemplate`${maybeRenderHead()}<picture${spreadAttributes(pictureAttrs)}>
|
|
1092
|
+
${sources.map((attrs) => {
|
|
1093
|
+
if (versionSuffix) {
|
|
1094
|
+
attrs.srcset = attrs.srcset.replace(/\s(\w+)$/, `${versionSuffix} $1`);
|
|
1095
|
+
}
|
|
1096
|
+
return renderTemplate`<source${spreadAttributes(attrs)}${addAttribute(sizes, "sizes")}>`;
|
|
1097
|
+
})}
|
|
1098
|
+
${imgAttrs && renderTemplate`<img${spreadAttributes(imgAttrs)}>`}
|
|
1099
|
+
</picture>`;
|
|
1100
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/components/Picture.astro", void 0);
|
|
1101
|
+
|
|
1102
|
+
const $$Astro$6 = createAstro("https://ecom2-demo.web.app");
|
|
1103
|
+
const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
|
|
1104
|
+
const Astro2 = $$result.createAstro($$Astro$6, $$props, $$slots);
|
|
1105
|
+
Astro2.self = $$BaseBody;
|
|
1106
|
+
const { settings } = Astro2.locals.routeContext;
|
|
1107
|
+
return renderTemplate`${maybeRenderHead()}<body>
|
|
1108
|
+
<div id="teleported-overlap" class="relative z-[59]"></div>
|
|
1109
|
+
<div id="teleported-top" class="relative z-[19]"></div>
|
|
1110
|
+
${renderSlot($$result, $$slots["default"])}
|
|
1111
|
+
${renderSlot($$result, $$slots["before-body-end"])}
|
|
1112
|
+
<div id="teleported-bottom" class="relative z-[19]"></div>
|
|
1113
|
+
${settings.icon && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": settings.icon, "alt": "Icon", "formats": ["png"], "widths": [32, 192, 512], "sizes": "32px", "class": "hidden absolute", "style": "bottom: -1000px", "hasImg": false })}`}
|
|
1114
|
+
</body>`;
|
|
1115
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro", void 0);
|
|
1116
|
+
|
|
1117
|
+
const $$Astro$5 = createAstro("https://ecom2-demo.web.app");
|
|
1118
|
+
const $$Base$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
1119
|
+
const Astro2 = $$result.createAstro($$Astro$5, $$props, $$slots);
|
|
1120
|
+
Astro2.self = $$Base$1;
|
|
1121
|
+
const { getContent } = Astro2.locals.routeContext;
|
|
1122
|
+
const { custom_code: customCodeContent } = await getContent("layout");
|
|
1123
|
+
return renderTemplate`${renderComponent($$result, "Head", Head, {}, { "default": ($$result2) => renderTemplate`
|
|
1124
|
+
${renderSlot($$result2, $$slots["base-head"])}
|
|
1125
|
+
${customCodeContent?.css && renderTemplate`<style>{customCodeContent.css}</style>`}${customCodeContent?.html_head && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(customCodeContent.html_head)}` })}`}${renderSlot($$result2, $$slots["base-head-scripts"])}
|
|
1126
|
+
${renderSlot($$result2, $$slots["before-head-end"])}
|
|
1127
|
+
` })}
|
|
1128
|
+
${renderComponent($$result, "BaseBody", $$BaseBody, {}, { "default": ($$result2) => renderTemplate`
|
|
1129
|
+
${renderSlot($$result2, $$slots["default"])}
|
|
1130
|
+
${customCodeContent?.html_body && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(customCodeContent.html_body)}` })}`}${renderSlot($$result2, $$slots["base-body-scripts"])}
|
|
1131
|
+
${renderSlot($$result2, $$slots["before-body-end"])}
|
|
1132
|
+
` })}`;
|
|
1133
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro", void 0);
|
|
1134
|
+
|
|
1135
|
+
var __freeze$1 = Object.freeze;
|
|
1136
|
+
var __defProp$1 = Object.defineProperty;
|
|
1137
|
+
var __template$1 = (cooked, raw) => __freeze$1(__defProp$1(cooked, "raw", { value: __freeze$1(raw || cooked.slice()) }));
|
|
1138
|
+
var _a$1;
|
|
1139
|
+
const $$Astro$4 = createAstro("https://ecom2-demo.web.app");
|
|
1140
|
+
const $$InlineScripts = createComponent(async ($$result, $$props, $$slots) => {
|
|
1141
|
+
const Astro2 = $$result.createAstro($$Astro$4, $$props, $$slots);
|
|
1142
|
+
Astro2.self = $$InlineScripts;
|
|
1143
|
+
return renderTemplate(_a$1 || (_a$1 = __template$1(['<script>\n window.$firebaseConfig = {\n apiKey: "AIzaSyCnvm7QrPKzSBrUi09Z3zTgjDST0t4Yikg",\n authDomain: "ecom2-demo.firebaseapp.com",\n projectId: "ecom2-demo",\n storageBucket: "ecom2-demo.appspot.com",\n messagingSenderId: "70369627313",\n appId: "1:70369627313:web:06634033b9c6208fe7e690"\n };\n<\/script>'])));
|
|
1144
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/scripts/InlineScripts.astro", void 0);
|
|
1145
|
+
|
|
1146
|
+
const $$Astro$3 = createAstro("https://ecom2-demo.web.app");
|
|
1147
|
+
const $$Base = createComponent(async ($$result, $$props, $$slots) => {
|
|
1148
|
+
const Astro2 = $$result.createAstro($$Astro$3, $$props, $$slots);
|
|
1149
|
+
Astro2.self = $$Base;
|
|
1150
|
+
return renderTemplate`${renderComponent($$result, "SfBase", $$Base$1, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "base-head" }, { "default": ($$result3) => renderTemplate`
|
|
1151
|
+
${renderSlot($$result3, $$slots["base-head"])}
|
|
1152
|
+
` })}`, "before-head-end": ($$result2) => renderTemplate`${renderComponent($$result2, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": ($$result2) => renderTemplate`
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
${renderSlot($$result2, $$slots["default"])}
|
|
1156
|
+
` })}`;
|
|
1157
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro", void 0);
|
|
1158
|
+
|
|
1159
|
+
const checkObjNotNull = (obj) => {
|
|
1160
|
+
return Object.values(obj).filter((val) => val).length;
|
|
1161
|
+
};
|
|
1162
|
+
const getModulesInfoPreset = (settingsModules = globalThis.$storefront.settings.modules) => {
|
|
1163
|
+
const modulesInfoPreset = {};
|
|
1164
|
+
if (settingsModules) {
|
|
1165
|
+
const settingsPayments = settingsModules.list_payments;
|
|
1166
|
+
if (settingsPayments) {
|
|
1167
|
+
const settingsDiscount = settingsPayments.discount_option;
|
|
1168
|
+
if (settingsDiscount && checkObjNotNull(settingsDiscount)) {
|
|
1169
|
+
modulesInfoPreset.list_payments = { discount_option: settingsDiscount };
|
|
1170
|
+
}
|
|
1171
|
+
const settingsInstallments = settingsPayments.installments_option;
|
|
1172
|
+
if (settingsInstallments?.max_number) {
|
|
1173
|
+
if (!modulesInfoPreset.list_payments)
|
|
1174
|
+
modulesInfoPreset.list_payments = {};
|
|
1175
|
+
modulesInfoPreset.list_payments.installments_option = settingsInstallments;
|
|
1176
|
+
}
|
|
1177
|
+
const settingsPointsPrograms = settingsPayments.loyalty_points_programs || {};
|
|
1178
|
+
if (!Object.keys(settingsPointsPrograms).length) {
|
|
1179
|
+
const pointsProgram = { ...settingsPayments.loyalty_points_program };
|
|
1180
|
+
if (pointsProgram?.id && pointsProgram.ratio) {
|
|
1181
|
+
const { id } = pointsProgram;
|
|
1182
|
+
delete pointsProgram.id;
|
|
1183
|
+
settingsPointsPrograms[id] = pointsProgram;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
if (Object.keys(settingsPointsPrograms).length) {
|
|
1187
|
+
if (!modulesInfoPreset.list_payments)
|
|
1188
|
+
modulesInfoPreset.list_payments = {};
|
|
1189
|
+
modulesInfoPreset.list_payments.loyalty_points_programs = settingsPointsPrograms;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
const settingsShipping = settingsModules.calculate_shipping;
|
|
1193
|
+
const freeShippingFromValue = settingsShipping?.free_shipping_from_value;
|
|
1194
|
+
if (typeof freeShippingFromValue === "number") {
|
|
1195
|
+
modulesInfoPreset.calculate_shipping = {
|
|
1196
|
+
free_shipping_from_value: freeShippingFromValue
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
return modulesInfoPreset;
|
|
1201
|
+
};
|
|
1202
|
+
const loadingGlobalInfoPreset = new Promise((resolve) => {
|
|
1203
|
+
{
|
|
1204
|
+
global.$storefront.onLoad(() => {
|
|
1205
|
+
resolve(getModulesInfoPreset());
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
|
|
1210
|
+
let userAgent;
|
|
1211
|
+
{
|
|
1212
|
+
userAgent = "";
|
|
1213
|
+
}
|
|
1214
|
+
userAgent.includes("Safari") && !userAgent.includes("Chrome");
|
|
1215
|
+
const isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream;
|
|
1216
|
+
const isMobile = isIOS || /Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
|
|
1217
|
+
|
|
1218
|
+
const networkNames = [
|
|
1219
|
+
"whatsapp",
|
|
1220
|
+
"instagram",
|
|
1221
|
+
"facebook",
|
|
1222
|
+
"twitter",
|
|
1223
|
+
"youtube",
|
|
1224
|
+
"tiktok",
|
|
1225
|
+
"pinterest",
|
|
1226
|
+
"threads"
|
|
1227
|
+
];
|
|
1228
|
+
const socialNetworks = {};
|
|
1229
|
+
const setSocialNetworks = () => {
|
|
1230
|
+
const { settings } = globalThis.$storefront;
|
|
1231
|
+
networkNames.forEach((network) => {
|
|
1232
|
+
if (settings[network]) {
|
|
1233
|
+
socialNetworks[network] = settings[network];
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
};
|
|
1237
|
+
{
|
|
1238
|
+
global.$storefront.onLoad(() => setSocialNetworks());
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
let id = -1;
|
|
1242
|
+
const useId = () => String(++id);
|
|
1243
|
+
|
|
1244
|
+
const emptyInfo = {
|
|
1245
|
+
list_payments: {},
|
|
1246
|
+
calculate_shipping: {},
|
|
1247
|
+
apply_discount: {}
|
|
1248
|
+
};
|
|
1249
|
+
const modulesInfo = reactive(emptyInfo);
|
|
1250
|
+
loadingGlobalInfoPreset.then((modulesInfoPreset) => {
|
|
1251
|
+
Object.assign(modulesInfo, modulesInfoPreset);
|
|
1252
|
+
});
|
|
1253
|
+
const freeShippingFromValue = computed(() => {
|
|
1254
|
+
return modulesInfo.calculate_shipping.free_shipping_from_value;
|
|
1255
|
+
});
|
|
1256
|
+
const installmentsOption = computed(() => {
|
|
1257
|
+
return modulesInfo.list_payments.installments_option;
|
|
1258
|
+
});
|
|
1259
|
+
const discountOption = computed(() => {
|
|
1260
|
+
return modulesInfo.list_payments.discount_option;
|
|
1261
|
+
});
|
|
1262
|
+
const loyaltyPointsPrograms = computed(() => {
|
|
1263
|
+
return modulesInfo.list_payments.loyalty_points_programs;
|
|
1264
|
+
});
|
|
1265
|
+
const availableExtraDiscount = computed(() => {
|
|
1266
|
+
return modulesInfo.apply_discount.available_extra_discount;
|
|
1267
|
+
});
|
|
1268
|
+
const parsePhrase = (phrase, modName, varName, formatValue = formatMoney) => {
|
|
1269
|
+
return computed(() => {
|
|
1270
|
+
const searchString = `{${varName}}`;
|
|
1271
|
+
const index = phrase.indexOf(searchString);
|
|
1272
|
+
if (index > -1) {
|
|
1273
|
+
const fieldValue = modulesInfo[modName][varName];
|
|
1274
|
+
if (fieldValue) {
|
|
1275
|
+
const replacement = formatValue(fieldValue);
|
|
1276
|
+
return phrase.substring(0, index) + replacement + phrase.substring(index + searchString.length);
|
|
1277
|
+
}
|
|
1278
|
+
return "";
|
|
1279
|
+
}
|
|
1280
|
+
return phrase;
|
|
1281
|
+
});
|
|
1282
|
+
};
|
|
1283
|
+
const parseShippingPhrase = (phrase) => {
|
|
1284
|
+
return parsePhrase(phrase, "calculate_shipping", "free_shipping_from_value");
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
const useCmsPreview = (filename) => {
|
|
1288
|
+
const liveContent = shallowRef(null);
|
|
1289
|
+
return { liveContent };
|
|
1290
|
+
};
|
|
1291
|
+
|
|
1292
|
+
const parseLayoutContent = (layoutContent) => {
|
|
1293
|
+
const pitchBar = { slides: [] };
|
|
1294
|
+
if (layoutContent.header?.pitch_bar) {
|
|
1295
|
+
pitchBar.slides = layoutContent.header.pitch_bar;
|
|
1296
|
+
}
|
|
1297
|
+
return pitchBar;
|
|
1298
|
+
};
|
|
1299
|
+
const usePitchBar = (props) => {
|
|
1300
|
+
const { liveContent } = useCmsPreview();
|
|
1301
|
+
const parsedContents = computed(() => {
|
|
1302
|
+
const slides = liveContent.value ? parseLayoutContent(liveContent.value).slides : props.slides;
|
|
1303
|
+
return slides.map(({ html }) => {
|
|
1304
|
+
return parseShippingPhrase(html).value.replace(/<\/?p>/g, "").replace(/<(\/?d-md)>/g, "<$1>");
|
|
1305
|
+
});
|
|
1306
|
+
});
|
|
1307
|
+
const countValidSlides = computed(() => {
|
|
1308
|
+
return parsedContents.value.filter((html) => html).length;
|
|
1309
|
+
});
|
|
1310
|
+
return {
|
|
1311
|
+
parsedContents,
|
|
1312
|
+
countValidSlides
|
|
1313
|
+
};
|
|
1314
|
+
};
|
|
1315
|
+
|
|
1316
|
+
const usePageHeader = async ({ routeContext, listedCategoryFields }) => {
|
|
1317
|
+
const { apiState, getContent } = routeContext;
|
|
1318
|
+
const layoutContent = await getContent("layout");
|
|
1319
|
+
const { header: headerContent } = layoutContent;
|
|
1320
|
+
const pitchBar = parseLayoutContent(layoutContent);
|
|
1321
|
+
let { categories } = apiState;
|
|
1322
|
+
if (!categories) {
|
|
1323
|
+
try {
|
|
1324
|
+
categories = (await api.get("categories", {
|
|
1325
|
+
fields: listedCategoryFields || [
|
|
1326
|
+
"name",
|
|
1327
|
+
"slug",
|
|
1328
|
+
"parent.slug",
|
|
1329
|
+
"icon.url",
|
|
1330
|
+
"icon.size",
|
|
1331
|
+
"pictures.0.url",
|
|
1332
|
+
"pictures.0.size"
|
|
1333
|
+
]
|
|
1334
|
+
})).data.result;
|
|
1335
|
+
} catch (err) {
|
|
1336
|
+
categories = [];
|
|
1337
|
+
console.error(err);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
const shopHeader = {
|
|
1341
|
+
categories,
|
|
1342
|
+
menuCategorySlugs: headerContent.inline_menu_categories?.featured,
|
|
1343
|
+
menuRandomCategories: headerContent.inline_menu_categories?.random,
|
|
1344
|
+
isAlphabeticalSortSubmenu: headerContent.alphabetical_sort_submenu
|
|
1345
|
+
};
|
|
1346
|
+
return {
|
|
1347
|
+
pitchBar,
|
|
1348
|
+
shopHeader
|
|
1349
|
+
};
|
|
1350
|
+
};
|
|
1351
|
+
|
|
1352
|
+
const emitter = new EventEmitter();
|
|
1353
|
+
const useSharedData = async ({ field, value }) => {
|
|
1354
|
+
const $data = global.$storefront.data;
|
|
1355
|
+
if (value) {
|
|
1356
|
+
$data[field] = value;
|
|
1357
|
+
emitter.emit(field, value);
|
|
1358
|
+
} else if ($data[field]) {
|
|
1359
|
+
value = $data[field];
|
|
1360
|
+
} else {
|
|
1361
|
+
value = await new Promise((resolve) => {
|
|
1362
|
+
emitter.once(field, resolve);
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
return {
|
|
1366
|
+
value,
|
|
1367
|
+
inlineClientJS: `
|
|
1368
|
+
window.$storefront.data['${field}'] = ${JSON.stringify(value)};`
|
|
1369
|
+
};
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
1373
|
+
__name: "CarouselControl",
|
|
1374
|
+
props: {
|
|
1375
|
+
isPrev: { type: Boolean, default: false }
|
|
1376
|
+
},
|
|
1377
|
+
setup(__props, { expose: __expose }) {
|
|
1378
|
+
__expose();
|
|
1379
|
+
const { changeSlide } = inject(carouselKey);
|
|
1380
|
+
const __returned__ = { changeSlide };
|
|
1381
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1382
|
+
return __returned__;
|
|
1383
|
+
}
|
|
1384
|
+
});
|
|
1385
|
+
function _sfc_ssrRender$c(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1386
|
+
_push(`<button${ssrRenderAttrs(mergeProps({
|
|
1387
|
+
type: "button",
|
|
1388
|
+
"aria-label": !$props.isPrev ? "Pr\xF3ximo" : "Anterior",
|
|
1389
|
+
class: ["group absolute top-0 z-1", !$props.isPrev ? "right-0" : "left-0"],
|
|
1390
|
+
"data-carousel-control": !$props.isPrev ? "next" : "previous"
|
|
1391
|
+
}, _attrs))}>`);
|
|
1392
|
+
ssrRenderSlot(_ctx.$slots, "default", {}, () => {
|
|
1393
|
+
_push(`<i class="${ssrRenderClass([!$props.isPrev ? "i-chevron-right group-active:translate-x-1" : "i-chevron-left group-active:-translate-x-1", "m-0"])}"></i>`);
|
|
1394
|
+
}, _push, _parent);
|
|
1395
|
+
_push(`</button>`);
|
|
1396
|
+
}
|
|
1397
|
+
const _sfc_setup$c = _sfc_main$c.setup;
|
|
1398
|
+
_sfc_main$c.setup = (props, ctx) => {
|
|
1399
|
+
const ssrContext = useSSRContext();
|
|
1400
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/CarouselControl.vue");
|
|
1401
|
+
return _sfc_setup$c ? _sfc_setup$c(props, ctx) : void 0;
|
|
1402
|
+
};
|
|
1403
|
+
const CarouselControl = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["ssrRender", _sfc_ssrRender$c]]);
|
|
1404
|
+
|
|
1405
|
+
const carouselKey = Symbol("carousel");
|
|
1406
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
1407
|
+
__name: "Carousel",
|
|
1408
|
+
props: {
|
|
1409
|
+
as: { default: "ul" },
|
|
1410
|
+
modelValue: { default: 1 },
|
|
1411
|
+
autoplay: {}
|
|
1412
|
+
},
|
|
1413
|
+
emits: [
|
|
1414
|
+
"update:modelValue"
|
|
1415
|
+
],
|
|
1416
|
+
setup(__props, { expose: __expose, emit }) {
|
|
1417
|
+
__expose();
|
|
1418
|
+
const props = __props;
|
|
1419
|
+
const currentIndex = ref(0);
|
|
1420
|
+
watch(toRef(props, "modelValue"), (modelValue) => {
|
|
1421
|
+
currentIndex.value = modelValue - 1;
|
|
1422
|
+
}, { immediate: true });
|
|
1423
|
+
watch(currentIndex, (current, previous) => {
|
|
1424
|
+
if (current !== previous) {
|
|
1425
|
+
emit("update:modelValue", current + 1);
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
const wrapper = ref(null);
|
|
1429
|
+
const { x: currentPos, isScrolling, arrivedState } = useScroll(wrapper);
|
|
1430
|
+
const isBoundLeft = computed(() => arrivedState.left);
|
|
1431
|
+
const isBoundRight = computed(() => arrivedState.right);
|
|
1432
|
+
const slidesWidth = ref([]);
|
|
1433
|
+
const wrapperScrollWidth = ref(0);
|
|
1434
|
+
const wrapperVisibleWidth = ref(0);
|
|
1435
|
+
const indexCount = ref(0);
|
|
1436
|
+
const calcWrapperWidth = () => {
|
|
1437
|
+
if (!wrapper.value)
|
|
1438
|
+
return;
|
|
1439
|
+
wrapperScrollWidth.value = wrapper.value.scrollWidth;
|
|
1440
|
+
wrapperVisibleWidth.value = wrapper.value.offsetWidth;
|
|
1441
|
+
};
|
|
1442
|
+
const calcSlidesWidth = () => {
|
|
1443
|
+
if (!wrapper.value)
|
|
1444
|
+
return;
|
|
1445
|
+
let childNodes = [...wrapper.value.children];
|
|
1446
|
+
if (childNodes.length === 1 && childNodes[0].tagName.endsWith("SLOT")) {
|
|
1447
|
+
childNodes = [...childNodes[0].children];
|
|
1448
|
+
}
|
|
1449
|
+
slidesWidth.value = childNodes.map((node) => ({
|
|
1450
|
+
offsetLeft: node.offsetLeft,
|
|
1451
|
+
width: node.offsetWidth
|
|
1452
|
+
}));
|
|
1453
|
+
};
|
|
1454
|
+
const calcNextOffsetLeft = (direction) => {
|
|
1455
|
+
let nextSlideIndex = currentIndex.value + direction;
|
|
1456
|
+
if (nextSlideIndex >= slidesWidth.value.length) {
|
|
1457
|
+
return 0;
|
|
1458
|
+
}
|
|
1459
|
+
if (nextSlideIndex < 0) {
|
|
1460
|
+
nextSlideIndex = slidesWidth.value.length + nextSlideIndex;
|
|
1461
|
+
}
|
|
1462
|
+
const { offsetLeft, width } = slidesWidth.value[nextSlideIndex] || {};
|
|
1463
|
+
if (!width) {
|
|
1464
|
+
return 0;
|
|
1465
|
+
}
|
|
1466
|
+
return offsetLeft;
|
|
1467
|
+
};
|
|
1468
|
+
const calcCurrentIndex = () => {
|
|
1469
|
+
const getCurrentIndex = slidesWidth.value.findIndex((slide) => {
|
|
1470
|
+
return Math.abs(slide.offsetLeft - currentPos.value) <= 5;
|
|
1471
|
+
});
|
|
1472
|
+
if (getCurrentIndex > -1) {
|
|
1473
|
+
currentIndex.value = getCurrentIndex || 0;
|
|
1474
|
+
}
|
|
1475
|
+
};
|
|
1476
|
+
const calcIndexCount = () => {
|
|
1477
|
+
const maxPos = wrapperScrollWidth.value - wrapperVisibleWidth.value;
|
|
1478
|
+
indexCount.value = slidesWidth.value.findIndex(({ offsetLeft }) => offsetLeft >= maxPos - 5);
|
|
1479
|
+
};
|
|
1480
|
+
let autoplayTimer;
|
|
1481
|
+
const restartAutoplay = () => {
|
|
1482
|
+
if (props.autoplay) {
|
|
1483
|
+
clearTimeout(autoplayTimer);
|
|
1484
|
+
autoplayTimer = setTimeout(() => {
|
|
1485
|
+
changeSlide(1);
|
|
1486
|
+
}, props.autoplay);
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
const changeSlide = (direction, isPageScroll = true) => {
|
|
1490
|
+
if (slidesWidth.value.length < 2) {
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1493
|
+
if (isPageScroll && (direction === 1 || direction === -1)) {
|
|
1494
|
+
let pageStep = 0;
|
|
1495
|
+
let pageStepWidth = 0;
|
|
1496
|
+
for (let i = currentIndex.value; i < slidesWidth.value.length; i++) {
|
|
1497
|
+
const { width } = slidesWidth.value[i] || {};
|
|
1498
|
+
if (width) {
|
|
1499
|
+
pageStep += 1;
|
|
1500
|
+
pageStepWidth += width;
|
|
1501
|
+
if (pageStepWidth >= wrapperVisibleWidth.value) {
|
|
1502
|
+
break;
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
if (pageStep) {
|
|
1507
|
+
direction = direction > 0 ? pageStep : -pageStep;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
const nextOffsetLeft = calcNextOffsetLeft(direction);
|
|
1511
|
+
wrapper.value?.scrollTo({ left: nextOffsetLeft, behavior: "smooth" });
|
|
1512
|
+
restartAutoplay();
|
|
1513
|
+
};
|
|
1514
|
+
watch(isScrolling, (_isScrolling) => {
|
|
1515
|
+
if (_isScrolling) {
|
|
1516
|
+
clearTimeout(autoplayTimer);
|
|
1517
|
+
} else {
|
|
1518
|
+
calcCurrentIndex();
|
|
1519
|
+
restartAutoplay();
|
|
1520
|
+
}
|
|
1521
|
+
});
|
|
1522
|
+
const carousel = ref(null);
|
|
1523
|
+
const isHovered = useElementHover(carousel);
|
|
1524
|
+
watch(isHovered, (_isHovered) => {
|
|
1525
|
+
if (_isHovered) {
|
|
1526
|
+
clearTimeout(autoplayTimer);
|
|
1527
|
+
} else {
|
|
1528
|
+
restartAutoplay();
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
const calcOnInit = () => {
|
|
1532
|
+
if (!wrapper.value) {
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
calcWrapperWidth();
|
|
1536
|
+
calcSlidesWidth();
|
|
1537
|
+
calcCurrentIndex();
|
|
1538
|
+
calcIndexCount();
|
|
1539
|
+
};
|
|
1540
|
+
const onResize = useDebounceFn(() => {
|
|
1541
|
+
if (!wrapper.value)
|
|
1542
|
+
return;
|
|
1543
|
+
wrapper.value.scrollLeft = 0;
|
|
1544
|
+
calcOnInit();
|
|
1545
|
+
}, 400);
|
|
1546
|
+
onMounted(() => {
|
|
1547
|
+
calcOnInit();
|
|
1548
|
+
});
|
|
1549
|
+
onBeforeUnmount(() => {
|
|
1550
|
+
clearTimeout(autoplayTimer);
|
|
1551
|
+
});
|
|
1552
|
+
provide(carouselKey, {
|
|
1553
|
+
autoplay: toRef(props, "autoplay"),
|
|
1554
|
+
changeSlide,
|
|
1555
|
+
isBoundLeft,
|
|
1556
|
+
isBoundRight
|
|
1557
|
+
});
|
|
1558
|
+
const __returned__ = { carouselKey, props, emit, currentIndex, wrapper, currentPos, isScrolling, arrivedState, isBoundLeft, isBoundRight, slidesWidth, wrapperScrollWidth, wrapperVisibleWidth, indexCount, calcWrapperWidth, calcSlidesWidth, calcNextOffsetLeft, calcCurrentIndex, calcIndexCount, get autoplayTimer() {
|
|
1559
|
+
return autoplayTimer;
|
|
1560
|
+
}, set autoplayTimer(v) {
|
|
1561
|
+
autoplayTimer = v;
|
|
1562
|
+
}, restartAutoplay, changeSlide, carousel, isHovered, calcOnInit, onResize, CarouselControl };
|
|
1563
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1564
|
+
return __returned__;
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
function _sfc_ssrRender$b(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1568
|
+
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
1569
|
+
ref: "carousel",
|
|
1570
|
+
class: "relative",
|
|
1571
|
+
"data-carousel": ""
|
|
1572
|
+
}, _attrs))}>`);
|
|
1573
|
+
ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), {
|
|
1574
|
+
ref: "wrapper",
|
|
1575
|
+
class: "flex overflow-x-scroll overflow-y-hidden list-none m-0 p-0 snap-x snap-mandatory scroll-smooth [&>*]:snap-start [&>*]:outline-none",
|
|
1576
|
+
style: { "scrollbar-width": "none", "-webkit-overflow-scrolling": "touch", "-ms-overflow-style": "none" },
|
|
1577
|
+
"data-carousel-wrapper": ""
|
|
1578
|
+
}, {
|
|
1579
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1580
|
+
if (_push2) {
|
|
1581
|
+
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
|
|
1582
|
+
} else {
|
|
1583
|
+
return [
|
|
1584
|
+
renderSlot$1(_ctx.$slots, "default")
|
|
1585
|
+
];
|
|
1586
|
+
}
|
|
1587
|
+
}),
|
|
1588
|
+
_: 3
|
|
1589
|
+
}), _parent);
|
|
1590
|
+
ssrRenderSlot(_ctx.$slots, "controls", {
|
|
1591
|
+
changeSlide: $setup.changeSlide,
|
|
1592
|
+
isBoundLeft: $setup.isBoundLeft,
|
|
1593
|
+
isBoundRight: $setup.isBoundRight,
|
|
1594
|
+
currentPage: $setup.currentIndex + 1,
|
|
1595
|
+
pageCount: $setup.indexCount + 1
|
|
1596
|
+
}, () => {
|
|
1597
|
+
_push(ssrRenderComponent($setup["CarouselControl"], { "is-prev": "" }, {
|
|
1598
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1599
|
+
if (_push2) {
|
|
1600
|
+
ssrRenderSlot(_ctx.$slots, "previous", {}, null, _push2, _parent2, _scopeId);
|
|
1601
|
+
} else {
|
|
1602
|
+
return [
|
|
1603
|
+
renderSlot$1(_ctx.$slots, "previous")
|
|
1604
|
+
];
|
|
1605
|
+
}
|
|
1606
|
+
}),
|
|
1607
|
+
_: 3
|
|
1608
|
+
}, _parent));
|
|
1609
|
+
_push(ssrRenderComponent($setup["CarouselControl"], null, {
|
|
1610
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1611
|
+
if (_push2) {
|
|
1612
|
+
ssrRenderSlot(_ctx.$slots, "next", {}, null, _push2, _parent2, _scopeId);
|
|
1613
|
+
} else {
|
|
1614
|
+
return [
|
|
1615
|
+
renderSlot$1(_ctx.$slots, "next")
|
|
1616
|
+
];
|
|
1617
|
+
}
|
|
1618
|
+
}),
|
|
1619
|
+
_: 3
|
|
1620
|
+
}, _parent));
|
|
1621
|
+
}, _push, _parent);
|
|
1622
|
+
_push(`</div>`);
|
|
1623
|
+
}
|
|
1624
|
+
const _sfc_setup$b = _sfc_main$b.setup;
|
|
1625
|
+
_sfc_main$b.setup = (props, ctx) => {
|
|
1626
|
+
const ssrContext = useSSRContext();
|
|
1627
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Carousel.vue");
|
|
1628
|
+
return _sfc_setup$b ? _sfc_setup$b(props, ctx) : void 0;
|
|
1629
|
+
};
|
|
1630
|
+
const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["ssrRender", _sfc_ssrRender$b]]);
|
|
1631
|
+
|
|
1632
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
1633
|
+
__name: "PitchBar",
|
|
1634
|
+
props: {
|
|
1635
|
+
slides: {}
|
|
1636
|
+
},
|
|
1637
|
+
setup(__props, { expose: __expose }) {
|
|
1638
|
+
__expose();
|
|
1639
|
+
const props = __props;
|
|
1640
|
+
const {
|
|
1641
|
+
parsedContents,
|
|
1642
|
+
countValidSlides
|
|
1643
|
+
} = usePitchBar(props);
|
|
1644
|
+
const __returned__ = { props, parsedContents, countValidSlides, Carousel, CarouselControl };
|
|
1645
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
1646
|
+
return __returned__;
|
|
1647
|
+
}
|
|
1648
|
+
});
|
|
1649
|
+
function _sfc_ssrRender$a(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
1650
|
+
const _component_ALink = resolveComponent("ALink");
|
|
1651
|
+
_push(`<div${ssrRenderAttrs(mergeProps({ class: "bg-base-100 relative z-20" }, _attrs))}><div class="container md:w-2/3 mx-auto px-3 py-1">`);
|
|
1652
|
+
_push(ssrRenderComponent($setup["Carousel"], {
|
|
1653
|
+
autoplay: $setup.countValidSlides > 1 ? 7e3 : void 0
|
|
1654
|
+
}, {
|
|
1655
|
+
controls: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1656
|
+
if (_push2) {
|
|
1657
|
+
_push2(`<div style="${ssrRenderStyle($setup.countValidSlides > 1 ? null : { display: "none" })}" class="text-xl leading-none text-base-400"${_scopeId}>`);
|
|
1658
|
+
_push2(ssrRenderComponent($setup["CarouselControl"], {
|
|
1659
|
+
class: "pr-2 bg-base-100 hover:text-base-700",
|
|
1660
|
+
"is-prev": ""
|
|
1661
|
+
}, null, _parent2, _scopeId));
|
|
1662
|
+
_push2(ssrRenderComponent($setup["CarouselControl"], { class: "pl-2 bg-base-100 hover:text-base-700" }, null, _parent2, _scopeId));
|
|
1663
|
+
_push2(`</div>`);
|
|
1664
|
+
} else {
|
|
1665
|
+
return [
|
|
1666
|
+
withDirectives(createVNode("div", { class: "text-xl leading-none text-base-400" }, [
|
|
1667
|
+
createVNode($setup["CarouselControl"], {
|
|
1668
|
+
class: "pr-2 bg-base-100 hover:text-base-700",
|
|
1669
|
+
"is-prev": ""
|
|
1670
|
+
}),
|
|
1671
|
+
createVNode($setup["CarouselControl"], { class: "pl-2 bg-base-100 hover:text-base-700" })
|
|
1672
|
+
], 512), [
|
|
1673
|
+
[vShow, $setup.countValidSlides > 1]
|
|
1674
|
+
])
|
|
1675
|
+
];
|
|
1676
|
+
}
|
|
1677
|
+
}),
|
|
1678
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1679
|
+
if (_push2) {
|
|
1680
|
+
_push2(`<!--[-->`);
|
|
1681
|
+
ssrRenderList($props.slides, (slide, i) => {
|
|
1682
|
+
_push2(`<li class="shrink-0 basis-full h-full text-center"${_scopeId}>`);
|
|
1683
|
+
_push2(ssrRenderComponent(_component_ALink, {
|
|
1684
|
+
href: slide.href,
|
|
1685
|
+
target: slide.target,
|
|
1686
|
+
class: ["inline-block px-8", slide.href ? "hover:underline" : null]
|
|
1687
|
+
}, {
|
|
1688
|
+
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
1689
|
+
if (_push3) {
|
|
1690
|
+
if ($setup.parsedContents[i]) {
|
|
1691
|
+
_push3(`<span class="prose text-sm text-base-800"${_scopeId2}>${$setup.parsedContents[i]}</span>`);
|
|
1692
|
+
} else {
|
|
1693
|
+
_push3(`<!---->`);
|
|
1694
|
+
}
|
|
1695
|
+
} else {
|
|
1696
|
+
return [
|
|
1697
|
+
$setup.parsedContents[i] ? (openBlock(), createBlock("span", {
|
|
1698
|
+
key: 0,
|
|
1699
|
+
innerHTML: $setup.parsedContents[i],
|
|
1700
|
+
class: "prose text-sm text-base-800"
|
|
1701
|
+
}, null, 8, ["innerHTML"])) : createCommentVNode("", true)
|
|
1702
|
+
];
|
|
1703
|
+
}
|
|
1704
|
+
}),
|
|
1705
|
+
_: 2
|
|
1706
|
+
}, _parent2, _scopeId));
|
|
1707
|
+
_push2(`</li>`);
|
|
1708
|
+
});
|
|
1709
|
+
_push2(`<!--]-->`);
|
|
1710
|
+
} else {
|
|
1711
|
+
return [
|
|
1712
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($props.slides, (slide, i) => {
|
|
1713
|
+
return openBlock(), createBlock("li", {
|
|
1714
|
+
key: i,
|
|
1715
|
+
class: "shrink-0 basis-full h-full text-center"
|
|
1716
|
+
}, [
|
|
1717
|
+
createVNode(_component_ALink, {
|
|
1718
|
+
href: slide.href,
|
|
1719
|
+
target: slide.target,
|
|
1720
|
+
class: ["inline-block px-8", slide.href ? "hover:underline" : null]
|
|
1721
|
+
}, {
|
|
1722
|
+
default: withCtx(() => [
|
|
1723
|
+
$setup.parsedContents[i] ? (openBlock(), createBlock("span", {
|
|
1724
|
+
key: 0,
|
|
1725
|
+
innerHTML: $setup.parsedContents[i],
|
|
1726
|
+
class: "prose text-sm text-base-800"
|
|
1727
|
+
}, null, 8, ["innerHTML"])) : createCommentVNode("", true)
|
|
1728
|
+
]),
|
|
1729
|
+
_: 2
|
|
1730
|
+
}, 1032, ["href", "target", "class"])
|
|
1731
|
+
]);
|
|
1732
|
+
}), 128))
|
|
1733
|
+
];
|
|
1734
|
+
}
|
|
1735
|
+
}),
|
|
1736
|
+
_: 1
|
|
1737
|
+
}, _parent));
|
|
1738
|
+
_push(`</div></div>`);
|
|
1739
|
+
}
|
|
1740
|
+
const _sfc_setup$a = _sfc_main$a.setup;
|
|
1741
|
+
_sfc_main$a.setup = (props, ctx) => {
|
|
1742
|
+
const ssrContext = useSSRContext();
|
|
1743
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/PitchBar.vue");
|
|
1744
|
+
return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
|
|
1745
|
+
};
|
|
1746
|
+
const PitchBar = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["ssrRender", _sfc_ssrRender$a]]);
|
|
1747
|
+
|
|
1748
|
+
const useStorage = (key, initialValue, storage = globalThis.localStorage) => {
|
|
1749
|
+
if (!storage) {
|
|
1750
|
+
return reactive(initialValue);
|
|
1751
|
+
}
|
|
1752
|
+
let persistedValue;
|
|
1753
|
+
const sessionJson = storage.getItem(key);
|
|
1754
|
+
if (sessionJson) {
|
|
1755
|
+
try {
|
|
1756
|
+
persistedValue = JSON.parse(sessionJson);
|
|
1757
|
+
} catch (e) {
|
|
1758
|
+
persistedValue = null;
|
|
1759
|
+
storage.removeItem(key);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
const state = reactive(persistedValue || initialValue);
|
|
1763
|
+
watch(state, () => {
|
|
1764
|
+
storage.setItem(key, JSON.stringify(state));
|
|
1765
|
+
});
|
|
1766
|
+
return state;
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
const matchItemsFlags = (item, { flags: newItemFlags }) => {
|
|
1770
|
+
if (!item.flags && !newItemFlags) {
|
|
1771
|
+
return true;
|
|
1772
|
+
}
|
|
1773
|
+
if (!item.flags || !newItemFlags || item.flags.length !== newItemFlags.length) {
|
|
1774
|
+
return false;
|
|
1775
|
+
}
|
|
1776
|
+
return item.flags.every((flag) => newItemFlags.includes(flag));
|
|
1777
|
+
};
|
|
1778
|
+
const addCartItem$1 = (cart, newItem) => {
|
|
1779
|
+
if (typeof newItem.product_id !== "string" || typeof newItem.quantity !== "number" || !(newItem.quantity >= 0) || typeof newItem.price !== "number" || !(newItem.price >= 0)) {
|
|
1780
|
+
return null;
|
|
1781
|
+
}
|
|
1782
|
+
const { items } = cart;
|
|
1783
|
+
if (!newItem.kit_product) {
|
|
1784
|
+
for (let i = 0; i < items.length; i++) {
|
|
1785
|
+
const item = items[i];
|
|
1786
|
+
if (!item.kit_product && item.product_id === newItem.product_id && item.variation_id === newItem.variation_id && (!item.customizations || !item.customizations.length) && matchItemsFlags(item, newItem)) {
|
|
1787
|
+
item.quantity += newItem.quantity;
|
|
1788
|
+
if (newItem.price) {
|
|
1789
|
+
item.price = newItem.price;
|
|
1790
|
+
}
|
|
1791
|
+
if (newItem.final_price) {
|
|
1792
|
+
item.final_price = newItem.final_price;
|
|
1793
|
+
}
|
|
1794
|
+
return item;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
const itemCopy = { ...newItem };
|
|
1799
|
+
if (!newItem._id || newItem._id === newItem.variation_id || items.find(({ _id }) => _id === newItem._id)) {
|
|
1800
|
+
itemCopy._id = randomObjectId();
|
|
1801
|
+
}
|
|
1802
|
+
if (newItem.customizations) {
|
|
1803
|
+
const customizationsCopy = [];
|
|
1804
|
+
newItem.customizations.forEach((customization, i) => {
|
|
1805
|
+
customizationsCopy[i] = { ...customization };
|
|
1806
|
+
});
|
|
1807
|
+
itemCopy.customizations = customizationsCopy;
|
|
1808
|
+
}
|
|
1809
|
+
items.push(itemCopy);
|
|
1810
|
+
return itemCopy;
|
|
1811
|
+
};
|
|
1812
|
+
|
|
1813
|
+
const parseProduct = (product, variationId, quantity) => {
|
|
1814
|
+
if (typeof quantity !== "number" || Number.isNaN(quantity)) {
|
|
1815
|
+
quantity = product.min_quantity || 1;
|
|
1816
|
+
}
|
|
1817
|
+
const minQuantity = product.min_quantity || 0;
|
|
1818
|
+
const variation = variationId && product.variations ? product.variations.find(({ _id }) => _id === variationId) : void 0;
|
|
1819
|
+
const item = {
|
|
1820
|
+
product_id: product._id,
|
|
1821
|
+
variation_id: variationId,
|
|
1822
|
+
sku: variation?.sku || product.sku,
|
|
1823
|
+
name: variation?.name || product.name,
|
|
1824
|
+
slug: product.slug,
|
|
1825
|
+
production_time: variation?.production_time || product.production_time,
|
|
1826
|
+
currency_id: product.currency_id,
|
|
1827
|
+
currency_symbol: product.currency_symbol,
|
|
1828
|
+
base_price: variation?.base_price || product.base_price,
|
|
1829
|
+
max_quantity: product.quantity,
|
|
1830
|
+
quantity: minQuantity > 0 ? Math.max(minQuantity, quantity) : quantity,
|
|
1831
|
+
price: price(product)
|
|
1832
|
+
};
|
|
1833
|
+
if (variation?.picture_id && product.pictures) {
|
|
1834
|
+
item.picture = product.pictures.find((_picture) => {
|
|
1835
|
+
return _picture._id === variation.picture_id;
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
if (!item.picture && product.pictures) {
|
|
1839
|
+
[item.picture] = product.pictures;
|
|
1840
|
+
}
|
|
1841
|
+
return item;
|
|
1842
|
+
};
|
|
1843
|
+
|
|
1844
|
+
const storageKey$1 = "ecomShoppingCart";
|
|
1845
|
+
const emptyCart = {
|
|
1846
|
+
items: []
|
|
1847
|
+
};
|
|
1848
|
+
const cart = useStorage(storageKey$1, emptyCart);
|
|
1849
|
+
const cartItems = computed(() => {
|
|
1850
|
+
return cart.items.map((item) => {
|
|
1851
|
+
let finalPrice = item.kit_product?.price && item.kit_product.pack_quantity ? item.kit_product.price / item.kit_product.pack_quantity : item.price;
|
|
1852
|
+
if (Array.isArray(item.customizations)) {
|
|
1853
|
+
item.customizations.forEach((customization) => {
|
|
1854
|
+
if (customization.add_to_price) {
|
|
1855
|
+
const { type, addition } = customization.add_to_price;
|
|
1856
|
+
finalPrice += type === "fixed" ? addition : item.price * (addition / 100);
|
|
1857
|
+
}
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
item.final_price = finalPrice;
|
|
1861
|
+
const min = item.min_quantity || 1;
|
|
1862
|
+
const max = item.max_quantity;
|
|
1863
|
+
if (typeof item.quantity !== "number" || Number.isNaN(item.quantity) || item.quantity < min) {
|
|
1864
|
+
item.quantity = min;
|
|
1865
|
+
} else if (max && item.quantity > max) {
|
|
1866
|
+
item.quantity = max;
|
|
1867
|
+
}
|
|
1868
|
+
return item;
|
|
1869
|
+
});
|
|
1870
|
+
});
|
|
1871
|
+
const subtotal = computed(() => {
|
|
1872
|
+
return cartItems.value.reduce((acc, item) => {
|
|
1873
|
+
return acc + item.quantity * (item.final_price || item.price);
|
|
1874
|
+
}, 0);
|
|
1875
|
+
});
|
|
1876
|
+
const totalItems = computed(() => {
|
|
1877
|
+
return cartItems.value.reduce((acc, item) => {
|
|
1878
|
+
return acc + item.quantity;
|
|
1879
|
+
}, 0);
|
|
1880
|
+
});
|
|
1881
|
+
const shoppingCart = computed({
|
|
1882
|
+
get() {
|
|
1883
|
+
return {
|
|
1884
|
+
...cart,
|
|
1885
|
+
subtotal: subtotal.value
|
|
1886
|
+
};
|
|
1887
|
+
},
|
|
1888
|
+
set(newCart) {
|
|
1889
|
+
Object.assign(cart, newCart, {
|
|
1890
|
+
subtotal: subtotal.value
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
});
|
|
1894
|
+
const addCartItem = (newItem) => {
|
|
1895
|
+
const cartObj = shoppingCart.value;
|
|
1896
|
+
const upsertedItem = addCartItem$1(cartObj, newItem);
|
|
1897
|
+
if (upsertedItem) {
|
|
1898
|
+
shoppingCart.value.items = cartObj.items;
|
|
1899
|
+
}
|
|
1900
|
+
};
|
|
1901
|
+
const removeCartItem = (itemId) => {
|
|
1902
|
+
for (let i = 0; i < shoppingCart.value.items.length; i++) {
|
|
1903
|
+
const item = shoppingCart.value.items[i];
|
|
1904
|
+
if (item._id === itemId) {
|
|
1905
|
+
shoppingCart.value.items.splice(i, 1);
|
|
1906
|
+
break;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
const addProductToCart = (product, variationId, quantity) => addCartItem(parseProduct(product, variationId, quantity));
|
|
1911
|
+
|
|
1912
|
+
const useStickyHeader = (props) => {
|
|
1913
|
+
const {
|
|
1914
|
+
header,
|
|
1915
|
+
canSetStyles,
|
|
1916
|
+
canCreateHeightDiv,
|
|
1917
|
+
isShownOnScrollDown,
|
|
1918
|
+
isShownOnMobile
|
|
1919
|
+
} = {
|
|
1920
|
+
canSetStyles: true,
|
|
1921
|
+
canCreateHeightDiv: true,
|
|
1922
|
+
...props
|
|
1923
|
+
};
|
|
1924
|
+
const { ready, start } = useTimeout(100, { controls: true, immediate: false });
|
|
1925
|
+
const staticHeight = ref(0);
|
|
1926
|
+
const staticY = ref(0);
|
|
1927
|
+
const { y: _y } = { y: ref(0) };
|
|
1928
|
+
const y = ref(0);
|
|
1929
|
+
watchDebounced(_y, (nextY) => {
|
|
1930
|
+
y.value = nextY;
|
|
1931
|
+
}, {
|
|
1932
|
+
debounce: isMobile ? 100 : 50,
|
|
1933
|
+
maxWait: isMobile ? 800 : 400
|
|
1934
|
+
});
|
|
1935
|
+
const isSticky = computed(() => ready.value && y.value > staticY.value * 1.2);
|
|
1936
|
+
const transition = ref("none");
|
|
1937
|
+
watch(isSticky, async (_isSticky) => {
|
|
1938
|
+
if (canSetStyles && header.value) {
|
|
1939
|
+
header.value.style.position = _isSticky ? "fixed" : "";
|
|
1940
|
+
header.value.style.width = _isSticky ? "100vw" : "";
|
|
1941
|
+
}
|
|
1942
|
+
if (!_isSticky) {
|
|
1943
|
+
start();
|
|
1944
|
+
transition.value = "none";
|
|
1945
|
+
} else {
|
|
1946
|
+
await promiseTimeout(300);
|
|
1947
|
+
transition.value = "opacity var(--transition-slow), transform var(--transition)";
|
|
1948
|
+
}
|
|
1949
|
+
});
|
|
1950
|
+
const isScrollUp = ref(false);
|
|
1951
|
+
watch(y, (newY, oldY) => {
|
|
1952
|
+
isScrollUp.value = newY > 0 && newY < oldY;
|
|
1953
|
+
});
|
|
1954
|
+
return {
|
|
1955
|
+
staticHeight,
|
|
1956
|
+
staticY,
|
|
1957
|
+
isSticky,
|
|
1958
|
+
isScrollUp,
|
|
1959
|
+
transition
|
|
1960
|
+
};
|
|
1961
|
+
};
|
|
1962
|
+
|
|
1963
|
+
const filterMainCategories = (categories, featuredSlugs) => {
|
|
1964
|
+
const mainCategories = categories.filter(({ name, slug, parent }) => {
|
|
1965
|
+
return name && slug && !parent;
|
|
1966
|
+
});
|
|
1967
|
+
if (featuredSlugs?.length) {
|
|
1968
|
+
mainCategories.sort((a, b) => {
|
|
1969
|
+
const indexA = featuredSlugs.indexOf(a.slug);
|
|
1970
|
+
const indexB = featuredSlugs.indexOf(b.slug);
|
|
1971
|
+
if (indexA > -1) {
|
|
1972
|
+
if (indexB === -1 || indexA < indexB)
|
|
1973
|
+
return -1;
|
|
1974
|
+
return 1;
|
|
1975
|
+
}
|
|
1976
|
+
if (indexB > -1)
|
|
1977
|
+
return 1;
|
|
1978
|
+
return 0;
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
return mainCategories;
|
|
1982
|
+
};
|
|
1983
|
+
const filterSubcategories = (categories, parentCategory, isAlphabeticalSort = false) => {
|
|
1984
|
+
const subcategories = categories.filter(({ name, slug, parent }) => {
|
|
1985
|
+
if (name && slug && parent) {
|
|
1986
|
+
return parent._id && parent._id === parentCategory._id || parent.slug && parent.slug === parentCategory.slug;
|
|
1987
|
+
}
|
|
1988
|
+
return false;
|
|
1989
|
+
});
|
|
1990
|
+
if (isAlphabeticalSort) {
|
|
1991
|
+
subcategories.sort((a, b) => {
|
|
1992
|
+
if (a.name < b.name)
|
|
1993
|
+
return -1;
|
|
1994
|
+
return 1;
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
return subcategories;
|
|
1998
|
+
};
|
|
1999
|
+
const useShopHeader = (props) => {
|
|
2000
|
+
const {
|
|
2001
|
+
header,
|
|
2002
|
+
categories = globalThis.$storefront.data.categories || [],
|
|
2003
|
+
menuCategorySlugs,
|
|
2004
|
+
menuRandomCategories = 7,
|
|
2005
|
+
isAlphabeticalSortSubmenu
|
|
2006
|
+
} = props;
|
|
2007
|
+
const {
|
|
2008
|
+
isSticky,
|
|
2009
|
+
staticHeight,
|
|
2010
|
+
staticY
|
|
2011
|
+
} = useStickyHeader({ header });
|
|
2012
|
+
const positionY = computed(() => {
|
|
2013
|
+
return isSticky.value ? header.value?.offsetHeight : staticY.value;
|
|
2014
|
+
});
|
|
2015
|
+
const mainCategories = filterMainCategories(categories, menuCategorySlugs);
|
|
2016
|
+
const getSubcategories = (parentCategory) => {
|
|
2017
|
+
return filterSubcategories(
|
|
2018
|
+
categories,
|
|
2019
|
+
parentCategory,
|
|
2020
|
+
!!isAlphabeticalSortSubmenu
|
|
2021
|
+
);
|
|
2022
|
+
};
|
|
2023
|
+
const getCategoryTree = (parentCategory) => {
|
|
2024
|
+
return {
|
|
2025
|
+
...parentCategory,
|
|
2026
|
+
subcategories: getSubcategories(parentCategory).map((subcategory) => {
|
|
2027
|
+
return getCategoryTree(subcategory);
|
|
2028
|
+
})
|
|
2029
|
+
};
|
|
2030
|
+
};
|
|
2031
|
+
const categoryTrees = mainCategories.map(getCategoryTree);
|
|
2032
|
+
let countRandom = 0;
|
|
2033
|
+
const inlineMenuTrees = categoryTrees.filter(({ slug }) => {
|
|
2034
|
+
if (menuCategorySlugs?.includes(slug)) {
|
|
2035
|
+
return true;
|
|
2036
|
+
}
|
|
2037
|
+
if (countRandom < menuRandomCategories) {
|
|
2038
|
+
countRandom += 1;
|
|
2039
|
+
return true;
|
|
2040
|
+
}
|
|
2041
|
+
return false;
|
|
2042
|
+
});
|
|
2043
|
+
return {
|
|
2044
|
+
isSticky,
|
|
2045
|
+
staticHeight,
|
|
2046
|
+
staticY,
|
|
2047
|
+
positionY,
|
|
2048
|
+
mainCategories,
|
|
2049
|
+
getSubcategories,
|
|
2050
|
+
getCategoryTree,
|
|
2051
|
+
categoryTrees,
|
|
2052
|
+
inlineMenuTrees
|
|
2053
|
+
};
|
|
2054
|
+
};
|
|
2055
|
+
|
|
2056
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
2057
|
+
__name: "Drawer",
|
|
2058
|
+
props: {
|
|
2059
|
+
modelValue: { type: Boolean, default: false },
|
|
2060
|
+
placement: { default: "start" },
|
|
2061
|
+
position: { default: "fixed" },
|
|
2062
|
+
hasCloseButton: { type: Boolean, default: true },
|
|
2063
|
+
backdropTarget: { default: "#teleported-top" }
|
|
2064
|
+
},
|
|
2065
|
+
emits: [
|
|
2066
|
+
"update:modelValue"
|
|
2067
|
+
],
|
|
2068
|
+
setup(__props, { expose: __expose, emit }) {
|
|
2069
|
+
__expose();
|
|
2070
|
+
const props = __props;
|
|
2071
|
+
const close = () => emit("update:modelValue", false);
|
|
2072
|
+
const drawer = ref(null);
|
|
2073
|
+
const outsideClickListener = (ev) => {
|
|
2074
|
+
if (!drawer.value?.contains(ev.target)) {
|
|
2075
|
+
close();
|
|
2076
|
+
}
|
|
2077
|
+
};
|
|
2078
|
+
const escClickListener = (ev) => {
|
|
2079
|
+
if (ev.key === "Escape") {
|
|
2080
|
+
close();
|
|
2081
|
+
}
|
|
2082
|
+
};
|
|
2083
|
+
const scrollbarWidth = ref(0);
|
|
2084
|
+
watch(toRef(props, "modelValue"), async (isOpen) => {
|
|
2085
|
+
if (isOpen) {
|
|
2086
|
+
scrollbarWidth.value = window.innerWidth - document.documentElement.clientWidth;
|
|
2087
|
+
document.body.style.overflow = "hidden";
|
|
2088
|
+
document.body.style.paddingRight = `${scrollbarWidth.value}px`;
|
|
2089
|
+
setTimeout(() => {
|
|
2090
|
+
document.addEventListener("click", outsideClickListener, { passive: true });
|
|
2091
|
+
document.addEventListener("keydown", escClickListener, { passive: true });
|
|
2092
|
+
}, 500);
|
|
2093
|
+
} else {
|
|
2094
|
+
document.body.style.overflow = "";
|
|
2095
|
+
document.body.style.paddingRight = "";
|
|
2096
|
+
document.removeEventListener("click", outsideClickListener);
|
|
2097
|
+
document.removeEventListener("keydown", escClickListener);
|
|
2098
|
+
}
|
|
2099
|
+
});
|
|
2100
|
+
const slideTo = computed(() => {
|
|
2101
|
+
switch (props.placement) {
|
|
2102
|
+
case "start":
|
|
2103
|
+
return "left";
|
|
2104
|
+
case "end":
|
|
2105
|
+
return "right";
|
|
2106
|
+
case "top":
|
|
2107
|
+
return "down";
|
|
2108
|
+
default:
|
|
2109
|
+
return "up";
|
|
2110
|
+
}
|
|
2111
|
+
});
|
|
2112
|
+
const isFixed = computed(() => {
|
|
2113
|
+
return props.position === "fixed";
|
|
2114
|
+
});
|
|
2115
|
+
const isPlacementX = computed(() => {
|
|
2116
|
+
return props.placement === "start" || props.placement === "end";
|
|
2117
|
+
});
|
|
2118
|
+
const __returned__ = { props, emit, close, drawer, outsideClickListener, escClickListener, scrollbarWidth, slideTo, isFixed, isPlacementX };
|
|
2119
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2120
|
+
return __returned__;
|
|
2121
|
+
}
|
|
2122
|
+
});
|
|
2123
|
+
function _sfc_ssrRender$9(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
2124
|
+
const _component_Fade = resolveComponent("Fade");
|
|
2125
|
+
_push(ssrRenderComponent(_component_Fade, mergeProps({
|
|
2126
|
+
slide: $setup.slideTo,
|
|
2127
|
+
speed: "slow",
|
|
2128
|
+
"is-floating": ""
|
|
2129
|
+
}, _attrs), {
|
|
2130
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
2131
|
+
if (_push2) {
|
|
2132
|
+
if ($props.modelValue) {
|
|
2133
|
+
_push2(`<dialog class="${ssrRenderClass([[
|
|
2134
|
+
$props.position,
|
|
2135
|
+
$setup.isFixed ? `top-0 ${$setup.isPlacementX ? "h-screen" : ""}` : null,
|
|
2136
|
+
$setup.isFixed && $props.placement !== "end" ? "left-0" : null,
|
|
2137
|
+
$setup.isFixed && $props.placement === "end" ? "left-auto right-0" : null,
|
|
2138
|
+
$setup.isPlacementX ? "max-w-sm" : null
|
|
2139
|
+
], "w-screen shadow p-0 m-0 z-50"])}" style="${ssrRenderStyle({
|
|
2140
|
+
maxWidth: !$setup.isPlacementX ? `calc(100vw - ${$setup.scrollbarWidth}px)` : void 0
|
|
2141
|
+
})}"${ssrIncludeBooleanAttr($props.modelValue) ? " open" : ""}${ssrRenderAttr("data-drawer", $props.placement)}${_scopeId}><div class="relative h-full"${_scopeId}>`);
|
|
2142
|
+
if ($props.hasCloseButton) {
|
|
2143
|
+
_push2(`<button type="button"${ssrRenderAttr("aria-label", "Fechar")} class="${ssrRenderClass([$props.placement === "end" ? "left-2" : "right-2", "absolute top-2 z-30"])}" data-drawer-close${_scopeId}>`);
|
|
2144
|
+
ssrRenderSlot(_ctx.$slots, "close", {}, () => {
|
|
2145
|
+
_push2(`<i class="i-close text-base-400 hover:text-base-600 text-3xl"${_scopeId}></i>`);
|
|
2146
|
+
}, _push2, _parent2, _scopeId);
|
|
2147
|
+
_push2(`</button>`);
|
|
2148
|
+
} else {
|
|
2149
|
+
_push2(`<!---->`);
|
|
2150
|
+
}
|
|
2151
|
+
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
|
|
2152
|
+
_push2(`</div>`);
|
|
2153
|
+
ssrRenderTeleport(_push2, (_push3) => {
|
|
2154
|
+
_push3(ssrRenderComponent(_component_Fade, null, {
|
|
2155
|
+
default: withCtx((_2, _push4, _parent3, _scopeId2) => {
|
|
2156
|
+
if (_push4) {
|
|
2157
|
+
if ($props.modelValue) {
|
|
2158
|
+
_push4(`<div class="fixed top-0 left-0 w-screen h-screen bg-black/50 z-40" data-drawer-backdrop${_scopeId2}></div>`);
|
|
2159
|
+
} else {
|
|
2160
|
+
_push4(`<!---->`);
|
|
2161
|
+
}
|
|
2162
|
+
} else {
|
|
2163
|
+
return [
|
|
2164
|
+
$props.modelValue ? (openBlock(), createBlock("div", {
|
|
2165
|
+
key: 0,
|
|
2166
|
+
class: "fixed top-0 left-0 w-screen h-screen bg-black/50 z-40",
|
|
2167
|
+
"data-drawer-backdrop": ""
|
|
2168
|
+
})) : createCommentVNode("", true)
|
|
2169
|
+
];
|
|
2170
|
+
}
|
|
2171
|
+
}),
|
|
2172
|
+
_: 1
|
|
2173
|
+
}, _parent2, _scopeId));
|
|
2174
|
+
}, $props.backdropTarget, false, _parent2);
|
|
2175
|
+
_push2(`</dialog>`);
|
|
2176
|
+
} else {
|
|
2177
|
+
_push2(`<!---->`);
|
|
2178
|
+
}
|
|
2179
|
+
} else {
|
|
2180
|
+
return [
|
|
2181
|
+
$props.modelValue ? (openBlock(), createBlock("dialog", {
|
|
2182
|
+
key: 0,
|
|
2183
|
+
ref: "drawer",
|
|
2184
|
+
class: ["w-screen shadow p-0 m-0 z-50", [
|
|
2185
|
+
$props.position,
|
|
2186
|
+
$setup.isFixed ? `top-0 ${$setup.isPlacementX ? "h-screen" : ""}` : null,
|
|
2187
|
+
$setup.isFixed && $props.placement !== "end" ? "left-0" : null,
|
|
2188
|
+
$setup.isFixed && $props.placement === "end" ? "left-auto right-0" : null,
|
|
2189
|
+
$setup.isPlacementX ? "max-w-sm" : null
|
|
2190
|
+
]],
|
|
2191
|
+
style: {
|
|
2192
|
+
maxWidth: !$setup.isPlacementX ? `calc(100vw - ${$setup.scrollbarWidth}px)` : void 0
|
|
2193
|
+
},
|
|
2194
|
+
open: $props.modelValue,
|
|
2195
|
+
"data-drawer": $props.placement
|
|
2196
|
+
}, [
|
|
2197
|
+
createVNode("div", { class: "relative h-full" }, [
|
|
2198
|
+
$props.hasCloseButton ? (openBlock(), createBlock("button", {
|
|
2199
|
+
key: 0,
|
|
2200
|
+
type: "button",
|
|
2201
|
+
"aria-label": "Fechar",
|
|
2202
|
+
onClick: withModifiers($setup.close, ["prevent"]),
|
|
2203
|
+
class: ["absolute top-2 z-30", $props.placement === "end" ? "left-2" : "right-2"],
|
|
2204
|
+
"data-drawer-close": ""
|
|
2205
|
+
}, [
|
|
2206
|
+
renderSlot$1(_ctx.$slots, "close", {}, () => [
|
|
2207
|
+
createVNode("i", { class: "i-close text-base-400 hover:text-base-600 text-3xl" })
|
|
2208
|
+
])
|
|
2209
|
+
], 10, ["onClick"])) : createCommentVNode("", true),
|
|
2210
|
+
renderSlot$1(_ctx.$slots, "default")
|
|
2211
|
+
]),
|
|
2212
|
+
(openBlock(), createBlock(Teleport, { to: $props.backdropTarget }, [
|
|
2213
|
+
createVNode(_component_Fade, null, {
|
|
2214
|
+
default: withCtx(() => [
|
|
2215
|
+
$props.modelValue ? (openBlock(), createBlock("div", {
|
|
2216
|
+
key: 0,
|
|
2217
|
+
class: "fixed top-0 left-0 w-screen h-screen bg-black/50 z-40",
|
|
2218
|
+
"data-drawer-backdrop": ""
|
|
2219
|
+
})) : createCommentVNode("", true)
|
|
2220
|
+
]),
|
|
2221
|
+
_: 1
|
|
2222
|
+
})
|
|
2223
|
+
], 8, ["to"]))
|
|
2224
|
+
], 14, ["open", "data-drawer"])) : createCommentVNode("", true)
|
|
2225
|
+
];
|
|
2226
|
+
}
|
|
2227
|
+
}),
|
|
2228
|
+
_: 3
|
|
2229
|
+
}, _parent));
|
|
2230
|
+
}
|
|
2231
|
+
const _sfc_setup$9 = _sfc_main$9.setup;
|
|
2232
|
+
_sfc_main$9.setup = (props, ctx) => {
|
|
2233
|
+
const ssrContext = useSSRContext();
|
|
2234
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Drawer.vue");
|
|
2235
|
+
return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
|
|
2236
|
+
};
|
|
2237
|
+
const Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["ssrRender", _sfc_ssrRender$9]]);
|
|
2238
|
+
|
|
2239
|
+
const storageKey = "ecomSession";
|
|
2240
|
+
const emptySession = {
|
|
2241
|
+
customer: {
|
|
2242
|
+
display_name: "",
|
|
2243
|
+
main_email: ""
|
|
2244
|
+
},
|
|
2245
|
+
auth: null
|
|
2246
|
+
};
|
|
2247
|
+
const session = useStorage(storageKey, emptySession);
|
|
2248
|
+
const isAuthenticated = computed(() => {
|
|
2249
|
+
const { auth } = session;
|
|
2250
|
+
return auth && new Date(auth.expires).getTime() - Date.now() > 1e3 * 10;
|
|
2251
|
+
});
|
|
2252
|
+
const customer = computed(() => session.customer);
|
|
2253
|
+
const customerName = computed(() => nickname(customer.value));
|
|
2254
|
+
computed({
|
|
2255
|
+
get() {
|
|
2256
|
+
return customer.value.main_email;
|
|
2257
|
+
},
|
|
2258
|
+
set(email) {
|
|
2259
|
+
session.customer.main_email = email;
|
|
2260
|
+
}
|
|
2261
|
+
});
|
|
2262
|
+
let firebaseAuth;
|
|
2263
|
+
const isLogged = computed(() => {
|
|
2264
|
+
return isAuthenticated.value || !!firebaseAuth?.currentUser?.emailVerified;
|
|
2265
|
+
});
|
|
2266
|
+
const logout = () => {
|
|
2267
|
+
session.auth = emptySession.auth;
|
|
2268
|
+
session.customer = emptySession.customer;
|
|
2269
|
+
localStorage.removeItem(storageKey);
|
|
2270
|
+
firebaseAuth.signOut();
|
|
2271
|
+
};
|
|
2272
|
+
const initializeFirebaseAuth = (canWaitIdle = !window.location.pathname.startsWith("/app/")) => {
|
|
2273
|
+
return;
|
|
2274
|
+
};
|
|
2275
|
+
|
|
2276
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
2277
|
+
__name: "AccountLink",
|
|
2278
|
+
props: {
|
|
2279
|
+
to: {},
|
|
2280
|
+
accountUrl: { default: globalThis.$storefront.settings.account_url || "/app/account" },
|
|
2281
|
+
returnUrl: { default: globalThis.location?.href },
|
|
2282
|
+
isSignUp: { type: Boolean }
|
|
2283
|
+
},
|
|
2284
|
+
setup(__props, { expose: __expose }) {
|
|
2285
|
+
__expose();
|
|
2286
|
+
const props = __props;
|
|
2287
|
+
const href = computed(() => {
|
|
2288
|
+
let url = props.accountUrl;
|
|
2289
|
+
if (!props.to) {
|
|
2290
|
+
if (props.isSignUp) {
|
|
2291
|
+
url += "?sign_up&";
|
|
2292
|
+
} else {
|
|
2293
|
+
url += "?";
|
|
2294
|
+
}
|
|
2295
|
+
return `${url}return_url=${props.returnUrl}`;
|
|
2296
|
+
}
|
|
2297
|
+
const { settings } = globalThis.$storefront;
|
|
2298
|
+
if (props.to === "orders" && settings.orders_url) {
|
|
2299
|
+
return settings.orders_url;
|
|
2300
|
+
}
|
|
2301
|
+
if (props.to === "favorites" && settings.favorites_url) {
|
|
2302
|
+
return settings.favorites_url;
|
|
2303
|
+
}
|
|
2304
|
+
return `${url}/${props.to}`;
|
|
2305
|
+
});
|
|
2306
|
+
const __returned__ = { props, href };
|
|
2307
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2308
|
+
return __returned__;
|
|
2309
|
+
}
|
|
2310
|
+
});
|
|
2311
|
+
function _sfc_ssrRender$8(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
2312
|
+
_push(`<a${ssrRenderAttrs(mergeProps({ href: $setup.href }, _attrs))}>`);
|
|
2313
|
+
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
|
|
2314
|
+
_push(`</a>`);
|
|
2315
|
+
}
|
|
2316
|
+
const _sfc_setup$8 = _sfc_main$8.setup;
|
|
2317
|
+
_sfc_main$8.setup = (props, ctx) => {
|
|
2318
|
+
const ssrContext = useSSRContext();
|
|
2319
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/AccountLink.vue");
|
|
2320
|
+
return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
|
|
2321
|
+
};
|
|
2322
|
+
const AccountLink = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["ssrRender", _sfc_ssrRender$8]]);
|
|
2323
|
+
|
|
2324
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
2325
|
+
__name: "SocialNetworkIcon",
|
|
2326
|
+
props: {
|
|
2327
|
+
as: { default: "i" },
|
|
2328
|
+
network: {}
|
|
2329
|
+
},
|
|
2330
|
+
setup(__props, { expose: __expose }) {
|
|
2331
|
+
__expose();
|
|
2332
|
+
const props = __props;
|
|
2333
|
+
const iconClassName = computed(() => {
|
|
2334
|
+
switch (props.network) {
|
|
2335
|
+
case "facebook":
|
|
2336
|
+
return "i-facebook";
|
|
2337
|
+
case "instagram":
|
|
2338
|
+
return "i-instagram";
|
|
2339
|
+
case "whatsapp":
|
|
2340
|
+
return "i-whatsapp";
|
|
2341
|
+
case "youtube":
|
|
2342
|
+
return "i-youtube";
|
|
2343
|
+
case "pinterest":
|
|
2344
|
+
return "i-pinterest";
|
|
2345
|
+
case "tiktok":
|
|
2346
|
+
return "i-tiktok";
|
|
2347
|
+
case "twitter":
|
|
2348
|
+
return "i-twitter";
|
|
2349
|
+
case "threads":
|
|
2350
|
+
return "i-threads";
|
|
2351
|
+
default:
|
|
2352
|
+
return "";
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
const __returned__ = { props, iconClassName };
|
|
2356
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2357
|
+
return __returned__;
|
|
2358
|
+
}
|
|
2359
|
+
});
|
|
2360
|
+
function _sfc_ssrRender$7(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
2361
|
+
ssrRenderVNode(_push, createVNode(resolveDynamicComponent($props.as), mergeProps({ class: $setup.iconClassName }, _attrs), null), _parent);
|
|
2362
|
+
}
|
|
2363
|
+
const _sfc_setup$7 = _sfc_main$7.setup;
|
|
2364
|
+
_sfc_main$7.setup = (props, ctx) => {
|
|
2365
|
+
const ssrContext = useSSRContext();
|
|
2366
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkIcon.vue");
|
|
2367
|
+
return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
|
|
2368
|
+
};
|
|
2369
|
+
const SocialNetworkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["ssrRender", _sfc_ssrRender$7]]);
|
|
2370
|
+
|
|
2371
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
2372
|
+
__name: "SocialNetworkLink",
|
|
2373
|
+
props: {
|
|
2374
|
+
network: {},
|
|
2375
|
+
href: {},
|
|
2376
|
+
message: {}
|
|
2377
|
+
},
|
|
2378
|
+
setup(__props, { expose: __expose }) {
|
|
2379
|
+
__expose();
|
|
2380
|
+
const props = __props;
|
|
2381
|
+
const fixedHref = computed(() => {
|
|
2382
|
+
let href = props.href || socialNetworks[props.network] || "";
|
|
2383
|
+
if (props.network === "whatsapp") {
|
|
2384
|
+
const tel = href.replace(/[^+\d]/g, "");
|
|
2385
|
+
href = `https://${isMobile ? "api" : "web"}.whatsapp.com/send?phone=` + encodeURIComponent(tel.charAt(0) === "+" ? tel : `+55${tel}`);
|
|
2386
|
+
if (props.message) {
|
|
2387
|
+
href += `&text=${encodeURIComponent(props.message)}`;
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
return href;
|
|
2391
|
+
});
|
|
2392
|
+
const __returned__ = { props, fixedHref, SocialNetworkIcon };
|
|
2393
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2394
|
+
return __returned__;
|
|
2395
|
+
}
|
|
2396
|
+
});
|
|
2397
|
+
function _sfc_ssrRender$6(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
2398
|
+
const _component_ALink = resolveComponent("ALink");
|
|
2399
|
+
_push(ssrRenderComponent(_component_ALink, mergeProps({ href: $setup.fixedHref }, _attrs), {
|
|
2400
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
2401
|
+
if (_push2) {
|
|
2402
|
+
ssrRenderSlot(_ctx.$slots, "default", {}, () => {
|
|
2403
|
+
_push2(ssrRenderComponent($setup["SocialNetworkIcon"], { network: $props.network }, null, _parent2, _scopeId));
|
|
2404
|
+
ssrRenderSlot(_ctx.$slots, "append", {}, null, _push2, _parent2, _scopeId);
|
|
2405
|
+
}, _push2, _parent2, _scopeId);
|
|
2406
|
+
} else {
|
|
2407
|
+
return [
|
|
2408
|
+
renderSlot$1(_ctx.$slots, "default", {}, () => [
|
|
2409
|
+
createVNode($setup["SocialNetworkIcon"], { network: $props.network }, null, 8, ["network"]),
|
|
2410
|
+
renderSlot$1(_ctx.$slots, "append")
|
|
2411
|
+
])
|
|
2412
|
+
];
|
|
2413
|
+
}
|
|
2414
|
+
}),
|
|
2415
|
+
_: 3
|
|
2416
|
+
}, _parent));
|
|
2417
|
+
}
|
|
2418
|
+
const _sfc_setup$6 = _sfc_main$6.setup;
|
|
2419
|
+
_sfc_main$6.setup = (props, ctx) => {
|
|
2420
|
+
const ssrContext = useSSRContext();
|
|
2421
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/SocialNetworkLink.vue");
|
|
2422
|
+
return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
|
|
2423
|
+
};
|
|
2424
|
+
const SocialNetworkLink = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["ssrRender", _sfc_ssrRender$6]]);
|
|
2425
|
+
|
|
2426
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
2427
|
+
__name: "ShopSidenavCategory",
|
|
2428
|
+
props: {
|
|
2429
|
+
categoryTree: {}
|
|
2430
|
+
},
|
|
2431
|
+
setup(__props, { expose: __expose }) {
|
|
2432
|
+
__expose();
|
|
2433
|
+
const isOpen = ref(false);
|
|
2434
|
+
const isFaded = ref(true);
|
|
2435
|
+
watch(isOpen, (_isOpen) => {
|
|
2436
|
+
if (_isOpen) {
|
|
2437
|
+
setTimeout(() => {
|
|
2438
|
+
isFaded.value = false;
|
|
2439
|
+
}, 25);
|
|
2440
|
+
} else {
|
|
2441
|
+
isFaded.value = true;
|
|
2442
|
+
}
|
|
2443
|
+
});
|
|
2444
|
+
const __returned__ = { isOpen, isFaded };
|
|
2445
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2446
|
+
return __returned__;
|
|
2447
|
+
}
|
|
2448
|
+
});
|
|
2449
|
+
function _sfc_ssrRender$5(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
2450
|
+
const _component_AImg = resolveComponent("AImg");
|
|
2451
|
+
const _component_ShopSidenavCategory = resolveComponent("ShopSidenavCategory", true);
|
|
2452
|
+
_push(`<li${ssrRenderAttrs(mergeProps({ class: "text-lg text-base-800" }, _attrs))}>`);
|
|
2453
|
+
if ($props.categoryTree.subcategories.length) {
|
|
2454
|
+
_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>`);
|
|
2455
|
+
if (!$setup.isOpen && $props.categoryTree.icon) {
|
|
2456
|
+
_push(ssrRenderComponent(_component_AImg, {
|
|
2457
|
+
picture: $props.categoryTree.icon,
|
|
2458
|
+
alt: $props.categoryTree.name,
|
|
2459
|
+
class: "w-auto h-5 inline mr-3"
|
|
2460
|
+
}, null, _parent));
|
|
2461
|
+
} else {
|
|
2462
|
+
_push(`<!---->`);
|
|
2463
|
+
}
|
|
2464
|
+
_push(`<h3 class="${ssrRenderClass([$setup.isOpen ? "ml-4 text-base" : null, "inline"])}">${ssrInterpolate($props.categoryTree.name)}</h3></summary><ul class="${ssrRenderClass([$setup.isFaded ? "opacity-20" : "opacity-100", "mt-2 transition-opacity"])}" tabindex="-1"><!--[-->`);
|
|
2465
|
+
ssrRenderList($props.categoryTree.subcategories, (subcategoryTree, i) => {
|
|
2466
|
+
_push(ssrRenderComponent(_component_ShopSidenavCategory, {
|
|
2467
|
+
key: i,
|
|
2468
|
+
"category-tree": subcategoryTree
|
|
2469
|
+
}, null, _parent));
|
|
2470
|
+
});
|
|
2471
|
+
_push(`<!--]--><li><a${ssrRenderAttr("href", `/${$props.categoryTree.slug}`)} class="block px-6 py-3 text-base underline active:bg-base-200">${ssrInterpolate("Ver toda a categoria $1".replace("$1", $props.categoryTree.name))}</a></li></ul></details>`);
|
|
2472
|
+
} else {
|
|
2473
|
+
_push(`<a${ssrRenderAttr("href", `/${$props.categoryTree.slug}`)} class="block px-6 py-3 active:bg-base-200">`);
|
|
2474
|
+
if (!$setup.isOpen && $props.categoryTree.icon) {
|
|
2475
|
+
_push(ssrRenderComponent(_component_AImg, {
|
|
2476
|
+
picture: $props.categoryTree.icon,
|
|
2477
|
+
alt: $props.categoryTree.name,
|
|
2478
|
+
class: "w-auto h-5 inline mr-3"
|
|
2479
|
+
}, null, _parent));
|
|
2480
|
+
} else {
|
|
2481
|
+
_push(`<!---->`);
|
|
2482
|
+
}
|
|
2483
|
+
_push(`<h3 class="inline">${ssrInterpolate($props.categoryTree.name)}</h3></a>`);
|
|
2484
|
+
}
|
|
2485
|
+
_push(`</li>`);
|
|
2486
|
+
}
|
|
2487
|
+
const _sfc_setup$5 = _sfc_main$5.setup;
|
|
2488
|
+
_sfc_main$5.setup = (props, ctx) => {
|
|
2489
|
+
const ssrContext = useSSRContext();
|
|
2490
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenavCategory.vue");
|
|
2491
|
+
return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
|
|
2492
|
+
};
|
|
2493
|
+
const ShopSidenavCategory = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["ssrRender", _sfc_ssrRender$5]]);
|
|
2494
|
+
|
|
2495
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2496
|
+
__name: "ShopSidenav",
|
|
2497
|
+
props: {
|
|
2498
|
+
categoryTrees: {}
|
|
2499
|
+
},
|
|
2500
|
+
setup(__props, { expose: __expose }) {
|
|
2501
|
+
__expose();
|
|
2502
|
+
onMounted(() => initializeFirebaseAuth());
|
|
2503
|
+
const __returned__ = { get customerName() {
|
|
2504
|
+
return customerName;
|
|
2505
|
+
}, get isLogged() {
|
|
2506
|
+
return isLogged;
|
|
2507
|
+
}, get logout() {
|
|
2508
|
+
return logout;
|
|
2509
|
+
}, get socialNetworks() {
|
|
2510
|
+
return socialNetworks;
|
|
2511
|
+
}, AccountLink, SocialNetworkLink, ShopSidenavCategory };
|
|
2512
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2513
|
+
return __returned__;
|
|
2514
|
+
}
|
|
2515
|
+
});
|
|
2516
|
+
function _sfc_ssrRender$4(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
2517
|
+
_push(`<aside${ssrRenderAttrs(mergeProps({ class: "flex flex-col h-full" }, _attrs))}><nav class="py-4 grow"><ul class="relative h-full"><!--[-->`);
|
|
2518
|
+
ssrRenderList($props.categoryTrees, (categoryTree, i) => {
|
|
2519
|
+
_push(ssrRenderComponent($setup["ShopSidenavCategory"], {
|
|
2520
|
+
key: i,
|
|
2521
|
+
"category-tree": categoryTree
|
|
2522
|
+
}, null, _parent));
|
|
2523
|
+
});
|
|
2524
|
+
_push(`<!--]--></ul></nav><footer class="text-base"><div class="flex items-center px-2 py-4 bg-base-100">`);
|
|
2525
|
+
_push(ssrRenderComponent($setup["AccountLink"], { class: "p-2 grow flex items-center gap-3" }, {
|
|
2526
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
2527
|
+
if (_push2) {
|
|
2528
|
+
_push2(`<i class="i-user-circle text-4xl text-base-500 m-0"${_scopeId}></i><span class="leading-tight"${_scopeId}>${ssrInterpolate(`${"Ol\xE1"} ${$setup.customerName || "Visitante"}`)} <small class="block lowercase font-semibold text-primary"${_scopeId}>${ssrInterpolate("Meus pedidos")}, ${ssrInterpolate("Minha conta")}</small></span>`);
|
|
2529
|
+
} else {
|
|
2530
|
+
return [
|
|
2531
|
+
createVNode("i", { class: "i-user-circle text-4xl text-base-500 m-0" }),
|
|
2532
|
+
createVNode("span", { class: "leading-tight" }, [
|
|
2533
|
+
createTextVNode(toDisplayString(`${"Ol\xE1"} ${$setup.customerName || "Visitante"}`) + " ", 1),
|
|
2534
|
+
createVNode("small", { class: "block lowercase font-semibold text-primary" }, toDisplayString("Meus pedidos") + ", " + toDisplayString("Minha conta"))
|
|
2535
|
+
])
|
|
2536
|
+
];
|
|
2537
|
+
}
|
|
2538
|
+
}),
|
|
2539
|
+
_: 1
|
|
2540
|
+
}, _parent));
|
|
2541
|
+
if ($setup.isLogged) {
|
|
2542
|
+
_push(`<button class="p-2 text-right text-base-800"><span class="text-base-600">${ssrInterpolate("Sair")}</span><i class="i-arrow-right-on-rectangle text-lg ml-1"></i></button>`);
|
|
2543
|
+
} else {
|
|
2544
|
+
_push(`<!---->`);
|
|
2545
|
+
}
|
|
2546
|
+
_push(`</div><ul class="flex gap-3 p-4 bg-base-200 text-xl text-base-700"><!--[-->`);
|
|
2547
|
+
ssrRenderList($setup.socialNetworks, (href, network) => {
|
|
2548
|
+
_push(`<li>`);
|
|
2549
|
+
_push(ssrRenderComponent($setup["SocialNetworkLink"], {
|
|
2550
|
+
network,
|
|
2551
|
+
class: "p-1 active:text-primary"
|
|
2552
|
+
}, null, _parent));
|
|
2553
|
+
_push(`</li>`);
|
|
2554
|
+
});
|
|
2555
|
+
_push(`<!--]--></ul></footer></aside>`);
|
|
2556
|
+
}
|
|
2557
|
+
const _sfc_setup$4 = _sfc_main$4.setup;
|
|
2558
|
+
_sfc_main$4.setup = (props, ctx) => {
|
|
2559
|
+
const ssrContext = useSSRContext();
|
|
2560
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopSidenav.vue");
|
|
2561
|
+
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
|
|
2562
|
+
};
|
|
2563
|
+
const ShopSidenav = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["ssrRender", _sfc_ssrRender$4]]);
|
|
2564
|
+
|
|
2565
|
+
const useShopHeaderSubmenu = (props) => {
|
|
2566
|
+
const categoryPicture = computed(() => {
|
|
2567
|
+
const picture = props.categoryTree.pictures?.[0];
|
|
2568
|
+
if (picture && !picture.alt) {
|
|
2569
|
+
return {
|
|
2570
|
+
alt: props.categoryTree.name,
|
|
2571
|
+
...picture
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2574
|
+
return void 0;
|
|
2575
|
+
});
|
|
2576
|
+
const subcategoriesWithChild = computed(() => {
|
|
2577
|
+
return props.categoryTree.subcategories.filter(({ subcategories }) => subcategories.length);
|
|
2578
|
+
});
|
|
2579
|
+
const maxMenuCols = computed(() => {
|
|
2580
|
+
let _maxMenuCols = subcategoriesWithChild.value.length;
|
|
2581
|
+
if (categoryPicture.value) {
|
|
2582
|
+
_maxMenuCols += 1;
|
|
2583
|
+
}
|
|
2584
|
+
if (subcategoriesWithChild.value.length < props.categoryTree.subcategories.length) {
|
|
2585
|
+
_maxMenuCols += 1;
|
|
2586
|
+
}
|
|
2587
|
+
return _maxMenuCols;
|
|
2588
|
+
});
|
|
2589
|
+
const isMegaMenu = computed(() => {
|
|
2590
|
+
return (props.megaMenuMaxCols || 7) >= maxMenuCols.value;
|
|
2591
|
+
});
|
|
2592
|
+
const subcategoryLinks = computed(() => {
|
|
2593
|
+
return isMegaMenu.value ? props.categoryTree.subcategories.filter(({ subcategories }) => !subcategories.length) : props.categoryTree.subcategories;
|
|
2594
|
+
});
|
|
2595
|
+
const subcategoryCols = computed(() => {
|
|
2596
|
+
return isMegaMenu.value ? props.categoryTree.subcategories.filter(({ subcategories }) => subcategories.length) : props.categoryTree.subcategories;
|
|
2597
|
+
});
|
|
2598
|
+
const countMenuCols = computed(() => {
|
|
2599
|
+
if (isMegaMenu.value)
|
|
2600
|
+
return maxMenuCols.value;
|
|
2601
|
+
return categoryPicture.value ? 2 : 1;
|
|
2602
|
+
});
|
|
2603
|
+
return {
|
|
2604
|
+
categoryPicture,
|
|
2605
|
+
isMegaMenu,
|
|
2606
|
+
subcategoryLinks,
|
|
2607
|
+
subcategoryCols,
|
|
2608
|
+
countMenuCols
|
|
2609
|
+
};
|
|
2610
|
+
};
|
|
2611
|
+
|
|
2612
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
2613
|
+
__name: "ShopHeaderSubmenu",
|
|
2614
|
+
props: {
|
|
2615
|
+
categoryTree: {},
|
|
2616
|
+
megaMenuMaxCols: {}
|
|
2617
|
+
},
|
|
2618
|
+
setup(__props, { expose: __expose }) {
|
|
2619
|
+
__expose();
|
|
2620
|
+
const props = __props;
|
|
2621
|
+
const {
|
|
2622
|
+
categoryPicture,
|
|
2623
|
+
subcategoryLinks,
|
|
2624
|
+
subcategoryCols,
|
|
2625
|
+
countMenuCols
|
|
2626
|
+
} = useShopHeaderSubmenu(props);
|
|
2627
|
+
const __returned__ = { props, categoryPicture, subcategoryLinks, subcategoryCols, countMenuCols, get Popover() {
|
|
2628
|
+
return Popover;
|
|
2629
|
+
}, get PopoverButton() {
|
|
2630
|
+
return PopoverButton;
|
|
2631
|
+
}, get PopoverPanel() {
|
|
2632
|
+
return PopoverPanel;
|
|
2633
|
+
} };
|
|
2634
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2635
|
+
return __returned__;
|
|
2636
|
+
}
|
|
2637
|
+
});
|
|
2638
|
+
function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
2639
|
+
const _component_Fade = resolveComponent("Fade");
|
|
2640
|
+
const _component_AImg = resolveComponent("AImg");
|
|
2641
|
+
_push(ssrRenderComponent($setup["Popover"], _attrs, {
|
|
2642
|
+
default: withCtx(({ open }, _push2, _parent2, _scopeId) => {
|
|
2643
|
+
if (_push2) {
|
|
2644
|
+
_push2(ssrRenderComponent($setup["PopoverButton"], { class: "outline-none" }, {
|
|
2645
|
+
default: withCtx((_, _push3, _parent3, _scopeId2) => {
|
|
2646
|
+
if (_push3) {
|
|
2647
|
+
ssrRenderSlot(_ctx.$slots, "button", { open }, null, _push3, _parent3, _scopeId2);
|
|
2648
|
+
} else {
|
|
2649
|
+
return [
|
|
2650
|
+
renderSlot$1(_ctx.$slots, "button", { open })
|
|
2651
|
+
];
|
|
2652
|
+
}
|
|
2653
|
+
}),
|
|
2654
|
+
_: 2
|
|
2655
|
+
}, _parent2, _scopeId));
|
|
2656
|
+
_push2(`<div class="relative"${_scopeId}>`);
|
|
2657
|
+
_push2(ssrRenderComponent(_component_Fade, null, {
|
|
2658
|
+
default: withCtx((_, _push3, _parent3, _scopeId2) => {
|
|
2659
|
+
if (_push3) {
|
|
2660
|
+
_push3(ssrRenderComponent($setup["PopoverPanel"], {
|
|
2661
|
+
class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded backdrop-blur-md shadow bg-white/80 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"]
|
|
2662
|
+
}, {
|
|
2663
|
+
default: withCtx((_2, _push4, _parent4, _scopeId3) => {
|
|
2664
|
+
if (_push4) {
|
|
2665
|
+
_push4(`<div class="flex gap-6 w-full"${_scopeId3}>`);
|
|
2666
|
+
if ($setup.subcategoryLinks.length) {
|
|
2667
|
+
_push4(`<ul class="flex-1"${_scopeId3}><!--[-->`);
|
|
2668
|
+
ssrRenderList($setup.subcategoryLinks, (subcategory, i) => {
|
|
2669
|
+
_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>`);
|
|
2670
|
+
});
|
|
2671
|
+
_push4(`<!--]--></ul>`);
|
|
2672
|
+
} else {
|
|
2673
|
+
_push4(`<!---->`);
|
|
2674
|
+
}
|
|
2675
|
+
_push4(`<!--[-->`);
|
|
2676
|
+
ssrRenderList($setup.subcategoryCols, (subcategory, i) => {
|
|
2677
|
+
_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}><!--[-->`);
|
|
2678
|
+
ssrRenderList(subcategory.subcategories, (nestedSubcategory, ii) => {
|
|
2679
|
+
_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>`);
|
|
2680
|
+
});
|
|
2681
|
+
_push4(`<!--]--></ul></div>`);
|
|
2682
|
+
});
|
|
2683
|
+
_push4(`<!--]-->`);
|
|
2684
|
+
if ($setup.categoryPicture) {
|
|
2685
|
+
_push4(`<div class="${ssrRenderClass($setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3")}"${_scopeId3}>`);
|
|
2686
|
+
_push4(ssrRenderComponent(_component_AImg, {
|
|
2687
|
+
picture: $setup.categoryPicture,
|
|
2688
|
+
class: "ml-auto rounded"
|
|
2689
|
+
}, null, _parent4, _scopeId3));
|
|
2690
|
+
_push4(`</div>`);
|
|
2691
|
+
} else {
|
|
2692
|
+
_push4(`<!---->`);
|
|
2693
|
+
}
|
|
2694
|
+
_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>`);
|
|
2695
|
+
} else {
|
|
2696
|
+
return [
|
|
2697
|
+
createVNode("div", { class: "flex gap-6 w-full" }, [
|
|
2698
|
+
$setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
|
|
2699
|
+
key: 0,
|
|
2700
|
+
class: "flex-1"
|
|
2701
|
+
}, [
|
|
2702
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryLinks, (subcategory, i) => {
|
|
2703
|
+
return openBlock(), createBlock("li", {
|
|
2704
|
+
key: `link-${i}`,
|
|
2705
|
+
class: $setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2"
|
|
2706
|
+
}, [
|
|
2707
|
+
createVNode("a", {
|
|
2708
|
+
href: `/${subcategory.slug}`,
|
|
2709
|
+
class: "hover:text-primary"
|
|
2710
|
+
}, [
|
|
2711
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2712
|
+
], 8, ["href"])
|
|
2713
|
+
], 2);
|
|
2714
|
+
}), 128))
|
|
2715
|
+
])) : createCommentVNode("", true),
|
|
2716
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryCols, (subcategory, i) => {
|
|
2717
|
+
return openBlock(), createBlock("div", {
|
|
2718
|
+
key: i,
|
|
2719
|
+
class: "flex-1"
|
|
2720
|
+
}, [
|
|
2721
|
+
createVNode("a", {
|
|
2722
|
+
href: `/${subcategory.slug}`,
|
|
2723
|
+
class: "hover:text-primary"
|
|
2724
|
+
}, [
|
|
2725
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2726
|
+
], 8, ["href"]),
|
|
2727
|
+
createVNode("ul", { class: "text-sm text-base-600 mt-1 mb-1.5" }, [
|
|
2728
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(subcategory.subcategories, (nestedSubcategory, ii) => {
|
|
2729
|
+
return openBlock(), createBlock("li", {
|
|
2730
|
+
key: `${i}-${ii}`,
|
|
2731
|
+
class: "mb-0.5"
|
|
2732
|
+
}, [
|
|
2733
|
+
createVNode("a", {
|
|
2734
|
+
href: `/${nestedSubcategory.slug}`,
|
|
2735
|
+
class: "hover:text-primary hover:underline"
|
|
2736
|
+
}, [
|
|
2737
|
+
createVNode("h3", null, toDisplayString(nestedSubcategory.name), 1)
|
|
2738
|
+
], 8, ["href"])
|
|
2739
|
+
]);
|
|
2740
|
+
}), 128))
|
|
2741
|
+
])
|
|
2742
|
+
]);
|
|
2743
|
+
}), 128)),
|
|
2744
|
+
$setup.categoryPicture ? (openBlock(), createBlock("div", {
|
|
2745
|
+
key: 1,
|
|
2746
|
+
class: $setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3"
|
|
2747
|
+
}, [
|
|
2748
|
+
createVNode(_component_AImg, {
|
|
2749
|
+
picture: $setup.categoryPicture,
|
|
2750
|
+
class: "ml-auto rounded"
|
|
2751
|
+
}, null, 8, ["picture"])
|
|
2752
|
+
], 2)) : createCommentVNode("", true)
|
|
2753
|
+
]),
|
|
2754
|
+
createVNode("a", {
|
|
2755
|
+
href: `/${$props.categoryTree.slug}`,
|
|
2756
|
+
class: "block mt-1 text-xs text-base-600 leading-snug underline"
|
|
2757
|
+
}, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
|
|
2758
|
+
];
|
|
2759
|
+
}
|
|
2760
|
+
}),
|
|
2761
|
+
_: 2
|
|
2762
|
+
}, _parent3, _scopeId2));
|
|
2763
|
+
} else {
|
|
2764
|
+
return [
|
|
2765
|
+
createVNode($setup["PopoverPanel"], {
|
|
2766
|
+
class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded backdrop-blur-md shadow bg-white/80 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"]
|
|
2767
|
+
}, {
|
|
2768
|
+
default: withCtx(() => [
|
|
2769
|
+
createVNode("div", { class: "flex gap-6 w-full" }, [
|
|
2770
|
+
$setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
|
|
2771
|
+
key: 0,
|
|
2772
|
+
class: "flex-1"
|
|
2773
|
+
}, [
|
|
2774
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryLinks, (subcategory, i) => {
|
|
2775
|
+
return openBlock(), createBlock("li", {
|
|
2776
|
+
key: `link-${i}`,
|
|
2777
|
+
class: $setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2"
|
|
2778
|
+
}, [
|
|
2779
|
+
createVNode("a", {
|
|
2780
|
+
href: `/${subcategory.slug}`,
|
|
2781
|
+
class: "hover:text-primary"
|
|
2782
|
+
}, [
|
|
2783
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2784
|
+
], 8, ["href"])
|
|
2785
|
+
], 2);
|
|
2786
|
+
}), 128))
|
|
2787
|
+
])) : createCommentVNode("", true),
|
|
2788
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryCols, (subcategory, i) => {
|
|
2789
|
+
return openBlock(), createBlock("div", {
|
|
2790
|
+
key: i,
|
|
2791
|
+
class: "flex-1"
|
|
2792
|
+
}, [
|
|
2793
|
+
createVNode("a", {
|
|
2794
|
+
href: `/${subcategory.slug}`,
|
|
2795
|
+
class: "hover:text-primary"
|
|
2796
|
+
}, [
|
|
2797
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2798
|
+
], 8, ["href"]),
|
|
2799
|
+
createVNode("ul", { class: "text-sm text-base-600 mt-1 mb-1.5" }, [
|
|
2800
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(subcategory.subcategories, (nestedSubcategory, ii) => {
|
|
2801
|
+
return openBlock(), createBlock("li", {
|
|
2802
|
+
key: `${i}-${ii}`,
|
|
2803
|
+
class: "mb-0.5"
|
|
2804
|
+
}, [
|
|
2805
|
+
createVNode("a", {
|
|
2806
|
+
href: `/${nestedSubcategory.slug}`,
|
|
2807
|
+
class: "hover:text-primary hover:underline"
|
|
2808
|
+
}, [
|
|
2809
|
+
createVNode("h3", null, toDisplayString(nestedSubcategory.name), 1)
|
|
2810
|
+
], 8, ["href"])
|
|
2811
|
+
]);
|
|
2812
|
+
}), 128))
|
|
2813
|
+
])
|
|
2814
|
+
]);
|
|
2815
|
+
}), 128)),
|
|
2816
|
+
$setup.categoryPicture ? (openBlock(), createBlock("div", {
|
|
2817
|
+
key: 1,
|
|
2818
|
+
class: $setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3"
|
|
2819
|
+
}, [
|
|
2820
|
+
createVNode(_component_AImg, {
|
|
2821
|
+
picture: $setup.categoryPicture,
|
|
2822
|
+
class: "ml-auto rounded"
|
|
2823
|
+
}, null, 8, ["picture"])
|
|
2824
|
+
], 2)) : createCommentVNode("", true)
|
|
2825
|
+
]),
|
|
2826
|
+
createVNode("a", {
|
|
2827
|
+
href: `/${$props.categoryTree.slug}`,
|
|
2828
|
+
class: "block mt-1 text-xs text-base-600 leading-snug underline"
|
|
2829
|
+
}, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
|
|
2830
|
+
]),
|
|
2831
|
+
_: 1
|
|
2832
|
+
}, 8, ["class"])
|
|
2833
|
+
];
|
|
2834
|
+
}
|
|
2835
|
+
}),
|
|
2836
|
+
_: 2
|
|
2837
|
+
}, _parent2, _scopeId));
|
|
2838
|
+
_push2(`</div>`);
|
|
2839
|
+
} else {
|
|
2840
|
+
return [
|
|
2841
|
+
createVNode($setup["PopoverButton"], { class: "outline-none" }, {
|
|
2842
|
+
default: withCtx(() => [
|
|
2843
|
+
renderSlot$1(_ctx.$slots, "button", { open })
|
|
2844
|
+
]),
|
|
2845
|
+
_: 2
|
|
2846
|
+
}, 1024),
|
|
2847
|
+
createVNode("div", { class: "relative" }, [
|
|
2848
|
+
createVNode(_component_Fade, null, {
|
|
2849
|
+
default: withCtx(() => [
|
|
2850
|
+
createVNode($setup["PopoverPanel"], {
|
|
2851
|
+
class: ["absolute z-20 top-3 left-1/2 -translate-x-1/2 !transform px-6 py-4 rounded backdrop-blur-md shadow bg-white/80 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"]
|
|
2852
|
+
}, {
|
|
2853
|
+
default: withCtx(() => [
|
|
2854
|
+
createVNode("div", { class: "flex gap-6 w-full" }, [
|
|
2855
|
+
$setup.subcategoryLinks.length ? (openBlock(), createBlock("ul", {
|
|
2856
|
+
key: 0,
|
|
2857
|
+
class: "flex-1"
|
|
2858
|
+
}, [
|
|
2859
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryLinks, (subcategory, i) => {
|
|
2860
|
+
return openBlock(), createBlock("li", {
|
|
2861
|
+
key: `link-${i}`,
|
|
2862
|
+
class: $setup.subcategoryLinks.length > 10 ? "text-sm mb-1" : "mb-2"
|
|
2863
|
+
}, [
|
|
2864
|
+
createVNode("a", {
|
|
2865
|
+
href: `/${subcategory.slug}`,
|
|
2866
|
+
class: "hover:text-primary"
|
|
2867
|
+
}, [
|
|
2868
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2869
|
+
], 8, ["href"])
|
|
2870
|
+
], 2);
|
|
2871
|
+
}), 128))
|
|
2872
|
+
])) : createCommentVNode("", true),
|
|
2873
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.subcategoryCols, (subcategory, i) => {
|
|
2874
|
+
return openBlock(), createBlock("div", {
|
|
2875
|
+
key: i,
|
|
2876
|
+
class: "flex-1"
|
|
2877
|
+
}, [
|
|
2878
|
+
createVNode("a", {
|
|
2879
|
+
href: `/${subcategory.slug}`,
|
|
2880
|
+
class: "hover:text-primary"
|
|
2881
|
+
}, [
|
|
2882
|
+
createVNode("h3", null, toDisplayString(subcategory.name), 1)
|
|
2883
|
+
], 8, ["href"]),
|
|
2884
|
+
createVNode("ul", { class: "text-sm text-base-600 mt-1 mb-1.5" }, [
|
|
2885
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(subcategory.subcategories, (nestedSubcategory, ii) => {
|
|
2886
|
+
return openBlock(), createBlock("li", {
|
|
2887
|
+
key: `${i}-${ii}`,
|
|
2888
|
+
class: "mb-0.5"
|
|
2889
|
+
}, [
|
|
2890
|
+
createVNode("a", {
|
|
2891
|
+
href: `/${nestedSubcategory.slug}`,
|
|
2892
|
+
class: "hover:text-primary hover:underline"
|
|
2893
|
+
}, [
|
|
2894
|
+
createVNode("h3", null, toDisplayString(nestedSubcategory.name), 1)
|
|
2895
|
+
], 8, ["href"])
|
|
2896
|
+
]);
|
|
2897
|
+
}), 128))
|
|
2898
|
+
])
|
|
2899
|
+
]);
|
|
2900
|
+
}), 128)),
|
|
2901
|
+
$setup.categoryPicture ? (openBlock(), createBlock("div", {
|
|
2902
|
+
key: 1,
|
|
2903
|
+
class: $setup.countMenuCols === 2 ? "basis-1/2" : $setup.countMenuCols < 5 ? "basis-2/5" : "basis-1/3"
|
|
2904
|
+
}, [
|
|
2905
|
+
createVNode(_component_AImg, {
|
|
2906
|
+
picture: $setup.categoryPicture,
|
|
2907
|
+
class: "ml-auto rounded"
|
|
2908
|
+
}, null, 8, ["picture"])
|
|
2909
|
+
], 2)) : createCommentVNode("", true)
|
|
2910
|
+
]),
|
|
2911
|
+
createVNode("a", {
|
|
2912
|
+
href: `/${$props.categoryTree.slug}`,
|
|
2913
|
+
class: "block mt-1 text-xs text-base-600 leading-snug underline"
|
|
2914
|
+
}, toDisplayString("Ver toda a categoria $1".replace("$1", $props.categoryTree.name)), 9, ["href"])
|
|
2915
|
+
]),
|
|
2916
|
+
_: 1
|
|
2917
|
+
}, 8, ["class"])
|
|
2918
|
+
]),
|
|
2919
|
+
_: 1
|
|
2920
|
+
})
|
|
2921
|
+
])
|
|
2922
|
+
];
|
|
2923
|
+
}
|
|
2924
|
+
}),
|
|
2925
|
+
_: 3
|
|
2926
|
+
}, _parent));
|
|
2927
|
+
}
|
|
2928
|
+
const _sfc_setup$3 = _sfc_main$3.setup;
|
|
2929
|
+
_sfc_main$3.setup = (props, ctx) => {
|
|
2930
|
+
const ssrContext = useSSRContext();
|
|
2931
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderSubmenu.vue");
|
|
2932
|
+
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
|
|
2933
|
+
};
|
|
2934
|
+
const ShopHeaderSubmenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["ssrRender", _sfc_ssrRender$3]]);
|
|
2935
|
+
|
|
2936
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2937
|
+
__name: "ShopHeaderMenu",
|
|
2938
|
+
props: {
|
|
2939
|
+
inlineMenuTrees: {}
|
|
2940
|
+
},
|
|
2941
|
+
setup(__props, { expose: __expose }) {
|
|
2942
|
+
__expose();
|
|
2943
|
+
const props = __props;
|
|
2944
|
+
const hasOneLevelSubcategories = computed(() => {
|
|
2945
|
+
return !!props.inlineMenuTrees.find(({ subcategories }) => !subcategories.length);
|
|
2946
|
+
});
|
|
2947
|
+
const __returned__ = { props, hasOneLevelSubcategories, ShopHeaderSubmenu };
|
|
2948
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
2949
|
+
return __returned__;
|
|
2950
|
+
}
|
|
2951
|
+
});
|
|
2952
|
+
function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
2953
|
+
_push(`<nav${ssrRenderAttrs(_attrs)}><ul class="${ssrRenderClass([$props.inlineMenuTrees.length < 7 ? "text-base" : "text-sm", "flex gap-4 xl:gap-5 text-base-700"])}"><!--[-->`);
|
|
2954
|
+
ssrRenderList($props.inlineMenuTrees, (categoryTree, i) => {
|
|
2955
|
+
_push(`<li>`);
|
|
2956
|
+
if (categoryTree.subcategories.length) {
|
|
2957
|
+
_push(ssrRenderComponent($setup["ShopHeaderSubmenu"], { "category-tree": categoryTree }, {
|
|
2958
|
+
button: withCtx(({ open }, _push2, _parent2, _scopeId) => {
|
|
2959
|
+
if (_push2) {
|
|
2960
|
+
_push2(`<span class="hover:text-primary group"${_scopeId}><h3 class="${ssrRenderClass([[
|
|
2961
|
+
$props.inlineMenuTrees.length < 7 ? "decoration-2" : null,
|
|
2962
|
+
open ? "underline" : null
|
|
2963
|
+
], "group-hover:underline inline"])}"${_scopeId}>${ssrInterpolate(categoryTree.name)}</h3>`);
|
|
2964
|
+
if ($setup.hasOneLevelSubcategories) {
|
|
2965
|
+
_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>`);
|
|
2966
|
+
} else {
|
|
2967
|
+
_push2(`<!---->`);
|
|
2968
|
+
}
|
|
2969
|
+
_push2(`</span>`);
|
|
2970
|
+
} else {
|
|
2971
|
+
return [
|
|
2972
|
+
createVNode("span", { class: "hover:text-primary group" }, [
|
|
2973
|
+
createVNode("h3", {
|
|
2974
|
+
class: ["group-hover:underline inline", [
|
|
2975
|
+
$props.inlineMenuTrees.length < 7 ? "decoration-2" : null,
|
|
2976
|
+
open ? "underline" : null
|
|
2977
|
+
]]
|
|
2978
|
+
}, toDisplayString(categoryTree.name), 3),
|
|
2979
|
+
$setup.hasOneLevelSubcategories ? (openBlock(), createBlock("i", {
|
|
2980
|
+
key: 0,
|
|
2981
|
+
class: ["i-chevron-down ml-1 transition-transform text-base-400 group-hover:text-primary-subtle", open ? "rotate-180" : null]
|
|
2982
|
+
}, null, 2)) : createCommentVNode("", true)
|
|
2983
|
+
])
|
|
2984
|
+
];
|
|
2985
|
+
}
|
|
2986
|
+
}),
|
|
2987
|
+
_: 2
|
|
2988
|
+
}, _parent));
|
|
2989
|
+
} else {
|
|
2990
|
+
_push(`<a${ssrRenderAttr("href", `/${categoryTree.slug}`)} class="${ssrRenderClass([$props.inlineMenuTrees.length < 7 ? "decoration-2" : null, "hover:text-primary hover:underline"])}"><h3 class="inline">${ssrInterpolate(categoryTree.name)}</h3></a>`);
|
|
2991
|
+
}
|
|
2992
|
+
_push(`</li>`);
|
|
2993
|
+
});
|
|
2994
|
+
_push(`<!--]--></ul></nav>`);
|
|
2995
|
+
}
|
|
2996
|
+
const _sfc_setup$2 = _sfc_main$2.setup;
|
|
2997
|
+
_sfc_main$2.setup = (props, ctx) => {
|
|
2998
|
+
const ssrContext = useSSRContext();
|
|
2999
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeaderMenu.vue");
|
|
3000
|
+
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
|
|
3001
|
+
};
|
|
3002
|
+
const ShopHeaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
|
|
3003
|
+
|
|
3004
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3005
|
+
__name: "AccountMenu",
|
|
3006
|
+
setup(__props, { expose: __expose }) {
|
|
3007
|
+
__expose();
|
|
3008
|
+
const __returned__ = { get Menu() {
|
|
3009
|
+
return Menu;
|
|
3010
|
+
}, get MenuButton() {
|
|
3011
|
+
return MenuButton;
|
|
3012
|
+
}, get MenuItems() {
|
|
3013
|
+
return MenuItems;
|
|
3014
|
+
}, get MenuItem() {
|
|
3015
|
+
return MenuItem;
|
|
3016
|
+
}, get socialNetworks() {
|
|
3017
|
+
return socialNetworks;
|
|
3018
|
+
}, get customerName() {
|
|
3019
|
+
return customerName;
|
|
3020
|
+
}, get initializeFirebaseAuth() {
|
|
3021
|
+
return initializeFirebaseAuth;
|
|
3022
|
+
}, get isLogged() {
|
|
3023
|
+
return isLogged;
|
|
3024
|
+
}, get logout() {
|
|
3025
|
+
return logout;
|
|
3026
|
+
}, AccountLink, SocialNetworkLink };
|
|
3027
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
3028
|
+
return __returned__;
|
|
3029
|
+
}
|
|
3030
|
+
});
|
|
3031
|
+
function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
3032
|
+
const _component_Fade = resolveComponent("Fade");
|
|
3033
|
+
const _component_ALink = resolveComponent("ALink");
|
|
3034
|
+
_push(ssrRenderComponent($setup["Menu"], mergeProps({
|
|
3035
|
+
as: "div",
|
|
3036
|
+
class: "relative text-center text-sm text-base-800"
|
|
3037
|
+
}, _attrs), {
|
|
3038
|
+
default: withCtx(({ open }, _push2, _parent2, _scopeId) => {
|
|
3039
|
+
if (_push2) {
|
|
3040
|
+
if (open) {
|
|
3041
|
+
_push2(`<div${_scopeId}><span${_scopeId}>${ssrInterpolate($setup.initializeFirebaseAuth())}</span></div>`);
|
|
3042
|
+
} else {
|
|
3043
|
+
_push2(`<!---->`);
|
|
3044
|
+
}
|
|
3045
|
+
_push2(ssrRenderComponent($setup["MenuButton"], {
|
|
3046
|
+
class: "outline-none",
|
|
3047
|
+
"aria-label": "Minha conta"
|
|
3048
|
+
}, {
|
|
3049
|
+
default: withCtx((_, _push3, _parent3, _scopeId2) => {
|
|
3050
|
+
if (_push3) {
|
|
3051
|
+
ssrRenderSlot(_ctx.$slots, "button", { open }, null, _push3, _parent3, _scopeId2);
|
|
3052
|
+
} else {
|
|
3053
|
+
return [
|
|
3054
|
+
renderSlot$1(_ctx.$slots, "button", { open })
|
|
3055
|
+
];
|
|
3056
|
+
}
|
|
3057
|
+
}),
|
|
3058
|
+
_: 2
|
|
3059
|
+
}, _parent2, _scopeId));
|
|
3060
|
+
_push2(ssrRenderComponent(_component_Fade, null, {
|
|
3061
|
+
default: withCtx((_, _push3, _parent3, _scopeId2) => {
|
|
3062
|
+
if (_push3) {
|
|
3063
|
+
_push3(ssrRenderComponent($setup["MenuItems"], { class: "absolute -right-8 mt-2 w-56 rounded shadow ring-1 ring-black/5 bg-white divide-y divide-base-100 focus:outline-none" }, {
|
|
3064
|
+
default: withCtx((_2, _push4, _parent4, _scopeId3) => {
|
|
3065
|
+
if (_push4) {
|
|
3066
|
+
_push4(`<div class="p-3 text-base-600"${_scopeId3}>${ssrInterpolate(`${"Ol\xE1"} ${$setup.customerName || "Visitante"}`)} `);
|
|
3067
|
+
_push4(ssrRenderComponent($setup["AccountLink"], {
|
|
3068
|
+
role: "button",
|
|
3069
|
+
class: "ui-btn-sm ui-btn-primary block my-1"
|
|
3070
|
+
}, {
|
|
3071
|
+
default: withCtx((_3, _push5, _parent5, _scopeId4) => {
|
|
3072
|
+
if (_push5) {
|
|
3073
|
+
_push5(`${ssrInterpolate("Acessar minha conta")}`);
|
|
3074
|
+
} else {
|
|
3075
|
+
return [
|
|
3076
|
+
createTextVNode(toDisplayString("Acessar minha conta"))
|
|
3077
|
+
];
|
|
3078
|
+
}
|
|
3079
|
+
}),
|
|
3080
|
+
_: 2
|
|
3081
|
+
}, _parent4, _scopeId3));
|
|
3082
|
+
if (!$setup.isLogged) {
|
|
3083
|
+
_push4(ssrRenderComponent($setup["AccountLink"], {
|
|
3084
|
+
"is-sign-up": "",
|
|
3085
|
+
class: "ui-link block"
|
|
3086
|
+
}, {
|
|
3087
|
+
default: withCtx((_3, _push5, _parent5, _scopeId4) => {
|
|
3088
|
+
if (_push5) {
|
|
3089
|
+
_push5(`${ssrInterpolate("Criar uma conta")}`);
|
|
3090
|
+
} else {
|
|
3091
|
+
return [
|
|
3092
|
+
createTextVNode(toDisplayString("Criar uma conta"))
|
|
3093
|
+
];
|
|
3094
|
+
}
|
|
3095
|
+
}),
|
|
3096
|
+
_: 2
|
|
3097
|
+
}, _parent4, _scopeId3));
|
|
3098
|
+
} else {
|
|
3099
|
+
_push4(`<!---->`);
|
|
3100
|
+
}
|
|
3101
|
+
_push4(`</div><ul class="list-none"${_scopeId3}>`);
|
|
3102
|
+
_push4(ssrRenderComponent($setup["MenuItem"], { as: "li" }, {
|
|
3103
|
+
default: withCtx(({ active }, _push5, _parent5, _scopeId4) => {
|
|
3104
|
+
if (_push5) {
|
|
3105
|
+
_push5(ssrRenderComponent($setup["AccountLink"], {
|
|
3106
|
+
to: "orders",
|
|
3107
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3108
|
+
}, {
|
|
3109
|
+
default: withCtx((_3, _push6, _parent6, _scopeId5) => {
|
|
3110
|
+
if (_push6) {
|
|
3111
|
+
_push6(`${ssrInterpolate("Meus pedidos")}`);
|
|
3112
|
+
} else {
|
|
3113
|
+
return [
|
|
3114
|
+
createTextVNode(toDisplayString("Meus pedidos"))
|
|
3115
|
+
];
|
|
3116
|
+
}
|
|
3117
|
+
}),
|
|
3118
|
+
_: 2
|
|
3119
|
+
}, _parent5, _scopeId4));
|
|
3120
|
+
} else {
|
|
3121
|
+
return [
|
|
3122
|
+
createVNode($setup["AccountLink"], {
|
|
3123
|
+
to: "orders",
|
|
3124
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3125
|
+
}, {
|
|
3126
|
+
default: withCtx(() => [
|
|
3127
|
+
createTextVNode(toDisplayString("Meus pedidos"))
|
|
3128
|
+
]),
|
|
3129
|
+
_: 2
|
|
3130
|
+
}, 1032, ["class"])
|
|
3131
|
+
];
|
|
3132
|
+
}
|
|
3133
|
+
}),
|
|
3134
|
+
_: 2
|
|
3135
|
+
}, _parent4, _scopeId3));
|
|
3136
|
+
_push4(ssrRenderComponent($setup["MenuItem"], { as: "li" }, {
|
|
3137
|
+
default: withCtx(({ active }, _push5, _parent5, _scopeId4) => {
|
|
3138
|
+
if (_push5) {
|
|
3139
|
+
_push5(ssrRenderComponent($setup["AccountLink"], {
|
|
3140
|
+
to: "favorites",
|
|
3141
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3142
|
+
}, {
|
|
3143
|
+
default: withCtx((_3, _push6, _parent6, _scopeId5) => {
|
|
3144
|
+
if (_push6) {
|
|
3145
|
+
_push6(`<i class="i-heart mr-1"${_scopeId5}></i> ${ssrInterpolate("Meus favoritos")}`);
|
|
3146
|
+
} else {
|
|
3147
|
+
return [
|
|
3148
|
+
createVNode("i", { class: "i-heart mr-1" }),
|
|
3149
|
+
createTextVNode(" " + toDisplayString("Meus favoritos"))
|
|
3150
|
+
];
|
|
3151
|
+
}
|
|
3152
|
+
}),
|
|
3153
|
+
_: 2
|
|
3154
|
+
}, _parent5, _scopeId4));
|
|
3155
|
+
} else {
|
|
3156
|
+
return [
|
|
3157
|
+
createVNode($setup["AccountLink"], {
|
|
3158
|
+
to: "favorites",
|
|
3159
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3160
|
+
}, {
|
|
3161
|
+
default: withCtx(() => [
|
|
3162
|
+
createVNode("i", { class: "i-heart mr-1" }),
|
|
3163
|
+
createTextVNode(" " + toDisplayString("Meus favoritos"))
|
|
3164
|
+
]),
|
|
3165
|
+
_: 2
|
|
3166
|
+
}, 1032, ["class"])
|
|
3167
|
+
];
|
|
3168
|
+
}
|
|
3169
|
+
}),
|
|
3170
|
+
_: 2
|
|
3171
|
+
}, _parent4, _scopeId3));
|
|
3172
|
+
_push4(`<!--[-->`);
|
|
3173
|
+
ssrRenderList(_ctx.$settings.service_links, ({ title, href }, i) => {
|
|
3174
|
+
_push4(ssrRenderComponent($setup["MenuItem"], {
|
|
3175
|
+
as: "li",
|
|
3176
|
+
key: `s-${i}`
|
|
3177
|
+
}, {
|
|
3178
|
+
default: withCtx(({ active }, _push5, _parent5, _scopeId4) => {
|
|
3179
|
+
if (_push5) {
|
|
3180
|
+
_push5(ssrRenderComponent(_component_ALink, {
|
|
3181
|
+
href,
|
|
3182
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3183
|
+
}, {
|
|
3184
|
+
default: withCtx((_3, _push6, _parent6, _scopeId5) => {
|
|
3185
|
+
if (_push6) {
|
|
3186
|
+
_push6(`${ssrInterpolate(title)}`);
|
|
3187
|
+
} else {
|
|
3188
|
+
return [
|
|
3189
|
+
createTextVNode(toDisplayString(title), 1)
|
|
3190
|
+
];
|
|
3191
|
+
}
|
|
3192
|
+
}),
|
|
3193
|
+
_: 2
|
|
3194
|
+
}, _parent5, _scopeId4));
|
|
3195
|
+
} else {
|
|
3196
|
+
return [
|
|
3197
|
+
createVNode(_component_ALink, {
|
|
3198
|
+
href,
|
|
3199
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3200
|
+
}, {
|
|
3201
|
+
default: withCtx(() => [
|
|
3202
|
+
createTextVNode(toDisplayString(title), 1)
|
|
3203
|
+
]),
|
|
3204
|
+
_: 2
|
|
3205
|
+
}, 1032, ["href", "class"])
|
|
3206
|
+
];
|
|
3207
|
+
}
|
|
3208
|
+
}),
|
|
3209
|
+
_: 2
|
|
3210
|
+
}, _parent4, _scopeId3));
|
|
3211
|
+
});
|
|
3212
|
+
_push4(`<!--]-->`);
|
|
3213
|
+
_push4(ssrRenderComponent($setup["MenuItem"], { as: "li" }, {
|
|
3214
|
+
default: withCtx((_3, _push5, _parent5, _scopeId4) => {
|
|
3215
|
+
if (_push5) {
|
|
3216
|
+
_push5(`<div class="flex justify-center gap-2 p-2 text-base-500 text-base"${_scopeId4}><!--[-->`);
|
|
3217
|
+
ssrRenderList($setup.socialNetworks, (href, network) => {
|
|
3218
|
+
_push5(`<span${_scopeId4}>`);
|
|
3219
|
+
_push5(ssrRenderComponent($setup["SocialNetworkLink"], {
|
|
3220
|
+
network,
|
|
3221
|
+
class: "p-1 hover:text-primary"
|
|
3222
|
+
}, null, _parent5, _scopeId4));
|
|
3223
|
+
_push5(`</span>`);
|
|
3224
|
+
});
|
|
3225
|
+
_push5(`<!--]--></div>`);
|
|
3226
|
+
} else {
|
|
3227
|
+
return [
|
|
3228
|
+
createVNode("div", { class: "flex justify-center gap-2 p-2 text-base-500 text-base" }, [
|
|
3229
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.socialNetworks, (href, network) => {
|
|
3230
|
+
return openBlock(), createBlock("span", { key: network }, [
|
|
3231
|
+
createVNode($setup["SocialNetworkLink"], {
|
|
3232
|
+
network,
|
|
3233
|
+
class: "p-1 hover:text-primary"
|
|
3234
|
+
}, null, 8, ["network"])
|
|
3235
|
+
]);
|
|
3236
|
+
}), 128))
|
|
3237
|
+
])
|
|
3238
|
+
];
|
|
3239
|
+
}
|
|
3240
|
+
}),
|
|
3241
|
+
_: 2
|
|
3242
|
+
}, _parent4, _scopeId3));
|
|
3243
|
+
if ($setup.isLogged) {
|
|
3244
|
+
_push4(ssrRenderComponent($setup["MenuItem"], { as: "li" }, {
|
|
3245
|
+
default: withCtx((_3, _push5, _parent5, _scopeId4) => {
|
|
3246
|
+
if (_push5) {
|
|
3247
|
+
_push5(`<button class="p-2 text-right text-base-800"${_scopeId4}><span class="text-base-600"${_scopeId4}>${ssrInterpolate("Sair")}</span><i class="i-arrow-right-on-rectangle text-lg ml-1"${_scopeId4}></i></button>`);
|
|
3248
|
+
} else {
|
|
3249
|
+
return [
|
|
3250
|
+
createVNode("button", {
|
|
3251
|
+
onClick: $setup.logout,
|
|
3252
|
+
class: "p-2 text-right text-base-800"
|
|
3253
|
+
}, [
|
|
3254
|
+
createVNode("span", { class: "text-base-600" }, toDisplayString("Sair")),
|
|
3255
|
+
createVNode("i", { class: "i-arrow-right-on-rectangle text-lg ml-1" })
|
|
3256
|
+
], 8, ["onClick"])
|
|
3257
|
+
];
|
|
3258
|
+
}
|
|
3259
|
+
}),
|
|
3260
|
+
_: 2
|
|
3261
|
+
}, _parent4, _scopeId3));
|
|
3262
|
+
} else {
|
|
3263
|
+
_push4(`<!---->`);
|
|
3264
|
+
}
|
|
3265
|
+
_push4(`</ul>`);
|
|
3266
|
+
} else {
|
|
3267
|
+
return [
|
|
3268
|
+
createVNode("div", { class: "p-3 text-base-600" }, [
|
|
3269
|
+
createTextVNode(toDisplayString(`${"Ol\xE1"} ${$setup.customerName || "Visitante"}`) + " ", 1),
|
|
3270
|
+
createVNode($setup["AccountLink"], {
|
|
3271
|
+
role: "button",
|
|
3272
|
+
class: "ui-btn-sm ui-btn-primary block my-1"
|
|
3273
|
+
}, {
|
|
3274
|
+
default: withCtx(() => [
|
|
3275
|
+
createTextVNode(toDisplayString("Acessar minha conta"))
|
|
3276
|
+
]),
|
|
3277
|
+
_: 1
|
|
3278
|
+
}),
|
|
3279
|
+
!$setup.isLogged ? (openBlock(), createBlock($setup["AccountLink"], {
|
|
3280
|
+
key: 0,
|
|
3281
|
+
"is-sign-up": "",
|
|
3282
|
+
class: "ui-link block"
|
|
3283
|
+
}, {
|
|
3284
|
+
default: withCtx(() => [
|
|
3285
|
+
createTextVNode(toDisplayString("Criar uma conta"))
|
|
3286
|
+
]),
|
|
3287
|
+
_: 1
|
|
3288
|
+
})) : createCommentVNode("", true)
|
|
3289
|
+
]),
|
|
3290
|
+
createVNode("ul", { class: "list-none" }, [
|
|
3291
|
+
createVNode($setup["MenuItem"], { as: "li" }, {
|
|
3292
|
+
default: withCtx(({ active }) => [
|
|
3293
|
+
createVNode($setup["AccountLink"], {
|
|
3294
|
+
to: "orders",
|
|
3295
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3296
|
+
}, {
|
|
3297
|
+
default: withCtx(() => [
|
|
3298
|
+
createTextVNode(toDisplayString("Meus pedidos"))
|
|
3299
|
+
]),
|
|
3300
|
+
_: 2
|
|
3301
|
+
}, 1032, ["class"])
|
|
3302
|
+
]),
|
|
3303
|
+
_: 1
|
|
3304
|
+
}),
|
|
3305
|
+
createVNode($setup["MenuItem"], { as: "li" }, {
|
|
3306
|
+
default: withCtx(({ active }) => [
|
|
3307
|
+
createVNode($setup["AccountLink"], {
|
|
3308
|
+
to: "favorites",
|
|
3309
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3310
|
+
}, {
|
|
3311
|
+
default: withCtx(() => [
|
|
3312
|
+
createVNode("i", { class: "i-heart mr-1" }),
|
|
3313
|
+
createTextVNode(" " + toDisplayString("Meus favoritos"))
|
|
3314
|
+
]),
|
|
3315
|
+
_: 2
|
|
3316
|
+
}, 1032, ["class"])
|
|
3317
|
+
]),
|
|
3318
|
+
_: 1
|
|
3319
|
+
}),
|
|
3320
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(_ctx.$settings.service_links, ({ title, href }, i) => {
|
|
3321
|
+
return openBlock(), createBlock($setup["MenuItem"], {
|
|
3322
|
+
as: "li",
|
|
3323
|
+
key: `s-${i}`
|
|
3324
|
+
}, {
|
|
3325
|
+
default: withCtx(({ active }) => [
|
|
3326
|
+
createVNode(_component_ALink, {
|
|
3327
|
+
href,
|
|
3328
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3329
|
+
}, {
|
|
3330
|
+
default: withCtx(() => [
|
|
3331
|
+
createTextVNode(toDisplayString(title), 1)
|
|
3332
|
+
]),
|
|
3333
|
+
_: 2
|
|
3334
|
+
}, 1032, ["href", "class"])
|
|
3335
|
+
]),
|
|
3336
|
+
_: 2
|
|
3337
|
+
}, 1024);
|
|
3338
|
+
}), 128)),
|
|
3339
|
+
createVNode($setup["MenuItem"], { as: "li" }, {
|
|
3340
|
+
default: withCtx(() => [
|
|
3341
|
+
createVNode("div", { class: "flex justify-center gap-2 p-2 text-base-500 text-base" }, [
|
|
3342
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.socialNetworks, (href, network) => {
|
|
3343
|
+
return openBlock(), createBlock("span", { key: network }, [
|
|
3344
|
+
createVNode($setup["SocialNetworkLink"], {
|
|
3345
|
+
network,
|
|
3346
|
+
class: "p-1 hover:text-primary"
|
|
3347
|
+
}, null, 8, ["network"])
|
|
3348
|
+
]);
|
|
3349
|
+
}), 128))
|
|
3350
|
+
])
|
|
3351
|
+
]),
|
|
3352
|
+
_: 1
|
|
3353
|
+
}),
|
|
3354
|
+
$setup.isLogged ? (openBlock(), createBlock($setup["MenuItem"], {
|
|
3355
|
+
key: 0,
|
|
3356
|
+
as: "li"
|
|
3357
|
+
}, {
|
|
3358
|
+
default: withCtx(() => [
|
|
3359
|
+
createVNode("button", {
|
|
3360
|
+
onClick: $setup.logout,
|
|
3361
|
+
class: "p-2 text-right text-base-800"
|
|
3362
|
+
}, [
|
|
3363
|
+
createVNode("span", { class: "text-base-600" }, toDisplayString("Sair")),
|
|
3364
|
+
createVNode("i", { class: "i-arrow-right-on-rectangle text-lg ml-1" })
|
|
3365
|
+
], 8, ["onClick"])
|
|
3366
|
+
]),
|
|
3367
|
+
_: 1
|
|
3368
|
+
})) : createCommentVNode("", true)
|
|
3369
|
+
])
|
|
3370
|
+
];
|
|
3371
|
+
}
|
|
3372
|
+
}),
|
|
3373
|
+
_: 2
|
|
3374
|
+
}, _parent3, _scopeId2));
|
|
3375
|
+
} else {
|
|
3376
|
+
return [
|
|
3377
|
+
createVNode($setup["MenuItems"], { class: "absolute -right-8 mt-2 w-56 rounded shadow ring-1 ring-black/5 bg-white divide-y divide-base-100 focus:outline-none" }, {
|
|
3378
|
+
default: withCtx(() => [
|
|
3379
|
+
createVNode("div", { class: "p-3 text-base-600" }, [
|
|
3380
|
+
createTextVNode(toDisplayString(`${"Ol\xE1"} ${$setup.customerName || "Visitante"}`) + " ", 1),
|
|
3381
|
+
createVNode($setup["AccountLink"], {
|
|
3382
|
+
role: "button",
|
|
3383
|
+
class: "ui-btn-sm ui-btn-primary block my-1"
|
|
3384
|
+
}, {
|
|
3385
|
+
default: withCtx(() => [
|
|
3386
|
+
createTextVNode(toDisplayString("Acessar minha conta"))
|
|
3387
|
+
]),
|
|
3388
|
+
_: 1
|
|
3389
|
+
}),
|
|
3390
|
+
!$setup.isLogged ? (openBlock(), createBlock($setup["AccountLink"], {
|
|
3391
|
+
key: 0,
|
|
3392
|
+
"is-sign-up": "",
|
|
3393
|
+
class: "ui-link block"
|
|
3394
|
+
}, {
|
|
3395
|
+
default: withCtx(() => [
|
|
3396
|
+
createTextVNode(toDisplayString("Criar uma conta"))
|
|
3397
|
+
]),
|
|
3398
|
+
_: 1
|
|
3399
|
+
})) : createCommentVNode("", true)
|
|
3400
|
+
]),
|
|
3401
|
+
createVNode("ul", { class: "list-none" }, [
|
|
3402
|
+
createVNode($setup["MenuItem"], { as: "li" }, {
|
|
3403
|
+
default: withCtx(({ active }) => [
|
|
3404
|
+
createVNode($setup["AccountLink"], {
|
|
3405
|
+
to: "orders",
|
|
3406
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3407
|
+
}, {
|
|
3408
|
+
default: withCtx(() => [
|
|
3409
|
+
createTextVNode(toDisplayString("Meus pedidos"))
|
|
3410
|
+
]),
|
|
3411
|
+
_: 2
|
|
3412
|
+
}, 1032, ["class"])
|
|
3413
|
+
]),
|
|
3414
|
+
_: 1
|
|
3415
|
+
}),
|
|
3416
|
+
createVNode($setup["MenuItem"], { as: "li" }, {
|
|
3417
|
+
default: withCtx(({ active }) => [
|
|
3418
|
+
createVNode($setup["AccountLink"], {
|
|
3419
|
+
to: "favorites",
|
|
3420
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3421
|
+
}, {
|
|
3422
|
+
default: withCtx(() => [
|
|
3423
|
+
createVNode("i", { class: "i-heart mr-1" }),
|
|
3424
|
+
createTextVNode(" " + toDisplayString("Meus favoritos"))
|
|
3425
|
+
]),
|
|
3426
|
+
_: 2
|
|
3427
|
+
}, 1032, ["class"])
|
|
3428
|
+
]),
|
|
3429
|
+
_: 1
|
|
3430
|
+
}),
|
|
3431
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(_ctx.$settings.service_links, ({ title, href }, i) => {
|
|
3432
|
+
return openBlock(), createBlock($setup["MenuItem"], {
|
|
3433
|
+
as: "li",
|
|
3434
|
+
key: `s-${i}`
|
|
3435
|
+
}, {
|
|
3436
|
+
default: withCtx(({ active }) => [
|
|
3437
|
+
createVNode(_component_ALink, {
|
|
3438
|
+
href,
|
|
3439
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3440
|
+
}, {
|
|
3441
|
+
default: withCtx(() => [
|
|
3442
|
+
createTextVNode(toDisplayString(title), 1)
|
|
3443
|
+
]),
|
|
3444
|
+
_: 2
|
|
3445
|
+
}, 1032, ["href", "class"])
|
|
3446
|
+
]),
|
|
3447
|
+
_: 2
|
|
3448
|
+
}, 1024);
|
|
3449
|
+
}), 128)),
|
|
3450
|
+
createVNode($setup["MenuItem"], { as: "li" }, {
|
|
3451
|
+
default: withCtx(() => [
|
|
3452
|
+
createVNode("div", { class: "flex justify-center gap-2 p-2 text-base-500 text-base" }, [
|
|
3453
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.socialNetworks, (href, network) => {
|
|
3454
|
+
return openBlock(), createBlock("span", { key: network }, [
|
|
3455
|
+
createVNode($setup["SocialNetworkLink"], {
|
|
3456
|
+
network,
|
|
3457
|
+
class: "p-1 hover:text-primary"
|
|
3458
|
+
}, null, 8, ["network"])
|
|
3459
|
+
]);
|
|
3460
|
+
}), 128))
|
|
3461
|
+
])
|
|
3462
|
+
]),
|
|
3463
|
+
_: 1
|
|
3464
|
+
}),
|
|
3465
|
+
$setup.isLogged ? (openBlock(), createBlock($setup["MenuItem"], {
|
|
3466
|
+
key: 0,
|
|
3467
|
+
as: "li"
|
|
3468
|
+
}, {
|
|
3469
|
+
default: withCtx(() => [
|
|
3470
|
+
createVNode("button", {
|
|
3471
|
+
onClick: $setup.logout,
|
|
3472
|
+
class: "p-2 text-right text-base-800"
|
|
3473
|
+
}, [
|
|
3474
|
+
createVNode("span", { class: "text-base-600" }, toDisplayString("Sair")),
|
|
3475
|
+
createVNode("i", { class: "i-arrow-right-on-rectangle text-lg ml-1" })
|
|
3476
|
+
], 8, ["onClick"])
|
|
3477
|
+
]),
|
|
3478
|
+
_: 1
|
|
3479
|
+
})) : createCommentVNode("", true)
|
|
3480
|
+
])
|
|
3481
|
+
]),
|
|
3482
|
+
_: 1
|
|
3483
|
+
})
|
|
3484
|
+
];
|
|
3485
|
+
}
|
|
3486
|
+
}),
|
|
3487
|
+
_: 2
|
|
3488
|
+
}, _parent2, _scopeId));
|
|
3489
|
+
} else {
|
|
3490
|
+
return [
|
|
3491
|
+
open ? (openBlock(), createBlock("div", { key: 0 }, [
|
|
3492
|
+
createVNode("span", null, [
|
|
3493
|
+
createTextVNode(toDisplayString($setup.initializeFirebaseAuth()), 1)
|
|
3494
|
+
])
|
|
3495
|
+
])) : createCommentVNode("", true),
|
|
3496
|
+
createVNode($setup["MenuButton"], {
|
|
3497
|
+
class: "outline-none",
|
|
3498
|
+
"aria-label": "Minha conta"
|
|
3499
|
+
}, {
|
|
3500
|
+
default: withCtx(() => [
|
|
3501
|
+
renderSlot$1(_ctx.$slots, "button", { open })
|
|
3502
|
+
]),
|
|
3503
|
+
_: 2
|
|
3504
|
+
}, 1024),
|
|
3505
|
+
createVNode(_component_Fade, null, {
|
|
3506
|
+
default: withCtx(() => [
|
|
3507
|
+
createVNode($setup["MenuItems"], { class: "absolute -right-8 mt-2 w-56 rounded shadow ring-1 ring-black/5 bg-white divide-y divide-base-100 focus:outline-none" }, {
|
|
3508
|
+
default: withCtx(() => [
|
|
3509
|
+
createVNode("div", { class: "p-3 text-base-600" }, [
|
|
3510
|
+
createTextVNode(toDisplayString(`${"Ol\xE1"} ${$setup.customerName || "Visitante"}`) + " ", 1),
|
|
3511
|
+
createVNode($setup["AccountLink"], {
|
|
3512
|
+
role: "button",
|
|
3513
|
+
class: "ui-btn-sm ui-btn-primary block my-1"
|
|
3514
|
+
}, {
|
|
3515
|
+
default: withCtx(() => [
|
|
3516
|
+
createTextVNode(toDisplayString("Acessar minha conta"))
|
|
3517
|
+
]),
|
|
3518
|
+
_: 1
|
|
3519
|
+
}),
|
|
3520
|
+
!$setup.isLogged ? (openBlock(), createBlock($setup["AccountLink"], {
|
|
3521
|
+
key: 0,
|
|
3522
|
+
"is-sign-up": "",
|
|
3523
|
+
class: "ui-link block"
|
|
3524
|
+
}, {
|
|
3525
|
+
default: withCtx(() => [
|
|
3526
|
+
createTextVNode(toDisplayString("Criar uma conta"))
|
|
3527
|
+
]),
|
|
3528
|
+
_: 1
|
|
3529
|
+
})) : createCommentVNode("", true)
|
|
3530
|
+
]),
|
|
3531
|
+
createVNode("ul", { class: "list-none" }, [
|
|
3532
|
+
createVNode($setup["MenuItem"], { as: "li" }, {
|
|
3533
|
+
default: withCtx(({ active }) => [
|
|
3534
|
+
createVNode($setup["AccountLink"], {
|
|
3535
|
+
to: "orders",
|
|
3536
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3537
|
+
}, {
|
|
3538
|
+
default: withCtx(() => [
|
|
3539
|
+
createTextVNode(toDisplayString("Meus pedidos"))
|
|
3540
|
+
]),
|
|
3541
|
+
_: 2
|
|
3542
|
+
}, 1032, ["class"])
|
|
3543
|
+
]),
|
|
3544
|
+
_: 1
|
|
3545
|
+
}),
|
|
3546
|
+
createVNode($setup["MenuItem"], { as: "li" }, {
|
|
3547
|
+
default: withCtx(({ active }) => [
|
|
3548
|
+
createVNode($setup["AccountLink"], {
|
|
3549
|
+
to: "favorites",
|
|
3550
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3551
|
+
}, {
|
|
3552
|
+
default: withCtx(() => [
|
|
3553
|
+
createVNode("i", { class: "i-heart mr-1" }),
|
|
3554
|
+
createTextVNode(" " + toDisplayString("Meus favoritos"))
|
|
3555
|
+
]),
|
|
3556
|
+
_: 2
|
|
3557
|
+
}, 1032, ["class"])
|
|
3558
|
+
]),
|
|
3559
|
+
_: 1
|
|
3560
|
+
}),
|
|
3561
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(_ctx.$settings.service_links, ({ title, href }, i) => {
|
|
3562
|
+
return openBlock(), createBlock($setup["MenuItem"], {
|
|
3563
|
+
as: "li",
|
|
3564
|
+
key: `s-${i}`
|
|
3565
|
+
}, {
|
|
3566
|
+
default: withCtx(({ active }) => [
|
|
3567
|
+
createVNode(_component_ALink, {
|
|
3568
|
+
href,
|
|
3569
|
+
class: ["block p-2", active ? "bg-base-100 text-primary" : null]
|
|
3570
|
+
}, {
|
|
3571
|
+
default: withCtx(() => [
|
|
3572
|
+
createTextVNode(toDisplayString(title), 1)
|
|
3573
|
+
]),
|
|
3574
|
+
_: 2
|
|
3575
|
+
}, 1032, ["href", "class"])
|
|
3576
|
+
]),
|
|
3577
|
+
_: 2
|
|
3578
|
+
}, 1024);
|
|
3579
|
+
}), 128)),
|
|
3580
|
+
createVNode($setup["MenuItem"], { as: "li" }, {
|
|
3581
|
+
default: withCtx(() => [
|
|
3582
|
+
createVNode("div", { class: "flex justify-center gap-2 p-2 text-base-500 text-base" }, [
|
|
3583
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList($setup.socialNetworks, (href, network) => {
|
|
3584
|
+
return openBlock(), createBlock("span", { key: network }, [
|
|
3585
|
+
createVNode($setup["SocialNetworkLink"], {
|
|
3586
|
+
network,
|
|
3587
|
+
class: "p-1 hover:text-primary"
|
|
3588
|
+
}, null, 8, ["network"])
|
|
3589
|
+
]);
|
|
3590
|
+
}), 128))
|
|
3591
|
+
])
|
|
3592
|
+
]),
|
|
3593
|
+
_: 1
|
|
3594
|
+
}),
|
|
3595
|
+
$setup.isLogged ? (openBlock(), createBlock($setup["MenuItem"], {
|
|
3596
|
+
key: 0,
|
|
3597
|
+
as: "li"
|
|
3598
|
+
}, {
|
|
3599
|
+
default: withCtx(() => [
|
|
3600
|
+
createVNode("button", {
|
|
3601
|
+
onClick: $setup.logout,
|
|
3602
|
+
class: "p-2 text-right text-base-800"
|
|
3603
|
+
}, [
|
|
3604
|
+
createVNode("span", { class: "text-base-600" }, toDisplayString("Sair")),
|
|
3605
|
+
createVNode("i", { class: "i-arrow-right-on-rectangle text-lg ml-1" })
|
|
3606
|
+
], 8, ["onClick"])
|
|
3607
|
+
]),
|
|
3608
|
+
_: 1
|
|
3609
|
+
})) : createCommentVNode("", true)
|
|
3610
|
+
])
|
|
3611
|
+
]),
|
|
3612
|
+
_: 1
|
|
3613
|
+
})
|
|
3614
|
+
]),
|
|
3615
|
+
_: 1
|
|
3616
|
+
})
|
|
3617
|
+
];
|
|
3618
|
+
}
|
|
3619
|
+
}),
|
|
3620
|
+
_: 3
|
|
3621
|
+
}, _parent));
|
|
3622
|
+
}
|
|
3623
|
+
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
3624
|
+
_sfc_main$1.setup = (props, ctx) => {
|
|
3625
|
+
const ssrContext = useSSRContext();
|
|
3626
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/AccountMenu.vue");
|
|
3627
|
+
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
3628
|
+
};
|
|
3629
|
+
const AccountMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender$1]]);
|
|
3630
|
+
|
|
3631
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3632
|
+
__name: "ShopHeader",
|
|
3633
|
+
props: {
|
|
3634
|
+
categories: {},
|
|
3635
|
+
menuCategorySlugs: {},
|
|
3636
|
+
menuRandomCategories: {},
|
|
3637
|
+
isAlphabeticalSortSubmenu: { type: Boolean }
|
|
3638
|
+
},
|
|
3639
|
+
setup(__props, { expose: __expose }) {
|
|
3640
|
+
__expose();
|
|
3641
|
+
const props = __props;
|
|
3642
|
+
const SearchModal = defineAsyncComponent(() => import('../SearchModal.a680efae.mjs'));
|
|
3643
|
+
const CartSidebar = defineAsyncComponent(() => import('../CartSidebar.cca9fdd3.mjs'));
|
|
3644
|
+
const header = ref(null);
|
|
3645
|
+
const {
|
|
3646
|
+
isSticky,
|
|
3647
|
+
positionY,
|
|
3648
|
+
categoryTrees,
|
|
3649
|
+
inlineMenuTrees
|
|
3650
|
+
} = useShopHeader({ ...props, header });
|
|
3651
|
+
const isSidenavOpen = ref(false);
|
|
3652
|
+
const isSearchOpen = ref(false);
|
|
3653
|
+
const isSearchOpenOnce = ref(false);
|
|
3654
|
+
watchOnce(isSearchOpen, () => {
|
|
3655
|
+
isSearchOpenOnce.value = true;
|
|
3656
|
+
});
|
|
3657
|
+
const isCartOpen = ref(false);
|
|
3658
|
+
const isCartOpenOnce = ref(false);
|
|
3659
|
+
watchOnce(isCartOpen, () => {
|
|
3660
|
+
isCartOpenOnce.value = true;
|
|
3661
|
+
});
|
|
3662
|
+
const isMounted = ref(false);
|
|
3663
|
+
const delayedTotalItems = ref(0);
|
|
3664
|
+
onMounted(() => {
|
|
3665
|
+
isMounted.value = true;
|
|
3666
|
+
watch(totalItems, (newTotalItems, prevTotalItems) => {
|
|
3667
|
+
if (typeof prevTotalItems === "number") {
|
|
3668
|
+
if (prevTotalItems < newTotalItems) {
|
|
3669
|
+
isCartOpen.value = true;
|
|
3670
|
+
} else if (prevTotalItems && !newTotalItems) {
|
|
3671
|
+
isCartOpen.value = false;
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
delayedTotalItems.value = newTotalItems;
|
|
3675
|
+
}, { immediate: true });
|
|
3676
|
+
});
|
|
3677
|
+
const __returned__ = { SearchModal, CartSidebar, props, header, isSticky, positionY, categoryTrees, inlineMenuTrees, isSidenavOpen, isSearchOpen, isSearchOpenOnce, isCartOpen, isCartOpenOnce, isMounted, delayedTotalItems, Drawer, ShopSidenav, ShopHeaderMenu, AccountMenu };
|
|
3678
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
3679
|
+
return __returned__;
|
|
3680
|
+
}
|
|
3681
|
+
});
|
|
3682
|
+
function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
3683
|
+
const _component_Skeleton = resolveComponent("Skeleton");
|
|
3684
|
+
_push(`<header${ssrRenderAttrs(mergeProps({
|
|
3685
|
+
ref: "header",
|
|
3686
|
+
class: ["relative top-0 z-50 transition-colors", [
|
|
3687
|
+
$setup.isSticky && !$setup.isSidenavOpen ? "bg-white/80" : "bg-white",
|
|
3688
|
+
$setup.isSticky ? "backdrop-blur-md shadow py-2 md:py-3" : "py-3 sm:py-4 md:py-5"
|
|
3689
|
+
]]
|
|
3690
|
+
}, _attrs))}><div class="w-screen lg:w-[calc(100vw-1rem)] xl:max-w-[82rem] 2xl:max-w-[85rem] mx-auto px-1 sm:pl-2 sm:pr-2.5 lg:px-1 flex md:grid grid-flow-col grid-cols-3 lg:grid-cols-none lg:auto-cols-max justify-between items-center"><div class="basis-1/4 lg:hidden"><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}><i class="${ssrRenderClass([$setup.isSidenavOpen ? "i-close" : "i-bars-3-bottom-left", "text-base-500 text-3xl"])}"></i></button></div>`);
|
|
3691
|
+
ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push, _parent);
|
|
3692
|
+
_push(ssrRenderComponent($setup["ShopHeaderMenu"], mergeProps({ class: "hidden lg:block" }, { inlineMenuTrees: $setup.inlineMenuTrees }), null, _parent));
|
|
3693
|
+
_push(`<div class="basis-1/4 px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800"><button${ssrRenderAttr("aria-label", "Buscar produtos")}><i class="i-magnifying-glass w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button>`);
|
|
3694
|
+
_push(ssrRenderComponent($setup["AccountMenu"], { class: "hidden sm:block" }, {
|
|
3695
|
+
button: withCtx(({ open }, _push2, _parent2, _scopeId) => {
|
|
3696
|
+
if (_push2) {
|
|
3697
|
+
_push2(`<i class="${ssrRenderClass([open ? "text-black scale-110" : null, "i-user-circle w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"])}"${_scopeId}></i>`);
|
|
3698
|
+
} else {
|
|
3699
|
+
return [
|
|
3700
|
+
createVNode("i", {
|
|
3701
|
+
class: ["i-user-circle w-7 h-7 hover:text-primary hover:scale-110 active:scale-125", open ? "text-black scale-110" : null]
|
|
3702
|
+
}, null, 2)
|
|
3703
|
+
];
|
|
3704
|
+
}
|
|
3705
|
+
}),
|
|
3706
|
+
_: 1
|
|
3707
|
+
}, _parent));
|
|
3708
|
+
_push(`<button${ssrRenderAttr("aria-label", "Abrir carrinho")} class="relative group"><i class="i-shopping-bag w-7 h-7 group-hover:text-primary group-hover:scale-110 group-active:scale-125"></i>`);
|
|
3709
|
+
if ($setup.delayedTotalItems) {
|
|
3710
|
+
_push(`<span class="ui-badge-pill-sm absolute -top-1 -right-1.5">${ssrInterpolate($setup.delayedTotalItems)}</span>`);
|
|
3711
|
+
} else {
|
|
3712
|
+
_push(`<!---->`);
|
|
3713
|
+
}
|
|
3714
|
+
_push(`</button></div></div>`);
|
|
3715
|
+
_push(ssrRenderComponent($setup["Drawer"], {
|
|
3716
|
+
modelValue: $setup.isSidenavOpen,
|
|
3717
|
+
"onUpdate:modelValue": ($event) => $setup.isSidenavOpen = $event,
|
|
3718
|
+
"has-close-button": false,
|
|
3719
|
+
position: "absolute",
|
|
3720
|
+
class: $setup.isSticky ? "mt-2 md:mt-3" : "mt-3 sm:mt-4 md:mt-5",
|
|
3721
|
+
style: { height: `calc(100vh - ${$setup.positionY}px + .5rem)` }
|
|
3722
|
+
}, {
|
|
3723
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
3724
|
+
if (_push2) {
|
|
3725
|
+
_push2(ssrRenderComponent($setup["ShopSidenav"], mergeProps({ class: "bg-white pt-6" }, { categoryTrees: $setup.categoryTrees }), null, _parent2, _scopeId));
|
|
3726
|
+
} else {
|
|
3727
|
+
return [
|
|
3728
|
+
createVNode($setup["ShopSidenav"], mergeProps({ class: "bg-white pt-6" }, { categoryTrees: $setup.categoryTrees }), null, 16)
|
|
3729
|
+
];
|
|
3730
|
+
}
|
|
3731
|
+
}),
|
|
3732
|
+
_: 1
|
|
3733
|
+
}, _parent));
|
|
3734
|
+
_push(ssrRenderComponent($setup["Drawer"], {
|
|
3735
|
+
modelValue: $setup.isSearchOpen,
|
|
3736
|
+
"onUpdate:modelValue": ($event) => $setup.isSearchOpen = $event,
|
|
3737
|
+
"has-close-button": false,
|
|
3738
|
+
placement: "top"
|
|
3739
|
+
}, {
|
|
3740
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
3741
|
+
if (_push2) {
|
|
3742
|
+
ssrRenderSuspense(_push2, {
|
|
3743
|
+
fallback: () => {
|
|
3744
|
+
_push2(`<div class="container mx-auto"${_scopeId}>`);
|
|
3745
|
+
_push2(ssrRenderComponent(_component_Skeleton, {
|
|
3746
|
+
class: "p-6",
|
|
3747
|
+
"is-large": ""
|
|
3748
|
+
}, null, _parent2, _scopeId));
|
|
3749
|
+
_push2(`</div>`);
|
|
3750
|
+
},
|
|
3751
|
+
default: () => {
|
|
3752
|
+
if ($setup.isSearchOpenOnce) {
|
|
3753
|
+
_push2(ssrRenderComponent($setup["SearchModal"], null, null, _parent2, _scopeId));
|
|
3754
|
+
} else {
|
|
3755
|
+
_push2(`<!---->`);
|
|
3756
|
+
}
|
|
3757
|
+
},
|
|
3758
|
+
_: 1
|
|
3759
|
+
});
|
|
3760
|
+
} else {
|
|
3761
|
+
return [
|
|
3762
|
+
(openBlock(), createBlock(Suspense, null, {
|
|
3763
|
+
fallback: withCtx(() => [
|
|
3764
|
+
createVNode("div", { class: "container mx-auto" }, [
|
|
3765
|
+
createVNode(_component_Skeleton, {
|
|
3766
|
+
class: "p-6",
|
|
3767
|
+
"is-large": ""
|
|
3768
|
+
})
|
|
3769
|
+
])
|
|
3770
|
+
]),
|
|
3771
|
+
default: withCtx(() => [
|
|
3772
|
+
$setup.isSearchOpenOnce ? (openBlock(), createBlock($setup["SearchModal"], { key: 0 })) : createCommentVNode("", true)
|
|
3773
|
+
]),
|
|
3774
|
+
_: 1
|
|
3775
|
+
}))
|
|
3776
|
+
];
|
|
3777
|
+
}
|
|
3778
|
+
}),
|
|
3779
|
+
_: 1
|
|
3780
|
+
}, _parent));
|
|
3781
|
+
if ($setup.isMounted) {
|
|
3782
|
+
ssrRenderTeleport(_push, (_push2) => {
|
|
3783
|
+
_push2(ssrRenderComponent($setup["Drawer"], {
|
|
3784
|
+
modelValue: $setup.isCartOpen,
|
|
3785
|
+
"onUpdate:modelValue": ($event) => $setup.isCartOpen = $event,
|
|
3786
|
+
placement: "end",
|
|
3787
|
+
"backdrop-target": "#teleported-overlap"
|
|
3788
|
+
}, {
|
|
3789
|
+
default: withCtx((_, _push3, _parent2, _scopeId) => {
|
|
3790
|
+
if (_push3) {
|
|
3791
|
+
ssrRenderSuspense(_push3, {
|
|
3792
|
+
fallback: () => {
|
|
3793
|
+
_push3(ssrRenderComponent(_component_Skeleton, {
|
|
3794
|
+
class: "pt-16 px-6",
|
|
3795
|
+
"is-bold": ""
|
|
3796
|
+
}, null, _parent2, _scopeId));
|
|
3797
|
+
},
|
|
3798
|
+
default: () => {
|
|
3799
|
+
if ($setup.isCartOpenOnce) {
|
|
3800
|
+
_push3(ssrRenderComponent($setup["CartSidebar"], {
|
|
3801
|
+
onClose: ($event) => $setup.isCartOpen = false
|
|
3802
|
+
}, null, _parent2, _scopeId));
|
|
3803
|
+
} else {
|
|
3804
|
+
_push3(`<!---->`);
|
|
3805
|
+
}
|
|
3806
|
+
},
|
|
3807
|
+
_: 1
|
|
3808
|
+
});
|
|
3809
|
+
} else {
|
|
3810
|
+
return [
|
|
3811
|
+
(openBlock(), createBlock(Suspense, null, {
|
|
3812
|
+
fallback: withCtx(() => [
|
|
3813
|
+
createVNode(_component_Skeleton, {
|
|
3814
|
+
class: "pt-16 px-6",
|
|
3815
|
+
"is-bold": ""
|
|
3816
|
+
})
|
|
3817
|
+
]),
|
|
3818
|
+
default: withCtx(() => [
|
|
3819
|
+
$setup.isCartOpenOnce ? (openBlock(), createBlock($setup["CartSidebar"], {
|
|
3820
|
+
key: 0,
|
|
3821
|
+
onClose: ($event) => $setup.isCartOpen = false
|
|
3822
|
+
}, null, 8, ["onClose"])) : createCommentVNode("", true)
|
|
3823
|
+
]),
|
|
3824
|
+
_: 1
|
|
3825
|
+
}))
|
|
3826
|
+
];
|
|
3827
|
+
}
|
|
3828
|
+
}),
|
|
3829
|
+
_: 1
|
|
3830
|
+
}, _parent));
|
|
3831
|
+
}, "#teleported-overlap", false, _parent);
|
|
3832
|
+
} else {
|
|
3833
|
+
_push(`<!---->`);
|
|
3834
|
+
}
|
|
3835
|
+
_push(`</header>`);
|
|
3836
|
+
}
|
|
3837
|
+
const _sfc_setup = _sfc_main.setup;
|
|
3838
|
+
_sfc_main.setup = (props, ctx) => {
|
|
3839
|
+
const ssrContext = useSSRContext();
|
|
3840
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/ShopHeader.vue");
|
|
3841
|
+
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
3842
|
+
};
|
|
3843
|
+
const ShopHeader = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
|
|
3844
|
+
|
|
3845
|
+
var __freeze = Object.freeze;
|
|
3846
|
+
var __defProp = Object.defineProperty;
|
|
3847
|
+
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
|
3848
|
+
var _a;
|
|
3849
|
+
const $$Astro$2 = createAstro("https://ecom2-demo.web.app");
|
|
3850
|
+
const $$PageHeader = createComponent(async ($$result, $$props, $$slots) => {
|
|
3851
|
+
const Astro2 = $$result.createAstro($$Astro$2, $$props, $$slots);
|
|
3852
|
+
Astro2.self = $$PageHeader;
|
|
3853
|
+
const { routeContext } = Astro2.locals;
|
|
3854
|
+
const { settings, isHomepage } = routeContext;
|
|
3855
|
+
const LogoHeading = isHomepage ? "h1" : "h2";
|
|
3856
|
+
const {
|
|
3857
|
+
pitchBar,
|
|
3858
|
+
shopHeader: { categories, ...shopHeader }
|
|
3859
|
+
} = await usePageHeader({ routeContext });
|
|
3860
|
+
const { inlineClientJS } = await useSharedData({
|
|
3861
|
+
field: "categories",
|
|
3862
|
+
value: categories?.map(({ _id, ...c }) => c)
|
|
3863
|
+
});
|
|
3864
|
+
return renderTemplate`${renderSlot($$result, $$slots["pitch-bar"], renderTemplate(_a || (_a = __template(["\n ", "\n ", "\n\n<script>", "<\/script>\n", ""])), pitchBar.slides.length > 1 && renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar, "client:idle": true, "client:component-hydration": "idle", "client:component-path": "~/components/PitchBar.vue", "client:component-export": "default" })}`, pitchBar.slides.length === 1 && renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar })}`, unescapeHTML(inlineClientJS), renderComponent($$result, "ShopHeader", ShopHeader, { ...shopHeader, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/ShopHeader.vue", "client:component-export": "default" }, { "logo": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "logo" }, { "default": ($$result3) => renderTemplate`
|
|
3865
|
+
${maybeRenderHead()}<a href="/">
|
|
3866
|
+
${renderComponent($$result3, "LogoHeading", LogoHeading, {}, { "default": ($$result4) => renderTemplate`
|
|
3867
|
+
${renderComponent($$result4, "Picture", $$Picture, { "src": settings.logo, "alt": settings.name, "widths": [300], "fetchpriority": "high", "loading": "eager", "class": "hover:drop-shadow-sm max-w-[150px] mx-auto" })}
|
|
3868
|
+
` })}
|
|
3869
|
+
</a>
|
|
3870
|
+
` })}` })))}`;
|
|
3871
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/PageHeader.astro", void 0);
|
|
3872
|
+
|
|
3873
|
+
const $$Astro$1 = createAstro("https://ecom2-demo.web.app");
|
|
3874
|
+
const $$Wildcard = createComponent(async ($$result, $$props, $$slots) => {
|
|
3875
|
+
const Astro2 = $$result.createAstro($$Astro$1, $$props, $$slots);
|
|
3876
|
+
Astro2.self = $$Wildcard;
|
|
3877
|
+
const { fetchingApiContext, apiContext } = Astro2.locals.routeContext;
|
|
3878
|
+
await fetchingApiContext;
|
|
3879
|
+
const apiDoc = apiContext.doc;
|
|
3880
|
+
return renderTemplate`${maybeRenderHead()}<main>
|
|
3881
|
+
${apiDoc && renderTemplate`<h1>Hello <span class="text-gradient">${apiDoc.name}</span></h1><hr><div class="mt-3">
|
|
3882
|
+
<mark>${apiDoc._id}</mark> from <i>${apiContext.resource}</i>
|
|
3883
|
+
<p>${Math.random()}</p>
|
|
3884
|
+
<em>Lorem ipsum dolor sit amet</em>
|
|
3885
|
+
</div>`}
|
|
3886
|
+
</main>`;
|
|
3887
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Wildcard.astro", void 0);
|
|
3888
|
+
|
|
3889
|
+
const $$Astro = createAstro("https://ecom2-demo.web.app");
|
|
3890
|
+
async function getStaticPaths() {
|
|
3891
|
+
return (await api.get("products?sort=-sales&limit=4&fields=slug")).data.result.map(({ slug }) => ({ params: { slug } }));
|
|
3892
|
+
}
|
|
3893
|
+
const $$ = createComponent(async ($$result, $$props, $$slots) => {
|
|
3894
|
+
const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
|
|
3895
|
+
Astro2.self = $$;
|
|
3896
|
+
if (String(Astro2.params.slug).endsWith(".css.map")) {
|
|
3897
|
+
return new Response(null, { status: 404 });
|
|
3898
|
+
}
|
|
3899
|
+
let routeContext;
|
|
3900
|
+
let loadError;
|
|
3901
|
+
try {
|
|
3902
|
+
routeContext = await loadRouteContext(Astro2);
|
|
3903
|
+
} catch (err) {
|
|
3904
|
+
if (err.astroResponse) {
|
|
3905
|
+
return err.astroResponse;
|
|
3906
|
+
}
|
|
3907
|
+
loadError = err;
|
|
3908
|
+
}
|
|
3909
|
+
return renderTemplate`<html${addAttribute(routeContext?.lang.replace("_", "-"), "lang")}>
|
|
3910
|
+
${routeContext && renderTemplate`${renderComponent($$result, "Base", $$Base, {}, { "base-head": ($$result2) => renderTemplate`${renderComponent($$result2, "BaseHead", $$BaseHead, { "slot": "base-head" })}`, "default": ($$result2) => renderTemplate`
|
|
3911
|
+
|
|
3912
|
+
${renderComponent($$result2, "PageHeader", $$PageHeader, {})}
|
|
3913
|
+
${renderComponent($$result2, "WildcardMain", $$Wildcard, {})}
|
|
3914
|
+
` })}`}
|
|
3915
|
+
${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
|
|
3916
|
+
</html>`;
|
|
3917
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro", void 0);
|
|
3918
|
+
|
|
3919
|
+
const $$file = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro";
|
|
3920
|
+
const $$url = "/[...slug]";
|
|
3921
|
+
|
|
3922
|
+
const ____slug_ = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
3923
|
+
__proto__: null,
|
|
3924
|
+
default: $$,
|
|
3925
|
+
file: $$file,
|
|
3926
|
+
getStaticPaths,
|
|
3927
|
+
url: $$url
|
|
3928
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
3929
|
+
|
|
3930
|
+
export { $$Picture as $, Carousel as C, SocialNetworkLink as S, _export_sfc as _, CarouselControl as a, availableExtraDiscount as b, installmentsOption as c, discountOption as d, addProductToCart as e, filterMainCategories as f, loadRouteContext as g, $$BaseHead as h, imageConfig as i, $$PageHeader as j, $$Base as k, loyaltyPointsPrograms as l, baseService as m, parseQuality as n, parseProduct as o, parseShippingPhrase as p, useId as q, removeCartItem as r, socialNetworks as s, freeShippingFromValue as t, useSharedData as u, shoppingCart as v, totalItems as w, ____slug_ as x };
|