cloudcommerce 2.13.1 → 2.14.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 +20 -0
- package/ecomplus-stores/barradoce/conf/firebase.json +1 -0
- package/ecomplus-stores/barradoce/functions/many/package.json +3 -3
- package/ecomplus-stores/barradoce/functions/ssr/content/extra-pages/promocoes.md +1 -1
- package/ecomplus-stores/barradoce/functions/ssr/package.json +6 -6
- package/ecomplus-stores/barradoce/functions/ssr/src/components/AccountMenu.vue +18 -15
- package/ecomplus-stores/barradoce/functions/ssr/src/components/AccountPage.vue +5 -5
- package/ecomplus-stores/barradoce/functions/ssr/src/components/LoginForm.vue +16 -10
- package/ecomplus-stores/barradoce/functions/ssr/src/components/ShopFooter.vue +1 -1
- package/ecomplus-stores/barradoce/functions/ssr/src/pages/sitemap-[index].xml.astro +75 -0
- package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barradoce/package.json +2 -2
- package/package.json +2 -2
- package/packages/api/package.json +1 -1
- package/packages/apps/affiliate-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/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/mandae/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagaleve/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/pagarme-v5/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/ci/bunny-config-base.sh +4 -6
- package/packages/cli/config/firebase.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/eslint/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/feeds/lib/firebase/render-catalog.js +272 -0
- package/packages/feeds/lib/firebase/render-catalog.js.map +1 -0
- package/packages/feeds/lib/firebase/render-sitemap.js +42 -0
- package/packages/feeds/lib/firebase/render-sitemap.js.map +1 -0
- package/packages/feeds/lib/firebase/serve-feeds.js +22 -270
- package/packages/feeds/lib/firebase/serve-feeds.js.map +1 -1
- package/packages/feeds/package.json +1 -1
- package/packages/feeds/src/firebase/render-catalog.ts +286 -0
- package/packages/feeds/src/firebase/render-sitemap.ts +46 -0
- package/packages/feeds/src/firebase/serve-feeds.ts +22 -283
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/storefront/dist/client/_astro/{AccountPage.Cf0WE6GF.js → AccountPage.CKu0oakN.js} +1 -1
- package/packages/storefront/dist/client/_astro/{CartSidebar.DAvJKL2c.js → CartSidebar.Bxz7ZD9N.js} +1 -1
- package/packages/storefront/dist/client/_astro/{ProductDetails.BpZtnS8j.js → ProductDetails.PkZr50hA.js} +1 -1
- package/packages/storefront/dist/client/_astro/{ProductShelf.C0TU_sRb.js → ProductShelf.BKz6WXbp.js} +1 -1
- package/packages/storefront/dist/client/_astro/{SearchModal.DWNSfxML.js → SearchModal.BIrixnFb.js} +1 -1
- package/packages/storefront/dist/client/_astro/SearchShowcase.YMZqG8rj.js +1 -0
- package/packages/storefront/dist/client/_astro/ShopHeader.BOLegIRO.js +7 -0
- package/packages/storefront/dist/client/_astro/{_slug_.HhgCFKHv.css → _slug_.oAbCb631.css} +1 -1
- package/packages/storefront/dist/client/_astro/customer-session.B9MvrBAQ.js +7 -0
- package/packages/storefront/dist/client/_astro/ecom-icon.png +0 -0
- package/packages/storefront/dist/client/_astro/ecom-icon_12falx.png +0 -0
- package/packages/storefront/dist/client/_astro/ecom-icon_15pqnO.png +0 -0
- package/packages/storefront/dist/client/_astro/ecom-icon_t3guw.png +0 -0
- package/packages/storefront/dist/client/_astro/{firebase-app.CmI1zl7o.js → firebase-app.DPioxxma.js} +1 -1
- package/packages/storefront/dist/client/_astro/headphone.webp +0 -0
- package/packages/storefront/dist/client/_astro/headphone_T2Jjc.avif +0 -0
- package/packages/storefront/dist/client/_astro/headphone_Z1CG18r.webp +0 -0
- package/packages/storefront/dist/client/_astro/{hoisted.BeKMioW4.js → hoisted.8Sq2YuJM.js} +1 -1
- package/packages/storefront/dist/client/_astro/{hoisted.Bf1gCkSN.js → hoisted.BzVcl7We.js} +1 -1
- package/packages/storefront/dist/client/_astro/{hoisted.-C0vLMXT.js → hoisted.CPcG9RpX.js} +1 -1
- package/packages/storefront/dist/client/_astro/{index-a8cf6c8f.k99a-gIB.js → index-219c3cac.78peI8kt.js} +3 -3
- package/packages/storefront/dist/client/_astro/logo.png +0 -0
- package/packages/storefront/dist/client/_astro/logo_1UBsBq.webp +0 -0
- package/packages/storefront/dist/client/_astro/logo_Z1K5PE9.png +0 -0
- package/packages/storefront/dist/client/_astro/logo_Z1KIIl1.avif +0 -0
- package/packages/storefront/dist/client/_astro/passion.webp +0 -0
- package/packages/storefront/dist/client/_astro/passion_LHbe9.webp +0 -0
- package/packages/storefront/dist/client/_astro/passion_Z23MeUb.avif +0 -0
- package/packages/storefront/dist/client/_astro/rect8589.png +0 -0
- package/packages/storefront/dist/client/_astro/rect8589_1TtOHY.png +0 -0
- package/packages/storefront/dist/client/_astro/rect8589_1f5opX.webp +0 -0
- package/packages/storefront/dist/client/_astro/rect8589_IUskt.webp +0 -0
- package/packages/storefront/dist/client/_astro/rect8589_Uxfdf.png +0 -0
- package/packages/storefront/dist/client/_astro/rect8589_Z15uApA.png +0 -0
- package/packages/storefront/dist/client/_astro/rect8589_Z1Ap1Im.avif +0 -0
- package/packages/storefront/dist/client/_astro/rect8589_Z1JT1HB.webp +0 -0
- package/packages/storefront/dist/client/_astro/rect8589_ZY9mtN.avif +0 -0
- package/packages/storefront/dist/client/_astro/rect8589_tMFW0.avif +0 -0
- package/packages/storefront/dist/client/_astro/rect859.png +0 -0
- package/packages/storefront/dist/client/_astro/rect859_1TgQXS.avif +0 -0
- package/packages/storefront/dist/client/_astro/rect859_2Nm1z.avif +0 -0
- package/packages/storefront/dist/client/_astro/rect859_DIqwR.png +0 -0
- package/packages/storefront/dist/client/_astro/rect859_Z1IKDb2.png +0 -0
- package/packages/storefront/dist/client/_astro/rect859_Z29FI4V.webp +0 -0
- package/packages/storefront/dist/client/_astro/rect859_Z2kFHGk.avif +0 -0
- package/packages/storefront/dist/client/_astro/rect859_ZkpPFI.webp +0 -0
- package/packages/storefront/dist/client/_astro/rect859_jXzBi.png +0 -0
- package/packages/storefront/dist/client/_astro/rect859_x1l16.webp +0 -0
- package/packages/storefront/dist/client/_astro/rect89.webp +0 -0
- package/packages/storefront/dist/client/_astro/rect89_1TSfW7.avif +0 -0
- package/packages/storefront/dist/client/_astro/rect89_Z1re32x.webp +0 -0
- package/packages/storefront/dist/client/_astro/{shopping-cart.Cqc6p5UR.js → shopping-cart.D8fbm2Dv.js} +1 -1
- package/packages/storefront/dist/client/_astro/{use-analytics.bP3a5cR0.js → use-analytics.D_peWG3X.js} +1 -1
- package/packages/storefront/dist/client/_astro/{use-product-card.Cj9Q-Y1A.js → use-product-card.BCGHZKB5.js} +1 -1
- package/packages/storefront/dist/client/_astro/{use-text-value.DT0v9Yj_.js → use-text-value.BFLvKnYE.js} +1 -1
- package/packages/storefront/dist/client/assets/cvv.png +0 -0
- package/packages/storefront/dist/client/assets/payments.png +0 -0
- package/packages/storefront/dist/client/robots.txt +2 -0
- package/packages/storefront/dist/client/~fallback.html +112 -0
- package/packages/storefront/dist/client/~index.html +137 -0
- package/packages/storefront/dist/server/_astro-internal_middleware.mjs +2 -2
- package/packages/storefront/dist/server/chunks/404_BUZm2bP1.mjs +5 -0
- package/packages/storefront/dist/server/chunks/{CartSidebar_tmly-0ip.mjs → CartSidebar_kQSDOTj2.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{SearchModal_CGNQss2j.mjs → SearchModal_O1xTrm-9.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{_.._Bt6Uzpk2.mjs → _.._6Bd7O3FD.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{_astro-internal_middleware_CqUpziyW.mjs → _astro-internal_middleware_BnKXd-Ev.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{_page__Dz-iZHMh.mjs → _page__CXnal5Rn.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{account_tfs9KFTy.mjs → account_C6XTKIP9.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/astro/{assets-service_DSoC_W52.mjs → assets-service_146xb0vN.mjs} +11 -67
- package/packages/storefront/dist/server/chunks/{astro_Cu3MZ9xv.mjs → astro_DIU6qHCh.mjs} +34 -79
- package/packages/storefront/dist/server/chunks/{index_CGzMgZTN.mjs → index_EbDDnIXs.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{index_BKS_40rA.mjs → index_STpvD2cy.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{node_lZaNT3E1.mjs → node_DHQVZgH_.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{404_CMwuVMu1.mjs → 404_n3mvoSWv.mjs} +94 -1140
- package/packages/storefront/dist/server/chunks/pages/{__Dz53F-0T.mjs → __C9Nd4c7_.mjs} +11 -42
- package/packages/storefront/dist/server/chunks/pages/{_page__C1x19nYF.mjs → _page__BnXBvVvn.mjs} +4 -20
- package/packages/storefront/dist/server/chunks/pages/account_Dk-8R3rY.mjs +22 -0
- package/packages/storefront/dist/server/chunks/pages/{index_CqvjdvSg.mjs → index_us3QX6kE.mjs} +5 -22
- package/packages/storefront/dist/server/chunks/pages/node_BGdGQ52C.mjs +1864 -0
- package/packages/storefront/dist/server/chunks/pages/sitemap-_index__rcX10oKd.mjs +32 -0
- package/packages/storefront/dist/server/chunks/pages/~fallback_BNfV6ECv.mjs +22 -0
- package/packages/storefront/dist/server/chunks/sitemap-_index__e6mToVZH.mjs +5 -0
- package/packages/storefront/dist/server/chunks/{~fallback_CrFe__-f.mjs → ~fallback_Cg1Pbe1d.mjs} +1 -1
- package/packages/storefront/dist/server/entry.mjs +18 -17
- package/packages/storefront/dist/server/images.dist.csv +37 -0
- package/packages/storefront/dist/server/images.src.csv +13 -0
- package/packages/storefront/dist/server/manifest_xBcEm6Np.mjs +206 -0
- package/packages/storefront/dist/server/middleware.mjs +2 -2
- package/packages/storefront/dist/server/renderers.mjs +1 -1
- package/packages/storefront/dist/server/static-builds.csv +80 -0
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/scripts/build-prod.sh +17 -0
- package/packages/storefront/src/lib/components/AccountLink.vue +16 -11
- package/packages/storefront/src/lib/components/globals/Skeleton.vue +6 -4
- package/packages/storefront/src/lib/composables/use-login-form.ts +6 -1
- package/packages/storefront/src/lib/scripts/vbeta-app.ts +11 -2
- package/packages/storefront/src/lib/state/customer-session.ts +8 -1
- package/packages/test-base/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/SearchShowcase.CUkbXIRk.js +0 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.D7qqQxFD.js +0 -7
- package/packages/storefront/dist/client/_astro/customer-session.Cctko5_9.js +0 -7
- package/packages/storefront/dist/client/assets/.gitkeep +0 -2
- package/packages/storefront/dist/server/chunks/404_BcY_5eJJ.mjs +0 -5
- package/packages/storefront/dist/server/chunks/pages/account_B5Z6wDBy.mjs +0 -32
- package/packages/storefront/dist/server/chunks/pages/node_mvX6Tssv.mjs +0 -879
- package/packages/storefront/dist/server/chunks/pages/~fallback_D2ugBVgc.mjs +0 -32
- package/packages/storefront/dist/server/manifest_D4v8KX-D.mjs +0 -206
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Request, Response } from 'firebase-functions';
|
|
2
2
|
import { error } from 'firebase-functions/logger';
|
|
3
3
|
import api from '@cloudcommerce/api';
|
|
4
|
-
import
|
|
4
|
+
import renderCatalog from './render-catalog';
|
|
5
|
+
import renderSitemap from './render-sitemap';
|
|
5
6
|
|
|
6
7
|
const fetchProducts = async (page = 1) => {
|
|
7
8
|
const limit = 300;
|
|
@@ -79,10 +80,6 @@ const serveFeeds = async (req: Request, res: Response) => {
|
|
|
79
80
|
res.sendStatus(405);
|
|
80
81
|
return;
|
|
81
82
|
}
|
|
82
|
-
if (url !== '/_feeds/catalog' && url !== '/catalog') {
|
|
83
|
-
res.sendStatus(404);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
83
|
try {
|
|
87
84
|
await fetching;
|
|
88
85
|
} catch (err) {
|
|
@@ -90,285 +87,27 @@ const serveFeeds = async (req: Request, res: Response) => {
|
|
|
90
87
|
res.sendStatus(500);
|
|
91
88
|
return;
|
|
92
89
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
90
|
+
res.set('Content-Type', 'application/xml; charset=UTF-8');
|
|
91
|
+
res.set('Cache-Control', 'public, max-age=600, s-maxage=120');
|
|
92
|
+
res.set('Content-Security-Policy', "default-src 'self'");
|
|
93
|
+
res.set('X-Content-Type-Options', 'nosniff');
|
|
94
|
+
res.set('X-XSS-Protection', '1; mode=block');
|
|
95
|
+
res.set('X-Frame-Options', 'DENY');
|
|
96
|
+
switch (url) {
|
|
97
|
+
case '/_feeds/catalog.xml':
|
|
98
|
+
case '/catalog.xml':
|
|
99
|
+
await renderCatalog(req, res, products);
|
|
100
|
+
break;
|
|
101
|
+
case '/sitemap-catalog.xml':
|
|
102
|
+
await renderSitemap(req, res, products);
|
|
103
|
+
break;
|
|
104
|
+
case '/sitemap':
|
|
105
|
+
case '/sitemap.xml':
|
|
106
|
+
res.redirect(302, '/sitemap-catalog.xml');
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
res.sendStatus(404);
|
|
103
110
|
}
|
|
104
|
-
let propsSet: Record<string, any> = {};
|
|
105
|
-
if (typeof req.query.set_properties === 'string') {
|
|
106
|
-
try {
|
|
107
|
-
propsSet = JSON.parse(req.query.set_properties);
|
|
108
|
-
if (typeof propsSet !== 'object' || !propsSet) {
|
|
109
|
-
throw new Error('Invalid');
|
|
110
|
-
}
|
|
111
|
-
} catch {
|
|
112
|
-
res.sendStatus(400);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const isFacebook = (req.get('User-Agent') || '').includes('facebook');
|
|
117
|
-
|
|
118
|
-
let xml = `
|
|
119
|
-
<?xml version="1.0"?>
|
|
120
|
-
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
|
|
121
|
-
<title><![CDATA[${title}]]></title>
|
|
122
|
-
<link href="https://${domain}/" rel="alternate" type="text/html"/>
|
|
123
|
-
<updated>${new Date().toISOString()}</updated>
|
|
124
|
-
<id><![CDATA[#${storeId},${Math.random()}]]></id>
|
|
125
|
-
<author>
|
|
126
|
-
<name>e-com.plus Cloud Commerce</name>
|
|
127
|
-
</author>`;
|
|
128
|
-
|
|
129
|
-
const convertProduct = (p: (typeof products)[0], groupId?: string) => {
|
|
130
|
-
if (p.name) {
|
|
131
|
-
const entry: Record<string, any> = {
|
|
132
|
-
id: p.sku || p._id,
|
|
133
|
-
title: p.name,
|
|
134
|
-
item_group_id: groupId,
|
|
135
|
-
google_product_category: p.google_product_category_id,
|
|
136
|
-
};
|
|
137
|
-
if (p.short_description) {
|
|
138
|
-
entry.description = p.short_description;
|
|
139
|
-
} else if (p.body_html) {
|
|
140
|
-
entry.description = p.body_html
|
|
141
|
-
.replace(/<style\b[^>]*>.*?<\/style>/isg, '')
|
|
142
|
-
.replace(/<[^>]+>/g, '')
|
|
143
|
-
.replace(/ /g, '');
|
|
144
|
-
} else {
|
|
145
|
-
entry.description = p.name;
|
|
146
|
-
}
|
|
147
|
-
if (p.slug) {
|
|
148
|
-
entry.link = `https://${domain}/${p.slug}${querystring}`;
|
|
149
|
-
if (groupId) entry.link += `&var=${p._id}`;
|
|
150
|
-
if (discount > 0) entry.link += `&discount=${discount}`;
|
|
151
|
-
}
|
|
152
|
-
if (
|
|
153
|
-
(p.quantity === undefined || p.quantity)
|
|
154
|
-
&& (!p.min_quantity || p.quantity! >= p.min_quantity)
|
|
155
|
-
) {
|
|
156
|
-
entry.availability = 'in stock';
|
|
157
|
-
} else {
|
|
158
|
-
entry.availability = 'out of stock';
|
|
159
|
-
}
|
|
160
|
-
if (p.production_time?.days) {
|
|
161
|
-
entry.min_handling_time = p.production_time.days;
|
|
162
|
-
if (p.production_time.max_time) {
|
|
163
|
-
entry.max_handling_time = p.production_time.max_time;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (p.pictures?.length) {
|
|
167
|
-
const additionalImages: string[] = [];
|
|
168
|
-
for (let i = 0; i < p.pictures.length && i < 10; i++) {
|
|
169
|
-
const picture = p.pictures[i];
|
|
170
|
-
let img = picture.zoom?.url || picture.big?.url || picture.normal?.url;
|
|
171
|
-
if (img) {
|
|
172
|
-
img = img.replace(
|
|
173
|
-
/(\w+\.)?(ecoms\d)\.com/i,
|
|
174
|
-
'$2-nyc3.nyc3.cdn.digitaloceanspaces.com',
|
|
175
|
-
);
|
|
176
|
-
if (!entry.image_link) {
|
|
177
|
-
entry.image_link = img;
|
|
178
|
-
} else {
|
|
179
|
-
additionalImages.push(img);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (additionalImages.length) {
|
|
184
|
-
entry.additional_image_link = additionalImages;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (p.price) {
|
|
188
|
-
if (p.base_price && p.base_price > p.price) {
|
|
189
|
-
entry.price = `${p.base_price} ${p.currency_id}`;
|
|
190
|
-
entry.sale_price = (p.price * (1 - discount)).toFixed(2) + ` ${p.currency_id}`;
|
|
191
|
-
} else {
|
|
192
|
-
entry.price = (p.price * (1 - discount)).toFixed(2) + ` ${p.currency_id}`;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (p.category_tree) {
|
|
196
|
-
entry.product_type = p.category_tree;
|
|
197
|
-
} else if (p.categories?.length) {
|
|
198
|
-
entry.product_type = p.categories[0].name;
|
|
199
|
-
}
|
|
200
|
-
let isIdentifierExists = false;
|
|
201
|
-
if (p.brands?.length) {
|
|
202
|
-
isIdentifierExists = true;
|
|
203
|
-
entry.brand = p.brands[0].name;
|
|
204
|
-
}
|
|
205
|
-
(['gtin', 'mpn'] as const).forEach((field) => {
|
|
206
|
-
const codes = p[field];
|
|
207
|
-
if (Array.isArray(codes) && codes.length) {
|
|
208
|
-
entry[field] = codes[0];
|
|
209
|
-
isIdentifierExists = true;
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
entry.identifier_exists = isIdentifierExists ? 'yes' : 'no';
|
|
213
|
-
if (p.adult) {
|
|
214
|
-
entry.adult = 'yes';
|
|
215
|
-
}
|
|
216
|
-
if (p.condition) {
|
|
217
|
-
entry.condition = p.condition !== 'not_specified' ? p.condition : 'new';
|
|
218
|
-
}
|
|
219
|
-
if (p.weight) {
|
|
220
|
-
entry.shipping_weight = `${p.weight.value} ${p.weight.unit || ''}`;
|
|
221
|
-
}
|
|
222
|
-
if (p.dimensions && !isFacebook) {
|
|
223
|
-
(['length', 'width', 'height'] as const).forEach((side) => {
|
|
224
|
-
const dimension = p.dimensions![side];
|
|
225
|
-
if (dimension) {
|
|
226
|
-
entry[`shipping_${side}`] = `${dimension.value} ${dimension.unit || ''}`;
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
if (p.specifications) {
|
|
231
|
-
let customLabel = 0;
|
|
232
|
-
Object.keys(p.specifications).forEach((spec) => {
|
|
233
|
-
const values = p.specifications![spec];
|
|
234
|
-
if (!values.length) return;
|
|
235
|
-
const [val] = values;
|
|
236
|
-
/* eslint-disable no-case-declarations */
|
|
237
|
-
switch (spec) {
|
|
238
|
-
case 'energy_efficiency_class':
|
|
239
|
-
case 'age_group':
|
|
240
|
-
case 'gender':
|
|
241
|
-
case 'size_type':
|
|
242
|
-
case 'size_system':
|
|
243
|
-
entry[spec] = val.value || val.text;
|
|
244
|
-
break;
|
|
245
|
-
case 'size':
|
|
246
|
-
case 'pattern':
|
|
247
|
-
case 'material':
|
|
248
|
-
entry[spec] = val.text;
|
|
249
|
-
break;
|
|
250
|
-
case 'colors':
|
|
251
|
-
case 'color':
|
|
252
|
-
case 'cor':
|
|
253
|
-
case 'cores':
|
|
254
|
-
let colors = val.text.replace(/[/]/g, ' ');
|
|
255
|
-
for (let i = 1; i < values.length; i++) {
|
|
256
|
-
colors += `/${values[i].text.replace(/[/]/g, ' ')}`;
|
|
257
|
-
}
|
|
258
|
-
entry.color = colors;
|
|
259
|
-
break;
|
|
260
|
-
default:
|
|
261
|
-
let commonSpec: string | null = null;
|
|
262
|
-
let fixedText = val.value || val.text;
|
|
263
|
-
switch (fixedText.toLowerCase()) {
|
|
264
|
-
case 'm':
|
|
265
|
-
case 'l':
|
|
266
|
-
case 'g':
|
|
267
|
-
case 's':
|
|
268
|
-
case 'p':
|
|
269
|
-
case 'xs':
|
|
270
|
-
case 'pp':
|
|
271
|
-
case 'xl':
|
|
272
|
-
case 'gg':
|
|
273
|
-
case 'xxl':
|
|
274
|
-
case 'xg':
|
|
275
|
-
case 'u':
|
|
276
|
-
case 'Único':
|
|
277
|
-
case 'unico':
|
|
278
|
-
commonSpec = 'size';
|
|
279
|
-
break;
|
|
280
|
-
case 'adult':
|
|
281
|
-
case 'adulto':
|
|
282
|
-
case 'kids':
|
|
283
|
-
case 'criança':
|
|
284
|
-
case 'infant':
|
|
285
|
-
case 'infantil':
|
|
286
|
-
case 'newborn':
|
|
287
|
-
case 'recém-nascido':
|
|
288
|
-
case 'toddler':
|
|
289
|
-
commonSpec = 'age_group';
|
|
290
|
-
break;
|
|
291
|
-
case 'male':
|
|
292
|
-
case 'masculino':
|
|
293
|
-
case 'female':
|
|
294
|
-
case 'feminino':
|
|
295
|
-
case 'unisex':
|
|
296
|
-
commonSpec = 'gender';
|
|
297
|
-
break;
|
|
298
|
-
case 'homem':
|
|
299
|
-
commonSpec = 'gender';
|
|
300
|
-
fixedText = 'male';
|
|
301
|
-
break;
|
|
302
|
-
case 'mulher':
|
|
303
|
-
commonSpec = 'gender';
|
|
304
|
-
fixedText = 'female';
|
|
305
|
-
break;
|
|
306
|
-
default:
|
|
307
|
-
if (customLabel < 5) {
|
|
308
|
-
entry[`custom_label_${customLabel}`] = val.text;
|
|
309
|
-
customLabel += 1;
|
|
310
|
-
}
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
if (commonSpec !== null && !entry[commonSpec]) {
|
|
314
|
-
entry[commonSpec] = fixedText;
|
|
315
|
-
}
|
|
316
|
-
break;
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
Object.keys(propsSet).forEach((key) => {
|
|
321
|
-
entry[key] = propsSet[key];
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
xml += `
|
|
325
|
-
<entry>`;
|
|
326
|
-
Object.keys(entry).forEach((key) => {
|
|
327
|
-
const val = entry[key];
|
|
328
|
-
if (val === undefined || val === null) return;
|
|
329
|
-
if (typeof val === 'object' && val) {
|
|
330
|
-
Object.keys(entry).forEach((nKey) => {
|
|
331
|
-
const nested = val[nKey];
|
|
332
|
-
xml += `<g:${key}><![CDATA[${nested}]]></g:${key}>`;
|
|
333
|
-
});
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
if (key === 'link') {
|
|
337
|
-
xml += `<g:${key}><!--${p._id}-->${val}</g:${key}>`;
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
xml += `<g:${key}><![CDATA[${val}]]></g:${key}>`;
|
|
341
|
-
});
|
|
342
|
-
xml += `
|
|
343
|
-
</entry>`;
|
|
344
|
-
|
|
345
|
-
if (p.variations && !isSkipVariations) {
|
|
346
|
-
p.variations.forEach((variation) => {
|
|
347
|
-
const mergedItem = { ...p, ...variation };
|
|
348
|
-
if (p.specifications) {
|
|
349
|
-
mergedItem.specifications = {
|
|
350
|
-
...p.specifications,
|
|
351
|
-
...variation.specifications,
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
if (!variation.sku && p.sku) {
|
|
355
|
-
mergedItem.sku = `${p.sku}-${Math.ceil(Math.random() * 1000)}`;
|
|
356
|
-
}
|
|
357
|
-
if (variation.picture_id && p.pictures) {
|
|
358
|
-
const picture = p.pictures.find(({ _id }) => _id === variation.picture_id);
|
|
359
|
-
if (picture) mergedItem.pictures = [picture];
|
|
360
|
-
}
|
|
361
|
-
delete mergedItem.variations;
|
|
362
|
-
convertProduct(mergedItem as any, entry.id);
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
products.forEach((p) => convertProduct(p));
|
|
369
|
-
xml += `
|
|
370
|
-
</feed>`;
|
|
371
|
-
res.send(xml);
|
|
372
111
|
};
|
|
373
112
|
|
|
374
113
|
export default serveFeeds;
|
package/packages/storefront/dist/client/_astro/{AccountPage.Cf0WE6GF.js → AccountPage.CKu0oakN.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f,w as h,d as P,c as M,j as C,k as l,e as c,Z as F,f as i,a0 as b,a1 as r,p as S,l as k,n as A,h as L,i as U,a4 as T,a5 as V,F as j,m as B}from"./sf-utils.C9ygvYIB.js";import{_ as N,a as I,v as R,w as x}from"./_plugin-vue_export-helper.6K9uDcVo.js";import{e as q,f as _,E as D,a as O,d as E}from"./customer-session.
|
|
1
|
+
import{a as f,w as h,d as P,c as M,j as C,k as l,e as c,Z as F,f as i,a0 as b,a1 as r,p as S,l as k,n as A,h as L,i as U,a4 as T,a5 as V,F as j,m as B}from"./sf-utils.C9ygvYIB.js";import{_ as N,a as I,v as R,w as x}from"./_plugin-vue_export-helper.6K9uDcVo.js";import{e as q,f as _,E as D,a as O,d as E}from"./customer-session.B9MvrBAQ.js";import{u as z}from"./index.BgtOIB20.js";import{g as G,b as K,c as W}from"./index-219c3cac.78peI8kt.js";import{u as Y}from"./index.BCNoXz_Z.js";const Z=m=>{q();const s=m?.canUseUrlParams!==!1?z("history"):{},e=s.sign_up!==void 0&&s.sign_up!=="0",a=s.password!==void 0&&s.password!=="0",u=f(e),n=f(!e&&!a);h(u,p=>{p?(n.value=!0,s.sign_up="1"):s.sign_up="0"}),h(n,p=>{s.password=p?"0":"1"});const o=f(""),d=f(!1),g=Y(async p=>{d.value=!0;const v=Date.now(),y=G();if(_.value){window.localStorage.setItem(D,_.value);try{if(n.value){const w=new URL(p||window.location.toString());w.searchParams.append("email",_.value),await K(y,_.value,{url:w.toString(),handleCodeInApp:!0})}else await W(y,_.value,o.value)}catch(w){console.warn(w.code),console.error(w)}setTimeout(()=>{d.value=!1},Math.min(2e3-(Date.now()-v),1))}},2e3);return{isLinkSignIn:n,isSignUp:u,email:_,password:o,isSubmitting:d,submitLogin:g}},$=P({__name:"LoginForm",props:{loginLinkActionUrl:{}},setup(m,{expose:t}){t();const{isLinkSignIn:s,isSignUp:e,email:a,password:u,isSubmitting:n,submitLogin:o}=Z(),d=f(!1),g=f(0),p=M(()=>g.value>9);h(n,()=>{!n.value&&s.value&&(d.value=!0,g.value+=1)}),h([a,e],()=>{d.value=!1}),h(p,()=>{s.value=!1});const v={isLinkSignIn:s,isSignUp:e,email:a,password:u,isSubmitting:n,submitLogin:o,isEmailSentMsg:d,countEmailsSent:g,isLinkSignInBlocked:p,get customerName(){return O}};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),H={class:"text-base-600 mb-4 text-2xl font-light"},J={key:0},Q={key:1,class:"lowercase"},X={key:0,for:"login-form-email"},ee={class:"relative"},se=["disabled"],te={key:0,class:"text-success-800 absolute left-0 top-0 mt-4 font-medium"},ne=i("i",{class:"i-check mr-1"},null,-1);function ie(m,t,s,e,a,u){const n=C("Fade");return l(),c("form",{class:"text-base-800 w-full max-w-sm bg-white p-6 text-base md:p-8",onSubmit:t[4]||(t[4]=x(()=>e.submitLogin(s.loginLinkActionUrl),["prevent"]))},[F(m.$slots,"head"),i("p",H,[b(r("Olá")+" "),e.customerName?(l(),c("span",J,r(e.customerName),1)):(l(),c("span",Q,r("Visitante")))]),e.isLinkSignIn?(l(),c("label",X,r("Enviar link de acesso por e-mail"))):S("",!0),k(i("input",{id:"login-form-email",type:"email",placeholder:"email@mail.com","onUpdate:modelValue":t[0]||(t[0]=o=>e.email=o),class:"mb-0.5 mt-2 w-full",required:""},null,512),[[I,e.email]]),e.isLinkSignIn?S("",!0):k((l(),c("input",{key:1,type:"password",placeholder:"Senha","onUpdate:modelValue":t[1]||(t[1]=o=>e.password=o),class:"mb-0.5 mt-2 w-full lowercase",required:""},null,512)),[[I,e.password]]),i("div",ee,[i("div",{class:A(["transition-opacity",e.isEmailSentMsg&&"opacity-0 invisible"])},[k(i("a",{href:"?password",class:"text-base-500 ui-link text-right text-sm lowercase",onClick:t[2]||(t[2]=x(o=>e.isLinkSignIn=!e.isLinkSignIn,["prevent"]))},r(e.isLinkSignIn?"Entrar com senha":"Esqueci minha senha"),513),[[R,!e.isSignUp&&!e.isLinkSignInBlocked]]),i("button",{type:"submit",disabled:e.isSubmitting,class:A(["ui-btn-lg ui-btn-primary mb-2 mt-5 w-full",e.isSubmitting&&"opacity-50"])},r(e.isSignUp?"Cadastrar":"Acessar minha conta"),11,se)],2),L(n,{speed:"slow"},{default:U(()=>[e.isEmailSentMsg?(l(),c("p",te,[ne,b(" "+r("Te enviamos o e-mail, verifique sua caixa de entrada e spam se necessário."),1)])):S("",!0)]),_:1}),i("a",{href:"?sign_up",class:"ui-btn-lg ui-btn-contrast block w-full text-center",onClick:t[3]||(t[3]=x(o=>e.isSignUp=!e.isSignUp,["prevent"]))},r(e.isSignUp?"Acessar minha conta":"Criar uma conta"),1)])],32)}const ae=N($,[["render",ie]]),oe=P({__name:"AccountPage",setup(m,{expose:t}){t();let s=null;{const{location:a}=window,u=new URLSearchParams(a.search).get("return_url");if(!u){const n=new URL(a.toString());n.pathname="/app/",n.hash=a.hash||`#${a.pathname.replace("/app/","/")}`,s=n.toString()}h(E,()=>{E.value&&(a.href=u||s)},{immediate:!0})}const e={get loginLinkActionUrl(){return s},set loginLinkActionUrl(a){s=a},LoginForm:ae};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),re={class:"from-secondary-700 to-secondary-950 flex min-h-screen w-full flex-col justify-center bg-gradient-to-br"},le={class:"mx-auto p-4"},ce=i("section",{class:"ui-section text-center"},[i("a",{href:"/",class:"text-base-200 hover:text-white"},[i("i",{class:"i-arrow-right mr-1 rotate-180"}),b(" "+r("Ir para a loja"))])],-1),me={class:"overflow-hidden rounded-md shadow-md ring-4 ring-black/10"},ue={class:"mb-5 text-center"},de={href:"/",class:"inline-block"},pe={key:0,class:"ui-section px-0"},ge={class:"mx-auto flex max-w-sm flex-wrap items-center justify-evenly gap-4 px-3"};function _e(m,t,s,e,a,u){const n=C("ALink");return l(),c("article",re,[i("div",le,[ce,i("section",me,[L(e.LoginForm,T(V({loginLinkActionUrl:e.loginLinkActionUrl})),{head:U(()=>[i("div",ue,[i("a",de,[F(m.$slots,"logo")])])]),_:3},16)]),m.$settings.serviceLinks?.length?(l(),c("nav",pe,[i("ul",ge,[(l(!0),c(j,null,B(m.$settings.serviceLinks,({title:o,href:d},g)=>(l(),c("li",{key:`s-${g}`},[L(n,{href:d,class:"text-base-200 ui-link hover:text-white"},{default:U(()=>[b(r(o),1)]),_:2},1032,["href"])]))),128))])])):S("",!0)])])}const ke=N(oe,[["render",_e]]);export{ke as default};
|
package/packages/storefront/dist/client/_astro/{CartSidebar.DAvJKL2c.js → CartSidebar.Bxz7ZD9N.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as v,w as f}from"./_plugin-vue_export-helper.6K9uDcVo.js";import{c as _,d as y,j as b,k as i,e as c,h as u,i as x,$ as C,p as g,f as t,a1 as o,a as S,a0 as h,F as I,m as w}from"./sf-utils.C9ygvYIB.js";import{f as F}from"./modules-info.BswYf_-7.js";import{p as V,r as P,s as j,t as z}from"./shopping-cart.
|
|
1
|
+
import{_ as v,w as f}from"./_plugin-vue_export-helper.6K9uDcVo.js";import{c as _,d as y,j as b,k as i,e as c,h as u,i as x,$ as C,p as g,f as t,a1 as o,a as S,a0 as h,F as I,m as w}from"./sf-utils.C9ygvYIB.js";import{f as F}from"./modules-info.BswYf_-7.js";import{p as V,r as P,s as j,t as z}from"./shopping-cart.D8fbm2Dv.js";import{Q as A,C as L,S as q}from"./ShippingCalculator.DZSCK4xv.js";import{P as k}from"./Prices.9RhV7hCY.js";import{n as B}from"./name.Dll7Wwmg.js";import{i as N}from"./img.Be85e5da.js";import"./afetch.DPLba2tr.js";import"./format-money.D19_eJVX.js";import"./price.CHiL6Z1J.js";import"./customer-session.B9MvrBAQ.js";import"./index.BCNoXz_Z.js";import"./_commonjsHelpers.Cpj98o6Y.js";import"./i18n.DPcLqMFO.js";const E=a=>{const r=_(()=>!a.item&&a.product?V(a.product):null),s=_(()=>a.item||r.value),e=_(()=>B(s.value)),m=_(()=>{const{slug:n}=s.value;return typeof n=="string"?`/${n}`:null}),l=_(()=>{if(s.value.picture)return N(s.value.picture,void 0,a.pictureSize||"small")}),p=_(()=>s.value.final_price||s.value.price);return{cartItem:s,title:e,link:m,image:l,finalPrice:p}},Q=y({__name:"CartItem",props:{item:{},product:{},pictureSize:{}},setup(a,{expose:r}){r();const s=a,{cartItem:e,title:m,link:l,image:p,finalPrice:n}=E(s),d={props:s,cartItem:e,title:m,link:l,image:p,finalPrice:n,get removeCartItem(){return P},QuantitySelector:A,Prices:k};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),M={class:"relative bg-white shadow-sm"},O={class:"text-base-700 group-hover:text-base-900 flex-auto py-2 text-sm group-hover:underline"},D=t("span",{class:"border-3 border-danger-700/30 text-danger-800 flex size-5 flex-col justify-center rounded-full text-sm leading-none"},[t("i",{class:"i-close mx-auto my-0"})],-1),R=[D],T={class:"border-base-100 flex items-center justify-between border-t-2"},U={class:"border-base-100 border-r-2"};function G(a,r,s,e,m,l){const p=b("AImg"),n=b("ALink");return i(),c("article",M,[u(n,{href:e.link,class:"group flex items-center gap-5 p-4"},{default:x(()=>[e.image?(i(),C(p,{key:0,picture:e.image,alt:e.title,class:"size-20 object-cover"},null,8,["picture","alt"])):g("",!0),t("p",O,o(e.title),1)]),_:1},8,["href"]),e.cartItem._id?(i(),c("button",{key:0,onClick:r[0]||(r[0]=f(d=>e.removeCartItem(e.cartItem._id),["stop"])),class:"absolute right-0 top-0 p-2 opacity-70 hover:opacity-100","aria-label":"Remover"},R)):g("",!0),t("div",T,[t("div",U,[u(e.QuantitySelector,{modelValue:e.cartItem.quantity,"onUpdate:modelValue":r[1]||(r[1]=d=>e.cartItem.quantity=d),min:e.cartItem.min_quantity,max:e.cartItem.max_quantity},null,8,["modelValue","min","max"])]),u(e.Prices,{"base-price":e.cartItem.base_price,price:e.finalPrice,"has-cashback":!1,"has-price-options":!1,class:"px-4 py-2.5 text-right text-[95%]"},null,8,["base-price","price"])])])}const H=v(Q,[["render",G]]),J=y({__name:"CartSidebar",emits:["close"],setup(a,{expose:r,emit:s}){r();const e=s,m=S(!1),l={emit:e,hasShippingCalculator:m,get freeShippingFromValue(){return F},get shoppingCart(){return j},get totalItems(){return z},CheckoutLink:L,Prices:k,CartItem:H,ShippingCalculator:q};return Object.defineProperty(l,"__isScriptSetup",{enumerable:!1,value:!0}),l}}),K={class:"flex h-screen flex-col bg-white"},W={class:"z-10 flex items-center justify-end gap-3 px-6 py-4 shadow ring-1 ring-black/5"},X=t("span",{class:"text-base-600 text-right text-base font-medium"},o("Meu carrinho de compras"),-1),Y={class:"min-w-[3rem] text-right"},Z={class:"ui-badge-pill-lg"},$={class:"bg-base-50 grow overflow-y-auto"},ee={key:0,class:"text-center text-sm"},te={key:0,class:"secondary-subtle p-3"},re=t("strong",{class:"lowercase"},o("Frete grátis"),-1),se={key:1,class:"bg-success-50 text-success-800 p-3"},ae=t("i",{class:"text-success-900 i-check mr-1"},null,-1),ie={class:"px-4 pb-2 pt-4"},oe={class:"z-10 px-5 pb-3 pt-4 ring-2 ring-black/5"},ne={class:"grid grid-cols-5 items-center gap-3 text-right"},ce=t("div",{class:"col-span-2"},o("Subtotal"),-1),le={key:0,class:"my-2.5 text-right"},me=t("i",{class:"i-truck text-base-500 ml-1"},null,-1),pe=t("i",{class:"i-check mr-2"},null,-1),de=t("i",{class:"i-arrow-right mr-1 rotate-180"},null,-1);function ue(a,r,s,e,m,l){const p=b("Fade");return i(),c("aside",K,[t("header",W,[X,t("span",Y,[t("span",Z,o(e.totalItems),1)])]),t("article",$,[e.freeShippingFromValue?(i(),c("div",ee,[e.freeShippingFromValue>e.shoppingCart.subtotal?(i(),c("div",te,[h(o("Adicione $1 para ganhar".replace("$1",a.$money(e.freeShippingFromValue-e.shoppingCart.subtotal)))+" ",1),re])):(i(),c("div",se,[ae,h(" "+o("Frete grátis a partir de")+" "+o(a.$money(e.freeShippingFromValue)),1)]))])):g("",!0),t("ul",ie,[(i(!0),c(I,null,w(e.shoppingCart.items,(n,d)=>(i(),c("li",{key:d},[u(e.CartItem,{item:n,class:"mb-3"},null,8,["item"])]))),128))])]),t("footer",oe,[t("div",ne,[ce,u(e.Prices,{price:e.shoppingCart.subtotal,class:"col-span-3 text-lg"},null,8,["price"])]),e.hasShippingCalculator?g("",!0):(i(),c("div",le,[t("a",{href:"#",class:"ui-link text-base-700 decoration-base-300",onClick:r[0]||(r[0]=f(n=>e.hasShippingCalculator=!0,["prevent","stop"]))},[h(o("Calcular frete")+" "),me])])),u(p,{slide:"down"},{default:x(()=>[e.hasShippingCalculator?(i(),C(e.ShippingCalculator,{key:0,"shipped-items":e.shoppingCart.items,class:"my-2.5 flex flex-wrap justify-end","can-auto-submit":""},null,8,["shipped-items"])):g("",!0)]),_:1}),u(e.CheckoutLink,{to:"checkout",class:"ui-btn-lg ui-btn-primary my-2.5 w-full text-right"},{default:x(()=>[pe,h(" "+o("Finalizar compra"))]),_:1}),t("a",{href:"#",onClick:r[1]||(r[1]=f(n=>e.emit("close"),["prevent"])),class:"text-base-500 ui-link hover:text-base-700 text-sm"},[de,h(" "+o("Continuar comprando"))])])])}const Pe=v(J,[["render",ue]]);export{Pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as D,a as S,j as V,k as u,e as m,$ as I,i as A,f as v,p as b,F as w,m as P,n as z,h as k,aa as U,ab as H,Y as J,r as L,w as E,a8 as M,c as Q,a0 as B,a1 as C,ac as K,o as W,Z as X}from"./sf-utils.C9ygvYIB.js";import{_ as F,w as Y}from"./_plugin-vue_export-helper.6K9uDcVo.js";import{u as $}from"./index.BgtOIB20.js";import{a as tt}from"./shopping-cart.Cqc6p5UR.js";import{u as et}from"./use-product-card.Cj9Q-Y1A.js";import{C as ot,Q as it,S as rt}from"./ShippingCalculator.DZSCK4xv.js";import{P as at}from"./Prices.9RhV7hCY.js";import{_ as j}from"./customer-session.Cctko5_9.js";import{i as st}from"./img-sizes.rFK7so02.js";import"./index.BCNoXz_Z.js";import{g as nt}from"./grid-title.CZdq2sDS.js";import"./price.CHiL6Z1J.js";import"./use-analytics.bP3a5cR0.js";import"./afetch.DPLba2tr.js";import"./name.Dll7Wwmg.js";import"./i18n.DPcLqMFO.js";import"./img.Be85e5da.js";import"./_commonjsHelpers.Cpj98o6Y.js";import"./modules-info.BswYf_-7.js";import"./format-money.D19_eJVX.js";const G=(a,n,l)=>{if(typeof a!="object"||a===null)return[];let t=[];if(typeof a=="object"&&a!==null)if(Array.isArray(a))a.length&&(a[0].specifications?a.forEach(e=>{t=t.concat(G(e,n,l))}):a[0].text&&(t=a));else{const{specifications:e}=a;if(e)for(const s in e)e[s]&&s===n&&(t=e[n]);if(t&&!t.length&&Array.isArray(l)&&l.length){let s,d;return l&&(d=l.find(i=>i.grid_id===n))&&d.options&&(s=d.options.map(i=>{let r;return i.colors&&i.colors.length?r=i.colors[0]:r=i.option_id,{text:i.text,value:r}})),G(s,n)}}return t},Z=(a,n,l,t=", ")=>{let e=G(a,n,l);if(e.length){let s=e[0].text;for(let d=1;d<e.length;d++)s+=t+e[d].text;return s}return null},lt=(a,n,l,t)=>{const e=G(a,l,t);for(let s=0;s<e.length;s++)if(e[s].text===n)return e[s].value},q=(a,n,l,t)=>{let e={};return a&&Array.isArray(a.variations)&&a.variations.forEach(s=>{if(l&&s.quantity<=0)return;let d=s.specifications,i=r=>Z(s,r,t);if(d){if(n){for(let r in n)if(n.hasOwnProperty(r)&&(!d[r]||i(r)!==n[r]))return}for(let r in d)if(d.hasOwnProperty(r)){let f=i(r);if(!e.hasOwnProperty(r))e[r]=[];else if(e[r].indexOf(f)!==-1)continue;e[r].push(f)}}}),e},ct=D({__name:"ImagesGallery",props:{pictures:{}},setup(a,{expose:n}){n();const l=S(0),t=S("");let e;const s=S(!1),i={activeIndex:l,psId:t,get lightbox(){return e},set lightbox(r){e=r},isLoadingLightbox:s,zoom:r=>{if(t.value=`ps-${H()}`,!e&&!s.value){s.value=!0;const f="photoswipe-style";Promise.all([j(()=>import("./photoswipe-lightbox.esm.BbYxSZIB.js"),[]),j(()=>import("./photoswipe.esm.C0FT-EY-.js"),[]),!document.getElementById(f)&&j(()=>import("./photoswipe.CNpEZKfy.js"),[])]).then(([{default:o},{default:c},h])=>{if(h){const{default:y}=h,g=document.createElement("style");g.id=f,g.textContent=y,document.head.appendChild(g)}e=new o({gallery:`#${t.value} > div`,children:"a",pswpModule:c,showAnimationDuration:300,hideAnimationDuration:300}),e.init(),e.loadAndOpen(r),s.value=!1})}},get getImgSizes(){return st}};return Object.defineProperty(i,"__isScriptSetup",{enumerable:!1,value:!0}),i}}),dt={class:"-mx-4 flex w-screen gap-3 sm:mx-0 sm:w-full md:h-[525px] 2xl:gap-5"},ut=["onClick"],mt=v("span",{class:"absolute bottom-0 block h-2 w-full bg-gradient-to-b from-transparent to-white"},null,-1),ft={class:"relative aspect-square h-full grow md:aspect-auto"},pt={key:0,class:"bg-base-200 i-arrow-path absolute left-1/2 top-1/2 -ml-7 -mt-7 size-14 animate-spin","aria-label":"Carregando"},gt={key:1,class:"mt-2 flex justify-center gap-1.5 md:hidden"},ht=["aria-label","onClick"];function _t(a,n,l,t,e,s){const d=V("AImg"),i=V("CarouselControl"),r=V("Carousel"),f=V("ALink");return u(),m("div",dt,[l.pictures.length>1?(u(),I(r,{key:0,axis:"y",class:"group hidden w-[300px] shrink-0 md:block"},{controls:A(()=>[v("span",null,[l.pictures.length>6?(u(),I(i,{key:0,class:"text-primary hover:bg-primary-300/60 !bottom-3 !left-1/2 -ml-5 size-10 rounded-full bg-white/60 text-xl opacity-0 shadow-sm ring-1 ring-black/5 group-hover:opacity-90"})):b("",!0),mt])]),default:A(()=>[(u(!0),m(w,null,P(Math.ceil(l.pictures.length/2),o=>(u(),m("li",{key:o,class:z(["grid w-full grid-cols-2 gap-3 px-1 pb-3",o===1&&"pt-1"])},[(u(!0),m(w,null,P([1,2].map(c=>(o-1)*2+(c-1)),c=>(u(),m(w,{key:`${o}-${c}`},[c<l.pictures.length?(u(),m("button",{key:0,class:"bg-secondary-100 block rounded md:h-[175px]",onClick:h=>t.activeIndex=c},[k(d,{picture:l.pictures[c],class:z(["ring-secondary/10 size-full rounded border-2 object-cover opacity-90 transition-colors",c===t.activeIndex?"border-secondary/50 ring-4 cursor-auto":"border-transparent hover:border-primary hover:ring-4 hover:ring-primary/20"])},null,8,["picture","class"])],8,ut)):b("",!0)],64))),128))],2))),128))]),_:1})):b("",!0),v("div",ft,[k(r,{as:"div",index:t.activeIndex,"onUpdate:index":n[1]||(n[1]=o=>t.activeIndex=o),class:z(["text-base-600 [&_i]:i-arrow-right mx-auto size-full max-w-[525px] [&>*]:h-full [&_i]:mx-2 [&_i]:text-2xl",t.isLoadingLightbox&&"opacity-80"]),id:t.psId},{default:A(()=>[n[0]||(U(-1),n[0]=(u(!0),m(w,null,P(l.pictures,(o,c)=>(u(),I(f,{key:`big-${c}`,href:o.zoom?.size&&o.zoom.url,"data-pswp-width":t.getImgSizes(o.zoom||"").width,"data-pswp-height":t.getImgSizes(o.zoom||"").height,target:"_blank",rel:"noreferrer",class:z(["shrink-0 basis-full",o.zoom?.size&&"cursor-zoom-in"]),onClick:Y(()=>o.zoom?.size&&t.zoom(c),["prevent"])},{default:A(()=>[k(d,{picture:o,"preferred-size":"big",class:"size-full rounded object-cover",fetchpriority:c===0?"high":"low",loading:c===0?"eager":"lazy"},null,8,["picture","fetchpriority","loading"])]),_:2},1032,["href","data-pswp-width","data-pswp-height","class","onClick"]))),128)),U(1),n[0])]),_:1},8,["index","class","id"]),t.isLoadingLightbox?(u(),m("i",pt)):b("",!0),l.pictures.length>1?(u(),m("ul",gt,[(u(!0),m(w,null,P(l.pictures.length,o=>(u(),m("li",{key:`d-${o}`},[v("button",{class:z(["bg-base-700 block h-1.5 w-3 rounded-full",t.activeIndex!==o-1&&"opacity-40"]),"aria-label":`Imagem ${o}`,onClick:c=>t.activeIndex=o-1},null,10,ht)]))),128))])):b("",!0)])])}const vt=F(ct,[["render",_t]]),yt=a=>{const n=J(a.grids||globalThis.$storefront.data.grids||[]);n.length||window.addEventListener("storefront:data:grids",()=>{globalThis.$storefront.data.grids?.forEach(o=>n.push(o))},{once:!0});const l=L({}),t=L({});E(M(a,"variations"),()=>{Object.assign(t,q(a,void 0,!0));const o=q(a);Object.keys(o).forEach(c=>{t[c]?l[c]=t[c]:delete l[c]})},{immediate:!0});const e=Q(()=>Object.keys(l)),s=L({}),d=S(),i=({optionText:o,gridId:c,gridIndex:h})=>{s[c]=o;const y={};for(let p=0;p<=h;p++){const _=e[p];s[_]&&(y[_]=s[_])}const g=q(a,y,!0);for(let p=h+1;p<e.value.length;p++){const _=e[p],O=g[_];t[_]=O,s[_]&&!O.includes(s[_])&&delete s[_]}const x=a.variations.slice(0);for(let p=0;p<x.length;p++){const _=x[p],{specifications:O}=_,R=Object.keys(O);for(let T=0;T<R.length;T++){const N=R[T];if(s[N]!==Z(_,N)){x.splice(p,1),p-=1;break}}}d.value=x[0]?._id||null};return E(M(a,"variationId"),o=>{if(!o||o===d.value)return;const c=a.variations.find(x=>x._id===o);if(!c){d.value=null;return}const{specifications:h}=c,y=Object.keys(h),g=(x=0)=>{const p=y[x];if(y[x]&&h[p]&&h[p].length===1){const _=h[p][0].text;l[p].find(O=>O===_)&&(i({optionText:_,gridId:p,gridIndex:e.value.indexOf(p)}),g(x+1))}};g()},{immediate:!0}),{grids:n,variationsGrids:l,activeVariationsGrids:t,selectOption:i,selectedOptions:s,variationId:d,getGridTitle:o=>nt(o,n),getColorOptionBg:o=>{const c=o.split(",").map(h=>lt(a.variations,h.trim(),"colors"));return c.length>1?`background:linear-gradient(to right bottom, ${c[0]} 50%, ${c[1]} 50%)`:`background:${c[0]}`}}},bt=D({__name:"SkuSelector",props:{variations:{},variationId:{},grids:{}},emits:["update:variationId"],setup(a,{expose:n,emit:l}){n();const t=a,e=l,{variationsGrids:s,activeVariationsGrids:d,selectOption:i,selectedOptions:r,variationId:f,getGridTitle:o,getColorOptionBg:c}=yt(t);E(f,y=>{e("update:variationId",y)});const h={props:t,emit:e,variationsGrids:s,activeVariationsGrids:d,selectOption:i,selectedOptions:r,variationId:f,getGridTitle:o,getColorOptionBg:c};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),xt={class:"text-base-700 text-sm font-medium"},kt={key:0,class:"text-base-800"},wt={key:0,class:"mt-2 flex gap-2"},Ct=["onClick"];function St(a,n,l,t,e,s){return u(),m("div",null,[(u(!0),m(w,null,P(t.variationsGrids,(d,i)=>(u(),m("div",{key:i,class:"mt-3"},[v("span",xt,[B(C(t.getGridTitle(i))+": ",1),t.selectedOptions[i]?(u(),m("strong",kt,C(t.selectedOptions[i]),1)):b("",!0)]),d.length<7?(u(),m("ul",wt,[(u(!0),m(w,null,P(d,(r,f)=>(u(),m("li",{key:`${i}-${f}`},[v("button",{class:z(["ring-primary/60 rounded border",[t.selectedOptions[i]===r?"border-primary ring-2":null,i==="colors"?"size-9 text-[0px]":"px-2.5 py-2 leading-none",t.activeVariationsGrids[i].includes(r)?"border-primary-400 bg-primary-100 text-primary-950":"border-primary-300 bg-primary-200 text-primary-600"]]),style:K(i==="colors"&&t.getColorOptionBg(r)),onClick:o=>t.selectOption({optionText:r,gridId:i,gridIndex:f})},C(r),15,Ct)]))),128))])):b("",!0)]))),128))])}const Ot=F(bt,[["render",St]]),zt=D({__name:"ProductDetails",props:{product:{default:()=>globalThis.$storefront.apiContext?.doc},cmsPreview:{}},setup(a,{expose:n}){n();const l=a,{product:t,title:e,isActive:s}=et(l),d=S(t.min_quantity||1),i=$("history"),r=S(!1),f=S(null);E(f,g=>{g&&(i.var=g,r.value=!1)}),W(()=>{E(i,({var:g})=>{typeof g=="string"&&g&&(f.value=g)},{immediate:!0})});const o=Q(()=>!!(!t.variations?.length||f.value)),c=g=>(o.value?r.value=!1:(g&&g.preventDefault(),r.value=!0),!r.value),y={props:l,product:t,title:e,isActive:s,quantity:d,params:i,hasSkuSelectionAlert:r,variationId:f,isSkuSelected:o,checkVariation:c,addToCart:()=>{c()&&tt(t,f.value||void 0,d.value)},CheckoutLink:ot,QuantitySelector:it,Prices:at,ImagesGallery:vt,SkuSelector:Ot,ShippingCalculator:rt};return Object.defineProperty(y,"__isScriptSetup",{enumerable:!1,value:!0}),y}}),At={class:"relative grid grid-cols-1 items-start gap-x-5 ui-section lg:grid-cols-4 lg:gap-x-4 2xl:gap-x-6"},Pt={class:"w-full lg:col-span-3"},Vt={class:"top-0 pt-4 transition-transform lg:sticky lg:pb-4 lg:sticky-header:translate-y-14"},It={class:"text-lg text-secondary-900 ui-text-brand"},Et={key:0,class:"mt-5"},Gt={key:0,class:"inline-block ui-alert"},Tt=v("i",{class:"ml-1 -rotate-90 i-arrow-right"},null,-1),Lt={class:"mt-5 flex flex-wrap items-center gap-x-4 gap-y-2 md:flex-nowrap lg:mt-4 lg:flex-wrap"},jt=v("i",{class:"mr-1 i-chevron-double-right"},null,-1),qt=["data-tooltip"],Bt={class:"mt-6 rounded border-2 border-base-50 border-t-base-100 p-4 lg:mt-4"},Dt={class:"w-full lg:col-span-3"};function Ft(a,n,l,t,e,s){const d=V("Fade");return u(),m("section",At,[v("div",Pt,[t.product.pictures?.length?(u(),I(t.ImagesGallery,{key:0,pictures:t.product.pictures,class:"mb-5"},null,8,["pictures"])):b("",!0)]),v("div",Vt,[v("h1",It,C(t.title),1),t.isActive?(u(),m("div",Et,[k(t.Prices,{product:t.product,"is-big":"","is-literal":""},null,8,["product"]),t.product.variations?(u(),I(t.SkuSelector,{key:0,variations:t.product.variations,"variation-id":t.variationId,"onUpdate:variationId":n[0]||(n[0]=i=>t.variationId=i),class:"my-4"},null,8,["variations","variation-id"])):b("",!0),k(d,{slide:"down"},{default:A(()=>[t.hasSkuSelectionAlert?(u(),m("div",Gt,[B(C("Por favor selecione uma opção em cada campo acima")+" "),Tt])):b("",!0)]),_:1}),v("div",Lt,[k(t.QuantitySelector,{modelValue:t.quantity,"onUpdate:modelValue":n[1]||(n[1]=i=>t.quantity=i),min:t.product.min_quantity,max:t.product.quantity,class:"rounded border-base-100 md:mr-5 lg:mb-2 lg:mr-auto lg:border-2"},null,8,["modelValue","min","max"]),k(t.CheckoutLink,{class:"grow text-center ui-btn-lg ui-btn-primary",to:"checkout","cart-item":{product_id:t.product._id,quantity:t.quantity,variation_id:t.variationId||void 0},"data-tooltip":t.isSkuSelected?null:"Escolha os detalhes do produto para comprar",onClick:t.checkVariation},{default:A(()=>[jt,B(" "+C("Comprar"))]),_:1},8,["cart-item","data-tooltip"]),v("button",{class:"grow ui-btn-lg ui-btn-contrast",onClick:Y(t.addToCart,["prevent"]),"data-tooltip":t.isSkuSelected?null:"Escolha os detalhes do produto para comprar"},C("Adicionar ao carrinho"),8,qt)]),v("div",Bt,[k(t.ShippingCalculator,{"shipped-items":[{...t.product,quantity:t.quantity}],"has-label":""},null,8,["shipped-items"])])])):b("",!0)]),v("div",Dt,[X(a.$slots,"description")])])}const ne=F(zt,[["render",Ft]]);export{ne as default};
|
|
1
|
+
import{d as D,a as S,j as V,k as u,e as m,$ as I,i as A,f as v,p as b,F as w,m as P,n as z,h as k,aa as U,ab as H,Y as J,r as L,w as E,a8 as M,c as Q,a0 as B,a1 as C,ac as K,o as W,Z as X}from"./sf-utils.C9ygvYIB.js";import{_ as F,w as Y}from"./_plugin-vue_export-helper.6K9uDcVo.js";import{u as $}from"./index.BgtOIB20.js";import{a as tt}from"./shopping-cart.D8fbm2Dv.js";import{u as et}from"./use-product-card.BCGHZKB5.js";import{C as ot,Q as it,S as rt}from"./ShippingCalculator.DZSCK4xv.js";import{P as at}from"./Prices.9RhV7hCY.js";import{_ as j}from"./customer-session.B9MvrBAQ.js";import{i as st}from"./img-sizes.rFK7so02.js";import"./index.BCNoXz_Z.js";import{g as nt}from"./grid-title.CZdq2sDS.js";import"./price.CHiL6Z1J.js";import"./use-analytics.D_peWG3X.js";import"./afetch.DPLba2tr.js";import"./name.Dll7Wwmg.js";import"./i18n.DPcLqMFO.js";import"./img.Be85e5da.js";import"./_commonjsHelpers.Cpj98o6Y.js";import"./modules-info.BswYf_-7.js";import"./format-money.D19_eJVX.js";const G=(a,n,l)=>{if(typeof a!="object"||a===null)return[];let t=[];if(typeof a=="object"&&a!==null)if(Array.isArray(a))a.length&&(a[0].specifications?a.forEach(e=>{t=t.concat(G(e,n,l))}):a[0].text&&(t=a));else{const{specifications:e}=a;if(e)for(const s in e)e[s]&&s===n&&(t=e[n]);if(t&&!t.length&&Array.isArray(l)&&l.length){let s,d;return l&&(d=l.find(i=>i.grid_id===n))&&d.options&&(s=d.options.map(i=>{let r;return i.colors&&i.colors.length?r=i.colors[0]:r=i.option_id,{text:i.text,value:r}})),G(s,n)}}return t},Z=(a,n,l,t=", ")=>{let e=G(a,n,l);if(e.length){let s=e[0].text;for(let d=1;d<e.length;d++)s+=t+e[d].text;return s}return null},lt=(a,n,l,t)=>{const e=G(a,l,t);for(let s=0;s<e.length;s++)if(e[s].text===n)return e[s].value},q=(a,n,l,t)=>{let e={};return a&&Array.isArray(a.variations)&&a.variations.forEach(s=>{if(l&&s.quantity<=0)return;let d=s.specifications,i=r=>Z(s,r,t);if(d){if(n){for(let r in n)if(n.hasOwnProperty(r)&&(!d[r]||i(r)!==n[r]))return}for(let r in d)if(d.hasOwnProperty(r)){let f=i(r);if(!e.hasOwnProperty(r))e[r]=[];else if(e[r].indexOf(f)!==-1)continue;e[r].push(f)}}}),e},ct=D({__name:"ImagesGallery",props:{pictures:{}},setup(a,{expose:n}){n();const l=S(0),t=S("");let e;const s=S(!1),i={activeIndex:l,psId:t,get lightbox(){return e},set lightbox(r){e=r},isLoadingLightbox:s,zoom:r=>{if(t.value=`ps-${H()}`,!e&&!s.value){s.value=!0;const f="photoswipe-style";Promise.all([j(()=>import("./photoswipe-lightbox.esm.BbYxSZIB.js"),[]),j(()=>import("./photoswipe.esm.C0FT-EY-.js"),[]),!document.getElementById(f)&&j(()=>import("./photoswipe.CNpEZKfy.js"),[])]).then(([{default:o},{default:c},h])=>{if(h){const{default:y}=h,g=document.createElement("style");g.id=f,g.textContent=y,document.head.appendChild(g)}e=new o({gallery:`#${t.value} > div`,children:"a",pswpModule:c,showAnimationDuration:300,hideAnimationDuration:300}),e.init(),e.loadAndOpen(r),s.value=!1})}},get getImgSizes(){return st}};return Object.defineProperty(i,"__isScriptSetup",{enumerable:!1,value:!0}),i}}),dt={class:"-mx-4 flex w-screen gap-3 sm:mx-0 sm:w-full md:h-[525px] 2xl:gap-5"},ut=["onClick"],mt=v("span",{class:"absolute bottom-0 block h-2 w-full bg-gradient-to-b from-transparent to-white"},null,-1),ft={class:"relative aspect-square h-full grow md:aspect-auto"},pt={key:0,class:"bg-base-200 i-arrow-path absolute left-1/2 top-1/2 -ml-7 -mt-7 size-14 animate-spin","aria-label":"Carregando"},gt={key:1,class:"mt-2 flex justify-center gap-1.5 md:hidden"},ht=["aria-label","onClick"];function _t(a,n,l,t,e,s){const d=V("AImg"),i=V("CarouselControl"),r=V("Carousel"),f=V("ALink");return u(),m("div",dt,[l.pictures.length>1?(u(),I(r,{key:0,axis:"y",class:"group hidden w-[300px] shrink-0 md:block"},{controls:A(()=>[v("span",null,[l.pictures.length>6?(u(),I(i,{key:0,class:"text-primary hover:bg-primary-300/60 !bottom-3 !left-1/2 -ml-5 size-10 rounded-full bg-white/60 text-xl opacity-0 shadow-sm ring-1 ring-black/5 group-hover:opacity-90"})):b("",!0),mt])]),default:A(()=>[(u(!0),m(w,null,P(Math.ceil(l.pictures.length/2),o=>(u(),m("li",{key:o,class:z(["grid w-full grid-cols-2 gap-3 px-1 pb-3",o===1&&"pt-1"])},[(u(!0),m(w,null,P([1,2].map(c=>(o-1)*2+(c-1)),c=>(u(),m(w,{key:`${o}-${c}`},[c<l.pictures.length?(u(),m("button",{key:0,class:"bg-secondary-100 block rounded md:h-[175px]",onClick:h=>t.activeIndex=c},[k(d,{picture:l.pictures[c],class:z(["ring-secondary/10 size-full rounded border-2 object-cover opacity-90 transition-colors",c===t.activeIndex?"border-secondary/50 ring-4 cursor-auto":"border-transparent hover:border-primary hover:ring-4 hover:ring-primary/20"])},null,8,["picture","class"])],8,ut)):b("",!0)],64))),128))],2))),128))]),_:1})):b("",!0),v("div",ft,[k(r,{as:"div",index:t.activeIndex,"onUpdate:index":n[1]||(n[1]=o=>t.activeIndex=o),class:z(["text-base-600 [&_i]:i-arrow-right mx-auto size-full max-w-[525px] [&>*]:h-full [&_i]:mx-2 [&_i]:text-2xl",t.isLoadingLightbox&&"opacity-80"]),id:t.psId},{default:A(()=>[n[0]||(U(-1),n[0]=(u(!0),m(w,null,P(l.pictures,(o,c)=>(u(),I(f,{key:`big-${c}`,href:o.zoom?.size&&o.zoom.url,"data-pswp-width":t.getImgSizes(o.zoom||"").width,"data-pswp-height":t.getImgSizes(o.zoom||"").height,target:"_blank",rel:"noreferrer",class:z(["shrink-0 basis-full",o.zoom?.size&&"cursor-zoom-in"]),onClick:Y(()=>o.zoom?.size&&t.zoom(c),["prevent"])},{default:A(()=>[k(d,{picture:o,"preferred-size":"big",class:"size-full rounded object-cover",fetchpriority:c===0?"high":"low",loading:c===0?"eager":"lazy"},null,8,["picture","fetchpriority","loading"])]),_:2},1032,["href","data-pswp-width","data-pswp-height","class","onClick"]))),128)),U(1),n[0])]),_:1},8,["index","class","id"]),t.isLoadingLightbox?(u(),m("i",pt)):b("",!0),l.pictures.length>1?(u(),m("ul",gt,[(u(!0),m(w,null,P(l.pictures.length,o=>(u(),m("li",{key:`d-${o}`},[v("button",{class:z(["bg-base-700 block h-1.5 w-3 rounded-full",t.activeIndex!==o-1&&"opacity-40"]),"aria-label":`Imagem ${o}`,onClick:c=>t.activeIndex=o-1},null,10,ht)]))),128))])):b("",!0)])])}const vt=F(ct,[["render",_t]]),yt=a=>{const n=J(a.grids||globalThis.$storefront.data.grids||[]);n.length||window.addEventListener("storefront:data:grids",()=>{globalThis.$storefront.data.grids?.forEach(o=>n.push(o))},{once:!0});const l=L({}),t=L({});E(M(a,"variations"),()=>{Object.assign(t,q(a,void 0,!0));const o=q(a);Object.keys(o).forEach(c=>{t[c]?l[c]=t[c]:delete l[c]})},{immediate:!0});const e=Q(()=>Object.keys(l)),s=L({}),d=S(),i=({optionText:o,gridId:c,gridIndex:h})=>{s[c]=o;const y={};for(let p=0;p<=h;p++){const _=e[p];s[_]&&(y[_]=s[_])}const g=q(a,y,!0);for(let p=h+1;p<e.value.length;p++){const _=e[p],O=g[_];t[_]=O,s[_]&&!O.includes(s[_])&&delete s[_]}const x=a.variations.slice(0);for(let p=0;p<x.length;p++){const _=x[p],{specifications:O}=_,R=Object.keys(O);for(let T=0;T<R.length;T++){const N=R[T];if(s[N]!==Z(_,N)){x.splice(p,1),p-=1;break}}}d.value=x[0]?._id||null};return E(M(a,"variationId"),o=>{if(!o||o===d.value)return;const c=a.variations.find(x=>x._id===o);if(!c){d.value=null;return}const{specifications:h}=c,y=Object.keys(h),g=(x=0)=>{const p=y[x];if(y[x]&&h[p]&&h[p].length===1){const _=h[p][0].text;l[p].find(O=>O===_)&&(i({optionText:_,gridId:p,gridIndex:e.value.indexOf(p)}),g(x+1))}};g()},{immediate:!0}),{grids:n,variationsGrids:l,activeVariationsGrids:t,selectOption:i,selectedOptions:s,variationId:d,getGridTitle:o=>nt(o,n),getColorOptionBg:o=>{const c=o.split(",").map(h=>lt(a.variations,h.trim(),"colors"));return c.length>1?`background:linear-gradient(to right bottom, ${c[0]} 50%, ${c[1]} 50%)`:`background:${c[0]}`}}},bt=D({__name:"SkuSelector",props:{variations:{},variationId:{},grids:{}},emits:["update:variationId"],setup(a,{expose:n,emit:l}){n();const t=a,e=l,{variationsGrids:s,activeVariationsGrids:d,selectOption:i,selectedOptions:r,variationId:f,getGridTitle:o,getColorOptionBg:c}=yt(t);E(f,y=>{e("update:variationId",y)});const h={props:t,emit:e,variationsGrids:s,activeVariationsGrids:d,selectOption:i,selectedOptions:r,variationId:f,getGridTitle:o,getColorOptionBg:c};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),xt={class:"text-base-700 text-sm font-medium"},kt={key:0,class:"text-base-800"},wt={key:0,class:"mt-2 flex gap-2"},Ct=["onClick"];function St(a,n,l,t,e,s){return u(),m("div",null,[(u(!0),m(w,null,P(t.variationsGrids,(d,i)=>(u(),m("div",{key:i,class:"mt-3"},[v("span",xt,[B(C(t.getGridTitle(i))+": ",1),t.selectedOptions[i]?(u(),m("strong",kt,C(t.selectedOptions[i]),1)):b("",!0)]),d.length<7?(u(),m("ul",wt,[(u(!0),m(w,null,P(d,(r,f)=>(u(),m("li",{key:`${i}-${f}`},[v("button",{class:z(["ring-primary/60 rounded border",[t.selectedOptions[i]===r?"border-primary ring-2":null,i==="colors"?"size-9 text-[0px]":"px-2.5 py-2 leading-none",t.activeVariationsGrids[i].includes(r)?"border-primary-400 bg-primary-100 text-primary-950":"border-primary-300 bg-primary-200 text-primary-600"]]),style:K(i==="colors"&&t.getColorOptionBg(r)),onClick:o=>t.selectOption({optionText:r,gridId:i,gridIndex:f})},C(r),15,Ct)]))),128))])):b("",!0)]))),128))])}const Ot=F(bt,[["render",St]]),zt=D({__name:"ProductDetails",props:{product:{default:()=>globalThis.$storefront.apiContext?.doc},cmsPreview:{}},setup(a,{expose:n}){n();const l=a,{product:t,title:e,isActive:s}=et(l),d=S(t.min_quantity||1),i=$("history"),r=S(!1),f=S(null);E(f,g=>{g&&(i.var=g,r.value=!1)}),W(()=>{E(i,({var:g})=>{typeof g=="string"&&g&&(f.value=g)},{immediate:!0})});const o=Q(()=>!!(!t.variations?.length||f.value)),c=g=>(o.value?r.value=!1:(g&&g.preventDefault(),r.value=!0),!r.value),y={props:l,product:t,title:e,isActive:s,quantity:d,params:i,hasSkuSelectionAlert:r,variationId:f,isSkuSelected:o,checkVariation:c,addToCart:()=>{c()&&tt(t,f.value||void 0,d.value)},CheckoutLink:ot,QuantitySelector:it,Prices:at,ImagesGallery:vt,SkuSelector:Ot,ShippingCalculator:rt};return Object.defineProperty(y,"__isScriptSetup",{enumerable:!1,value:!0}),y}}),At={class:"relative grid grid-cols-1 items-start gap-x-5 ui-section lg:grid-cols-4 lg:gap-x-4 2xl:gap-x-6"},Pt={class:"w-full lg:col-span-3"},Vt={class:"top-0 pt-4 transition-transform lg:sticky lg:pb-4 lg:sticky-header:translate-y-14"},It={class:"text-lg text-secondary-900 ui-text-brand"},Et={key:0,class:"mt-5"},Gt={key:0,class:"inline-block ui-alert"},Tt=v("i",{class:"ml-1 -rotate-90 i-arrow-right"},null,-1),Lt={class:"mt-5 flex flex-wrap items-center gap-x-4 gap-y-2 md:flex-nowrap lg:mt-4 lg:flex-wrap"},jt=v("i",{class:"mr-1 i-chevron-double-right"},null,-1),qt=["data-tooltip"],Bt={class:"mt-6 rounded border-2 border-base-50 border-t-base-100 p-4 lg:mt-4"},Dt={class:"w-full lg:col-span-3"};function Ft(a,n,l,t,e,s){const d=V("Fade");return u(),m("section",At,[v("div",Pt,[t.product.pictures?.length?(u(),I(t.ImagesGallery,{key:0,pictures:t.product.pictures,class:"mb-5"},null,8,["pictures"])):b("",!0)]),v("div",Vt,[v("h1",It,C(t.title),1),t.isActive?(u(),m("div",Et,[k(t.Prices,{product:t.product,"is-big":"","is-literal":""},null,8,["product"]),t.product.variations?(u(),I(t.SkuSelector,{key:0,variations:t.product.variations,"variation-id":t.variationId,"onUpdate:variationId":n[0]||(n[0]=i=>t.variationId=i),class:"my-4"},null,8,["variations","variation-id"])):b("",!0),k(d,{slide:"down"},{default:A(()=>[t.hasSkuSelectionAlert?(u(),m("div",Gt,[B(C("Por favor selecione uma opção em cada campo acima")+" "),Tt])):b("",!0)]),_:1}),v("div",Lt,[k(t.QuantitySelector,{modelValue:t.quantity,"onUpdate:modelValue":n[1]||(n[1]=i=>t.quantity=i),min:t.product.min_quantity,max:t.product.quantity,class:"rounded border-base-100 md:mr-5 lg:mb-2 lg:mr-auto lg:border-2"},null,8,["modelValue","min","max"]),k(t.CheckoutLink,{class:"grow text-center ui-btn-lg ui-btn-primary",to:"checkout","cart-item":{product_id:t.product._id,quantity:t.quantity,variation_id:t.variationId||void 0},"data-tooltip":t.isSkuSelected?null:"Escolha os detalhes do produto para comprar",onClick:t.checkVariation},{default:A(()=>[jt,B(" "+C("Comprar"))]),_:1},8,["cart-item","data-tooltip"]),v("button",{class:"grow ui-btn-lg ui-btn-contrast",onClick:Y(t.addToCart,["prevent"]),"data-tooltip":t.isSkuSelected?null:"Escolha os detalhes do produto para comprar"},C("Adicionar ao carrinho"),8,qt)]),v("div",Bt,[k(t.ShippingCalculator,{"shipped-items":[{...t.product,quantity:t.quantity}],"has-label":""},null,8,["shipped-items"])])])):b("",!0)]),v("div",Dt,[X(a.$slots,"description")])])}const ne=F(zt,[["render",Ft]]);export{ne as default};
|
package/packages/storefront/dist/client/_astro/{ProductShelf.C0TU_sRb.js → ProductShelf.BKz6WXbp.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k,Y as j,d as z,w as N,j as I,k as l,e as u,h as v,i as x,f as b,$ as A,p as P,a0 as y,a1 as C,a2 as B,n as S,am as R,ab as M,au as O,Z as V,l as D,F as E,m as G}from"./sf-utils.C9ygvYIB.js";import{_ as T,w as H,v as Q}from"./_plugin-vue_export-helper.6K9uDcVo.js";import{b as F,d as q}from"./index.BgtOIB20.js";import{b as L}from"./customer-session.
|
|
1
|
+
import{a as k,Y as j,d as z,w as N,j as I,k as l,e as u,h as v,i as x,f as b,$ as A,p as P,a0 as y,a1 as C,a2 as B,n as S,am as R,ab as M,au as O,Z as V,l as D,F as E,m as G}from"./sf-utils.C9ygvYIB.js";import{_ as T,w as H,v as Q}from"./_plugin-vue_export-helper.6K9uDcVo.js";import{b as F,d as q}from"./index.BgtOIB20.js";import{b as L}from"./customer-session.B9MvrBAQ.js";import{s as Y,P as Z}from"./Prices.9RhV7hCY.js";import{a as J}from"./use-cms-preview.BxKK4a1X.js";import{i as w,u as K}from"./use-product-card.BCGHZKB5.js";import"./index.BCNoXz_Z.js";import{a as U}from"./shopping-cart.D8fbm2Dv.js";import"./modules-info.BswYf_-7.js";import"./afetch.DPLba2tr.js";import"./format-money.D19_eJVX.js";import"./price.CHiL6Z1J.js";import"./use-analytics.D_peWG3X.js";import"./name.Dll7Wwmg.js";import"./i18n.DPcLqMFO.js";import"./img.Be85e5da.js";const W=t=>{const s=k(t.title||""),i=k(t.titleLink||""),e=k(!1);let g=null;const f=k(null),n=j(t.products||[]);return J(t,{title:s,titleLink:i,products:n}),t.products||(e.value=!0,g=(async()=>{const m=t.limit||12;let p=`offset=${t.page?(t.page-1)*m:0}&limit=${m}`;if(t.sort&&(p+=`&sort=${t.sort}`),t.isRelatedProducts){const{apiContext:o}=globalThis.$storefront;o?.resource==="products"&&(p+=`&like=${o.doc._id}`,!s.value&&s.value!==null&&(s.value=Y))}else{let o=t.searchQuery||"",d,r;if(t.collectionId){try{const{data:a}=await L.get(`collections/${t.collectionId}`);d=a}catch(a){console.error(a),f.value=a}r=d?.products,!s.value&&s.value!==null&&d?.name&&(s.value=d?.name)}else!o&&t.orderedProductIds&&(r=t.orderedProductIds);r?.length&&(o+=`&_id=${r.slice(0,60).join(",")}`),p+=o}try{const{data:o}=await L.get(`search/v1?${p}`);if(t.isShuffle){let r=o.result.filter(_=>_.available&&w(_)).length,a,h;for(;r;)h=Math.floor(Math.random()*r--),a=o.result[r],o.result[r]=o.result[h],o.result[h]=a}const{orderedProductIds:d}=t;d&&o.result.sort((r,a)=>{if(a.available&&w(a)){if(!r.available||!w(r))return 1;const h=d.indexOf(r._id),_=d.indexOf(a._id);return h===-1&&_>-1?1:_===-1&&h>-1?-1:h-_}return r.available&&w(r)?-1:0}),o.result.forEach(r=>n.push(r))}catch(o){console.error(o),f.value=o}e.value=!1})()),{title:s,titleLink:i,isFetching:e,fetching:g,fetchError:f,products:n}},X=z({__name:"ProductCard",props:{product:{},productId:{},listName:{},listId:{},headingTag:{default:"h3"}},setup(t,{expose:s}){s();const i=t,{product:e,title:g,link:f,images:n,isInStock:m,isActive:c,discountPercentage:p,hasVariations:o}=K(i),d=k(null),r=F(d),a=k(!1),h=N(r,()=>{a.value=!0,h()}),_={props:i,product:e,title:g,link:f,images:n,isInStock:m,isActive:c,discountPercentage:p,hasVariations:o,card:d,isHovered:r,wasHoveredOnce:a,unwatch:h,get addProductToCart(){return U},get isMobile(){return R},Prices:Z};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),$=["data-sku"],ee={class:"aspect-square p-2 transition-transform motion-safe:group-hover:scale-110"},te={class:"relative size-full overflow-hidden rounded bg-white group-hover:rounded-none"},oe={key:0,class:"text-xs text-opacity-70"},re={key:1,class:"size-full bg-gradient-to-br from-base-50/20 to-base-100"},se={key:0,class:"uno-bm03rg"},ie={class:"relative z-10 flex grow flex-col justify-between p-4"},ae={class:"pt-2"},le={key:0},ne={key:1,class:"bg-warning-100 text-warning-700 ui-badge"},ce=b("span",{class:"mr-1 inline-block size-4 rounded-full bg-on-primary text-center text-base leading-none text-primary opacity-80"}," + ",-1);function de(t,s,i,e,g,f){const n=I("AImg"),m=I("ALink");return l(),u("article",{ref:"card","data-sku":e.product.sku,class:"group relative mx-auto h-full max-w-[350px] px-0.5 py-3 hover:z-[1]"},[v(m,{href:e.link,prefetch:"visible",class:"flex h-full flex-col overflow-hidden rounded bg-white ring-black/5 group-hover:shadow group-hover:ring-1"},{default:x(()=>[b("div",ee,[b("div",te,[e.images?.length?(l(),u("span",oe,[v(n,{picture:e.images[0],alt:e.title,class:"absolute left-0 top-0 block size-full object-cover"},null,8,["picture","alt"]),!e.isMobile&&e.images[1]&&e.wasHoveredOnce?(l(),A(n,{key:0,picture:e.images[1],alt:e.title,class:"absolute left-0 top-0 z-10 block size-full object-cover text-transparent opacity-0 transition-opacity group-hover:opacity-100 motion-safe:duration-300"},null,8,["picture","alt"])):P("",!0)])):(l(),u("div",re))])]),e.discountPercentage?(l(),u("span",se,[y(" -"),b("strong",null,C(e.discountPercentage),1),y("% ")])):P("",!0),b("div",ie,[(l(),A(B(i.headingTag),{class:S(["line-clamp-2 no-underline ui-link",[e.isActive?"text-base-700":"text-base-500",e.link?"group-hover:text-primary group-hover:underline":null]])},{default:x(()=>[y(C(e.title),1)]),_:1},8,["class"])),b("div",ae,[e.isActive?(l(),u("div",le,[v(e.Prices,{product:e.product},null,8,["product"])])):(l(),u("span",ne,C(e.isInStock?"Inativo":"Sem estoque"),1))]),e.isActive&&!e.hasVariations?(l(),u("button",{key:0,class:"uno-3suct9 ui-btn-sm ui-btn-primary",onClick:s[0]||(s[0]=H(c=>e.addProductToCart(e.product),["stop","prevent"]))},[ce,y(" "+C("Adicionar ao carrinho"))])):P("",!0)])]),_:1},8,["href"])],8,$)}const ue=T(X,[["render",de]]),fe=z({__name:"ProductShelf",props:{isGrid:{type:Boolean},collectionId:{},searchQuery:{},sort:{},title:{},titleLink:{},isShuffle:{type:Boolean},limit:{},page:{},products:{},orderedProductIds:{},isRelatedProducts:{type:Boolean},cmsPreview:{}},async setup(t,{expose:s}){s();const i=t,[e,g]=q(),{title:f,titleLink:n,fetching:m,products:c}=W(i),p=f.value||`Shelf ${M()}`,o={props:i,DefineCarouselControl:e,ReuseCarouselControl:g,title:f,titleLink:n,fetching:m,products:c,listName:p,ProductCard:ue};return Object.defineProperty(o,"__isScriptSetup",{enumerable:!1,value:!0}),o}}),me={class:"ui-section"},he={key:0,class:"mx-auto mb-4 max-w-prose text-center"};function _e(t,s,i,e,g,f){const n=I("ALink"),m=I("CarouselControl");return l(),u("section",me,[e.title?(l(),u("div",he,[b("h3",null,[v(n,{href:e.titleLink,class:S(["text-3xl text-base-700 ui-text-brand",e.titleLink&&"ui-link decoration-primary/60"])},{default:x(()=>[y(C(e.title),1)]),_:1},8,["href","class"])])])):P("",!0),(l(),A(B(i.isGrid?"ul":"Carousel"),{class:S(["group/shelf",i.isGrid&&"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4"])},O({default:x(()=>[(l(!0),u(E,null,G(e.products,c=>(l(),u("li",{key:c._id,class:"shrink-0 basis-1/2 md:basis-1/3 lg:basis-1/4"},[v(e.ProductCard,{product:c,"list-name":e.listName},null,8,["product","list-name"])]))),128))]),_:2},[i.isGrid?void 0:{name:"controls",fn:x(()=>[v(e.DefineCarouselControl,null,{default:x(({isPrev:c})=>[D(v(m,{class:S(["uno-t0rdy7",c?"!-left-4":"!-right-4"]),"is-prev":c},null,8,["class","is-prev"]),[[Q,e.products.length>2]])]),_:1}),v(e.ReuseCarouselControl,{"is-prev":!0}),v(e.ReuseCarouselControl)]),key:"0"}]),1032,["class"])),V(t.$slots,"append")])}const je=T(fe,[["render",_e]]);export{je as default};
|
package/packages/storefront/dist/client/_astro/{SearchModal.DWNSfxML.js → SearchModal.BIrixnFb.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as K}from"./_plugin-vue_export-helper.6K9uDcVo.js";import{a7 as q,a as V,w as N,a8 as Q,d as X,j,k as m,e as y,h as F,i as x,n as T,f as S,F as z,m as O,a0 as R,a1 as W,p as H,$ as U,a9 as Y}from"./sf-utils.C9ygvYIB.js";import{c as Z,g as $}from"./_commonjsHelpers.Cpj98o6Y.js";import{S as ee,s as G}from"./use-analytics.
|
|
1
|
+
import{_ as K}from"./_plugin-vue_export-helper.6K9uDcVo.js";import{a7 as q,a as V,w as N,a8 as Q,d as X,j,k as m,e as y,h as F,i as x,n as T,f as S,F as z,m as O,a0 as R,a1 as W,p as H,$ as U,a9 as Y}from"./sf-utils.C9ygvYIB.js";import{c as Z,g as $}from"./_commonjsHelpers.Cpj98o6Y.js";import{S as ee,s as G}from"./use-analytics.D_peWG3X.js";import te from"./ProductShelf.BKz6WXbp.js";import"./customer-session.B9MvrBAQ.js";import"./index.BCNoXz_Z.js";import"./shopping-cart.D8fbm2Dv.js";import"./price.CHiL6Z1J.js";import"./afetch.DPLba2tr.js";import"./name.Dll7Wwmg.js";import"./i18n.DPcLqMFO.js";import"./index.BgtOIB20.js";import"./Prices.9RhV7hCY.js";import"./modules-info.BswYf_-7.js";import"./format-money.D19_eJVX.js";import"./use-cms-preview.BxKK4a1X.js";import"./use-product-card.BCGHZKB5.js";import"./img.Be85e5da.js";var J={exports:{}};(function(l){(function(n,a){l.exports?l.exports=a():n.Wade=a()})(Z,function(){var n={stopWords:["about","after","all","also","am","an","and","another","any","are","as","at","be","because","been","before","being","between","both","but","by","came","can","come","could","did","do","each","for","from","get","got","has","had","he","have","her","here","him","himself","his","how","if","in","into","is","it","like","make","many","me","might","more","most","much","must","my","never","now","of","on","only","or","other","our","out","over","said","same","see","should","since","some","still","such","take","than","that","the","their","them","then","there","these","they","this","those","through","to","too","under","up","very","was","way","we","well","were","what","where","which","while","who","with","would","you","your","a","i"],punctuationRE:/[.,!?:;"']/g},a=function(e,o){for(var r=o,c=0;c<e.length&&(r=r[e[c]])!==void 0;c++);return r},t=function(e,o,r,c){for(var h=null,i=0;i<e.length;i++){var u=e[i];(h=r[u])===void 0?(r[u]=o.length,o.push({index:u,score:c})):o[h].score+=c}},k=function(e,o,r,c,h){var i=a(e,o);i!==void 0&&i.id!==void 0&&t(i.id,r,c,h)},v=function(e,o,r,c,h){var i=a(e,o);if(i!==void 0)for(var u=[i],g=null,d=0;u.length!==0;){(g=u[d]).id!==void 0&&t(g.id,r,c,h),u.pop(),d--;for(var _ in g)u.push(g[_]),d++}},f=function(e){var o=e.length-1;return e[0]===" "&&(e=e.substring(1)),e[o]===" "&&(e=e.substring(0,o)),e.split(" ")},w=function(e){return e.toLowerCase()},p=function(e){return e.replace(n.punctuationRE,"")},E=function(e){for(var o=f(e),r=o.length;r--!=0;)s.config.stopWords.indexOf(o[r])!==-1&&o.splice(r,1);return o.join(" ")},s=function(e){var o=function(u){var g=o.index,d=s.process(u);if(d===!1)return[];for(var _=f(d),L=_.length,b=L-1,C=1/L,B=[],P={},D=0;D<b;D++)k(_[D],g,B,P,C);return v(_[b],g,B,P,C),B};if(Array.isArray(e)){for(var r=e.length,c=new Array(r),h=null,i=0;i<r;i++)(h=s.process(e[i]))!==!1&&(c[i]=h);o.index=s.index(c),o.data=c}else o.index=e.index,o.data=e.data;return o};return s.pipeline=[w,p,E],s.process=function(e){for(var o=s.pipeline,r=0;r<o.length;r++)e=o[r](e);return e.length!==0&&e},s.index=function(e){for(var o={},r=0;r<e.length;r++){var c=e[r];if(c!==void 0)for(var h=f(c),i=0;i<h.length;i++){for(var u=h[i],g=u.length-1,d=o,_=0;_<g;_++){var L=u[_],b=d[L];b=b===void 0?{}:b,d[L]=b,d=b}var C=u[g];d[C]===void 0?d[C]={id:[r]}:(d=d[C]).id===void 0?d.id=[r]:d.id.push(r)}}return o},s.save=function(e){return{data:e.data,index:e.index}},s.config=n,s.version="0.3.3",s})})(J);var oe=J.exports;const I=$(oe),A=[];["categories","brands","collections"].forEach(l=>{const n=globalThis.$storefront.data[l];if(n)for(let a=0;a<n.length;a++){const t=n[a];t.name&&t.slug&&A.push({text:q(`${t.name} ${t.short_description}`),type:l,data:t})}});let M;A.length&&(globalThis.$storefront.settings.lang==="pt_br"&&(I.config.stopWords=["e","a","o","de","para","com","tem"]),M=I(A.map(({text:l})=>l)));const re=l=>{const n=l.searchEngine||new ee({debounce:l.fetchDebounce||300});n.pageSize.value=l.productsLimit||12,n.isWithCount.value=!0,n.isWithBuckets.value=!1;const a=V(0),t=V([]);N(Q(l,"term"),async v=>{if(n.fetch(v),M){const f=M(q(v));t.value=f.map(({index:w})=>{const{name:p,slug:E}=A[w].data;return{title:p,href:`/${E}`}})}},{immediate:!0}),N(n.meta,()=>{a.value=n.meta.count||0});const k=V([]);return N(G,()=>{k.value=G.filter(v=>v!==l.term)},{immediate:!0}),{searchHistory:k,searchEngine:n,isFetching:n.isFetching,products:n.products,productCount:a,linkHits:t}},ne=X({__name:"SearchModal",props:{term:{},fetchDebounce:{},productsLimit:{},searchEngine:{}},setup(l,{expose:n}){n();const a=l,{searchHistory:t,isFetching:k,products:v,productCount:f,linkHits:w}=re(a),p={props:a,searchHistory:t,isFetching:k,products:v,productCount:f,linkHits:w,get getSearchUrl(){return Y},ProductShelf:te};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),ae={class:"relative"},ie={key:0,class:"grid grid-cols-1 items-center gap-4 bg-base-100/80 p-4 backdrop-blur-md md:grid-cols-2 md:rounded-b lg:mt-5 lg:grid-cols-3 lg:rounded"},se={class:"flex items-center justify-end gap-4 md:order-2"},ce={key:0,class:"text-right text-sm lowercase text-base-900"},le={class:"lg:col-span-2"},de=["href"],ue=S("i",{class:"m-0 i-clock","aria-label":"Buscar novamente"},null,-1);function he(l,n,a,t,k,v){const f=j("ALink"),w=j("Carousel"),p=j("Fade"),E=j("Skeleton");return m(),y("article",ae,[F(p,{slide:"down"},{default:x(()=>[t.linkHits.length?(m(),y("section",{key:0,class:T(["bg-white p-4",!t.isFetching&&t.products.length?"lg:rounded-t":"lg:rounded"])},[S("nav",null,[F(w,{"wrapper-key":a.term,class:"px-6 [&>ul]:gap-3"},{default:x(()=>[(m(!0),y(z,null,O(t.linkHits,({title:s,href:e},o)=>(m(),y("li",{key:o,class:"shrink-0"},[F(f,{href:e,class:"ui-link"},{default:x(()=>[R(W(s),1)]),_:2},1032,["href"])]))),128))]),_:1},8,["wrapper-key"])])],2)):H("",!0)]),_:1}),t.isFetching?(m(),U(E,{key:0,class:"absolute top-0 w-full px-5 pt-20"})):H("",!0),F(p,{"is-leave-to":!1},{default:x(()=>[!t.isFetching&&t.products.length?(m(),U(t.ProductShelf,{key:0,products:t.products,class:T(["m-0 max-w-none bg-white px-4 lg:[&_[data-carousel-control=next]]:!-right-10 lg:[&_[data-carousel-control=previous]]:!-left-10",t.linkHits.length?"lg:rounded-b":"lg:rounded"])},null,8,["products","class"])):H("",!0)]),_:1}),F(p,{"is-leave-to":!1},{default:x(()=>[!t.isFetching&&(t.searchHistory.length||t.productCount>t.products.length)?(m(),y("section",ie,[S("div",se,[t.productCount>1?(m(),y("p",ce,[S("strong",null,W(t.productCount),1),R(" "+W("Itens encontrados"))])):H("",!0),t.productCount>t.products.length?(m(),U(f,{key:1,href:t.getSearchUrl(a.term),prefetch:"visible",class:"w-auto whitespace-nowrap text-center ui-btn ui-btn-primary"},{default:x(()=>[R(W("Ver todos"))]),_:1},8,["href"])):H("",!0)]),S("div",le,[S("nav",null,[F(w,{"wrapper-key":a.term,class:"px-6 [&>ul]:gap-2.5"},{previous:x(()=>[ue]),default:x(()=>[(m(!0),y(z,null,O(t.searchHistory,(s,e)=>(m(),y("li",{key:e,class:"shrink-0"},[S("a",{href:t.getSearchUrl(s),class:"text-sm font-normal text-base-700 ui-link"},W(s),9,de)]))),128))]),_:1},8,["wrapper-key"])])])])):H("",!0)]),_:1})])}const Ae=K(ne,[["render",he]]);export{Ae as default};
|