cloudcommerce 0.16.3 → 0.17.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 +21 -0
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/affilate-program/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/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/feeds/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/lib/firebase/serve-storefront.js +12 -4
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/ssr/src/firebase/serve-storefront.ts +12 -4
- package/packages/storefront/dist/client/_astro/ProductShelf.c266a001.js +1 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/{_...06f412d0.mjs → _...ac19792e.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{account@_@astro.d58b2d34.mjs → account@_@astro.d6c3fcbd.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{endpoint@_@js.ce919661.mjs → endpoint@_@js.98745cd2.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{fallback@_@astro.6c7c4acd.mjs → fallback@_@astro.08f4af85.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{index@_@astro.f7e2409d.mjs → index@_@astro.0fdfcad0.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{index@_@astro.8e359cb4.mjs → index@_@astro.8d90cfe1.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.f0a57b8d.mjs → _...slug_.astro.75b11a3a.mjs} +29 -25
- package/packages/storefront/dist/server/chunks/pages/{endpoint.js.1d889b2f.mjs → endpoint.js.e6f912a7.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{fallback.astro.42f81a9a.mjs → fallback.astro.dfe6d27b.mjs} +3 -2
- package/packages/storefront/dist/server/chunks/pages/{index.astro.533679e1.mjs → index.astro.4ad20d64.mjs} +17 -16
- package/packages/storefront/dist/server/entry.mjs +8 -8
- package/packages/storefront/dist/server/renderers.mjs +1 -1
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/src/lib/composables/use-product-card.ts +15 -15
- package/packages/storefront/src/lib/layouts/main/use-page-sections.ts +5 -0
- package/packages/storefront/src/lib/layouts/{use-page-layout.ts → use-page-header.ts} +24 -4
- package/packages/storefront/src/lib/ssr-context.ts +1 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/ProductShelf.f013b3ee.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.17.0](https://github.com/ecomplus/cloud-commerce/compare/v0.16.4...v0.17.0) (2023-07-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* **storefront:** Route context `apiState.categories` is now undefined by default
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **ssr:** Properly debugging time on X-Cache-Key-Took header ([992cf5d](https://github.com/ecomplus/cloud-commerce/commit/992cf5dbe4687945c67f82d421c5e92cabd239dc))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
* **storefront:** No API endpoints to prefetch by default (current route slug only) ([4b20ace](https://github.com/ecomplus/cloud-commerce/commit/4b20ace9c828cf674f152803a62c56d2cba66724))
|
|
18
|
+
|
|
19
|
+
### [0.16.4](https://github.com/ecomplus/cloud-commerce/compare/v0.16.3...v0.16.4) (2023-07-11)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **ssr:** Ensure valid Firestore doc path for home SSR cache ([2ae2b4e](https://github.com/ecomplus/cloud-commerce/commit/2ae2b4e5f89a3713bbb318311ce04ffa887740c4))
|
|
25
|
+
|
|
5
26
|
### [0.16.3](https://github.com/ecomplus/cloud-commerce/compare/v0.16.2...v0.16.3) (2023-07-11)
|
|
6
27
|
|
|
7
28
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.0",
|
|
5
5
|
"description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
|
|
6
6
|
"main": "packages/api/lib/index.js",
|
|
7
7
|
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
@@ -77,6 +77,7 @@ export default async (req, res) => {
|
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
const startedAt = Date.now();
|
|
80
|
+
let cacheKeyEndedAt;
|
|
80
81
|
let ssrStartedAt;
|
|
81
82
|
let status;
|
|
82
83
|
let headers = {};
|
|
@@ -89,9 +90,13 @@ export default async (req, res) => {
|
|
|
89
90
|
/* eslint-disable prefer-rest-params */
|
|
90
91
|
// @ts-ignore
|
|
91
92
|
res.writeHead = function writeHead(_status, _headers) {
|
|
92
|
-
|
|
93
|
+
const now = Date.now();
|
|
94
|
+
_headers['X-Function-Took'] = String(now - startedAt);
|
|
93
95
|
if (ssrStartedAt) {
|
|
94
|
-
_headers['X-SSR-Took'] = String(
|
|
96
|
+
_headers['X-SSR-Took'] = String(now - ssrStartedAt);
|
|
97
|
+
}
|
|
98
|
+
if (cacheKeyEndedAt) {
|
|
99
|
+
_headers['X-Cache-Key-Took'] = String(cacheKeyEndedAt - startedAt);
|
|
95
100
|
}
|
|
96
101
|
if (!res.headersSent) {
|
|
97
102
|
// @ts-ignore
|
|
@@ -102,12 +107,15 @@ export default async (req, res) => {
|
|
|
102
107
|
};
|
|
103
108
|
let cacheRef;
|
|
104
109
|
let isBodySent = false;
|
|
105
|
-
if (!req.query.__noCache && req.path.charAt(1) !== '~') {
|
|
110
|
+
if (!req.query.__noCache && req.path.charAt(1) !== '~' && cacheMaxAge > 0) {
|
|
106
111
|
try {
|
|
107
112
|
const firestore = getFirestore();
|
|
108
|
-
const cacheKey = req.path.
|
|
113
|
+
const cacheKey = (!req.path || req.path === '/')
|
|
114
|
+
? '__home'
|
|
115
|
+
: req.path.slice(1).replace(/\//g, '_');
|
|
109
116
|
cacheRef = firestore.doc(`ssrCache/${cacheKey}`);
|
|
110
117
|
const cacheDoc = await cacheRef.get();
|
|
118
|
+
cacheKeyEndedAt = Date.now();
|
|
111
119
|
if (cacheDoc.exists) {
|
|
112
120
|
const {
|
|
113
121
|
headers: cachedHeaders, status: cachedStatus, body: cachedBody, __timestamp,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve-storefront.js","sourceRoot":"","sources":["../../src/firebase/serve-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,CAAC,KAAK,CAAC,CAAC;YACxC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACd,OAAO;SACR;QACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QAC7C,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnC,iBAAiB,CAAC,GAAG,EAAE,kCAAkC,CAAC;iBACvD,IAAI,CAAC,IAAI,CAAC,CAAC;SACf;QAAC,OAAO,CAAC,EAAE;YACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAClB;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -99,6 +99,7 @@ export default async (req: Request, res: Response) => {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
const startedAt = Date.now();
|
|
102
|
+
let cacheKeyEndedAt: number | undefined;
|
|
102
103
|
let ssrStartedAt: number | undefined;
|
|
103
104
|
let status: number;
|
|
104
105
|
let headers: OutgoingHttpHeaders = {};
|
|
@@ -111,9 +112,13 @@ export default async (req: Request, res: Response) => {
|
|
|
111
112
|
/* eslint-disable prefer-rest-params */
|
|
112
113
|
// @ts-ignore
|
|
113
114
|
res.writeHead = function writeHead(_status: number, _headers: OutgoingHttpHeaders) {
|
|
114
|
-
|
|
115
|
+
const now = Date.now();
|
|
116
|
+
_headers['X-Function-Took'] = String(now - startedAt);
|
|
115
117
|
if (ssrStartedAt) {
|
|
116
|
-
_headers['X-SSR-Took'] = String(
|
|
118
|
+
_headers['X-SSR-Took'] = String(now - ssrStartedAt);
|
|
119
|
+
}
|
|
120
|
+
if (cacheKeyEndedAt) {
|
|
121
|
+
_headers['X-Cache-Key-Took'] = String(cacheKeyEndedAt - startedAt);
|
|
117
122
|
}
|
|
118
123
|
if (!res.headersSent) {
|
|
119
124
|
// @ts-ignore
|
|
@@ -125,12 +130,15 @@ export default async (req: Request, res: Response) => {
|
|
|
125
130
|
|
|
126
131
|
let cacheRef: DocumentReference<any> | undefined | null;
|
|
127
132
|
let isBodySent = false;
|
|
128
|
-
if (!req.query.__noCache && req.path.charAt(1) !== '~') {
|
|
133
|
+
if (!req.query.__noCache && req.path.charAt(1) !== '~' && cacheMaxAge > 0) {
|
|
129
134
|
try {
|
|
130
135
|
const firestore = getFirestore();
|
|
131
|
-
const cacheKey = req.path.
|
|
136
|
+
const cacheKey = (!req.path || req.path === '/')
|
|
137
|
+
? '__home'
|
|
138
|
+
: req.path.slice(1).replace(/\//g, '_');
|
|
132
139
|
cacheRef = firestore.doc(`ssrCache/${cacheKey}`);
|
|
133
140
|
const cacheDoc = await cacheRef.get();
|
|
141
|
+
cacheKeyEndedAt = Date.now();
|
|
134
142
|
if (cacheDoc.exists) {
|
|
135
143
|
const {
|
|
136
144
|
headers: cachedHeaders,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{v as z}from"./runtime-dom.esm-bundler.00b967e0.js";import{a as C}from"./api.7f62c1ff.js";import{T as F,N as m,a1 as E,r as _,_ as N,s as Q,a2 as B,x as u,u as g,E as x,w,z as b,F as P,v,J as H,G as A,C as T,H as I,I as S,y as V,A as D}from"./_plugin-vue_export-helper.d3aaeb0d.js";import{C as M,a as G}from"./Carousel.f39be3c0.js";import{a as J,w as R}from"./index.33347cbd.js";import{i as K,g as O}from"./img.517fec8e.js";import{g as j,c as U}from"./format-money.3b884fcb.js";import W from"./Prices.de6df3cb.js";import"./modules-info.ad27b027.js";import"./session-utm.744b0db3.js";import"./idle-callback.889bf0ea.js";const X=(t,n=F.get("lang"))=>n&&t.i18n&&t.i18n[n]?t.i18n[n]:t.name||t.title||K(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||""),a=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:s}=await C.get(`collections/${t.collectionId}`);d=s}catch(s){console.error(s),i.value=s}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 s=r.result.filter(L=>L.available&&q(L)).length,p,f;for(;s;)f=Math.floor(Math.random()*s--),p=r.result[s],r.result[s]=r.result[f],r.result[f]=p}r.result.forEach(s=>l.push(s))}catch(r){console.error(r),i.value=r}e.value=!1})()),{title:n,titleLink:a,isFetching:e,fetching:o,fetchError:i,products:l}},rt=t=>{const n=m(!1);let a=null;const e=m(null),o=E({...t.product,price:j(t.product||{})}),{productId:i}=t;!t.product&&i&&(n.value=!0,a=(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,s=[];if(r)r.forEach(p=>{const f=O(p);f&&s.push(f)});else{const{picture:p}=o;if(p){const f=O(p);f&&s.push(f)}}return s}),h=_(()=>q(o)),k=_(()=>h.value&&o.available&&o.visible),y=_(()=>{if(U(o)){const r=o.base_price;return Math.round((r-j(o))*100/r)}return 0});return{isFetching:n,fetching:a,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 a=t,{product:e,title:o,link:i,images:l}=rt({product:a.product,productId:a.productId}),c=m(null),d=J(c),h=m(!1);R(d,()=>{h.value=!0});const k={props:a,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"],st={class:"aspect-square p-2 motion-safe:group-hover:scale-110 transition-transform"},at={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,a,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(A(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",st,[b("div",at,[e.images?.length?(u(),g(P,{key:0},[v(l,{picture:e.images[0],class:"absolute top-0 left-0 block w-full h-full object-cover"},null,8,["picture"]),e.images[1]&&e.wasHoveredOnce?(u(),x(l,{key:0,picture:e.images[1],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"])):H("",!0)],64)):(u(),g("div",lt))])]),b("div",ct,[(u(),x(A(a.headingTag),{class:T(["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 a=t,{title:e,titleLink:o,fetching:i,products:l}=et(a),c={props:a,title:e,titleLink:o,fetching:i,products:l,Carousel:M,CarouselControl:G,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,a,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(()=>[V(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,D(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 Lt=N(ft,[["render",pt]]);export{Lt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){let e,s={};const r=(r,n)=>(r=new URL(r+".js",n).href,s[r]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=r,e.onload=s,document.head.appendChild(e)}else e=r,importScripts(r),s()})).then((()=>{let e=s[r];if(!e)throw new Error(`Module ${r} didn’t register its module`);return e})));self.define=(n,i)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(s[o])return;let l={};const a=e=>r(e,o),u={module:{uri:o},exports:l,require:a};s[o]=Promise.all(n.map((e=>u[e]||a(e)))).then((e=>(i(...e),l)))}}define(["./workbox-5e0bf4e4"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"_astro/_...slug_.45bc69ca.css",revision:null},{url:"_astro/_plugin-vue_export-helper.d3aaeb0d.js",revision:null},{url:"_astro/api.7f62c1ff.js",revision:null},{url:"_astro/Carousel.f39be3c0.js",revision:null},{url:"_astro/client.2d950540.js",revision:null},{url:"_astro/firebase-app.84207480.js",revision:null},{url:"_astro/format-money.3b884fcb.js",revision:null},{url:"_astro/HeroSlider.3d4a1d1c.js",revision:null},{url:"_astro/hoisted.9d9d7ac4.js",revision:null},{url:"_astro/idle-callback.889bf0ea.js",revision:null},{url:"_astro/img.517fec8e.js",revision:null},{url:"_astro/index.33347cbd.js",revision:null},{url:"_astro/modules-info.ad27b027.js",revision:null},{url:"_astro/PitchBar.c53e6d0b.js",revision:null},{url:"_astro/preload-helper.cf010ec4.js",revision:null},{url:"_astro/Prices.de6df3cb.js",revision:null},{url:"_astro/ProductShelf.
|
|
1
|
+
if(!self.define){let e,s={};const r=(r,n)=>(r=new URL(r+".js",n).href,s[r]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=r,e.onload=s,document.head.appendChild(e)}else e=r,importScripts(r),s()})).then((()=>{let e=s[r];if(!e)throw new Error(`Module ${r} didn’t register its module`);return e})));self.define=(n,i)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(s[o])return;let l={};const a=e=>r(e,o),u={module:{uri:o},exports:l,require:a};s[o]=Promise.all(n.map((e=>u[e]||a(e)))).then((e=>(i(...e),l)))}}define(["./workbox-5e0bf4e4"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"_astro/_...slug_.45bc69ca.css",revision:null},{url:"_astro/_plugin-vue_export-helper.d3aaeb0d.js",revision:null},{url:"_astro/api.7f62c1ff.js",revision:null},{url:"_astro/Carousel.f39be3c0.js",revision:null},{url:"_astro/client.2d950540.js",revision:null},{url:"_astro/firebase-app.84207480.js",revision:null},{url:"_astro/format-money.3b884fcb.js",revision:null},{url:"_astro/HeroSlider.3d4a1d1c.js",revision:null},{url:"_astro/hoisted.9d9d7ac4.js",revision:null},{url:"_astro/idle-callback.889bf0ea.js",revision:null},{url:"_astro/img.517fec8e.js",revision:null},{url:"_astro/index.33347cbd.js",revision:null},{url:"_astro/modules-info.ad27b027.js",revision:null},{url:"_astro/PitchBar.c53e6d0b.js",revision:null},{url:"_astro/preload-helper.cf010ec4.js",revision:null},{url:"_astro/Prices.de6df3cb.js",revision:null},{url:"_astro/ProductShelf.c266a001.js",revision:null},{url:"_astro/runtime-dom.esm-bundler.00b967e0.js",revision:null},{url:"_astro/session-utm.744b0db3.js",revision:null},{url:"_astro/ShopHeader.c0ba5061.js",revision:null},{url:"_astro/workbox-window.prod.es5.a7b12eab.js",revision:null},{url:"manifest.webmanifest",revision:"138b9c9f495fe815bcec626365e9372e"}],{ignoreURLParametersMatching:[/.*/]}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/404"))),e.registerRoute(/^\/$/,new e.NetworkFirst,"GET"),e.registerRoute(/\/((?!(?:admin|assets|img)(\/|$))[^.]+)(\.(?!js|css|xml|txt|png|jpg|jpeg|webp|avif|svg|gif)[^.]+)*$/,new e.NetworkFirst({cacheName:"pages",plugins:[new e.ExpirationPlugin({maxEntries:50,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^\/assets\//,new e.StaleWhileRevalidate({cacheName:"assets",plugins:[]}),"GET"),e.registerRoute(/^\/_image$/,new e.StaleWhileRevalidate({cacheName:"optim-images",plugins:[new e.ExpirationPlugin({maxEntries:50,maxAgeSeconds:2592e3,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^\/img\/uploads\/.*\.(?:png|jpg|jpeg|webp|avif|svg|gif)$/,new e.StaleWhileRevalidate({cacheName:"cms-images",plugins:[new e.ExpirationPlugin({maxEntries:20,maxAgeSeconds:2592e3,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^https:\/\/ecomplus\.io/,new e.NetworkFirst({cacheName:"store-api",plugins:[new e.ExpirationPlugin({maxEntries:50,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^https:\/\/(((\w+\.)?ecoms\d)|(ecom[\w-]+(\.\w+)*\.digitaloceanspaces))\.com.*\/imgs\/normal\//,new e.CacheFirst({cacheName:"product-thumbnails",plugins:[new e.ExpirationPlugin({maxEntries:100,maxAgeSeconds:2592e3,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^https:\/\/(((\w+\.)?ecoms\d)|(ecom[\w-]+(\.\w+)*\.digitaloceanspaces))\.com.*\/imgs\/big\//,new e.CacheFirst({cacheName:"product-pictures",plugins:[new e.ExpirationPlugin({maxEntries:10,maxAgeSeconds:604800,purgeOnQuotaError:!0})]}),"GET")}));
|
|
@@ -14,7 +14,7 @@ import 'string-width';
|
|
|
14
14
|
import 'vue';
|
|
15
15
|
import 'vue/server-renderer';
|
|
16
16
|
import '@ecomplus/utils';
|
|
17
|
-
import './pages/_...slug_.astro.
|
|
17
|
+
import './pages/_...slug_.astro.75b11a3a.mjs';
|
|
18
18
|
import 'node:fs/promises';
|
|
19
19
|
import 'node:path';
|
|
20
20
|
import 'node:url';
|
|
@@ -30,6 +30,6 @@ import '@cloudcommerce/config';
|
|
|
30
30
|
/* empty css */import '@vueuse/core';
|
|
31
31
|
import '@headlessui/vue';
|
|
32
32
|
|
|
33
|
-
const page = () => import('./pages/_...slug_.astro.
|
|
33
|
+
const page = () => import('./pages/_...slug_.astro.75b11a3a.mjs').then(n => n.d);
|
|
34
34
|
|
|
35
35
|
export { page };
|
|
@@ -14,7 +14,7 @@ import 'string-width';
|
|
|
14
14
|
import 'vue';
|
|
15
15
|
import 'vue/server-renderer';
|
|
16
16
|
import '@ecomplus/utils';
|
|
17
|
-
import './pages/_...slug_.astro.
|
|
17
|
+
import './pages/_...slug_.astro.75b11a3a.mjs';
|
|
18
18
|
import 'node:fs/promises';
|
|
19
19
|
import 'node:path';
|
|
20
20
|
import 'node:url';
|
|
@@ -14,7 +14,7 @@ import 'string-width';
|
|
|
14
14
|
import 'vue';
|
|
15
15
|
import 'vue/server-renderer';
|
|
16
16
|
import '@ecomplus/utils';
|
|
17
|
-
import './pages/_...slug_.astro.
|
|
17
|
+
import './pages/_...slug_.astro.75b11a3a.mjs';
|
|
18
18
|
import 'node:fs/promises';
|
|
19
19
|
import 'node:path';
|
|
20
20
|
import 'node:url';
|
|
@@ -30,6 +30,6 @@ import '@cloudcommerce/config';
|
|
|
30
30
|
/* empty css */import '@vueuse/core';
|
|
31
31
|
import '@headlessui/vue';
|
|
32
32
|
|
|
33
|
-
const page = () => import('./pages/endpoint.js.
|
|
33
|
+
const page = () => import('./pages/endpoint.js.e6f912a7.mjs').then(n => n.e);
|
|
34
34
|
|
|
35
35
|
export { page };
|
|
@@ -14,7 +14,7 @@ import 'string-width';
|
|
|
14
14
|
import 'vue';
|
|
15
15
|
import 'vue/server-renderer';
|
|
16
16
|
import '@ecomplus/utils';
|
|
17
|
-
import './pages/_...slug_.astro.
|
|
17
|
+
import './pages/_...slug_.astro.75b11a3a.mjs';
|
|
18
18
|
import 'node:fs/promises';
|
|
19
19
|
import 'node:path';
|
|
20
20
|
import 'node:url';
|
|
@@ -30,6 +30,6 @@ import '@cloudcommerce/config';
|
|
|
30
30
|
/* empty css */import '@vueuse/core';
|
|
31
31
|
import '@headlessui/vue';
|
|
32
32
|
|
|
33
|
-
const page = () => import('./pages/fallback.astro.
|
|
33
|
+
const page = () => import('./pages/fallback.astro.dfe6d27b.mjs');
|
|
34
34
|
|
|
35
35
|
export { page };
|
|
@@ -14,7 +14,7 @@ import 'string-width';
|
|
|
14
14
|
import 'vue';
|
|
15
15
|
import 'vue/server-renderer';
|
|
16
16
|
import '@ecomplus/utils';
|
|
17
|
-
import './pages/_...slug_.astro.
|
|
17
|
+
import './pages/_...slug_.astro.75b11a3a.mjs';
|
|
18
18
|
import 'node:fs/promises';
|
|
19
19
|
import 'node:path';
|
|
20
20
|
import 'node:url';
|
|
@@ -30,6 +30,6 @@ import '@cloudcommerce/config';
|
|
|
30
30
|
/* empty css */import '@vueuse/core';
|
|
31
31
|
import '@headlessui/vue';
|
|
32
32
|
|
|
33
|
-
const page = () => import('./pages/index.astro.
|
|
33
|
+
const page = () => import('./pages/index.astro.4ad20d64.mjs').then(n => n.a);
|
|
34
34
|
|
|
35
35
|
export { page };
|
|
@@ -14,7 +14,7 @@ import 'string-width';
|
|
|
14
14
|
import 'vue';
|
|
15
15
|
import 'vue/server-renderer';
|
|
16
16
|
import '@ecomplus/utils';
|
|
17
|
-
import './pages/_...slug_.astro.
|
|
17
|
+
import './pages/_...slug_.astro.75b11a3a.mjs';
|
|
18
18
|
import 'node:fs/promises';
|
|
19
19
|
import 'node:path';
|
|
20
20
|
import 'node:url';
|
|
@@ -30,6 +30,6 @@ import '@cloudcommerce/config';
|
|
|
30
30
|
/* empty css */import '@vueuse/core';
|
|
31
31
|
import '@headlessui/vue';
|
|
32
32
|
|
|
33
|
-
const page = () => import('./pages/index.astro.
|
|
33
|
+
const page = () => import('./pages/index.astro.4ad20d64.mjs').then(n => n.i);
|
|
34
34
|
|
|
35
35
|
export { page };
|
|
@@ -267,7 +267,7 @@ if (!globalThis.$apiMergeConfig) {
|
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
if (!globalThis.$apiPrefetchEndpoints) {
|
|
270
|
-
globalThis.$apiPrefetchEndpoints = [
|
|
270
|
+
globalThis.$apiPrefetchEndpoints = [];
|
|
271
271
|
}
|
|
272
272
|
if (!globalThis.$storefront) {
|
|
273
273
|
globalThis.$storefront = {
|
|
@@ -615,7 +615,7 @@ async function getImage(transform) {
|
|
|
615
615
|
}
|
|
616
616
|
let loader = (_a = globalThis.astroImage) == null ? void 0 : _a.loader;
|
|
617
617
|
if (!loader) {
|
|
618
|
-
const { default: mod } = await import('./endpoint.js.
|
|
618
|
+
const { default: mod } = await import('./endpoint.js.e6f912a7.mjs').then(n => n.s).catch(() => {
|
|
619
619
|
throw new Error(
|
|
620
620
|
"[@astrojs/image] Builtin image loader not found. (Did you remember to add the integration to your Astro config?)"
|
|
621
621
|
);
|
|
@@ -1054,7 +1054,7 @@ const usePitchBar = (props) => {
|
|
|
1054
1054
|
};
|
|
1055
1055
|
};
|
|
1056
1056
|
|
|
1057
|
-
const
|
|
1057
|
+
const usePageHeader = async ({ routeContext }) => {
|
|
1058
1058
|
const { apiState, getContent } = routeContext;
|
|
1059
1059
|
const layoutContent = await getContent("layout");
|
|
1060
1060
|
const {
|
|
@@ -1062,8 +1062,17 @@ const usePageLayout = async ({ routeContext }) => {
|
|
|
1062
1062
|
service_links: serviceLinks
|
|
1063
1063
|
} = layoutContent;
|
|
1064
1064
|
const pitchBar = parseLayoutContent(layoutContent);
|
|
1065
|
+
let { categories } = apiState;
|
|
1066
|
+
if (!categories) {
|
|
1067
|
+
try {
|
|
1068
|
+
categories = (await api.get("categories")).data.result;
|
|
1069
|
+
} catch (err) {
|
|
1070
|
+
categories = [];
|
|
1071
|
+
console.error(err);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1065
1074
|
const shopHeader = {
|
|
1066
|
-
categories
|
|
1075
|
+
categories,
|
|
1067
1076
|
menuCategorySlugs: headerContent.inline_menu_categories?.featured,
|
|
1068
1077
|
menuRandomCategories: headerContent.inline_menu_categories?.random,
|
|
1069
1078
|
isAlphabeticalSortSubmenu: headerContent.alphabetical_sort_submenu,
|
|
@@ -3307,29 +3316,23 @@ _sfc_main.setup = (props, ctx) => {
|
|
|
3307
3316
|
const ShopHeader = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
|
|
3308
3317
|
|
|
3309
3318
|
const $$Astro$2 = createAstro("https://ecom2-demo.web.app");
|
|
3310
|
-
const $$
|
|
3319
|
+
const $$PageHeader = createComponent(async ($$result, $$props, $$slots) => {
|
|
3311
3320
|
const Astro2 = $$result.createAstro($$Astro$2, $$props, $$slots);
|
|
3312
|
-
Astro2.self = $$
|
|
3313
|
-
const { title } = Astro2.props;
|
|
3321
|
+
Astro2.self = $$PageHeader;
|
|
3314
3322
|
const { routeContext } = Astro2.locals;
|
|
3315
3323
|
const { settings, isHomepage } = routeContext;
|
|
3316
3324
|
const LogoHeading = isHomepage ? "h1" : "h2";
|
|
3317
|
-
const { pitchBar, shopHeader } = await
|
|
3318
|
-
return renderTemplate`${
|
|
3319
|
-
${
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
` })}` })}
|
|
3329
|
-
`)}
|
|
3330
|
-
${renderSlot($$result2, $$slots["default"])}
|
|
3331
|
-
` })}`;
|
|
3332
|
-
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Pages.astro");
|
|
3325
|
+
const { pitchBar, shopHeader } = await usePageHeader({ routeContext });
|
|
3326
|
+
return renderTemplate`${renderSlot($$result, $$slots["pitch-bar"], renderTemplate`
|
|
3327
|
+
${pitchBar.slides.length > 1 && renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar, "client:idle": true, "client:component-hydration": "idle", "client:component-path": "~/components/PitchBar.vue", "client:component-export": "default" })}`}
|
|
3328
|
+
${pitchBar.slides.length === 1 && renderTemplate`${renderComponent($$result, "PitchBar", PitchBar, { ...pitchBar })}`}
|
|
3329
|
+
|
|
3330
|
+
${renderComponent($$result, "ShopHeader", ShopHeader, { ...shopHeader, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/ShopHeader.vue", "client:component-export": "default" }, { "logo": ($$result2) => renderTemplate`${renderComponent($$result2, "Fragment", Fragment, { "slot": "logo" }, { "default": ($$result3) => renderTemplate`
|
|
3331
|
+
${maybeRenderHead()}<a href="/">
|
|
3332
|
+
${renderComponent($$result3, "LogoHeading", LogoHeading, {}, { "logo-picture": ($$result4) => renderTemplate`${renderComponent($$result4, "Picture", $$Picture, { "slot": "logo-picture", "src": settings.logo, "alt": settings.name, "widths": [300], "fetchpriority": "high", "loading": "eager", "class": "hover:drop-shadow-sm max-w-[150px] mx-auto" })}` })}
|
|
3333
|
+
</a>
|
|
3334
|
+
` })}` })}`)}`;
|
|
3335
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/PageHeader.astro");
|
|
3333
3336
|
|
|
3334
3337
|
const $$Astro$1 = createAstro("https://ecom2-demo.web.app");
|
|
3335
3338
|
const $$Wildcard = createComponent(async ($$result, $$props, $$slots) => {
|
|
@@ -3366,7 +3369,8 @@ const $$ = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
3366
3369
|
loadError = err;
|
|
3367
3370
|
}
|
|
3368
3371
|
return renderTemplate`<html${addAttribute(routeContext?.lang.replace("_", "-"), "lang")}>
|
|
3369
|
-
${routeContext && renderTemplate`${renderComponent($$result, "
|
|
3372
|
+
${routeContext && renderTemplate`${renderComponent($$result, "Base", $$Base, {}, { "default": ($$result2) => renderTemplate`
|
|
3373
|
+
${renderComponent($$result2, "PageHeader", $$PageHeader, {})}
|
|
3370
3374
|
${renderComponent($$result2, "WildcardMain", $$Wildcard, {})}
|
|
3371
3375
|
` })}`}
|
|
3372
3376
|
${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
|
|
@@ -3384,4 +3388,4 @@ const ____slug_ = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty(
|
|
|
3384
3388
|
url: $$url
|
|
3385
3389
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
3386
3390
|
|
|
3387
|
-
export { $$
|
|
3391
|
+
export { $$PageHeader as $, BaseSSRService as B, Carousel as C, _export_sfc as _, $$Base as a, $$Picture as b, CarouselControl as c, ____slug_ as d, isOutputFormatSupportsAlpha as i, loadRouteContext as l, modulesInfo as m, parseShippingPhrase as p };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import mime from 'mime';
|
|
2
2
|
import sharp$1 from 'sharp';
|
|
3
|
-
import { B as BaseSSRService, i as isOutputFormatSupportsAlpha } from './_...slug_.astro.
|
|
3
|
+
import { B as BaseSSRService, i as isOutputFormatSupportsAlpha } from './_...slug_.astro.75b11a3a.mjs';
|
|
4
4
|
|
|
5
5
|
class SharpService extends BaseSSRService {
|
|
6
6
|
async transform(inputBuffer, transform) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createAstro, a as createComponent, r as renderTemplate, m as maybeRenderHead, b as addAttribute, d as renderComponent } from '../astro.2df8d1c5.mjs';
|
|
2
|
-
import { l as loadRouteContext, $ as $$
|
|
2
|
+
import { l as loadRouteContext, $ as $$PageHeader, a as $$Base } from './_...slug_.astro.75b11a3a.mjs';
|
|
3
3
|
import 'path-to-regexp';
|
|
4
4
|
import 'cookie';
|
|
5
5
|
import '@astrojs/internal-helpers/path';
|
|
@@ -52,7 +52,8 @@ const $$Fallback = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
52
52
|
return err.astroResponse;
|
|
53
53
|
}
|
|
54
54
|
return renderTemplate`<html${addAttribute(routeContext?.lang.replace("_", "-"), "lang")}>
|
|
55
|
-
${renderComponent($$result, "
|
|
55
|
+
${renderComponent($$result, "Base", $$Base, {}, { "default": ($$result2) => renderTemplate`
|
|
56
|
+
${renderComponent($$result2, "PageHeader", $$PageHeader, {})}
|
|
56
57
|
${renderComponent($$result2, "FallbackMain", $$Fallback$1, {})}
|
|
57
58
|
` })}
|
|
58
59
|
</html>`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createAstro, a as createComponent, r as renderTemplate, d as renderComponent, m as maybeRenderHead, b as addAttribute, u as unescapeHTML, F as Fragment$1 } from '../astro.2df8d1c5.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { b as $$Picture, p as parseShippingPhrase, _ as _export_sfc, C as Carousel, c as CarouselControl, m as modulesInfo, l as loadRouteContext, $ as $$PageHeader, a as $$Base } from './_...slug_.astro.75b11a3a.mjs';
|
|
3
3
|
import api from '@cloudcommerce/api';
|
|
4
4
|
import { computed, useSSRContext, defineComponent, mergeProps, withCtx, createVNode, withDirectives, vShow, resolveDynamicComponent, createTextVNode, toDisplayString, openBlock, createBlock, Fragment, renderList, renderSlot, createCommentVNode, ref, shallowReactive, resolveComponent, withAsyncContext } from 'vue';
|
|
5
5
|
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrRenderClass, ssrRenderAttr, ssrRenderSlot, ssrRenderVNode, ssrInterpolate } from 'vue/server-renderer';
|
|
@@ -409,6 +409,20 @@ const useProductCard = (props) => {
|
|
|
409
409
|
...props.product,
|
|
410
410
|
price: price(props.product || {})
|
|
411
411
|
});
|
|
412
|
+
const { productId } = props;
|
|
413
|
+
if (!props.product && productId) {
|
|
414
|
+
isFetching.value = true;
|
|
415
|
+
fetching = (async () => {
|
|
416
|
+
try {
|
|
417
|
+
const { data } = await api.get(`products/${productId}`);
|
|
418
|
+
Object.assign(product, data);
|
|
419
|
+
} catch (err) {
|
|
420
|
+
console.error(err);
|
|
421
|
+
fetchError.value = err;
|
|
422
|
+
}
|
|
423
|
+
isFetching.value = false;
|
|
424
|
+
})();
|
|
425
|
+
}
|
|
412
426
|
const title = computed(() => {
|
|
413
427
|
return name(product);
|
|
414
428
|
});
|
|
@@ -451,20 +465,6 @@ const useProductCard = (props) => {
|
|
|
451
465
|
}
|
|
452
466
|
return 0;
|
|
453
467
|
});
|
|
454
|
-
const { productId } = props;
|
|
455
|
-
if (!props.product && productId) {
|
|
456
|
-
isFetching.value = true;
|
|
457
|
-
fetching = (async () => {
|
|
458
|
-
try {
|
|
459
|
-
const { data } = await api.get(`products/${productId}`);
|
|
460
|
-
Object.assign(product, data);
|
|
461
|
-
} catch (err) {
|
|
462
|
-
console.error(err);
|
|
463
|
-
fetchError.value = err;
|
|
464
|
-
}
|
|
465
|
-
isFetching.value = false;
|
|
466
|
-
})();
|
|
467
|
-
}
|
|
468
468
|
return {
|
|
469
469
|
isFetching,
|
|
470
470
|
fetching,
|
|
@@ -1135,7 +1135,8 @@ const $$Index$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
1135
1135
|
loadError = err;
|
|
1136
1136
|
}
|
|
1137
1137
|
return renderTemplate`<html${addAttribute(routeContext?.lang.replace("_", "-"), "lang")}>
|
|
1138
|
-
${routeContext && renderTemplate`${renderComponent($$result, "
|
|
1138
|
+
${routeContext && renderTemplate`${renderComponent($$result, "Base", $$Base, {}, { "default": ($$result2) => renderTemplate`
|
|
1139
|
+
${renderComponent($$result2, "PageHeader", $$PageHeader, {})}
|
|
1139
1140
|
${renderComponent($$result2, "HomeMain", $$Home, {})}
|
|
1140
1141
|
` })}`}
|
|
1141
1142
|
${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment$1, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(loadError.responseHTML)}` })}`}
|
|
@@ -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.75b11a3a.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.0_sharp@0.32.1/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_.45bc69ca.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_.45bc69ca.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_.45bc69ca.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.f630663e.mjs","/src/pages/fallback.astro":"chunks/pages/fallback.astro.
|
|
2827
|
+
const _page0 = () => import('./chunks/endpoint@_@js.98745cd2.mjs');
|
|
2828
|
+
const _page1 = () => import('./chunks/index@_@astro.8d90cfe1.mjs');
|
|
2829
|
+
const _page2 = () => import('./chunks/fallback@_@astro.08f4af85.mjs');
|
|
2830
|
+
const _page3 = () => import('./chunks/index@_@astro.0fdfcad0.mjs');
|
|
2831
|
+
const _page4 = () => import('./chunks/account@_@astro.d6c3fcbd.mjs');
|
|
2832
|
+
const _page5 = () => import('./chunks/_...ac19792e.mjs');const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.0_sharp@0.32.1/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.0_sharp@0.32.1/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_.45bc69ca.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_.45bc69ca.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_.45bc69ca.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.f630663e.mjs","/src/pages/fallback.astro":"chunks/pages/fallback.astro.dfe6d27b.mjs","\u0000@astro-page:../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.0_sharp@0.32.1/node_modules/@astrojs/image/dist/endpoint@_@js":"chunks/endpoint@_@js.98745cd2.mjs","\u0000@astro-page:src/pages/index@_@astro":"chunks/index@_@astro.8d90cfe1.mjs","\u0000@astro-page:src/pages/fallback@_@astro":"chunks/fallback@_@astro.08f4af85.mjs","\u0000@astro-page:src/pages/app/index@_@astro":"chunks/index@_@astro.0fdfcad0.mjs","\u0000@astro-page:src/pages/app/account@_@astro":"chunks/account@_@astro.d6c3fcbd.mjs","\u0000@astro-page:src/pages/[...slug]@_@astro":"chunks/_...ac19792e.mjs","/astro/hoisted.js?q=0":"_astro/hoisted.9d9d7ac4.js","~/components/PitchBar.vue":"_astro/PitchBar.c53e6d0b.js","~/components/ProductShelf.vue":"_astro/ProductShelf.c266a001.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.a7b12eab.js","@astrojs/vue/client.js":"_astro/client.2d950540.js","~/components/HeroSlider.vue":"_astro/HeroSlider.3d4a1d1c.js","~/components/Prices.vue":"_astro/Prices.de6df3cb.js","~/components/ShopHeader.vue":"_astro/ShopHeader.c0ba5061.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_.45bc69ca.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-5e0bf4e4.js","/_astro/Carousel.f39be3c0.js","/_astro/HeroSlider.3d4a1d1c.js","/_astro/PitchBar.c53e6d0b.js","/_astro/Prices.de6df3cb.js","/_astro/ProductShelf.c266a001.js","/_astro/ShopHeader.c0ba5061.js","/_astro/_plugin-vue_export-helper.d3aaeb0d.js","/_astro/api.7f62c1ff.js","/_astro/client.2d950540.js","/_astro/firebase-app.84207480.js","/_astro/format-money.3b884fcb.js","/_astro/hoisted.9d9d7ac4.js","/_astro/idle-callback.889bf0ea.js","/_astro/img.517fec8e.js","/_astro/index.33347cbd.js","/_astro/modules-info.ad27b027.js","/_astro/preload-helper.cf010ec4.js","/_astro/runtime-dom.esm-bundler.00b967e0.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/banner1.png","/img/uploads/banner2.png","/img/uploads/banner2.webp","/img/uploads/ecom-icon.png","/img/uploads/favicon.png","/img/uploads/headless.png","/img/uploads/headphone.png","/img/uploads/headphone.webp","/img/uploads/logo.png","/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"]}), {
|
|
2834
2834
|
pageMap,
|
|
2835
2835
|
renderers,
|
|
2836
2836
|
});
|
|
@@ -2,7 +2,7 @@ import { h as server_default } from './chunks/astro.2df8d1c5.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.75b11a3a.mjs';
|
|
6
6
|
import 'path-to-regexp';
|
|
7
7
|
import 'cookie';
|
|
8
8
|
import '@astrojs/internal-helpers/path';
|
|
@@ -28,6 +28,21 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
|
|
|
28
28
|
...(props.product as Exclude<T, undefined>),
|
|
29
29
|
price: getPrice(props.product || {}),
|
|
30
30
|
});
|
|
31
|
+
const { productId } = props;
|
|
32
|
+
if (!props.product && productId) {
|
|
33
|
+
isFetching.value = true;
|
|
34
|
+
fetching = (async () => {
|
|
35
|
+
try {
|
|
36
|
+
const { data } = await api.get(`products/${productId}`);
|
|
37
|
+
Object.assign(product, data);
|
|
38
|
+
} catch (err: any) {
|
|
39
|
+
console.error(err);
|
|
40
|
+
fetchError.value = err;
|
|
41
|
+
}
|
|
42
|
+
isFetching.value = false;
|
|
43
|
+
})();
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
const title = computed(() => {
|
|
32
47
|
return getName(product);
|
|
33
48
|
});
|
|
@@ -70,21 +85,6 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
|
|
|
70
85
|
return 0;
|
|
71
86
|
});
|
|
72
87
|
|
|
73
|
-
const { productId } = props;
|
|
74
|
-
if (!props.product && productId) {
|
|
75
|
-
isFetching.value = true;
|
|
76
|
-
fetching = (async () => {
|
|
77
|
-
try {
|
|
78
|
-
const { data } = await api.get(`products/${productId}`);
|
|
79
|
-
Object.assign(product, data);
|
|
80
|
-
} catch (err: any) {
|
|
81
|
-
console.error(err);
|
|
82
|
-
fetchError.value = err;
|
|
83
|
-
}
|
|
84
|
-
isFetching.value = false;
|
|
85
|
-
})();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
88
|
return {
|
|
89
89
|
isFetching,
|
|
90
90
|
fetching,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RouteContext } from '@@sf/ssr-context';
|
|
2
2
|
import type { LayoutContent } from '@@sf/content';
|
|
3
3
|
import type { Props as UseShopHeaderProps } from '@@sf/composables/use-shop-header';
|
|
4
|
+
import api from '@cloudcommerce/api';
|
|
4
5
|
import { parseLayoutContent } from '@@sf/composables/use-pitch-bar';
|
|
5
6
|
|
|
6
7
|
type ShopHeaderProps = Omit<UseShopHeaderProps, 'header'> & {
|
|
@@ -11,7 +12,7 @@ export interface Props {
|
|
|
11
12
|
routeContext: RouteContext;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
+
const usePageHeader = async ({ routeContext }: Props) => {
|
|
15
16
|
const { apiState, getContent } = routeContext;
|
|
16
17
|
const layoutContent = await getContent('layout');
|
|
17
18
|
const {
|
|
@@ -19,21 +20,40 @@ const usePageLayout = async ({ routeContext }: Props) => {
|
|
|
19
20
|
service_links: serviceLinks,
|
|
20
21
|
} = layoutContent;
|
|
21
22
|
const pitchBar = parseLayoutContent(layoutContent);
|
|
23
|
+
let { categories } = apiState;
|
|
24
|
+
if (!categories) {
|
|
25
|
+
try {
|
|
26
|
+
categories = (await api.get('categories')).data.result;
|
|
27
|
+
} catch (err) {
|
|
28
|
+
categories = [];
|
|
29
|
+
console.error(err);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
22
32
|
const shopHeader: ShopHeaderProps = {
|
|
23
|
-
categories
|
|
33
|
+
categories,
|
|
24
34
|
menuCategorySlugs: headerContent.inline_menu_categories?.featured,
|
|
25
35
|
menuRandomCategories: headerContent.inline_menu_categories?.random,
|
|
26
36
|
isAlphabeticalSortSubmenu: headerContent.alphabetical_sort_submenu,
|
|
27
37
|
serviceLinks,
|
|
28
38
|
};
|
|
39
|
+
/*
|
|
40
|
+
if (import.meta.env.DEV) {
|
|
41
|
+
await new Promise((resolve) => {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
console.log('> This log must come after sections');
|
|
44
|
+
resolve(true);
|
|
45
|
+
}, 2000);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
*/
|
|
29
49
|
return {
|
|
30
50
|
pitchBar,
|
|
31
51
|
shopHeader,
|
|
32
52
|
};
|
|
33
53
|
};
|
|
34
54
|
|
|
35
|
-
export default
|
|
55
|
+
export default usePageHeader;
|
|
36
56
|
|
|
37
|
-
export {
|
|
57
|
+
export { usePageHeader };
|
|
38
58
|
|
|
39
59
|
export type { ShopHeaderProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as z}from"./runtime-dom.esm-bundler.00b967e0.js";import{a as C}from"./api.7f62c1ff.js";import{T as F,N as g,a1 as E,r as v,_ as N,s as Q,a2 as B,x as i,u as h,E as x,w,z as b,F as P,v as k,J as H,G as A,C as T,H as I,I as S,y as V,A as D}from"./_plugin-vue_export-helper.d3aaeb0d.js";import{C as M,a as G}from"./Carousel.f39be3c0.js";import{a as J,w as R}from"./index.33347cbd.js";import{i as K,g as O}from"./img.517fec8e.js";import{g as j,c as U}from"./format-money.3b884fcb.js";import W from"./Prices.de6df3cb.js";import"./modules-info.ad27b027.js";import"./session-utm.744b0db3.js";import"./idle-callback.889bf0ea.js";const X=(t,n=F.get("lang"))=>n&&t.i18n&&t.i18n[n]?t.i18n[n]:t.name||t.title||K(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=g(t.title||""),a=g(t.titleLink||""),e=g(!1);let o=null;const u=g(null),l=E(t.products||[]);return t.products||(e.value=!0,o=(async()=>{let c=t.searchQuery||"",d;if(t.collectionId){try{const{data:s}=await C.get(`collections/${t.collectionId}`);d=s}catch(s){console.error(s),u.value=s}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 m=t.limit||24;let _=`offset=${t.page?(t.page-1)*m:0}&limit=${m}`;t.sort&&(_+=`&sort=${t.sort}`),_+=c;try{const{data:r}=await C.get(`search/v1?${_}`);if(t.isShuffle){let s=r.result.filter(L=>L.available&&q(L)).length,p,f;for(;s;)f=Math.floor(Math.random()*s--),p=r.result[s],r.result[s]=r.result[f],r.result[f]=p}r.result.forEach(s=>l.push(s))}catch(r){console.error(r),u.value=r}e.value=!1})()),{title:n,titleLink:a,isFetching:e,fetching:o,fetchError:u,products:l}},rt=t=>{const n=g(!1);let a=null;const e=g(null),o=E({...t.product,price:j(t.product||{})}),u=v(()=>Y(o)),l=v(()=>{const{slug:r}=o;return typeof r=="string"?`/${r}`:null}),c=v(()=>{const{pictures:r}=o,s=[];if(r)r.forEach(p=>{const f=O(p);f&&s.push(f)});else{const{picture:p}=o;if(p){const f=O(p);f&&s.push(f)}}return s}),d=v(()=>q(o)),m=v(()=>d.value&&o.available&&o.visible),y=v(()=>{if(U(o)){const r=o.base_price;return Math.round((r-j(o))*100/r)}return 0}),{productId:_}=t;return!t.product&&_&&(n.value=!0,a=(async()=>{try{const{data:r}=await C.get(`products/${_}`);Object.assign(o,r)}catch(r){console.error(r),e.value=r}n.value=!1})()),{isFetching:n,fetching:a,fetchError:e,product:o,title:u,link:l,images:c,isInStock:d,isActive:m,discountPercentage:y}},ot=Q({__name:"ProductCard",props:{product:{},productId:{},headingTag:{default:"h3"}},setup(t,{expose:n}){n();const a=t,{product:e,title:o,link:u,images:l}=rt({product:a.product,productId:a.productId}),c=g(null),d=J(c),m=g(!1);R(d,()=>{m.value=!0});const y={props:a,product:e,title:o,link:u,images:l,card:c,isHovered:d,wasHoveredOnce:m,Prices:W};return Object.defineProperty(y,"__isScriptSetup",{enumerable:!1,value:!0}),y}}),nt=["data-sku"],st={class:"aspect-square p-2 motion-safe:group-hover:scale-110 transition-transform"},at={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,a,e,o,u){const l=B("AImg");return i(),h("article",{ref:"card","data-sku":e.product.sku,class:"relative h-full max-w-[350px] mx-auto py-3 group"},[(i(),x(A(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",st,[b("div",at,[e.images?.length?(i(),h(P,{key:0},[k(l,{picture:e.images[0],class:"absolute top-0 left-0 block w-full h-full object-cover"},null,8,["picture"]),e.images[1]&&e.wasHoveredOnce?(i(),x(l,{key:0,picture:e.images[1],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"])):H("",!0)],64)):(i(),h("div",lt))])]),b("div",ct,[(i(),x(A(a.headingTag),{class:T(["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,[k(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 a=t,{title:e,titleLink:o,fetching:u,products:l}=et(a),c={props:a,title:e,titleLink:o,fetching:u,products:l,Carousel:M,CarouselControl:G,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,a,e,o,u){const l=B("ALink");return i(),h("section",ht,[e.title?(i(),h("h2",gt,[e.titleLink?(i(),x(l,{key:0,href:e.titleLink},{default:w(()=>[I(S(e.title),1)]),_:1},8,["href"])):(i(),h(P,{key:1},[I(S(e.title),1)],64))])):H("",!0),k(e.Carousel,{class:"group/shelf"},{controls:w(()=>[V(b("div",mt,[k(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":""}),k(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(()=>[(i(!0),h(P,null,D(e.products,c=>(i(),h("li",{key:c._id,class:"basis-1/2 md:basis-1/3 lg:basis-1/4 shrink-0"},[k(e.ProductCard,{product:c},null,8,["product"])]))),128))]),_:1})])}const Lt=N(ft,[["render",pt]]);export{Lt as default};
|