@soma-vertical-web/multi-lib 0.0.33 → 0.0.35

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