cloudcommerce 0.5.0 → 0.6.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 +27 -0
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/infinitepay/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/storefront/client.d.ts +23 -3
- package/packages/storefront/dist/client/_astro/PitchBar.457658a3.js +1 -0
- package/packages/storefront/dist/client/_astro/Prices.a1302bf9.js +1 -0
- package/packages/storefront/dist/client/_astro/ProductCard.1a45764a.js +1 -0
- package/packages/storefront/dist/client/_astro/ShopHeader.0a6766ac.js +1 -0
- package/packages/storefront/dist/client/_astro/{_...slug_.648728f3.css → _...slug_.6721f699.css} +1 -1
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.6da04e63.js +1 -0
- package/packages/storefront/dist/client/_astro/client.b854166f.js +1 -0
- package/packages/storefront/dist/client/_astro/firebase-app.7ce2ebb1.js +1426 -0
- package/packages/storefront/dist/client/_astro/format-money.6f464cee.js +1 -0
- package/packages/storefront/dist/client/_astro/hoisted.721ad75d.js +1 -0
- package/packages/storefront/dist/client/_astro/idle-callback.889bf0ea.js +1 -0
- package/packages/storefront/dist/client/_astro/index.a500792d.js +1 -0
- package/packages/storefront/dist/client/_astro/modules-info.80ae4e30.js +1 -0
- package/packages/storefront/dist/client/_astro/preload-helper.101896b7.js +1 -0
- package/packages/storefront/dist/client/_astro/{runtime-dom.esm-bundler.e8b26f2c.js → runtime-dom.esm-bundler.acde10ec.js} +1 -1
- package/packages/storefront/dist/client/fallback/index.html +3 -3
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/pages/{all.ba8f4b85.mjs → all.e0f284c9.mjs} +240 -26
- package/packages/storefront/dist/server/chunks/{prerender.8cd4ad42.mjs → prerender.9f6cbb00.mjs} +0 -0
- package/packages/storefront/dist/server/entry.mjs +5 -5
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/server.d.ts +34 -0
- package/packages/storefront/src/env.d.ts +1 -0
- package/packages/storefront/src/helpers/afetch.ts +3 -1
- package/packages/storefront/src/helpers/idle-callback.ts +9 -0
- package/packages/storefront/src/lib/browser-env.ts +22 -0
- package/packages/storefront/src/lib/components/LoginForm.vue +13 -9
- package/packages/storefront/src/lib/components/SocialNetworkIcon.vue +29 -0
- package/packages/storefront/src/lib/components/SocialNetworkLink.vue +37 -0
- package/packages/storefront/src/lib/components/globals/ALink.vue +2 -2
- package/packages/storefront/src/lib/layouts/BaseStateJson.astro +1 -1
- package/packages/storefront/src/lib/scripts/firebase-app.ts +16 -3
- package/packages/storefront/src/lib/server-data.ts +25 -0
- package/packages/storefront/src/lib/ssr-context.ts +8 -6
- package/packages/storefront/src/lib/state/customer-session.ts +51 -30
- package/packages/storefront/src/lib/state/modules-info.ts +2 -5
- package/packages/storefront/tailwind.config.cjs +1 -0
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/PitchBar.df2672ff.js +0 -1
- package/packages/storefront/dist/client/_astro/Prices.99fa99bf.js +0 -1
- package/packages/storefront/dist/client/_astro/ProductCard.a322c854.js +0 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.abd6dec6.js +0 -1
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.e6f0b936.js +0 -1
- package/packages/storefront/dist/client/_astro/client.e6b58b55.js +0 -1
- package/packages/storefront/dist/client/_astro/ecom-utils.92f137f6.js +0 -1
- package/packages/storefront/dist/client/_astro/hoisted.6edd7364.js +0 -1
- package/packages/storefront/dist/client/_astro/index.5dd878ac.js +0 -1
- package/packages/storefront/dist/client/_astro/modules-info.e8935203.js +0 -1
- package/packages/storefront/src/lib/components/ADrawer.vue +0 -110
- package/packages/storefront/src/lib/components/LoginDrawer.vue +0 -82
|
@@ -14,8 +14,8 @@ import enableDestroy from 'server-destroy';
|
|
|
14
14
|
import { defineComponent, useCssVars, unref, computed, useSSRContext, mergeProps, h as h$2, createSSRApp } from 'vue';
|
|
15
15
|
import { ssrRenderSlotInner, ssrRenderAttrs, ssrRenderSlot, renderToString } from 'vue/server-renderer';
|
|
16
16
|
import { i18n, formatMoney } from '@ecomplus/utils';
|
|
17
|
-
/* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page3, d as _page4, e as _page5 } from './chunks/pages/all.
|
|
18
|
-
import { _ as _page2 } from './chunks/prerender.
|
|
17
|
+
/* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page3, d as _page4, e as _page5 } from './chunks/pages/all.e0f284c9.mjs';
|
|
18
|
+
import { _ as _page2 } from './chunks/prerender.9f6cbb00.mjs';
|
|
19
19
|
import 'path-to-regexp';
|
|
20
20
|
import 'tls';
|
|
21
21
|
import 'mime';
|
|
@@ -3293,12 +3293,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3293
3293
|
const linkTarget = computed(() => {
|
|
3294
3294
|
if (props.target)
|
|
3295
3295
|
return props.target;
|
|
3296
|
-
if (props.href.startsWith("http")
|
|
3296
|
+
if (props.href.startsWith("http")) {
|
|
3297
3297
|
const domain = globalThis.storefront.settings.domain || window.location.host;
|
|
3298
3298
|
if (props.href.startsWith(`https://${domain}`))
|
|
3299
3299
|
return null;
|
|
3300
3300
|
}
|
|
3301
|
-
return
|
|
3301
|
+
return "_blank";
|
|
3302
3302
|
});
|
|
3303
3303
|
const __returned__ = { props, linkTarget };
|
|
3304
3304
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
@@ -3380,7 +3380,7 @@ const _renderer1 = {
|
|
|
3380
3380
|
const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.14.1_astro@2.0.10+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js", _page0],["src/pages/index.astro", _page1],["src/pages/fallback.astro", _page2],["src/pages/app/index.astro", _page3],["src/pages/app/account.astro", _page4],["src/pages/[...slug].astro", _page5],]);
|
|
3381
3381
|
const renderers = [Object.assign({"name":"astro:jsx","serverEntrypoint":"astro/jsx/server.js","jsxImportSource":"astro"}, { ssr: server_default }),Object.assign({"name":"@astrojs/vue","clientEntrypoint":"@astrojs/vue/client.js","serverEntrypoint":"@astrojs/vue/server.js"}, { ssr: _renderer1 }),];
|
|
3382
3382
|
|
|
3383
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"fallback/index.html","links":[],"scripts":[],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.14.1_astro@2.0.10+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.
|
|
3383
|
+
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"fallback/index.html","links":[],"scripts":[],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.14.1_astro@2.0.10+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.6721f699.css","_astro/index.0c833781.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app/account","type":"page","pattern":"^\\/app\\/account\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}],[{"content":"account","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/account.astro","pathname":"/app/account","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.6721f699.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-002.web.app","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true,"contentDir":"file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/content/"},"pageMap":null,"propagation":[["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseStateJson.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/scripts/InlineScripts.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/@astrojs/image/components/Image.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/@astrojs/image/components/Picture.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/ssr/Picture.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/PagesHeader.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Pages.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Home.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/account.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Wildcard.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/main/Fallback.astro","in-tree"],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro","in-tree"]],"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","~/components/Prices.vue":"_astro/Prices.a1302bf9.js","/astro/hoisted.js?q=0":"_astro/hoisted.721ad75d.js","@@sf/components/ProductCard.vue":"_astro/ProductCard.1a45764a.js","~/components/PitchBar.vue":"_astro/PitchBar.457658a3.js","~/components/ShopHeader.vue":"_astro/ShopHeader.0a6766ac.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.295a6886.js","@astrojs/vue/client.js":"_astro/client.b854166f.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.7ce2ebb1.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/index.0c833781.css","/_astro/server.60de185d.css","/_astro/_...slug_.6721f699.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-e2ee76b5.js","/_astro/PitchBar.457658a3.js","/_astro/Prices.a1302bf9.js","/_astro/ProductCard.1a45764a.js","/_astro/ShopHeader.0a6766ac.js","/_astro/_plugin-vue_export-helper.6da04e63.js","/_astro/client.b854166f.js","/_astro/firebase-app.7ce2ebb1.js","/_astro/format-money.6f464cee.js","/_astro/hoisted.721ad75d.js","/_astro/idle-callback.889bf0ea.js","/_astro/index.a500792d.js","/_astro/modules-info.80ae4e30.js","/_astro/preload-helper.101896b7.js","/_astro/runtime-dom.esm-bundler.acde10ec.js","/_astro/session-utm.72684b84.js","/_astro/workbox-window.prod.es5.295a6886.js","/admin/config.json","/assets/cms-preview.css","/assets/cms.css","/assets/cvv.png","/assets/img-placeholder.png","/assets/payments.png","/assets/ssl-safe.png","/img/icon.png","/img/large-icon.png","/img/uploads/banner1.png","/img/uploads/banner2.png","/img/uploads/banner2.webp","/img/uploads/favicon.png","/img/uploads/headless.png","/img/uploads/headphone.png","/img/uploads/headphone.webp","/img/uploads/icon.png","/img/uploads/large-icon.png","/img/uploads/logo.png","/img/uploads/logo.webp","/img/uploads/og-image.png","/img/uploads/passion.png","/img/uploads/passion.webp","/img/uploads/pwa-reliable.png","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.png","/img/uploads/rect89.webp","/img/uploads/ssl-safe.png","/assets/icons/bootstrap-icons/font/storefront-icons.woff2","/assets/icons/feather-icons/font/storefront-icons.woff2","/assets/icons/font-awesome/font/storefront-icons.woff2","/assets/icons/line-awesome/font/storefront-icons.woff2","/assets/icons/tabler-icons/font/storefront-icons.woff2","/fallback/index.html"]}), {
|
|
3384
3384
|
pageMap: pageMap,
|
|
3385
3385
|
renderers: renderers
|
|
3386
3386
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ProductSet,
|
|
3
|
+
CategorySet,
|
|
4
|
+
BrandSet,
|
|
5
|
+
CollectionSet,
|
|
6
|
+
} from '@cloudcommerce/api/types';
|
|
7
|
+
import type { CmsSettings } from './src/lib/cms';
|
|
8
|
+
|
|
9
|
+
declare global {
|
|
10
|
+
// eslint-disable-next-line
|
|
11
|
+
var storefront: {
|
|
12
|
+
settings: Partial<CmsSettings>,
|
|
13
|
+
context?: {
|
|
14
|
+
resource: 'products',
|
|
15
|
+
doc: ProductSet,
|
|
16
|
+
timestamp: number,
|
|
17
|
+
} | {
|
|
18
|
+
resource: 'categories',
|
|
19
|
+
doc: CategorySet,
|
|
20
|
+
timestamp: number,
|
|
21
|
+
} | {
|
|
22
|
+
resource: 'brands',
|
|
23
|
+
doc: BrandSet,
|
|
24
|
+
timestamp: number,
|
|
25
|
+
} | {
|
|
26
|
+
resource: 'collections',
|
|
27
|
+
doc: CollectionSet,
|
|
28
|
+
timestamp: number,
|
|
29
|
+
},
|
|
30
|
+
onLoad: (callback: (...args: any[]) => void) => void,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type FetchParams = Parameters<typeof fetch>;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const afetch = (url: FetchParams[0], init?: FetchParams[1], timeout = 10000) => {
|
|
4
4
|
let abortController: AbortController | undefined;
|
|
5
5
|
let timer;
|
|
6
6
|
if (timeout) {
|
|
@@ -28,3 +28,5 @@ export default (url: FetchParams[0], init?: FetchParams[1], timeout = 10000) =>
|
|
|
28
28
|
});
|
|
29
29
|
return promise;
|
|
30
30
|
};
|
|
31
|
+
|
|
32
|
+
export default afetch;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
let userAgent: string;
|
|
2
|
+
let screenWidth: number;
|
|
3
|
+
if (!import.meta.env.SSR) {
|
|
4
|
+
userAgent = navigator.userAgent;
|
|
5
|
+
screenWidth = document.body ? document.body.offsetWidth : window.screen.width;
|
|
6
|
+
} else {
|
|
7
|
+
userAgent = '';
|
|
8
|
+
screenWidth = 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const isSafari = userAgent.includes('Safari') && !userAgent.includes('Chrome');
|
|
12
|
+
|
|
13
|
+
export const isSafariNew = isSafari && /Version\/1[4-9]/i.test(userAgent);
|
|
14
|
+
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
export const isIOS = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream;
|
|
17
|
+
|
|
18
|
+
export const isMobile = isIOS || /Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
|
|
19
|
+
|
|
20
|
+
export const isScreenXs = screenWidth < 640;
|
|
21
|
+
|
|
22
|
+
export const isScreenLg = screenWidth >= 1024;
|
|
@@ -4,12 +4,10 @@ import {
|
|
|
4
4
|
i19accessMyAccount,
|
|
5
5
|
i19createAnAccount,
|
|
6
6
|
i19enterWithPassword,
|
|
7
|
-
i19hello,
|
|
8
7
|
i19iForgotMyPassword,
|
|
9
8
|
i19password,
|
|
10
9
|
i19sendLoginCodeByEmail,
|
|
11
10
|
i19signUp,
|
|
12
|
-
i19visitor,
|
|
13
11
|
} from '@@i18n';
|
|
14
12
|
import {
|
|
15
13
|
getAuth,
|
|
@@ -22,9 +20,20 @@ import {
|
|
|
22
20
|
isLogged,
|
|
23
21
|
} from '@@sf/state/customer-session';
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
// eslint-disable-next-line no-spaced-func, func-call-spacing
|
|
24
|
+
const emit = defineEmits<{
|
|
25
|
+
(e: 'set:is-logged', value: boolean): void
|
|
26
|
+
(e: 'set:email', value: string): void
|
|
27
|
+
(e: 'set:customer-name', value: string): void
|
|
28
|
+
}>();
|
|
26
29
|
watch(isLogged, (_isLogged) => {
|
|
27
|
-
emit(
|
|
30
|
+
emit('set:is-logged', _isLogged);
|
|
31
|
+
emit('set:customer-name', customerName.value);
|
|
32
|
+
}, {
|
|
33
|
+
immediate: true,
|
|
34
|
+
});
|
|
35
|
+
watch(email, (_email) => {
|
|
36
|
+
emit('set:email', _email);
|
|
28
37
|
}, {
|
|
29
38
|
immediate: true,
|
|
30
39
|
});
|
|
@@ -58,11 +67,6 @@ const submitLogin = async () => {
|
|
|
58
67
|
</script>
|
|
59
68
|
|
|
60
69
|
<template>
|
|
61
|
-
<slot name="greetings" v-bind="{ customerName }">
|
|
62
|
-
<div class="text-xl font-medium mb-5">
|
|
63
|
-
{{ `${i19hello} ${customerName || i19visitor}` }}
|
|
64
|
-
</div>
|
|
65
|
-
</slot>
|
|
66
70
|
<form
|
|
67
71
|
class="login-form text-base"
|
|
68
72
|
@submit.prevent="submitLogin"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NetworkName } from '@@sf/server-data';
|
|
3
|
+
import { computed } from 'vue';
|
|
4
|
+
|
|
5
|
+
export interface Props {
|
|
6
|
+
as?: string;
|
|
7
|
+
network: NetworkName;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
11
|
+
as: 'i',
|
|
12
|
+
});
|
|
13
|
+
const iconClassName = computed(() => {
|
|
14
|
+
switch (props.network) {
|
|
15
|
+
case 'facebook': return 'i-facebook';
|
|
16
|
+
case 'instagram': return 'i-instagram';
|
|
17
|
+
case 'whatsapp': return 'i-whatsapp';
|
|
18
|
+
case 'youtube': return 'i-youtube';
|
|
19
|
+
case 'pinterest': return 'i-pinterest';
|
|
20
|
+
case 'tiktok': return 'i-tiktok';
|
|
21
|
+
case 'twitter': return 'i-twitter';
|
|
22
|
+
default: return '';
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<component :is="as" :class="iconClassName" />
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NetworkName } from '@@sf/server-data';
|
|
3
|
+
import { computed } from 'vue';
|
|
4
|
+
import { isMobile } from '@@sf/browser-env';
|
|
5
|
+
import { socialNetworks } from '@@sf/server-data';
|
|
6
|
+
import SocialNetworkIcon from '@@sf/components/SocialNetworkIcon.vue';
|
|
7
|
+
|
|
8
|
+
export interface Props {
|
|
9
|
+
network: NetworkName;
|
|
10
|
+
href?: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = defineProps<Props>();
|
|
15
|
+
const fixedHref = computed(() => {
|
|
16
|
+
let href = props.href || socialNetworks[props.network];
|
|
17
|
+
if (props.network === 'whatsapp') {
|
|
18
|
+
const tel = href.replace(/[^+\d]/g, '');
|
|
19
|
+
// eslint-disable-next-line prefer-template
|
|
20
|
+
href = `https://${(isMobile ? 'api' : 'web')}.whatsapp.com/send?phone=`
|
|
21
|
+
+ encodeURIComponent(tel.charAt(0) === '+' ? tel : `+55${tel}`);
|
|
22
|
+
if (props.message) {
|
|
23
|
+
href += `&text=${encodeURIComponent(props.message)}`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return href;
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<ALink :href="fixedHref">
|
|
32
|
+
<slot>
|
|
33
|
+
<SocialNetworkIcon :network="network" />
|
|
34
|
+
<slot name="append"></slot>
|
|
35
|
+
</slot>
|
|
36
|
+
</ALink>
|
|
37
|
+
</template>
|
|
@@ -9,11 +9,11 @@ export interface Props {
|
|
|
9
9
|
const props = defineProps<Props>();
|
|
10
10
|
const linkTarget = computed(() => {
|
|
11
11
|
if (props.target) return props.target;
|
|
12
|
-
if (props.href.startsWith('http')
|
|
12
|
+
if (props.href.startsWith('http')) {
|
|
13
13
|
const domain = globalThis.storefront.settings.domain || window.location.host;
|
|
14
14
|
if (props.href.startsWith(`https://${domain}`)) return null;
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return '_blank';
|
|
17
17
|
});
|
|
18
18
|
</script>
|
|
19
19
|
|
|
@@ -32,7 +32,7 @@ if (apiDoc) {
|
|
|
32
32
|
apiDoc.price = getPrice(apiDoc);
|
|
33
33
|
}
|
|
34
34
|
const slimDocRegex = globalThis.storefront_slim_doc_regex
|
|
35
|
-
|| /
|
|
35
|
+
|| /body_|meta_|metafields|_records|i18n/;
|
|
36
36
|
const minifyApiDoc = (nestedDoc: any) => {
|
|
37
37
|
if (typeof nestedDoc === 'object' && nestedDoc) {
|
|
38
38
|
if (Array.isArray(nestedDoc)) {
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { initializeApp } from 'firebase/app';
|
|
2
|
+
import {
|
|
3
|
+
getAuth,
|
|
4
|
+
onAuthStateChanged,
|
|
5
|
+
isSignInWithEmailLink,
|
|
6
|
+
signInWithEmailLink,
|
|
7
|
+
// updateProfile,
|
|
8
|
+
} from 'firebase/auth';
|
|
2
9
|
|
|
3
|
-
const
|
|
10
|
+
const firebaseApp = initializeApp(window.firebaseConfig);
|
|
4
11
|
|
|
5
|
-
export default
|
|
12
|
+
export default firebaseApp;
|
|
6
13
|
|
|
7
|
-
export
|
|
14
|
+
export {
|
|
15
|
+
firebaseApp,
|
|
16
|
+
getAuth,
|
|
17
|
+
onAuthStateChanged,
|
|
18
|
+
isSignInWithEmailLink,
|
|
19
|
+
signInWithEmailLink,
|
|
20
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const {
|
|
2
|
+
settings,
|
|
3
|
+
context: apiContext,
|
|
4
|
+
} = globalThis.storefront;
|
|
5
|
+
|
|
6
|
+
const networkNames = [
|
|
7
|
+
'whatsapp',
|
|
8
|
+
'instagram',
|
|
9
|
+
'facebook',
|
|
10
|
+
'twitter',
|
|
11
|
+
'youtube',
|
|
12
|
+
'tiktok',
|
|
13
|
+
'pinterest',
|
|
14
|
+
] as const;
|
|
15
|
+
type NetworkName = typeof networkNames[number];
|
|
16
|
+
const socialNetworks: Partial<Record<NetworkName, string>> = {};
|
|
17
|
+
networkNames.forEach((network: NetworkName) => {
|
|
18
|
+
if (settings[network]) {
|
|
19
|
+
socialNetworks[network] = settings[network];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { settings, apiContext, socialNetworks };
|
|
24
|
+
|
|
25
|
+
export type { NetworkName };
|
|
@@ -27,11 +27,6 @@ const getConfig: () => StorefrontConfig = _getConfig;
|
|
|
27
27
|
declare global {
|
|
28
28
|
// eslint-disable-next-line
|
|
29
29
|
var api_prefetch_endpoints: ApiEndpoint[];
|
|
30
|
-
// eslint-disable-next-line
|
|
31
|
-
var storefront: {
|
|
32
|
-
settings: Partial<CmsSettings>,
|
|
33
|
-
onLoad: (callback: (...args: any[]) => void) => void,
|
|
34
|
-
};
|
|
35
30
|
}
|
|
36
31
|
if (!globalThis.api_prefetch_endpoints) {
|
|
37
32
|
globalThis.api_prefetch_endpoints = ['categories'];
|
|
@@ -70,7 +65,7 @@ const loadPageContext = async (Astro: AstroGlobal, {
|
|
|
70
65
|
const config = getConfig();
|
|
71
66
|
globalThis.storefront.settings = config.settings;
|
|
72
67
|
let cmsContent: Record<string, any> | undefined;
|
|
73
|
-
let apiResource:
|
|
68
|
+
let apiResource: 'products' | 'categories' | 'brands' | 'collections' | undefined;
|
|
74
69
|
let apiDoc: Record<string, any> | undefined;
|
|
75
70
|
const apiState: {
|
|
76
71
|
categories?: CategoriesList,
|
|
@@ -133,6 +128,13 @@ const loadPageContext = async (Astro: AstroGlobal, {
|
|
|
133
128
|
} else {
|
|
134
129
|
setResponseCache(Astro, 120, 300);
|
|
135
130
|
}
|
|
131
|
+
if (apiDoc) {
|
|
132
|
+
globalThis.storefront.context = {
|
|
133
|
+
resource: apiResource,
|
|
134
|
+
doc: apiDoc as any,
|
|
135
|
+
timestamp: Date.now(),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
136
138
|
const pageContext = {
|
|
137
139
|
...config,
|
|
138
140
|
isHomepage,
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import type { Customers } from '@cloudcommerce/api/types';
|
|
2
|
+
import type { Auth } from 'firebase/auth';
|
|
2
3
|
import api from '@cloudcommerce/api';
|
|
3
4
|
import { nickname as getNickname } from '@ecomplus/utils';
|
|
4
5
|
import { computed } from 'vue';
|
|
5
|
-
import
|
|
6
|
-
getAuth,
|
|
7
|
-
onAuthStateChanged,
|
|
8
|
-
isSignInWithEmailLink,
|
|
9
|
-
signInWithEmailLink,
|
|
10
|
-
// updateProfile,
|
|
11
|
-
} from 'firebase/auth';
|
|
6
|
+
import requestIdleCallback from '../../helpers/idle-callback';
|
|
12
7
|
import useStorage from './use-storage';
|
|
13
|
-
import '../scripts/firebase-app';
|
|
14
8
|
|
|
15
9
|
const storageKey = 'SESSION';
|
|
16
10
|
const emptySession = {
|
|
@@ -44,18 +38,9 @@ const customerEmail = computed({
|
|
|
44
38
|
},
|
|
45
39
|
});
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
if (isSignInWithEmailLink(firebaseAuth, window.location.href)) {
|
|
49
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
50
|
-
const email = urlParams.get('email');
|
|
51
|
-
if (email) {
|
|
52
|
-
signInWithEmailLink(firebaseAuth, email, window.location.href)
|
|
53
|
-
.catch(console.error);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
41
|
+
let firebaseAuth: Auth;
|
|
57
42
|
const isLogged = computed(() => {
|
|
58
|
-
return isAuthenticated.value || !!firebaseAuth
|
|
43
|
+
return isAuthenticated.value || !!firebaseAuth?.currentUser?.emailVerified;
|
|
59
44
|
});
|
|
60
45
|
const logout = () => {
|
|
61
46
|
session.auth = emptySession.auth;
|
|
@@ -97,21 +82,56 @@ const fetchCustomer = async () => {
|
|
|
97
82
|
return data;
|
|
98
83
|
};
|
|
99
84
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
85
|
+
let isAuthInitialized = false;
|
|
86
|
+
const initializeFirebaseAuth = (canWaitIdle = !window.location.pathname.startsWith('/app/')) => {
|
|
87
|
+
if (import.meta.env.SSR || isAuthInitialized) return;
|
|
88
|
+
isAuthInitialized = true;
|
|
89
|
+
const runImport = () => import('../scripts/firebase-app')
|
|
90
|
+
.then(({
|
|
91
|
+
getAuth,
|
|
92
|
+
onAuthStateChanged,
|
|
93
|
+
isSignInWithEmailLink,
|
|
94
|
+
signInWithEmailLink,
|
|
95
|
+
}) => {
|
|
96
|
+
firebaseAuth = getAuth();
|
|
97
|
+
onAuthStateChanged(firebaseAuth, async (user) => {
|
|
98
|
+
if (user) {
|
|
99
|
+
if (user.displayName && !customerName.value) {
|
|
100
|
+
session.customer.display_name = user.displayName;
|
|
101
|
+
}
|
|
102
|
+
if (user.email && (!customerEmail.value || user.emailVerified)) {
|
|
103
|
+
session.customer.main_email = user.email;
|
|
104
|
+
}
|
|
105
|
+
if (user.emailVerified) {
|
|
106
|
+
const isEmailChanged = user.email !== customerEmail.value;
|
|
107
|
+
if (isEmailChanged || !isAuthenticated.value) {
|
|
108
|
+
await authenticate();
|
|
109
|
+
if (isEmailChanged || !customerName.value) {
|
|
110
|
+
await fetchCustomer();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
logout();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
if (isSignInWithEmailLink(firebaseAuth, window.location.href)) {
|
|
119
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
120
|
+
const email = urlParams.get('email');
|
|
121
|
+
if (email) {
|
|
122
|
+
signInWithEmailLink(firebaseAuth, email, window.location.href)
|
|
123
|
+
.then(() => window.localStorage.removeItem('emailForSignIn'))
|
|
124
|
+
.catch(console.error);
|
|
108
125
|
}
|
|
109
126
|
}
|
|
110
|
-
}
|
|
127
|
+
})
|
|
128
|
+
.catch(console.error);
|
|
129
|
+
if (canWaitIdle) {
|
|
130
|
+
requestIdleCallback(runImport);
|
|
111
131
|
} else {
|
|
112
|
-
|
|
132
|
+
runImport();
|
|
113
133
|
}
|
|
114
|
-
}
|
|
134
|
+
};
|
|
115
135
|
|
|
116
136
|
export default session;
|
|
117
137
|
|
|
@@ -126,4 +146,5 @@ export {
|
|
|
126
146
|
authenticate,
|
|
127
147
|
getAccessToken,
|
|
128
148
|
fetchCustomer,
|
|
149
|
+
initializeFirebaseAuth,
|
|
129
150
|
};
|
|
@@ -8,6 +8,7 @@ import { formatMoney } from '@ecomplus/utils';
|
|
|
8
8
|
import loadingGlobalInfoPreset from '@@sf/scripts/modules-info-preset';
|
|
9
9
|
import utm from '@@sf/scripts/session-utm';
|
|
10
10
|
import afetch from '../../helpers/afetch';
|
|
11
|
+
import requestIdleCallback from '../../helpers/idle-callback';
|
|
11
12
|
|
|
12
13
|
const emptyInfo = {
|
|
13
14
|
list_payments: {},
|
|
@@ -140,11 +141,7 @@ if (!import.meta.env.SSR) {
|
|
|
140
141
|
.catch(console.error);
|
|
141
142
|
});
|
|
142
143
|
};
|
|
143
|
-
|
|
144
|
-
window.requestIdleCallback(fetchInfo);
|
|
145
|
-
} else {
|
|
146
|
-
setTimeout(fetchInfo, 300);
|
|
147
|
-
}
|
|
144
|
+
requestIdleCallback(fetchInfo);
|
|
148
145
|
}
|
|
149
146
|
|
|
150
147
|
export default modulesInfo;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as G}from"./runtime-dom.esm-bundler.e8b26f2c.js";import{p as J}from"./modules-info.e8935203.js";import{c as g,d as z,_ as R,l as Q,o as u,a as p,m as x,e as I,n as D,i as d,p as b,q as O,s as X,u as Y,v as Z,x as ee,j as $,w as h,k as q,g as C,y as te,z as ae,A as oe,F as ne,B as re,b as se}from"./_plugin-vue_export-helper.e6f0b936.js";import{u as le,a as ie,b as ue}from"./index.5dd878ac.js";/* empty css */import"./session-utm.72684b84.js";import"./ecom-utils.92f137f6.js";const ce=o=>{const r=g(()=>o.slides.map(({html:e})=>J(e).value)),a=g(()=>r.value.filter(e=>e).length);return{parsedContents:r,countValidSlides:a}},K=Symbol("carousel"),de=z({__name:"CarouselControl",props:{direction:{default:1}},setup(o,{expose:r}){r();const{changeSlide:a}=Q(K),e={changeSlide:a};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),fe=["aria-label","data-carousel-control"];function pe(o,r,a,e,s,n){return u(),p("button",{type:"button","aria-label":a.direction>0?"Próximo":"Anterior",onClick:r[0]||(r[0]=i=>e.changeSlide(a.direction)),"data-carousel-control":a.direction>0?"next":"previous"},[x(o.$slots,"default",{},()=>[I("i",{class:D(["m-0",a.direction>0?"i-chevron-right":"i-chevron-left"])},null,2)])],8,fe)}const U=R(de,[["render",pe]]),he=z({__name:"Carousel",props:{as:{default:"ul"},modelValue:{default:1},autoplay:null},emits:["update:modelValue"],setup(o,{expose:r,emit:a}){r();const e=o,s=d(e.modelValue-1);b(O(e,"modelValue"),t=>{s.value=t-1}),b(s,(t,l)=>{t!==l&&a("update:modelValue",t+1)});const n=d(null),{x:i,isScrolling:f,arrivedState:S}=le(n),y=g(()=>S.left),w=g(()=>S.right),m=d([]),B=d(0),P=d(0),V=d(0),j=()=>{B.value=n.value.scrollWidth,P.value=n.value.offsetWidth},A=()=>{const t=[...n.value.children];m.value=t.map(l=>({offsetLeft:l.offsetLeft,width:l.offsetWidth}))},E=t=>{const l=t>0?s.value:s.value+t,M=m.value[l]?.width||0;return M?M*t:0},L=()=>{const t=m.value.findIndex(l=>Math.abs(l.offsetLeft-i.value)<=5);t>-1&&(s.value=t||0)},T=()=>{const t=B.value-P.value;V.value=m.value.findIndex(({offsetLeft:l})=>l>=t-5)};let c=null;const v=()=>{e.autoplay&&(clearTimeout(c),c=setTimeout(()=>{_(1)},e.autoplay))},_=t=>{if(t<0){if(y.value){T(),s.value=V.value-1,_(1);return}}else if(w.value){s.value=1,_(-1);return}const l=E(t);l&&(n.value.scrollBy({left:l,behavior:"smooth"}),v())};b(f,t=>{t?clearTimeout(c):(L(),v())});const N=d(null),F=ie(N);b(F,t=>{t?clearTimeout(c):v()});const W=()=>{n.value&&(j(),A(),L(),T())},k=ue(W,400);X(()=>{W(),Y(()=>{[...n.value.children].forEach(t=>{t.setAttribute("tabindex","0")})}),v(),window.addEventListener("resize",k)}),Z(()=>{window.removeEventListener("resize",k),clearTimeout(c)}),ee(K,{autoplay:O(e,"autoplay"),changeSlide:_,isBoundLeft:y,isBoundRight:w});const H={props:e,emit:a,currentIndex:s,wrapper:n,currentPos:i,isScrolling:f,arrivedState:S,isBoundLeft:y,isBoundRight:w,slidesWidth:m,wrapperScrollWidth:B,wrapperVisibleWidth:P,indexCount:V,calcWrapperWidth:j,calcSlidesWidth:A,calcNextWidth:E,calcCurrentIndex:L,calcIndexCount:T,get autoplayTimer(){return c},set autoplayTimer(t){c=t},restartAutoplay:v,changeSlide:_,carousel:N,isHovered:F,calcOnInit:W,onResize:k,CarouselControl:U};return Object.defineProperty(H,"__isScriptSetup",{enumerable:!1,value:!0}),H}}),me={ref:"carousel","data-carousel":""};function ve(o,r,a,e,s,n){return u(),p("div",me,[(u(),$(q(a.as),{ref:"wrapper","data-carousel-wrapper":""},{default:h(()=>[x(o.$slots,"default")]),_:3},512)),x(o.$slots,"controls",te(ae({changeSlide:e.changeSlide,isBoundLeft:e.isBoundLeft,isBoundRight:e.isBoundRight,currentPage:e.currentIndex+1,pageCount:e.indexCount+1})),()=>[C(e.CarouselControl,{direction:-1},{default:h(()=>[x(o.$slots,"previous")]),_:3}),C(e.CarouselControl,null,{default:h(()=>[x(o.$slots,"next")]),_:3})])],512)}const _e=R(he,[["render",ve]]),xe=z({__name:"PitchBar",props:{slides:null},setup(o,{expose:r}){r();const a=o,{parsedContents:e,countValidSlides:s}=ce(a),n={props:a,parsedContents:e,countValidSlides:s,Carousel:_e,CarouselControl:U};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),Ce={class:"bg-base-100 relative z-1"},be={class:"container md:w-2/3 mx-auto px-3 py-1"},ge=["innerHTML"],Se={class:"text-xl leading-none text-base-400"};function ye(o,r,a,e,s,n){return u(),p("div",Ce,[I("div",be,[C(e.Carousel,{autoplay:e.countValidSlides>1?7e3:null},{controls:h(()=>[oe(I("div",Se,[C(e.CarouselControl,{direction:-1,class:"pr-2 bg-base-100 hover:text-base-700"}),C(e.CarouselControl,{class:"pl-2 bg-base-100 hover:text-base-700"})],512),[[G,e.countValidSlides>1]])]),default:h(()=>[(u(!0),p(ne,null,re(a.slides,(i,f)=>(u(),p("li",{key:f},[(u(),$(q(i.href?"ALink":"span"),{href:i.href,target:i.target,class:D(["inline-block px-8",i.href?"hover:underline":null])},{default:h(()=>[e.parsedContents[f]?(u(),p("span",{key:0,innerHTML:e.parsedContents[f],class:"prose text-sm text-base-800"},null,8,ge)):se("",!0)]),_:2},1032,["href","target","class"]))]))),128))]),_:1},8,["autoplay"])])])}const ke=R(xe,[["render",ye]]);export{ke as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as k}from"./modules-info.e8935203.js";import{g,c as S}from"./ecom-utils.92f137f6.js";import{c as a,d as M,_ as T,a as i,t as o,b as u,e as h,f as C,n as I,g as L,w as D,r as z,o as l}from"./_plugin-vue_export-helper.e6f0b936.js";/* empty css */import"./session-utm.72684b84.js";const j=(n,c)=>{const{type:s,value:t}=c;let r;return t?(s==="percentage"?r=n*((100-t)/100):r=n-t,r>0?r:0):n},E=n=>{const c=a(()=>n.product||{price:n.price||0,base_price:n.basePrice}),s=a(()=>{const{variations:e}=c.value;if(e){const d=g(c.value);for(let v=0;v<e.length;v++)if(g({...c.value,...e[v]})>d)return!0}return!1}),t=a(()=>k.apply_discount.available_extra_discount),r=a(()=>{const e=g(c.value),d=t.value;return d&&(!d.min_amount||e>d.min_amount)?j(e,d):e}),f=a(()=>{if(S(c.value))return c.value.base_price;const e=g(c.value);return e>r.value?e:0}),m=a(()=>n.installmentsOption||k.list_payments.installments_option||{max_number:1}),b=a(()=>{if(m.value.max_number<=1)return 1;const e=m.value.min_installment||5,d=Math.round(r.value/e);return Math.min(d,m.value.max_number)}),y=a(()=>m.value.monthly_interest||0),V=a(()=>{if(b.value>=2){if(!y.value)return r.value/b.value;const e=y.value/100;return r.value*e/(1-(1+e)**-b.value)}return 0}),p=a(()=>{const e=n.discountOption||k.list_payments.discount_option;return e&&(!e.min_amount||e.min_amount<=r.value)&&(!n.isAmountTotal||e.apply_at==="total")?e:{}}),x=a(()=>{const{label:e}=p.value;return e?e.includes(" ")?e:`via ${e}`:""}),O=a(()=>j(r.value,p.value)),_=a(()=>{if(n.loyaltyPointsProgram)return n.loyaltyPointsProgram;const e=k.list_payments.loyalty_points_programs;if(e){const d=Object.keys(e);for(let v=0;v<d.length;v++){const P=e[d[v]];if(P&&P.earn_percentage>0)return P}}return{ratio:0}}),W=a(()=>_.value.min_subtotal_to_earn||0),w=a(()=>_.value.name||""),N=a(()=>_.value.earn_percentage||0),B=a(()=>N.value*_.value.ratio),A=a(()=>B.value>=1?r.value*(B.value/100):0);return{hasVariedPrices:s,salePrice:r,comparePrice:f,installmentsObject:m,installmentsNumber:b,monthlyInterest:y,installmentValue:V,discountObject:p,discountLabel:x,priceWithDiscount:O,pointsProgramObject:_,pointsMinPrice:W,pointsProgramName:w,earnPointsPercentage:N,cashbackPercentage:B,cashbackValue:A}},F=M({__name:"Prices",props:{product:null,price:null,basePrice:null,isAmountTotal:{type:Boolean},installmentsOption:null,discountOption:null,isBig:{type:Boolean},isLiteral:{type:Boolean},hasCashback:{type:Boolean,default:!0},hasPriceOptions:{type:Boolean,default:!0}},setup(n,{expose:c}){c();const s=n,{hasVariedPrices:t,salePrice:r,comparePrice:f,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:V,installmentValue:p,priceWithDiscount:x,discountLabel:O}=E(s),_={props:s,hasVariedPrices:t,salePrice:r,comparePrice:f,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:V,installmentValue:p,priceWithDiscount:x,discountLabel:O};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),R={key:0,class:"text-base-500 mr-1"},q={key:0},G={key:1},H={key:0},J={key:0,class:"relative z-10"},K=["data-tooltip"],Q=h("i",{class:"i-cashback mr-1"},null,-1),U={class:"font-medium"},X=h("small",null," cashback",-1),Y={key:0},Z={key:0},$={key:1},ee={key:2},te={key:0},ne={key:0},ae={key:1};function se(n,c,s,t,r,f){const m=z("Fade");return l(),i("div",{class:I(["text-base-600",s.isBig?"text-lg":null]),"data-prices":""},[t.comparePrice?(l(),i("span",R,[s.isLiteral?(l(),i("small",q,o("De "))):u("",!0),h("s",null,o(n.$money(t.comparePrice)),1),s.isLiteral?(l(),i("small",G,o(" Por"))):u("",!0)])):u("",!0),h("strong",{class:I(["inline-block text-base-800",s.isBig?"text-5xl block":null])},[t.hasVariedPrices?(l(),i("small",H,o("A partir de "))):u("",!0),C(" "+o(n.$money(t.salePrice)),1)],2),L(m,{slide:"down"},{default:D(()=>[t.cashbackValue&&s.hasCashback?(l(),i("div",J,[h("span",{"data-tooltip":"Receba $1 de volta".replace("$1",n.$percentage(t.cashbackPercentage))},[Q,h("span",U,o(n.$money(t.cashbackValue)),1),X],8,K)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.installmentValue&&s.hasPriceOptions?(l(),i("div",Y,[s.isLiteral?(l(),i("small",Z,o("Até "))):u("",!0),C(" "+o(t.installmentsNumber)+"x ",1),s.isLiteral?(l(),i("small",$,o(" De "))):u("",!0),h("span",null,o(n.$money(t.installmentValue)),1),!t.monthlyInterest&&s.isLiteral?(l(),i("small",ee,o("Sem juros"))):u("",!0)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.priceWithDiscount<t.salePrice&&s.hasPriceOptions?(l(),i("div",te,[t.discountLabel?u("",!0):(l(),i("small",ne,o("A partir de "))),h("span",null,o(n.$money(t.priceWithDiscount)),1),t.discountLabel?(l(),i("small",ae,o(` ${t.discountLabel}`),1)):u("",!0)])):u("",!0)]),_:1})],2)}const ue=T(F,[["render",se]]);export{ue as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import d from"./Prices.99fa99bf.js";import{d as _,_ as u,i as o,j as f,w as t,k as m,o as P,g as r,f as n,t as l}from"./_plugin-vue_export-helper.e6f0b936.js";import"./modules-info.e8935203.js";import"./session-utm.72684b84.js";import"./ecom-utils.92f137f6.js";/* empty css */const b=_({__name:"ProductCard",props:{as:{default:"div"}},setup(p,{expose:s}){s();const i=o(12),e=o(!1);setTimeout(()=>{i.value=8,e.value=!0},5e3);const c={price:i,isBig:e,Prices:d};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}});function g(p,s,i,e,c,v){return P(),f(m(i.as),null,{default:t(()=>[r(e.Prices,null,{default:t(({salePrice:a})=>[n(" ProductCard "+l(a),1)]),_:1}),r(e.Prices,{product:{price:e.price}},null,8,["product"]),r(e.Prices,{price:12,"base-price":17}),r(e.Prices,{price:12,"base-price":16,"is-literal":!0}),r(e.Prices,{price:12,"is-big":e.isBig},null,8,["is-big"]),r(e.Prices,{price:14,"base-price":18,"is-big":e.isBig,"is-literal":!0},null,8,["is-big"]),r(e.Prices,{price:12,"base-price":16},{"compare-value":t(({comparePrice:a})=>[n(" x"+l(a),1)]),_:1})]),_:1})}const h=u(b,[["render",g]]);export{h as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as M,u as N,p as A,b as R}from"./index.5dd878ac.js";import{i as g,c as w,p as b,s as U,d as C,q as X,_ as O,r as j,o as r,j as T,w as H,a as m,n as _,e as i,m as z,b as x,a2 as q,g as E,t as B,F as P,B as Y,a3 as G,a4 as I,a5 as $}from"./_plugin-vue_export-helper.e6f0b936.js";import{w as J}from"./runtime-dom.esm-bundler.e8b26f2c.js";const K=s=>{const{header:a,canSetStyles:t,canCreateHeightDiv:e,isShownOnScrollDown:o}={canSetStyles:!0,canCreateHeightDiv:!0,...s},{ready:c,start:n}=M(100,{controls:!0,immediate:!1}),l=g(0),d=g(0);let h;const{y:v}=N(document),f=w(()=>c.value&&v.value>d.value*1.2),u=g("none");b(f,async p=>{t&&(a.value.style.position=p?"sticky":null),h&&(h.style.height=p?`${l.value}px`:null),p?(await A(300),u.value="opacity var(--transition-slow), transform var(--transition)"):(n(),u.value="none")});const V=g(!1);return b(v,(p,k)=>{V.value=p>0&&p<k}),U(()=>{const p=()=>{l.value=a.value.offsetHeight,d.value=l.value+window.pageYOffset+a.value.getBoundingClientRect().top,n()},k=a.value.getElementsByTagName("IMG");let F=!0;for(let y=0;y<k.length;y++){const S=k[y];(!S.complete||S.naturalHeight===0)&&(F=!1,S.onload=p)}F&&p(),window.addEventListener("resize",R(p,300)),t&&(a.value.style.willChange="transform",b([f,V],([y,S])=>{let D=null,L=null;y&&(!S||o)&&(D="0",L="translateY(-100%)"),a.value.style.opacity=D,a.value.style.transform=L}),b(u,y=>{a.value.style.transition=y})),e&&(h=document.createElement("div"),a.value.parentElement.insertBefore(h,a.value))}),{staticHeight:l,staticY:d,isSticky:f,isScrollUp:V,transition:u}},Q=s=>s.filter(({slug:a,parent:t})=>a&&!t),W=(s,a)=>s.filter(({slug:t,parent:e})=>t&&e?e._id===a._id||e.slug&&e.slug===a.slug:!1),Z=s=>{const{header:a}=s,{isSticky:t,staticHeight:e,staticY:o}=K({header:a}),c=w(()=>t.value?a.value.offsetHeight:o.value),n=Q(s.categories),l=f=>W(s.categories,f),d=f=>({...f,subcategories:l(f).map(u=>d(u))}),h=n.map(d),v=g(!1);return{isSticky:t,staticHeight:e,staticY:o,positionY:c,mainCategories:n,getSubcategories:l,getCategoryTree:d,categoryTrees:h,isSidenavOpen:v}},ee=C({__name:"Drawer",props:{modelValue:{type:Boolean,default:!1},placement:{default:"start"},position:{default:"fixed"},hasCloseButton:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(s,{expose:a,emit:t}){a();const e=s,o=()=>t("update:modelValue",!1),c=g(null),n=u=>{c.value?.contains(u.target)||o()},l=u=>{u.key==="Escape"&&o()};b(X(e,"modelValue"),async u=>{u?(document.body.style.overflow="hidden",setTimeout(()=>{document.addEventListener("click",n,{passive:!0}),document.addEventListener("keydown",l,{passive:!0})},500)):(document.body.style.overflow=null,document.removeEventListener("click",n),document.removeEventListener("keydown",l))});const d=w(()=>{switch(e.placement){case"start":return"left";case"end":return"right";case"top":return"up";default:return"down"}}),h=w(()=>e.position==="fixed"),v=w(()=>e.placement==="start"||e.placement==="end"),f={props:e,emit:t,close:o,drawer:c,outsideClickListener:n,escClickListener:l,slideTo:d,isFixed:h,isPlacementX:v};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),te=["open","data-drawer"],ae={class:"relative h-full"},se=["onClick"],ne=i("i",{class:"i-close text-base-400 text-3xl"},null,-1),oe={key:0,class:"fixed top-0 left-0 w-screen h-screen bg-black/50 z-40","data-drawer-backdrop":""};function le(s,a,t,e,o,c){const n=j("Fade");return r(),T(n,{slide:e.slideTo,speed:"slow","is-floating":""},{default:H(()=>[t.modelValue?(r(),m("dialog",{key:0,ref:"drawer",class:_(["w-screen max-w-sm shadow p-0 m-0 z-50",[t.position,e.isFixed?`top-0 left-0 ${e.isPlacementX?"h-screen":""}`:null]]),open:t.modelValue,"data-drawer":t.placement},[i("div",ae,[t.hasCloseButton?(r(),m("button",{key:0,type:"button","aria-label":"Fechar",onClick:J(e.close,["prevent"]),class:_(["absolute top-2",t.placement==="end"?"left-2":"right-2"]),"data-drawer-close":""},[z(s.$slots,"close",{},()=>[ne])],10,se)):x("",!0),z(s.$slots,"default")]),(r(),T(q,{to:"#teleported-top"},[E(n,null,{default:H(()=>[t.modelValue?(r(),m("div",oe)):x("",!0)]),_:1})]))],10,te)):x("",!0)]),_:3},8,["slide"])}const re=O(ee,[["render",le]]),ie=C({__name:"ShopSidenavCategory",props:{categoryTree:null},setup(s,{expose:a}){a();const t=g(!1),e=g(!0);b(t,c=>{c?setTimeout(()=>{e.value=!1},25):e.value=!0});const o={isOpen:t,isFaded:e};return Object.defineProperty(o,"__isScriptSetup",{enumerable:!1,value:!0}),o}}),ce={class:"text-lg text-base-800"},de=["src"],ue=["href"],me=["href"],fe=["src"],pe={class:"inline"};function ge(s,a,t,e,o,c){const n=j("ShopSidenavCategory",!0);return r(),m("li",ce,[t.categoryTree.subcategories.length?(r(),m("details",{key:0,class:"bg-white overflow-y-auto overflow-x-hidden z-10 open:absolute open:top-0 open:left-0 open:w-full open:h-full",onToggle:a[0]||(a[0]=l=>e.isOpen=!e.isOpen)},[i("summary",{class:_(["cursor-pointer list-none px-6 py-3 active:bg-base-100 transition-colors",e.isOpen?"bg-base-100":null])},[i("i",{class:_(e.isOpen?"i-arrow-left text-lg":"i-arrow-right float-right mb-0 mt-1 text-xl text-base-500")},null,2),!e.isOpen&&t.categoryTree.icon?(r(),m("img",{key:0,loading:"lazy",src:t.categoryTree.icon.url,class:"w-auto h-5 inline mr-3"},null,8,de)):x("",!0),i("h3",{class:_(["inline",e.isOpen?"ml-4 text-base":null])},B(t.categoryTree.name),3)],2),i("ul",{class:_(["mt-2 transition-opacity",e.isFaded?"opacity-20":"opacity-100"]),tabindex:"-1"},[(r(!0),m(P,null,Y(t.categoryTree.subcategories,l=>(r(),T(n,{key:l._id,"category-tree":l},null,8,["category-tree"]))),128)),i("li",null,[i("a",{href:`/${t.categoryTree.slug}`,class:"block px-6 py-3 text-base underline active:bg-base-200"},B("Ver toda a categoria $1".replace("$1",t.categoryTree.name)),9,ue)])],2)],32)):(r(),m("a",{key:1,href:`/${t.categoryTree.slug}`,class:"block px-6 py-3 active:bg-base-200"},[!e.isOpen&&t.categoryTree.icon?(r(),m("img",{key:0,loading:"lazy",src:t.categoryTree.icon.url,class:"w-auto h-5 inline mr-3"},null,8,fe)):x("",!0),i("h3",pe,B(t.categoryTree.name),1)],8,me))])}const he=O(ie,[["render",ge]]),_e=C({__name:"ShopSidenav",props:{categoryTrees:null},setup(s,{expose:a}){a();const t={ShopSidenavCategory:he};return Object.defineProperty(t,"__isScriptSetup",{enumerable:!1,value:!0}),t}}),ye={class:"flex flex-col h-full"},ve={class:"py-4 grow"},be={class:"relative h-full"};function Se(s,a,t,e,o,c){return r(),m("aside",ye,[i("nav",ve,[i("ul",be,[(r(!0),m(P,null,Y(t.categoryTrees,n=>(r(),T(e.ShopSidenavCategory,{key:n._id,"category-tree":n},null,8,["category-tree"]))),128))])])])}const we=O(_e,[["render",Se]]),xe=C({__name:"ShopHeader",props:{categories:null},setup(s,{expose:a}){a();const t=s,e=g(null),{isSticky:o,positionY:c,categoryTrees:n,isSidenavOpen:l}=Z({...t,header:e}),d={props:t,header:e,isSticky:o,positionY:c,categoryTrees:n,isSidenavOpen:l,Drawer:re,ShopSidenav:we};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),ke={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"},Te={class:"md:hidden"},Ce=I('<nav class="hidden md:block"></nav><div class="px-2 flex justify-end items-center gap-3 lg:gap-4 text-base-800"><button aria-label="Buscar produtos"><i class="i-search w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button class="hidden sm:block" aria-label="Minha conta"><i class="i-account w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button><button aria-label="Abrir carrinho"><i class="i-shopping-cart w-7 h-7 hover:text-primary hover:scale-110 active:scale-125"></i></button></div>',2);function Oe(s,a,t,e,o,c){return r(),m("header",{ref:"header",class:_(["top-0 z-50 transition-colors",[e.isSticky&&!e.isSidenavOpen?"bg-white/80":"bg-white",e.isSticky?"backdrop-blur-md shadow py-2 md:py-3":"py-3 sm:py-4 md:py-5"]])},[i("div",ke,[i("div",Te,[i("button",{class:"px-2 my-1","aria-label":"Abrir/fechar menu",onClick:a[0]||(a[0]=n=>e.isSidenavOpen=!e.isSidenavOpen)},[i("i",{class:_(["text-base-500 text-3xl",e.isSidenavOpen?"i-close":"i-menu"])},null,2)])]),z(s.$slots,"logo"),Ce]),E(e.Drawer,{modelValue:e.isSidenavOpen,"onUpdate:modelValue":a[1]||(a[1]=n=>e.isSidenavOpen=n),"has-close-button":!1,position:"absolute",class:"mt-3 -z-1",style:G({height:`calc(100vh - ${e.positionY}px + .5rem)`})},{default:H(()=>[E(e.ShopSidenav,$({class:"bg-white pt-6"},{categoryTrees:e.categoryTrees}),null,16)]),_:1},8,["modelValue","style"])],2)}const ze=O(xe,[["render",Oe]]);export{ze as default};
|