@soma-vertical-web/multi-lib 0.0.38 → 0.0.39
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/cms/ContentTypes/Header/index.d.ts +1 -1
- package/cms/ContentTypes/Tipbar/Tipbar.d.ts +3 -0
- package/cms/ContentTypes/Tipbar/TipbarScreening.d.ts +3 -0
- package/cms/index.d.ts +1 -0
- package/cms/server.d.ts +7 -4
- package/contexts/contexts/Session.d.ts +5 -0
- package/contexts/contexts/header/UserMenuContext.d.ts +6 -0
- package/contexts/contexts/plp/PLPContext.d.ts +6 -0
- package/contexts/contexts/plp/PLPInfiniteContext.tsx.d.ts +6 -0
- package/contexts/hooks/useOnClickOutside.d.ts +3 -0
- package/contexts/index.d.ts +8 -0
- package/contexts/store/plp.d.ts +3 -0
- package/data/helpers/plp/index.d.ts +81 -0
- package/index.js +20 -20
- package/index.mjs +4277 -3866
- package/index2.js +1 -1
- package/index2.mjs +261 -243
- package/layout/index.d.ts +0 -4
- package/layout/team-component/UserMenu/Composite/Content.d.ts +7 -0
- package/layout/team-component/UserMenu/Composite/Credits.d.ts +7 -0
- package/layout/team-component/UserMenu/Composite/Login.d.ts +10 -0
- package/layout/team-component/UserMenu/Composite/Menu.d.ts +7 -0
- package/layout/team-component/UserMenu/Composite/Modal.d.ts +7 -0
- package/layout/team-component/UserMenu/Composite/Root.d.ts +7 -0
- package/layout/team-component/UserMenu/Composite/Tooltip.d.ts +4 -0
- package/layout/team-component/UserMenu/UserMenu.d.ts +31 -0
- package/layout/team-component/UserMenu/helpers.d.ts +7 -0
- package/layout/team-component/UserMenu/index.d.ts +4 -0
- package/layout/utils/SessionEvent/index.d.ts +1 -0
- package/package.json +1 -1
- package/server.d.ts +2 -5
- package/style.css +1 -1
- package/types/cms/ContentTypes/Tipbar/index.d.ts +9 -0
- package/types/contexts/contexts/plp.d.ts +48 -1
- package/types/contexts/contexts/session.d.ts +84 -0
- package/types/layout/team-components/UserMenu/index.d.ts +60 -0
package/index2.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as n from "yup";
|
|
2
2
|
import { f as oe, r as _, a as ne, b as se, d as ae, e as ie, c as ce, p as le } from "./__vite-browser-external-C4n7rb1H.mjs";
|
|
3
|
-
import { jsxs as ue, Fragment as de, jsx as
|
|
3
|
+
import { jsxs as ue, Fragment as de, jsx as C } from "react/jsx-runtime";
|
|
4
4
|
import { Utils as G, helpers as H } from "@soma-vertical-web/core-components";
|
|
5
5
|
import me from "sanitize-html";
|
|
6
6
|
const d = async (e, t = {}) => {
|
|
7
|
-
const { method: o = "GET", body: r, headers:
|
|
7
|
+
const { method: o = "GET", body: r, headers: s = {}, priority: a = "auto", cache: i = "default" } = t;
|
|
8
8
|
return fetch(e, {
|
|
9
9
|
method: o,
|
|
10
10
|
headers: {
|
|
11
|
-
...
|
|
11
|
+
...s,
|
|
12
12
|
Accept: "application/json",
|
|
13
13
|
"Content-Type": "application/json"
|
|
14
14
|
},
|
|
15
|
-
priority:
|
|
15
|
+
priority: a,
|
|
16
16
|
cache: i,
|
|
17
17
|
...r ? { body: JSON.stringify(r) } : {}
|
|
18
18
|
// not body in get
|
|
@@ -23,13 +23,13 @@ const d = async (e, t = {}) => {
|
|
|
23
23
|
async function pe(e, t = {}) {
|
|
24
24
|
var o;
|
|
25
25
|
try {
|
|
26
|
-
const { abort: r = !1 } = t,
|
|
27
|
-
r && (O.has(e) && ((o = O.get(e)) == null || o.abort(), O.delete(e)), O.set(e,
|
|
28
|
-
const
|
|
26
|
+
const { abort: r = !1 } = t, s = new AbortController();
|
|
27
|
+
r && (O.has(e) && ((o = O.get(e)) == null || o.abort(), O.delete(e)), O.set(e, s));
|
|
28
|
+
const a = d(e, {
|
|
29
29
|
...t,
|
|
30
|
-
...r ? { signal:
|
|
30
|
+
...r ? { signal: s.signal } : {}
|
|
31
31
|
});
|
|
32
|
-
return r && O.delete(e),
|
|
32
|
+
return r && O.delete(e), a;
|
|
33
33
|
} catch (r) {
|
|
34
34
|
if (r.name === "AbortError") {
|
|
35
35
|
console.log(`[REQUEST CANCELLED]: ${e}`);
|
|
@@ -48,9 +48,9 @@ async function fe({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
await ge.validate(t);
|
|
51
|
-
const { country: r, postalCode:
|
|
51
|
+
const { country: r, postalCode: s } = t;
|
|
52
52
|
return await d(
|
|
53
|
-
`${e}/api/checkout/pub/postal-code/${r}/${
|
|
53
|
+
`${e}/api/checkout/pub/postal-code/${r}/${s}`,
|
|
54
54
|
{
|
|
55
55
|
method: "POST",
|
|
56
56
|
body: t,
|
|
@@ -73,7 +73,7 @@ async function x({
|
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
await he.validate(t);
|
|
76
|
-
const { orderFormId: r, sellerCode:
|
|
76
|
+
const { orderFormId: r, sellerCode: s, sellerName: a } = t, i = s ? `${s.trim()} - ${a}` : null;
|
|
77
77
|
return d(
|
|
78
78
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/openTextField`,
|
|
79
79
|
{
|
|
@@ -96,16 +96,16 @@ async function z({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
await Ie.validate(t);
|
|
99
|
-
const { orderFormId: r, sellerCode:
|
|
100
|
-
utmCampaign:
|
|
101
|
-
utmiCampaign:
|
|
99
|
+
const { orderFormId: r, sellerCode: s, marketingData: a } = t, i = s ? {
|
|
100
|
+
utmCampaign: s ? s.toUpperCase() : "",
|
|
101
|
+
utmiCampaign: s ? "codigodavendedora" : "semcodigo"
|
|
102
102
|
} : {};
|
|
103
103
|
return d(
|
|
104
104
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/marketingData`,
|
|
105
105
|
{
|
|
106
106
|
method: "POST",
|
|
107
107
|
body: {
|
|
108
|
-
...
|
|
108
|
+
...a,
|
|
109
109
|
...i
|
|
110
110
|
},
|
|
111
111
|
...o
|
|
@@ -147,9 +147,9 @@ async function Re({
|
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
149
|
await Ce.validate(t);
|
|
150
|
-
const { coupon: r = "", orderFormId:
|
|
150
|
+
const { coupon: r = "", orderFormId: s } = t;
|
|
151
151
|
return d(
|
|
152
|
-
`${e}/api/checkout/pub/orderForm/${
|
|
152
|
+
`${e}/api/checkout/pub/orderForm/${s}/coupons`,
|
|
153
153
|
{
|
|
154
154
|
method: "POST",
|
|
155
155
|
body: { text: r },
|
|
@@ -172,9 +172,9 @@ async function Fe({
|
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
await ve.validate(t);
|
|
175
|
-
const { appId: r = "faststore", orderFormId:
|
|
175
|
+
const { appId: r = "faststore", orderFormId: s, key: a } = t;
|
|
176
176
|
return d(
|
|
177
|
-
`${e}/api/checkout/pub/orderForm/${
|
|
177
|
+
`${e}/api/checkout/pub/orderForm/${s}/customData/${r}/${a}`,
|
|
178
178
|
{
|
|
179
179
|
method: "PUT",
|
|
180
180
|
...o
|
|
@@ -186,16 +186,16 @@ const Oe = n.object().shape({
|
|
|
186
186
|
content: n.object().nullable()
|
|
187
187
|
});
|
|
188
188
|
var V;
|
|
189
|
-
const
|
|
189
|
+
const $e = n.object().shape({
|
|
190
190
|
attachments: (V = n.array().of(Oe)) == null ? void 0 : V.nullable(),
|
|
191
191
|
id: n.string().required("ID of SKU is required"),
|
|
192
192
|
index: n.number().integer().nullable(),
|
|
193
193
|
quantity: n.number().integer().nullable(),
|
|
194
194
|
seller: n.string().required("Seller is required"),
|
|
195
195
|
price: n.number().integer()
|
|
196
|
-
}),
|
|
196
|
+
}), Se = n.object({
|
|
197
197
|
orderFormId: n.string().required("OrderFormId is required"),
|
|
198
|
-
orderItems: n.array().of(
|
|
198
|
+
orderItems: n.array().of($e)
|
|
199
199
|
});
|
|
200
200
|
async function Ee({
|
|
201
201
|
apiUrl: e,
|
|
@@ -206,13 +206,13 @@ async function Ee({
|
|
|
206
206
|
console.error("[ERROR FETCHING] Body is required");
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
await
|
|
210
|
-
const { orderFormId: r, orderItems:
|
|
209
|
+
await Se.validate(t);
|
|
210
|
+
const { orderFormId: r, orderItems: s } = t;
|
|
211
211
|
return d(
|
|
212
212
|
`${e}/api/checkout/pub/orderForm/${r}/items`,
|
|
213
213
|
{
|
|
214
214
|
method: "POST",
|
|
215
|
-
body: { orderItems:
|
|
215
|
+
body: { orderItems: s },
|
|
216
216
|
...o
|
|
217
217
|
}
|
|
218
218
|
);
|
|
@@ -265,12 +265,12 @@ async function je({
|
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
267
|
await Ne.validate(t);
|
|
268
|
-
const { orderFormId: r, orderItems:
|
|
268
|
+
const { orderFormId: r, orderItems: s } = t;
|
|
269
269
|
return d(
|
|
270
270
|
`${e}/api/checkout/pub/orderForm/${r}/items/update`,
|
|
271
271
|
{
|
|
272
272
|
method: "POST",
|
|
273
|
-
body: { orderItems:
|
|
273
|
+
body: { orderItems: s },
|
|
274
274
|
...o
|
|
275
275
|
}
|
|
276
276
|
);
|
|
@@ -310,10 +310,10 @@ async function _e({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
312
|
await De.validate(t);
|
|
313
|
-
const { itemIndex: r, orderFormId:
|
|
313
|
+
const { itemIndex: r, orderFormId: s, id: a, remove: i } = t, c = i ? `/${a}/remove` : "", l = `${e}/api/checkout/pub/orderForm/${s}/items/${r}/offerings${c}`;
|
|
314
314
|
return d(l, {
|
|
315
315
|
method: "POST",
|
|
316
|
-
body: { id:
|
|
316
|
+
body: { id: a },
|
|
317
317
|
...o
|
|
318
318
|
});
|
|
319
319
|
}
|
|
@@ -332,10 +332,10 @@ async function He({
|
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
334
|
await Ge.validate(t);
|
|
335
|
-
const
|
|
335
|
+
const s = new URLSearchParams({
|
|
336
336
|
refreshOutdatedData: "true"
|
|
337
|
-
}),
|
|
338
|
-
return d(
|
|
337
|
+
}), a = t.orderFormId && ((i = r.orderFormPurchaseId) == null ? void 0 : i.value) !== t.orderFormId ? `${e}/api/checkout/pub/orderForm/${t.orderFormId}?${String(s)}` : `${e}/api/checkout/pub/orderForm`;
|
|
338
|
+
return d(a, { method: "GET", ...o });
|
|
339
339
|
}
|
|
340
340
|
const Be = n.object({
|
|
341
341
|
orderFormId: n.string().nullable(),
|
|
@@ -356,12 +356,12 @@ async function Ue({
|
|
|
356
356
|
return;
|
|
357
357
|
}
|
|
358
358
|
await Be.validate(t);
|
|
359
|
-
const { orderFormId: r, ...
|
|
359
|
+
const { orderFormId: r, ...s } = t;
|
|
360
360
|
return d(
|
|
361
361
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/clientProfileData`,
|
|
362
362
|
{
|
|
363
363
|
method: "POST",
|
|
364
|
-
body: { ...
|
|
364
|
+
body: { ...s },
|
|
365
365
|
...o
|
|
366
366
|
}
|
|
367
367
|
);
|
|
@@ -406,10 +406,10 @@ async function xe({
|
|
|
406
406
|
return;
|
|
407
407
|
}
|
|
408
408
|
await Me.validate(t);
|
|
409
|
-
const { country: r, orderFormId:
|
|
409
|
+
const { country: r, orderFormId: s, postalCode: a } = t, i = a ? {
|
|
410
410
|
address: {
|
|
411
411
|
addressType: "residential",
|
|
412
|
-
postalCode:
|
|
412
|
+
postalCode: a,
|
|
413
413
|
country: r
|
|
414
414
|
}
|
|
415
415
|
} : {
|
|
@@ -417,7 +417,7 @@ async function xe({
|
|
|
417
417
|
clearAddressIfPostalCodeNotFound: !0
|
|
418
418
|
};
|
|
419
419
|
return d(
|
|
420
|
-
`${e}/api/checkout/pub/orderForm/${
|
|
420
|
+
`${e}/api/checkout/pub/orderForm/${s}/attachments/shippingData`,
|
|
421
421
|
{
|
|
422
422
|
method: "POST",
|
|
423
423
|
body: i,
|
|
@@ -459,15 +459,15 @@ async function Qe({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
461
|
await ze.validate(t);
|
|
462
|
-
const { orderFormId: r, options:
|
|
462
|
+
const { orderFormId: r, options: s, selectedAddresses: a } = t;
|
|
463
463
|
return d(
|
|
464
464
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/shippingData`,
|
|
465
465
|
{
|
|
466
466
|
method: "POST",
|
|
467
467
|
body: {
|
|
468
|
-
selectedAddresses:
|
|
468
|
+
selectedAddresses: a,
|
|
469
469
|
clearAddressIfPostalCodeNotFound: !1,
|
|
470
|
-
logisticsInfo:
|
|
470
|
+
logisticsInfo: s
|
|
471
471
|
},
|
|
472
472
|
...o
|
|
473
473
|
}
|
|
@@ -487,10 +487,10 @@ async function Ke({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
|
487
487
|
return;
|
|
488
488
|
}
|
|
489
489
|
await Je.validate(t);
|
|
490
|
-
const { country: r = "", geoCoordinates:
|
|
491
|
-
return
|
|
490
|
+
const { country: r = "", geoCoordinates: s, postalCode: a = "" } = t, i = new URLSearchParams({ country: String(r) });
|
|
491
|
+
return a ? i.append("postalCode", a) : i.append(
|
|
492
492
|
"geoCoordinates",
|
|
493
|
-
`${
|
|
493
|
+
`${s == null ? void 0 : s.longitude};${s == null ? void 0 : s.latitude}`
|
|
494
494
|
), await d(
|
|
495
495
|
`${e}/api/checkout/pub/regions/?${i.toString()}`,
|
|
496
496
|
{
|
|
@@ -571,7 +571,7 @@ async function ot({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
|
571
571
|
await rt.validate(t);
|
|
572
572
|
const { ids: r } = t;
|
|
573
573
|
return d(
|
|
574
|
-
`${e}/api/catalog_system/pub/products/search?fq=${r.map((
|
|
574
|
+
`${e}/api/catalog_system/pub/products/search?fq=${r.map((s) => `productId:${s}`).join("&fq=")}`,
|
|
575
575
|
{
|
|
576
576
|
...o
|
|
577
577
|
}
|
|
@@ -603,7 +603,7 @@ const at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
603
603
|
const r = Array.isArray(o) ? o.join(", ") : o;
|
|
604
604
|
return {
|
|
605
605
|
id: 0,
|
|
606
|
-
Title: `${Array.isArray(o) ? o.map((
|
|
606
|
+
Title: `${Array.isArray(o) ? o.map((a) => B(a)).join(",") : B(o)} - ${t.title}`,
|
|
607
607
|
MetaTagDescription: t.description,
|
|
608
608
|
name: r,
|
|
609
609
|
hasChildren: !1,
|
|
@@ -622,12 +622,12 @@ const at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
622
622
|
images: Array.isArray(o) ? [...o] : []
|
|
623
623
|
}
|
|
624
624
|
}), ut = ({ items: e, parent: t, apiUrl: o, find: r }) => {
|
|
625
|
-
const
|
|
625
|
+
const s = e.find(
|
|
626
626
|
(i) => i.url.replace(o, "") === decodeURIComponent(t.toLowerCase())
|
|
627
627
|
);
|
|
628
|
-
return (
|
|
628
|
+
return (s == null ? void 0 : s.children.find(
|
|
629
629
|
(i) => i.name.toLowerCase() === decodeURIComponent(String(r))
|
|
630
|
-
)) ??
|
|
630
|
+
)) ?? s;
|
|
631
631
|
}, dt = (e) => {
|
|
632
632
|
e instanceof Error ? (console.error(`[ERROR CATEGORY INFO]: ${e.message}`), console.error(e.stack)) : console.error("[ERROR CATEGORY INFO]: Unknown error", e);
|
|
633
633
|
}, mt = /* @__PURE__ */ new Set([
|
|
@@ -647,14 +647,14 @@ const at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
647
647
|
(i) => i.sellers.find((c) => c.commertialOffer.IsAvailable)
|
|
648
648
|
).length === 0 || (o == null ? void 0 : o.find((i) => (i == null ? void 0 : i.productId) === (r == null ? void 0 : r.productId))) !== void 0)
|
|
649
649
|
return o;
|
|
650
|
-
const
|
|
650
|
+
const a = r.items[0].images.find(
|
|
651
651
|
(i) => t.includes(i.imageLabel)
|
|
652
652
|
);
|
|
653
653
|
return o.push({
|
|
654
654
|
slug: `/${r.linkText}/p`,
|
|
655
655
|
productId: r == null ? void 0 : r.productId,
|
|
656
|
-
textureImage: (
|
|
657
|
-
textureAlt: (
|
|
656
|
+
textureImage: (a == null ? void 0 : a.imageUrl) ?? "",
|
|
657
|
+
textureAlt: (a == null ? void 0 : a.imageText) ?? ""
|
|
658
658
|
}), o;
|
|
659
659
|
}, []), ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
660
660
|
__proto__: null,
|
|
@@ -667,27 +667,27 @@ const at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
667
667
|
responseAdapter: gt
|
|
668
668
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
669
669
|
async function It({ contentType: e, storeId: t, CMS_PROJECT_NAME: o, NextCookies: r }) {
|
|
670
|
-
const
|
|
670
|
+
const s = await $({
|
|
671
671
|
contentType: e,
|
|
672
672
|
storeId: t,
|
|
673
673
|
CMS_PROJECT_NAME: o,
|
|
674
674
|
NextCookies: r
|
|
675
675
|
});
|
|
676
|
-
if (
|
|
677
|
-
const
|
|
676
|
+
if (s.status === 200) {
|
|
677
|
+
const a = {
|
|
678
678
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
679
679
|
contentType: e,
|
|
680
|
-
data:
|
|
680
|
+
data: s.data
|
|
681
681
|
};
|
|
682
|
-
console.log("Resultado da chamada:",
|
|
682
|
+
console.log("Resultado da chamada:", s);
|
|
683
683
|
const i = `backup-${e}-${Date.now()}.json`;
|
|
684
684
|
return await oe.writeFile(
|
|
685
685
|
`./backups/${i}`,
|
|
686
|
-
JSON.stringify(
|
|
686
|
+
JSON.stringify(a, null, 2),
|
|
687
687
|
"utf-8"
|
|
688
688
|
), { success: !0, fileName: i };
|
|
689
689
|
}
|
|
690
|
-
return { success: !1, error:
|
|
690
|
+
return { success: !1, error: s.error || "No data to backup" };
|
|
691
691
|
}
|
|
692
692
|
async function bt(e) {
|
|
693
693
|
return It(e);
|
|
@@ -697,11 +697,11 @@ async function yt({
|
|
|
697
697
|
documentId: t,
|
|
698
698
|
versionId: o,
|
|
699
699
|
storeId: r,
|
|
700
|
-
CMS_PROJECT_NAME:
|
|
700
|
+
CMS_PROJECT_NAME: s
|
|
701
701
|
}) {
|
|
702
|
-
const
|
|
702
|
+
const a = t && t.length ? `/${t}` : "", i = o && o.length ? `?versionId=${o}` : "";
|
|
703
703
|
return fetch(
|
|
704
|
-
`https://${r}.myvtex.com/_v/cms/api/${
|
|
704
|
+
`https://${r}.myvtex.com/_v/cms/api/${s}/${e}${a}${i}`,
|
|
705
705
|
{ cache: "no-cache" }
|
|
706
706
|
);
|
|
707
707
|
}
|
|
@@ -710,45 +710,45 @@ async function Ct({
|
|
|
710
710
|
documents: t,
|
|
711
711
|
NextCookies: o,
|
|
712
712
|
CMS_PROJECT_NAME: r,
|
|
713
|
-
storeId:
|
|
713
|
+
storeId: s
|
|
714
714
|
}) {
|
|
715
715
|
var i;
|
|
716
|
-
const
|
|
716
|
+
const a = JSON.parse(
|
|
717
717
|
((i = o().get("cms_preview_data")) == null ? void 0 : i.value) ?? "{}"
|
|
718
718
|
);
|
|
719
|
-
if (
|
|
720
|
-
const c =
|
|
721
|
-
`https://${
|
|
719
|
+
if (a && (a == null ? void 0 : a.contentType) === e) {
|
|
720
|
+
const c = a.documentId && a.documentId.length ? `/${a.documentId}` : "", l = a != null && a.versionId && (a != null && a.versionId.length) ? `?versionId=${a == null ? void 0 : a.versionId}` : "", p = await (await fetch(
|
|
721
|
+
`https://${s}.myvtex.com/_v/cms/api/${r}/${e}${c}${l}`,
|
|
722
722
|
{ cache: "no-store" }
|
|
723
723
|
)).json(), u = t.filter(
|
|
724
|
-
(
|
|
724
|
+
(m) => p.id !== m.documentId
|
|
725
725
|
);
|
|
726
|
-
return u.unshift(
|
|
726
|
+
return u.unshift(p), u;
|
|
727
727
|
}
|
|
728
728
|
return t;
|
|
729
729
|
}
|
|
730
|
-
async function
|
|
730
|
+
async function $({
|
|
731
731
|
contentType: e,
|
|
732
732
|
NextCookies: t,
|
|
733
733
|
CMS_PROJECT_NAME: o,
|
|
734
734
|
storeId: r
|
|
735
735
|
}) {
|
|
736
|
-
var g,
|
|
737
|
-
const
|
|
736
|
+
var g, p;
|
|
737
|
+
const s = JSON.parse(
|
|
738
738
|
((g = t().get("cms_preview_data")) == null ? void 0 : g.value) ?? "{}"
|
|
739
|
-
),
|
|
739
|
+
), a = [];
|
|
740
740
|
let i = 1, c = 0, l = !0;
|
|
741
741
|
try {
|
|
742
742
|
do {
|
|
743
|
-
const
|
|
743
|
+
const m = await (await fetch(
|
|
744
744
|
`https://${r}.myvtex.com/_v/cms/api/${o}/${e}?page=${i}`
|
|
745
745
|
)).json();
|
|
746
|
-
i === 1 && (c =
|
|
747
|
-
} while (l &&
|
|
748
|
-
if (
|
|
746
|
+
i === 1 && (c = m.totalItems), (p = m == null ? void 0 : m.data) != null && p.length && a.push(...m.data), l = m.hasNextPage, i++;
|
|
747
|
+
} while (l && a.length < c);
|
|
748
|
+
if (s.previewMode && a.length) {
|
|
749
749
|
const u = await Ct({
|
|
750
750
|
contentType: e,
|
|
751
|
-
documents:
|
|
751
|
+
documents: a,
|
|
752
752
|
NextCookies: t,
|
|
753
753
|
CMS_PROJECT_NAME: o,
|
|
754
754
|
storeId: r
|
|
@@ -759,8 +759,8 @@ async function A({
|
|
|
759
759
|
};
|
|
760
760
|
}
|
|
761
761
|
return {
|
|
762
|
-
status:
|
|
763
|
-
data:
|
|
762
|
+
status: a.length ? 200 : 404,
|
|
763
|
+
data: a
|
|
764
764
|
};
|
|
765
765
|
} catch (u) {
|
|
766
766
|
return { status: "error", data: [], error: u };
|
|
@@ -770,37 +770,37 @@ const Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
770
770
|
__proto__: null,
|
|
771
771
|
cmsBackup: bt,
|
|
772
772
|
getCMSContentType: yt,
|
|
773
|
-
getContentType:
|
|
773
|
+
getContentType: $
|
|
774
774
|
}, Symbol.toStringTag, { value: "Module" })), vt = ({
|
|
775
775
|
slug: e,
|
|
776
776
|
data: t,
|
|
777
777
|
SectionZone: o,
|
|
778
778
|
COMMON_PAGE_COLUMN_GAP: r
|
|
779
779
|
}) => {
|
|
780
|
-
const
|
|
781
|
-
(
|
|
782
|
-
var u,
|
|
783
|
-
return ((
|
|
780
|
+
const s = t == null ? void 0 : t.find(
|
|
781
|
+
(p) => {
|
|
782
|
+
var u, m, h, f;
|
|
783
|
+
return ((m = (u = p.config) == null ? void 0 : u.responsive) == null ? void 0 : m.deviceType) === "desktop" && ((f = (h = p.config) == null ? void 0 : h.seo) == null ? void 0 : f.slug) === e;
|
|
784
784
|
}
|
|
785
|
-
),
|
|
786
|
-
(
|
|
787
|
-
var u,
|
|
788
|
-
return ((
|
|
785
|
+
), a = s == null ? void 0 : s.config.responsive.gapCustom, i = s == null ? void 0 : s.config.responsive.gapSections, c = t == null ? void 0 : t.find(
|
|
786
|
+
(p) => {
|
|
787
|
+
var u, m, h, f;
|
|
788
|
+
return ((m = (u = p.config) == null ? void 0 : u.responsive) == null ? void 0 : m.deviceType) === "mobile" && ((f = (h = p.config) == null ? void 0 : h.seo) == null ? void 0 : f.slug) === e;
|
|
789
789
|
}
|
|
790
790
|
), l = c == null ? void 0 : c.config.responsive.gapCustom, g = c == null ? void 0 : c.config.responsive.gapSections;
|
|
791
791
|
return /* @__PURE__ */ ue(de, { children: [
|
|
792
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ C(
|
|
793
793
|
G.Column,
|
|
794
794
|
{
|
|
795
|
-
gap:
|
|
795
|
+
gap: a && i ? i : r,
|
|
796
796
|
className: H.classNameConcat(
|
|
797
797
|
_["responsive-desktop-flex"],
|
|
798
798
|
"utils-column-modifier"
|
|
799
799
|
),
|
|
800
|
-
children: /* @__PURE__ */
|
|
800
|
+
children: /* @__PURE__ */ C(o, { data: (s == null ? void 0 : s.sections) ?? [] })
|
|
801
801
|
}
|
|
802
802
|
),
|
|
803
|
-
/* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ C(
|
|
804
804
|
G.Column,
|
|
805
805
|
{
|
|
806
806
|
gap: l && g ? g : r,
|
|
@@ -808,61 +808,81 @@ const Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
808
808
|
_["responsive-mobile-flex"],
|
|
809
809
|
"utils-column-modifier"
|
|
810
810
|
),
|
|
811
|
-
children: /* @__PURE__ */
|
|
811
|
+
children: /* @__PURE__ */ C(o, { data: (c == null ? void 0 : c.sections) ?? [] })
|
|
812
812
|
}
|
|
813
813
|
)
|
|
814
814
|
] });
|
|
815
|
-
}, Ft = async ({
|
|
816
|
-
|
|
815
|
+
}, Ft = async ({
|
|
816
|
+
slug: e,
|
|
817
|
+
SectionZone: t,
|
|
818
|
+
COMMON_PAGE_COLUMN_GAP: o,
|
|
819
|
+
...r
|
|
820
|
+
}) => {
|
|
821
|
+
const { data: s } = await $({
|
|
817
822
|
contentType: "common_page",
|
|
818
823
|
...r
|
|
819
824
|
});
|
|
820
|
-
return /* @__PURE__ */
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
825
|
+
return /* @__PURE__ */ C(
|
|
826
|
+
vt,
|
|
827
|
+
{
|
|
828
|
+
data: s,
|
|
829
|
+
slug: e,
|
|
830
|
+
SectionZone: t,
|
|
831
|
+
COMMON_PAGE_COLUMN_GAP: o
|
|
832
|
+
}
|
|
833
|
+
);
|
|
834
|
+
}, Ot = async ({
|
|
835
|
+
children: e,
|
|
836
|
+
ClientHeaderProvider: t,
|
|
837
|
+
...o
|
|
838
|
+
}) => {
|
|
839
|
+
var a, i, c, l;
|
|
840
|
+
const { data: r } = await $({
|
|
824
841
|
contentType: "header",
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
return /* @__PURE__ */ R(
|
|
830
|
-
a,
|
|
842
|
+
...o
|
|
843
|
+
}), s = (a = r[0]) == null ? void 0 : a.sections.map((g) => g.data);
|
|
844
|
+
return /* @__PURE__ */ C(
|
|
845
|
+
t,
|
|
831
846
|
{
|
|
832
847
|
headerData: {
|
|
833
|
-
...(
|
|
834
|
-
subMenus:
|
|
835
|
-
categories: ((
|
|
836
|
-
navigationLinks: ((
|
|
848
|
+
...(i = r[0]) == null ? void 0 : i.layerConfig.config,
|
|
849
|
+
subMenus: s ?? [],
|
|
850
|
+
categories: ((c = r[0]) == null ? void 0 : c.categories.categories.items) ?? [],
|
|
851
|
+
navigationLinks: ((l = r[0]) == null ? void 0 : l.navigationLinks.navigationLinks.items) ?? []
|
|
837
852
|
},
|
|
838
853
|
children: e
|
|
839
854
|
}
|
|
840
855
|
);
|
|
841
|
-
},
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
856
|
+
}, $t = async ({
|
|
857
|
+
ClientTipbarContent: e,
|
|
858
|
+
...t
|
|
859
|
+
}) => {
|
|
860
|
+
const { data: o } = await $({
|
|
861
|
+
contentType: "tipbar",
|
|
862
|
+
...t
|
|
863
|
+
});
|
|
864
|
+
return /* @__PURE__ */ C(e, { data: o });
|
|
865
|
+
}, St = { CommonPageContent: Ft, HeaderContent: Ot, TipbarContent: $t }, tr = { Components: St }, Et = n.object({
|
|
846
866
|
query: n.string()
|
|
847
867
|
});
|
|
848
|
-
async function
|
|
868
|
+
async function Tt({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
849
869
|
if (!t) {
|
|
850
870
|
console.error("[ERROR FETCHING] Body is required");
|
|
851
871
|
return;
|
|
852
872
|
}
|
|
853
|
-
await
|
|
854
|
-
const { query: r = "" } = t,
|
|
873
|
+
await Et.validate(t);
|
|
874
|
+
const { query: r = "" } = t, s = new URLSearchParams({ query: r });
|
|
855
875
|
return d(
|
|
856
|
-
`${e}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${
|
|
876
|
+
`${e}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${s.toString()}`,
|
|
857
877
|
{
|
|
858
878
|
...o
|
|
859
879
|
}
|
|
860
880
|
);
|
|
861
881
|
}
|
|
862
|
-
const
|
|
882
|
+
const qt = (e, t) => me(e, t), At = (e) => ({
|
|
863
883
|
...e,
|
|
864
|
-
description: e.description ?
|
|
865
|
-
}),
|
|
884
|
+
description: e.description ? qt(e.description) : e.description
|
|
885
|
+
}), Pt = ({
|
|
866
886
|
offer: e,
|
|
867
887
|
seller: t,
|
|
868
888
|
product: o
|
|
@@ -872,21 +892,21 @@ const Tt = (e, t) => me(e, t), qt = (e) => ({
|
|
|
872
892
|
seller: t
|
|
873
893
|
}), Q = (e, t) => ({
|
|
874
894
|
...e,
|
|
875
|
-
isVariantOf:
|
|
876
|
-
}),
|
|
895
|
+
isVariantOf: At(t)
|
|
896
|
+
}), Nt = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", T = (e) => e.AvailableQuantity > 0, U = (e) => e.spotPrice ?? 0, jt = (e) => e.Price ?? 0, J = (e, t) => T(e) && !T(t) ? -1 : !T(e) && T(t) ? 1 : U(e) - U(t), kt = (e, t) => {
|
|
877
897
|
let o = 0;
|
|
878
898
|
for (let r = 1; r < e.length; r++)
|
|
879
899
|
t(e[o], e[r]) > 0 && (o = r);
|
|
880
900
|
return e[o];
|
|
881
901
|
}, K = (e) => {
|
|
882
902
|
const t = e.flatMap(
|
|
883
|
-
(r) => r.sellers.map((
|
|
884
|
-
offer:
|
|
903
|
+
(r) => r.sellers.map((s) => ({
|
|
904
|
+
offer: s.commertialOffer,
|
|
885
905
|
sku: r
|
|
886
906
|
}))
|
|
887
|
-
), o =
|
|
907
|
+
), o = kt(
|
|
888
908
|
t,
|
|
889
|
-
({ offer: r }, { offer:
|
|
909
|
+
({ offer: r }, { offer: s }) => J(r, s)
|
|
890
910
|
);
|
|
891
911
|
return o ? o.sku : e[0];
|
|
892
912
|
}, Y = (e) => e.map(
|
|
@@ -895,48 +915,48 @@ const Tt = (e, t) => me(e, t), qt = (e) => ({
|
|
|
895
915
|
url: t.replace("vteximg.com.br", "vtexassets.com"),
|
|
896
916
|
keywords: r
|
|
897
917
|
})
|
|
898
|
-
),
|
|
918
|
+
), q = {
|
|
899
919
|
attachment: "ATTACHMENT",
|
|
900
920
|
specification: "SPECIFICATION",
|
|
901
921
|
attribute: "ATTRIBUTE"
|
|
902
|
-
},
|
|
922
|
+
}, wt = (e) => ({
|
|
903
923
|
name: e.name,
|
|
904
924
|
value: e.content,
|
|
905
|
-
valueReference:
|
|
906
|
-
}),
|
|
925
|
+
valueReference: q.attachment
|
|
926
|
+
}), Dt = (e) => ({
|
|
907
927
|
propertyID: e.id,
|
|
908
928
|
name: e.name,
|
|
909
929
|
value: e.value,
|
|
910
930
|
valueReference: {
|
|
911
|
-
valueReference:
|
|
931
|
+
valueReference: q.attribute,
|
|
912
932
|
visible: e.visible
|
|
913
933
|
}
|
|
914
|
-
}),
|
|
934
|
+
}), A = (e, t, o) => {
|
|
915
935
|
const r = e.flatMap(({ name: i, values: c }) => c ? c.map((l) => ({
|
|
916
936
|
name: i,
|
|
917
937
|
value: l,
|
|
918
|
-
valueReference:
|
|
938
|
+
valueReference: q.specification
|
|
919
939
|
})) : {
|
|
920
940
|
name: i,
|
|
921
941
|
value: "",
|
|
922
|
-
valueReference:
|
|
923
|
-
}),
|
|
942
|
+
valueReference: q.specification
|
|
943
|
+
}), s = Array.isArray(o) ? o.map(wt) : [], a = t ? t.map(Dt) : [];
|
|
924
944
|
return [
|
|
925
945
|
...r,
|
|
926
|
-
...
|
|
927
|
-
...
|
|
946
|
+
...s,
|
|
947
|
+
...a
|
|
928
948
|
];
|
|
929
|
-
}, L = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a",
|
|
949
|
+
}, L = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", _t = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", Gt = (e) => {
|
|
930
950
|
let t = e.slice(0);
|
|
931
951
|
for (let o = 0; o < L.length; o++)
|
|
932
952
|
t = t.replace(
|
|
933
953
|
new RegExp(L.charAt(o), "g"),
|
|
934
|
-
|
|
954
|
+
_t.charAt(o)
|
|
935
955
|
);
|
|
936
956
|
return t;
|
|
937
|
-
},
|
|
957
|
+
}, Ht = (e) => e.replace(/[·/_,:]/, "-"), W = (e) => {
|
|
938
958
|
const o = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}|><=_^]/g, "-");
|
|
939
|
-
return Gt(
|
|
959
|
+
return Ht(Gt(o)).toLowerCase();
|
|
940
960
|
}, X = (e) => `/${e}/p`, Z = (e) => {
|
|
941
961
|
const t = Math.max(
|
|
942
962
|
...e.map((r) => r.NumberOfInstallments)
|
|
@@ -952,38 +972,38 @@ const Tt = (e, t) => me(e, t), qt = (e) => ({
|
|
|
952
972
|
price: 0,
|
|
953
973
|
listPrice: 0,
|
|
954
974
|
sellerDefault: !1
|
|
955
|
-
},
|
|
956
|
-
(
|
|
957
|
-
offer:
|
|
958
|
-
seller:
|
|
975
|
+
}, s = e.map(
|
|
976
|
+
(a) => Pt({
|
|
977
|
+
offer: a.commertialOffer,
|
|
978
|
+
seller: a,
|
|
959
979
|
product: t
|
|
960
980
|
})
|
|
961
|
-
).sort(J).map((
|
|
962
|
-
availability:
|
|
963
|
-
listPrice:
|
|
964
|
-
price:
|
|
965
|
-
priceValidUntil:
|
|
981
|
+
).sort(J).map((a) => (a.seller.sellerId === "1" && a.AvailableQuantity > 0 && (o.price = a.Price, o.listPrice = a.ListPrice, o.sellerDefault = !0), {
|
|
982
|
+
availability: a.AvailableQuantity > 0,
|
|
983
|
+
listPrice: a.ListPrice,
|
|
984
|
+
price: jt(a),
|
|
985
|
+
priceValidUntil: a.PriceValidUntil,
|
|
966
986
|
priceCurrency: "BRL",
|
|
967
|
-
installments:
|
|
968
|
-
lowPrice:
|
|
969
|
-
quantity:
|
|
987
|
+
installments: a.Installments,
|
|
988
|
+
lowPrice: a.spotPrice,
|
|
989
|
+
quantity: a.AvailableQuantity,
|
|
970
990
|
seller: {
|
|
971
|
-
identifier:
|
|
991
|
+
identifier: a.seller.sellerId
|
|
972
992
|
}
|
|
973
993
|
}));
|
|
974
994
|
return {
|
|
975
|
-
lowPrice: o.sellerDefault ? o.price :
|
|
976
|
-
highPrice: o.sellerDefault ? o.listPrice :
|
|
977
|
-
offers:
|
|
995
|
+
lowPrice: o.sellerDefault ? o.price : s[0].price,
|
|
996
|
+
highPrice: o.sellerDefault ? o.listPrice : s[0].listPrice,
|
|
997
|
+
offers: s
|
|
978
998
|
};
|
|
979
999
|
}, te = (e) => {
|
|
980
|
-
const { attributes: t, itemId: o, name: r, sellers:
|
|
1000
|
+
const { attributes: t, itemId: o, name: r, sellers: s, variations: a } = e;
|
|
981
1001
|
return {
|
|
982
|
-
additionalProperty:
|
|
1002
|
+
additionalProperty: A(a, t, []),
|
|
983
1003
|
name: r,
|
|
984
1004
|
offers: {
|
|
985
|
-
offers:
|
|
986
|
-
availability:
|
|
1005
|
+
offers: s.map(({ sellerId: i, commertialOffer: c }) => ({
|
|
1006
|
+
availability: Nt(c.AvailableQuantity > 0),
|
|
987
1007
|
listPrice: c.ListPrice,
|
|
988
1008
|
price: c.Price,
|
|
989
1009
|
quantity: c.AvailableQuantity,
|
|
@@ -995,45 +1015,45 @@ const Tt = (e, t) => me(e, t), qt = (e) => ({
|
|
|
995
1015
|
sku: o
|
|
996
1016
|
// slug: getSlug('', itemId), // getSlug('', itemId) que tipo de slug é esse?
|
|
997
1017
|
};
|
|
998
|
-
},
|
|
1018
|
+
}, Bt = (e) => {
|
|
999
1019
|
var v;
|
|
1000
1020
|
const {
|
|
1001
1021
|
attributes: t,
|
|
1002
1022
|
referenceId: o,
|
|
1003
1023
|
isVariantOf: r,
|
|
1004
|
-
images:
|
|
1005
|
-
itemId:
|
|
1024
|
+
images: s,
|
|
1025
|
+
itemId: a,
|
|
1006
1026
|
name: i,
|
|
1007
1027
|
sellers: c,
|
|
1008
1028
|
videos: l,
|
|
1009
1029
|
variations: g
|
|
1010
1030
|
} = e, {
|
|
1011
|
-
brand:
|
|
1031
|
+
brand: p,
|
|
1012
1032
|
categories: u,
|
|
1013
|
-
categoriesIds:
|
|
1033
|
+
categoriesIds: m,
|
|
1014
1034
|
description: h,
|
|
1015
1035
|
linkText: f,
|
|
1016
1036
|
productClusters: P,
|
|
1017
1037
|
clusterHighlights: S,
|
|
1018
|
-
productName:
|
|
1038
|
+
productName: E,
|
|
1019
1039
|
properties: N,
|
|
1020
1040
|
productId: j
|
|
1021
1041
|
} = r, k = u.slice().reverse(), y = ee(c, e.isVariantOf), w = Z(y.offers[0].installments);
|
|
1022
1042
|
return {
|
|
1023
|
-
sku:
|
|
1043
|
+
sku: a,
|
|
1024
1044
|
gtin: ((v = o[0]) == null ? void 0 : v.Value) ?? "",
|
|
1025
|
-
name:
|
|
1045
|
+
name: E ?? i,
|
|
1026
1046
|
description: h,
|
|
1027
1047
|
releaseDate: r.releaseDate ?? "",
|
|
1028
1048
|
slug: f,
|
|
1029
1049
|
video: l[0],
|
|
1030
1050
|
categories: u,
|
|
1031
|
-
categoriesIds:
|
|
1051
|
+
categoriesIds: m,
|
|
1032
1052
|
id: j,
|
|
1033
|
-
brand: { name:
|
|
1053
|
+
brand: { name: p, brandName: p },
|
|
1034
1054
|
seo: {
|
|
1035
1055
|
description: h,
|
|
1036
|
-
title:
|
|
1056
|
+
title: E,
|
|
1037
1057
|
canonical: X(f)
|
|
1038
1058
|
},
|
|
1039
1059
|
cluster: {
|
|
@@ -1045,9 +1065,9 @@ const Tt = (e, t) => me(e, t), qt = (e) => ({
|
|
|
1045
1065
|
breadcrumbList: {
|
|
1046
1066
|
itemListElement: [
|
|
1047
1067
|
...k.map((I, F) => {
|
|
1048
|
-
const b = I.split("/"),
|
|
1068
|
+
const b = I.split("/"), R = b[b.length - 2], D = b.map(W).join("/");
|
|
1049
1069
|
return {
|
|
1050
|
-
name:
|
|
1070
|
+
name: R,
|
|
1051
1071
|
item: D,
|
|
1052
1072
|
position: F + 1
|
|
1053
1073
|
};
|
|
@@ -1060,41 +1080,41 @@ const Tt = (e, t) => me(e, t), qt = (e) => ({
|
|
|
1060
1080
|
],
|
|
1061
1081
|
numberOfItems: u.length
|
|
1062
1082
|
},
|
|
1063
|
-
image: Y(
|
|
1083
|
+
image: Y(s),
|
|
1064
1084
|
offers: y,
|
|
1065
|
-
additionalProperty:
|
|
1085
|
+
additionalProperty: A(g, t, []),
|
|
1066
1086
|
isVariantOf: {
|
|
1067
1087
|
productGroupID: r.productId,
|
|
1068
1088
|
hasVariant: r.items.map((I) => te(I))
|
|
1069
1089
|
},
|
|
1070
1090
|
installments: w
|
|
1071
1091
|
};
|
|
1072
|
-
},
|
|
1092
|
+
}, Ut = (e) => {
|
|
1073
1093
|
var v;
|
|
1074
1094
|
const {
|
|
1075
1095
|
attributes: t,
|
|
1076
1096
|
referenceId: o,
|
|
1077
1097
|
isVariantOf: r,
|
|
1078
|
-
images:
|
|
1079
|
-
itemId:
|
|
1098
|
+
images: s,
|
|
1099
|
+
itemId: a,
|
|
1080
1100
|
name: i,
|
|
1081
1101
|
sellers: c,
|
|
1082
1102
|
Videos: l,
|
|
1083
1103
|
variations: g
|
|
1084
1104
|
} = e, {
|
|
1085
|
-
brand:
|
|
1105
|
+
brand: p,
|
|
1086
1106
|
categories: u,
|
|
1087
|
-
categoriesIds:
|
|
1107
|
+
categoriesIds: m,
|
|
1088
1108
|
description: h,
|
|
1089
1109
|
linkText: f,
|
|
1090
1110
|
productClusters: P,
|
|
1091
1111
|
productName: S,
|
|
1092
|
-
Coleção:
|
|
1112
|
+
Coleção: E,
|
|
1093
1113
|
"ID Coleção": N,
|
|
1094
1114
|
productId: j
|
|
1095
1115
|
} = r, k = u.slice().reverse(), y = ee(c, e.isVariantOf), w = Z(y.offers[0].installments);
|
|
1096
1116
|
return {
|
|
1097
|
-
sku:
|
|
1117
|
+
sku: a,
|
|
1098
1118
|
gtin: ((v = o[0]) == null ? void 0 : v.Value) ?? "",
|
|
1099
1119
|
name: S ?? i,
|
|
1100
1120
|
description: h,
|
|
@@ -1102,11 +1122,11 @@ const Tt = (e, t) => me(e, t), qt = (e) => ({
|
|
|
1102
1122
|
slug: f,
|
|
1103
1123
|
video: l[0],
|
|
1104
1124
|
categories: u,
|
|
1105
|
-
categoriesIds:
|
|
1106
|
-
collection:
|
|
1125
|
+
categoriesIds: m,
|
|
1126
|
+
collection: E,
|
|
1107
1127
|
collectionId: N,
|
|
1108
1128
|
id: j,
|
|
1109
|
-
brand: { name:
|
|
1129
|
+
brand: { name: p, brandName: p },
|
|
1110
1130
|
seo: {
|
|
1111
1131
|
description: h,
|
|
1112
1132
|
title: S,
|
|
@@ -1121,9 +1141,9 @@ const Tt = (e, t) => me(e, t), qt = (e) => ({
|
|
|
1121
1141
|
breadcrumbList: {
|
|
1122
1142
|
itemListElement: [
|
|
1123
1143
|
...k.map((I, F) => {
|
|
1124
|
-
const b = I.split("/"),
|
|
1144
|
+
const b = I.split("/"), R = b[b.length - 2], D = b.map(W).join("/");
|
|
1125
1145
|
return {
|
|
1126
|
-
name:
|
|
1146
|
+
name: R,
|
|
1127
1147
|
item: D,
|
|
1128
1148
|
position: F + 1
|
|
1129
1149
|
};
|
|
@@ -1136,19 +1156,19 @@ const Tt = (e, t) => me(e, t), qt = (e) => ({
|
|
|
1136
1156
|
],
|
|
1137
1157
|
numberOfItems: u.length
|
|
1138
1158
|
},
|
|
1139
|
-
image: Y(
|
|
1159
|
+
image: Y(s),
|
|
1140
1160
|
offers: y,
|
|
1141
|
-
additionalProperty:
|
|
1161
|
+
additionalProperty: A(g, t, []),
|
|
1142
1162
|
isVariantOf: {
|
|
1143
1163
|
productGroupID: r.productId,
|
|
1144
1164
|
hasVariant: r.items.map((I) => {
|
|
1145
|
-
const { variations: F } = I, b = F.map((
|
|
1146
|
-
name:
|
|
1147
|
-
values: I[
|
|
1165
|
+
const { variations: F } = I, b = F.map((R) => ({
|
|
1166
|
+
name: R,
|
|
1167
|
+
values: I[R]
|
|
1148
1168
|
}));
|
|
1149
1169
|
return {
|
|
1150
1170
|
...te(I),
|
|
1151
|
-
additionalProperty:
|
|
1171
|
+
additionalProperty: A(
|
|
1152
1172
|
b,
|
|
1153
1173
|
t,
|
|
1154
1174
|
[]
|
|
@@ -1158,27 +1178,27 @@ const Tt = (e, t) => me(e, t), qt = (e) => ({
|
|
|
1158
1178
|
},
|
|
1159
1179
|
installments: w
|
|
1160
1180
|
};
|
|
1161
|
-
},
|
|
1181
|
+
}, Lt = n.array().of(n.object({
|
|
1162
1182
|
key: n.string().required(),
|
|
1163
1183
|
value: n.string().required()
|
|
1164
1184
|
})).required("Facets are required");
|
|
1165
|
-
async function
|
|
1185
|
+
async function Vt({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
1166
1186
|
if (!t) {
|
|
1167
1187
|
console.error("[ERROR FETCHING] Body is required");
|
|
1168
1188
|
return;
|
|
1169
1189
|
}
|
|
1170
|
-
await
|
|
1171
|
-
const r = new URLSearchParams({}),
|
|
1190
|
+
await Lt.validate(t);
|
|
1191
|
+
const r = new URLSearchParams({}), s = t.map(({ key: i, value: c }) => `${i}/${c}`).join("/");
|
|
1172
1192
|
ne(t, r);
|
|
1173
|
-
const
|
|
1174
|
-
return d(
|
|
1193
|
+
const a = `${e}/api/catalog_system/pub/products/crossselling/${s}`;
|
|
1194
|
+
return d(a, {
|
|
1175
1195
|
cache: "no-store",
|
|
1176
1196
|
...o
|
|
1177
1197
|
}).then((i) => i.map((l) => {
|
|
1178
1198
|
const g = K(l.items);
|
|
1179
1199
|
return g && Q(g, l);
|
|
1180
1200
|
}).filter((l) => !!l).map((l) => ({
|
|
1181
|
-
node:
|
|
1201
|
+
node: Ut(l)
|
|
1182
1202
|
})));
|
|
1183
1203
|
}
|
|
1184
1204
|
const re = ({
|
|
@@ -1192,25 +1212,25 @@ const re = ({
|
|
|
1192
1212
|
return;
|
|
1193
1213
|
}
|
|
1194
1214
|
const {
|
|
1195
|
-
query:
|
|
1196
|
-
page:
|
|
1215
|
+
query: s = "",
|
|
1216
|
+
page: a = 1,
|
|
1197
1217
|
count: i,
|
|
1198
1218
|
sort: c = "",
|
|
1199
1219
|
facets: l = [],
|
|
1200
1220
|
type: g,
|
|
1201
|
-
hideUnavailableItems:
|
|
1221
|
+
hideUnavailableItems: p = !0,
|
|
1202
1222
|
locale: u = ""
|
|
1203
|
-
} = t,
|
|
1204
|
-
page:
|
|
1223
|
+
} = t, m = new URLSearchParams({
|
|
1224
|
+
page: a.toString(),
|
|
1205
1225
|
count: (i == null ? void 0 : i.toString()) ?? (r == null ? void 0 : r.ITEMS_PER_PAGE) ?? 24,
|
|
1206
|
-
query:
|
|
1226
|
+
query: s,
|
|
1207
1227
|
sort: c,
|
|
1208
1228
|
locale: u
|
|
1209
1229
|
});
|
|
1210
|
-
|
|
1230
|
+
p !== void 0 && m.append("hideUnavailableItems", p.toString());
|
|
1211
1231
|
const h = l.map((f) => `${f.key}/${f.value}`).join("/") ?? "";
|
|
1212
1232
|
return pe(
|
|
1213
|
-
`${e}/api/io/_v/api/intelligent-search/${g}/${h}?${
|
|
1233
|
+
`${e}/api/io/_v/api/intelligent-search/${g}/${h}?${m.toString()}`,
|
|
1214
1234
|
{
|
|
1215
1235
|
headers: {
|
|
1216
1236
|
Accept: "application/json",
|
|
@@ -1220,7 +1240,7 @@ const re = ({
|
|
|
1220
1240
|
}
|
|
1221
1241
|
);
|
|
1222
1242
|
};
|
|
1223
|
-
async function
|
|
1243
|
+
async function Mt({ body: e, extraData: t, ...o }) {
|
|
1224
1244
|
if (!e) {
|
|
1225
1245
|
console.error("[ERROR FETCHING] Body is required");
|
|
1226
1246
|
return;
|
|
@@ -1232,31 +1252,31 @@ async function Vt({ body: e, extraData: t, ...o }) {
|
|
|
1232
1252
|
},
|
|
1233
1253
|
extraData: t,
|
|
1234
1254
|
...o
|
|
1235
|
-
}),
|
|
1255
|
+
}), s = (r == null ? void 0 : r.products.map((c) => {
|
|
1236
1256
|
const l = K(c.items);
|
|
1237
1257
|
return l && Q(l, c);
|
|
1238
1258
|
}).filter((c) => !!c)) ?? [], {
|
|
1239
|
-
pagination:
|
|
1259
|
+
pagination: a,
|
|
1240
1260
|
recordsFiltered: i
|
|
1241
1261
|
} = r;
|
|
1242
1262
|
return {
|
|
1243
1263
|
data: {
|
|
1244
1264
|
pagination: {
|
|
1245
|
-
nextPage:
|
|
1246
|
-
previousPage:
|
|
1265
|
+
nextPage: a.after.length > 0,
|
|
1266
|
+
previousPage: a.before.length > 0,
|
|
1247
1267
|
startCursor: "0",
|
|
1248
1268
|
endCursor: i.toString(),
|
|
1249
1269
|
count: i,
|
|
1250
|
-
total:
|
|
1270
|
+
total: a.count
|
|
1251
1271
|
},
|
|
1252
|
-
products:
|
|
1253
|
-
node:
|
|
1272
|
+
products: s.map((c, l) => ({
|
|
1273
|
+
node: Bt(c),
|
|
1254
1274
|
cursor: l.toString()
|
|
1255
1275
|
}))
|
|
1256
1276
|
}
|
|
1257
1277
|
};
|
|
1258
1278
|
}
|
|
1259
|
-
async function
|
|
1279
|
+
async function xt({ body: e, extraData: t, ...o }) {
|
|
1260
1280
|
if (!e) {
|
|
1261
1281
|
console.error("[ERROR FETCHING] Body is required");
|
|
1262
1282
|
return;
|
|
@@ -1276,53 +1296,51 @@ async function Mt({ body: e, extraData: t, ...o }) {
|
|
|
1276
1296
|
}
|
|
1277
1297
|
};
|
|
1278
1298
|
}
|
|
1279
|
-
const
|
|
1299
|
+
const zt = n.object({
|
|
1280
1300
|
query: n.string().optional(),
|
|
1281
1301
|
locale: n.string().optional()
|
|
1282
1302
|
});
|
|
1283
|
-
async function
|
|
1303
|
+
async function Qt({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
1284
1304
|
if (!t) {
|
|
1285
1305
|
console.error("[ERROR FETCHING] Body is required");
|
|
1286
1306
|
return;
|
|
1287
1307
|
}
|
|
1288
|
-
await
|
|
1289
|
-
const { query: r = "", locale:
|
|
1308
|
+
await zt.validate(t);
|
|
1309
|
+
const { query: r = "", locale: s = "default_locale" } = t, a = new URLSearchParams({ query: r, locale: s });
|
|
1290
1310
|
return d(
|
|
1291
|
-
`${e}/api/io/_v/api/intelligent-search/search_suggestions?${
|
|
1311
|
+
`${e}/api/io/_v/api/intelligent-search/search_suggestions?${a.toString()}`,
|
|
1292
1312
|
{
|
|
1293
1313
|
...o
|
|
1294
1314
|
}
|
|
1295
1315
|
);
|
|
1296
1316
|
}
|
|
1297
|
-
async function
|
|
1317
|
+
async function Jt({ apiUrl: e }) {
|
|
1298
1318
|
return d(`${e}/api/io/_v/api/intelligent-search/top_searches`);
|
|
1299
1319
|
}
|
|
1300
|
-
const
|
|
1320
|
+
const Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1301
1321
|
__proto__: null,
|
|
1302
|
-
getSearchAutoCompleteSuggestions:
|
|
1303
|
-
getSearchCrossellingProducts:
|
|
1304
|
-
getSearchFacets:
|
|
1305
|
-
getSearchProducts:
|
|
1306
|
-
getSearchSuggestedTerms:
|
|
1307
|
-
getSearchTopSearchs:
|
|
1308
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1322
|
+
getSearchAutoCompleteSuggestions: Tt,
|
|
1323
|
+
getSearchCrossellingProducts: Vt,
|
|
1324
|
+
getSearchFacets: xt,
|
|
1325
|
+
getSearchProducts: Mt,
|
|
1326
|
+
getSearchSuggestedTerms: Qt,
|
|
1327
|
+
getSearchTopSearchs: Jt
|
|
1328
|
+
}, Symbol.toStringTag, { value: "Module" })), Yt = {
|
|
1309
1329
|
parseSearchState: le,
|
|
1310
1330
|
convertSearchParams: ce,
|
|
1311
1331
|
filterNonRootFacets: ie,
|
|
1312
1332
|
filterNonCategorySelected: ae
|
|
1313
|
-
},
|
|
1333
|
+
}, rr = {
|
|
1314
1334
|
checkout: Ze,
|
|
1315
1335
|
catalog: at,
|
|
1316
1336
|
cms: Rt,
|
|
1317
|
-
search: Jt
|
|
1318
|
-
}, tr = {
|
|
1319
|
-
catalog: ht,
|
|
1320
1337
|
search: Kt
|
|
1321
|
-
},
|
|
1322
|
-
|
|
1338
|
+
}, or = {
|
|
1339
|
+
catalog: ht,
|
|
1340
|
+
search: Yt
|
|
1323
1341
|
};
|
|
1324
1342
|
export {
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1343
|
+
rr as serverAPIs,
|
|
1344
|
+
tr as serverCMS,
|
|
1345
|
+
or as serverHelpers
|
|
1328
1346
|
};
|