cloudcommerce 0.18.2 → 0.20.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/.github/renovate.json +1 -2
- package/CHANGELOG.md +48 -0
- package/package.json +6 -6
- package/packages/api/package.json +1 -1
- package/packages/apps/affilate-program/package.json +2 -2
- 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 +2 -2
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +2 -2
- package/packages/apps/fb-conversions/package.json +2 -2
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +2 -2
- package/packages/apps/galaxpay/package.json +2 -2
- package/packages/apps/google-analytics/package.json +2 -2
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +2 -2
- package/packages/apps/mercadopago/package.json +2 -2
- package/packages/apps/pagarme/package.json +2 -2
- package/packages/apps/paghiper/package.json +2 -2
- package/packages/apps/pix/package.json +2 -2
- package/packages/apps/tiny-erp/package.json +2 -2
- package/packages/apps/webhooks/package.json +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/events/package.json +2 -2
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/package.json +2 -2
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +2 -2
- package/packages/passport/package.json +2 -2
- package/packages/ssr/lib/firebase/serve-storefront.js +75 -72
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/package.json +3 -3
- package/packages/ssr/src/firebase/serve-storefront.ts +83 -84
- package/packages/storefront/.eslintrc.cjs +1 -1
- package/packages/storefront/config/storefront.tailwind.cjs +5 -8
- package/packages/storefront/dist/client/_astro/Carousel.62c97a79.js +1 -0
- package/packages/storefront/dist/client/_astro/HeroSlider.eb156f18.js +1 -0
- package/packages/storefront/dist/client/_astro/PitchBar.ed85833a.js +1 -0
- package/packages/storefront/dist/client/_astro/ProductShelf.9e290480.js +1 -0
- package/packages/storefront/dist/client/_astro/ShopHeader.0c884bbe.js +4 -0
- package/packages/storefront/dist/client/_astro/_...slug_.c2da43fb.css +1 -0
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.4cb7dd76.js +1 -0
- package/packages/storefront/dist/client/_astro/api.4984c5be.js +1 -0
- package/packages/storefront/dist/client/_astro/client.8035a95a.js +1 -0
- package/packages/storefront/dist/client/_astro/img.abbe849f.js +1 -0
- package/packages/storefront/dist/client/_astro/index.b93f3d06.js +1 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/{_...4cff750f.mjs → _...9e22b578.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/{account@_@astro.9bc80fb8.mjs → account@_@astro.89e4cf60.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/{astro.2df8d1c5.mjs → astro.45d3047f.mjs} +10 -3
- package/packages/storefront/dist/server/chunks/{endpoint@_@js.36a1cfa7.mjs → endpoint@_@js.f880a152.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/{fallback@_@astro.6af59549.mjs → fallback@_@astro.89538855.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/{index@_@astro.846e70bb.mjs → index@_@astro.548cf7ad.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/{index@_@astro.1ea814dc.mjs → index@_@astro.56fdd6da.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.906634b2.mjs → _...slug_.astro.bde9380b.mjs} +125 -36
- package/packages/storefront/dist/server/chunks/pages/{account.astro.f630663e.mjs → account.astro.f07cf19e.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{endpoint.js.ffec1d05.mjs → endpoint.js.d4e37801.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{fallback.astro.0a073a86.mjs → fallback.astro.e2e8a0e4.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/pages/{index.astro.fb8fe537.mjs → index.astro.3760ebe3.mjs} +443 -321
- package/packages/storefront/dist/server/entry.mjs +9 -9
- package/packages/storefront/dist/server/renderers.mjs +2 -2
- package/packages/storefront/package.json +5 -5
- package/packages/storefront/src/images/get-built-picture.ts +1 -0
- package/packages/storefront/src/images/use-ssr-picture.ts +11 -6
- package/packages/storefront/src/lib/components/{HeroPicture.astro → BannerPictures.astro} +19 -13
- package/packages/storefront/src/lib/composables/use-banner.ts +38 -0
- package/packages/storefront/src/lib/composables/use-hero-slider.ts +4 -18
- package/packages/storefront/src/lib/composables/use-product-card.ts +10 -11
- package/packages/storefront/src/lib/layouts/{main/use-page-sections.ts → use-page-main.ts} +59 -12
- package/packages/storefront/src/lib/ssr-context.ts +1 -1
- package/packages/storefront/src/lib/state/shopping-cart/parse-product.ts +6 -3
- package/packages/storefront/src/lib/state/shopping-cart.ts +3 -3
- package/packages/storefront/src/lib/state/use-cms-preview.ts +1 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/Carousel.533b4b19.js +0 -1
- package/packages/storefront/dist/client/_astro/HeroSlider.359c76cc.js +0 -1
- package/packages/storefront/dist/client/_astro/PitchBar.75d2999f.js +0 -1
- package/packages/storefront/dist/client/_astro/Prices.bd0d3474.js +0 -1
- package/packages/storefront/dist/client/_astro/ProductShelf.83c66e3e.js +0 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.a06de422.js +0 -4
- package/packages/storefront/dist/client/_astro/_...slug_.b19aabfc.css +0 -1
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.4e6dc3af.js +0 -1
- package/packages/storefront/dist/client/_astro/api.7f62c1ff.js +0 -1
- package/packages/storefront/dist/client/_astro/client.24201f93.js +0 -1
- package/packages/storefront/dist/client/_astro/img.22ad29ec.js +0 -1
- package/packages/storefront/dist/client/_astro/index.ddc27a3a.js +0 -1
- package/packages/storefront/dist/client/_astro/modules-info.d6bd555b.js +0 -1
- package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.578d6e91.js +0 -1
- package/packages/storefront/dist/client/img/uploads/banner1.png +0 -0
- package/packages/storefront/dist/client/img/uploads/banner2.png +0 -0
- package/packages/storefront/dist/client/img/uploads/favicon.png +0 -0
- package/packages/storefront/dist/client/img/uploads/headless.png +0 -0
- package/packages/storefront/dist/client/img/uploads/headphone.png +0 -0
- package/packages/storefront/dist/client/img/uploads/passion.png +0 -0
- package/packages/storefront/dist/client/img/uploads/pwa-reliable.png +0 -0
- package/packages/storefront/dist/client/img/uploads/rect89.png +0 -0
- package/packages/storefront/dist/client/img/uploads/ssl-safe.png +0 -0
- package/packages/storefront/src/lib/layouts/main/use-page-hero.ts +0 -47
|
@@ -3,7 +3,7 @@ import { webcrypto } from 'node:crypto';
|
|
|
3
3
|
import { ByteLengthQueuingStrategy, CountQueuingStrategy, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, TransformStream, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from 'node:stream/web';
|
|
4
4
|
import { File, FormData, Headers, Request, Response, fetch } from 'undici';
|
|
5
5
|
import { setTimeout as setTimeout$1, clearTimeout as clearTimeout$1 } from 'node:timers';
|
|
6
|
-
import { N as NodeApp, g as deserializeManifest } from './chunks/astro.
|
|
6
|
+
import { N as NodeApp, g as deserializeManifest } from './chunks/astro.45d3047f.mjs';
|
|
7
7
|
import { Readable } from 'stream';
|
|
8
8
|
import https from 'https';
|
|
9
9
|
import path from 'path';
|
|
@@ -24,7 +24,7 @@ import 'string-width';
|
|
|
24
24
|
import 'vue';
|
|
25
25
|
import 'vue/server-renderer';
|
|
26
26
|
import '@ecomplus/utils';
|
|
27
|
-
import './chunks/pages/_...slug_.astro.
|
|
27
|
+
import './chunks/pages/_...slug_.astro.bde9380b.mjs';
|
|
28
28
|
import 'node:fs/promises';
|
|
29
29
|
import 'node:path';
|
|
30
30
|
import 'node:url';
|
|
@@ -2824,13 +2824,13 @@ const adapter = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
2824
2824
|
start
|
|
2825
2825
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2826
2826
|
|
|
2827
|
-
const _page0 = () => import('./chunks/endpoint@_@js.
|
|
2828
|
-
const _page1 = () => import('./chunks/index@_@astro.
|
|
2829
|
-
const _page2 = () => import('./chunks/fallback@_@astro.
|
|
2830
|
-
const _page3 = () => import('./chunks/index@_@astro.
|
|
2831
|
-
const _page4 = () => import('./chunks/account@_@astro.
|
|
2832
|
-
const _page5 = () => import('./chunks/_...
|
|
2833
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.
|
|
2827
|
+
const _page0 = () => import('./chunks/endpoint@_@js.f880a152.mjs');
|
|
2828
|
+
const _page1 = () => import('./chunks/index@_@astro.56fdd6da.mjs');
|
|
2829
|
+
const _page2 = () => import('./chunks/fallback@_@astro.89538855.mjs');
|
|
2830
|
+
const _page3 = () => import('./chunks/index@_@astro.548cf7ad.mjs');
|
|
2831
|
+
const _page4 = () => import('./chunks/account@_@astro.89e4cf60.mjs');
|
|
2832
|
+
const _page5 = () => import('./chunks/_...9e22b578.mjs');const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.3_sharp@0.32.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]]);
|
|
2833
|
+
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.3_sharp@0.32.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.9d9d7ac4.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.c2da43fb.css"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.9d9d7ac4.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.c2da43fb.css"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"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","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.9d9d7ac4.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.c2da43fb.css"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-demo.web.app","base":"/","compressHTML":false,"markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"componentMetadata":[["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro",{"propagation":"none","containsHead":true}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro",{"propagation":"none","containsHead":true}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro",{"propagation":"none","containsHead":true}]],"renderers":[],"clientDirectives":[["idle","(()=>{var i=t=>{let e=async()=>{await(await t())()};\"requestIdleCallback\"in window?window.requestIdleCallback(e):setTimeout(e,200)};(self.Astro||(self.Astro={})).idle=i;window.dispatchEvent(new Event(\"astro:idle\"));})();"],["load","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).load=e;window.dispatchEvent(new Event(\"astro:load\"));})();"],["media","(()=>{var s=(i,t)=>{let a=async()=>{await(await i())()};if(t.value){let e=matchMedia(t.value);e.matches?a():e.addEventListener(\"change\",a,{once:!0})}};(self.Astro||(self.Astro={})).media=s;window.dispatchEvent(new Event(\"astro:media\"));})();"],["only","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).only=e;window.dispatchEvent(new Event(\"astro:only\"));})();"],["visible","(()=>{var r=(i,c,n)=>{let s=async()=>{await(await i())()},t=new IntersectionObserver(e=>{for(let o of e)if(o.isIntersecting){t.disconnect(),s();break}});for(let e of n.children)t.observe(e)};(self.Astro||(self.Astro={})).visible=r;window.dispatchEvent(new Event(\"astro:visible\"));})();"]],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","\u0000@astro-renderers":"renderers.mjs","\u0000empty-middleware":"_empty-middleware.mjs","/src/pages/app/account.astro":"chunks/pages/account.astro.f07cf19e.mjs","/src/pages/fallback.astro":"chunks/pages/fallback.astro.e2e8a0e4.mjs","\u0000@astro-page:../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.3_sharp@0.32.3/node_modules/@astrojs/image/dist/endpoint@_@js":"chunks/endpoint@_@js.f880a152.mjs","\u0000@astro-page:src/pages/index@_@astro":"chunks/index@_@astro.56fdd6da.mjs","\u0000@astro-page:src/pages/fallback@_@astro":"chunks/fallback@_@astro.89538855.mjs","\u0000@astro-page:src/pages/app/index@_@astro":"chunks/index@_@astro.548cf7ad.mjs","\u0000@astro-page:src/pages/app/account@_@astro":"chunks/account@_@astro.89e4cf60.mjs","\u0000@astro-page:src/pages/[...slug]@_@astro":"chunks/_...9e22b578.mjs","~/components/PitchBar.vue":"_astro/PitchBar.ed85833a.js","@astrojs/vue/client.js":"_astro/client.8035a95a.js","~/components/ProductShelf.vue":"_astro/ProductShelf.9e290480.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.a7b12eab.js","~/components/HeroSlider.vue":"_astro/HeroSlider.eb156f18.js","/astro/hoisted.js?q=0":"_astro/hoisted.9d9d7ac4.js","~/components/ShopHeader.vue":"_astro/ShopHeader.0c884bbe.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.84207480.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/_...slug_.c2da43fb.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-5e0bf4e4.js","/_astro/Carousel.62c97a79.js","/_astro/HeroSlider.eb156f18.js","/_astro/PitchBar.ed85833a.js","/_astro/ProductShelf.9e290480.js","/_astro/ShopHeader.0c884bbe.js","/_astro/_plugin-vue_export-helper.4cb7dd76.js","/_astro/api.4984c5be.js","/_astro/client.8035a95a.js","/_astro/firebase-app.84207480.js","/_astro/hoisted.9d9d7ac4.js","/_astro/img.abbe849f.js","/_astro/index.b93f3d06.js","/_astro/preload-helper.cf010ec4.js","/_astro/session-utm.744b0db3.js","/_astro/workbox-window.prod.es5.a7b12eab.js","/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/banner2.webp","/img/uploads/ecom-icon.png","/img/uploads/headphone.webp","/img/uploads/logo.png","/img/uploads/og-image.png","/img/uploads/passion.webp","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.webp"]}), {
|
|
2834
2834
|
pageMap,
|
|
2835
2835
|
renderers,
|
|
2836
2836
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { h as server_default } from './chunks/astro.
|
|
1
|
+
import { h as server_default } from './chunks/astro.45d3047f.mjs';
|
|
2
2
|
import { useSSRContext, defineComponent, computed, mergeProps, h, createSSRApp } from 'vue';
|
|
3
3
|
import { ssrRenderSlotInner, ssrRenderAttrs, ssrRenderSlot, renderToString } from 'vue/server-renderer';
|
|
4
4
|
import { img, imgSizes, i18n, formatMoney } from '@ecomplus/utils';
|
|
5
|
-
import { _ as _export_sfc } from './chunks/pages/_...slug_.astro.
|
|
5
|
+
import { _ as _export_sfc } from './chunks/pages/_...slug_.astro.bde9380b.mjs';
|
|
6
6
|
import 'path-to-regexp';
|
|
7
7
|
import 'cookie';
|
|
8
8
|
import '@astrojs/internal-helpers/path';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.20.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"bin": {
|
|
7
7
|
"storefront": "./scripts/build-prod.sh"
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"@iconify-json/logos": "^1.1.33",
|
|
44
44
|
"@vite-pwa/astro": "^0.1.1",
|
|
45
45
|
"@vueuse/core": "10.2.1",
|
|
46
|
-
"astro": "2.8.
|
|
46
|
+
"astro": "2.8.3",
|
|
47
47
|
"chroma-js": "^2.4.2",
|
|
48
48
|
"dotenv": "^16.3.1",
|
|
49
49
|
"firebase": "^9.23.0",
|
|
50
50
|
"image-size": "^1.0.2",
|
|
51
51
|
"mime": "^3.0.0",
|
|
52
52
|
"semver": "^7.5.4",
|
|
53
|
-
"sharp": "^0.32.
|
|
54
|
-
"tailwindcss": "^3.3.
|
|
53
|
+
"sharp": "^0.32.3",
|
|
54
|
+
"tailwindcss": "^3.3.3",
|
|
55
55
|
"unocss": "^0.53.5",
|
|
56
|
-
"vite": "^4.4.
|
|
56
|
+
"vite": "^4.4.4",
|
|
57
57
|
"vite-plugin-pwa": "^0.16.4",
|
|
58
58
|
"vue": "^3.3.4"
|
|
59
59
|
},
|
|
@@ -3,6 +3,10 @@ import type {
|
|
|
3
3
|
GetPictureParams,
|
|
4
4
|
GetPictureResult,
|
|
5
5
|
} from '@astrojs/image/dist/lib/get-picture';
|
|
6
|
+
import type {
|
|
7
|
+
GetPictureParams as GetBuiltPictureParams,
|
|
8
|
+
GetPictureResult as GetBuiltPictureResult,
|
|
9
|
+
} from './get-built-picture';
|
|
6
10
|
|
|
7
11
|
export type PictureProps = Omit<PictureComponentRemoteImageProps, 'aspectRatio' | 'sizes'> & {
|
|
8
12
|
sizes?: string;
|
|
@@ -26,7 +30,8 @@ const getAspectRatio = (src: string | ImageSize, tryImageSize: TryImageSize) =>
|
|
|
26
30
|
|
|
27
31
|
export type UsePictureParams = PictureProps & {
|
|
28
32
|
tryImageSize: TryImageSize;
|
|
29
|
-
getPicture: (params: GetPictureParams) => Promise<GetPictureResult
|
|
33
|
+
getPicture: ((params: GetPictureParams) => Promise<GetPictureResult>)
|
|
34
|
+
| ((params: GetBuiltPictureParams) => Promise<GetBuiltPictureResult>);
|
|
30
35
|
};
|
|
31
36
|
|
|
32
37
|
const useSSRPicture = async (params: UsePictureParams) => {
|
|
@@ -48,7 +53,7 @@ const useSSRPicture = async (params: UsePictureParams) => {
|
|
|
48
53
|
...attrs
|
|
49
54
|
} = params;
|
|
50
55
|
|
|
51
|
-
let aspectRatio: number;
|
|
56
|
+
let aspectRatio: number | undefined;
|
|
52
57
|
if (propAspectRatio) {
|
|
53
58
|
if (typeof propAspectRatio === 'number') {
|
|
54
59
|
aspectRatio = propAspectRatio;
|
|
@@ -67,7 +72,7 @@ const useSSRPicture = async (params: UsePictureParams) => {
|
|
|
67
72
|
let sizes: string = propSizes || '';
|
|
68
73
|
if (!sizes && attrs.class) {
|
|
69
74
|
const classNames = attrs.class.split(' ');
|
|
70
|
-
let nextSize: string;
|
|
75
|
+
let nextSize: string | undefined;
|
|
71
76
|
const breakpoints = {
|
|
72
77
|
sm: 640,
|
|
73
78
|
md: 768,
|
|
@@ -75,10 +80,10 @@ const useSSRPicture = async (params: UsePictureParams) => {
|
|
|
75
80
|
xl: 1280,
|
|
76
81
|
'2xl': 1536,
|
|
77
82
|
};
|
|
78
|
-
[
|
|
79
|
-
[''],
|
|
83
|
+
([
|
|
84
|
+
['', 0],
|
|
80
85
|
...Object.entries(breakpoints),
|
|
81
|
-
].forEach(([breakpoint, minWidth]
|
|
86
|
+
] as Array<[string, number]>).forEach(([breakpoint, minWidth]) => {
|
|
82
87
|
const classRegex = breakpoint
|
|
83
88
|
? new RegExp(`^${breakpoint}:max-w-(\\[\\w+\\]|screen-\\w+)$`)
|
|
84
89
|
: /^max-w-(\[\w+\]|screen-\w+)$/;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type {
|
|
2
|
+
import type { Props as UseBannerProps } from '@@sf/composables/use-banner';
|
|
3
3
|
import Picture from '@@sf/components/Picture.astro';
|
|
4
4
|
|
|
5
|
-
export type Props =
|
|
6
|
-
index
|
|
5
|
+
export type Props = UseBannerProps & {
|
|
6
|
+
index?: number;
|
|
7
7
|
widths?: number[];
|
|
8
|
+
class?: string;
|
|
8
9
|
mobileWidths?: number[];
|
|
10
|
+
mobileClass?: string;
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
const {
|
|
@@ -16,9 +18,11 @@ const {
|
|
|
16
18
|
subtitle,
|
|
17
19
|
buttonText,
|
|
18
20
|
index,
|
|
21
|
+
class: className = 'max-w-screen-2xl',
|
|
22
|
+
mobileClass = 'max-w-screen-sm',
|
|
19
23
|
} = Astro.props as Props;
|
|
20
24
|
const hasHeader = title || subtitle || buttonText;
|
|
21
|
-
let { widths, mobileWidths }= Astro.props;
|
|
25
|
+
let { widths, mobileWidths } = Astro.props;
|
|
22
26
|
if (!widths?.length) {
|
|
23
27
|
if (mobileImg) {
|
|
24
28
|
widths = [1536, 2048];
|
|
@@ -34,14 +38,16 @@ if (!mobileWidths?.length) {
|
|
|
34
38
|
}
|
|
35
39
|
---
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
{img &&
|
|
42
|
+
<Picture
|
|
43
|
+
src={img}
|
|
44
|
+
alt={alt || ''}
|
|
45
|
+
widths={widths}
|
|
46
|
+
fetchpriority={index === 0 ? 'high' : 'low'}
|
|
47
|
+
loading={index === 0 ? 'eager' : 'lazy'}
|
|
48
|
+
class={`${(mobileImg ? 'hidden md:block ' : '')}mx-auto ${className}`}
|
|
49
|
+
/>
|
|
50
|
+
}
|
|
45
51
|
{mobileImg &&
|
|
46
52
|
<Picture
|
|
47
53
|
src={mobileImg}
|
|
@@ -49,6 +55,6 @@ if (!mobileWidths?.length) {
|
|
|
49
55
|
widths={mobileWidths}
|
|
50
56
|
fetchpriority={index === 0 ? 'high' : 'low'}
|
|
51
57
|
loading={index === 0 ? 'eager' : 'lazy'}
|
|
52
|
-
class=
|
|
58
|
+
class={`md:hidden mx-auto ${mobileClass}`}
|
|
53
59
|
/>
|
|
54
60
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { parseShippingPhrase } from '@@sf/state/modules-info';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
img?: string;
|
|
6
|
+
alt?: string;
|
|
7
|
+
mobileImg?: string;
|
|
8
|
+
href?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
subtitle?: string;
|
|
11
|
+
buttonLink?: string;
|
|
12
|
+
buttonText?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const useBanner = (props: Props) => {
|
|
16
|
+
const parsedTitle = computed(() => {
|
|
17
|
+
return props.title ? parseShippingPhrase(props.title).value : '';
|
|
18
|
+
});
|
|
19
|
+
const parsedSubtitle = computed(() => {
|
|
20
|
+
return props.subtitle ? parseShippingPhrase(props.subtitle).value : '';
|
|
21
|
+
});
|
|
22
|
+
const parsedButtonText = computed(() => {
|
|
23
|
+
return props.buttonText ? parseShippingPhrase(props.buttonText).value : '';
|
|
24
|
+
});
|
|
25
|
+
const hasHeader = computed(() => {
|
|
26
|
+
return Boolean(parsedTitle.value || parsedSubtitle.value || parsedButtonText.value);
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
parsedTitle,
|
|
30
|
+
parsedSubtitle,
|
|
31
|
+
parsedButtonText,
|
|
32
|
+
hasHeader,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default useBanner;
|
|
37
|
+
|
|
38
|
+
export { useBanner };
|
|
@@ -1,32 +1,18 @@
|
|
|
1
|
+
import type { Props as UseBannerProps } from '@@sf/composables/use-banner';
|
|
1
2
|
import { computed } from 'vue';
|
|
2
|
-
import
|
|
3
|
+
import useBanner from '@@sf/composables/use-banner';
|
|
3
4
|
|
|
4
5
|
export interface Props {
|
|
5
6
|
autoplay?: number;
|
|
6
|
-
slides: Array<
|
|
7
|
-
img?: string;
|
|
8
|
-
alt?: string;
|
|
9
|
-
mobileImg?: string;
|
|
10
|
-
href?: string;
|
|
11
|
-
title?: string;
|
|
12
|
-
subtitle?: string;
|
|
13
|
-
buttonLink?: string;
|
|
14
|
-
buttonText?: string;
|
|
15
|
-
}>;
|
|
7
|
+
slides: Array<UseBannerProps>;
|
|
16
8
|
}
|
|
17
9
|
|
|
18
10
|
const useHeroSlider = (props: Props) => {
|
|
19
11
|
const parsedSlides = computed(() => {
|
|
20
12
|
return props.slides.map((slide) => {
|
|
21
|
-
const title = slide.title
|
|
22
|
-
? parseShippingPhrase(slide.title).value : '';
|
|
23
|
-
const subtitle = slide.subtitle
|
|
24
|
-
? parseShippingPhrase(slide.subtitle).value : '';
|
|
25
|
-
const buttonText = slide.buttonText
|
|
26
|
-
? parseShippingPhrase(slide.buttonText).value : '';
|
|
27
13
|
return {
|
|
28
14
|
...slide,
|
|
29
|
-
|
|
15
|
+
...useBanner(slide),
|
|
30
16
|
};
|
|
31
17
|
});
|
|
32
18
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Products,
|
|
1
|
+
import type { Products, SearchItem } from '@cloudcommerce/types';
|
|
2
2
|
import { ref, computed, shallowReactive } from 'vue';
|
|
3
3
|
import api from '@cloudcommerce/api';
|
|
4
4
|
import {
|
|
@@ -9,10 +9,9 @@ import {
|
|
|
9
9
|
onPromotion as checkOnPromotion,
|
|
10
10
|
} from '@ecomplus/utils';
|
|
11
11
|
|
|
12
|
-
type CartItem = Carts['items'][0];
|
|
13
12
|
type PictureSize = { url: string; alt?: string; size?: string };
|
|
14
13
|
|
|
15
|
-
export type ProductItem = Products | SearchItem
|
|
14
|
+
export type ProductItem = Products | SearchItem;
|
|
16
15
|
|
|
17
16
|
export type Props = {
|
|
18
17
|
product?: ProductItem;
|
|
@@ -23,12 +22,13 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
|
|
|
23
22
|
const isFetching = ref(false);
|
|
24
23
|
let fetching: Promise<void> | null = null;
|
|
25
24
|
const fetchError = ref<Error | null>(null);
|
|
25
|
+
const { productId } = props;
|
|
26
26
|
const product = shallowReactive<(T extends undefined ? Partial<SearchItem> : T)
|
|
27
|
-
& { price: number }>({
|
|
27
|
+
& { _id: Products['_id'], price: number }>({
|
|
28
28
|
...(props.product as Exclude<T, undefined>),
|
|
29
|
+
_id: (props.product?._id || productId) as Products['_id'],
|
|
29
30
|
price: getPrice(props.product || {}),
|
|
30
31
|
});
|
|
31
|
-
const { productId } = props;
|
|
32
32
|
if (!props.product && productId) {
|
|
33
33
|
isFetching.value = true;
|
|
34
34
|
fetching = (async () => {
|
|
@@ -61,12 +61,6 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
|
|
|
61
61
|
const img = getImg(picture);
|
|
62
62
|
if (img) _images.push(img);
|
|
63
63
|
}));
|
|
64
|
-
} else {
|
|
65
|
-
const { picture } = (product as CartItem);
|
|
66
|
-
if (picture) {
|
|
67
|
-
const img = getImg(picture);
|
|
68
|
-
if (img) _images.push(img);
|
|
69
|
-
}
|
|
70
64
|
}
|
|
71
65
|
return _images;
|
|
72
66
|
});
|
|
@@ -84,6 +78,10 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
|
|
|
84
78
|
}
|
|
85
79
|
return 0;
|
|
86
80
|
});
|
|
81
|
+
const hasVariations = computed(() => {
|
|
82
|
+
if ((product as SearchItem).has_variations) return true;
|
|
83
|
+
return Boolean(product.variations?.length);
|
|
84
|
+
});
|
|
87
85
|
|
|
88
86
|
return {
|
|
89
87
|
isFetching,
|
|
@@ -96,6 +94,7 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
|
|
|
96
94
|
isInStock,
|
|
97
95
|
isActive,
|
|
98
96
|
discountPercentage,
|
|
97
|
+
hasVariations,
|
|
99
98
|
};
|
|
100
99
|
};
|
|
101
100
|
|
|
@@ -1,21 +1,61 @@
|
|
|
1
1
|
import type { ResourceId } from '@cloudcommerce/types';
|
|
2
|
+
import type { PageContent } from '@@sf/content';
|
|
2
3
|
import type { RouteContext } from '@@sf/ssr-context';
|
|
3
|
-
import type { Props as
|
|
4
|
+
import type { Props as UseBannerProps } from '@@sf/composables/use-banner';
|
|
5
|
+
import type { Props as UseHeroSliderProps } from '@@sf/composables/use-hero-slider';
|
|
6
|
+
import type { Props as UseProductShelfProps } from '@@sf/composables/use-product-shelf';
|
|
4
7
|
import { useProductShelf } from '@@sf/composables/use-product-shelf';
|
|
5
8
|
|
|
6
|
-
export type ProductShelfProps = UseProductShelf;
|
|
7
|
-
|
|
8
9
|
export interface Props {
|
|
9
10
|
routeContext: RouteContext;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
+
const now = Date.now();
|
|
14
|
+
const parseBanners = (banners: Partial<PageContent['hero']['slides'][0]>[]) => {
|
|
15
|
+
const validBanners: UseBannerProps[] = [];
|
|
16
|
+
banners.forEach(({
|
|
17
|
+
img,
|
|
18
|
+
start,
|
|
19
|
+
end,
|
|
20
|
+
mobile_img: mobileImg,
|
|
21
|
+
button_link: buttonLink,
|
|
22
|
+
button_text: buttonText,
|
|
23
|
+
...rest
|
|
24
|
+
}) => {
|
|
25
|
+
if (start && new Date(start).getTime() < now) return;
|
|
26
|
+
if (end && new Date(end).getTime() > now) return;
|
|
27
|
+
validBanners.push({
|
|
28
|
+
...rest,
|
|
29
|
+
img,
|
|
30
|
+
mobileImg,
|
|
31
|
+
buttonLink,
|
|
32
|
+
buttonText,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
return validBanners;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const usePageHero = async ({ routeContext }: Props) => {
|
|
39
|
+
const { cmsContent } = routeContext;
|
|
40
|
+
const heroSlider: UseHeroSliderProps = { slides: [] };
|
|
41
|
+
const heroContent = cmsContent?.hero;
|
|
42
|
+
if (heroContent) {
|
|
43
|
+
heroSlider.autoplay = heroContent.autoplay;
|
|
44
|
+
if (heroContent.slides) {
|
|
45
|
+
heroSlider.slides = parseBanners(heroContent.slides);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return { heroSlider };
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const usePageSections = async ({ routeContext }: Props) => {
|
|
13
52
|
const sectionsContent = routeContext.cmsContent?.sections;
|
|
14
53
|
const sections: Array<
|
|
15
|
-
{ type: 'product-shelf', props:
|
|
54
|
+
{ type: 'product-shelf', props: UseProductShelfProps }
|
|
55
|
+
| { type: 'banners-grid', props: { banners: UseBannerProps[] } }
|
|
16
56
|
> = [];
|
|
17
57
|
if (sectionsContent) {
|
|
18
|
-
await Promise.all(sectionsContent.map(async ({ type, ...sectionContent }) => {
|
|
58
|
+
await Promise.all(sectionsContent.map(async ({ type, ...sectionContent }, index) => {
|
|
19
59
|
if (type === 'product-shelf') {
|
|
20
60
|
const {
|
|
21
61
|
collection_id: collectionIdAndInfo,
|
|
@@ -72,7 +112,7 @@ const usePageSections = async ({ routeContext }: Props) => {
|
|
|
72
112
|
};
|
|
73
113
|
const { fetching, products } = useProductShelf(props);
|
|
74
114
|
await fetching;
|
|
75
|
-
sections
|
|
115
|
+
sections[index] = {
|
|
76
116
|
type,
|
|
77
117
|
props: {
|
|
78
118
|
...rest,
|
|
@@ -84,7 +124,18 @@ const usePageSections = async ({ routeContext }: Props) => {
|
|
|
84
124
|
isShuffle,
|
|
85
125
|
products,
|
|
86
126
|
},
|
|
87
|
-
}
|
|
127
|
+
};
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (type === 'banners-grid') {
|
|
132
|
+
sections[index] = {
|
|
133
|
+
type,
|
|
134
|
+
props: {
|
|
135
|
+
banners: parseBanners(sectionContent.banners || []),
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
// return;
|
|
88
139
|
}
|
|
89
140
|
}));
|
|
90
141
|
}
|
|
@@ -97,7 +148,3 @@ const usePageSections = async ({ routeContext }: Props) => {
|
|
|
97
148
|
sections,
|
|
98
149
|
};
|
|
99
150
|
};
|
|
100
|
-
|
|
101
|
-
export default usePageSections;
|
|
102
|
-
|
|
103
|
-
export { usePageSections };
|
|
@@ -2,7 +2,7 @@ import type { AstroGlobal } from 'astro';
|
|
|
2
2
|
import type { BaseConfig } from '@cloudcommerce/config';
|
|
3
3
|
import type { ApiError, ApiEndpoint } from '@cloudcommerce/api';
|
|
4
4
|
import type { CategoriesList, BrandsList } from '@cloudcommerce/api/types';
|
|
5
|
-
import type { ContentGetter, SettingsContent, PageContent } from '
|
|
5
|
+
import type { ContentGetter, SettingsContent, PageContent } from '@@sf/content';
|
|
6
6
|
import { EventEmitter } from 'node:events';
|
|
7
7
|
import api from '@cloudcommerce/api';
|
|
8
8
|
import _getConfig from '../../config/storefront.config.mjs';
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Products, Carts, SearchItem } from '@cloudcommerce/api/types';
|
|
2
2
|
import { price as getPrice } from '@ecomplus/utils';
|
|
3
3
|
|
|
4
4
|
type CartItem = Carts['items'][0];
|
|
5
5
|
|
|
6
|
-
export default (
|
|
6
|
+
export default (
|
|
7
|
+
product: (Partial<Products> | Partial<SearchItem>) & { _id: Products['_id'] },
|
|
8
|
+
variationId?: Products['_id'],
|
|
9
|
+
quantity?: number,
|
|
10
|
+
) => {
|
|
7
11
|
if (typeof quantity !== 'number' || Number.isNaN(quantity)) {
|
|
8
12
|
quantity = product.min_quantity || 1;
|
|
9
13
|
}
|
|
@@ -15,7 +19,6 @@ export default (product: Products, variationId?: ResourceId, quantity?: number)
|
|
|
15
19
|
item.product_id = product._id;
|
|
16
20
|
if (variationId) {
|
|
17
21
|
item.variation_id = variationId;
|
|
18
|
-
item.slug = product.slug;
|
|
19
22
|
if (item.picture_id && product.pictures) {
|
|
20
23
|
const pictures = product.pictures.filter((picture) => {
|
|
21
24
|
return picture._id === item.picture_id;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Products, CartSet, SearchItem } from '@cloudcommerce/api/types';
|
|
2
2
|
import { computed } from 'vue';
|
|
3
3
|
import useStorage from './use-storage';
|
|
4
4
|
import addItem from './shopping-cart/add-cart-item';
|
|
@@ -74,8 +74,8 @@ const addCartItem = (newItem: CartSet['items'][0]) => {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
const addProductToCart = (
|
|
77
|
-
product: Products,
|
|
78
|
-
variationId?:
|
|
77
|
+
product: (Partial<Products> | Partial<SearchItem>) & { _id: Products['_id'] },
|
|
78
|
+
variationId?: Products['_id'],
|
|
79
79
|
quantity?: number,
|
|
80
80
|
) => addCartItem(parseProduct(product, variationId, quantity));
|
|
81
81
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as X,a as Y,b as Z}from"./index.ddc27a3a.js";import{_ as K,s as M,V as q,x as P,u as G,D as v,z as J,C as A,N as c,K as h,W as D,r as F,X as Q,L as ee,Y as te,Z as ae,E as oe,w as L,G as le,v as H,$ as se,a0 as re}from"./_plugin-vue_export-helper.4e6dc3af.js";const U=Symbol("carousel"),ne=M({__name:"CarouselControl",props:{isPrev:{type:Boolean,default:!1}},setup(r,{expose:u}){u();const{changeSlide:l}=q(U),t={changeSlide:l};return Object.defineProperty(t,"__isScriptSetup",{enumerable:!1,value:!0}),t}}),ue=["aria-label","data-carousel-control"];function ie(r,u,l,t,n,o){return P(),G("button",{type:"button","aria-label":l.isPrev?"Anterior":"Próximo",onClick:u[0]||(u[0]=m=>t.changeSlide(l.isPrev?-1:1)),class:A(["group absolute top-0 z-1",l.isPrev?"left-0":"right-0"]),"data-carousel-control":l.isPrev?"previous":"next"},[v(r.$slots,"default",{},()=>[J("i",{class:A(["m-0",l.isPrev?"i-chevron-left group-active:-translate-x-1":"i-chevron-right group-active:translate-x-1"])},null,2)])],10,ue)}const ce=K(ne,[["render",ie]]),de=M({__name:"Carousel",props:{as:{default:"ul"},modelValue:{default:1},autoplay:{}},emits:["update:modelValue"],setup(r,{expose:u,emit:l}){u();const t=r,n=c(t.modelValue-1);h(D(t,"modelValue"),e=>{n.value=e-1}),h(n,(e,a)=>{e!==a&&l("update:modelValue",e+1)});const o=c(null),{x:m,isScrolling:B,arrivedState:_}=X(o),W=F(()=>_.left),T=F(()=>_.right),s=c([]),g=c(0),p=c(0),I=c(0),V=()=>{o.value&&(g.value=o.value.scrollWidth,p.value=o.value.offsetWidth)},k=()=>{if(!o.value)return;let e=[...o.value.children];e.length===1&&e[0].tagName.endsWith("SLOT")&&(e=[...e[0].children]),s.value=e.map(a=>({offsetLeft:a.offsetLeft,width:a.offsetWidth}))},z=e=>{let a=n.value+e;if(a>=s.value.length)return 0;a<0&&(a=s.value.length+a);const{offsetLeft:b,width:d}=s.value[a]||{};return d?b:0},x=()=>{const e=s.value.findIndex(a=>Math.abs(a.offsetLeft-m.value)<=5);e>-1&&(n.value=e||0)},E=()=>{const e=g.value-p.value;I.value=s.value.findIndex(({offsetLeft:a})=>a>=e-5)};let i;const f=()=>{t.autoplay&&(clearTimeout(i),i=setTimeout(()=>{C(1)},t.autoplay))},C=(e,a=!0)=>{if(s.value.length<2)return;if(a&&(e===1||e===-1)){let d=0,$=0;for(let S=n.value;S<s.value.length;S++){const{width:j}=s.value[S]||{};if(j&&(d+=1,$+=j,$>=p.value))break}d&&(e=e>0?d:-d)}t.autoplay||console.log({direction:e},n.value,s.value.length);const b=z(e);o.value?.scrollTo({left:b,behavior:"smooth"}),f()};h(B,e=>{e?clearTimeout(i):(x(),f())});const N=c(null),O=Y(N);h(O,e=>{e?clearTimeout(i):f()});const w=()=>{o.value&&(V(),k(),x(),E())},y=Z(()=>{o.value&&(o.value.scrollLeft=0,w())},400);Q(()=>{w(),ee(()=>{o.value&&[...o.value.children].forEach(e=>{e.setAttribute("tabindex","0")})}),f(),window.addEventListener("resize",y)}),te(()=>{window.removeEventListener("resize",y),clearTimeout(i)}),ae(U,{autoplay:D(t,"autoplay"),changeSlide:C,isBoundLeft:W,isBoundRight:T});const R={props:t,emit:l,currentIndex:n,wrapper:o,currentPos:m,isScrolling:B,arrivedState:_,isBoundLeft:W,isBoundRight:T,slidesWidth:s,wrapperScrollWidth:g,wrapperVisibleWidth:p,indexCount:I,calcWrapperWidth:V,calcSlidesWidth:k,calcNextOffsetLeft:z,calcCurrentIndex:x,calcIndexCount:E,get autoplayTimer(){return i},set autoplayTimer(e){i=e},restartAutoplay:f,changeSlide:C,carousel:N,isHovered:O,calcOnInit:w,onResize:y,CarouselControl:ce};return Object.defineProperty(R,"__isScriptSetup",{enumerable:!1,value:!0}),R}}),fe={ref:"carousel",class:"relative","data-carousel":""};function ve(r,u,l,t,n,o){return P(),G("div",fe,[(P(),oe(le(l.as),{ref:"wrapper",class:"flex overflow-x-scroll overflow-y-hidden list-none m-0 p-0 snap-x snap-mandatory scroll-smooth [&>*]:snap-start [&>*]:outline-none",style:{"scrollbar-width":"none","-webkit-overflow-scrolling":"touch","-ms-overflow-style":"none"},"data-carousel-wrapper":""},{default:L(()=>[v(r.$slots,"default")]),_:3},512)),v(r.$slots,"controls",se(re({changeSlide:t.changeSlide,isBoundLeft:t.isBoundLeft,isBoundRight:t.isBoundRight,currentPage:t.currentIndex+1,pageCount:t.indexCount+1})),()=>[H(t.CarouselControl,{"is-prev":""},{default:L(()=>[v(r.$slots,"previous")]),_:3}),H(t.CarouselControl,null,{default:L(()=>[v(r.$slots,"next")]),_:3})])],512)}const me=K(de,[["render",ve]]);export{me as C,ce as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as x}from"./runtime-dom.esm-bundler.578d6e91.js";import{p as d}from"./modules-info.d6bd555b.js";import{r as b,_ as g,s as v,u as a,v as m,w as i,x as r,y as w,z as o,F as y,A as C,C as f,D as S,E as k,G as H,H as T,I as p,J as h}from"./_plugin-vue_export-helper.4e6dc3af.js";import{C as B,a as D}from"./Carousel.533b4b19.js";import"./session-utm.744b0db3.js";import"./index.ddc27a3a.js";const N=l=>({parsedSlides:b(()=>l.slides.map(e=>{const s=e.title?d(e.title).value:"",n=e.subtitle?d(e.subtitle).value:"",_=e.buttonText?d(e.buttonText).value:"";return{...e,hasHeader:!!(s||n||_)}}))}),V=v({__name:"HeroSlider",props:{autoplay:{},slides:{}},setup(l,{expose:c}){c();const e=l,{parsedSlides:s}=N(e),n={props:e,parsedSlides:s,Carousel:B,CarouselControl:D};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),z={class:"relative mx-auto"},j=["href"],E={key:0,class:"basis-1/2 grow-0 p-12 xl:ps-32 mb-3 md:mb-0"},F={key:0,class:"text-lg mt-4 md:mt-6"},L=["href"],P={class:"absolute z-10 bottom-5 flex justify-end items-center w-screen right-5 xl:right-auto xl:max-w-screen-xl xl:left-1/2 xl:-ms-[640px]"},A={class:"relative w-20 h-10 rounded-full bg-white/50 text-primary shadow-sm ring-1 ring-black/5"},G=o("i",{class:"i-arrow-left"},null,-1),I=o("i",{class:"i-arrow-right"},null,-1);function J(l,c,e,s,n,_){return r(),a("section",z,[m(s.Carousel,{autoplay:e.autoplay},{controls:i(()=>[w(o("div",P,[o("div",A,[m(s.CarouselControl,{class:"w-10 h-10 rounded-full hover:bg-primary/10","is-prev":""},{default:i(()=>[G]),_:1}),m(s.CarouselControl,{class:"w-10 h-10 rounded-full hover:bg-primary/10"},{default:i(()=>[I]),_:1})])],512),[[x,s.parsedSlides.length>1]])]),default:i(()=>[(r(!0),a(y,null,C(s.parsedSlides,(t,u)=>(r(),a("li",{key:u,class:"shrink-0 basis-full h-full secondary"},[o("div",{class:f(["w-screen max-w-screen-2xl mx-auto overflow-x-hidden",t.hasHeader?"grid grid-cols-1 md:grid-cols-2 items-center":null])},[o("a",{href:t.href,class:f(t.hasHeader?"basis-1/2 grow-0 md:order-last":null)},[S(l.$slots,`picture-${u}`)],10,j),t.hasHeader?(r(),a("div",E,[(r(),k(H(u===0?"h2":"h3"),{class:"ui-title mt-1"},{default:i(()=>[T(p(t.title),1)]),_:2},1024)),t.subtitle?(r(),a("p",F,p(t.subtitle),1)):h("",!0),t.buttonText?(r(),a("a",{key:1,href:t.buttonLink,class:"ui-btn-lg ui-btn-contrast min-w-[150px] mt-7 md:mt-10"},p(t.buttonText),9,L)):h("",!0)])):h("",!0)],2)]))),128))]),_:3},8,["autoplay"])])}const U=g(V,[["render",J]]);export{U as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as m}from"./runtime-dom.esm-bundler.578d6e91.js";import{p as _}from"./modules-info.d6bd555b.js";import{U as f,r as u,_ as v,s as C,u as l,z as h,v as d,w as p,x as o,y as g,F as b,A as x,E as w,G as y,C as S,J as k}from"./_plugin-vue_export-helper.4e6dc3af.js";import{C as B,a as P}from"./Carousel.533b4b19.js";import"./session-utm.744b0db3.js";import"./index.ddc27a3a.js";function V(t,s){{const a=btoa(JSON.stringify({filename:t}));window.parent.postMessage(JSON.parse(JSON.stringify({type:"open",filename:t,id:a})),window.location.origin),window.addEventListener("message",e=>{e.data.id===a&&s(e.data.data)})}}const L=t=>{const s=f(null);return window.$isCmsPreview&&V(t,a=>{s.value=a}),{liveContent:s}},N=t=>{const s={slides:[]};return t.header?.pitch_bar&&(s.slides=t.header.pitch_bar),s},J=t=>{const{liveContent:s}=L("layout"),a=u(()=>(s.value?N(s.value).slides:t.slides).map(({html:n})=>_(n).value.replace(/<\/?p>/g,"").replace(/<(\/?d-md)>/g,"<$1>"))),e=u(()=>a.value.filter(r=>r).length);return{parsedContents:a,countValidSlides:e}},O=C({__name:"PitchBar",props:{slides:{}},setup(t,{expose:s}){s();const a=t,{parsedContents:e,countValidSlides:r}=J(a),n={props:a,parsedContents:e,countValidSlides:r,Carousel:B,CarouselControl:P};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),z={class:"bg-base-100 relative z-20"},E={class:"container md:w-2/3 mx-auto px-3 py-1"},M=["innerHTML"],A={class:"text-xl leading-none text-base-400"};function D(t,s,a,e,r,n){return o(),l("div",z,[h("div",E,[d(e.Carousel,{autoplay:e.countValidSlides>1?7e3:void 0},{controls:p(()=>[g(h("div",A,[d(e.CarouselControl,{class:"pr-2 bg-base-100 hover:text-base-700","is-prev":""}),d(e.CarouselControl,{class:"pl-2 bg-base-100 hover:text-base-700"})],512),[[m,e.countValidSlides>1]])]),default:p(()=>[(o(!0),l(b,null,x(a.slides,(i,c)=>(o(),l("li",{key:c,class:"shrink-0 basis-full h-full text-center"},[(o(),w(y(i.href?"ALink":"span"),{href:i.href,target:i.target,class:S(["inline-block px-8",i.href?"hover:underline":null])},{default:p(()=>[e.parsedContents[c]?(o(),l("span",{key:0,innerHTML:e.parsedContents[c],class:"prose text-sm text-base-800"},null,8,M)):k("",!0)]),_:2},1032,["href","target","class"]))]))),128))]),_:1},8,["autoplay"])])])}const R=v(O,[["render",D]]);export{R as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as z,b as W,d as A,l as S}from"./modules-info.d6bd555b.js";import{r as s,a3 as k,a4 as E,_ as M,s as T,a5 as F,u as o,I as r,J as c,z as h,H as N,C,v as B,w as L,x as i}from"./_plugin-vue_export-helper.4e6dc3af.js";import"./session-utm.744b0db3.js";const I=(a,l)=>{const{type:n,value:e}=l;let d;return e?(n==="percentage"?d=a*((100-e)/100):d=a-e,d>0?d:0):a},H=a=>{const l=s(()=>a.product||{price:a.price||0,base_price:a.basePrice}),n=s(()=>{const{variations:t}=l.value;if(t){const u=k(l.value);for(let b=0;b<t.length;b++)if(k({...l.value,...t[b]})>u)return!0}return!1}),e=s(()=>{const t=k(l.value),u=z.value;return u&&(!u.min_amount||t>u.min_amount)?I(t,u):t}),d=s(()=>{if(E(l.value))return l.value.base_price;const t=k(l.value);return t>e.value?t:0}),_=s(()=>a.installmentsOption||W.value||{max_number:1}),m=s(()=>{if(_.value.max_number<=1)return 1;const t=_.value.min_installment||5,u=Math.round(e.value/t);return Math.min(u,_.value.max_number)}),P=s(()=>_.value.monthly_interest||0),g=s(()=>{if(m.value>=2){if(!P.value)return e.value/m.value;const t=P.value/100;return e.value*t/(1-(1+t)**-m.value)}return 0}),y=s(()=>{const t=a.discountOption||A.value;return t&&(!t.min_amount||t.min_amount<=e.value)&&(!a.isAmountTotal||t.apply_at==="total")?t:{}}),O=s(()=>{const{label:t}=y.value;return t?t.includes(" ")?t:`via ${t}`:""}),V=s(()=>I(e.value,y.value)),v=s(()=>{if(a.loyaltyPointsProgram)return a.loyaltyPointsProgram;const t=S.value;if(t){const u=Object.keys(t);for(let b=0;b<u.length;b++){const p=t[u[b]];if(p?.earn_percentage&&p.earn_percentage>0)return p}}return{ratio:0}}),f=s(()=>v.value.min_subtotal_to_earn||0),j=s(()=>v.value.name||""),D=s(()=>v.value.earn_percentage||0),x=s(()=>D.value*v.value.ratio),w=s(()=>x.value>=1?e.value*(x.value/100):0);return{hasVariedPrices:n,salePrice:e,comparePrice:d,installmentsObject:_,installmentsNumber:m,monthlyInterest:P,installmentValue:g,discountObject:y,discountLabel:O,priceWithDiscount:V,pointsProgramObject:v,pointsMinPrice:f,pointsProgramName:j,earnPointsPercentage:D,cashbackPercentage:x,cashbackValue:w}},J=T({__name:"Prices",props:{isBig:{type:Boolean},isLiteral:{type:Boolean},hasCashback:{type:Boolean,default:!0},hasPriceOptions:{type:Boolean,default:!0},product:{},price:{},basePrice:{},isAmountTotal:{type:Boolean},installmentsOption:{},discountOption:{},loyaltyPointsProgram:{}},setup(a,{expose:l}){l();const n=a,{hasVariedPrices:e,salePrice:d,comparePrice:_,cashbackPercentage:m,cashbackValue:P,installmentsNumber:g,monthlyInterest:y,installmentValue:O,priceWithDiscount:V,discountLabel:v}=H(n),f={props:n,hasVariedPrices:e,salePrice:d,comparePrice:_,cashbackPercentage:m,cashbackValue:P,installmentsNumber:g,monthlyInterest:y,installmentValue:O,priceWithDiscount:V,discountLabel:v};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),R={key:0,class:"text-base-500 mr-1 [font-size:87%]"},q={key:0},G={key:1},K={key:0},Q={key:0,class:"relative z-10"},U=["data-tooltip"],X=h("i",{class:"i-cashback mr-1"},null,-1),Y={class:"font-medium"},Z=h("small",null," cashback",-1),$={key:0},ee={key:0},te={key:1},ae={key:2},ne={key:0},se={key:0},re={key:1};function oe(a,l,n,e,d,_){const m=F("Fade");return i(),o("div",{class:C(["text-base-600 [&>div]:[font-size:90%] [&_small]:lowercase [&_small]:[font-size:92%]",n.isBig?"text-lg":null]),"data-prices":""},[e.comparePrice?(i(),o("span",R,[n.isLiteral?(i(),o("small",q,r("De "))):c("",!0),h("s",null,r(a.$money(e.comparePrice)),1),n.isLiteral?(i(),o("small",G,r(" Por"))):c("",!0)])):c("",!0),h("strong",{class:C(["inline-block text-base-800",n.isBig?"text-5xl block":null])},[e.hasVariedPrices?(i(),o("small",K,r("A partir de "))):c("",!0),N(" "+r(a.$money(e.salePrice)),1)],2),B(m,{slide:"down"},{default:L(()=>[e.cashbackValue&&n.hasCashback?(i(),o("div",Q,[h("span",{"data-tooltip":"Receba $1 de volta".replace("$1",a.$percentage(e.cashbackPercentage))},[X,h("span",Y,r(a.$money(e.cashbackValue)),1),Z],8,U)])):c("",!0)]),_:1}),B(m,{slide:"down"},{default:L(()=>[e.installmentValue&&n.hasPriceOptions?(i(),o("div",$,[n.isLiteral?(i(),o("small",ee,r("Até "))):c("",!0),N(" "+r(e.installmentsNumber)+"x ",1),n.isLiteral?(i(),o("small",te,r(" De "))):c("",!0),h("span",null,r(a.$money(e.installmentValue)),1),!e.monthlyInterest&&n.isLiteral?(i(),o("small",ae,r("Sem juros"))):c("",!0)])):c("",!0)]),_:1}),B(m,{slide:"down"},{default:L(()=>[e.priceWithDiscount<e.salePrice&&n.hasPriceOptions?(i(),o("div",ne,[e.discountLabel?c("",!0):(i(),o("small",se,r("A partir de "))),h("span",null,r(a.$money(e.priceWithDiscount)),1),e.discountLabel?(i(),o("small",re,r(` ${e.discountLabel}`),1)):c("",!0)])):c("",!0)]),_:1})],2)}const ue=M(J,[["render",oe]]);export{ue as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as z}from"./runtime-dom.esm-bundler.578d6e91.js";import{a as C}from"./api.7f62c1ff.js";import{T as F,N as m,a2 as E,a3 as A,r as _,a4 as T,_ as N,s as Q,a5 as B,x as u,u as g,E as x,w,z as b,F as P,v,J as H,G as O,C as V,H as I,I as S,y as D,A as M}from"./_plugin-vue_export-helper.4e6dc3af.js";import{C as G,a as J}from"./Carousel.533b4b19.js";import{a as R,w as K}from"./index.ddc27a3a.js";import{i as U,g as j}from"./img.22ad29ec.js";import W from"./Prices.bd0d3474.js";import"./modules-info.d6bd555b.js";import"./session-utm.744b0db3.js";const X=(t,n=F.get("lang"))=>n&&t.i18n&&t.i18n[n]?t.i18n[n]:t.name||t.title||U(t.i18n,n)||"",Y=X,Z=t=>t&&t.min_quantity||1,$=Z,tt=t=>!t.hasOwnProperty("quantity")||t.quantity>=$(t),q=tt,et=t=>{const n=m(t.title||""),s=m(t.titleLink||""),e=m(!1);let o=null;const i=m(null),l=E(t.products||[]);return t.products||(e.value=!0,o=(async()=>{let c=t.searchQuery||"",d;if(t.collectionId){try{const{data:a}=await C.get(`collections/${t.collectionId}`);d=a}catch(a){console.error(a),i.value=a}const r=d?.products;Array.isArray(r)&&r.length&&(c+=`&_id=${r.slice(0,60).join(",")}`),!n.value&&n.value!==null&&d?.name&&(n.value=d?.name)}const h=t.limit||24;let y=`offset=${t.page?(t.page-1)*h:0}&limit=${h}`;t.sort&&(y+=`&sort=${t.sort}`),y+=c;try{const{data:r}=await C.get(`search/v1?${y}`);if(t.isShuffle){let a=r.result.filter(L=>L.available&&q(L)).length,p,f;for(;a;)f=Math.floor(Math.random()*a--),p=r.result[a],r.result[a]=r.result[f],r.result[f]=p}r.result.forEach(a=>l.push(a))}catch(r){console.error(r),i.value=r}e.value=!1})()),{title:n,titleLink:s,isFetching:e,fetching:o,fetchError:i,products:l}},rt=t=>{const n=m(!1);let s=null;const e=m(null),o=E({...t.product,price:A(t.product||{})}),{productId:i}=t;!t.product&&i&&(n.value=!0,s=(async()=>{try{const{data:r}=await C.get(`products/${i}`);Object.assign(o,r)}catch(r){console.error(r),e.value=r}n.value=!1})());const l=_(()=>Y(o)),c=_(()=>{const{slug:r}=o;return typeof r=="string"?`/${r}`:null}),d=_(()=>{const{pictures:r}=o,a=[];if(r)r.forEach(p=>{const f=j(p);f&&a.push(f)});else{const{picture:p}=o;if(p){const f=j(p);f&&a.push(f)}}return a}),h=_(()=>q(o)),k=_(()=>h.value&&o.available&&o.visible),y=_(()=>{if(T(o)){const r=o.base_price;return Math.round((r-A(o))*100/r)}return 0});return{isFetching:n,fetching:s,fetchError:e,product:o,title:l,link:c,images:d,isInStock:h,isActive:k,discountPercentage:y}},ot=Q({__name:"ProductCard",props:{product:{},productId:{},headingTag:{default:"h3"}},setup(t,{expose:n}){n();const s=t,{product:e,title:o,link:i,images:l}=rt({product:s.product,productId:s.productId}),c=m(null),d=R(c),h=m(!1);K(d,()=>{h.value=!0});const k={props:s,product:e,title:o,link:i,images:l,card:c,isHovered:d,wasHoveredOnce:h,Prices:W};return Object.defineProperty(k,"__isScriptSetup",{enumerable:!1,value:!0}),k}}),nt=["data-sku"],at={class:"aspect-square p-2 motion-safe:group-hover:scale-110 transition-transform"},st={class:"relative w-full h-full bg-white rounded overflow-hidden group-hover:rounded-none"},lt={key:1,class:"w-full h-full bg-gradient-to-br from-base-50/20 to-base-100"},ct={class:"flex flex-col grow justify-between p-4 group-hover:backdrop-blur-md bg-white/40 z-10"},it={class:"pt-2"};function ut(t,n,s,e,o,i){const l=B("AImg");return u(),g("article",{ref:"card","data-sku":e.product.sku,class:"relative h-full max-w-[350px] mx-auto py-3 group"},[(u(),x(O(e.link?"ALink":"span"),{href:e.link,class:"flex flex-col h-full rounded overflow-hidden group-hover:shadow group-hover:ring-1 ring-black/5"},{default:w(()=>[b("div",at,[b("div",st,[e.images?.length?(u(),g(P,{key:0},[v(l,{picture:e.images[0],alt:e.title,class:"absolute top-0 left-0 block w-full h-full object-cover"},null,8,["picture","alt"]),e.images[1]&&e.wasHoveredOnce?(u(),x(l,{key:0,picture:e.images[1],alt:e.title,class:"absolute top-0 left-0 block w-full h-full object-cover opacity-0 group-hover:opacity-100 transition-opacity motion-safe:duration-300 text-transparent z-10"},null,8,["picture","alt"])):H("",!0)],64)):(u(),g("div",lt))])]),b("div",ct,[(u(),x(O(s.headingTag),{class:V(["ui-link text-base-700 no-underline line-clamp-2",e.link?"group-hover:underline group-hover:text-primary":null])},{default:w(()=>[I(S(e.title),1)]),_:1},8,["class"])),b("div",it,[v(e.Prices,{product:e.product},null,8,["product"])])])]),_:1},8,["href"]))],8,nt)}const dt=N(ot,[["render",ut]]),ft=Q({__name:"ProductShelf",props:{collectionId:{},searchQuery:{},sort:{},title:{},titleLink:{},isShuffle:{type:Boolean},limit:{},page:{},products:{}},async setup(t,{expose:n}){n();const s=t,{title:e,titleLink:o,fetching:i,products:l}=et(s),c={props:s,title:e,titleLink:o,fetching:i,products:l,Carousel:G,CarouselControl:J,ProductCard:dt};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}}),ht={class:"container mx-auto"},gt={key:0},mt={class:"text-3xl lg:text-xl leading-none text-primary lg:opacity-0 group-hover/shelf:opacity-90 transition-opacity"};function pt(t,n,s,e,o,i){const l=B("ALink");return u(),g("section",ht,[e.title?(u(),g("h2",gt,[e.titleLink?(u(),x(l,{key:0,href:e.titleLink},{default:w(()=>[I(S(e.title),1)]),_:1},8,["href"])):(u(),g(P,{key:1},[I(S(e.title),1)],64))])):H("",!0),v(e.Carousel,{class:"group/shelf"},{controls:w(()=>[D(b("div",mt,[v(e.CarouselControl,{class:"!top-1/2 lg:-left-2 w-10 h-10 bg-transparent lg:bg-white/80 lg:hover:bg-primary/10 rounded-full lg:shadow-sm lg:ring-1 ring-black/5","is-prev":""}),v(e.CarouselControl,{class:"!top-1/2 lg:-right-2 w-10 h-10 bg-transparent lg:bg-white/80 lg:hover:bg-primary/10 rounded-full lg:shadow-sm lg:ring-1 ring-black/5"})],512),[[z,e.products.length>2]])]),default:w(()=>[(u(!0),g(P,null,M(e.products,c=>(u(),g("li",{key:c._id,class:"basis-1/2 md:basis-1/3 lg:basis-1/4 shrink-0"},[v(e.ProductCard,{product:c},null,8,["product"])]))),128))]),_:1})])}const It=N(ft,[["render",pt]]);export{It as default};
|