cloudcommerce 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/ecomplus-stores/monocard/functions/ssr/package.json +0 -2
- package/ecomplus-stores/tia-sonia/functions/ssr/package.json +0 -2
- package/package.json +7 -7
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +2 -2
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +2 -2
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/lib/fb-conversions-events.js +131 -111
- package/packages/apps/fb-conversions/lib/fb-conversions-events.js.map +1 -1
- package/packages/apps/fb-conversions/lib/functions-lib/create-fb-objects.js +69 -0
- package/packages/apps/fb-conversions/lib/functions-lib/create-fb-objects.js.map +1 -0
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/fb-conversions/src/fb-conversions-events.ts +173 -125
- package/packages/apps/fb-conversions/src/functions-lib/create-fb-objects.ts +104 -0
- package/packages/apps/frenet/package.json +2 -2
- package/packages/apps/galaxpay/package.json +2 -2
- package/packages/apps/google-analytics/package.json +2 -2
- package/packages/apps/infinitepay/package.json +2 -2
- package/packages/apps/jadlog/package.json +2 -2
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/CHANGELOG.md +1 -0
- package/packages/apps/melhor-envio/README.md +1 -0
- package/packages/apps/melhor-envio/events.js +1 -0
- package/packages/apps/melhor-envio/lib/functions-lib/database.d.ts +18 -0
- package/packages/apps/melhor-envio/lib/functions-lib/database.js +115 -0
- package/packages/apps/melhor-envio/lib/functions-lib/database.js.map +1 -0
- package/packages/apps/melhor-envio/lib/functions-lib/events-to-melhor-envio.d.ts +7 -0
- package/packages/apps/melhor-envio/lib/functions-lib/events-to-melhor-envio.js +112 -0
- package/packages/apps/melhor-envio/lib/functions-lib/events-to-melhor-envio.js.map +1 -0
- package/packages/apps/melhor-envio/lib/functions-lib/new-label.d.ts +42 -0
- package/packages/apps/melhor-envio/lib/functions-lib/new-label.js +185 -0
- package/packages/apps/melhor-envio/lib/functions-lib/new-label.js.map +1 -0
- package/packages/apps/melhor-envio/lib/functions-lib/order-is-valid.d.ts +5 -0
- package/packages/apps/melhor-envio/lib/functions-lib/order-is-valid.js +40 -0
- package/packages/apps/melhor-envio/lib/functions-lib/order-is-valid.js.map +1 -0
- package/packages/apps/melhor-envio/lib/functions-lib/tracking-codes.d.ts +2 -0
- package/packages/apps/melhor-envio/lib/functions-lib/tracking-codes.js +164 -0
- package/packages/apps/melhor-envio/lib/functions-lib/tracking-codes.js.map +1 -0
- package/packages/apps/melhor-envio/lib/index.d.ts +1 -0
- package/packages/apps/melhor-envio/lib/index.js +2 -0
- package/packages/apps/melhor-envio/lib/index.js.map +1 -0
- package/packages/apps/melhor-envio/lib/melhor-envio-events.d.ts +6 -0
- package/packages/apps/melhor-envio/lib/melhor-envio-events.js +17 -0
- package/packages/apps/melhor-envio/lib/melhor-envio-events.js.map +1 -0
- package/packages/apps/melhor-envio/lib/melhor-envio.d.ts +2 -0
- package/packages/apps/melhor-envio/lib/melhor-envio.js +6 -0
- package/packages/apps/melhor-envio/lib/melhor-envio.js.map +1 -0
- package/packages/apps/melhor-envio/lib-mjs/calculate-melhor-envio.mjs +341 -0
- package/packages/apps/melhor-envio/lib-mjs/functions/client-melhor-envio.mjs +14 -0
- package/packages/apps/melhor-envio/lib-mjs/functions/error-handling.mjs +62 -0
- package/packages/apps/melhor-envio/lib-mjs/functions/new-shipment.mjs +119 -0
- package/packages/apps/melhor-envio/package.json +36 -0
- package/packages/apps/melhor-envio/src/functions-lib/database.ts +140 -0
- package/packages/apps/melhor-envio/src/functions-lib/events-to-melhor-envio.ts +137 -0
- package/packages/apps/melhor-envio/src/functions-lib/new-label.ts +214 -0
- package/packages/apps/melhor-envio/src/functions-lib/order-is-valid.ts +51 -0
- package/packages/apps/melhor-envio/src/functions-lib/tracking-codes.ts +191 -0
- package/packages/apps/melhor-envio/src/index.ts +1 -0
- package/packages/apps/melhor-envio/src/melhor-envio-events.ts +24 -0
- package/packages/apps/melhor-envio/src/melhor-envio.ts +7 -0
- package/packages/apps/melhor-envio/tsconfig.json +6 -0
- package/packages/apps/mercadopago/package.json +2 -2
- package/packages/apps/pagarme/package.json +2 -2
- package/packages/apps/paghiper/package.json +3 -3
- package/packages/apps/pix/package.json +2 -2
- package/packages/apps/tiny-erp/package.json +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +3 -3
- package/packages/events/lib/firebase.js +2 -0
- package/packages/events/lib/firebase.js.map +1 -1
- package/packages/events/package.json +2 -1
- package/packages/events/src/firebase.ts +2 -0
- package/packages/firebase/lib/config.d.ts +4 -0
- package/packages/firebase/lib/config.js +8 -0
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/package.json +2 -2
- package/packages/firebase/src/config.ts +9 -0
- package/packages/i18n/lib/en_us/i19buyTogether.txt +1 -0
- package/packages/i18n/lib/en_us/i19buyTogetherWith.txt +1 -0
- package/packages/i18n/lib/en_us/i19report.txt +1 -0
- package/packages/i18n/lib/en_us/i19toggleMenu.txt +1 -0
- package/packages/i18n/lib/en_us/i19uponRequest.txt +1 -0
- package/packages/i18n/lib/en_us/i19usedPoints.txt +1 -0
- package/packages/i18n/lib/en_us.d.ts +6 -0
- package/packages/i18n/lib/en_us.js +6 -0
- package/packages/i18n/lib/en_us.js.map +1 -1
- package/packages/i18n/lib/pt_br/i19buyTogether.txt +1 -0
- package/packages/i18n/lib/pt_br/i19buyTogetherWith.txt +1 -0
- package/packages/i18n/lib/pt_br/i19report.txt +1 -0
- package/packages/i18n/lib/pt_br/i19toggleMenu.txt +1 -0
- package/packages/i18n/lib/pt_br/i19uponRequest.txt +1 -0
- package/packages/i18n/lib/pt_br/i19usedPoints.txt +1 -0
- package/packages/i18n/lib/pt_br.d.ts +6 -0
- package/packages/i18n/lib/pt_br.js +6 -0
- package/packages/i18n/lib/pt_br.js.map +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/i18n/src/en_us.ts +6 -0
- package/packages/i18n/src/pt_br.ts +6 -0
- package/packages/modules/lib/firebase/call-app-module.js +5 -0
- package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
- package/packages/modules/package.json +3 -2
- package/packages/modules/src/firebase/call-app-module.ts +5 -0
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +6 -7
- package/packages/storefront/.eslintrc.cjs +1 -1
- package/packages/storefront/astro.config.mjs +8 -1
- package/packages/storefront/dist/client/_astro/PitchBar.209c6645.js +1 -0
- package/packages/storefront/dist/client/_astro/Prices.6fbcb5ac.js +1 -0
- package/packages/storefront/dist/client/_astro/Prices.vue_vue_type_script_setup_true_lang.44f23680.js +1 -0
- package/packages/storefront/dist/client/_astro/ProductCard.ee5eee91.js +1 -0
- package/packages/storefront/dist/client/_astro/ShopHeader.b801c785.js +1 -0
- package/packages/storefront/dist/client/_astro/_...slug_.32968ccf.css +1 -0
- package/packages/storefront/dist/client/_astro/client.5a46cc02.js +1 -0
- package/packages/storefront/dist/client/_astro/ecom-utils.92f137f6.js +1 -0
- package/packages/storefront/dist/client/_astro/hoisted.6edd7364.js +1 -0
- package/packages/storefront/dist/client/_astro/index.844a4059.js +1 -0
- package/packages/storefront/dist/client/{assets → _astro}/index.90df622b.css +0 -0
- package/packages/storefront/dist/client/_astro/modules-info.d9373e21.js +1 -0
- package/packages/storefront/dist/client/_astro/runtime-core.esm-bundler.f04cee62.js +1 -0
- package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.00313542.js +1 -0
- package/packages/storefront/dist/client/_astro/server.60de185d.css +1 -0
- package/packages/storefront/dist/client/{chunks/session-utm.ceebe967.js → _astro/session-utm.72684b84.js} +0 -0
- package/packages/storefront/dist/client/_astro/use-component-variant.58788b6e.js +1 -0
- package/packages/storefront/dist/client/{chunks/workbox-window.prod.es5.10f2e5ac.js → _astro/workbox-window.prod.es5.295a6886.js} +0 -0
- package/packages/storefront/dist/client/fallback/index.html +79 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/astro.89bd9221.mjs +3378 -0
- package/packages/storefront/dist/server/chunks/pages/all.23de4e5c.mjs +2453 -0
- package/packages/storefront/dist/server/chunks/prerender.f40361a3.mjs +2 -0
- package/packages/storefront/dist/server/entry.mjs +2016 -11995
- package/packages/storefront/package.json +10 -11
- package/packages/storefront/src/lib/assets/base.css +16 -11
- package/packages/storefront/src/lib/components/Carousel.vue +52 -82
- package/packages/storefront/src/lib/components/Drawer.vue +103 -0
- package/packages/storefront/src/lib/components/PitchBar.vue +16 -11
- package/packages/storefront/src/lib/components/Prices.vue +29 -29
- package/packages/storefront/src/lib/components/ShopHeader.vue +82 -0
- package/packages/storefront/src/lib/components/StickyHeader.vue +73 -32
- package/packages/storefront/src/lib/components/globals/Fade.vue +10 -14
- package/packages/storefront/src/lib/composables/use-component-variant.ts +6 -2
- package/packages/storefront/src/lib/composables/use-prices.ts +4 -2
- package/packages/storefront/src/lib/layouts/BaseBody.astro +1 -0
- package/packages/storefront/src/lib/layouts/PagesHeader.astro +28 -13
- package/packages/storefront/src/lib/ssr/Picture.astro +7 -2
- package/packages/storefront/tailwind.config.cjs +4 -0
- package/packages/storefront/uno.config.cjs +1 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/PitchBar.5ae15bda.js +0 -1
- package/packages/storefront/dist/client/Prices.248d1aae.js +0 -1
- package/packages/storefront/dist/client/ProductCard.4848304c.js +0 -1
- package/packages/storefront/dist/client/assets/_...slug_.b701cbb1.css +0 -1
- package/packages/storefront/dist/client/assets/server.4d9646d8.css +0 -1
- package/packages/storefront/dist/client/chunks/Prices.vue_vue_type_script_setup_true_lang.2d01aaa2.js +0 -1
- package/packages/storefront/dist/client/chunks/ecom-utils.cd6787a7.js +0 -1
- package/packages/storefront/dist/client/chunks/modules-info.fcab5bba.js +0 -1
- package/packages/storefront/dist/client/chunks/runtime-dom.esm-bundler.923790dc.js +0 -1
- package/packages/storefront/dist/client/client.2356f675.js +0 -1
- package/packages/storefront/dist/client/hoisted.11b849a7.js +0 -1
|
@@ -0,0 +1,2453 @@
|
|
|
1
|
+
import mime from 'mime';
|
|
2
|
+
import sharp$1 from 'sharp';
|
|
3
|
+
import 'kleur/colors';
|
|
4
|
+
import 'node:fs/promises';
|
|
5
|
+
import { resolve, join } from 'node:path';
|
|
6
|
+
import 'node:url';
|
|
7
|
+
import 'http-cache-semantics';
|
|
8
|
+
import 'node:os';
|
|
9
|
+
import sizeOf from 'image-size';
|
|
10
|
+
import 'magic-string';
|
|
11
|
+
import 'node:stream';
|
|
12
|
+
import 'slash';
|
|
13
|
+
import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, d as renderComponent, u as unescapeHTML, F as Fragment, m as maybeRenderHead, e as renderSlot, f as renderHead, s as spreadAttributes } from '../astro.89bd9221.mjs';
|
|
14
|
+
import api from '@cloudcommerce/api';
|
|
15
|
+
import { reactive, computed, defineComponent, inject, mergeProps, useSSRContext, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, unref, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, resolveComponent, withModifiers, createTextVNode, toDisplayString } from 'vue';
|
|
16
|
+
import { ssrRenderAttrs, ssrRenderSlot, ssrRenderClass, ssrRenderVNode, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrRenderTeleport, ssrIncludeBooleanAttr, ssrRenderAttr, ssrInterpolate } from 'vue/server-renderer';
|
|
17
|
+
import { img, price, formatMoney, onPromotion } from '@ecomplus/utils';
|
|
18
|
+
/* empty css */import { EventEmitter } from 'node:events';
|
|
19
|
+
import fs, { readFileSync } from 'node:fs';
|
|
20
|
+
import config from '@cloudcommerce/config';
|
|
21
|
+
import { resolve as resolve$1 } from 'path';
|
|
22
|
+
/* empty css */import { useScroll, useElementHover, useDebounceFn, useTimeout, promiseTimeout } from '@vueuse/core';
|
|
23
|
+
|
|
24
|
+
function isOutputFormat(value) {
|
|
25
|
+
return ["avif", "jpeg", "jpg", "png", "webp"].includes(value);
|
|
26
|
+
}
|
|
27
|
+
function isOutputFormatSupportsAlpha(value) {
|
|
28
|
+
return ["avif", "png", "webp"].includes(value);
|
|
29
|
+
}
|
|
30
|
+
function isAspectRatioString(value) {
|
|
31
|
+
return /^\d*:\d*$/.test(value);
|
|
32
|
+
}
|
|
33
|
+
function parseAspectRatio(aspectRatio) {
|
|
34
|
+
if (!aspectRatio) {
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
37
|
+
if (typeof aspectRatio === "number") {
|
|
38
|
+
return aspectRatio;
|
|
39
|
+
} else {
|
|
40
|
+
const [width, height] = aspectRatio.split(":");
|
|
41
|
+
return parseInt(width) / parseInt(height);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function isSSRService(service) {
|
|
45
|
+
return "transform" in service;
|
|
46
|
+
}
|
|
47
|
+
class BaseSSRService {
|
|
48
|
+
async getImageAttributes(transform) {
|
|
49
|
+
const { width, height, src, format, quality, aspectRatio, ...rest } = transform;
|
|
50
|
+
return {
|
|
51
|
+
...rest,
|
|
52
|
+
width,
|
|
53
|
+
height
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
serializeTransform(transform) {
|
|
57
|
+
const searchParams = new URLSearchParams();
|
|
58
|
+
if (transform.quality) {
|
|
59
|
+
searchParams.append("q", transform.quality.toString());
|
|
60
|
+
}
|
|
61
|
+
if (transform.format) {
|
|
62
|
+
searchParams.append("f", transform.format);
|
|
63
|
+
}
|
|
64
|
+
if (transform.width) {
|
|
65
|
+
searchParams.append("w", transform.width.toString());
|
|
66
|
+
}
|
|
67
|
+
if (transform.height) {
|
|
68
|
+
searchParams.append("h", transform.height.toString());
|
|
69
|
+
}
|
|
70
|
+
if (transform.aspectRatio) {
|
|
71
|
+
searchParams.append("ar", transform.aspectRatio.toString());
|
|
72
|
+
}
|
|
73
|
+
if (transform.fit) {
|
|
74
|
+
searchParams.append("fit", transform.fit);
|
|
75
|
+
}
|
|
76
|
+
if (transform.background) {
|
|
77
|
+
searchParams.append("bg", transform.background);
|
|
78
|
+
}
|
|
79
|
+
if (transform.position) {
|
|
80
|
+
searchParams.append("p", encodeURI(transform.position));
|
|
81
|
+
}
|
|
82
|
+
searchParams.append("href", transform.src);
|
|
83
|
+
return { searchParams };
|
|
84
|
+
}
|
|
85
|
+
parseTransform(searchParams) {
|
|
86
|
+
if (!searchParams.has("href")) {
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
let transform = { src: searchParams.get("href") };
|
|
90
|
+
if (searchParams.has("q")) {
|
|
91
|
+
transform.quality = parseInt(searchParams.get("q"));
|
|
92
|
+
}
|
|
93
|
+
if (searchParams.has("f")) {
|
|
94
|
+
const format = searchParams.get("f");
|
|
95
|
+
if (isOutputFormat(format)) {
|
|
96
|
+
transform.format = format;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (searchParams.has("w")) {
|
|
100
|
+
transform.width = parseInt(searchParams.get("w"));
|
|
101
|
+
}
|
|
102
|
+
if (searchParams.has("h")) {
|
|
103
|
+
transform.height = parseInt(searchParams.get("h"));
|
|
104
|
+
}
|
|
105
|
+
if (searchParams.has("ar")) {
|
|
106
|
+
const ratio = searchParams.get("ar");
|
|
107
|
+
if (isAspectRatioString(ratio)) {
|
|
108
|
+
transform.aspectRatio = ratio;
|
|
109
|
+
} else {
|
|
110
|
+
transform.aspectRatio = parseFloat(ratio);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (searchParams.has("fit")) {
|
|
114
|
+
transform.fit = searchParams.get("fit");
|
|
115
|
+
}
|
|
116
|
+
if (searchParams.has("p")) {
|
|
117
|
+
transform.position = decodeURI(searchParams.get("p"));
|
|
118
|
+
}
|
|
119
|
+
if (searchParams.has("bg")) {
|
|
120
|
+
transform.background = searchParams.get("bg");
|
|
121
|
+
}
|
|
122
|
+
return transform;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
class SharpService extends BaseSSRService {
|
|
127
|
+
async transform(inputBuffer, transform) {
|
|
128
|
+
const sharpImage = sharp$1(inputBuffer, { failOnError: false, pages: -1 });
|
|
129
|
+
sharpImage.rotate();
|
|
130
|
+
if (transform.width || transform.height) {
|
|
131
|
+
const width = transform.width && Math.round(transform.width);
|
|
132
|
+
const height = transform.height && Math.round(transform.height);
|
|
133
|
+
sharpImage.resize({
|
|
134
|
+
width,
|
|
135
|
+
height,
|
|
136
|
+
fit: transform.fit,
|
|
137
|
+
position: transform.position,
|
|
138
|
+
background: transform.background
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (transform.format) {
|
|
142
|
+
sharpImage.toFormat(transform.format, { quality: transform.quality });
|
|
143
|
+
if (transform.background && !isOutputFormatSupportsAlpha(transform.format)) {
|
|
144
|
+
sharpImage.flatten({ background: transform.background });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const { data, info } = await sharpImage.toBuffer({ resolveWithObject: true });
|
|
148
|
+
return {
|
|
149
|
+
data,
|
|
150
|
+
format: info.format
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const service = new SharpService();
|
|
155
|
+
var sharp_default = service;
|
|
156
|
+
|
|
157
|
+
const sharp = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
158
|
+
__proto__: null,
|
|
159
|
+
default: sharp_default
|
|
160
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
161
|
+
|
|
162
|
+
const fnv1a52 = (str) => {
|
|
163
|
+
const len = str.length;
|
|
164
|
+
let i = 0, t0 = 0, v0 = 8997, t1 = 0, v1 = 33826, t2 = 0, v2 = 40164, t3 = 0, v3 = 52210;
|
|
165
|
+
while (i < len) {
|
|
166
|
+
v0 ^= str.charCodeAt(i++);
|
|
167
|
+
t0 = v0 * 435;
|
|
168
|
+
t1 = v1 * 435;
|
|
169
|
+
t2 = v2 * 435;
|
|
170
|
+
t3 = v3 * 435;
|
|
171
|
+
t2 += v0 << 8;
|
|
172
|
+
t3 += v1 << 8;
|
|
173
|
+
t1 += t0 >>> 16;
|
|
174
|
+
v0 = t0 & 65535;
|
|
175
|
+
t2 += t1 >>> 16;
|
|
176
|
+
v1 = t1 & 65535;
|
|
177
|
+
v3 = t3 + (t2 >>> 16) & 65535;
|
|
178
|
+
v2 = t2 & 65535;
|
|
179
|
+
}
|
|
180
|
+
return (v3 & 15) * 281474976710656 + v2 * 4294967296 + v1 * 65536 + (v0 ^ v3 >> 4);
|
|
181
|
+
};
|
|
182
|
+
const etag = (payload, weak = false) => {
|
|
183
|
+
const prefix = weak ? 'W/"' : '"';
|
|
184
|
+
return prefix + fnv1a52(payload).toString(36) + payload.length.toString(36) + '"';
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
function isRemoteImage$1(src) {
|
|
188
|
+
return /^(https?:)?\/\//.test(src);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function loadRemoteImage(src) {
|
|
192
|
+
try {
|
|
193
|
+
const res = await fetch(src);
|
|
194
|
+
if (!res.ok) {
|
|
195
|
+
return void 0;
|
|
196
|
+
}
|
|
197
|
+
return Buffer.from(await res.arrayBuffer());
|
|
198
|
+
} catch (err) {
|
|
199
|
+
console.error(err);
|
|
200
|
+
return void 0;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const get = async ({ request }) => {
|
|
204
|
+
try {
|
|
205
|
+
const url = new URL(request.url);
|
|
206
|
+
const transform = sharp_default.parseTransform(url.searchParams);
|
|
207
|
+
let inputBuffer = void 0;
|
|
208
|
+
const sourceUrl = isRemoteImage$1(transform.src) ? new URL(transform.src) : new URL(transform.src, url.origin);
|
|
209
|
+
inputBuffer = await loadRemoteImage(sourceUrl);
|
|
210
|
+
if (!inputBuffer) {
|
|
211
|
+
return new Response("Not Found", { status: 404 });
|
|
212
|
+
}
|
|
213
|
+
const { data, format } = await sharp_default.transform(inputBuffer, transform);
|
|
214
|
+
return new Response(data, {
|
|
215
|
+
status: 200,
|
|
216
|
+
headers: {
|
|
217
|
+
"Content-Type": mime.getType(format) || "",
|
|
218
|
+
"Cache-Control": "public, max-age=31536000",
|
|
219
|
+
ETag: etag(data.toString()),
|
|
220
|
+
Date: new Date().toUTCString()
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
} catch (err) {
|
|
224
|
+
console.error(err);
|
|
225
|
+
return new Response(`Server Error: ${err}`, { status: 500 });
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
const _page0 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
230
|
+
__proto__: null,
|
|
231
|
+
get
|
|
232
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
233
|
+
|
|
234
|
+
const getCMS = () => {
|
|
235
|
+
const { STOREFRONT_BASE_DIR } = process.env;
|
|
236
|
+
let baseDir;
|
|
237
|
+
if (STOREFRONT_BASE_DIR) {
|
|
238
|
+
baseDir = resolve(process.cwd(), STOREFRONT_BASE_DIR);
|
|
239
|
+
} else {
|
|
240
|
+
baseDir = process.cwd();
|
|
241
|
+
}
|
|
242
|
+
process.env.STOREFRONT_BASE_DIR = baseDir;
|
|
243
|
+
const dirContent = resolve(baseDir, 'content');
|
|
244
|
+
|
|
245
|
+
const cms = (filename) => {
|
|
246
|
+
if (filename.endsWith('/')) {
|
|
247
|
+
const dirColl = resolve(dirContent, filename);
|
|
248
|
+
return fs.readdirSync(dirColl).map((_filename) => _filename.replace('.json', ''));
|
|
249
|
+
}
|
|
250
|
+
const filepath = resolve(dirContent, `${filename}.json`);
|
|
251
|
+
return JSON.parse(fs.readFileSync(filepath, 'utf8'));
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
let settings;
|
|
255
|
+
try {
|
|
256
|
+
settings = cms('settings');
|
|
257
|
+
} catch (e) {
|
|
258
|
+
settings = {};
|
|
259
|
+
}
|
|
260
|
+
const { domain } = settings;
|
|
261
|
+
const primaryColor = settings.primary_color || '#137c5c';
|
|
262
|
+
const secondaryColor = settings.secondary_color || primaryColor;
|
|
263
|
+
|
|
264
|
+
return {
|
|
265
|
+
domain,
|
|
266
|
+
primaryColor,
|
|
267
|
+
secondaryColor,
|
|
268
|
+
settings,
|
|
269
|
+
cms,
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const _getConfig = () => {
|
|
274
|
+
const { VITE_ECOM_STORE_ID } = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true},{ECOM_STORE_ID:process.env.ECOM_STORE_ID,})) || process.env;
|
|
275
|
+
if (VITE_ECOM_STORE_ID) {
|
|
276
|
+
config.set({ storeId: Number(VITE_ECOM_STORE_ID) });
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const {
|
|
280
|
+
domain,
|
|
281
|
+
primaryColor,
|
|
282
|
+
secondaryColor,
|
|
283
|
+
settings,
|
|
284
|
+
cms,
|
|
285
|
+
} = getCMS();
|
|
286
|
+
config.set({ cmsSettings: settings });
|
|
287
|
+
|
|
288
|
+
let { storeId } = config.get();
|
|
289
|
+
if (!storeId) {
|
|
290
|
+
const configFilepath = join(process.cwd(), 'config.json');
|
|
291
|
+
try {
|
|
292
|
+
const mergeConfig = JSON.parse(readFileSync(configFilepath), 'utf8');
|
|
293
|
+
if (mergeConfig.storeId) {
|
|
294
|
+
storeId = mergeConfig.storeId;
|
|
295
|
+
config.set({ storeId });
|
|
296
|
+
}
|
|
297
|
+
} catch { /* */ }
|
|
298
|
+
}
|
|
299
|
+
const {
|
|
300
|
+
lang,
|
|
301
|
+
countryCode,
|
|
302
|
+
currency,
|
|
303
|
+
currencySymbol,
|
|
304
|
+
} = config.get();
|
|
305
|
+
|
|
306
|
+
return {
|
|
307
|
+
storeId,
|
|
308
|
+
lang,
|
|
309
|
+
countryCode,
|
|
310
|
+
currency,
|
|
311
|
+
currencySymbol,
|
|
312
|
+
domain,
|
|
313
|
+
primaryColor,
|
|
314
|
+
secondaryColor,
|
|
315
|
+
settings,
|
|
316
|
+
cms,
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
const emitter = new EventEmitter();
|
|
321
|
+
const getConfig = _getConfig;
|
|
322
|
+
if (!globalThis.api_prefetch_endpoints) {
|
|
323
|
+
globalThis.api_prefetch_endpoints = ["categories"];
|
|
324
|
+
}
|
|
325
|
+
if (!globalThis.storefront) {
|
|
326
|
+
globalThis.storefront = {
|
|
327
|
+
settings: {},
|
|
328
|
+
onLoad(callback) {
|
|
329
|
+
emitter.on("load", callback);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
const setResponseCache = (Astro, maxAge, sMaxAge) => {
|
|
334
|
+
const headerName = "Cache-Control" ;
|
|
335
|
+
let cacheControl = `public, max-age=${maxAge}, must-revalidate`;
|
|
336
|
+
if (sMaxAge) {
|
|
337
|
+
cacheControl += `, s-maxage=${sMaxAge}, stale-while-revalidate=604800`;
|
|
338
|
+
}
|
|
339
|
+
Astro.response.headers.set(headerName, cacheControl);
|
|
340
|
+
};
|
|
341
|
+
const loadPageContext = async (Astro, {
|
|
342
|
+
cmsCollection,
|
|
343
|
+
apiPrefetchEndpoints = globalThis.api_prefetch_endpoints
|
|
344
|
+
} = {}) => {
|
|
345
|
+
const startedAt = Date.now();
|
|
346
|
+
const urlPath = Astro.url.pathname;
|
|
347
|
+
const isHomepage = urlPath === "/";
|
|
348
|
+
const { slug } = Astro.params;
|
|
349
|
+
const config = getConfig();
|
|
350
|
+
globalThis.storefront.settings = config.settings;
|
|
351
|
+
let cmsContent;
|
|
352
|
+
let apiResource;
|
|
353
|
+
let apiDoc;
|
|
354
|
+
const apiState = {};
|
|
355
|
+
const apiOptions = {
|
|
356
|
+
fetch,
|
|
357
|
+
isNoAuth: true
|
|
358
|
+
};
|
|
359
|
+
const apiFetchings = [
|
|
360
|
+
null,
|
|
361
|
+
// fetch by slug
|
|
362
|
+
...apiPrefetchEndpoints.map((endpoint) => api.get(endpoint, apiOptions))
|
|
363
|
+
];
|
|
364
|
+
if (slug) {
|
|
365
|
+
if (cmsCollection) {
|
|
366
|
+
cmsContent = config.cms(`${cmsCollection}/${slug}`);
|
|
367
|
+
} else {
|
|
368
|
+
apiFetchings[0] = api.get(`slugs/${slug}`, apiOptions);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
try {
|
|
372
|
+
const [slugResponse, ...prefetchResponses] = await Promise.all(apiFetchings);
|
|
373
|
+
if (slugResponse) {
|
|
374
|
+
apiResource = slugResponse.data.resource;
|
|
375
|
+
apiDoc = slugResponse.data.doc;
|
|
376
|
+
apiState[`${apiResource}/${apiDoc._id}`] = apiDoc;
|
|
377
|
+
}
|
|
378
|
+
prefetchResponses.forEach(({ config: { endpoint }, data }) => {
|
|
379
|
+
apiState[endpoint] = data.result || data;
|
|
380
|
+
});
|
|
381
|
+
} catch (err) {
|
|
382
|
+
const error = err;
|
|
383
|
+
const status = error.statusCode || 500;
|
|
384
|
+
if (status === 404) {
|
|
385
|
+
if (urlPath.endsWith("/")) {
|
|
386
|
+
err.redirectUrl = urlPath.slice(0, -1);
|
|
387
|
+
err.astroResponse = Astro.redirect(err.redirectUrl);
|
|
388
|
+
throw err;
|
|
389
|
+
}
|
|
390
|
+
setResponseCache(Astro, 120, 300);
|
|
391
|
+
} else {
|
|
392
|
+
console.error(error);
|
|
393
|
+
setResponseCache(Astro, 30);
|
|
394
|
+
Astro.response.headers.set("X-SSR-Error", error.message);
|
|
395
|
+
}
|
|
396
|
+
Astro.response.status = status;
|
|
397
|
+
err.responseHTML = `<head>
|
|
398
|
+
<meta http-equiv="refresh" content="0;
|
|
399
|
+
url=/fallback?status=${status}&url=${encodeURIComponent(urlPath)}"/>
|
|
400
|
+
</head>
|
|
401
|
+
<body></body>`;
|
|
402
|
+
throw err;
|
|
403
|
+
}
|
|
404
|
+
Astro.response.headers.set("X-Load-Took", String(Date.now() - startedAt));
|
|
405
|
+
if (urlPath === "/fallback") {
|
|
406
|
+
setResponseCache(Astro, 3600, 86400);
|
|
407
|
+
} else if (isHomepage) {
|
|
408
|
+
setResponseCache(Astro, 180, 300);
|
|
409
|
+
} else {
|
|
410
|
+
setResponseCache(Astro, 120, 300);
|
|
411
|
+
}
|
|
412
|
+
const pageContext = {
|
|
413
|
+
...config,
|
|
414
|
+
isHomepage,
|
|
415
|
+
cmsContent,
|
|
416
|
+
apiResource,
|
|
417
|
+
apiDoc,
|
|
418
|
+
apiState
|
|
419
|
+
};
|
|
420
|
+
emitter.emit("load", pageContext);
|
|
421
|
+
return pageContext;
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
const pwaInfo = {"pwaInDevEnvironment":false,"webManifest":{"href":"/manifest.webmanifest","useCredentials":false,"linkTag":"<link rel=\"manifest\" href=\"/manifest.webmanifest\">"}};
|
|
425
|
+
|
|
426
|
+
function isRemoteImage(src) {
|
|
427
|
+
return /^(https?:)?\/\//.test(src);
|
|
428
|
+
}
|
|
429
|
+
function removeQueryString(src) {
|
|
430
|
+
const index = src.lastIndexOf("?");
|
|
431
|
+
return index > 0 ? src.substring(0, index) : src;
|
|
432
|
+
}
|
|
433
|
+
function extname(src) {
|
|
434
|
+
const base = basename(src);
|
|
435
|
+
const index = base.lastIndexOf(".");
|
|
436
|
+
if (index <= 0) {
|
|
437
|
+
return "";
|
|
438
|
+
}
|
|
439
|
+
return base.substring(index);
|
|
440
|
+
}
|
|
441
|
+
function basename(src) {
|
|
442
|
+
return removeQueryString(src.replace(/^.*[\\\/]/, ""));
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function resolveSize(transform) {
|
|
446
|
+
if (transform.width && transform.height) {
|
|
447
|
+
return transform;
|
|
448
|
+
}
|
|
449
|
+
if (!transform.width && !transform.height) {
|
|
450
|
+
throw new Error(`"width" and "height" cannot both be undefined`);
|
|
451
|
+
}
|
|
452
|
+
if (!transform.aspectRatio) {
|
|
453
|
+
throw new Error(
|
|
454
|
+
`"aspectRatio" must be included if only "${transform.width ? "width" : "height"}" is provided`
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
let aspectRatio;
|
|
458
|
+
if (typeof transform.aspectRatio === "number") {
|
|
459
|
+
aspectRatio = transform.aspectRatio;
|
|
460
|
+
} else {
|
|
461
|
+
const [width, height] = transform.aspectRatio.split(":");
|
|
462
|
+
aspectRatio = Number.parseInt(width) / Number.parseInt(height);
|
|
463
|
+
}
|
|
464
|
+
if (transform.width) {
|
|
465
|
+
return {
|
|
466
|
+
...transform,
|
|
467
|
+
width: transform.width,
|
|
468
|
+
height: Math.round(transform.width / aspectRatio)
|
|
469
|
+
};
|
|
470
|
+
} else if (transform.height) {
|
|
471
|
+
return {
|
|
472
|
+
...transform,
|
|
473
|
+
width: Math.round(transform.height * aspectRatio),
|
|
474
|
+
height: transform.height
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
return transform;
|
|
478
|
+
}
|
|
479
|
+
async function resolveTransform(input) {
|
|
480
|
+
if (typeof input.src === "string") {
|
|
481
|
+
return resolveSize(input);
|
|
482
|
+
}
|
|
483
|
+
const metadata = "then" in input.src ? (await input.src).default : input.src;
|
|
484
|
+
let { width, height, aspectRatio, background, format = metadata.format, ...rest } = input;
|
|
485
|
+
if (!width && !height) {
|
|
486
|
+
width = metadata.width;
|
|
487
|
+
height = metadata.height;
|
|
488
|
+
} else if (width) {
|
|
489
|
+
let ratio = parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
|
|
490
|
+
height = height || Math.round(width / ratio);
|
|
491
|
+
} else if (height) {
|
|
492
|
+
let ratio = parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
|
|
493
|
+
width = width || Math.round(height * ratio);
|
|
494
|
+
}
|
|
495
|
+
return {
|
|
496
|
+
...rest,
|
|
497
|
+
src: metadata.src,
|
|
498
|
+
width,
|
|
499
|
+
height,
|
|
500
|
+
aspectRatio,
|
|
501
|
+
format,
|
|
502
|
+
background
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
async function getImage$1(transform) {
|
|
506
|
+
var _a, _b, _c;
|
|
507
|
+
if (!transform.src) {
|
|
508
|
+
throw new Error("[@astrojs/image] `src` is required");
|
|
509
|
+
}
|
|
510
|
+
let loader = (_a = globalThis.astroImage) == null ? void 0 : _a.loader;
|
|
511
|
+
if (!loader) {
|
|
512
|
+
const { default: mod } = await Promise.resolve().then(() => sharp).catch(() => {
|
|
513
|
+
throw new Error(
|
|
514
|
+
"[@astrojs/image] Builtin image loader not found. (Did you remember to add the integration to your Astro config?)"
|
|
515
|
+
);
|
|
516
|
+
});
|
|
517
|
+
loader = mod;
|
|
518
|
+
globalThis.astroImage = globalThis.astroImage || {};
|
|
519
|
+
globalThis.astroImage.loader = loader;
|
|
520
|
+
}
|
|
521
|
+
const resolved = await resolveTransform(transform);
|
|
522
|
+
const attributes = await loader.getImageAttributes(resolved);
|
|
523
|
+
const isDev = (_b = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true},{SSR:true,}))) == null ? void 0 : _b.DEV;
|
|
524
|
+
const isLocalImage = !isRemoteImage(resolved.src);
|
|
525
|
+
const _loader = isDev && isLocalImage ? globalThis.astroImage.defaultLoader : loader;
|
|
526
|
+
if (!_loader) {
|
|
527
|
+
throw new Error("@astrojs/image: loader not found!");
|
|
528
|
+
}
|
|
529
|
+
const { searchParams } = isSSRService(_loader) ? _loader.serializeTransform(resolved) : globalThis.astroImage.defaultLoader.serializeTransform(resolved);
|
|
530
|
+
const imgSrc = !isLocalImage && resolved.src.startsWith("//") ? `https:${resolved.src}` : resolved.src;
|
|
531
|
+
let src;
|
|
532
|
+
if (/^[\/\\]?@astroimage/.test(imgSrc)) {
|
|
533
|
+
src = `${imgSrc}?${searchParams.toString()}`;
|
|
534
|
+
} else {
|
|
535
|
+
searchParams.set("href", imgSrc);
|
|
536
|
+
src = `/_image?${searchParams.toString()}`;
|
|
537
|
+
}
|
|
538
|
+
if ((_c = globalThis.astroImage) == null ? void 0 : _c.addStaticImage) {
|
|
539
|
+
src = globalThis.astroImage.addStaticImage(resolved);
|
|
540
|
+
}
|
|
541
|
+
return {
|
|
542
|
+
...attributes,
|
|
543
|
+
src
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
async function resolveAspectRatio({ src, aspectRatio }) {
|
|
548
|
+
if (typeof src === "string") {
|
|
549
|
+
return parseAspectRatio(aspectRatio);
|
|
550
|
+
} else {
|
|
551
|
+
const metadata = "then" in src ? (await src).default : src;
|
|
552
|
+
return parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
async function resolveFormats({ src, formats }) {
|
|
556
|
+
const unique = new Set(formats);
|
|
557
|
+
if (typeof src === "string") {
|
|
558
|
+
unique.add(extname(src).replace(".", ""));
|
|
559
|
+
} else {
|
|
560
|
+
const metadata = "then" in src ? (await src).default : src;
|
|
561
|
+
unique.add(extname(metadata.src).replace(".", ""));
|
|
562
|
+
}
|
|
563
|
+
return Array.from(unique).filter(Boolean);
|
|
564
|
+
}
|
|
565
|
+
async function getPicture(params) {
|
|
566
|
+
const { src, alt, widths, fit, position, background } = params;
|
|
567
|
+
if (!src) {
|
|
568
|
+
throw new Error("[@astrojs/image] `src` is required");
|
|
569
|
+
}
|
|
570
|
+
if (!widths || !Array.isArray(widths)) {
|
|
571
|
+
throw new Error("[@astrojs/image] at least one `width` is required");
|
|
572
|
+
}
|
|
573
|
+
const aspectRatio = await resolveAspectRatio(params);
|
|
574
|
+
if (!aspectRatio) {
|
|
575
|
+
throw new Error("`aspectRatio` must be provided for remote images");
|
|
576
|
+
}
|
|
577
|
+
const allFormats = await resolveFormats(params);
|
|
578
|
+
const lastFormat = allFormats[allFormats.length - 1];
|
|
579
|
+
const maxWidth = Math.max(...widths);
|
|
580
|
+
let image;
|
|
581
|
+
async function getSource(format) {
|
|
582
|
+
const imgs = await Promise.all(
|
|
583
|
+
widths.map(async (width) => {
|
|
584
|
+
const img = await getImage$1({
|
|
585
|
+
src,
|
|
586
|
+
alt,
|
|
587
|
+
format,
|
|
588
|
+
width,
|
|
589
|
+
fit,
|
|
590
|
+
position,
|
|
591
|
+
background,
|
|
592
|
+
aspectRatio
|
|
593
|
+
});
|
|
594
|
+
if (format === lastFormat && width === maxWidth) {
|
|
595
|
+
image = img;
|
|
596
|
+
}
|
|
597
|
+
return `${img.src} ${width}w`;
|
|
598
|
+
})
|
|
599
|
+
);
|
|
600
|
+
return {
|
|
601
|
+
type: mime.getType(format) || format,
|
|
602
|
+
srcset: imgs.join(",")
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
const sources = await Promise.all(allFormats.map((format) => getSource(format)));
|
|
606
|
+
return {
|
|
607
|
+
sources,
|
|
608
|
+
image
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const tryImageSize = (src) => {
|
|
613
|
+
let dimensions = {};
|
|
614
|
+
if (typeof src === "string" && src.startsWith("/")) {
|
|
615
|
+
const { STOREFRONT_BASE_DIR } = Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true}, { STOREFRONT_BASE_DIR: process.env.STOREFRONT_BASE_DIR });
|
|
616
|
+
try {
|
|
617
|
+
dimensions = sizeOf(resolve$1(STOREFRONT_BASE_DIR, `public${src}`));
|
|
618
|
+
} catch (e) {
|
|
619
|
+
dimensions = {};
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
return dimensions;
|
|
623
|
+
};
|
|
624
|
+
const getAspectRatio = (src) => {
|
|
625
|
+
if (typeof src === "string") {
|
|
626
|
+
src = tryImageSize(src);
|
|
627
|
+
}
|
|
628
|
+
if (src.width) {
|
|
629
|
+
return src.height ? src.width / src.height : 1;
|
|
630
|
+
}
|
|
631
|
+
return 0;
|
|
632
|
+
};
|
|
633
|
+
const getImage = async (options) => {
|
|
634
|
+
if (!options.isLowResolution) {
|
|
635
|
+
if (options.width) {
|
|
636
|
+
options.width *= 2;
|
|
637
|
+
}
|
|
638
|
+
if (options.height) {
|
|
639
|
+
options.height *= 2;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
if (typeof options.src === "string" && !options.aspectRatio && (!options.width || !options.height)) {
|
|
643
|
+
const { width, height } = tryImageSize(options.src);
|
|
644
|
+
if (width) {
|
|
645
|
+
if (!options.width) {
|
|
646
|
+
options.width = width;
|
|
647
|
+
}
|
|
648
|
+
options.aspectRatio = getAspectRatio({ width, height });
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
const imgAttrs = await getImage$1({ alt: "", ...options });
|
|
652
|
+
imgAttrs.src += imgAttrs.src.includes("?") ? "&" : "?";
|
|
653
|
+
imgAttrs.src += `V=${({}).DEPLOY_RAND || "_"}`;
|
|
654
|
+
if (typeof imgAttrs.width === "number") {
|
|
655
|
+
imgAttrs.width /= 2;
|
|
656
|
+
}
|
|
657
|
+
if (typeof imgAttrs.height === "number") {
|
|
658
|
+
imgAttrs.height /= 2;
|
|
659
|
+
}
|
|
660
|
+
return imgAttrs;
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
const $$Astro$g = createAstro("https://ecom2-002.web.app");
|
|
664
|
+
const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
|
|
665
|
+
const Astro2 = $$result.createAstro($$Astro$g, $$props, $$slots);
|
|
666
|
+
Astro2.self = $$BaseHead;
|
|
667
|
+
const {
|
|
668
|
+
storeId,
|
|
669
|
+
cmsContent,
|
|
670
|
+
apiDoc,
|
|
671
|
+
lang,
|
|
672
|
+
domain,
|
|
673
|
+
primaryColor,
|
|
674
|
+
settings,
|
|
675
|
+
cms
|
|
676
|
+
} = Astro2.props.pageContext;
|
|
677
|
+
const state = apiDoc || cmsContent || {};
|
|
678
|
+
const title = state.meta_title || state.name || state.title || Astro2.props.title || settings.name;
|
|
679
|
+
const description = state.meta_description || state.short_description || settings.description;
|
|
680
|
+
const favicon = settings.icon ? (await getImage({
|
|
681
|
+
src: settings.icon,
|
|
682
|
+
width: 32,
|
|
683
|
+
height: 32,
|
|
684
|
+
format: "png",
|
|
685
|
+
isLowResolution: true
|
|
686
|
+
})).src : "/favicon.ico";
|
|
687
|
+
const canonicalUrl = new URL(Astro2.url.pathname, Astro2.site || `https://${domain}`);
|
|
688
|
+
const cmsSocial = cms("social");
|
|
689
|
+
const ogLocale = lang.length === 2 ? lang : lang.substring(0, 2) + lang.slice(3).toUpperCase();
|
|
690
|
+
let ogImage;
|
|
691
|
+
if (apiDoc) {
|
|
692
|
+
const picture = img(state, null, "zoom");
|
|
693
|
+
ogImage = picture && picture.url;
|
|
694
|
+
}
|
|
695
|
+
if (!ogImage) {
|
|
696
|
+
if (cmsSocial.og_image) {
|
|
697
|
+
ogImage = cmsSocial.og_image.charAt(0) === "/" ? `https://${domain}${cmsSocial.og_image}` : cmsSocial.og_image;
|
|
698
|
+
}
|
|
699
|
+
} else {
|
|
700
|
+
ogImage = ogImage.replace(/(\w+\.)?(ecoms\d)\.com/i, "$2-nyc3.nyc3.cdn.digitaloceanspaces.com");
|
|
701
|
+
}
|
|
702
|
+
return renderTemplate`<meta charset="UTF-8">
|
|
703
|
+
<meta name="viewport" content="width=device-width">
|
|
704
|
+
<meta name="theme-color"${addAttribute(primaryColor, "content")}>
|
|
705
|
+
<link rel="icon"${addAttribute(favicon, "href")}>
|
|
706
|
+
<title>${title}</title>
|
|
707
|
+
<meta name="description"${addAttribute(description, "content")}>
|
|
708
|
+
<meta name="author"${addAttribute(settings.name, "content")}>
|
|
709
|
+
<meta name="generator"${addAttribute(Astro2.generator, "content")}>
|
|
710
|
+
<link rel="canonical"${addAttribute(canonicalUrl, "href")}>
|
|
711
|
+
<link rel="apple-touch-icon"${addAttribute(settings.icon, "href")}>
|
|
712
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
713
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
714
|
+
<meta property="og:site_name"${addAttribute(settings.name, "content")}>
|
|
715
|
+
<meta property="og:url"${addAttribute(canonicalUrl, "content")}>
|
|
716
|
+
<meta property="og:title"${addAttribute(title, "content")}>
|
|
717
|
+
<meta property="og:description"${addAttribute(description, "content")}>
|
|
718
|
+
<meta property="og:type" content="website">
|
|
719
|
+
<meta property="og:locale"${addAttribute(ogLocale, "content")}>
|
|
720
|
+
${ogImage && renderTemplate`<meta property="og:image"${addAttribute(ogImage, "content")}>`}
|
|
721
|
+
${cmsSocial.fb_app_id && renderTemplate`<meta property="fb:app_id"${addAttribute(cmsSocial.fb_app_id, "content")}>`}
|
|
722
|
+
<meta name="twitter:card" content="summary">
|
|
723
|
+
${cmsSocial.twitter_username && renderTemplate`<meta name="twitter:site"${addAttribute(cmsSocial.twitter_username, "content")}>`}
|
|
724
|
+
<meta name="ecom-store-id"${addAttribute(String(storeId), "content")}>
|
|
725
|
+
${pwaInfo && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(pwaInfo.webManifest.linkTag)}` })}`}
|
|
726
|
+
`;
|
|
727
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro");
|
|
728
|
+
|
|
729
|
+
var __freeze$1 = Object.freeze;
|
|
730
|
+
var __defProp$1 = Object.defineProperty;
|
|
731
|
+
var __template$1 = (cooked, raw) => __freeze$1(__defProp$1(cooked, "raw", { value: __freeze$1(raw || cooked.slice()) }));
|
|
732
|
+
var _a$1;
|
|
733
|
+
const $$Astro$f = createAstro("https://ecom2-002.web.app");
|
|
734
|
+
const $$BaseStateJson = createComponent(async ($$result, $$props, $$slots) => {
|
|
735
|
+
const Astro2 = $$result.createAstro($$Astro$f, $$props, $$slots);
|
|
736
|
+
Astro2.self = $$BaseStateJson;
|
|
737
|
+
const {
|
|
738
|
+
pageContext: {
|
|
739
|
+
storeId,
|
|
740
|
+
apiResource,
|
|
741
|
+
apiDoc,
|
|
742
|
+
lang,
|
|
743
|
+
countryCode,
|
|
744
|
+
currency,
|
|
745
|
+
currencySymbol,
|
|
746
|
+
domain,
|
|
747
|
+
settings
|
|
748
|
+
}
|
|
749
|
+
} = Astro2.props;
|
|
750
|
+
let inlineClientJS = `
|
|
751
|
+
window.ECOM_STORE_ID = ${storeId};
|
|
752
|
+
window.ECOM_LANG = '${lang}';
|
|
753
|
+
window.ECOM_CURRENCY = '${currency}';
|
|
754
|
+
window.ECOM_CURRENCY_SYMBOL = '${currencySymbol}';
|
|
755
|
+
window.ECOM_COUNTRY_CODE = '${countryCode}';
|
|
756
|
+
window.storefront = ${JSON.stringify({ settings })};`;
|
|
757
|
+
if (apiDoc) {
|
|
758
|
+
if (typeof apiDoc.price === "number") {
|
|
759
|
+
apiDoc.price = price(apiDoc);
|
|
760
|
+
}
|
|
761
|
+
const slimDocRegex = globalThis.storefront_slim_doc_regex || /body|meta|records|description|i18n/;
|
|
762
|
+
const minifyApiDoc = (nestedDoc) => {
|
|
763
|
+
if (typeof nestedDoc === "object" && nestedDoc) {
|
|
764
|
+
if (Array.isArray(nestedDoc)) {
|
|
765
|
+
nestedDoc.forEach((item) => minifyApiDoc(item));
|
|
766
|
+
} else {
|
|
767
|
+
Object.keys(nestedDoc).forEach((field) => {
|
|
768
|
+
if (slimDocRegex.test(field)) {
|
|
769
|
+
delete nestedDoc[field];
|
|
770
|
+
} else {
|
|
771
|
+
minifyApiDoc(nestedDoc[field]);
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
return nestedDoc;
|
|
777
|
+
};
|
|
778
|
+
inlineClientJS += `
|
|
779
|
+
window.storefront.context = ${JSON.stringify({
|
|
780
|
+
resource: apiResource,
|
|
781
|
+
doc: minifyApiDoc({ ...apiDoc }),
|
|
782
|
+
timestamp: Date.now()
|
|
783
|
+
})};`;
|
|
784
|
+
}
|
|
785
|
+
const inlineJSONLd = JSON.stringify({
|
|
786
|
+
"@context": "http://schema.org",
|
|
787
|
+
"@type": "Organization",
|
|
788
|
+
name: settings.name,
|
|
789
|
+
url: `https://${domain}/`,
|
|
790
|
+
logo: `https://${domain}${settings.logo}`
|
|
791
|
+
});
|
|
792
|
+
return renderTemplate(_a$1 || (_a$1 = __template$1(["<script>", '<\/script>\n<script type="application/ld+json">', "<\/script>"])), unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd));
|
|
793
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseStateJson.astro");
|
|
794
|
+
|
|
795
|
+
const $$Astro$e = createAstro("https://ecom2-002.web.app");
|
|
796
|
+
const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
|
|
797
|
+
const Astro2 = $$result.createAstro($$Astro$e, $$props, $$slots);
|
|
798
|
+
Astro2.self = $$BaseBody;
|
|
799
|
+
return renderTemplate`${maybeRenderHead($$result)}<body>
|
|
800
|
+
${renderSlot($$result, $$slots["default"])}
|
|
801
|
+
${renderSlot($$result, $$slots["before-body-end"])}
|
|
802
|
+
<div id="teleported"></div>
|
|
803
|
+
</body>`;
|
|
804
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro");
|
|
805
|
+
|
|
806
|
+
const $$Astro$d = createAstro("https://ecom2-002.web.app");
|
|
807
|
+
const $$Base$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
808
|
+
const Astro2 = $$result.createAstro($$Astro$d, $$props, $$slots);
|
|
809
|
+
Astro2.self = $$Base$1;
|
|
810
|
+
const { pageContext, title } = Astro2.props;
|
|
811
|
+
const { cms } = pageContext;
|
|
812
|
+
const cmsCustomCode = cms("code");
|
|
813
|
+
return renderTemplate`<head>
|
|
814
|
+
${renderComponent($$result, "BaseHead", $$BaseHead, { "pageContext": pageContext, "title": title })}
|
|
815
|
+
${renderComponent($$result, "BaseStateJson", $$BaseStateJson, { "pageContext": pageContext })}
|
|
816
|
+
${cmsCustomCode.css && renderTemplate`<style>{cmsCustomCode.css}</style>`}
|
|
817
|
+
${cmsCustomCode.html_head && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(cmsCustomCode.html_head)}` })}`}
|
|
818
|
+
${renderSlot($$result, $$slots["base-head-scripts"])}
|
|
819
|
+
${renderSlot($$result, $$slots["before-head-end"])}
|
|
820
|
+
${renderHead($$result)}</head>
|
|
821
|
+
${renderComponent($$result, "BaseBody", $$BaseBody, { "pageContext": pageContext }, { "default": () => renderTemplate`${renderSlot($$result, $$slots["default"])}${cmsCustomCode.html_body && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(cmsCustomCode.html_body)}` })}`}${renderSlot($$result, $$slots["base-body-scripts"])}${renderSlot($$result, $$slots["before-body-end"])}` })}`;
|
|
822
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro");
|
|
823
|
+
|
|
824
|
+
var __freeze = Object.freeze;
|
|
825
|
+
var __defProp = Object.defineProperty;
|
|
826
|
+
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
|
827
|
+
var _a;
|
|
828
|
+
const $$Astro$c = createAstro("https://ecom2-002.web.app");
|
|
829
|
+
const $$InlineScripts = createComponent(async ($$result, $$props, $$slots) => {
|
|
830
|
+
const Astro2 = $$result.createAstro($$Astro$c, $$props, $$slots);
|
|
831
|
+
Astro2.self = $$InlineScripts;
|
|
832
|
+
return renderTemplate(_a || (_a = __template(["<script>\n window.firebaseConfig = {\n apiKey: 'AIzaSyCrVzemDgpyp9i6ni7Yc5ZuEVfXYwl-4J0',\n authDomain: 'ecom2-002.firebaseapp.com',\n projectId: 'ecom2-002',\n storageBucket: 'ecom2-002.appspot.com',\n messagingSenderId: '402807248219',\n appId: '1:402807248219:web:cf7d57759751e74776367e',\n measurementId: 'G-SC592CE0GB',\n };\n<\/script>"])));
|
|
833
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/scripts/InlineScripts.astro");
|
|
834
|
+
|
|
835
|
+
const $$Astro$b = createAstro("https://ecom2-002.web.app");
|
|
836
|
+
const $$Base = createComponent(async ($$result, $$props, $$slots) => {
|
|
837
|
+
const Astro2 = $$result.createAstro($$Astro$b, $$props, $$slots);
|
|
838
|
+
Astro2.self = $$Base;
|
|
839
|
+
const { pageContext, title } = Astro2.props;
|
|
840
|
+
return renderTemplate`${renderComponent($$result, "Base", $$Base$1, { "pageContext": pageContext, "title": title }, { "before-head-end": () => renderTemplate`${renderComponent($$result, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": () => renderTemplate`${renderSlot($$result, $$slots["default"])}` })}`;
|
|
841
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro");
|
|
842
|
+
|
|
843
|
+
const $$Astro$a = createAstro("https://ecom2-002.web.app");
|
|
844
|
+
const $$Image = createComponent(async ($$result, $$props, $$slots) => {
|
|
845
|
+
const Astro2 = $$result.createAstro($$Astro$a, $$props, $$slots);
|
|
846
|
+
Astro2.self = $$Image;
|
|
847
|
+
const { loading = "lazy", decoding = "async", ...props } = Astro2.props;
|
|
848
|
+
if (props.alt === void 0 || props.alt === null) {
|
|
849
|
+
warnForMissingAlt();
|
|
850
|
+
}
|
|
851
|
+
const attrs = await getImage$1(props);
|
|
852
|
+
return renderTemplate`${maybeRenderHead($$result)}<img${spreadAttributes(attrs)}${addAttribute(loading, "loading")}${addAttribute(decoding, "decoding")}>`;
|
|
853
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/@astrojs/image/components/Image.astro");
|
|
854
|
+
|
|
855
|
+
const $$Astro$9 = createAstro("https://ecom2-002.web.app");
|
|
856
|
+
const $$Picture$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
857
|
+
const Astro2 = $$result.createAstro($$Astro$9, $$props, $$slots);
|
|
858
|
+
Astro2.self = $$Picture$1;
|
|
859
|
+
const {
|
|
860
|
+
src,
|
|
861
|
+
alt,
|
|
862
|
+
sizes,
|
|
863
|
+
widths,
|
|
864
|
+
aspectRatio,
|
|
865
|
+
fit,
|
|
866
|
+
background,
|
|
867
|
+
position,
|
|
868
|
+
formats = ["avif", "webp"],
|
|
869
|
+
loading = "lazy",
|
|
870
|
+
decoding = "async",
|
|
871
|
+
...attrs
|
|
872
|
+
} = Astro2.props;
|
|
873
|
+
if (alt === void 0 || alt === null) {
|
|
874
|
+
warnForMissingAlt();
|
|
875
|
+
}
|
|
876
|
+
const { image, sources } = await getPicture({
|
|
877
|
+
src,
|
|
878
|
+
widths,
|
|
879
|
+
formats,
|
|
880
|
+
aspectRatio,
|
|
881
|
+
fit,
|
|
882
|
+
background,
|
|
883
|
+
position,
|
|
884
|
+
alt
|
|
885
|
+
});
|
|
886
|
+
delete image.width;
|
|
887
|
+
delete image.height;
|
|
888
|
+
return renderTemplate`${maybeRenderHead($$result)}<picture>
|
|
889
|
+
${sources.map((attrs2) => renderTemplate`<source${spreadAttributes(attrs2)}${addAttribute(sizes, "sizes")}>`)}
|
|
890
|
+
<img${spreadAttributes(image)}${addAttribute(loading, "loading")}${addAttribute(decoding, "decoding")}${addAttribute(alt, "alt")}${spreadAttributes(attrs)}>
|
|
891
|
+
</picture>`;
|
|
892
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/@astrojs/image/components/Picture.astro");
|
|
893
|
+
|
|
894
|
+
let altWarningShown = false;
|
|
895
|
+
function warnForMissingAlt() {
|
|
896
|
+
if (altWarningShown === true) {
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
altWarningShown = true;
|
|
900
|
+
console.warn(`
|
|
901
|
+
[@astrojs/image] "alt" text was not provided for an <Image> or <Picture> component.
|
|
902
|
+
|
|
903
|
+
A future release of @astrojs/image may throw a build error when "alt" text is missing.
|
|
904
|
+
|
|
905
|
+
The "alt" attribute holds a text description of the image, which isn't mandatory but is incredibly useful for accessibility. Set to an empty string (alt="") if the image is not a key part of the content (it's decoration or a tracking pixel).
|
|
906
|
+
`);
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
const $$Astro$8 = createAstro("https://ecom2-002.web.app");
|
|
910
|
+
const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
|
|
911
|
+
const Astro2 = $$result.createAstro($$Astro$8, $$props, $$slots);
|
|
912
|
+
Astro2.self = $$Picture;
|
|
913
|
+
const props = Astro2.props;
|
|
914
|
+
if (!props.aspectRatio && typeof props.src === "string") {
|
|
915
|
+
props.aspectRatio = getAspectRatio(props.src);
|
|
916
|
+
}
|
|
917
|
+
return renderTemplate`${renderComponent($$result, "Picture", $$Picture$1, { ...props })}`;
|
|
918
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/ssr/Picture.astro");
|
|
919
|
+
|
|
920
|
+
const checkObjNotNull = (obj) => {
|
|
921
|
+
return Object.values(obj).filter((val) => val).length;
|
|
922
|
+
};
|
|
923
|
+
const getModulesInfoPreset = (settingsModules = globalThis.storefront.settings.modules) => {
|
|
924
|
+
const modulesInfoPreset = {};
|
|
925
|
+
if (settingsModules) {
|
|
926
|
+
const settingsPayments = settingsModules.list_payments;
|
|
927
|
+
if (settingsPayments) {
|
|
928
|
+
const settingsDiscount = settingsPayments.discount_option;
|
|
929
|
+
if (settingsDiscount && checkObjNotNull(settingsDiscount)) {
|
|
930
|
+
modulesInfoPreset.list_payments = { discount_option: settingsDiscount };
|
|
931
|
+
}
|
|
932
|
+
const settingsInstallments = settingsPayments.installments_option;
|
|
933
|
+
if (settingsInstallments?.max_number) {
|
|
934
|
+
if (!modulesInfoPreset.list_payments)
|
|
935
|
+
modulesInfoPreset.list_payments = {};
|
|
936
|
+
modulesInfoPreset.list_payments.installments_option = settingsInstallments;
|
|
937
|
+
}
|
|
938
|
+
const settingsPointsPrograms = settingsPayments.loyalty_points_programs || {};
|
|
939
|
+
if (!Object.keys(settingsPointsPrograms).length) {
|
|
940
|
+
const pointsProgram = { ...settingsPayments.loyalty_points_program };
|
|
941
|
+
if (pointsProgram?.id && pointsProgram.ratio) {
|
|
942
|
+
const { id } = pointsProgram;
|
|
943
|
+
delete pointsProgram.id;
|
|
944
|
+
settingsPointsPrograms[id] = pointsProgram;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
if (Object.keys(settingsPointsPrograms).length) {
|
|
948
|
+
if (!modulesInfoPreset.list_payments)
|
|
949
|
+
modulesInfoPreset.list_payments = {};
|
|
950
|
+
modulesInfoPreset.list_payments.loyalty_points_programs = settingsPointsPrograms;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
const settingsShipping = settingsModules.calculate_shipping;
|
|
954
|
+
if (settingsShipping && settingsShipping.free_shipping_from_value) {
|
|
955
|
+
modulesInfoPreset.calculate_shipping = settingsShipping;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
return modulesInfoPreset;
|
|
959
|
+
};
|
|
960
|
+
const loadingGlobalInfoPreset = new Promise((resolve) => {
|
|
961
|
+
{
|
|
962
|
+
global.storefront.onLoad(() => {
|
|
963
|
+
resolve(getModulesInfoPreset());
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
});
|
|
967
|
+
|
|
968
|
+
const emptyInfo = {
|
|
969
|
+
list_payments: {},
|
|
970
|
+
calculate_shipping: {},
|
|
971
|
+
apply_discount: {}
|
|
972
|
+
};
|
|
973
|
+
const modulesInfo = reactive(emptyInfo);
|
|
974
|
+
loadingGlobalInfoPreset.then((modulesInfoPreset) => {
|
|
975
|
+
Object.assign(modulesInfo, modulesInfoPreset);
|
|
976
|
+
});
|
|
977
|
+
const parsePhrase = (phrase, modName, varName, formatValue = formatMoney) => {
|
|
978
|
+
return computed(() => {
|
|
979
|
+
const searchString = `{{${varName}}}`;
|
|
980
|
+
const index = phrase.indexOf(searchString);
|
|
981
|
+
if (index > -1) {
|
|
982
|
+
const fieldValue = modulesInfo[modName][varName];
|
|
983
|
+
if (fieldValue) {
|
|
984
|
+
const replacement = formatValue(fieldValue);
|
|
985
|
+
return phrase.substring(0, index) + replacement + phrase.substring(index + searchString.length);
|
|
986
|
+
}
|
|
987
|
+
return "";
|
|
988
|
+
}
|
|
989
|
+
return phrase;
|
|
990
|
+
});
|
|
991
|
+
};
|
|
992
|
+
const parseShippingPhrase = (phrase) => {
|
|
993
|
+
return parsePhrase(phrase, "calculate_shipping", "free_shipping_from_value");
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
const carouselKey = Symbol("carousel");
|
|
997
|
+
|
|
998
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
999
|
+
__name: "CarouselControl",
|
|
1000
|
+
__ssrInlineRender: true,
|
|
1001
|
+
props: {
|
|
1002
|
+
direction: { default: 1 }
|
|
1003
|
+
},
|
|
1004
|
+
setup(__props) {
|
|
1005
|
+
inject(carouselKey);
|
|
1006
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
1007
|
+
_push(`<button${ssrRenderAttrs(mergeProps({
|
|
1008
|
+
type: "button",
|
|
1009
|
+
"aria-label": __props.direction > 0 ? "Próximo" : "Anterior",
|
|
1010
|
+
"data-carousel-control": __props.direction > 0 ? "next" : "previous"
|
|
1011
|
+
}, _attrs))}>`);
|
|
1012
|
+
ssrRenderSlot(_ctx.$slots, "default", {}, () => {
|
|
1013
|
+
_push(`<i class="${ssrRenderClass([__props.direction > 0 ? "i-chevron-right" : "i-chevron-left", "m-0"])}"></i>`);
|
|
1014
|
+
}, _push, _parent);
|
|
1015
|
+
_push(`</button>`);
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
|
|
1020
|
+
const _sfc_setup$7 = _sfc_main$7.setup;
|
|
1021
|
+
_sfc_main$7.setup = (props, ctx) => {
|
|
1022
|
+
const ssrContext = useSSRContext();
|
|
1023
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/CarouselControl.vue");
|
|
1024
|
+
return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1028
|
+
__name: "Carousel",
|
|
1029
|
+
__ssrInlineRender: true,
|
|
1030
|
+
props: {
|
|
1031
|
+
as: { default: "ul" },
|
|
1032
|
+
modelValue: { default: 1 },
|
|
1033
|
+
autoplay: null
|
|
1034
|
+
},
|
|
1035
|
+
emits: [
|
|
1036
|
+
"update:modelValue"
|
|
1037
|
+
],
|
|
1038
|
+
setup(__props, { emit }) {
|
|
1039
|
+
const props = __props;
|
|
1040
|
+
const currentIndex = ref(props.modelValue - 1);
|
|
1041
|
+
watch(toRef(props, "modelValue"), (modelValue) => {
|
|
1042
|
+
currentIndex.value = modelValue - 1;
|
|
1043
|
+
});
|
|
1044
|
+
watch(currentIndex, (current, previous) => {
|
|
1045
|
+
if (current !== previous) {
|
|
1046
|
+
emit("update:modelValue", current + 1);
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
const wrapper = ref(null);
|
|
1050
|
+
const { x: currentPos, isScrolling, arrivedState } = useScroll(wrapper);
|
|
1051
|
+
const isBoundLeft = computed(() => arrivedState.left);
|
|
1052
|
+
const isBoundRight = computed(() => arrivedState.right);
|
|
1053
|
+
const slidesWidth = ref([]);
|
|
1054
|
+
const wrapperScrollWidth = ref(0);
|
|
1055
|
+
const wrapperVisibleWidth = ref(0);
|
|
1056
|
+
const indexCount = ref(0);
|
|
1057
|
+
const calcWrapperWidth = () => {
|
|
1058
|
+
wrapperScrollWidth.value = wrapper.value.scrollWidth;
|
|
1059
|
+
wrapperVisibleWidth.value = wrapper.value.offsetWidth;
|
|
1060
|
+
};
|
|
1061
|
+
const calcSlidesWidth = () => {
|
|
1062
|
+
const childNodes = [...wrapper.value.children];
|
|
1063
|
+
slidesWidth.value = childNodes.map((node) => ({
|
|
1064
|
+
offsetLeft: node.offsetLeft,
|
|
1065
|
+
width: node.offsetWidth
|
|
1066
|
+
}));
|
|
1067
|
+
};
|
|
1068
|
+
const calcNextWidth = (direction) => {
|
|
1069
|
+
const nextSlideIndex = direction > 0 ? currentIndex.value : currentIndex.value + direction;
|
|
1070
|
+
const width = slidesWidth.value[nextSlideIndex]?.width || 0;
|
|
1071
|
+
if (!width) {
|
|
1072
|
+
return 0;
|
|
1073
|
+
}
|
|
1074
|
+
return width * direction;
|
|
1075
|
+
};
|
|
1076
|
+
const calcCurrentIndex = () => {
|
|
1077
|
+
const getCurrentIndex = slidesWidth.value.findIndex((slide) => {
|
|
1078
|
+
return Math.abs(slide.offsetLeft - currentPos.value) <= 5;
|
|
1079
|
+
});
|
|
1080
|
+
if (getCurrentIndex > -1) {
|
|
1081
|
+
currentIndex.value = getCurrentIndex || 0;
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
const calcIndexCount = () => {
|
|
1085
|
+
const maxPos = wrapperScrollWidth.value - wrapperVisibleWidth.value;
|
|
1086
|
+
indexCount.value = slidesWidth.value.findIndex(({ offsetLeft }) => offsetLeft >= maxPos - 5);
|
|
1087
|
+
};
|
|
1088
|
+
let autoplayTimer = null;
|
|
1089
|
+
const restartAutoplay = () => {
|
|
1090
|
+
if (props.autoplay) {
|
|
1091
|
+
clearTimeout(autoplayTimer);
|
|
1092
|
+
autoplayTimer = setTimeout(() => {
|
|
1093
|
+
changeSlide(1);
|
|
1094
|
+
}, props.autoplay);
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
const changeSlide = (direction) => {
|
|
1098
|
+
if (direction < 0) {
|
|
1099
|
+
if (isBoundLeft.value) {
|
|
1100
|
+
calcIndexCount();
|
|
1101
|
+
currentIndex.value = indexCount.value - 1;
|
|
1102
|
+
changeSlide(1);
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
} else if (isBoundRight.value) {
|
|
1106
|
+
currentIndex.value = 1;
|
|
1107
|
+
changeSlide(-1);
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
const nextSlideWidth = calcNextWidth(direction);
|
|
1111
|
+
if (nextSlideWidth) {
|
|
1112
|
+
wrapper.value.scrollBy({ left: nextSlideWidth, behavior: "smooth" });
|
|
1113
|
+
restartAutoplay();
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
watch(isScrolling, (_isScrolling) => {
|
|
1117
|
+
if (_isScrolling) {
|
|
1118
|
+
clearTimeout(autoplayTimer);
|
|
1119
|
+
} else {
|
|
1120
|
+
calcCurrentIndex();
|
|
1121
|
+
restartAutoplay();
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
const carousel = ref(null);
|
|
1125
|
+
const isHovered = useElementHover(carousel);
|
|
1126
|
+
watch(isHovered, (_isHovered) => {
|
|
1127
|
+
if (_isHovered) {
|
|
1128
|
+
clearTimeout(autoplayTimer);
|
|
1129
|
+
} else {
|
|
1130
|
+
restartAutoplay();
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
const calcOnInit = () => {
|
|
1134
|
+
if (!wrapper.value) {
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
calcWrapperWidth();
|
|
1138
|
+
calcSlidesWidth();
|
|
1139
|
+
calcCurrentIndex();
|
|
1140
|
+
calcIndexCount();
|
|
1141
|
+
};
|
|
1142
|
+
useDebounceFn(calcOnInit, 400);
|
|
1143
|
+
onMounted(() => {
|
|
1144
|
+
calcOnInit();
|
|
1145
|
+
});
|
|
1146
|
+
onBeforeUnmount(() => {
|
|
1147
|
+
clearTimeout(autoplayTimer);
|
|
1148
|
+
});
|
|
1149
|
+
provide(carouselKey, {
|
|
1150
|
+
autoplay: toRef(props, "autoplay"),
|
|
1151
|
+
changeSlide,
|
|
1152
|
+
isBoundLeft,
|
|
1153
|
+
isBoundRight
|
|
1154
|
+
});
|
|
1155
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
1156
|
+
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
1157
|
+
ref_key: "carousel",
|
|
1158
|
+
ref: carousel,
|
|
1159
|
+
"data-carousel": ""
|
|
1160
|
+
}, _attrs))}>`);
|
|
1161
|
+
ssrRenderVNode(_push, createVNode(resolveDynamicComponent(__props.as), {
|
|
1162
|
+
ref_key: "wrapper",
|
|
1163
|
+
ref: wrapper,
|
|
1164
|
+
"data-carousel-wrapper": ""
|
|
1165
|
+
}, {
|
|
1166
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1167
|
+
if (_push2) {
|
|
1168
|
+
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
|
|
1169
|
+
} else {
|
|
1170
|
+
return [
|
|
1171
|
+
renderSlot$1(_ctx.$slots, "default")
|
|
1172
|
+
];
|
|
1173
|
+
}
|
|
1174
|
+
}),
|
|
1175
|
+
_: 3
|
|
1176
|
+
}), _parent);
|
|
1177
|
+
ssrRenderSlot(_ctx.$slots, "controls", {
|
|
1178
|
+
changeSlide,
|
|
1179
|
+
isBoundLeft: unref(isBoundLeft),
|
|
1180
|
+
isBoundRight: unref(isBoundRight),
|
|
1181
|
+
currentPage: currentIndex.value + 1,
|
|
1182
|
+
pageCount: indexCount.value + 1
|
|
1183
|
+
}, () => {
|
|
1184
|
+
_push(ssrRenderComponent(_sfc_main$7, { direction: -1 }, {
|
|
1185
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1186
|
+
if (_push2) {
|
|
1187
|
+
ssrRenderSlot(_ctx.$slots, "previous", {}, null, _push2, _parent2, _scopeId);
|
|
1188
|
+
} else {
|
|
1189
|
+
return [
|
|
1190
|
+
renderSlot$1(_ctx.$slots, "previous")
|
|
1191
|
+
];
|
|
1192
|
+
}
|
|
1193
|
+
}),
|
|
1194
|
+
_: 3
|
|
1195
|
+
}, _parent));
|
|
1196
|
+
_push(ssrRenderComponent(_sfc_main$7, null, {
|
|
1197
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1198
|
+
if (_push2) {
|
|
1199
|
+
ssrRenderSlot(_ctx.$slots, "next", {}, null, _push2, _parent2, _scopeId);
|
|
1200
|
+
} else {
|
|
1201
|
+
return [
|
|
1202
|
+
renderSlot$1(_ctx.$slots, "next")
|
|
1203
|
+
];
|
|
1204
|
+
}
|
|
1205
|
+
}),
|
|
1206
|
+
_: 3
|
|
1207
|
+
}, _parent));
|
|
1208
|
+
}, _push, _parent);
|
|
1209
|
+
_push(`</div>`);
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
|
|
1214
|
+
const _sfc_setup$6 = _sfc_main$6.setup;
|
|
1215
|
+
_sfc_main$6.setup = (props, ctx) => {
|
|
1216
|
+
const ssrContext = useSSRContext();
|
|
1217
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Carousel.vue");
|
|
1218
|
+
return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
|
|
1219
|
+
};
|
|
1220
|
+
|
|
1221
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1222
|
+
__name: "PitchBar",
|
|
1223
|
+
__ssrInlineRender: true,
|
|
1224
|
+
props: {
|
|
1225
|
+
slides: null
|
|
1226
|
+
},
|
|
1227
|
+
setup(__props) {
|
|
1228
|
+
const props = __props;
|
|
1229
|
+
const parsedContents = computed(() => {
|
|
1230
|
+
return props.slides.map(({ html }) => {
|
|
1231
|
+
return parseShippingPhrase(html).value;
|
|
1232
|
+
});
|
|
1233
|
+
});
|
|
1234
|
+
const countValidSlides = computed(() => {
|
|
1235
|
+
return parsedContents.value.filter((html) => html).length;
|
|
1236
|
+
});
|
|
1237
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
1238
|
+
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
1239
|
+
class: "bg-base-100",
|
|
1240
|
+
"data-pitch-bar": ""
|
|
1241
|
+
}, _attrs))}><div class="container md:w-2/3 mx-auto px-3 py-1">`);
|
|
1242
|
+
_push(ssrRenderComponent(_sfc_main$6, {
|
|
1243
|
+
autoplay: unref(countValidSlides) > 1 ? 7e3 : null
|
|
1244
|
+
}, {
|
|
1245
|
+
controls: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1246
|
+
if (_push2) {
|
|
1247
|
+
ssrRenderSlot(_ctx.$slots, "controls", { countValidSlides: unref(countValidSlides) }, () => {
|
|
1248
|
+
_push2(`<div style="${ssrRenderStyle(unref(countValidSlides) > 1 ? null : { display: "none" })}" class="text-xl leading-none text-base-400" data-pitch-bar-controls${_scopeId}>`);
|
|
1249
|
+
_push2(ssrRenderComponent(_sfc_main$7, {
|
|
1250
|
+
direction: -1,
|
|
1251
|
+
class: "pr-2 bg-base-100 hover:text-base-700"
|
|
1252
|
+
}, null, _parent2, _scopeId));
|
|
1253
|
+
_push2(ssrRenderComponent(_sfc_main$7, { class: "pl-2 bg-base-100 hover:text-base-700" }, null, _parent2, _scopeId));
|
|
1254
|
+
_push2(`</div>`);
|
|
1255
|
+
}, _push2, _parent2, _scopeId);
|
|
1256
|
+
} else {
|
|
1257
|
+
return [
|
|
1258
|
+
renderSlot$1(_ctx.$slots, "controls", { countValidSlides: unref(countValidSlides) }, () => [
|
|
1259
|
+
withDirectives(createVNode("div", {
|
|
1260
|
+
class: "text-xl leading-none text-base-400",
|
|
1261
|
+
"data-pitch-bar-controls": ""
|
|
1262
|
+
}, [
|
|
1263
|
+
createVNode(_sfc_main$7, {
|
|
1264
|
+
direction: -1,
|
|
1265
|
+
class: "pr-2 bg-base-100 hover:text-base-700"
|
|
1266
|
+
}),
|
|
1267
|
+
createVNode(_sfc_main$7, { class: "pl-2 bg-base-100 hover:text-base-700" })
|
|
1268
|
+
], 512), [
|
|
1269
|
+
[vShow, unref(countValidSlides) > 1]
|
|
1270
|
+
])
|
|
1271
|
+
])
|
|
1272
|
+
];
|
|
1273
|
+
}
|
|
1274
|
+
}),
|
|
1275
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1276
|
+
if (_push2) {
|
|
1277
|
+
_push2(`<!--[-->`);
|
|
1278
|
+
ssrRenderList(__props.slides, (slide, i) => {
|
|
1279
|
+
_push2(`<li${_scopeId}>`);
|
|
1280
|
+
ssrRenderVNode(_push2, createVNode(resolveDynamicComponent(slide.href ? "ALink" : "span"), {
|
|
1281
|
+
href: slide.href,
|
|
1282
|
+
target: slide.target,
|
|
1283
|
+
class: ["inline-block px-8", slide.href ? "hover:underline" : null]
|
|
1284
|
+
}, {
|
|
1285
|
+
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
1286
|
+
if (_push3) {
|
|
1287
|
+
ssrRenderSlot(_ctx.$slots, "slide", { slide, i, parsedContents: unref(parsedContents) }, () => {
|
|
1288
|
+
if (unref(parsedContents)[i]) {
|
|
1289
|
+
_push3(`<span class="prose text-sm text-base-800" data-pitch-bar-slide${_scopeId2}>${unref(parsedContents)[i]}</span>`);
|
|
1290
|
+
} else {
|
|
1291
|
+
_push3(`<!---->`);
|
|
1292
|
+
}
|
|
1293
|
+
}, _push3, _parent3, _scopeId2);
|
|
1294
|
+
} else {
|
|
1295
|
+
return [
|
|
1296
|
+
renderSlot$1(_ctx.$slots, "slide", { slide, i, parsedContents: unref(parsedContents) }, () => [
|
|
1297
|
+
unref(parsedContents)[i] ? (openBlock(), createBlock("span", {
|
|
1298
|
+
key: 0,
|
|
1299
|
+
innerHTML: unref(parsedContents)[i],
|
|
1300
|
+
class: "prose text-sm text-base-800",
|
|
1301
|
+
"data-pitch-bar-slide": ""
|
|
1302
|
+
}, null, 8, ["innerHTML"])) : createCommentVNode("", true)
|
|
1303
|
+
])
|
|
1304
|
+
];
|
|
1305
|
+
}
|
|
1306
|
+
}),
|
|
1307
|
+
_: 2
|
|
1308
|
+
}), _parent2, _scopeId);
|
|
1309
|
+
_push2(`</li>`);
|
|
1310
|
+
});
|
|
1311
|
+
_push2(`<!--]-->`);
|
|
1312
|
+
} else {
|
|
1313
|
+
return [
|
|
1314
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(__props.slides, (slide, i) => {
|
|
1315
|
+
return openBlock(), createBlock("li", { key: i }, [
|
|
1316
|
+
(openBlock(), createBlock(resolveDynamicComponent(slide.href ? "ALink" : "span"), {
|
|
1317
|
+
href: slide.href,
|
|
1318
|
+
target: slide.target,
|
|
1319
|
+
class: ["inline-block px-8", slide.href ? "hover:underline" : null]
|
|
1320
|
+
}, {
|
|
1321
|
+
default: withCtx(() => [
|
|
1322
|
+
renderSlot$1(_ctx.$slots, "slide", { slide, i, parsedContents: unref(parsedContents) }, () => [
|
|
1323
|
+
unref(parsedContents)[i] ? (openBlock(), createBlock("span", {
|
|
1324
|
+
key: 0,
|
|
1325
|
+
innerHTML: unref(parsedContents)[i],
|
|
1326
|
+
class: "prose text-sm text-base-800",
|
|
1327
|
+
"data-pitch-bar-slide": ""
|
|
1328
|
+
}, null, 8, ["innerHTML"])) : createCommentVNode("", true)
|
|
1329
|
+
])
|
|
1330
|
+
]),
|
|
1331
|
+
_: 2
|
|
1332
|
+
}, 1032, ["href", "target", "class"]))
|
|
1333
|
+
]);
|
|
1334
|
+
}), 128))
|
|
1335
|
+
];
|
|
1336
|
+
}
|
|
1337
|
+
}),
|
|
1338
|
+
_: 3
|
|
1339
|
+
}, _parent));
|
|
1340
|
+
_push(`</div></div>`);
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
|
|
1345
|
+
const _sfc_setup$5 = _sfc_main$5.setup;
|
|
1346
|
+
_sfc_main$5.setup = (props, ctx) => {
|
|
1347
|
+
const ssrContext = useSSRContext();
|
|
1348
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/PitchBar.vue");
|
|
1349
|
+
return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
|
|
1350
|
+
};
|
|
1351
|
+
|
|
1352
|
+
const i19myAccount = "Minha conta";
|
|
1353
|
+
const i19openCart = "Abrir carrinho";
|
|
1354
|
+
const i19searchProducts = "Buscar produtos";
|
|
1355
|
+
|
|
1356
|
+
const useComponentVariant = (props, stringProps) => {
|
|
1357
|
+
return computed(() => {
|
|
1358
|
+
let variantName = "";
|
|
1359
|
+
Object.keys(props).forEach((prop) => {
|
|
1360
|
+
if (props[prop] === true && prop !== "modelValue") {
|
|
1361
|
+
variantName += ` ${prop.replace(/^(is|has)/, "")}`;
|
|
1362
|
+
} else if (stringProps && stringProps.includes(prop)) {
|
|
1363
|
+
variantName += ` ${prop}:${props[prop]}`;
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
return variantName.slice(1);
|
|
1367
|
+
});
|
|
1368
|
+
};
|
|
1369
|
+
|
|
1370
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1371
|
+
__name: "Drawer",
|
|
1372
|
+
__ssrInlineRender: true,
|
|
1373
|
+
props: {
|
|
1374
|
+
modelValue: { type: Boolean, default: false },
|
|
1375
|
+
placement: { default: "start" },
|
|
1376
|
+
isTeleported: { type: Boolean, default: false },
|
|
1377
|
+
hasCloseButton: { type: Boolean, default: true }
|
|
1378
|
+
},
|
|
1379
|
+
emits: [
|
|
1380
|
+
"update:modelValue"
|
|
1381
|
+
],
|
|
1382
|
+
setup(__props, { emit }) {
|
|
1383
|
+
const props = __props;
|
|
1384
|
+
const close = () => emit("update:modelValue", false);
|
|
1385
|
+
const anchor = ref(null);
|
|
1386
|
+
const canvas = ref(null);
|
|
1387
|
+
const outsideClickListener = (ev) => {
|
|
1388
|
+
if (!canvas.value?.contains(ev.target)) {
|
|
1389
|
+
close();
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
const escClickListener = (ev) => {
|
|
1393
|
+
if (ev.key === "Escape") {
|
|
1394
|
+
close();
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
watch(toRef(props, "modelValue"), async (isOpen) => {
|
|
1398
|
+
const header = anchor.value.closest('[class*="backdrop-"]');
|
|
1399
|
+
if (isOpen) {
|
|
1400
|
+
document.body.style.overflow = "hidden";
|
|
1401
|
+
if (header) {
|
|
1402
|
+
header.style.backdropFilter = "none";
|
|
1403
|
+
}
|
|
1404
|
+
setTimeout(() => {
|
|
1405
|
+
document.addEventListener("click", outsideClickListener, { passive: true });
|
|
1406
|
+
document.addEventListener("keydown", escClickListener, { passive: true });
|
|
1407
|
+
}, 500);
|
|
1408
|
+
} else {
|
|
1409
|
+
document.body.style.overflow = null;
|
|
1410
|
+
if (header) {
|
|
1411
|
+
setTimeout(() => {
|
|
1412
|
+
header.style.backdropFilter = null;
|
|
1413
|
+
}, 500);
|
|
1414
|
+
}
|
|
1415
|
+
document.removeEventListener("click", outsideClickListener);
|
|
1416
|
+
document.removeEventListener("keydown", escClickListener);
|
|
1417
|
+
}
|
|
1418
|
+
});
|
|
1419
|
+
const slideTo = computed(() => {
|
|
1420
|
+
switch (props.placement) {
|
|
1421
|
+
case "start":
|
|
1422
|
+
return "left";
|
|
1423
|
+
case "end":
|
|
1424
|
+
return "right";
|
|
1425
|
+
case "top":
|
|
1426
|
+
return "up";
|
|
1427
|
+
default:
|
|
1428
|
+
return "down";
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
const componentVariant = useComponentVariant(props, ["placement"]);
|
|
1432
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
1433
|
+
const _component_Fade = resolveComponent("Fade");
|
|
1434
|
+
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
1435
|
+
ref_key: "anchor",
|
|
1436
|
+
ref: anchor,
|
|
1437
|
+
class: "relative"
|
|
1438
|
+
}, _attrs))}>`);
|
|
1439
|
+
ssrRenderTeleport(_push, (_push2) => {
|
|
1440
|
+
_push2(ssrRenderComponent(_component_Fade, {
|
|
1441
|
+
slide: unref(slideTo),
|
|
1442
|
+
speed: "slow",
|
|
1443
|
+
"is-floating": ""
|
|
1444
|
+
}, {
|
|
1445
|
+
default: withCtx((_, _push3, _parent2, _scopeId) => {
|
|
1446
|
+
if (_push3) {
|
|
1447
|
+
if (__props.modelValue) {
|
|
1448
|
+
_push3(`<dialog class="${ssrRenderClass([__props.isTeleported ? "fixed top-0 left-0" : "absolute", "w-screen max-w-sm p-0 z-50"])}"${ssrIncludeBooleanAttr(__props.modelValue) ? " open" : ""}${ssrRenderAttr("data-drawer", unref(componentVariant))}${_scopeId}><div class="relative"${_scopeId}>`);
|
|
1449
|
+
if (__props.hasCloseButton) {
|
|
1450
|
+
_push3(`<button type="button"${ssrRenderAttr("aria-label", "Fechar")} class="${ssrRenderClass([__props.placement === "end" ? "left-2" : "right-2", "absolute top-2"])}" data-drawer-close${_scopeId}>`);
|
|
1451
|
+
ssrRenderSlot(_ctx.$slots, "close", {}, () => {
|
|
1452
|
+
_push3(`<i class="i-close text-base-400 text-3xl"${_scopeId}></i>`);
|
|
1453
|
+
}, _push3, _parent2, _scopeId);
|
|
1454
|
+
_push3(`</button>`);
|
|
1455
|
+
} else {
|
|
1456
|
+
_push3(`<!---->`);
|
|
1457
|
+
}
|
|
1458
|
+
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push3, _parent2, _scopeId);
|
|
1459
|
+
_push3(`</div></dialog>`);
|
|
1460
|
+
} else {
|
|
1461
|
+
_push3(`<!---->`);
|
|
1462
|
+
}
|
|
1463
|
+
} else {
|
|
1464
|
+
return [
|
|
1465
|
+
__props.modelValue ? (openBlock(), createBlock("dialog", {
|
|
1466
|
+
key: 0,
|
|
1467
|
+
class: ["w-screen max-w-sm p-0 z-50", __props.isTeleported ? "fixed top-0 left-0" : "absolute"],
|
|
1468
|
+
open: __props.modelValue,
|
|
1469
|
+
"data-drawer": unref(componentVariant)
|
|
1470
|
+
}, [
|
|
1471
|
+
createVNode("div", {
|
|
1472
|
+
ref_key: "canvas",
|
|
1473
|
+
ref: canvas,
|
|
1474
|
+
class: "relative"
|
|
1475
|
+
}, [
|
|
1476
|
+
__props.hasCloseButton ? (openBlock(), createBlock("button", {
|
|
1477
|
+
key: 0,
|
|
1478
|
+
type: "button",
|
|
1479
|
+
"aria-label": "Fechar",
|
|
1480
|
+
onClick: withModifiers(close, ["prevent"]),
|
|
1481
|
+
class: ["absolute top-2", __props.placement === "end" ? "left-2" : "right-2"],
|
|
1482
|
+
"data-drawer-close": ""
|
|
1483
|
+
}, [
|
|
1484
|
+
renderSlot$1(_ctx.$slots, "close", {}, () => [
|
|
1485
|
+
createVNode("i", { class: "i-close text-base-400 text-3xl" })
|
|
1486
|
+
])
|
|
1487
|
+
], 10, ["onClick"])) : createCommentVNode("", true),
|
|
1488
|
+
renderSlot$1(_ctx.$slots, "default")
|
|
1489
|
+
], 512)
|
|
1490
|
+
], 10, ["open", "data-drawer"])) : createCommentVNode("", true)
|
|
1491
|
+
];
|
|
1492
|
+
}
|
|
1493
|
+
}),
|
|
1494
|
+
_: 3
|
|
1495
|
+
}, _parent));
|
|
1496
|
+
}, "#teleported", !__props.isTeleported, _parent);
|
|
1497
|
+
_push(`</div>`);
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
});
|
|
1501
|
+
|
|
1502
|
+
const _sfc_setup$4 = _sfc_main$4.setup;
|
|
1503
|
+
_sfc_main$4.setup = (props, ctx) => {
|
|
1504
|
+
const ssrContext = useSSRContext();
|
|
1505
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Drawer.vue");
|
|
1506
|
+
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
|
|
1507
|
+
};
|
|
1508
|
+
|
|
1509
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1510
|
+
__name: "StickyHeader",
|
|
1511
|
+
__ssrInlineRender: true,
|
|
1512
|
+
props: {
|
|
1513
|
+
isShownOnScrollDown: { type: Boolean }
|
|
1514
|
+
},
|
|
1515
|
+
setup(__props) {
|
|
1516
|
+
const props = __props;
|
|
1517
|
+
ref(null);
|
|
1518
|
+
const { ready, start } = useTimeout(100, { controls: true, immediate: false });
|
|
1519
|
+
const height = ref(0);
|
|
1520
|
+
const { y } = { y: ref(0) };
|
|
1521
|
+
const isSticky = computed(() => ready.value && y.value > height.value * 1.5);
|
|
1522
|
+
const transition = ref("none");
|
|
1523
|
+
watch(isSticky, async (isSetSticky) => {
|
|
1524
|
+
if (!isSetSticky) {
|
|
1525
|
+
start();
|
|
1526
|
+
transition.value = "none";
|
|
1527
|
+
} else {
|
|
1528
|
+
await promiseTimeout(300);
|
|
1529
|
+
transition.value = "opacity var(--transition-slow), transform var(--transition)";
|
|
1530
|
+
}
|
|
1531
|
+
});
|
|
1532
|
+
const isScrollUp = ref(false);
|
|
1533
|
+
watch(y, (newY, oldY) => {
|
|
1534
|
+
isScrollUp.value = newY > 0 && newY < oldY;
|
|
1535
|
+
});
|
|
1536
|
+
const componentVariant = useComponentVariant(reactive({
|
|
1537
|
+
...props,
|
|
1538
|
+
isSticky,
|
|
1539
|
+
isScrollUp
|
|
1540
|
+
}));
|
|
1541
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
1542
|
+
_push(`<!--[--><div style="${ssrRenderStyle(unref(isSticky) ? `height: ${height.value}px` : null)}"></div><header class="${ssrRenderClass([{
|
|
1543
|
+
"sticky bg-white/80 backdrop-blur-md shadow py-2 md:py-3": unref(isSticky),
|
|
1544
|
+
"opacity-0 -translate-y-full": unref(isSticky) && (!isScrollUp.value || __props.isShownOnScrollDown),
|
|
1545
|
+
"py-3 sm:py-4 md:py-5": !unref(isSticky)
|
|
1546
|
+
}, "z-50 top-0 will-change-transform"])}" style="${ssrRenderStyle({ transition: transition.value })}"${ssrRenderAttr("data-sticky-header", unref(componentVariant))}>`);
|
|
1547
|
+
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
|
|
1548
|
+
_push(`</header><!--]-->`);
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
});
|
|
1552
|
+
|
|
1553
|
+
const _sfc_setup$3 = _sfc_main$3.setup;
|
|
1554
|
+
_sfc_main$3.setup = (props, ctx) => {
|
|
1555
|
+
const ssrContext = useSSRContext();
|
|
1556
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/StickyHeader.vue");
|
|
1557
|
+
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1561
|
+
__name: "ShopHeader",
|
|
1562
|
+
__ssrInlineRender: true,
|
|
1563
|
+
setup(__props) {
|
|
1564
|
+
const buttons = ref({
|
|
1565
|
+
search: {
|
|
1566
|
+
icon: "i-search",
|
|
1567
|
+
onClick: () => {
|
|
1568
|
+
},
|
|
1569
|
+
label: i19searchProducts
|
|
1570
|
+
},
|
|
1571
|
+
account: {
|
|
1572
|
+
icon: "i-account",
|
|
1573
|
+
onClick: () => {
|
|
1574
|
+
},
|
|
1575
|
+
label: i19myAccount
|
|
1576
|
+
},
|
|
1577
|
+
cart: {
|
|
1578
|
+
icon: "i-shopping-cart",
|
|
1579
|
+
onClick: () => {
|
|
1580
|
+
},
|
|
1581
|
+
label: i19openCart
|
|
1582
|
+
}
|
|
1583
|
+
});
|
|
1584
|
+
const isSidenavOpen = ref(false);
|
|
1585
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
1586
|
+
_push(ssrRenderComponent(_sfc_main$3, _attrs, {
|
|
1587
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1588
|
+
if (_push2) {
|
|
1589
|
+
_push2(`<div class="container lg:max-w-7xl mx-auto px-1 lg:pl-3 grid grid-flow-col grid-cols-3 justify-between items-center md:grid-cols-none md:auto-cols-max" data-header${_scopeId}>`);
|
|
1590
|
+
ssrRenderSlot(_ctx.$slots, "sidenav-toggle", {}, () => {
|
|
1591
|
+
_push2(`<div class="md:hidden" data-sidenav-toggle${_scopeId}><button class="px-2 my-1"${ssrRenderAttr("aria-label", "Abrir/fechar menu")}${_scopeId}>`);
|
|
1592
|
+
ssrRenderSlot(_ctx.$slots, "sidenav-toggle-content", {}, () => {
|
|
1593
|
+
_push2(`<i class="i-menu text-base-500 text-3xl"${_scopeId}></i>`);
|
|
1594
|
+
}, _push2, _parent2, _scopeId);
|
|
1595
|
+
_push2(`</button>`);
|
|
1596
|
+
_push2(ssrRenderComponent(_sfc_main$4, {
|
|
1597
|
+
modelValue: isSidenavOpen.value,
|
|
1598
|
+
"onUpdate:modelValue": ($event) => isSidenavOpen.value = $event,
|
|
1599
|
+
class: "-ml-1 lg:-ml-3"
|
|
1600
|
+
}, {
|
|
1601
|
+
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
1602
|
+
if (_push3) {
|
|
1603
|
+
_push3(` MENU `);
|
|
1604
|
+
} else {
|
|
1605
|
+
return [
|
|
1606
|
+
createTextVNode(" MENU ")
|
|
1607
|
+
];
|
|
1608
|
+
}
|
|
1609
|
+
}),
|
|
1610
|
+
_: 1
|
|
1611
|
+
}, _parent2, _scopeId));
|
|
1612
|
+
_push2(`</div>`);
|
|
1613
|
+
}, _push2, _parent2, _scopeId);
|
|
1614
|
+
ssrRenderSlot(_ctx.$slots, "logo", {}, null, _push2, _parent2, _scopeId);
|
|
1615
|
+
ssrRenderSlot(_ctx.$slots, "nav", {}, null, _push2, _parent2, _scopeId);
|
|
1616
|
+
ssrRenderSlot(_ctx.$slots, "buttons", {}, () => {
|
|
1617
|
+
_push2(`<div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800" data-header-buttons${_scopeId}><!--[-->`);
|
|
1618
|
+
ssrRenderList(buttons.value, ({ icon, onClick, label }, name) => {
|
|
1619
|
+
ssrRenderSlot(_ctx.$slots, "button", mergeProps({ key: name }, { name, icon, onClick }), () => {
|
|
1620
|
+
_push2(`<button class="${ssrRenderClass(name === "account" ? "hidden sm:block" : null)}"${ssrRenderAttr("aria-label", label)}${ssrRenderAttr("data-header-button", name)}${_scopeId}>`);
|
|
1621
|
+
ssrRenderSlot(_ctx.$slots, "button-content", { name, icon }, () => {
|
|
1622
|
+
_push2(`<i class="${ssrRenderClass([icon, "hover:text-primary w-7 h-7 hover:scale-110 active:scale-125"])}"${_scopeId}></i>`);
|
|
1623
|
+
}, _push2, _parent2, _scopeId);
|
|
1624
|
+
_push2(`</button>`);
|
|
1625
|
+
}, _push2, _parent2, _scopeId);
|
|
1626
|
+
});
|
|
1627
|
+
_push2(`<!--]--></div>`);
|
|
1628
|
+
}, _push2, _parent2, _scopeId);
|
|
1629
|
+
_push2(`</div>`);
|
|
1630
|
+
} else {
|
|
1631
|
+
return [
|
|
1632
|
+
createVNode("div", {
|
|
1633
|
+
class: "container lg:max-w-7xl mx-auto px-1 lg:pl-3 grid grid-flow-col grid-cols-3 justify-between items-center md:grid-cols-none md:auto-cols-max",
|
|
1634
|
+
"data-header": ""
|
|
1635
|
+
}, [
|
|
1636
|
+
renderSlot$1(_ctx.$slots, "sidenav-toggle", {}, () => [
|
|
1637
|
+
createVNode("div", {
|
|
1638
|
+
class: "md:hidden",
|
|
1639
|
+
"data-sidenav-toggle": ""
|
|
1640
|
+
}, [
|
|
1641
|
+
createVNode("button", {
|
|
1642
|
+
class: "px-2 my-1",
|
|
1643
|
+
"aria-label": "Abrir/fechar menu",
|
|
1644
|
+
onClick: ($event) => isSidenavOpen.value = !isSidenavOpen.value
|
|
1645
|
+
}, [
|
|
1646
|
+
renderSlot$1(_ctx.$slots, "sidenav-toggle-content", {}, () => [
|
|
1647
|
+
createVNode("i", { class: "i-menu text-base-500 text-3xl" })
|
|
1648
|
+
])
|
|
1649
|
+
], 8, ["onClick"]),
|
|
1650
|
+
createVNode(_sfc_main$4, {
|
|
1651
|
+
modelValue: isSidenavOpen.value,
|
|
1652
|
+
"onUpdate:modelValue": ($event) => isSidenavOpen.value = $event,
|
|
1653
|
+
class: "-ml-1 lg:-ml-3"
|
|
1654
|
+
}, {
|
|
1655
|
+
default: withCtx(() => [
|
|
1656
|
+
createTextVNode(" MENU ")
|
|
1657
|
+
]),
|
|
1658
|
+
_: 1
|
|
1659
|
+
}, 8, ["modelValue", "onUpdate:modelValue"])
|
|
1660
|
+
])
|
|
1661
|
+
]),
|
|
1662
|
+
renderSlot$1(_ctx.$slots, "logo"),
|
|
1663
|
+
renderSlot$1(_ctx.$slots, "nav"),
|
|
1664
|
+
renderSlot$1(_ctx.$slots, "buttons", {}, () => [
|
|
1665
|
+
createVNode("div", {
|
|
1666
|
+
class: "px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800",
|
|
1667
|
+
"data-header-buttons": ""
|
|
1668
|
+
}, [
|
|
1669
|
+
(openBlock(true), createBlock(Fragment$1, null, renderList(buttons.value, ({ icon, onClick, label }, name) => {
|
|
1670
|
+
return renderSlot$1(_ctx.$slots, "button", mergeProps({ key: name }, { name, icon, onClick }), () => [
|
|
1671
|
+
createVNode("button", {
|
|
1672
|
+
class: name === "account" ? "hidden sm:block" : null,
|
|
1673
|
+
"aria-label": label,
|
|
1674
|
+
onClick,
|
|
1675
|
+
"data-header-button": name
|
|
1676
|
+
}, [
|
|
1677
|
+
renderSlot$1(_ctx.$slots, "button-content", { name, icon }, () => [
|
|
1678
|
+
createVNode("i", {
|
|
1679
|
+
class: [icon, "hover:text-primary w-7 h-7 hover:scale-110 active:scale-125"]
|
|
1680
|
+
}, null, 2)
|
|
1681
|
+
])
|
|
1682
|
+
], 10, ["aria-label", "onClick", "data-header-button"])
|
|
1683
|
+
]);
|
|
1684
|
+
}), 128))
|
|
1685
|
+
])
|
|
1686
|
+
])
|
|
1687
|
+
])
|
|
1688
|
+
];
|
|
1689
|
+
}
|
|
1690
|
+
}),
|
|
1691
|
+
_: 3
|
|
1692
|
+
}, _parent));
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
});
|
|
1696
|
+
|
|
1697
|
+
const _sfc_setup$2 = _sfc_main$2.setup;
|
|
1698
|
+
_sfc_main$2.setup = (props, ctx) => {
|
|
1699
|
+
const ssrContext = useSSRContext();
|
|
1700
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/ShopHeader.vue");
|
|
1701
|
+
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
|
|
1702
|
+
};
|
|
1703
|
+
|
|
1704
|
+
const $$Astro$7 = createAstro("https://ecom2-002.web.app");
|
|
1705
|
+
const $$PagesHeader = createComponent(async ($$result, $$props, $$slots) => {
|
|
1706
|
+
const Astro2 = $$result.createAstro($$Astro$7, $$props, $$slots);
|
|
1707
|
+
Astro2.self = $$PagesHeader;
|
|
1708
|
+
const {
|
|
1709
|
+
pageContext: {
|
|
1710
|
+
isHomepage,
|
|
1711
|
+
apiState,
|
|
1712
|
+
settings,
|
|
1713
|
+
cms
|
|
1714
|
+
}
|
|
1715
|
+
} = Astro2.props;
|
|
1716
|
+
const header = cms("header");
|
|
1717
|
+
const pitchBar = { slides: [] };
|
|
1718
|
+
if (header.pitch_bar) {
|
|
1719
|
+
pitchBar.slides = header.pitch_bar;
|
|
1720
|
+
} else if (header.marketing_stripe) {
|
|
1721
|
+
pitchBar.slides = [{
|
|
1722
|
+
href: header.marketing_stripe.link,
|
|
1723
|
+
html: header.marketing_stripe.text
|
|
1724
|
+
}];
|
|
1725
|
+
}
|
|
1726
|
+
const logoSrc = header.logo || settings.logo;
|
|
1727
|
+
const LogoHeading = Astro2.props.logoHeading || (isHomepage ? "h1" : "h2");
|
|
1728
|
+
return renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${renderSlot($$result, $$slots["pitch-bar"], renderTemplate`
|
|
1729
|
+
${pitchBar.slides.length > 1 && renderTemplate`${renderComponent($$result, "PitchBar", _sfc_main$5, { ...pitchBar, "client:idle": true, "client:component-hydration": "idle", "client:component-path": "@@sf/components/PitchBar.vue", "client:component-export": "default" })}`}
|
|
1730
|
+
${pitchBar.slides.length === 1 && renderTemplate`${renderComponent($$result, "PitchBar", _sfc_main$5, { ...pitchBar })}`}
|
|
1731
|
+
`)}${renderSlot($$result, $$slots["sticky-header"], renderTemplate`
|
|
1732
|
+
${renderComponent($$result, "ShopHeader", _sfc_main$2, { "client:load": true, "client:component-hydration": "load", "client:component-path": "@@sf/components/ShopHeader.vue", "client:component-export": "default" }, { "logo": () => renderTemplate`${renderComponent($$result, "Fragment", Fragment, { "slot": "logo" }, { "default": () => renderTemplate`${renderSlot($$result, $$slots["logo"], renderTemplate`
|
|
1733
|
+
${maybeRenderHead($$result)}<a href="/">
|
|
1734
|
+
${renderComponent($$result, "LogoHeading", LogoHeading, {}, { "default": () => renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": logoSrc, "alt": settings.name, "widths": [300], "sizes": "150px", "fetchpriority": "high", "class": "hover:drop-shadow-sm" })}` })}
|
|
1735
|
+
</a>
|
|
1736
|
+
`)}` })}` })}
|
|
1737
|
+
`)}` })}
|
|
1738
|
+
|
|
1739
|
+
`;
|
|
1740
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/PagesHeader.astro");
|
|
1741
|
+
|
|
1742
|
+
const $$Astro$6 = createAstro("https://ecom2-002.web.app");
|
|
1743
|
+
const $$Pages = createComponent(async ($$result, $$props, $$slots) => {
|
|
1744
|
+
const Astro2 = $$result.createAstro($$Astro$6, $$props, $$slots);
|
|
1745
|
+
Astro2.self = $$Pages;
|
|
1746
|
+
const { pageContext, title } = Astro2.props;
|
|
1747
|
+
return renderTemplate`${renderComponent($$result, "Base", $$Base, { "pageContext": pageContext, "title": title }, { "default": () => renderTemplate`${renderSlot($$result, $$slots["header"], renderTemplate`
|
|
1748
|
+
${renderComponent($$result, "Header", $$PagesHeader, { "pageContext": pageContext })}
|
|
1749
|
+
`)}${renderSlot($$result, $$slots["default"])}` })}`;
|
|
1750
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Pages.astro");
|
|
1751
|
+
|
|
1752
|
+
const getPriceWithDiscount = (price, discount) => {
|
|
1753
|
+
const { type, value } = discount;
|
|
1754
|
+
let priceWithDiscount;
|
|
1755
|
+
if (value) {
|
|
1756
|
+
if (type === "percentage") {
|
|
1757
|
+
priceWithDiscount = price * ((100 - value) / 100);
|
|
1758
|
+
} else {
|
|
1759
|
+
priceWithDiscount = price - value;
|
|
1760
|
+
}
|
|
1761
|
+
return priceWithDiscount > 0 ? priceWithDiscount : 0;
|
|
1762
|
+
}
|
|
1763
|
+
return price;
|
|
1764
|
+
};
|
|
1765
|
+
const usePrices = (props) => {
|
|
1766
|
+
const _product = computed(() => {
|
|
1767
|
+
return props.product || {
|
|
1768
|
+
price: props.price || 0,
|
|
1769
|
+
base_price: props.basePrice
|
|
1770
|
+
};
|
|
1771
|
+
});
|
|
1772
|
+
const hasVariedPrices = computed(() => {
|
|
1773
|
+
const { variations } = _product.value;
|
|
1774
|
+
if (variations) {
|
|
1775
|
+
const productPrice = price(_product.value);
|
|
1776
|
+
for (let i = 0; i < variations.length; i++) {
|
|
1777
|
+
const price$1 = price({
|
|
1778
|
+
..._product.value,
|
|
1779
|
+
...variations[i]
|
|
1780
|
+
});
|
|
1781
|
+
if (price$1 > productPrice) {
|
|
1782
|
+
return true;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
return false;
|
|
1787
|
+
});
|
|
1788
|
+
const extraDiscount = computed(() => {
|
|
1789
|
+
return modulesInfo.apply_discount.available_extra_discount;
|
|
1790
|
+
});
|
|
1791
|
+
const salePrice = computed(() => {
|
|
1792
|
+
const price$1 = price(_product.value);
|
|
1793
|
+
const discount = extraDiscount.value;
|
|
1794
|
+
if (discount && (!discount.min_amount || price$1 > discount.min_amount)) {
|
|
1795
|
+
return getPriceWithDiscount(price$1, discount);
|
|
1796
|
+
}
|
|
1797
|
+
return price$1;
|
|
1798
|
+
});
|
|
1799
|
+
const comparePrice = computed(() => {
|
|
1800
|
+
if (onPromotion(_product.value)) {
|
|
1801
|
+
return _product.value.base_price;
|
|
1802
|
+
}
|
|
1803
|
+
const price$1 = price(_product.value);
|
|
1804
|
+
if (price$1 > salePrice.value) {
|
|
1805
|
+
return price$1;
|
|
1806
|
+
}
|
|
1807
|
+
return 0;
|
|
1808
|
+
});
|
|
1809
|
+
const installmentsObject = computed(() => {
|
|
1810
|
+
return props.installmentsOption || modulesInfo.list_payments.installments_option || { max_number: 1 };
|
|
1811
|
+
});
|
|
1812
|
+
const installmentsNumber = computed(() => {
|
|
1813
|
+
if (installmentsObject.value.max_number <= 1) {
|
|
1814
|
+
return 1;
|
|
1815
|
+
}
|
|
1816
|
+
const minInstallment = installmentsObject.value.min_installment || 5;
|
|
1817
|
+
const maxInstallmentsNumber = Math.round(salePrice.value / minInstallment);
|
|
1818
|
+
return Math.min(maxInstallmentsNumber, installmentsObject.value.max_number);
|
|
1819
|
+
});
|
|
1820
|
+
const monthlyInterest = computed(() => {
|
|
1821
|
+
return installmentsObject.value.monthly_interest || 0;
|
|
1822
|
+
});
|
|
1823
|
+
const installmentValue = computed(() => {
|
|
1824
|
+
if (installmentsNumber.value >= 2) {
|
|
1825
|
+
if (!monthlyInterest.value) {
|
|
1826
|
+
return salePrice.value / installmentsNumber.value;
|
|
1827
|
+
}
|
|
1828
|
+
const interest = monthlyInterest.value / 100;
|
|
1829
|
+
return salePrice.value * interest / (1 - (1 + interest) ** -installmentsNumber.value);
|
|
1830
|
+
}
|
|
1831
|
+
return 0;
|
|
1832
|
+
});
|
|
1833
|
+
const discountObject = computed(() => {
|
|
1834
|
+
const discount = props.discountOption || modulesInfo.list_payments.discount_option;
|
|
1835
|
+
if (discount && (!discount.min_amount || discount.min_amount <= salePrice.value) && (!props.isAmountTotal || discount.apply_at === "total")) {
|
|
1836
|
+
return discount;
|
|
1837
|
+
}
|
|
1838
|
+
return {};
|
|
1839
|
+
});
|
|
1840
|
+
const discountLabel = computed(() => {
|
|
1841
|
+
const { label } = discountObject.value;
|
|
1842
|
+
if (label) {
|
|
1843
|
+
if (label.includes(" ")) {
|
|
1844
|
+
return label;
|
|
1845
|
+
}
|
|
1846
|
+
return `via ${label}`;
|
|
1847
|
+
}
|
|
1848
|
+
return "";
|
|
1849
|
+
});
|
|
1850
|
+
const priceWithDiscount = computed(() => {
|
|
1851
|
+
return getPriceWithDiscount(salePrice.value, discountObject.value);
|
|
1852
|
+
});
|
|
1853
|
+
const pointsProgramObject = computed(() => {
|
|
1854
|
+
if (props.loyaltyPointsProgram) {
|
|
1855
|
+
return props.loyaltyPointsProgram;
|
|
1856
|
+
}
|
|
1857
|
+
const pointsPrograms = modulesInfo.list_payments.loyalty_points_programs;
|
|
1858
|
+
if (pointsPrograms) {
|
|
1859
|
+
const programIds = Object.keys(pointsPrograms);
|
|
1860
|
+
for (let i = 0; i < programIds.length; i++) {
|
|
1861
|
+
const program = pointsPrograms[programIds[i]];
|
|
1862
|
+
if (program && program.earn_percentage > 0) {
|
|
1863
|
+
return program;
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
return { ratio: 0 };
|
|
1868
|
+
});
|
|
1869
|
+
const pointsMinPrice = computed(() => {
|
|
1870
|
+
return pointsProgramObject.value.min_subtotal_to_earn || 0;
|
|
1871
|
+
});
|
|
1872
|
+
const pointsProgramName = computed(() => {
|
|
1873
|
+
return pointsProgramObject.value.name || "";
|
|
1874
|
+
});
|
|
1875
|
+
const earnPointsPercentage = computed(() => {
|
|
1876
|
+
return pointsProgramObject.value.earn_percentage || 0;
|
|
1877
|
+
});
|
|
1878
|
+
const cashbackPercentage = computed(() => {
|
|
1879
|
+
return earnPointsPercentage.value * pointsProgramObject.value.ratio;
|
|
1880
|
+
});
|
|
1881
|
+
const cashbackValue = computed(() => {
|
|
1882
|
+
return cashbackPercentage.value >= 1 ? salePrice.value * (cashbackPercentage.value / 100) : 0;
|
|
1883
|
+
});
|
|
1884
|
+
return {
|
|
1885
|
+
hasVariedPrices,
|
|
1886
|
+
salePrice,
|
|
1887
|
+
comparePrice,
|
|
1888
|
+
installmentsObject,
|
|
1889
|
+
installmentsNumber,
|
|
1890
|
+
monthlyInterest,
|
|
1891
|
+
installmentValue,
|
|
1892
|
+
discountObject,
|
|
1893
|
+
discountLabel,
|
|
1894
|
+
priceWithDiscount,
|
|
1895
|
+
pointsProgramObject,
|
|
1896
|
+
pointsMinPrice,
|
|
1897
|
+
pointsProgramName,
|
|
1898
|
+
earnPointsPercentage,
|
|
1899
|
+
cashbackPercentage,
|
|
1900
|
+
cashbackValue
|
|
1901
|
+
};
|
|
1902
|
+
};
|
|
1903
|
+
|
|
1904
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1905
|
+
__name: "Prices",
|
|
1906
|
+
__ssrInlineRender: true,
|
|
1907
|
+
props: {
|
|
1908
|
+
product: null,
|
|
1909
|
+
price: null,
|
|
1910
|
+
basePrice: null,
|
|
1911
|
+
isAmountTotal: { type: Boolean },
|
|
1912
|
+
installmentsOption: null,
|
|
1913
|
+
discountOption: null,
|
|
1914
|
+
isBig: { type: Boolean },
|
|
1915
|
+
isLiteral: { type: Boolean },
|
|
1916
|
+
hasCashback: { type: Boolean, default: true },
|
|
1917
|
+
hasPriceOptions: { type: Boolean, default: true }
|
|
1918
|
+
},
|
|
1919
|
+
setup(__props) {
|
|
1920
|
+
const props = __props;
|
|
1921
|
+
const prices = usePrices(props);
|
|
1922
|
+
const {
|
|
1923
|
+
hasVariedPrices,
|
|
1924
|
+
salePrice,
|
|
1925
|
+
comparePrice,
|
|
1926
|
+
cashbackPercentage,
|
|
1927
|
+
cashbackValue,
|
|
1928
|
+
installmentsNumber,
|
|
1929
|
+
monthlyInterest,
|
|
1930
|
+
installmentValue,
|
|
1931
|
+
priceWithDiscount,
|
|
1932
|
+
discountLabel
|
|
1933
|
+
} = prices;
|
|
1934
|
+
const componentVariant = useComponentVariant(props);
|
|
1935
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
1936
|
+
const _component_Fade = resolveComponent("Fade");
|
|
1937
|
+
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
1938
|
+
class: "text-base-600",
|
|
1939
|
+
"data-prices": unref(componentVariant)
|
|
1940
|
+
}, _attrs))}>`);
|
|
1941
|
+
if (unref(comparePrice)) {
|
|
1942
|
+
ssrRenderSlot(_ctx.$slots, "compare", { salePrice: unref(salePrice), comparePrice: unref(comparePrice) }, () => {
|
|
1943
|
+
_push(`<span class="text-base-500 mr-1" data-prices-compare>`);
|
|
1944
|
+
ssrRenderSlot(_ctx.$slots, "compare-pre", {}, () => {
|
|
1945
|
+
if (__props.isLiteral) {
|
|
1946
|
+
_push(`<small>${ssrInterpolate(`${"De"} `)}</small>`);
|
|
1947
|
+
} else {
|
|
1948
|
+
_push(`<!---->`);
|
|
1949
|
+
}
|
|
1950
|
+
}, _push, _parent);
|
|
1951
|
+
ssrRenderSlot(_ctx.$slots, "compare-value", { salePrice: unref(salePrice), comparePrice: unref(comparePrice) }, () => {
|
|
1952
|
+
_push(`<s>${ssrInterpolate(_ctx.$money(unref(comparePrice)))}</s>`);
|
|
1953
|
+
}, _push, _parent);
|
|
1954
|
+
ssrRenderSlot(_ctx.$slots, "compare-post", {}, () => {
|
|
1955
|
+
if (__props.isLiteral) {
|
|
1956
|
+
_push(`<small>${ssrInterpolate(` ${"Por"}`)}</small>`);
|
|
1957
|
+
} else {
|
|
1958
|
+
_push(`<!---->`);
|
|
1959
|
+
}
|
|
1960
|
+
}, _push, _parent);
|
|
1961
|
+
_push(`</span>`);
|
|
1962
|
+
}, _push, _parent);
|
|
1963
|
+
} else {
|
|
1964
|
+
_push(`<!---->`);
|
|
1965
|
+
}
|
|
1966
|
+
ssrRenderSlot(_ctx.$slots, "sale", { salePrice: unref(salePrice) }, () => {
|
|
1967
|
+
_push(`<strong class="inline-block text-base-800" data-prices-sale>`);
|
|
1968
|
+
ssrRenderSlot(_ctx.$slots, "sale-pre", {}, () => {
|
|
1969
|
+
if (unref(hasVariedPrices)) {
|
|
1970
|
+
_push(`<small>${ssrInterpolate(`${"A partir de"} `)}</small>`);
|
|
1971
|
+
} else {
|
|
1972
|
+
_push(`<!---->`);
|
|
1973
|
+
}
|
|
1974
|
+
}, _push, _parent);
|
|
1975
|
+
ssrRenderSlot(_ctx.$slots, "sale-value", { salePrice: unref(salePrice) }, () => {
|
|
1976
|
+
_push(`${ssrInterpolate(_ctx.$money(unref(salePrice)))}`);
|
|
1977
|
+
}, _push, _parent);
|
|
1978
|
+
ssrRenderSlot(_ctx.$slots, "sale-post", {}, null, _push, _parent);
|
|
1979
|
+
_push(`</strong>`);
|
|
1980
|
+
}, _push, _parent);
|
|
1981
|
+
_push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
|
|
1982
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
1983
|
+
if (_push2) {
|
|
1984
|
+
if (unref(cashbackValue)) {
|
|
1985
|
+
ssrRenderSlot(_ctx.$slots, "cashback", { salePrice: unref(salePrice), cashbackValue: unref(cashbackValue), cashbackPercentage: unref(cashbackPercentage) }, () => {
|
|
1986
|
+
if (__props.hasCashback) {
|
|
1987
|
+
_push2(`<div class="relative z-10" data-prices-cashback${_scopeId}><span${ssrRenderAttr("data-tooltip", "Receba $1 de volta".replace("$1", _ctx.$percentage(unref(cashbackPercentage))))}${_scopeId}>`);
|
|
1988
|
+
ssrRenderSlot(_ctx.$slots, "cashback-pre", {}, () => {
|
|
1989
|
+
_push2(`<i class="i-cashback mr-1"${_scopeId}></i>`);
|
|
1990
|
+
}, _push2, _parent2, _scopeId);
|
|
1991
|
+
ssrRenderSlot(_ctx.$slots, "cashback-value", { salePrice: unref(salePrice), cashbackValue: unref(cashbackValue), cashbackPercentage: unref(cashbackPercentage) }, () => {
|
|
1992
|
+
_push2(`<span class="font-medium"${_scopeId}>${ssrInterpolate(_ctx.$money(unref(cashbackValue)))}</span>`);
|
|
1993
|
+
}, _push2, _parent2, _scopeId);
|
|
1994
|
+
ssrRenderSlot(_ctx.$slots, "cashback-post", {}, () => {
|
|
1995
|
+
_push2(`<small${_scopeId}> cashback</small>`);
|
|
1996
|
+
}, _push2, _parent2, _scopeId);
|
|
1997
|
+
_push2(`</span></div>`);
|
|
1998
|
+
} else {
|
|
1999
|
+
_push2(`<!---->`);
|
|
2000
|
+
}
|
|
2001
|
+
}, _push2, _parent2, _scopeId);
|
|
2002
|
+
} else {
|
|
2003
|
+
_push2(`<!---->`);
|
|
2004
|
+
}
|
|
2005
|
+
} else {
|
|
2006
|
+
return [
|
|
2007
|
+
unref(cashbackValue) ? renderSlot$1(_ctx.$slots, "cashback", mergeProps({ key: 0 }, { salePrice: unref(salePrice), cashbackValue: unref(cashbackValue), cashbackPercentage: unref(cashbackPercentage) }), () => [
|
|
2008
|
+
__props.hasCashback ? (openBlock(), createBlock("div", {
|
|
2009
|
+
key: 0,
|
|
2010
|
+
class: "relative z-10",
|
|
2011
|
+
"data-prices-cashback": ""
|
|
2012
|
+
}, [
|
|
2013
|
+
createVNode("span", {
|
|
2014
|
+
"data-tooltip": "Receba $1 de volta".replace("$1", _ctx.$percentage(unref(cashbackPercentage)))
|
|
2015
|
+
}, [
|
|
2016
|
+
renderSlot$1(_ctx.$slots, "cashback-pre", {}, () => [
|
|
2017
|
+
createVNode("i", { class: "i-cashback mr-1" })
|
|
2018
|
+
]),
|
|
2019
|
+
renderSlot$1(_ctx.$slots, "cashback-value", { salePrice: unref(salePrice), cashbackValue: unref(cashbackValue), cashbackPercentage: unref(cashbackPercentage) }, () => [
|
|
2020
|
+
createVNode("span", { class: "font-medium" }, toDisplayString(_ctx.$money(unref(cashbackValue))), 1)
|
|
2021
|
+
]),
|
|
2022
|
+
renderSlot$1(_ctx.$slots, "cashback-post", {}, () => [
|
|
2023
|
+
createVNode("small", null, " cashback")
|
|
2024
|
+
])
|
|
2025
|
+
], 8, ["data-tooltip"])
|
|
2026
|
+
])) : createCommentVNode("", true)
|
|
2027
|
+
]) : createCommentVNode("", true)
|
|
2028
|
+
];
|
|
2029
|
+
}
|
|
2030
|
+
}),
|
|
2031
|
+
_: 3
|
|
2032
|
+
}, _parent));
|
|
2033
|
+
_push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
|
|
2034
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
2035
|
+
if (_push2) {
|
|
2036
|
+
if (unref(installmentValue)) {
|
|
2037
|
+
ssrRenderSlot(_ctx.$slots, "installment", { salePrice: unref(salePrice), installmentValue: unref(installmentValue), installmentsNumber: unref(installmentsNumber), monthlyInterest: unref(monthlyInterest) }, () => {
|
|
2038
|
+
if (__props.hasPriceOptions) {
|
|
2039
|
+
_push2(`<div data-prices-installment${_scopeId}>`);
|
|
2040
|
+
ssrRenderSlot(_ctx.$slots, "installment-pre", {}, () => {
|
|
2041
|
+
if (__props.isLiteral) {
|
|
2042
|
+
_push2(`<small${_scopeId}>${ssrInterpolate(`${"Até"} `)}</small>`);
|
|
2043
|
+
} else {
|
|
2044
|
+
_push2(`<!---->`);
|
|
2045
|
+
}
|
|
2046
|
+
}, _push2, _parent2, _scopeId);
|
|
2047
|
+
ssrRenderSlot(_ctx.$slots, "installment-value", { salePrice: unref(salePrice), installmentValue: unref(installmentValue), installmentsNumber: unref(installmentsNumber), monthlyInterest: unref(monthlyInterest) }, () => {
|
|
2048
|
+
_push2(`${ssrInterpolate(unref(installmentsNumber))}x `);
|
|
2049
|
+
if (__props.isLiteral) {
|
|
2050
|
+
_push2(`<small${_scopeId}>${ssrInterpolate(` ${"De"} `)}</small>`);
|
|
2051
|
+
} else {
|
|
2052
|
+
_push2(`<!---->`);
|
|
2053
|
+
}
|
|
2054
|
+
_push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money(unref(installmentValue)))}</span>`);
|
|
2055
|
+
}, _push2, _parent2, _scopeId);
|
|
2056
|
+
ssrRenderSlot(_ctx.$slots, "installment-post", {}, () => {
|
|
2057
|
+
if (!unref(monthlyInterest) && __props.isLiteral) {
|
|
2058
|
+
_push2(`<small${_scopeId}>${ssrInterpolate("Sem juros")}</small>`);
|
|
2059
|
+
} else {
|
|
2060
|
+
_push2(`<!---->`);
|
|
2061
|
+
}
|
|
2062
|
+
}, _push2, _parent2, _scopeId);
|
|
2063
|
+
_push2(`</div>`);
|
|
2064
|
+
} else {
|
|
2065
|
+
_push2(`<!---->`);
|
|
2066
|
+
}
|
|
2067
|
+
}, _push2, _parent2, _scopeId);
|
|
2068
|
+
} else {
|
|
2069
|
+
_push2(`<!---->`);
|
|
2070
|
+
}
|
|
2071
|
+
} else {
|
|
2072
|
+
return [
|
|
2073
|
+
unref(installmentValue) ? renderSlot$1(_ctx.$slots, "installment", mergeProps({ key: 0 }, { salePrice: unref(salePrice), installmentValue: unref(installmentValue), installmentsNumber: unref(installmentsNumber), monthlyInterest: unref(monthlyInterest) }), () => [
|
|
2074
|
+
__props.hasPriceOptions ? (openBlock(), createBlock("div", {
|
|
2075
|
+
key: 0,
|
|
2076
|
+
"data-prices-installment": ""
|
|
2077
|
+
}, [
|
|
2078
|
+
renderSlot$1(_ctx.$slots, "installment-pre", {}, () => [
|
|
2079
|
+
__props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"Até"} `))) : createCommentVNode("", true)
|
|
2080
|
+
]),
|
|
2081
|
+
renderSlot$1(_ctx.$slots, "installment-value", { salePrice: unref(salePrice), installmentValue: unref(installmentValue), installmentsNumber: unref(installmentsNumber), monthlyInterest: unref(monthlyInterest) }, () => [
|
|
2082
|
+
createTextVNode(toDisplayString(unref(installmentsNumber)) + "x ", 1),
|
|
2083
|
+
__props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(` ${"De"} `))) : createCommentVNode("", true),
|
|
2084
|
+
createVNode("span", null, toDisplayString(_ctx.$money(unref(installmentValue))), 1)
|
|
2085
|
+
]),
|
|
2086
|
+
renderSlot$1(_ctx.$slots, "installment-post", {}, () => [
|
|
2087
|
+
!unref(monthlyInterest) && __props.isLiteral ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString("Sem juros"))) : createCommentVNode("", true)
|
|
2088
|
+
])
|
|
2089
|
+
])) : createCommentVNode("", true)
|
|
2090
|
+
]) : createCommentVNode("", true)
|
|
2091
|
+
];
|
|
2092
|
+
}
|
|
2093
|
+
}),
|
|
2094
|
+
_: 3
|
|
2095
|
+
}, _parent));
|
|
2096
|
+
_push(ssrRenderComponent(_component_Fade, { slide: "down" }, {
|
|
2097
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
2098
|
+
if (_push2) {
|
|
2099
|
+
if (unref(priceWithDiscount) < unref(salePrice)) {
|
|
2100
|
+
ssrRenderSlot(_ctx.$slots, "discount", { salePrice: unref(salePrice), priceWithDiscount: unref(priceWithDiscount), discountLabel: unref(discountLabel) }, () => {
|
|
2101
|
+
if (__props.hasPriceOptions) {
|
|
2102
|
+
_push2(`<div data-prices-discount${_scopeId}>`);
|
|
2103
|
+
ssrRenderSlot(_ctx.$slots, "discount-pre", {}, () => {
|
|
2104
|
+
if (!unref(discountLabel)) {
|
|
2105
|
+
_push2(`<small${_scopeId}>${ssrInterpolate(`${"A partir de"} `)}</small>`);
|
|
2106
|
+
} else {
|
|
2107
|
+
_push2(`<!---->`);
|
|
2108
|
+
}
|
|
2109
|
+
}, _push2, _parent2, _scopeId);
|
|
2110
|
+
ssrRenderSlot(_ctx.$slots, "discount-value", { salePrice: unref(salePrice), priceWithDiscount: unref(priceWithDiscount), discountLabel: unref(discountLabel) }, () => {
|
|
2111
|
+
_push2(`<span${_scopeId}>${ssrInterpolate(_ctx.$money(unref(priceWithDiscount)))}</span>`);
|
|
2112
|
+
}, _push2, _parent2, _scopeId);
|
|
2113
|
+
ssrRenderSlot(_ctx.$slots, "discount-post", {}, () => {
|
|
2114
|
+
if (unref(discountLabel)) {
|
|
2115
|
+
_push2(`<small${_scopeId}>${ssrInterpolate(` ${unref(discountLabel)}`)}</small>`);
|
|
2116
|
+
} else {
|
|
2117
|
+
_push2(`<!---->`);
|
|
2118
|
+
}
|
|
2119
|
+
}, _push2, _parent2, _scopeId);
|
|
2120
|
+
_push2(`</div>`);
|
|
2121
|
+
} else {
|
|
2122
|
+
_push2(`<!---->`);
|
|
2123
|
+
}
|
|
2124
|
+
}, _push2, _parent2, _scopeId);
|
|
2125
|
+
} else {
|
|
2126
|
+
_push2(`<!---->`);
|
|
2127
|
+
}
|
|
2128
|
+
} else {
|
|
2129
|
+
return [
|
|
2130
|
+
unref(priceWithDiscount) < unref(salePrice) ? renderSlot$1(_ctx.$slots, "discount", mergeProps({ key: 0 }, { salePrice: unref(salePrice), priceWithDiscount: unref(priceWithDiscount), discountLabel: unref(discountLabel) }), () => [
|
|
2131
|
+
__props.hasPriceOptions ? (openBlock(), createBlock("div", {
|
|
2132
|
+
key: 0,
|
|
2133
|
+
"data-prices-discount": ""
|
|
2134
|
+
}, [
|
|
2135
|
+
renderSlot$1(_ctx.$slots, "discount-pre", {}, () => [
|
|
2136
|
+
!unref(discountLabel) ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(`${"A partir de"} `))) : createCommentVNode("", true)
|
|
2137
|
+
]),
|
|
2138
|
+
renderSlot$1(_ctx.$slots, "discount-value", { salePrice: unref(salePrice), priceWithDiscount: unref(priceWithDiscount), discountLabel: unref(discountLabel) }, () => [
|
|
2139
|
+
createVNode("span", null, toDisplayString(_ctx.$money(unref(priceWithDiscount))), 1)
|
|
2140
|
+
]),
|
|
2141
|
+
renderSlot$1(_ctx.$slots, "discount-post", {}, () => [
|
|
2142
|
+
unref(discountLabel) ? (openBlock(), createBlock("small", { key: 0 }, toDisplayString(` ${unref(discountLabel)}`), 1)) : createCommentVNode("", true)
|
|
2143
|
+
])
|
|
2144
|
+
])) : createCommentVNode("", true)
|
|
2145
|
+
]) : createCommentVNode("", true)
|
|
2146
|
+
];
|
|
2147
|
+
}
|
|
2148
|
+
}),
|
|
2149
|
+
_: 3
|
|
2150
|
+
}, _parent));
|
|
2151
|
+
_push(`</div>`);
|
|
2152
|
+
};
|
|
2153
|
+
}
|
|
2154
|
+
});
|
|
2155
|
+
|
|
2156
|
+
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
2157
|
+
_sfc_main$1.setup = (props, ctx) => {
|
|
2158
|
+
const ssrContext = useSSRContext();
|
|
2159
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/Prices.vue");
|
|
2160
|
+
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
2161
|
+
};
|
|
2162
|
+
|
|
2163
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2164
|
+
__name: "ProductCard",
|
|
2165
|
+
__ssrInlineRender: true,
|
|
2166
|
+
props: {
|
|
2167
|
+
as: { default: "div" }
|
|
2168
|
+
},
|
|
2169
|
+
setup(__props) {
|
|
2170
|
+
const price = ref(12);
|
|
2171
|
+
const isBig = ref(false);
|
|
2172
|
+
setTimeout(() => {
|
|
2173
|
+
price.value = 8;
|
|
2174
|
+
isBig.value = true;
|
|
2175
|
+
}, 5e3);
|
|
2176
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
2177
|
+
ssrRenderVNode(_push, createVNode(resolveDynamicComponent(__props.as), _attrs, {
|
|
2178
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
2179
|
+
if (_push2) {
|
|
2180
|
+
_push2(ssrRenderComponent(_sfc_main$1, null, {
|
|
2181
|
+
default: withCtx(({ salePrice }, _push3, _parent3, _scopeId2) => {
|
|
2182
|
+
if (_push3) {
|
|
2183
|
+
_push3(` ProductCard ${ssrInterpolate(salePrice)}`);
|
|
2184
|
+
} else {
|
|
2185
|
+
return [
|
|
2186
|
+
createTextVNode(" ProductCard " + toDisplayString(salePrice), 1)
|
|
2187
|
+
];
|
|
2188
|
+
}
|
|
2189
|
+
}),
|
|
2190
|
+
_: 1
|
|
2191
|
+
}, _parent2, _scopeId));
|
|
2192
|
+
_push2(ssrRenderComponent(_sfc_main$1, {
|
|
2193
|
+
product: { price: price.value }
|
|
2194
|
+
}, null, _parent2, _scopeId));
|
|
2195
|
+
_push2(ssrRenderComponent(_sfc_main$1, {
|
|
2196
|
+
price: 12,
|
|
2197
|
+
"base-price": 17
|
|
2198
|
+
}, null, _parent2, _scopeId));
|
|
2199
|
+
_push2(ssrRenderComponent(_sfc_main$1, {
|
|
2200
|
+
price: 12,
|
|
2201
|
+
"base-price": 16,
|
|
2202
|
+
"is-literal": true
|
|
2203
|
+
}, null, _parent2, _scopeId));
|
|
2204
|
+
_push2(ssrRenderComponent(_sfc_main$1, {
|
|
2205
|
+
price: 12,
|
|
2206
|
+
"is-big": isBig.value
|
|
2207
|
+
}, null, _parent2, _scopeId));
|
|
2208
|
+
_push2(ssrRenderComponent(_sfc_main$1, {
|
|
2209
|
+
price: 14,
|
|
2210
|
+
"base-price": 18,
|
|
2211
|
+
"is-big": isBig.value,
|
|
2212
|
+
"is-literal": true
|
|
2213
|
+
}, null, _parent2, _scopeId));
|
|
2214
|
+
_push2(ssrRenderComponent(_sfc_main$1, {
|
|
2215
|
+
price: 12,
|
|
2216
|
+
"base-price": 16
|
|
2217
|
+
}, {
|
|
2218
|
+
"compare-value": withCtx(({ comparePrice }, _push3, _parent3, _scopeId2) => {
|
|
2219
|
+
if (_push3) {
|
|
2220
|
+
_push3(` x${ssrInterpolate(comparePrice)}`);
|
|
2221
|
+
} else {
|
|
2222
|
+
return [
|
|
2223
|
+
createTextVNode(" x" + toDisplayString(comparePrice), 1)
|
|
2224
|
+
];
|
|
2225
|
+
}
|
|
2226
|
+
}),
|
|
2227
|
+
_: 1
|
|
2228
|
+
}, _parent2, _scopeId));
|
|
2229
|
+
} else {
|
|
2230
|
+
return [
|
|
2231
|
+
createVNode(_sfc_main$1, null, {
|
|
2232
|
+
default: withCtx(({ salePrice }) => [
|
|
2233
|
+
createTextVNode(" ProductCard " + toDisplayString(salePrice), 1)
|
|
2234
|
+
]),
|
|
2235
|
+
_: 1
|
|
2236
|
+
}),
|
|
2237
|
+
createVNode(_sfc_main$1, {
|
|
2238
|
+
product: { price: price.value }
|
|
2239
|
+
}, null, 8, ["product"]),
|
|
2240
|
+
createVNode(_sfc_main$1, {
|
|
2241
|
+
price: 12,
|
|
2242
|
+
"base-price": 17
|
|
2243
|
+
}),
|
|
2244
|
+
createVNode(_sfc_main$1, {
|
|
2245
|
+
price: 12,
|
|
2246
|
+
"base-price": 16,
|
|
2247
|
+
"is-literal": true
|
|
2248
|
+
}),
|
|
2249
|
+
createVNode(_sfc_main$1, {
|
|
2250
|
+
price: 12,
|
|
2251
|
+
"is-big": isBig.value
|
|
2252
|
+
}, null, 8, ["is-big"]),
|
|
2253
|
+
createVNode(_sfc_main$1, {
|
|
2254
|
+
price: 14,
|
|
2255
|
+
"base-price": 18,
|
|
2256
|
+
"is-big": isBig.value,
|
|
2257
|
+
"is-literal": true
|
|
2258
|
+
}, null, 8, ["is-big"]),
|
|
2259
|
+
createVNode(_sfc_main$1, {
|
|
2260
|
+
price: 12,
|
|
2261
|
+
"base-price": 16
|
|
2262
|
+
}, {
|
|
2263
|
+
"compare-value": withCtx(({ comparePrice }) => [
|
|
2264
|
+
createTextVNode(" x" + toDisplayString(comparePrice), 1)
|
|
2265
|
+
]),
|
|
2266
|
+
_: 1
|
|
2267
|
+
})
|
|
2268
|
+
];
|
|
2269
|
+
}
|
|
2270
|
+
}),
|
|
2271
|
+
_: 1
|
|
2272
|
+
}), _parent);
|
|
2273
|
+
};
|
|
2274
|
+
}
|
|
2275
|
+
});
|
|
2276
|
+
|
|
2277
|
+
const _sfc_setup = _sfc_main.setup;
|
|
2278
|
+
_sfc_main.setup = (props, ctx) => {
|
|
2279
|
+
const ssrContext = useSSRContext();
|
|
2280
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/lib/components/ProductCard.vue");
|
|
2281
|
+
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
2282
|
+
};
|
|
2283
|
+
|
|
2284
|
+
const $$Astro$5 = createAstro("https://ecom2-002.web.app");
|
|
2285
|
+
const $$Home = createComponent(async ($$result, $$props, $$slots) => {
|
|
2286
|
+
const Astro2 = $$result.createAstro($$Astro$5, $$props, $$slots);
|
|
2287
|
+
Astro2.self = $$Home;
|
|
2288
|
+
const products = (await api.get("products")).data.result;
|
|
2289
|
+
return renderTemplate`${maybeRenderHead($$result)}<main>
|
|
2290
|
+
<h1>Welcome to <span class="text-primary">Astro</span></h1>
|
|
2291
|
+
<ul role="list" class="mt-3 fs-20">
|
|
2292
|
+
${products.map((product) => renderTemplate`<li>
|
|
2293
|
+
<a${addAttribute(`/${product.slug}`, "href")}>${product.sku}</a>
|
|
2294
|
+
</li>`)}
|
|
2295
|
+
</ul>
|
|
2296
|
+
<div class="prose">
|
|
2297
|
+
<h1>Oi</h1>
|
|
2298
|
+
<p>Olá <a href="/">link</a></p>
|
|
2299
|
+
<ul>
|
|
2300
|
+
<li>So here is the first item in this list.</li>
|
|
2301
|
+
<li>In this example we're keeping the items short.</li>
|
|
2302
|
+
<li>Later, we'll use longer, more complex list items.</li>
|
|
2303
|
+
</ul>
|
|
2304
|
+
<details>
|
|
2305
|
+
<summary role="button">Accordion 1</summary>
|
|
2306
|
+
<p>…</p>
|
|
2307
|
+
</details>
|
|
2308
|
+
</div>
|
|
2309
|
+
<div>
|
|
2310
|
+
<h1>Oi</h1>
|
|
2311
|
+
<p>Olá <a href="/">link</a></p>
|
|
2312
|
+
<details>
|
|
2313
|
+
<summary role="button">Accordion 1</summary>
|
|
2314
|
+
<p>…</p>
|
|
2315
|
+
</details>
|
|
2316
|
+
</div>
|
|
2317
|
+
<div class="mt-2">
|
|
2318
|
+
<div>
|
|
2319
|
+
<label class="block">
|
|
2320
|
+
<span class="text-gray-700">Email address</span>
|
|
2321
|
+
<input type="email" class="mt-1 block w-full" placeholder="john@example.com">
|
|
2322
|
+
</label>
|
|
2323
|
+
<label class="inline-flex items-center">
|
|
2324
|
+
<input type="checkbox" checked>
|
|
2325
|
+
<span class="ml-2 font-brand">Email me news and special offers</span>
|
|
2326
|
+
</label>
|
|
2327
|
+
</div>
|
|
2328
|
+
</div>
|
|
2329
|
+
${renderComponent($$result, "Prices", _sfc_main$1, { "price": 10, "client:load": true, "client:component-hydration": "load", "client:component-path": "@@sf/components/Prices.vue", "client:component-export": "default" })}
|
|
2330
|
+
${renderComponent($$result, "ProductCard", _sfc_main, { "client:load": true, "client:component-hydration": "load", "client:component-path": "@@sf/components/ProductCard.vue", "client:component-export": "default" })}
|
|
2331
|
+
</main>`;
|
|
2332
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Home.astro");
|
|
2333
|
+
|
|
2334
|
+
const $$Astro$4 = createAstro("https://ecom2-002.web.app");
|
|
2335
|
+
const $$Index$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
2336
|
+
const Astro2 = $$result.createAstro($$Astro$4, $$props, $$slots);
|
|
2337
|
+
Astro2.self = $$Index$1;
|
|
2338
|
+
let pageContext;
|
|
2339
|
+
let loadError;
|
|
2340
|
+
try {
|
|
2341
|
+
pageContext = await loadPageContext(Astro2);
|
|
2342
|
+
} catch (err) {
|
|
2343
|
+
if (err.astroResponse) {
|
|
2344
|
+
return err.astroResponse;
|
|
2345
|
+
}
|
|
2346
|
+
loadError = err;
|
|
2347
|
+
}
|
|
2348
|
+
return renderTemplate`<html${addAttribute(pageContext?.lang.replace("_", "-"), "lang")}>
|
|
2349
|
+
${pageContext && renderTemplate`${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext }, { "default": () => renderTemplate`${renderComponent($$result, "HomeMain", $$Home, { "pageContext": pageContext })}` })}`}
|
|
2350
|
+
${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
|
|
2351
|
+
</html>`;
|
|
2352
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro");
|
|
2353
|
+
|
|
2354
|
+
const $$file$3 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro";
|
|
2355
|
+
const $$url$3 = "";
|
|
2356
|
+
|
|
2357
|
+
const _page1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2358
|
+
__proto__: null,
|
|
2359
|
+
default: $$Index$1,
|
|
2360
|
+
file: $$file$3,
|
|
2361
|
+
url: $$url$3
|
|
2362
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2363
|
+
|
|
2364
|
+
const $$Astro$3 = createAstro("https://ecom2-002.web.app");
|
|
2365
|
+
const $$Index = createComponent(async ($$result, $$props, $$slots) => {
|
|
2366
|
+
const Astro2 = $$result.createAstro($$Astro$3, $$props, $$slots);
|
|
2367
|
+
Astro2.self = $$Index;
|
|
2368
|
+
return renderTemplate``;
|
|
2369
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro");
|
|
2370
|
+
|
|
2371
|
+
const $$file$2 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro";
|
|
2372
|
+
const $$url$2 = "/app";
|
|
2373
|
+
|
|
2374
|
+
const _page3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2375
|
+
__proto__: null,
|
|
2376
|
+
default: $$Index,
|
|
2377
|
+
file: $$file$2,
|
|
2378
|
+
url: $$url$2
|
|
2379
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2380
|
+
|
|
2381
|
+
const $$Astro$2 = createAstro("https://ecom2-002.web.app");
|
|
2382
|
+
const $$Account = createComponent(async ($$result, $$props, $$slots) => {
|
|
2383
|
+
const Astro2 = $$result.createAstro($$Astro$2, $$props, $$slots);
|
|
2384
|
+
Astro2.self = $$Account;
|
|
2385
|
+
return renderTemplate``;
|
|
2386
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/account.astro");
|
|
2387
|
+
|
|
2388
|
+
const $$file$1 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/account.astro";
|
|
2389
|
+
const $$url$1 = "/app/account";
|
|
2390
|
+
|
|
2391
|
+
const _page4 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2392
|
+
__proto__: null,
|
|
2393
|
+
default: $$Account,
|
|
2394
|
+
file: $$file$1,
|
|
2395
|
+
url: $$url$1
|
|
2396
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2397
|
+
|
|
2398
|
+
const $$Astro$1 = createAstro("https://ecom2-002.web.app");
|
|
2399
|
+
const $$Wildcard = createComponent(async ($$result, $$props, $$slots) => {
|
|
2400
|
+
const Astro2 = $$result.createAstro($$Astro$1, $$props, $$slots);
|
|
2401
|
+
Astro2.self = $$Wildcard;
|
|
2402
|
+
const {
|
|
2403
|
+
pageContext: { apiResource, apiDoc }
|
|
2404
|
+
} = Astro2.props;
|
|
2405
|
+
return renderTemplate`${maybeRenderHead($$result)}<main>
|
|
2406
|
+
<h1>Hello <span class="text-gradient">${apiDoc.name}</span></h1>
|
|
2407
|
+
<hr>
|
|
2408
|
+
<div class="mt-3">
|
|
2409
|
+
<mark>${apiDoc._id}</mark> from <i>${apiResource}</i>
|
|
2410
|
+
<p>${Math.random()}</p>
|
|
2411
|
+
<em>Lorem ipsum dolor sit amet</em>
|
|
2412
|
+
</div>
|
|
2413
|
+
</main>`;
|
|
2414
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Wildcard.astro");
|
|
2415
|
+
|
|
2416
|
+
const $$Astro = createAstro("https://ecom2-002.web.app");
|
|
2417
|
+
async function getStaticPaths() {
|
|
2418
|
+
return (await api.get("products?sort=-sales&limit=4&fields=slug")).data.result.map(({ slug }) => ({ params: { slug } }));
|
|
2419
|
+
}
|
|
2420
|
+
const $$ = createComponent(async ($$result, $$props, $$slots) => {
|
|
2421
|
+
const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
|
|
2422
|
+
Astro2.self = $$;
|
|
2423
|
+
if (String(Astro2.params.slug).endsWith(".css.map")) {
|
|
2424
|
+
return new Response(null, { status: 404 });
|
|
2425
|
+
}
|
|
2426
|
+
let pageContext;
|
|
2427
|
+
let loadError;
|
|
2428
|
+
try {
|
|
2429
|
+
pageContext = await loadPageContext(Astro2);
|
|
2430
|
+
} catch (err) {
|
|
2431
|
+
if (err.astroResponse) {
|
|
2432
|
+
return err.astroResponse;
|
|
2433
|
+
}
|
|
2434
|
+
loadError = err;
|
|
2435
|
+
}
|
|
2436
|
+
return renderTemplate`<html${addAttribute(pageContext?.lang.replace("_", "-"), "lang")}>
|
|
2437
|
+
${pageContext && renderTemplate`${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext }, { "default": () => renderTemplate`${renderComponent($$result, "WildcardMain", $$Wildcard, { "pageContext": pageContext })}` })}`}
|
|
2438
|
+
${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": () => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
|
|
2439
|
+
</html>`;
|
|
2440
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro");
|
|
2441
|
+
|
|
2442
|
+
const $$file = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro";
|
|
2443
|
+
const $$url = "/[...slug]";
|
|
2444
|
+
|
|
2445
|
+
const _page5 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2446
|
+
__proto__: null,
|
|
2447
|
+
default: $$,
|
|
2448
|
+
file: $$file,
|
|
2449
|
+
getStaticPaths,
|
|
2450
|
+
url: $$url
|
|
2451
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2452
|
+
|
|
2453
|
+
export { $$Pages as $, _page0 as _, _page1 as a, _page3 as b, _page4 as c, _page5 as d, loadPageContext as l };
|