@soma-vertical-web/multi-lib 0.0.40 → 0.0.41
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/Footer-COiI-tye.mjs +7049 -0
- package/Footer-okPVOqRy.js +41 -0
- package/cms/ContentTypes/Footer/Footer.d.ts +1 -1
- package/cms/index.d.ts +1 -0
- package/cms/server.d.ts +2 -0
- package/contexts/index.d.ts +4 -0
- package/data/api/user/index.d.ts +3 -0
- package/index.js +3 -43
- package/index.mjs +4525 -11394
- package/index2.js +1 -1
- package/index2.mjs +620 -500
- package/layout/team-component/ProductList/Composite/Banner.d.ts +7 -0
- package/layout/team-component/ProductList/Composite/Card/Actions.d.ts +7 -0
- package/layout/team-component/ProductList/Composite/Card/Card.d.ts +7 -0
- package/layout/team-component/ProductList/Composite/Card/index.d.ts +1 -0
- package/layout/team-component/ProductList/Composite/Root.d.ts +7 -0
- package/layout/team-component/ProductList/ProductList.d.ts +17 -0
- package/layout/team-component/ProductList/helpers.d.ts +13 -0
- package/layout/team-component/ProductList/index.d.ts +2 -0
- package/package.json +1 -1
- package/style.css +1 -1
- package/types/layout/templates/PLP/index.d.ts +8 -0
package/index2.mjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import * as n from "yup";
|
|
2
|
-
import {
|
|
3
|
-
import { jsxs as
|
|
4
|
-
import { Utils as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
const { method: o = "GET", body: r, headers:
|
|
2
|
+
import { R as ae, C as N, F as ie, H as ce, t as V, T as le, V as ue, W as de, X as me, n as pe, p as fe } from "./Footer-COiI-tye.mjs";
|
|
3
|
+
import { jsxs as Q, Fragment as G, jsx as I } from "react/jsx-runtime";
|
|
4
|
+
import { Utils as w, helpers as B } from "@soma-vertical-web/core-components";
|
|
5
|
+
import ge from "sanitize-html";
|
|
6
|
+
const f = async (e, t = {}) => {
|
|
7
|
+
const { method: o = "GET", body: r, headers: a = {}, priority: s = "auto", cache: i = "default" } = t;
|
|
8
8
|
return fetch(e, {
|
|
9
9
|
method: o,
|
|
10
10
|
headers: {
|
|
11
|
-
...
|
|
11
|
+
...a,
|
|
12
12
|
Accept: "application/json",
|
|
13
13
|
"Content-Type": "application/json"
|
|
14
14
|
},
|
|
15
|
-
priority:
|
|
15
|
+
priority: s,
|
|
16
16
|
cache: i,
|
|
17
17
|
...r ? { body: JSON.stringify(r) } : {}
|
|
18
18
|
// not body in get
|
|
19
19
|
}).then((c) => c.json()).catch((c) => {
|
|
20
20
|
console.error("[ERROR FETCH VTEX]", c);
|
|
21
21
|
});
|
|
22
|
-
},
|
|
23
|
-
async function
|
|
22
|
+
}, A = /* @__PURE__ */ new Map();
|
|
23
|
+
async function he(e, t = {}) {
|
|
24
24
|
var o;
|
|
25
25
|
try {
|
|
26
|
-
const { abort: r = !1 } = t,
|
|
27
|
-
r && (
|
|
28
|
-
const
|
|
26
|
+
const { abort: r = !1 } = t, a = new AbortController();
|
|
27
|
+
r && (A.has(e) && ((o = A.get(e)) == null || o.abort(), A.delete(e)), A.set(e, a));
|
|
28
|
+
const s = f(e, {
|
|
29
29
|
...t,
|
|
30
|
-
...r ? { signal:
|
|
30
|
+
...r ? { signal: a.signal } : {}
|
|
31
31
|
});
|
|
32
|
-
return r &&
|
|
32
|
+
return r && A.delete(e), s;
|
|
33
33
|
} catch (r) {
|
|
34
34
|
if (r.name === "AbortError") {
|
|
35
35
|
console.log(`[REQUEST CANCELLED]: ${e}`);
|
|
@@ -38,19 +38,19 @@ async function pe(e, t = {}) {
|
|
|
38
38
|
throw console.error(`[ERROR API]: ${r.message}`), r;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const Ie = n.object({
|
|
42
42
|
country: n.string().length(3, "Country code must be 3 characters long").required("Country is required"),
|
|
43
43
|
postalCode: n.string().nullable()
|
|
44
44
|
});
|
|
45
|
-
async function
|
|
45
|
+
async function be({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
46
46
|
if (!t) {
|
|
47
47
|
console.error("[ERROR FETCHING] Body is required");
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
await
|
|
51
|
-
const { country: r, postalCode:
|
|
52
|
-
return await
|
|
53
|
-
`${e}/api/checkout/pub/postal-code/${r}/${
|
|
50
|
+
await Ie.validate(t);
|
|
51
|
+
const { country: r, postalCode: a } = t;
|
|
52
|
+
return await f(
|
|
53
|
+
`${e}/api/checkout/pub/postal-code/${r}/${a}`,
|
|
54
54
|
{
|
|
55
55
|
method: "POST",
|
|
56
56
|
body: t,
|
|
@@ -58,12 +58,12 @@ async function fe({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
|
-
const
|
|
61
|
+
const ye = n.object({
|
|
62
62
|
orderFormId: n.string().nullable(),
|
|
63
63
|
sellerCode: n.string().nullable(),
|
|
64
64
|
sellerName: n.string().nullable()
|
|
65
65
|
});
|
|
66
|
-
async function
|
|
66
|
+
async function J({
|
|
67
67
|
apiUrl: e,
|
|
68
68
|
body: t,
|
|
69
69
|
fetchOptions: o
|
|
@@ -72,9 +72,9 @@ async function x({
|
|
|
72
72
|
console.error("[ERROR FETCHING] Body is required");
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
await
|
|
76
|
-
const { orderFormId: r, sellerCode:
|
|
77
|
-
return
|
|
75
|
+
await ye.validate(t);
|
|
76
|
+
const { orderFormId: r, sellerCode: a, sellerName: s } = t, i = a ? `${a.trim()} - ${s}` : null;
|
|
77
|
+
return f(
|
|
78
78
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/openTextField`,
|
|
79
79
|
{
|
|
80
80
|
method: "POST",
|
|
@@ -85,46 +85,46 @@ async function x({
|
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
const
|
|
88
|
+
const ve = n.object({
|
|
89
89
|
orderFormId: n.string().nullable(),
|
|
90
90
|
sellerCode: n.string().nullable(),
|
|
91
91
|
marketingData: n.object()
|
|
92
92
|
});
|
|
93
|
-
async function
|
|
93
|
+
async function K({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
94
94
|
if (!t) {
|
|
95
95
|
console.error("[ERROR FETCHING] Body is required");
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
-
await
|
|
99
|
-
const { orderFormId: r, sellerCode:
|
|
100
|
-
utmCampaign:
|
|
101
|
-
utmiCampaign:
|
|
98
|
+
await ve.validate(t);
|
|
99
|
+
const { orderFormId: r, sellerCode: a, marketingData: s } = t, i = a ? {
|
|
100
|
+
utmCampaign: a ? a.toUpperCase() : "",
|
|
101
|
+
utmiCampaign: a ? "codigodavendedora" : "semcodigo"
|
|
102
102
|
} : {};
|
|
103
|
-
return
|
|
103
|
+
return f(
|
|
104
104
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/marketingData`,
|
|
105
105
|
{
|
|
106
106
|
method: "POST",
|
|
107
107
|
body: {
|
|
108
|
-
...
|
|
108
|
+
...s,
|
|
109
109
|
...i
|
|
110
110
|
},
|
|
111
111
|
...o
|
|
112
112
|
}
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const Ce = n.object({
|
|
116
116
|
orderFormId: n.string().nullable(),
|
|
117
117
|
sellerCode: n.string().nullable(),
|
|
118
118
|
sellerName: n.string().nullable()
|
|
119
119
|
});
|
|
120
|
-
async function
|
|
120
|
+
async function Re({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
121
121
|
if (!t) {
|
|
122
122
|
console.error("[ERROR FETCHING] Body is required");
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
await
|
|
126
|
-
const r = await
|
|
127
|
-
return
|
|
125
|
+
await Ce.validate(t);
|
|
126
|
+
const r = await J({ apiUrl: e, body: t, fetchOptions: o });
|
|
127
|
+
return K({
|
|
128
128
|
apiUrl: e,
|
|
129
129
|
body: {
|
|
130
130
|
...t,
|
|
@@ -133,11 +133,11 @@ async function ye({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
|
133
133
|
fetchOptions: o
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
const
|
|
136
|
+
const Fe = n.object({
|
|
137
137
|
orderFormId: n.string().nullable(),
|
|
138
138
|
coupon: n.string().nullable()
|
|
139
139
|
});
|
|
140
|
-
async function
|
|
140
|
+
async function $e({
|
|
141
141
|
apiUrl: e,
|
|
142
142
|
body: t,
|
|
143
143
|
fetchOptions: o
|
|
@@ -146,10 +146,10 @@ async function Re({
|
|
|
146
146
|
console.error("[ERROR FETCHING] Body is required");
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
await
|
|
150
|
-
const { coupon: r = "", orderFormId:
|
|
151
|
-
return
|
|
152
|
-
`${e}/api/checkout/pub/orderForm/${
|
|
149
|
+
await Fe.validate(t);
|
|
150
|
+
const { coupon: r = "", orderFormId: a } = t;
|
|
151
|
+
return f(
|
|
152
|
+
`${e}/api/checkout/pub/orderForm/${a}/coupons`,
|
|
153
153
|
{
|
|
154
154
|
method: "POST",
|
|
155
155
|
body: { text: r },
|
|
@@ -157,12 +157,12 @@ async function Re({
|
|
|
157
157
|
}
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
|
-
const
|
|
160
|
+
const Se = n.object({
|
|
161
161
|
appId: n.string().required("App ID is required"),
|
|
162
162
|
orderFormId: n.string().nullable(),
|
|
163
163
|
key: n.array().of(n.string())
|
|
164
164
|
});
|
|
165
|
-
async function
|
|
165
|
+
async function Oe({
|
|
166
166
|
apiUrl: e,
|
|
167
167
|
body: t,
|
|
168
168
|
fetchOptions: o
|
|
@@ -171,33 +171,33 @@ async function Fe({
|
|
|
171
171
|
console.error("[ERROR FETCHING] Body is required");
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
|
-
await
|
|
175
|
-
const { appId: r = "faststore", orderFormId:
|
|
176
|
-
return
|
|
177
|
-
`${e}/api/checkout/pub/orderForm/${
|
|
174
|
+
await Se.validate(t);
|
|
175
|
+
const { appId: r = "faststore", orderFormId: a, key: s } = t;
|
|
176
|
+
return f(
|
|
177
|
+
`${e}/api/checkout/pub/orderForm/${a}/customData/${r}/${s}`,
|
|
178
178
|
{
|
|
179
179
|
method: "PUT",
|
|
180
180
|
...o
|
|
181
181
|
}
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const Te = n.object().shape({
|
|
185
185
|
name: n.string().required("Attachment name is required"),
|
|
186
186
|
content: n.object().nullable()
|
|
187
187
|
});
|
|
188
|
-
var
|
|
189
|
-
const
|
|
190
|
-
attachments: (
|
|
188
|
+
var x;
|
|
189
|
+
const Ee = n.object().shape({
|
|
190
|
+
attachments: (x = n.array().of(Te)) == null ? void 0 : x.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
|
+
}), qe = n.object({
|
|
197
197
|
orderFormId: n.string().required("OrderFormId is required"),
|
|
198
|
-
orderItems: n.array().of(
|
|
198
|
+
orderItems: n.array().of(Ee)
|
|
199
199
|
});
|
|
200
|
-
async function
|
|
200
|
+
async function Pe({
|
|
201
201
|
apiUrl: e,
|
|
202
202
|
body: t,
|
|
203
203
|
fetchOptions: o
|
|
@@ -206,21 +206,21 @@ async function Ee({
|
|
|
206
206
|
console.error("[ERROR FETCHING] Body is required");
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
await
|
|
210
|
-
const { orderFormId: r, orderItems:
|
|
211
|
-
return
|
|
209
|
+
await qe.validate(t);
|
|
210
|
+
const { orderFormId: r, orderItems: a } = t;
|
|
211
|
+
return f(
|
|
212
212
|
`${e}/api/checkout/pub/orderForm/${r}/items`,
|
|
213
213
|
{
|
|
214
214
|
method: "POST",
|
|
215
|
-
body: { orderItems:
|
|
215
|
+
body: { orderItems: a },
|
|
216
216
|
...o
|
|
217
217
|
}
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
|
-
const
|
|
220
|
+
const Ae = n.object({
|
|
221
221
|
orderFormId: n.string().nullable()
|
|
222
222
|
});
|
|
223
|
-
async function
|
|
223
|
+
async function ke({
|
|
224
224
|
apiUrl: e,
|
|
225
225
|
body: t,
|
|
226
226
|
fetchOptions: o
|
|
@@ -229,9 +229,9 @@ async function qe({
|
|
|
229
229
|
console.error("[ERROR FETCHING] Body is required");
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
232
|
-
await
|
|
232
|
+
await Ae.validate(t);
|
|
233
233
|
const { orderFormId: r } = t;
|
|
234
|
-
return
|
|
234
|
+
return f(
|
|
235
235
|
`${e}/api/checkout/pub/orderForm/${r}/items/removeAll`,
|
|
236
236
|
{
|
|
237
237
|
method: "POST",
|
|
@@ -239,23 +239,23 @@ async function qe({
|
|
|
239
239
|
}
|
|
240
240
|
);
|
|
241
241
|
}
|
|
242
|
-
const
|
|
242
|
+
const Ne = n.object().shape({
|
|
243
243
|
name: n.string().required("Attachment name is required"),
|
|
244
244
|
content: n.object().nullable()
|
|
245
245
|
});
|
|
246
|
-
var
|
|
247
|
-
const
|
|
248
|
-
attachments: (
|
|
246
|
+
var z;
|
|
247
|
+
const we = n.object().shape({
|
|
248
|
+
attachments: (z = n.array().of(Ne)) == null ? void 0 : z.nullable(),
|
|
249
249
|
id: n.string().required("ID of SKU is required"),
|
|
250
250
|
index: n.number().integer().nullable(),
|
|
251
251
|
quantity: n.number().integer().nullable(),
|
|
252
252
|
seller: n.string().required("Seller is required"),
|
|
253
253
|
price: n.number().integer()
|
|
254
|
-
}),
|
|
254
|
+
}), je = n.object({
|
|
255
255
|
orderFormId: n.string().nullable(),
|
|
256
|
-
orderItems: n.array().of(
|
|
256
|
+
orderItems: n.array().of(we)
|
|
257
257
|
});
|
|
258
|
-
async function
|
|
258
|
+
async function De({
|
|
259
259
|
apiUrl: e,
|
|
260
260
|
body: t,
|
|
261
261
|
fetchOptions: o
|
|
@@ -264,21 +264,21 @@ async function je({
|
|
|
264
264
|
console.error("[ERROR FETCHING] Body is required");
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
|
-
await
|
|
268
|
-
const { orderFormId: r, orderItems:
|
|
269
|
-
return
|
|
267
|
+
await je.validate(t);
|
|
268
|
+
const { orderFormId: r, orderItems: a } = t;
|
|
269
|
+
return f(
|
|
270
270
|
`${e}/api/checkout/pub/orderForm/${r}/items/update`,
|
|
271
271
|
{
|
|
272
272
|
method: "POST",
|
|
273
|
-
body: { orderItems:
|
|
273
|
+
body: { orderItems: a },
|
|
274
274
|
...o
|
|
275
275
|
}
|
|
276
276
|
);
|
|
277
277
|
}
|
|
278
|
-
const
|
|
278
|
+
const He = n.object({
|
|
279
279
|
orderFormId: n.string().nullable()
|
|
280
280
|
});
|
|
281
|
-
async function
|
|
281
|
+
async function _e({
|
|
282
282
|
apiUrl: e,
|
|
283
283
|
body: t,
|
|
284
284
|
fetchOptions: o
|
|
@@ -287,9 +287,9 @@ async function we({
|
|
|
287
287
|
console.error("[ERROR FETCHING] Body is required");
|
|
288
288
|
return;
|
|
289
289
|
}
|
|
290
|
-
await
|
|
290
|
+
await He.validate(t);
|
|
291
291
|
const { orderFormId: r } = t;
|
|
292
|
-
return
|
|
292
|
+
return f(
|
|
293
293
|
`${e}/api/checkout/pub/orderForm/${r}/messages/clear`,
|
|
294
294
|
{
|
|
295
295
|
method: "POST",
|
|
@@ -297,30 +297,30 @@ async function we({
|
|
|
297
297
|
}
|
|
298
298
|
);
|
|
299
299
|
}
|
|
300
|
-
const
|
|
300
|
+
const Be = n.object({
|
|
301
301
|
id: n.string().nullable(),
|
|
302
302
|
// id offering
|
|
303
303
|
itemIndex: n.number().nullable(),
|
|
304
304
|
orderFormId: n.string().nullable(),
|
|
305
305
|
remove: n.boolean().nullable()
|
|
306
306
|
});
|
|
307
|
-
async function
|
|
307
|
+
async function Ge({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
308
308
|
if (!t) {
|
|
309
309
|
console.error("[ERROR FETCHING] Body is required");
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
|
-
await
|
|
313
|
-
const { itemIndex: r, orderFormId:
|
|
314
|
-
return d
|
|
312
|
+
await Be.validate(t);
|
|
313
|
+
const { itemIndex: r, orderFormId: a, id: s, remove: i } = t, c = i ? `/${s}/remove` : "", d = `${e}/api/checkout/pub/orderForm/${a}/items/${r}/offerings${c}`;
|
|
314
|
+
return f(d, {
|
|
315
315
|
method: "POST",
|
|
316
|
-
body: { id:
|
|
316
|
+
body: { id: s },
|
|
317
317
|
...o
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
|
-
const
|
|
320
|
+
const Ve = n.object({
|
|
321
321
|
orderFormId: n.string().nullable()
|
|
322
322
|
});
|
|
323
|
-
async function
|
|
323
|
+
async function Le({
|
|
324
324
|
apiUrl: e,
|
|
325
325
|
body: t,
|
|
326
326
|
fetchOptions: o,
|
|
@@ -331,13 +331,13 @@ async function He({
|
|
|
331
331
|
console.error("[ERROR FETCHING] Body is required");
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
|
-
await
|
|
335
|
-
const
|
|
334
|
+
await Ve.validate(t);
|
|
335
|
+
const a = new URLSearchParams({
|
|
336
336
|
refreshOutdatedData: "true"
|
|
337
|
-
}),
|
|
338
|
-
return
|
|
337
|
+
}), s = t.orderFormId && ((i = r.orderFormPurchaseId) == null ? void 0 : i.value) !== t.orderFormId ? `${e}/api/checkout/pub/orderForm/${t.orderFormId}?${String(a)}` : `${e}/api/checkout/pub/orderForm`;
|
|
338
|
+
return f(s, { method: "GET", ...o });
|
|
339
339
|
}
|
|
340
|
-
const
|
|
340
|
+
const Ue = n.object({
|
|
341
341
|
orderFormId: n.string().nullable(),
|
|
342
342
|
email: n.string().email().required(),
|
|
343
343
|
firstName: n.string().required(),
|
|
@@ -346,7 +346,7 @@ const Be = n.object({
|
|
|
346
346
|
document: n.string().required(),
|
|
347
347
|
phone: n.string().matches(/^\+\d{1,3}\d{10,11}$/)
|
|
348
348
|
});
|
|
349
|
-
async function
|
|
349
|
+
async function Me({
|
|
350
350
|
apiUrl: e,
|
|
351
351
|
body: t,
|
|
352
352
|
fetchOptions: o
|
|
@@ -355,21 +355,21 @@ async function Ue({
|
|
|
355
355
|
console.error("[ERROR FETCHING] Body is required");
|
|
356
356
|
return;
|
|
357
357
|
}
|
|
358
|
-
await
|
|
359
|
-
const { orderFormId: r, ...
|
|
360
|
-
return
|
|
358
|
+
await Ue.validate(t);
|
|
359
|
+
const { orderFormId: r, ...a } = t;
|
|
360
|
+
return f(
|
|
361
361
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/clientProfileData`,
|
|
362
362
|
{
|
|
363
363
|
method: "POST",
|
|
364
|
-
body: { ...
|
|
364
|
+
body: { ...a },
|
|
365
365
|
...o
|
|
366
366
|
}
|
|
367
367
|
);
|
|
368
368
|
}
|
|
369
|
-
const
|
|
369
|
+
const xe = n.object({
|
|
370
370
|
sellerCode: n.string().nullable()
|
|
371
371
|
});
|
|
372
|
-
async function
|
|
372
|
+
async function ze({
|
|
373
373
|
apiUrl: e,
|
|
374
374
|
body: t,
|
|
375
375
|
fetchOptions: o
|
|
@@ -378,9 +378,9 @@ async function Ve({
|
|
|
378
378
|
console.error("[ERROR FETCHING] Body is required");
|
|
379
379
|
return;
|
|
380
380
|
}
|
|
381
|
-
await
|
|
381
|
+
await xe.validate(t);
|
|
382
382
|
const { sellerCode: r = "" } = t;
|
|
383
|
-
return
|
|
383
|
+
return f(
|
|
384
384
|
`${e}/api/dataentities/VD/search?_fields=id,cod,name,ativo&cod=${r}`,
|
|
385
385
|
{
|
|
386
386
|
method: "GET",
|
|
@@ -391,12 +391,12 @@ async function Ve({
|
|
|
391
391
|
}
|
|
392
392
|
);
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const Qe = n.object().shape({
|
|
395
395
|
country: n.string().length(3, "Country code must be 3 characters long").required("Country is required"),
|
|
396
396
|
orderFormId: n.string().nullable(),
|
|
397
397
|
postalCode: n.string().nullable()
|
|
398
398
|
});
|
|
399
|
-
async function
|
|
399
|
+
async function Je({
|
|
400
400
|
apiUrl: e,
|
|
401
401
|
body: t,
|
|
402
402
|
fetchOptions: o
|
|
@@ -405,19 +405,19 @@ async function xe({
|
|
|
405
405
|
console.error("[ERROR FETCHING] Body is required");
|
|
406
406
|
return;
|
|
407
407
|
}
|
|
408
|
-
await
|
|
409
|
-
const { country: r, orderFormId:
|
|
408
|
+
await Qe.validate(t);
|
|
409
|
+
const { country: r, orderFormId: a, postalCode: s } = t, i = s ? {
|
|
410
410
|
address: {
|
|
411
411
|
addressType: "residential",
|
|
412
|
-
postalCode:
|
|
412
|
+
postalCode: s,
|
|
413
413
|
country: r
|
|
414
414
|
}
|
|
415
415
|
} : {
|
|
416
416
|
logisticsInfo: [],
|
|
417
417
|
clearAddressIfPostalCodeNotFound: !0
|
|
418
418
|
};
|
|
419
|
-
return
|
|
420
|
-
`${e}/api/checkout/pub/orderForm/${
|
|
419
|
+
return f(
|
|
420
|
+
`${e}/api/checkout/pub/orderForm/${a}/attachments/shippingData`,
|
|
421
421
|
{
|
|
422
422
|
method: "POST",
|
|
423
423
|
body: i,
|
|
@@ -425,7 +425,7 @@ async function xe({
|
|
|
425
425
|
}
|
|
426
426
|
);
|
|
427
427
|
}
|
|
428
|
-
const
|
|
428
|
+
const Ke = n.object().shape({
|
|
429
429
|
orderFormId: n.string().nullable(),
|
|
430
430
|
options: n.array().of(
|
|
431
431
|
n.object().shape({
|
|
@@ -453,27 +453,27 @@ const ze = n.object().shape({
|
|
|
453
453
|
})
|
|
454
454
|
)
|
|
455
455
|
});
|
|
456
|
-
async function
|
|
456
|
+
async function We({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
457
457
|
if (!t) {
|
|
458
458
|
console.error("[ERROR FETCHING] Body is required");
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
|
-
await
|
|
462
|
-
const { orderFormId: r, options:
|
|
463
|
-
return
|
|
461
|
+
await Ke.validate(t);
|
|
462
|
+
const { orderFormId: r, options: a, selectedAddresses: s } = t;
|
|
463
|
+
return f(
|
|
464
464
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/shippingData`,
|
|
465
465
|
{
|
|
466
466
|
method: "POST",
|
|
467
467
|
body: {
|
|
468
|
-
selectedAddresses:
|
|
468
|
+
selectedAddresses: s,
|
|
469
469
|
clearAddressIfPostalCodeNotFound: !1,
|
|
470
|
-
logisticsInfo:
|
|
470
|
+
logisticsInfo: a
|
|
471
471
|
},
|
|
472
472
|
...o
|
|
473
473
|
}
|
|
474
474
|
);
|
|
475
475
|
}
|
|
476
|
-
const
|
|
476
|
+
const Xe = n.object({
|
|
477
477
|
country: n.string().length(3, "Country code must be 3 characters long").required("Country is required"),
|
|
478
478
|
postalCode: n.string().nullable(),
|
|
479
479
|
geoCoordinates: n.object().shape({
|
|
@@ -481,17 +481,17 @@ const Je = n.object({
|
|
|
481
481
|
latitude: n.number().required()
|
|
482
482
|
})
|
|
483
483
|
});
|
|
484
|
-
async function
|
|
484
|
+
async function Ye({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
485
485
|
if (!t) {
|
|
486
486
|
console.error("[ERROR FETCHING] Body is required");
|
|
487
487
|
return;
|
|
488
488
|
}
|
|
489
|
-
await
|
|
490
|
-
const { country: r = "", geoCoordinates:
|
|
491
|
-
return
|
|
489
|
+
await Xe.validate(t);
|
|
490
|
+
const { country: r = "", geoCoordinates: a, postalCode: s = "" } = t, i = new URLSearchParams({ country: String(r) });
|
|
491
|
+
return s ? i.append("postalCode", s) : i.append(
|
|
492
492
|
"geoCoordinates",
|
|
493
|
-
`${
|
|
494
|
-
), await
|
|
493
|
+
`${a == null ? void 0 : a.longitude};${a == null ? void 0 : a.latitude}`
|
|
494
|
+
), await f(
|
|
495
495
|
`${e}/api/checkout/pub/regions/?${i.toString()}`,
|
|
496
496
|
{
|
|
497
497
|
method: "GET",
|
|
@@ -499,22 +499,22 @@ async function Ke({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
|
499
499
|
}
|
|
500
500
|
);
|
|
501
501
|
}
|
|
502
|
-
const
|
|
502
|
+
const Ze = n.object({
|
|
503
503
|
id: n.string().required("ID of SKU is required"),
|
|
504
504
|
quantity: n.number().integer().required("Quantity of item is required"),
|
|
505
505
|
seller: n.string()
|
|
506
|
-
}),
|
|
507
|
-
items: n.array().of(
|
|
506
|
+
}), et = n.object({
|
|
507
|
+
items: n.array().of(Ze),
|
|
508
508
|
country: n.string().length(3, "Country code must be 3 characters long").required("Country is required"),
|
|
509
509
|
postalCode: n.string().nullable(),
|
|
510
510
|
geoCoordinates: n.array().nullable().of(n.number()).length(2)
|
|
511
511
|
});
|
|
512
|
-
async function
|
|
512
|
+
async function tt({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
513
513
|
if (!t) {
|
|
514
514
|
console.error("[ERROR FETCHING] Body is required");
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
|
-
return await
|
|
517
|
+
return await et.validate(t), f(
|
|
518
518
|
`${e}/api/checkout/pub/orderForms/simulation`,
|
|
519
519
|
{
|
|
520
520
|
method: "POST",
|
|
@@ -523,94 +523,94 @@ async function Xe({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
|
523
523
|
}
|
|
524
524
|
);
|
|
525
525
|
}
|
|
526
|
-
const
|
|
526
|
+
const rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
527
527
|
__proto__: null,
|
|
528
|
-
getMasterDataSellerCode:
|
|
529
|
-
getOrderForm:
|
|
530
|
-
postOrderFormAddCoupon:
|
|
531
|
-
postOrderFormAttachClientProfileData:
|
|
532
|
-
postOrderFormAttachOrderFormData:
|
|
533
|
-
postOrderFormAttachShippingData:
|
|
534
|
-
postOrderFormAttachmentsMarketingData:
|
|
535
|
-
postOrderFormAttachmentsOpenTextField:
|
|
536
|
-
postOrderFormClearMessages:
|
|
537
|
-
postOrderFormFreightSimulation:
|
|
538
|
-
postOrderFormItems:
|
|
539
|
-
postOrderFormRegion:
|
|
540
|
-
postOrderFormRemoveAllItems:
|
|
541
|
-
postOrderFormUpdateItems:
|
|
542
|
-
postOrderFormUpdateShippingData:
|
|
543
|
-
postOrderformAddress:
|
|
544
|
-
putOrderFormCustomData:
|
|
545
|
-
updateOrderFormOffering:
|
|
546
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
528
|
+
getMasterDataSellerCode: ze,
|
|
529
|
+
getOrderForm: Le,
|
|
530
|
+
postOrderFormAddCoupon: $e,
|
|
531
|
+
postOrderFormAttachClientProfileData: Me,
|
|
532
|
+
postOrderFormAttachOrderFormData: Re,
|
|
533
|
+
postOrderFormAttachShippingData: Je,
|
|
534
|
+
postOrderFormAttachmentsMarketingData: K,
|
|
535
|
+
postOrderFormAttachmentsOpenTextField: J,
|
|
536
|
+
postOrderFormClearMessages: _e,
|
|
537
|
+
postOrderFormFreightSimulation: tt,
|
|
538
|
+
postOrderFormItems: Pe,
|
|
539
|
+
postOrderFormRegion: Ye,
|
|
540
|
+
postOrderFormRemoveAllItems: ke,
|
|
541
|
+
postOrderFormUpdateItems: De,
|
|
542
|
+
postOrderFormUpdateShippingData: We,
|
|
543
|
+
postOrderformAddress: be,
|
|
544
|
+
putOrderFormCustomData: Oe,
|
|
545
|
+
updateOrderFormOffering: Ge
|
|
546
|
+
}, Symbol.toStringTag, { value: "Module" })), ot = n.object({
|
|
547
547
|
skuId: n.string()
|
|
548
548
|
});
|
|
549
|
-
async function
|
|
549
|
+
async function nt({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
550
550
|
if (!t) {
|
|
551
551
|
console.error("[ERROR FETCHING] Body is required");
|
|
552
552
|
return;
|
|
553
553
|
}
|
|
554
|
-
await
|
|
554
|
+
await ot.validate(t);
|
|
555
555
|
const { skuId: r } = t;
|
|
556
|
-
return
|
|
556
|
+
return f(
|
|
557
557
|
`${e}/api/catalog/pvt/stockkeepingunitkit?parentSkuId=${r}`,
|
|
558
558
|
{
|
|
559
559
|
...o
|
|
560
560
|
}
|
|
561
561
|
);
|
|
562
562
|
}
|
|
563
|
-
const
|
|
563
|
+
const st = n.object({
|
|
564
564
|
ids: n.array().of(n.string().required("ID are required")).required("IDs are required")
|
|
565
565
|
});
|
|
566
|
-
async function
|
|
566
|
+
async function at({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
567
567
|
if (!t) {
|
|
568
568
|
console.error("[ERROR FETCHING] Body is required");
|
|
569
569
|
return;
|
|
570
570
|
}
|
|
571
|
-
await
|
|
571
|
+
await st.validate(t);
|
|
572
572
|
const { ids: r } = t;
|
|
573
|
-
return
|
|
574
|
-
`${e}/api/catalog_system/pub/products/search?fq=${r.map((
|
|
573
|
+
return f(
|
|
574
|
+
`${e}/api/catalog_system/pub/products/search?fq=${r.map((a) => `productId:${a}`).join("&fq=")}`,
|
|
575
575
|
{
|
|
576
576
|
...o
|
|
577
577
|
}
|
|
578
578
|
);
|
|
579
579
|
}
|
|
580
|
-
const
|
|
580
|
+
const it = n.object({
|
|
581
581
|
productId: n.number().required("Product ID is required")
|
|
582
582
|
});
|
|
583
|
-
async function
|
|
583
|
+
async function ct({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
584
584
|
if (!t) {
|
|
585
585
|
console.error("[ERROR FETCHING] Body is required");
|
|
586
586
|
return;
|
|
587
587
|
}
|
|
588
|
-
await
|
|
588
|
+
await it.validate(t);
|
|
589
589
|
const { productId: r } = t;
|
|
590
|
-
return
|
|
590
|
+
return f(
|
|
591
591
|
`${e}/api/catalog_system/pub/products/crossselling/similars/${r.toString()}`,
|
|
592
592
|
{
|
|
593
593
|
...o
|
|
594
594
|
}
|
|
595
595
|
);
|
|
596
596
|
}
|
|
597
|
-
const
|
|
597
|
+
const lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
598
598
|
__proto__: null,
|
|
599
|
-
getCatalogKitProducts:
|
|
600
|
-
getCatalogProducts:
|
|
601
|
-
getCatalogSimilars:
|
|
602
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
599
|
+
getCatalogKitProducts: nt,
|
|
600
|
+
getCatalogProducts: at,
|
|
601
|
+
getCatalogSimilars: ct
|
|
602
|
+
}, Symbol.toStringTag, { value: "Module" })), ut = (e = "") => e.charAt(0).toUpperCase() + e.slice(1), L = (e, t = " ") => !e || typeof e == "string" && e.length === 0 ? e : (Array.isArray(e) ? e : e.split("-")).map(ut).join(t), dt = ({ canonical: e, seo: t, slug: o }) => {
|
|
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((s) => L(s)).join(",") : L(o)} - ${t.title}`,
|
|
607
607
|
MetaTagDescription: t.description,
|
|
608
608
|
name: r,
|
|
609
609
|
hasChildren: !1,
|
|
610
610
|
url: e,
|
|
611
611
|
children: []
|
|
612
612
|
};
|
|
613
|
-
},
|
|
613
|
+
}, mt = ({ canonical: e, category: t, previousImages: o, seo: r }) => ({
|
|
614
614
|
category: String(t == null ? void 0 : t.id),
|
|
615
615
|
title: (t == null ? void 0 : t.Title) ?? r.title,
|
|
616
616
|
description: (t == null ? void 0 : t.MetaTagDescription) ?? r.description,
|
|
@@ -621,268 +621,388 @@ const at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
621
621
|
description: (t == null ? void 0 : t.MetaTagDescription) ?? r.description,
|
|
622
622
|
images: Array.isArray(o) ? [...o] : []
|
|
623
623
|
}
|
|
624
|
-
}),
|
|
625
|
-
const
|
|
624
|
+
}), pt = ({ items: e, parent: t, apiUrl: o, find: r }) => {
|
|
625
|
+
const a = e.find(
|
|
626
626
|
(i) => i.url.replace(o, "") === decodeURIComponent(t.toLowerCase())
|
|
627
627
|
);
|
|
628
|
-
return (
|
|
628
|
+
return (a == null ? void 0 : a.children.find(
|
|
629
629
|
(i) => i.name.toLowerCase() === decodeURIComponent(String(r))
|
|
630
|
-
)) ??
|
|
631
|
-
},
|
|
630
|
+
)) ?? a;
|
|
631
|
+
}, ft = (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
|
+
}, gt = /* @__PURE__ */ new Set([
|
|
634
634
|
"brand",
|
|
635
635
|
"category",
|
|
636
636
|
"department",
|
|
637
637
|
"subcategory",
|
|
638
638
|
"collection",
|
|
639
639
|
"cluster"
|
|
640
|
-
]),
|
|
640
|
+
]), ht = (e) => typeof (e == null ? void 0 : e.pageType) == "string" && gt.has(e == null ? void 0 : e.pageType.toLowerCase()), It = (e) => ({
|
|
641
641
|
collection: e.Coleção,
|
|
642
642
|
categoryId: e.categoryId,
|
|
643
643
|
current_collection: e["Coleção Atual"],
|
|
644
644
|
items: e.items
|
|
645
|
-
}),
|
|
645
|
+
}), bt = (e, t) => e.reduce((o, r) => {
|
|
646
646
|
if (r.items.filter(
|
|
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 s = 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: (s == null ? void 0 : s.imageUrl) ?? "",
|
|
657
|
+
textureAlt: (s == null ? void 0 : s.imageText) ?? ""
|
|
658
658
|
}), o;
|
|
659
|
-
}, []),
|
|
659
|
+
}, []), yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
660
660
|
__proto__: null,
|
|
661
|
-
createEmptySeoCategory:
|
|
662
|
-
createSeoCategory:
|
|
663
|
-
findCategory:
|
|
664
|
-
formattedSimilars:
|
|
665
|
-
isCollectionPageType:
|
|
666
|
-
notFindCategoryError:
|
|
667
|
-
responseAdapter:
|
|
661
|
+
createEmptySeoCategory: dt,
|
|
662
|
+
createSeoCategory: mt,
|
|
663
|
+
findCategory: pt,
|
|
664
|
+
formattedSimilars: bt,
|
|
665
|
+
isCollectionPageType: ht,
|
|
666
|
+
notFindCategoryError: ft,
|
|
667
|
+
responseAdapter: It
|
|
668
668
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
669
|
-
async function
|
|
670
|
-
const
|
|
669
|
+
async function vt({ contentType: e, storeId: t, CMS_PROJECT_NAME: o, NextCookies: r }) {
|
|
670
|
+
const a = await F({
|
|
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 (a.status === 200) {
|
|
677
|
+
const s = {
|
|
678
678
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
679
679
|
contentType: e,
|
|
680
|
-
data:
|
|
680
|
+
data: a.data
|
|
681
681
|
};
|
|
682
|
-
console.log("Resultado da chamada:",
|
|
682
|
+
console.log("Resultado da chamada:", a);
|
|
683
683
|
const i = `backup-${e}-${Date.now()}.json`;
|
|
684
|
-
return await
|
|
684
|
+
return await ae.writeFile(
|
|
685
685
|
`./backups/${i}`,
|
|
686
|
-
JSON.stringify(
|
|
686
|
+
JSON.stringify(s, null, 2),
|
|
687
687
|
"utf-8"
|
|
688
688
|
), { success: !0, fileName: i };
|
|
689
689
|
}
|
|
690
|
-
return { success: !1, error:
|
|
690
|
+
return { success: !1, error: a.error || "No data to backup" };
|
|
691
691
|
}
|
|
692
|
-
async function
|
|
693
|
-
return
|
|
692
|
+
async function Ct(e) {
|
|
693
|
+
return vt(e);
|
|
694
694
|
}
|
|
695
|
-
async function
|
|
695
|
+
async function Rt({
|
|
696
696
|
contentType: e,
|
|
697
697
|
documentId: t,
|
|
698
698
|
versionId: o,
|
|
699
699
|
storeId: r,
|
|
700
|
-
CMS_PROJECT_NAME:
|
|
700
|
+
CMS_PROJECT_NAME: a
|
|
701
701
|
}) {
|
|
702
|
-
const
|
|
702
|
+
const s = 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/${a}/${e}${s}${i}`,
|
|
705
705
|
{ cache: "no-cache" }
|
|
706
706
|
);
|
|
707
707
|
}
|
|
708
|
-
async function
|
|
708
|
+
async function Ft({
|
|
709
709
|
contentType: e,
|
|
710
710
|
documents: t,
|
|
711
711
|
NextCookies: o,
|
|
712
712
|
CMS_PROJECT_NAME: r,
|
|
713
|
-
storeId:
|
|
713
|
+
storeId: a
|
|
714
714
|
}) {
|
|
715
715
|
var i;
|
|
716
|
-
const
|
|
716
|
+
const s = 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 (s && (s == null ? void 0 : s.contentType) === e) {
|
|
720
|
+
const c = s.documentId && s.documentId.length ? `/${s.documentId}` : "", d = s != null && s.versionId && (s != null && s.versionId.length) ? `?versionId=${s == null ? void 0 : s.versionId}` : "", m = await (await fetch(
|
|
721
|
+
`https://${a}.myvtex.com/_v/cms/api/${r}/${e}${c}${d}`,
|
|
722
722
|
{ cache: "no-store" }
|
|
723
|
-
)).json(),
|
|
724
|
-
(
|
|
723
|
+
)).json(), l = t.filter(
|
|
724
|
+
(u) => m.id !== u.documentId
|
|
725
725
|
);
|
|
726
|
-
return
|
|
726
|
+
return l.unshift(m), l;
|
|
727
727
|
}
|
|
728
728
|
return t;
|
|
729
729
|
}
|
|
730
|
-
async function
|
|
730
|
+
async function F({
|
|
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, m;
|
|
737
|
+
const a = JSON.parse(
|
|
738
738
|
((g = t().get("cms_preview_data")) == null ? void 0 : g.value) ?? "{}"
|
|
739
|
-
),
|
|
740
|
-
let i = 1, c = 0,
|
|
739
|
+
), s = [];
|
|
740
|
+
let i = 1, c = 0, d = !0;
|
|
741
741
|
try {
|
|
742
742
|
do {
|
|
743
|
-
const
|
|
743
|
+
const u = 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 (
|
|
748
|
-
if (
|
|
749
|
-
const
|
|
746
|
+
i === 1 && (c = u.totalItems), (m = u == null ? void 0 : u.data) != null && m.length && s.push(...u.data), d = u.hasNextPage, i++;
|
|
747
|
+
} while (d && s.length < c);
|
|
748
|
+
if (a.previewMode && s.length) {
|
|
749
|
+
const l = await Ft({
|
|
750
750
|
contentType: e,
|
|
751
|
-
documents:
|
|
751
|
+
documents: s,
|
|
752
752
|
NextCookies: t,
|
|
753
753
|
CMS_PROJECT_NAME: o,
|
|
754
754
|
storeId: r
|
|
755
755
|
});
|
|
756
756
|
return {
|
|
757
|
-
status:
|
|
758
|
-
data:
|
|
757
|
+
status: l.length > 0 ? 200 : 404,
|
|
758
|
+
data: l ?? []
|
|
759
759
|
};
|
|
760
760
|
}
|
|
761
761
|
return {
|
|
762
|
-
status:
|
|
763
|
-
data:
|
|
762
|
+
status: s.length ? 200 : 404,
|
|
763
|
+
data: s
|
|
764
764
|
};
|
|
765
|
-
} catch (
|
|
766
|
-
return { status: "error", data: [], error:
|
|
765
|
+
} catch (l) {
|
|
766
|
+
return { status: "error", data: [], error: l };
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
|
-
const
|
|
769
|
+
const $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
770
770
|
__proto__: null,
|
|
771
|
-
cmsBackup:
|
|
772
|
-
getCMSContentType:
|
|
773
|
-
getContentType:
|
|
774
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
771
|
+
cmsBackup: Ct,
|
|
772
|
+
getCMSContentType: Rt,
|
|
773
|
+
getContentType: F
|
|
774
|
+
}, Symbol.toStringTag, { value: "Module" })), St = ({
|
|
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 a = t == null ? void 0 : t.find(
|
|
781
|
+
(m) => {
|
|
782
|
+
var l, u, p, h;
|
|
783
|
+
return ((u = (l = m.config) == null ? void 0 : l.responsive) == null ? void 0 : u.deviceType) === "desktop" && ((h = (p = m.config) == null ? void 0 : p.seo) == null ? void 0 : h.slug) === e;
|
|
784
784
|
}
|
|
785
|
-
),
|
|
786
|
-
(
|
|
787
|
-
var u,
|
|
788
|
-
return ((
|
|
785
|
+
), s = a == null ? void 0 : a.config.responsive.gapCustom, i = a == null ? void 0 : a.config.responsive.gapSections, c = t == null ? void 0 : t.find(
|
|
786
|
+
(m) => {
|
|
787
|
+
var l, u, p, h;
|
|
788
|
+
return ((u = (l = m.config) == null ? void 0 : l.responsive) == null ? void 0 : u.deviceType) === "mobile" && ((h = (p = m.config) == null ? void 0 : p.seo) == null ? void 0 : h.slug) === e;
|
|
789
789
|
}
|
|
790
|
-
),
|
|
791
|
-
return /* @__PURE__ */
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
|
|
790
|
+
), d = c == null ? void 0 : c.config.responsive.gapCustom, g = c == null ? void 0 : c.config.responsive.gapSections;
|
|
791
|
+
return /* @__PURE__ */ Q(G, { children: [
|
|
792
|
+
/* @__PURE__ */ I(
|
|
793
|
+
w.Column,
|
|
794
794
|
{
|
|
795
|
-
gap:
|
|
796
|
-
className:
|
|
797
|
-
|
|
795
|
+
gap: s && i ? i : r,
|
|
796
|
+
className: B.classNameConcat(
|
|
797
|
+
N["responsive-desktop-flex"],
|
|
798
798
|
"utils-column-modifier"
|
|
799
799
|
),
|
|
800
|
-
children: /* @__PURE__ */
|
|
800
|
+
children: /* @__PURE__ */ I(o, { data: (a == null ? void 0 : a.sections) ?? [] })
|
|
801
801
|
}
|
|
802
802
|
),
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
|
|
803
|
+
/* @__PURE__ */ I(
|
|
804
|
+
w.Column,
|
|
805
805
|
{
|
|
806
|
-
gap:
|
|
807
|
-
className:
|
|
808
|
-
|
|
806
|
+
gap: d && g ? g : r,
|
|
807
|
+
className: B.classNameConcat(
|
|
808
|
+
N["responsive-mobile-flex"],
|
|
809
809
|
"utils-column-modifier"
|
|
810
810
|
),
|
|
811
|
-
children: /* @__PURE__ */
|
|
811
|
+
children: /* @__PURE__ */ I(o, { data: (c == null ? void 0 : c.sections) ?? [] })
|
|
812
812
|
}
|
|
813
813
|
)
|
|
814
814
|
] });
|
|
815
|
-
},
|
|
815
|
+
}, Ot = async ({
|
|
816
816
|
slug: e,
|
|
817
817
|
SectionZone: t,
|
|
818
818
|
COMMON_PAGE_COLUMN_GAP: o,
|
|
819
819
|
...r
|
|
820
820
|
}) => {
|
|
821
|
-
const { data:
|
|
821
|
+
const { data: a } = await F({
|
|
822
822
|
contentType: "common_page",
|
|
823
823
|
...r
|
|
824
824
|
});
|
|
825
|
-
return /* @__PURE__ */
|
|
826
|
-
|
|
825
|
+
return /* @__PURE__ */ I(
|
|
826
|
+
St,
|
|
827
827
|
{
|
|
828
|
-
data:
|
|
828
|
+
data: a,
|
|
829
829
|
slug: e,
|
|
830
830
|
SectionZone: t,
|
|
831
831
|
COMMON_PAGE_COLUMN_GAP: o
|
|
832
832
|
}
|
|
833
833
|
);
|
|
834
|
-
},
|
|
834
|
+
}, Tt = async ({
|
|
835
|
+
PAYMENT_FLAGS_DICTIONARY: e,
|
|
836
|
+
PAYMENT_FLAGS: t,
|
|
837
|
+
LEGAL_INFORMATION_TEXT: o,
|
|
838
|
+
SectionZone: r,
|
|
839
|
+
ICONS: a,
|
|
840
|
+
...s
|
|
841
|
+
}) => {
|
|
842
|
+
var g, m, l, u, p, h, $, C, R, S, O, T;
|
|
843
|
+
const { data: i } = await F({
|
|
844
|
+
contentType: "footer",
|
|
845
|
+
...s
|
|
846
|
+
}), c = Array.isArray(i) && ((m = (g = i[0]) == null ? void 0 : g.name) == null ? void 0 : m.toLowerCase()) === "footer" ? i[0] : null, d = {
|
|
847
|
+
...(l = c == null ? void 0 : c.paymentInfo) == null ? void 0 : l.paymentInfo,
|
|
848
|
+
acceptedFlags: Array.isArray(
|
|
849
|
+
(u = c == null ? void 0 : c.paymentInfo) == null ? void 0 : u.paymentInfo.acceptedFlags
|
|
850
|
+
) ? (p = c == null ? void 0 : c.paymentInfo) == null ? void 0 : p.paymentInfo.acceptedFlags.filter((b) => !!e[b]).map(
|
|
851
|
+
(b) => e[b]
|
|
852
|
+
) : []
|
|
853
|
+
};
|
|
854
|
+
return c ? /* @__PURE__ */ I(
|
|
855
|
+
ie,
|
|
856
|
+
{
|
|
857
|
+
data: { ...c },
|
|
858
|
+
socialInfo: (h = c.socialMedia) == null ? void 0 : h.socialMedia,
|
|
859
|
+
socialMedias: (C = ($ = c.socialMedia) == null ? void 0 : $.socialMedia) == null ? void 0 : C.medias,
|
|
860
|
+
payments: d,
|
|
861
|
+
adornment: {
|
|
862
|
+
...(S = (R = c.supportInfo) == null ? void 0 : R.supportInfo) != null && S.content ? {
|
|
863
|
+
bottom: /* @__PURE__ */ I(
|
|
864
|
+
ce,
|
|
865
|
+
{
|
|
866
|
+
content: (T = (O = c.supportInfo) == null ? void 0 : O.supportInfo) == null ? void 0 : T.content,
|
|
867
|
+
CONSTANTS: {
|
|
868
|
+
ICONS: a,
|
|
869
|
+
PAYMENT_FLAGS: t,
|
|
870
|
+
PAYMENT_FLAGS_DICTIONARY: e
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
)
|
|
874
|
+
} : {},
|
|
875
|
+
...c.sections.length ? { top: /* @__PURE__ */ I(r, { data: c.sections }) } : {}
|
|
876
|
+
},
|
|
877
|
+
LEGAL_INFORMATION_TEXT: o,
|
|
878
|
+
ICONS: a
|
|
879
|
+
}
|
|
880
|
+
) : /* @__PURE__ */ I(G, {});
|
|
881
|
+
}, Et = async ({
|
|
835
882
|
children: e,
|
|
836
883
|
ClientHeaderProvider: t,
|
|
837
884
|
...o
|
|
838
885
|
}) => {
|
|
839
|
-
var
|
|
840
|
-
const { data: r } = await
|
|
886
|
+
var s, i, c, d;
|
|
887
|
+
const { data: r } = await F({
|
|
841
888
|
contentType: "header",
|
|
842
889
|
...o
|
|
843
|
-
}),
|
|
844
|
-
return /* @__PURE__ */
|
|
890
|
+
}), a = (s = r[0]) == null ? void 0 : s.sections.map((g) => g.data);
|
|
891
|
+
return /* @__PURE__ */ I(
|
|
845
892
|
t,
|
|
846
893
|
{
|
|
847
894
|
headerData: {
|
|
848
895
|
...(i = r[0]) == null ? void 0 : i.layerConfig.config,
|
|
849
|
-
subMenus:
|
|
896
|
+
subMenus: a ?? [],
|
|
850
897
|
categories: ((c = r[0]) == null ? void 0 : c.categories.categories.items) ?? [],
|
|
851
|
-
navigationLinks: ((
|
|
898
|
+
navigationLinks: ((d = r[0]) == null ? void 0 : d.navigationLinks.navigationLinks.items) ?? []
|
|
852
899
|
},
|
|
853
900
|
children: e
|
|
854
901
|
}
|
|
855
902
|
);
|
|
856
|
-
},
|
|
903
|
+
}, qt = {
|
|
904
|
+
"column-modifier": "_column-modifier_1tqap_1"
|
|
905
|
+
}, Pt = async ({
|
|
906
|
+
children: e,
|
|
907
|
+
slug: t,
|
|
908
|
+
SectionZone: o,
|
|
909
|
+
COMMON_PAGE_COLUMN_GAP_PDC: r,
|
|
910
|
+
...a
|
|
911
|
+
}) => {
|
|
912
|
+
const { data: s } = await F({
|
|
913
|
+
contentType: "categories_page",
|
|
914
|
+
...a
|
|
915
|
+
}), i = s.find(
|
|
916
|
+
(m) => {
|
|
917
|
+
var l, u, p;
|
|
918
|
+
return ((l = m.config) == null ? void 0 : l.seo.slug) === t && ((p = (u = m.config) == null ? void 0 : u.responsive) == null ? void 0 : p.deviceType) === "desktop";
|
|
919
|
+
}
|
|
920
|
+
), c = s.find(
|
|
921
|
+
(m) => {
|
|
922
|
+
var l, u, p;
|
|
923
|
+
return ((l = m.config) == null ? void 0 : l.seo.slug) === t && ((p = (u = m.config) == null ? void 0 : u.responsive) == null ? void 0 : p.deviceType) === "mobile";
|
|
924
|
+
}
|
|
925
|
+
), d = s.find(
|
|
926
|
+
(m) => {
|
|
927
|
+
var l, u, p;
|
|
928
|
+
return ((l = m.config) == null ? void 0 : l.seo.slug) === "default" && ((p = (u = m.config) == null ? void 0 : u.responsive) == null ? void 0 : p.deviceType) === "desktop";
|
|
929
|
+
}
|
|
930
|
+
), g = s.find(
|
|
931
|
+
(m) => {
|
|
932
|
+
var l, u, p;
|
|
933
|
+
return ((l = m.config) == null ? void 0 : l.seo.slug) === "default" && ((p = (u = m.config) == null ? void 0 : u.responsive) == null ? void 0 : p.deviceType) === "mobile";
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
return /* @__PURE__ */ Q(G, { children: [
|
|
937
|
+
/* @__PURE__ */ I(
|
|
938
|
+
w.Column,
|
|
939
|
+
{
|
|
940
|
+
className: B.classNameConcat(
|
|
941
|
+
N["responsive-desktop-flex"],
|
|
942
|
+
qt["column-modifier"]
|
|
943
|
+
),
|
|
944
|
+
style: {
|
|
945
|
+
minHeight: "100vh"
|
|
946
|
+
},
|
|
947
|
+
children: /* @__PURE__ */ I(
|
|
948
|
+
V,
|
|
949
|
+
{
|
|
950
|
+
data: i ?? d,
|
|
951
|
+
device: "desktop",
|
|
952
|
+
SectionZone: o,
|
|
953
|
+
COMMON_PAGE_COLUMN_GAP_PDC: r,
|
|
954
|
+
children: e
|
|
955
|
+
}
|
|
956
|
+
)
|
|
957
|
+
}
|
|
958
|
+
),
|
|
959
|
+
/* @__PURE__ */ I(w.Column, { className: N["responsive-mobile-flex"], children: /* @__PURE__ */ I(
|
|
960
|
+
V,
|
|
961
|
+
{
|
|
962
|
+
data: c ?? g,
|
|
963
|
+
device: "mobile",
|
|
964
|
+
SectionZone: o,
|
|
965
|
+
COMMON_PAGE_COLUMN_GAP_PDC: r,
|
|
966
|
+
children: e
|
|
967
|
+
}
|
|
968
|
+
) })
|
|
969
|
+
] });
|
|
970
|
+
}, At = async ({
|
|
857
971
|
ClientTipbarContent: e,
|
|
858
972
|
...t
|
|
859
973
|
}) => {
|
|
860
|
-
const { data: o } = await
|
|
974
|
+
const { data: o } = await F({
|
|
861
975
|
contentType: "tipbar",
|
|
862
976
|
...t
|
|
863
977
|
});
|
|
864
|
-
return /* @__PURE__ */
|
|
865
|
-
},
|
|
978
|
+
return /* @__PURE__ */ I(e, { data: o });
|
|
979
|
+
}, kt = {
|
|
980
|
+
CommonPageContent: Ot,
|
|
981
|
+
HeaderContent: Et,
|
|
982
|
+
TipbarContent: At,
|
|
983
|
+
FooterContent: Tt,
|
|
984
|
+
PLPContent: Pt
|
|
985
|
+
}, ir = { Components: kt }, Nt = n.object({
|
|
866
986
|
query: n.string()
|
|
867
987
|
});
|
|
868
|
-
async function
|
|
988
|
+
async function wt({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
869
989
|
if (!t) {
|
|
870
990
|
console.error("[ERROR FETCHING] Body is required");
|
|
871
991
|
return;
|
|
872
992
|
}
|
|
873
|
-
await
|
|
874
|
-
const { query: r = "" } = t,
|
|
875
|
-
return
|
|
876
|
-
`${e}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${
|
|
993
|
+
await Nt.validate(t);
|
|
994
|
+
const { query: r = "" } = t, a = new URLSearchParams({ query: r });
|
|
995
|
+
return f(
|
|
996
|
+
`${e}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${a.toString()}`,
|
|
877
997
|
{
|
|
878
998
|
...o
|
|
879
999
|
}
|
|
880
1000
|
);
|
|
881
1001
|
}
|
|
882
|
-
const
|
|
1002
|
+
const jt = (e, t) => ge(e, t), Dt = (e) => ({
|
|
883
1003
|
...e,
|
|
884
|
-
description: e.description ?
|
|
885
|
-
}),
|
|
1004
|
+
description: e.description ? jt(e.description) : e.description
|
|
1005
|
+
}), Ht = ({
|
|
886
1006
|
offer: e,
|
|
887
1007
|
seller: t,
|
|
888
1008
|
product: o
|
|
@@ -890,74 +1010,74 @@ const qt = (e, t) => me(e, t), At = (e) => ({
|
|
|
890
1010
|
...e,
|
|
891
1011
|
product: o,
|
|
892
1012
|
seller: t
|
|
893
|
-
}),
|
|
1013
|
+
}), W = (e, t) => ({
|
|
894
1014
|
...e,
|
|
895
|
-
isVariantOf:
|
|
896
|
-
}),
|
|
1015
|
+
isVariantOf: Dt(t)
|
|
1016
|
+
}), _t = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", k = (e) => e.AvailableQuantity > 0, U = (e) => e.spotPrice ?? 0, Bt = (e) => e.Price ?? 0, X = (e, t) => k(e) && !k(t) ? -1 : !k(e) && k(t) ? 1 : U(e) - U(t), Gt = (e, t) => {
|
|
897
1017
|
let o = 0;
|
|
898
1018
|
for (let r = 1; r < e.length; r++)
|
|
899
1019
|
t(e[o], e[r]) > 0 && (o = r);
|
|
900
1020
|
return e[o];
|
|
901
|
-
},
|
|
1021
|
+
}, Y = (e) => {
|
|
902
1022
|
const t = e.flatMap(
|
|
903
|
-
(r) => r.sellers.map((
|
|
904
|
-
offer:
|
|
1023
|
+
(r) => r.sellers.map((a) => ({
|
|
1024
|
+
offer: a.commertialOffer,
|
|
905
1025
|
sku: r
|
|
906
1026
|
}))
|
|
907
|
-
), o =
|
|
1027
|
+
), o = Gt(
|
|
908
1028
|
t,
|
|
909
|
-
({ offer: r }, { offer:
|
|
1029
|
+
({ offer: r }, { offer: a }) => X(r, a)
|
|
910
1030
|
);
|
|
911
1031
|
return o ? o.sku : e[0];
|
|
912
|
-
},
|
|
1032
|
+
}, Z = (e) => e.map(
|
|
913
1033
|
({ imageUrl: t, imageText: o, imageLabel: r }) => ({
|
|
914
1034
|
alternateName: o ?? "",
|
|
915
1035
|
url: t.replace("vteximg.com.br", "vtexassets.com"),
|
|
916
1036
|
keywords: r
|
|
917
1037
|
})
|
|
918
|
-
),
|
|
1038
|
+
), j = {
|
|
919
1039
|
attachment: "ATTACHMENT",
|
|
920
1040
|
specification: "SPECIFICATION",
|
|
921
1041
|
attribute: "ATTRIBUTE"
|
|
922
|
-
},
|
|
1042
|
+
}, Vt = (e) => ({
|
|
923
1043
|
name: e.name,
|
|
924
1044
|
value: e.content,
|
|
925
|
-
valueReference:
|
|
926
|
-
}),
|
|
1045
|
+
valueReference: j.attachment
|
|
1046
|
+
}), Lt = (e) => ({
|
|
927
1047
|
propertyID: e.id,
|
|
928
1048
|
name: e.name,
|
|
929
1049
|
value: e.value,
|
|
930
1050
|
valueReference: {
|
|
931
|
-
valueReference:
|
|
1051
|
+
valueReference: j.attribute,
|
|
932
1052
|
visible: e.visible
|
|
933
1053
|
}
|
|
934
|
-
}),
|
|
935
|
-
const r = e.flatMap(({ name: i, values: c }) => c ? c.map((
|
|
1054
|
+
}), D = (e, t, o) => {
|
|
1055
|
+
const r = e.flatMap(({ name: i, values: c }) => c ? c.map((d) => ({
|
|
936
1056
|
name: i,
|
|
937
|
-
value:
|
|
938
|
-
valueReference:
|
|
1057
|
+
value: d,
|
|
1058
|
+
valueReference: j.specification
|
|
939
1059
|
})) : {
|
|
940
1060
|
name: i,
|
|
941
1061
|
value: "",
|
|
942
|
-
valueReference:
|
|
943
|
-
}),
|
|
1062
|
+
valueReference: j.specification
|
|
1063
|
+
}), a = Array.isArray(o) ? o.map(Vt) : [], s = t ? t.map(Lt) : [];
|
|
944
1064
|
return [
|
|
945
1065
|
...r,
|
|
946
|
-
...
|
|
947
|
-
...
|
|
1066
|
+
...a,
|
|
1067
|
+
...s
|
|
948
1068
|
];
|
|
949
|
-
},
|
|
1069
|
+
}, M = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", Ut = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", Mt = (e) => {
|
|
950
1070
|
let t = e.slice(0);
|
|
951
|
-
for (let o = 0; o <
|
|
1071
|
+
for (let o = 0; o < M.length; o++)
|
|
952
1072
|
t = t.replace(
|
|
953
|
-
new RegExp(
|
|
954
|
-
|
|
1073
|
+
new RegExp(M.charAt(o), "g"),
|
|
1074
|
+
Ut.charAt(o)
|
|
955
1075
|
);
|
|
956
1076
|
return t;
|
|
957
|
-
},
|
|
1077
|
+
}, xt = (e) => e.replace(/[·/_,:]/, "-"), ee = (e) => {
|
|
958
1078
|
const o = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}|><=_^]/g, "-");
|
|
959
|
-
return
|
|
960
|
-
},
|
|
1079
|
+
return xt(Mt(o)).toLowerCase();
|
|
1080
|
+
}, te = (e) => `/${e}/p`, re = (e) => {
|
|
961
1081
|
const t = Math.max(
|
|
962
1082
|
...e.map((r) => r.NumberOfInstallments)
|
|
963
1083
|
), o = e.find(
|
|
@@ -967,43 +1087,43 @@ const qt = (e, t) => me(e, t), At = (e) => ({
|
|
|
967
1087
|
count: (o == null ? void 0 : o.NumberOfInstallments) ?? 0,
|
|
968
1088
|
value: (o == null ? void 0 : o.Value) ?? 0
|
|
969
1089
|
};
|
|
970
|
-
},
|
|
1090
|
+
}, oe = (e, t) => {
|
|
971
1091
|
const o = {
|
|
972
1092
|
price: 0,
|
|
973
1093
|
listPrice: 0,
|
|
974
1094
|
sellerDefault: !1
|
|
975
|
-
},
|
|
976
|
-
(
|
|
977
|
-
offer:
|
|
978
|
-
seller:
|
|
1095
|
+
}, a = e.map(
|
|
1096
|
+
(s) => Ht({
|
|
1097
|
+
offer: s.commertialOffer,
|
|
1098
|
+
seller: s,
|
|
979
1099
|
product: t
|
|
980
1100
|
})
|
|
981
|
-
).sort(
|
|
982
|
-
availability:
|
|
983
|
-
listPrice:
|
|
984
|
-
price:
|
|
985
|
-
priceValidUntil:
|
|
1101
|
+
).sort(X).map((s) => (s.seller.sellerId === "1" && s.AvailableQuantity > 0 && (o.price = s.Price, o.listPrice = s.ListPrice, o.sellerDefault = !0), {
|
|
1102
|
+
availability: s.AvailableQuantity > 0,
|
|
1103
|
+
listPrice: s.ListPrice,
|
|
1104
|
+
price: Bt(s),
|
|
1105
|
+
priceValidUntil: s.PriceValidUntil,
|
|
986
1106
|
priceCurrency: "BRL",
|
|
987
|
-
installments:
|
|
988
|
-
lowPrice:
|
|
989
|
-
quantity:
|
|
1107
|
+
installments: s.Installments,
|
|
1108
|
+
lowPrice: s.spotPrice,
|
|
1109
|
+
quantity: s.AvailableQuantity,
|
|
990
1110
|
seller: {
|
|
991
|
-
identifier:
|
|
1111
|
+
identifier: s.seller.sellerId
|
|
992
1112
|
}
|
|
993
1113
|
}));
|
|
994
1114
|
return {
|
|
995
|
-
lowPrice: o.sellerDefault ? o.price :
|
|
996
|
-
highPrice: o.sellerDefault ? o.listPrice :
|
|
997
|
-
offers:
|
|
1115
|
+
lowPrice: o.sellerDefault ? o.price : a[0].price,
|
|
1116
|
+
highPrice: o.sellerDefault ? o.listPrice : a[0].listPrice,
|
|
1117
|
+
offers: a
|
|
998
1118
|
};
|
|
999
|
-
},
|
|
1000
|
-
const { attributes: t, itemId: o, name: r, sellers:
|
|
1119
|
+
}, ne = (e) => {
|
|
1120
|
+
const { attributes: t, itemId: o, name: r, sellers: a, variations: s } = e;
|
|
1001
1121
|
return {
|
|
1002
|
-
additionalProperty:
|
|
1122
|
+
additionalProperty: D(s, t, []),
|
|
1003
1123
|
name: r,
|
|
1004
1124
|
offers: {
|
|
1005
|
-
offers:
|
|
1006
|
-
availability:
|
|
1125
|
+
offers: a.map(({ sellerId: i, commertialOffer: c }) => ({
|
|
1126
|
+
availability: _t(c.AvailableQuantity > 0),
|
|
1007
1127
|
listPrice: c.ListPrice,
|
|
1008
1128
|
price: c.Price,
|
|
1009
1129
|
quantity: c.AvailableQuantity,
|
|
@@ -1015,193 +1135,193 @@ const qt = (e, t) => me(e, t), At = (e) => ({
|
|
|
1015
1135
|
sku: o
|
|
1016
1136
|
// slug: getSlug('', itemId), // getSlug('', itemId) que tipo de slug é esse?
|
|
1017
1137
|
};
|
|
1018
|
-
},
|
|
1019
|
-
var
|
|
1138
|
+
}, zt = (e) => {
|
|
1139
|
+
var q;
|
|
1020
1140
|
const {
|
|
1021
1141
|
attributes: t,
|
|
1022
1142
|
referenceId: o,
|
|
1023
1143
|
isVariantOf: r,
|
|
1024
|
-
images:
|
|
1025
|
-
itemId:
|
|
1144
|
+
images: a,
|
|
1145
|
+
itemId: s,
|
|
1026
1146
|
name: i,
|
|
1027
1147
|
sellers: c,
|
|
1028
|
-
videos:
|
|
1148
|
+
videos: d,
|
|
1029
1149
|
variations: g
|
|
1030
1150
|
} = e, {
|
|
1031
|
-
brand:
|
|
1032
|
-
categories:
|
|
1033
|
-
categoriesIds:
|
|
1034
|
-
description:
|
|
1035
|
-
linkText:
|
|
1036
|
-
productClusters:
|
|
1037
|
-
clusterHighlights:
|
|
1038
|
-
productName:
|
|
1039
|
-
properties:
|
|
1040
|
-
productId:
|
|
1041
|
-
} = r,
|
|
1151
|
+
brand: m,
|
|
1152
|
+
categories: l,
|
|
1153
|
+
categoriesIds: u,
|
|
1154
|
+
description: p,
|
|
1155
|
+
linkText: h,
|
|
1156
|
+
productClusters: $,
|
|
1157
|
+
clusterHighlights: C,
|
|
1158
|
+
productName: R,
|
|
1159
|
+
properties: S,
|
|
1160
|
+
productId: O
|
|
1161
|
+
} = r, T = l.slice().reverse(), b = oe(c, e.isVariantOf), H = re(b.offers[0].installments);
|
|
1042
1162
|
return {
|
|
1043
|
-
sku:
|
|
1044
|
-
gtin: ((
|
|
1045
|
-
name:
|
|
1046
|
-
description:
|
|
1163
|
+
sku: s,
|
|
1164
|
+
gtin: ((q = o[0]) == null ? void 0 : q.Value) ?? "",
|
|
1165
|
+
name: R ?? i,
|
|
1166
|
+
description: p,
|
|
1047
1167
|
releaseDate: r.releaseDate ?? "",
|
|
1048
|
-
slug:
|
|
1049
|
-
video:
|
|
1050
|
-
categories:
|
|
1051
|
-
categoriesIds:
|
|
1052
|
-
id:
|
|
1053
|
-
brand: { name:
|
|
1168
|
+
slug: h,
|
|
1169
|
+
video: d[0],
|
|
1170
|
+
categories: l,
|
|
1171
|
+
categoriesIds: u,
|
|
1172
|
+
id: O,
|
|
1173
|
+
brand: { name: m, brandName: m },
|
|
1054
1174
|
seo: {
|
|
1055
|
-
description:
|
|
1056
|
-
title:
|
|
1057
|
-
canonical:
|
|
1175
|
+
description: p,
|
|
1176
|
+
title: R,
|
|
1177
|
+
canonical: te(h)
|
|
1058
1178
|
},
|
|
1059
1179
|
cluster: {
|
|
1060
|
-
generals:
|
|
1061
|
-
highlights:
|
|
1180
|
+
generals: $,
|
|
1181
|
+
highlights: C
|
|
1062
1182
|
},
|
|
1063
|
-
properties:
|
|
1064
|
-
availability: { status:
|
|
1183
|
+
properties: S,
|
|
1184
|
+
availability: { status: b.offers[0].availability },
|
|
1065
1185
|
breadcrumbList: {
|
|
1066
1186
|
itemListElement: [
|
|
1067
|
-
...
|
|
1068
|
-
const
|
|
1187
|
+
...T.map((y, P) => {
|
|
1188
|
+
const v = y.split("/"), E = v[v.length - 2], _ = v.map(ee).join("/");
|
|
1069
1189
|
return {
|
|
1070
|
-
name:
|
|
1071
|
-
item:
|
|
1072
|
-
position:
|
|
1190
|
+
name: E,
|
|
1191
|
+
item: _,
|
|
1192
|
+
position: P + 1
|
|
1073
1193
|
};
|
|
1074
1194
|
}),
|
|
1075
1195
|
{
|
|
1076
1196
|
name: r.productName,
|
|
1077
|
-
item:
|
|
1078
|
-
position:
|
|
1197
|
+
item: h,
|
|
1198
|
+
position: l.length + 1
|
|
1079
1199
|
}
|
|
1080
1200
|
],
|
|
1081
|
-
numberOfItems:
|
|
1201
|
+
numberOfItems: l.length
|
|
1082
1202
|
},
|
|
1083
|
-
image:
|
|
1084
|
-
offers:
|
|
1085
|
-
additionalProperty:
|
|
1203
|
+
image: Z(a),
|
|
1204
|
+
offers: b,
|
|
1205
|
+
additionalProperty: D(g, t, []),
|
|
1086
1206
|
isVariantOf: {
|
|
1087
1207
|
productGroupID: r.productId,
|
|
1088
|
-
hasVariant: r.items.map((
|
|
1208
|
+
hasVariant: r.items.map((y) => ne(y))
|
|
1089
1209
|
},
|
|
1090
|
-
installments:
|
|
1210
|
+
installments: H
|
|
1091
1211
|
};
|
|
1092
|
-
},
|
|
1093
|
-
var
|
|
1212
|
+
}, Qt = (e) => {
|
|
1213
|
+
var q;
|
|
1094
1214
|
const {
|
|
1095
1215
|
attributes: t,
|
|
1096
1216
|
referenceId: o,
|
|
1097
1217
|
isVariantOf: r,
|
|
1098
|
-
images:
|
|
1099
|
-
itemId:
|
|
1218
|
+
images: a,
|
|
1219
|
+
itemId: s,
|
|
1100
1220
|
name: i,
|
|
1101
1221
|
sellers: c,
|
|
1102
|
-
Videos:
|
|
1222
|
+
Videos: d,
|
|
1103
1223
|
variations: g
|
|
1104
1224
|
} = e, {
|
|
1105
|
-
brand:
|
|
1106
|
-
categories:
|
|
1107
|
-
categoriesIds:
|
|
1108
|
-
description:
|
|
1109
|
-
linkText:
|
|
1110
|
-
productClusters:
|
|
1111
|
-
productName:
|
|
1112
|
-
Coleção:
|
|
1113
|
-
"ID Coleção":
|
|
1114
|
-
productId:
|
|
1115
|
-
} = r,
|
|
1225
|
+
brand: m,
|
|
1226
|
+
categories: l,
|
|
1227
|
+
categoriesIds: u,
|
|
1228
|
+
description: p,
|
|
1229
|
+
linkText: h,
|
|
1230
|
+
productClusters: $,
|
|
1231
|
+
productName: C,
|
|
1232
|
+
Coleção: R,
|
|
1233
|
+
"ID Coleção": S,
|
|
1234
|
+
productId: O
|
|
1235
|
+
} = r, T = l.slice().reverse(), b = oe(c, e.isVariantOf), H = re(b.offers[0].installments);
|
|
1116
1236
|
return {
|
|
1117
|
-
sku:
|
|
1118
|
-
gtin: ((
|
|
1119
|
-
name:
|
|
1120
|
-
description:
|
|
1237
|
+
sku: s,
|
|
1238
|
+
gtin: ((q = o[0]) == null ? void 0 : q.Value) ?? "",
|
|
1239
|
+
name: C ?? i,
|
|
1240
|
+
description: p,
|
|
1121
1241
|
releaseDate: r.releaseDate ?? "",
|
|
1122
|
-
slug:
|
|
1123
|
-
video:
|
|
1124
|
-
categories:
|
|
1125
|
-
categoriesIds:
|
|
1126
|
-
collection:
|
|
1127
|
-
collectionId:
|
|
1128
|
-
id:
|
|
1129
|
-
brand: { name:
|
|
1242
|
+
slug: h,
|
|
1243
|
+
video: d[0],
|
|
1244
|
+
categories: l,
|
|
1245
|
+
categoriesIds: u,
|
|
1246
|
+
collection: R,
|
|
1247
|
+
collectionId: S,
|
|
1248
|
+
id: O,
|
|
1249
|
+
brand: { name: m, brandName: m },
|
|
1130
1250
|
seo: {
|
|
1131
|
-
description:
|
|
1132
|
-
title:
|
|
1133
|
-
canonical:
|
|
1251
|
+
description: p,
|
|
1252
|
+
title: C,
|
|
1253
|
+
canonical: te(h)
|
|
1134
1254
|
},
|
|
1135
1255
|
cluster: {
|
|
1136
|
-
generals:
|
|
1256
|
+
generals: $,
|
|
1137
1257
|
highlights: []
|
|
1138
1258
|
// TODO: add highlights
|
|
1139
1259
|
},
|
|
1140
|
-
availability: { status:
|
|
1260
|
+
availability: { status: b.offers[0].availability },
|
|
1141
1261
|
breadcrumbList: {
|
|
1142
1262
|
itemListElement: [
|
|
1143
|
-
...
|
|
1144
|
-
const
|
|
1263
|
+
...T.map((y, P) => {
|
|
1264
|
+
const v = y.split("/"), E = v[v.length - 2], _ = v.map(ee).join("/");
|
|
1145
1265
|
return {
|
|
1146
|
-
name:
|
|
1147
|
-
item:
|
|
1148
|
-
position:
|
|
1266
|
+
name: E,
|
|
1267
|
+
item: _,
|
|
1268
|
+
position: P + 1
|
|
1149
1269
|
};
|
|
1150
1270
|
}),
|
|
1151
1271
|
{
|
|
1152
1272
|
name: r.productName,
|
|
1153
|
-
item:
|
|
1154
|
-
position:
|
|
1273
|
+
item: h,
|
|
1274
|
+
position: l.length + 1
|
|
1155
1275
|
}
|
|
1156
1276
|
],
|
|
1157
|
-
numberOfItems:
|
|
1277
|
+
numberOfItems: l.length
|
|
1158
1278
|
},
|
|
1159
|
-
image:
|
|
1160
|
-
offers:
|
|
1161
|
-
additionalProperty:
|
|
1279
|
+
image: Z(a),
|
|
1280
|
+
offers: b,
|
|
1281
|
+
additionalProperty: D(g, t, []),
|
|
1162
1282
|
isVariantOf: {
|
|
1163
1283
|
productGroupID: r.productId,
|
|
1164
|
-
hasVariant: r.items.map((
|
|
1165
|
-
const { variations:
|
|
1166
|
-
name:
|
|
1167
|
-
values:
|
|
1284
|
+
hasVariant: r.items.map((y) => {
|
|
1285
|
+
const { variations: P } = y, v = P.map((E) => ({
|
|
1286
|
+
name: E,
|
|
1287
|
+
values: y[E]
|
|
1168
1288
|
}));
|
|
1169
1289
|
return {
|
|
1170
|
-
...
|
|
1171
|
-
additionalProperty:
|
|
1172
|
-
|
|
1290
|
+
...ne(y),
|
|
1291
|
+
additionalProperty: D(
|
|
1292
|
+
v,
|
|
1173
1293
|
t,
|
|
1174
1294
|
[]
|
|
1175
1295
|
)
|
|
1176
1296
|
};
|
|
1177
1297
|
})
|
|
1178
1298
|
},
|
|
1179
|
-
installments:
|
|
1299
|
+
installments: H
|
|
1180
1300
|
};
|
|
1181
|
-
},
|
|
1301
|
+
}, Jt = n.array().of(n.object({
|
|
1182
1302
|
key: n.string().required(),
|
|
1183
1303
|
value: n.string().required()
|
|
1184
1304
|
})).required("Facets are required");
|
|
1185
|
-
async function
|
|
1305
|
+
async function Kt({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
1186
1306
|
if (!t) {
|
|
1187
1307
|
console.error("[ERROR FETCHING] Body is required");
|
|
1188
1308
|
return;
|
|
1189
1309
|
}
|
|
1190
|
-
await
|
|
1191
|
-
const r = new URLSearchParams({}),
|
|
1192
|
-
|
|
1193
|
-
const
|
|
1194
|
-
return
|
|
1310
|
+
await Jt.validate(t);
|
|
1311
|
+
const r = new URLSearchParams({}), a = t.map(({ key: i, value: c }) => `${i}/${c}`).join("/");
|
|
1312
|
+
le(t, r);
|
|
1313
|
+
const s = `${e}/api/catalog_system/pub/products/crossselling/${a}`;
|
|
1314
|
+
return f(s, {
|
|
1195
1315
|
cache: "no-store",
|
|
1196
1316
|
...o
|
|
1197
|
-
}).then((i) => i.map((
|
|
1198
|
-
const g =
|
|
1199
|
-
return g &&
|
|
1200
|
-
}).filter((
|
|
1201
|
-
node:
|
|
1317
|
+
}).then((i) => i.map((d) => {
|
|
1318
|
+
const g = Y(d.items);
|
|
1319
|
+
return g && W(g, d);
|
|
1320
|
+
}).filter((d) => !!d).map((d) => ({
|
|
1321
|
+
node: Qt(d)
|
|
1202
1322
|
})));
|
|
1203
1323
|
}
|
|
1204
|
-
const
|
|
1324
|
+
const se = ({
|
|
1205
1325
|
apiUrl: e,
|
|
1206
1326
|
body: t,
|
|
1207
1327
|
fetchOptions: o,
|
|
@@ -1212,25 +1332,25 @@ const re = ({
|
|
|
1212
1332
|
return;
|
|
1213
1333
|
}
|
|
1214
1334
|
const {
|
|
1215
|
-
query:
|
|
1216
|
-
page:
|
|
1335
|
+
query: a = "",
|
|
1336
|
+
page: s = 1,
|
|
1217
1337
|
count: i,
|
|
1218
1338
|
sort: c = "",
|
|
1219
|
-
facets:
|
|
1339
|
+
facets: d = [],
|
|
1220
1340
|
type: g,
|
|
1221
|
-
hideUnavailableItems:
|
|
1222
|
-
locale:
|
|
1223
|
-
} = t,
|
|
1224
|
-
page:
|
|
1341
|
+
hideUnavailableItems: m = !0,
|
|
1342
|
+
locale: l = ""
|
|
1343
|
+
} = t, u = new URLSearchParams({
|
|
1344
|
+
page: s.toString(),
|
|
1225
1345
|
count: (i == null ? void 0 : i.toString()) ?? (r == null ? void 0 : r.ITEMS_PER_PAGE) ?? 24,
|
|
1226
|
-
query:
|
|
1346
|
+
query: a,
|
|
1227
1347
|
sort: c,
|
|
1228
|
-
locale:
|
|
1348
|
+
locale: l
|
|
1229
1349
|
});
|
|
1230
|
-
|
|
1231
|
-
const
|
|
1232
|
-
return
|
|
1233
|
-
`${e}/api/io/_v/api/intelligent-search/${g}/${
|
|
1350
|
+
m !== void 0 && u.append("hideUnavailableItems", m.toString());
|
|
1351
|
+
const p = d.map((h) => `${h.key}/${h.value}`).join("/") ?? "";
|
|
1352
|
+
return he(
|
|
1353
|
+
`${e}/api/io/_v/api/intelligent-search/${g}/${p}?${u.toString()}`,
|
|
1234
1354
|
{
|
|
1235
1355
|
headers: {
|
|
1236
1356
|
Accept: "application/json",
|
|
@@ -1240,48 +1360,48 @@ const re = ({
|
|
|
1240
1360
|
}
|
|
1241
1361
|
);
|
|
1242
1362
|
};
|
|
1243
|
-
async function
|
|
1363
|
+
async function Wt({ body: e, extraData: t, ...o }) {
|
|
1244
1364
|
if (!e) {
|
|
1245
1365
|
console.error("[ERROR FETCHING] Body is required");
|
|
1246
1366
|
return;
|
|
1247
1367
|
}
|
|
1248
|
-
const r = await
|
|
1368
|
+
const r = await se({
|
|
1249
1369
|
body: {
|
|
1250
1370
|
...e,
|
|
1251
1371
|
type: "product_search"
|
|
1252
1372
|
},
|
|
1253
1373
|
extraData: t,
|
|
1254
1374
|
...o
|
|
1255
|
-
}),
|
|
1256
|
-
const
|
|
1257
|
-
return
|
|
1375
|
+
}), a = (r == null ? void 0 : r.products.map((c) => {
|
|
1376
|
+
const d = Y(c.items);
|
|
1377
|
+
return d && W(d, c);
|
|
1258
1378
|
}).filter((c) => !!c)) ?? [], {
|
|
1259
|
-
pagination:
|
|
1379
|
+
pagination: s,
|
|
1260
1380
|
recordsFiltered: i
|
|
1261
1381
|
} = r;
|
|
1262
1382
|
return {
|
|
1263
1383
|
data: {
|
|
1264
1384
|
pagination: {
|
|
1265
|
-
nextPage:
|
|
1266
|
-
previousPage:
|
|
1385
|
+
nextPage: s.after.length > 0,
|
|
1386
|
+
previousPage: s.before.length > 0,
|
|
1267
1387
|
startCursor: "0",
|
|
1268
1388
|
endCursor: i.toString(),
|
|
1269
1389
|
count: i,
|
|
1270
|
-
total:
|
|
1390
|
+
total: s.count
|
|
1271
1391
|
},
|
|
1272
|
-
products:
|
|
1273
|
-
node:
|
|
1274
|
-
cursor:
|
|
1392
|
+
products: a.map((c, d) => ({
|
|
1393
|
+
node: zt(c),
|
|
1394
|
+
cursor: d.toString()
|
|
1275
1395
|
}))
|
|
1276
1396
|
}
|
|
1277
1397
|
};
|
|
1278
1398
|
}
|
|
1279
|
-
async function
|
|
1399
|
+
async function Xt({ body: e, extraData: t, ...o }) {
|
|
1280
1400
|
if (!e) {
|
|
1281
1401
|
console.error("[ERROR FETCHING] Body is required");
|
|
1282
1402
|
return;
|
|
1283
1403
|
}
|
|
1284
|
-
const r = await
|
|
1404
|
+
const r = await se({
|
|
1285
1405
|
body: {
|
|
1286
1406
|
...e,
|
|
1287
1407
|
type: "facets"
|
|
@@ -1292,55 +1412,55 @@ async function xt({ body: e, extraData: t, ...o }) {
|
|
|
1292
1412
|
return !r || !r.facets ? (console.error("[ERROR FETCHING] No facets found"), { data: { facets: [] } }) : {
|
|
1293
1413
|
data: {
|
|
1294
1414
|
...r,
|
|
1295
|
-
facets:
|
|
1415
|
+
facets: ue(r, e == null ? void 0 : e.selectedFacets, (e == null ? void 0 : e.query) ?? "")
|
|
1296
1416
|
}
|
|
1297
1417
|
};
|
|
1298
1418
|
}
|
|
1299
|
-
const
|
|
1419
|
+
const Yt = n.object({
|
|
1300
1420
|
query: n.string().optional(),
|
|
1301
1421
|
locale: n.string().optional()
|
|
1302
1422
|
});
|
|
1303
|
-
async function
|
|
1423
|
+
async function Zt({ apiUrl: e, body: t, fetchOptions: o }) {
|
|
1304
1424
|
if (!t) {
|
|
1305
1425
|
console.error("[ERROR FETCHING] Body is required");
|
|
1306
1426
|
return;
|
|
1307
1427
|
}
|
|
1308
|
-
await
|
|
1309
|
-
const { query: r = "", locale:
|
|
1310
|
-
return
|
|
1311
|
-
`${e}/api/io/_v/api/intelligent-search/search_suggestions?${
|
|
1428
|
+
await Yt.validate(t);
|
|
1429
|
+
const { query: r = "", locale: a = "default_locale" } = t, s = new URLSearchParams({ query: r, locale: a });
|
|
1430
|
+
return f(
|
|
1431
|
+
`${e}/api/io/_v/api/intelligent-search/search_suggestions?${s.toString()}`,
|
|
1312
1432
|
{
|
|
1313
1433
|
...o
|
|
1314
1434
|
}
|
|
1315
1435
|
);
|
|
1316
1436
|
}
|
|
1317
|
-
async function
|
|
1318
|
-
return
|
|
1437
|
+
async function er({ apiUrl: e }) {
|
|
1438
|
+
return f(`${e}/api/io/_v/api/intelligent-search/top_searches`);
|
|
1319
1439
|
}
|
|
1320
|
-
const
|
|
1440
|
+
const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1321
1441
|
__proto__: null,
|
|
1322
|
-
getSearchAutoCompleteSuggestions:
|
|
1323
|
-
getSearchCrossellingProducts:
|
|
1324
|
-
getSearchFacets:
|
|
1325
|
-
getSearchProducts:
|
|
1326
|
-
getSearchSuggestedTerms:
|
|
1327
|
-
getSearchTopSearchs:
|
|
1328
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1329
|
-
parseSearchState:
|
|
1330
|
-
convertSearchParams:
|
|
1331
|
-
filterNonRootFacets:
|
|
1332
|
-
filterNonCategorySelected:
|
|
1333
|
-
},
|
|
1334
|
-
checkout:
|
|
1335
|
-
catalog:
|
|
1336
|
-
cms:
|
|
1337
|
-
search:
|
|
1338
|
-
},
|
|
1339
|
-
catalog:
|
|
1340
|
-
search:
|
|
1442
|
+
getSearchAutoCompleteSuggestions: wt,
|
|
1443
|
+
getSearchCrossellingProducts: Kt,
|
|
1444
|
+
getSearchFacets: Xt,
|
|
1445
|
+
getSearchProducts: Wt,
|
|
1446
|
+
getSearchSuggestedTerms: Zt,
|
|
1447
|
+
getSearchTopSearchs: er
|
|
1448
|
+
}, Symbol.toStringTag, { value: "Module" })), rr = {
|
|
1449
|
+
parseSearchState: fe,
|
|
1450
|
+
convertSearchParams: pe,
|
|
1451
|
+
filterNonRootFacets: me,
|
|
1452
|
+
filterNonCategorySelected: de
|
|
1453
|
+
}, cr = {
|
|
1454
|
+
checkout: rt,
|
|
1455
|
+
catalog: lt,
|
|
1456
|
+
cms: $t,
|
|
1457
|
+
search: tr
|
|
1458
|
+
}, lr = {
|
|
1459
|
+
catalog: yt,
|
|
1460
|
+
search: rr
|
|
1341
1461
|
};
|
|
1342
1462
|
export {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1463
|
+
cr as serverAPIs,
|
|
1464
|
+
ir as serverCMS,
|
|
1465
|
+
lr as serverHelpers
|
|
1346
1466
|
};
|