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