@soma-vertical-web/multi-lib 0.0.48 → 0.0.49

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/index2.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as n from "yup";
2
- import { f as se, r as w, a as ae, b as ie, d as ce, e as le, c as ue, p as de } from "./__vite-browser-external-C4n7rb1H.mjs";
2
+ import { f as ae, r as N, a as se, b as ie, d as ce, e as le, c as ue, p as de } from "./__vite-browser-external-C4n7rb1H.mjs";
3
3
  import { jsxs as z, Fragment as G, jsx as I } from "react/jsx-runtime";
4
4
  import { Utils as j, helpers as B } from "@soma-vertical-web/core-components";
5
- import me from "sanitize-html";
6
- const g = async (e, t = {}) => {
5
+ import pe from "sanitize-html";
6
+ const h = async (e, t = {}) => {
7
7
  const { method: o = "GET", body: r, headers: s = {}, priority: a = "auto", cache: i = "default" } = t;
8
8
  return fetch(e, {
9
9
  method: o,
@@ -20,12 +20,12 @@ const g = async (e, t = {}) => {
20
20
  console.error("[ERROR FETCH VTEX]", c);
21
21
  });
22
22
  }, P = /* @__PURE__ */ new Map();
23
- async function pe(e, t = {}) {
23
+ async function me(e, t = {}) {
24
24
  var o;
25
25
  try {
26
26
  const { abort: r = !1 } = t, s = new AbortController();
27
27
  r && (P.has(e) && ((o = P.get(e)) == null || o.abort(), P.delete(e)), P.set(e, s));
28
- const a = g(e, {
28
+ const a = h(e, {
29
29
  ...t,
30
30
  ...r ? { signal: s.signal } : {}
31
31
  });
@@ -49,7 +49,7 @@ async function ge({ apiUrl: e, body: t, fetchOptions: o }) {
49
49
  }
50
50
  await fe.validate(t);
51
51
  const { country: r, postalCode: s } = t;
52
- return await g(
52
+ return await h(
53
53
  `${e}/api/checkout/pub/postal-code/${r}/${s}`,
54
54
  {
55
55
  method: "POST",
@@ -74,7 +74,7 @@ async function Q({
74
74
  }
75
75
  await he.validate(t);
76
76
  const { orderFormId: r, sellerCode: s, sellerName: a } = t, i = s ? `${s.trim()} - ${a}` : null;
77
- return g(
77
+ return h(
78
78
  `${e}/api/checkout/pub/orderForm/${r}/attachments/openTextField`,
79
79
  {
80
80
  method: "POST",
@@ -100,7 +100,7 @@ async function J({ apiUrl: e, body: t, fetchOptions: o }) {
100
100
  utmCampaign: s ? s.toUpperCase() : "",
101
101
  utmiCampaign: s ? "codigodavendedora" : "semcodigo"
102
102
  } : {};
103
- return g(
103
+ return h(
104
104
  `${e}/api/checkout/pub/orderForm/${r}/attachments/marketingData`,
105
105
  {
106
106
  method: "POST",
@@ -112,17 +112,17 @@ async function J({ apiUrl: e, body: t, fetchOptions: o }) {
112
112
  }
113
113
  );
114
114
  }
115
- const be = n.object({
115
+ const ye = n.object({
116
116
  orderFormId: n.string().nullable(),
117
117
  sellerCode: n.string().nullable(),
118
118
  sellerName: n.string().nullable()
119
119
  });
120
- async function ye({ apiUrl: e, body: t, fetchOptions: o }) {
120
+ async function be({ apiUrl: e, body: t, fetchOptions: o }) {
121
121
  if (!t) {
122
122
  console.error("[ERROR FETCHING] Body is required");
123
123
  return;
124
124
  }
125
- await be.validate(t);
125
+ await ye.validate(t);
126
126
  const r = await Q({ apiUrl: e, body: t, fetchOptions: o });
127
127
  return J({
128
128
  apiUrl: e,
@@ -133,11 +133,11 @@ async function ye({ apiUrl: e, body: t, fetchOptions: o }) {
133
133
  fetchOptions: o
134
134
  });
135
135
  }
136
- const ve = n.object({
136
+ const Ce = n.object({
137
137
  orderFormId: n.string().nullable(),
138
138
  coupon: n.string().nullable()
139
139
  });
140
- async function Ce({
140
+ async function ve({
141
141
  apiUrl: e,
142
142
  body: t,
143
143
  fetchOptions: o
@@ -146,9 +146,9 @@ async function Ce({
146
146
  console.error("[ERROR FETCHING] Body is required");
147
147
  return;
148
148
  }
149
- await ve.validate(t);
149
+ await Ce.validate(t);
150
150
  const { coupon: r = "", orderFormId: s } = t;
151
- return g(
151
+ return h(
152
152
  `${e}/api/checkout/pub/orderForm/${s}/coupons`,
153
153
  {
154
154
  method: "POST",
@@ -173,7 +173,7 @@ async function Fe({
173
173
  }
174
174
  await Re.validate(t);
175
175
  const { appId: r = "faststore", orderFormId: s, key: a } = t;
176
- return g(
176
+ return h(
177
177
  `${e}/api/checkout/pub/orderForm/${s}/customData/${r}/${a}`,
178
178
  {
179
179
  method: "PUT",
@@ -181,23 +181,23 @@ async function Fe({
181
181
  }
182
182
  );
183
183
  }
184
- const $e = n.object().shape({
184
+ const Se = n.object().shape({
185
185
  name: n.string().required("Attachment name is required"),
186
186
  content: n.object().nullable()
187
187
  });
188
188
  var M;
189
- const Se = n.object().shape({
190
- attachments: (M = n.array().of($e)) == null ? void 0 : M.nullable(),
189
+ const $e = n.object().shape({
190
+ attachments: (M = n.array().of(Se)) == null ? void 0 : M.nullable(),
191
191
  id: n.string().required("ID of SKU is required"),
192
192
  index: n.number().integer().nullable(),
193
193
  quantity: n.number().integer().nullable(),
194
194
  seller: n.string().required("Seller is required"),
195
195
  price: n.number().integer()
196
- }), Oe = n.object({
196
+ }), Te = n.object({
197
197
  orderFormId: n.string().required("OrderFormId is required"),
198
- orderItems: n.array().of(Se)
198
+ orderItems: n.array().of($e)
199
199
  });
200
- async function Te({
200
+ async function Oe({
201
201
  apiUrl: e,
202
202
  body: t,
203
203
  fetchOptions: o
@@ -206,9 +206,9 @@ async function Te({
206
206
  console.error("[ERROR FETCHING] Body is required");
207
207
  return;
208
208
  }
209
- await Oe.validate(t);
209
+ await Te.validate(t);
210
210
  const { orderFormId: r, orderItems: s } = t;
211
- return g(
211
+ return h(
212
212
  `${e}/api/checkout/pub/orderForm/${r}/items`,
213
213
  {
214
214
  method: "POST",
@@ -217,10 +217,10 @@ async function Te({
217
217
  }
218
218
  );
219
219
  }
220
- const Ee = n.object({
220
+ const qe = n.object({
221
221
  orderFormId: n.string().nullable()
222
222
  });
223
- async function qe({
223
+ async function Ee({
224
224
  apiUrl: e,
225
225
  body: t,
226
226
  fetchOptions: o
@@ -229,9 +229,9 @@ async function qe({
229
229
  console.error("[ERROR FETCHING] Body is required");
230
230
  return;
231
231
  }
232
- await Ee.validate(t);
232
+ await qe.validate(t);
233
233
  const { orderFormId: r } = t;
234
- return g(
234
+ return h(
235
235
  `${e}/api/checkout/pub/orderForm/${r}/items/removeAll`,
236
236
  {
237
237
  method: "POST",
@@ -239,13 +239,13 @@ async function qe({
239
239
  }
240
240
  );
241
241
  }
242
- const Ae = n.object().shape({
242
+ const we = n.object().shape({
243
243
  name: n.string().required("Attachment name is required"),
244
244
  content: n.object().nullable()
245
245
  });
246
246
  var x;
247
- const ke = n.object().shape({
248
- attachments: (x = n.array().of(Ae)) == null ? void 0 : x.nullable(),
247
+ const Ae = n.object().shape({
248
+ attachments: (x = n.array().of(we)) == null ? void 0 : x.nullable(),
249
249
  id: n.string().required("ID of SKU is required"),
250
250
  index: n.number().integer().nullable(),
251
251
  quantity: n.number().integer().nullable(),
@@ -253,9 +253,9 @@ const ke = n.object().shape({
253
253
  price: n.number().integer()
254
254
  }), Pe = n.object({
255
255
  orderFormId: n.string().nullable(),
256
- orderItems: n.array().of(ke)
256
+ orderItems: n.array().of(Ae)
257
257
  });
258
- async function Ne({
258
+ async function ke({
259
259
  apiUrl: e,
260
260
  body: t,
261
261
  fetchOptions: o
@@ -266,7 +266,7 @@ async function Ne({
266
266
  }
267
267
  await Pe.validate(t);
268
268
  const { orderFormId: r, orderItems: s } = t;
269
- return g(
269
+ return h(
270
270
  `${e}/api/checkout/pub/orderForm/${r}/items/update`,
271
271
  {
272
272
  method: "POST",
@@ -275,7 +275,7 @@ async function Ne({
275
275
  }
276
276
  );
277
277
  }
278
- const we = n.object({
278
+ const Ne = n.object({
279
279
  orderFormId: n.string().nullable()
280
280
  });
281
281
  async function je({
@@ -287,9 +287,9 @@ async function je({
287
287
  console.error("[ERROR FETCHING] Body is required");
288
288
  return;
289
289
  }
290
- await we.validate(t);
290
+ await Ne.validate(t);
291
291
  const { orderFormId: r } = t;
292
- return g(
292
+ return h(
293
293
  `${e}/api/checkout/pub/orderForm/${r}/messages/clear`,
294
294
  {
295
295
  method: "POST",
@@ -304,20 +304,20 @@ const De = n.object({
304
304
  orderFormId: n.string().nullable(),
305
305
  remove: n.boolean().nullable()
306
306
  });
307
- async function He({ apiUrl: e, body: t, fetchOptions: o }) {
307
+ async function _e({ apiUrl: e, body: t, fetchOptions: o }) {
308
308
  if (!t) {
309
309
  console.error("[ERROR FETCHING] Body is required");
310
310
  return;
311
311
  }
312
312
  await De.validate(t);
313
313
  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}`;
314
- return g(u, {
314
+ return h(u, {
315
315
  method: "POST",
316
316
  body: { id: a },
317
317
  ...o
318
318
  });
319
319
  }
320
- const _e = n.object({
320
+ const He = n.object({
321
321
  orderFormId: n.string().nullable()
322
322
  });
323
323
  async function Be({
@@ -331,11 +331,11 @@ async function Be({
331
331
  console.error("[ERROR FETCHING] Body is required");
332
332
  return;
333
333
  }
334
- await _e.validate(t);
334
+ await He.validate(t);
335
335
  const s = new URLSearchParams({
336
336
  refreshOutdatedData: "true"
337
337
  }), a = t.orderFormId && ((i = r.orderFormPurchaseId) == null ? void 0 : i.value) !== t.orderFormId ? `${e}/api/checkout/pub/orderForm/${t.orderFormId}?${String(s)}` : `${e}/api/checkout/pub/orderForm`;
338
- return g(a, { method: "GET", ...o });
338
+ return h(a, { method: "GET", ...o });
339
339
  }
340
340
  const Ge = n.object({
341
341
  orderFormId: n.string().nullable(),
@@ -346,7 +346,7 @@ const Ge = n.object({
346
346
  document: n.string().required(),
347
347
  phone: n.string().matches(/^\+\d{1,3}\d{10,11}$/)
348
348
  });
349
- async function Ue({
349
+ async function Le({
350
350
  apiUrl: e,
351
351
  body: t,
352
352
  fetchOptions: o
@@ -357,7 +357,7 @@ async function Ue({
357
357
  }
358
358
  await Ge.validate(t);
359
359
  const { orderFormId: r, ...s } = t;
360
- return g(
360
+ return h(
361
361
  `${e}/api/checkout/pub/orderForm/${r}/attachments/clientProfileData`,
362
362
  {
363
363
  method: "POST",
@@ -366,10 +366,10 @@ async function Ue({
366
366
  }
367
367
  );
368
368
  }
369
- const Ve = n.object({
369
+ const Ue = n.object({
370
370
  sellerCode: n.string().nullable()
371
371
  });
372
- async function Le({
372
+ async function Ve({
373
373
  apiUrl: e,
374
374
  body: t,
375
375
  fetchOptions: o
@@ -378,9 +378,9 @@ async function Le({
378
378
  console.error("[ERROR FETCHING] Body is required");
379
379
  return;
380
380
  }
381
- await Ve.validate(t);
381
+ await Ue.validate(t);
382
382
  const { sellerCode: r = "" } = t;
383
- return g(
383
+ return h(
384
384
  `${e}/api/dataentities/VD/search?_fields=id,cod,name,ativo&cod=${r}`,
385
385
  {
386
386
  method: "GET",
@@ -416,7 +416,7 @@ async function xe({
416
416
  logisticsInfo: [],
417
417
  clearAddressIfPostalCodeNotFound: !0
418
418
  };
419
- return g(
419
+ return h(
420
420
  `${e}/api/checkout/pub/orderForm/${s}/attachments/shippingData`,
421
421
  {
422
422
  method: "POST",
@@ -460,7 +460,7 @@ async function Qe({ apiUrl: e, body: t, fetchOptions: o }) {
460
460
  }
461
461
  await ze.validate(t);
462
462
  const { orderFormId: r, options: s, selectedAddresses: a } = t;
463
- return g(
463
+ return h(
464
464
  `${e}/api/checkout/pub/orderForm/${r}/attachments/shippingData`,
465
465
  {
466
466
  method: "POST",
@@ -491,7 +491,7 @@ async function Ke({ apiUrl: e, body: t, fetchOptions: o }) {
491
491
  return a ? i.append("postalCode", a) : i.append(
492
492
  "geoCoordinates",
493
493
  `${s == null ? void 0 : s.longitude};${s == null ? void 0 : s.latitude}`
494
- ), await g(
494
+ ), await h(
495
495
  `${e}/api/checkout/pub/regions/?${i.toString()}`,
496
496
  {
497
497
  method: "GET",
@@ -514,7 +514,7 @@ async function Ye({ apiUrl: e, body: t, fetchOptions: o }) {
514
514
  console.error("[ERROR FETCHING] Body is required");
515
515
  return;
516
516
  }
517
- return await Xe.validate(t), g(
517
+ return await Xe.validate(t), h(
518
518
  `${e}/api/checkout/pub/orderForms/simulation`,
519
519
  {
520
520
  method: "POST",
@@ -525,24 +525,24 @@ async function Ye({ apiUrl: e, body: t, fetchOptions: o }) {
525
525
  }
526
526
  const Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
527
527
  __proto__: null,
528
- getMasterDataSellerCode: Le,
528
+ getMasterDataSellerCode: Ve,
529
529
  getOrderForm: Be,
530
- postOrderFormAddCoupon: Ce,
531
- postOrderFormAttachClientProfileData: Ue,
532
- postOrderFormAttachOrderFormData: ye,
530
+ postOrderFormAddCoupon: ve,
531
+ postOrderFormAttachClientProfileData: Le,
532
+ postOrderFormAttachOrderFormData: be,
533
533
  postOrderFormAttachShippingData: xe,
534
534
  postOrderFormAttachmentsMarketingData: J,
535
535
  postOrderFormAttachmentsOpenTextField: Q,
536
536
  postOrderFormClearMessages: je,
537
537
  postOrderFormFreightSimulation: Ye,
538
- postOrderFormItems: Te,
538
+ postOrderFormItems: Oe,
539
539
  postOrderFormRegion: Ke,
540
- postOrderFormRemoveAllItems: qe,
541
- postOrderFormUpdateItems: Ne,
540
+ postOrderFormRemoveAllItems: Ee,
541
+ postOrderFormUpdateItems: ke,
542
542
  postOrderFormUpdateShippingData: Qe,
543
543
  postOrderformAddress: ge,
544
544
  putOrderFormCustomData: Fe,
545
- updateOrderFormOffering: He
545
+ updateOrderFormOffering: _e
546
546
  }, Symbol.toStringTag, { value: "Module" })), et = n.object({
547
547
  skuId: n.string()
548
548
  });
@@ -553,7 +553,7 @@ async function tt({ apiUrl: e, body: t, fetchOptions: o }) {
553
553
  }
554
554
  await et.validate(t);
555
555
  const { skuId: r } = t;
556
- return g(
556
+ return h(
557
557
  `${e}/api/catalog/pvt/stockkeepingunitkit?parentSkuId=${r}`,
558
558
  {
559
559
  ...o
@@ -570,7 +570,7 @@ async function ot({ apiUrl: e, body: t, fetchOptions: o }) {
570
570
  }
571
571
  await rt.validate(t);
572
572
  const { ids: r } = t;
573
- return g(
573
+ return h(
574
574
  `${e}/api/catalog_system/pub/products/search?fq=${r.map((s) => `productId:${s}`).join("&fq=")}`,
575
575
  {
576
576
  ...o
@@ -580,30 +580,30 @@ async function ot({ apiUrl: e, body: t, fetchOptions: o }) {
580
580
  const nt = n.object({
581
581
  productId: n.number().required("Product ID is required")
582
582
  });
583
- async function st({ apiUrl: e, body: t, fetchOptions: o }) {
583
+ async function at({ apiUrl: e, body: t, fetchOptions: o }) {
584
584
  if (!t) {
585
585
  console.error("[ERROR FETCHING] Body is required");
586
586
  return;
587
587
  }
588
588
  await nt.validate(t);
589
589
  const { productId: r } = t;
590
- return g(
590
+ return h(
591
591
  `${e}/api/catalog_system/pub/products/crossselling/similars/${r.toString()}`,
592
592
  {
593
593
  ...o
594
594
  }
595
595
  );
596
596
  }
597
- const at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
597
+ const st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
598
598
  __proto__: null,
599
599
  getCatalogKitProducts: tt,
600
600
  getCatalogProducts: ot,
601
- getCatalogSimilars: st
602
- }, Symbol.toStringTag, { value: "Module" })), it = (e = "") => e.charAt(0).toUpperCase() + e.slice(1), U = (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
+ getCatalogSimilars: at
602
+ }, Symbol.toStringTag, { value: "Module" })), it = (e = "") => e.charAt(0).toUpperCase() + e.slice(1), L = (e, t = " ") => !e || typeof e == "string" && e.length === 0 ? e : (Array.isArray(e) ? e : e.split("-")).map(it).join(t), ct = ({ canonical: e, seo: t, slug: o }) => {
603
603
  const r = Array.isArray(o) ? o.join(", ") : o;
604
604
  return {
605
605
  id: 0,
606
- Title: `${Array.isArray(o) ? o.map((a) => U(a)).join(",") : U(o)} - ${t.title}`,
606
+ Title: `${Array.isArray(o) ? o.map((a) => L(a)).join(",") : L(o)} - ${t.title}`,
607
607
  MetaTagDescription: t.description,
608
608
  name: r,
609
609
  hasChildren: !1,
@@ -630,14 +630,14 @@ const at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
630
630
  )) ?? s;
631
631
  }, dt = (e) => {
632
632
  e instanceof Error ? (console.error(`[ERROR CATEGORY INFO]: ${e.message}`), console.error(e.stack)) : console.error("[ERROR CATEGORY INFO]: Unknown error", e);
633
- }, mt = /* @__PURE__ */ new Set([
633
+ }, pt = /* @__PURE__ */ new Set([
634
634
  "brand",
635
635
  "category",
636
636
  "department",
637
637
  "subcategory",
638
638
  "collection",
639
639
  "cluster"
640
- ]), pt = (e) => typeof (e == null ? void 0 : e.pageType) == "string" && mt.has(e == null ? void 0 : e.pageType.toLowerCase()), ft = (e) => ({
640
+ ]), mt = (e) => typeof (e == null ? void 0 : e.pageType) == "string" && pt.has(e == null ? void 0 : e.pageType.toLowerCase()), ft = (e) => ({
641
641
  collection: e.Coleção,
642
642
  categoryId: e.categoryId,
643
643
  current_collection: e["Coleção Atual"],
@@ -662,12 +662,12 @@ const at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
662
662
  createSeoCategory: lt,
663
663
  findCategory: ut,
664
664
  formattedSimilars: gt,
665
- isCollectionPageType: pt,
665
+ isCollectionPageType: mt,
666
666
  notFindCategoryError: dt,
667
667
  responseAdapter: ft
668
668
  }, Symbol.toStringTag, { value: "Module" }));
669
669
  async function It({ contentType: e, storeId: t, CMS_PROJECT_NAME: o, NextCookies: r }) {
670
- const s = await R({
670
+ const s = await b({
671
671
  contentType: e,
672
672
  storeId: t,
673
673
  CMS_PROJECT_NAME: o,
@@ -681,7 +681,7 @@ async function It({ contentType: e, storeId: t, CMS_PROJECT_NAME: o, NextCookies
681
681
  };
682
682
  console.log("Resultado da chamada:", s);
683
683
  const i = `backup-${e}-${Date.now()}.json`;
684
- return await se.writeFile(
684
+ return await ae.writeFile(
685
685
  `./backups/${i}`,
686
686
  JSON.stringify(a, null, 2),
687
687
  "utf-8"
@@ -689,10 +689,10 @@ async function It({ contentType: e, storeId: t, CMS_PROJECT_NAME: o, NextCookies
689
689
  }
690
690
  return { success: !1, error: s.error || "No data to backup" };
691
691
  }
692
- async function bt(e) {
692
+ async function yt(e) {
693
693
  return It(e);
694
694
  }
695
- async function yt({
695
+ async function bt({
696
696
  contentType: e,
697
697
  documentId: t,
698
698
  versionId: o,
@@ -705,7 +705,7 @@ async function yt({
705
705
  { cache: "no-cache" }
706
706
  );
707
707
  }
708
- async function vt({
708
+ async function Ct({
709
709
  contentType: e,
710
710
  documents: t,
711
711
  NextCookies: o,
@@ -717,36 +717,36 @@ async function vt({
717
717
  ((i = o().get("cms_preview_data")) == null ? void 0 : i.value) ?? "{}"
718
718
  );
719
719
  if (a && (a == null ? void 0 : a.contentType) === e) {
720
- 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}` : "", h = await (await fetch(
720
+ 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}` : "", f = await (await fetch(
721
721
  `https://${s}.myvtex.com/_v/cms/api/${r}/${e}${c}${u}`,
722
722
  { cache: "no-store" }
723
723
  )).json(), l = t.filter(
724
- (m) => h.id !== m.documentId
724
+ (p) => f.id !== p.documentId
725
725
  );
726
- return l.unshift(h), l;
726
+ return l.unshift(f), l;
727
727
  }
728
728
  return t;
729
729
  }
730
- async function R({
730
+ async function b({
731
731
  contentType: e,
732
732
  NextCookies: t,
733
733
  CMS_PROJECT_NAME: o,
734
734
  storeId: r
735
735
  }) {
736
- var d, h;
736
+ var d, f;
737
737
  const s = JSON.parse(
738
738
  ((d = t().get("cms_preview_data")) == null ? void 0 : d.value) ?? "{}"
739
739
  ), a = [];
740
740
  let i = 1, c = 0, u = !0;
741
741
  try {
742
742
  do {
743
- const m = await (await fetch(
743
+ const p = await (await fetch(
744
744
  `https://${r}.myvtex.com/_v/cms/api/${o}/${e}?page=${i}`
745
745
  )).json();
746
- i === 1 && (c = m.totalItems), (h = m == null ? void 0 : m.data) != null && h.length && a.push(...m.data), u = m.hasNextPage, i++;
746
+ i === 1 && (c = p.totalItems), (f = p == null ? void 0 : p.data) != null && f.length && a.push(...p.data), u = p.hasNextPage, i++;
747
747
  } while (u && a.length < c);
748
748
  if (s.previewMode && a.length) {
749
- const l = await vt({
749
+ const l = await Ct({
750
750
  contentType: e,
751
751
  documents: a,
752
752
  NextCookies: t,
@@ -766,11 +766,11 @@ async function R({
766
766
  return { status: "error", data: [], error: l };
767
767
  }
768
768
  }
769
- const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
769
+ const vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
770
770
  __proto__: null,
771
- cmsBackup: bt,
772
- getCMSContentType: yt,
773
- getContentType: R
771
+ cmsBackup: yt,
772
+ getCMSContentType: bt,
773
+ getContentType: b
774
774
  }, Symbol.toStringTag, { value: "Module" })), Rt = ({
775
775
  slug: e,
776
776
  data: t,
@@ -778,14 +778,14 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
778
778
  COMMON_PAGE_COLUMN_GAP: r
779
779
  }) => {
780
780
  const s = t == null ? void 0 : t.find(
781
- (h) => {
782
- var l, m, f, p;
783
- return ((m = (l = h.config) == null ? void 0 : l.responsive) == null ? void 0 : m.deviceType) === "desktop" && ((p = (f = h.config) == null ? void 0 : f.seo) == null ? void 0 : p.slug) === e;
781
+ (f) => {
782
+ var l, p, g, m;
783
+ return ((p = (l = f.config) == null ? void 0 : l.responsive) == null ? void 0 : p.deviceType) === "desktop" && ((m = (g = f.config) == null ? void 0 : g.seo) == null ? void 0 : m.slug) === e;
784
784
  }
785
785
  ), a = s == null ? void 0 : s.config.responsive.gapCustom, i = s == null ? void 0 : s.config.responsive.gapSections, c = t == null ? void 0 : t.find(
786
- (h) => {
787
- var l, m, f, p;
788
- return ((m = (l = h.config) == null ? void 0 : l.responsive) == null ? void 0 : m.deviceType) === "mobile" && ((p = (f = h.config) == null ? void 0 : f.seo) == null ? void 0 : p.slug) === e;
786
+ (f) => {
787
+ var l, p, g, m;
788
+ return ((p = (l = f.config) == null ? void 0 : l.responsive) == null ? void 0 : p.deviceType) === "mobile" && ((m = (g = f.config) == null ? void 0 : g.seo) == null ? void 0 : m.slug) === e;
789
789
  }
790
790
  ), u = c == null ? void 0 : c.config.responsive.gapCustom, d = c == null ? void 0 : c.config.responsive.gapSections;
791
791
  return /* @__PURE__ */ z(G, { children: [
@@ -794,7 +794,7 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
794
794
  {
795
795
  gap: a && i ? i : r,
796
796
  className: B.classNameConcat(
797
- w["responsive-desktop-flex"],
797
+ N["responsive-desktop-flex"],
798
798
  "utils-column-modifier"
799
799
  ),
800
800
  children: /* @__PURE__ */ I(o, { data: (s == null ? void 0 : s.sections) ?? [] })
@@ -805,7 +805,7 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
805
805
  {
806
806
  gap: u && d ? d : r,
807
807
  className: B.classNameConcat(
808
- w["responsive-mobile-flex"],
808
+ N["responsive-mobile-flex"],
809
809
  "utils-column-modifier"
810
810
  ),
811
811
  children: /* @__PURE__ */ I(o, { data: (c == null ? void 0 : c.sections) ?? [] })
@@ -818,7 +818,7 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
818
818
  COMMON_PAGE_COLUMN_GAP: o,
819
819
  ...r
820
820
  }) => {
821
- const { data: s } = await R({
821
+ const { data: s } = await b({
822
822
  contentType: "common_page",
823
823
  ...r
824
824
  });
@@ -831,7 +831,7 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
831
831
  COMMON_PAGE_COLUMN_GAP: o
832
832
  }
833
833
  );
834
- }, $t = async ({
834
+ }, St = async ({
835
835
  PAYMENT_FLAGS_DICTIONARY: e,
836
836
  PAYMENT_FLAGS: t,
837
837
  LEGAL_INFORMATION_TEXT: o,
@@ -841,16 +841,16 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
841
841
  FooterSupport: i,
842
842
  ...c
843
843
  }) => {
844
- var l, m, f, p, S, F, $, O, T, E, b, q;
845
- const { data: u } = await R({
844
+ var l, p, g, m, $, F, S, T, O, q, y, E;
845
+ const { data: u } = await b({
846
846
  contentType: "footer",
847
847
  ...c
848
- }), d = Array.isArray(u) && ((m = (l = u[0]) == null ? void 0 : l.name) == null ? void 0 : m.toLowerCase()) === "footer" ? u[0] : null, h = {
849
- ...(f = d == null ? void 0 : d.paymentInfo) == null ? void 0 : f.paymentInfo,
848
+ }), d = Array.isArray(u) && ((p = (l = u[0]) == null ? void 0 : l.name) == null ? void 0 : p.toLowerCase()) === "footer" ? u[0] : null, f = {
849
+ ...(g = d == null ? void 0 : d.paymentInfo) == null ? void 0 : g.paymentInfo,
850
850
  acceptedFlags: Array.isArray(
851
- (p = d == null ? void 0 : d.paymentInfo) == null ? void 0 : p.paymentInfo.acceptedFlags
852
- ) ? (S = d == null ? void 0 : d.paymentInfo) == null ? void 0 : S.paymentInfo.acceptedFlags.filter((y) => !!e[y]).map(
853
- (y) => e[y]
851
+ (m = d == null ? void 0 : d.paymentInfo) == null ? void 0 : m.paymentInfo.acceptedFlags
852
+ ) ? ($ = d == null ? void 0 : d.paymentInfo) == null ? void 0 : $.paymentInfo.acceptedFlags.filter((C) => !!e[C]).map(
853
+ (C) => e[C]
854
854
  ) : []
855
855
  };
856
856
  return d ? /* @__PURE__ */ I(
@@ -858,14 +858,14 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
858
858
  {
859
859
  data: { ...d },
860
860
  socialInfo: (F = d.socialMedia) == null ? void 0 : F.socialMedia,
861
- socialMedias: (O = ($ = d.socialMedia) == null ? void 0 : $.socialMedia) == null ? void 0 : O.medias,
862
- payments: h,
861
+ socialMedias: (T = (S = d.socialMedia) == null ? void 0 : S.socialMedia) == null ? void 0 : T.medias,
862
+ payments: f,
863
863
  adornment: {
864
- ...(E = (T = d.supportInfo) == null ? void 0 : T.supportInfo) != null && E.content ? {
864
+ ...(q = (O = d.supportInfo) == null ? void 0 : O.supportInfo) != null && q.content ? {
865
865
  bottom: /* @__PURE__ */ I(
866
866
  i,
867
867
  {
868
- content: (q = (b = d.supportInfo) == null ? void 0 : b.supportInfo) == null ? void 0 : q.content,
868
+ content: (E = (y = d.supportInfo) == null ? void 0 : y.supportInfo) == null ? void 0 : E.content,
869
869
  CONSTANTS: {
870
870
  ICONS: s,
871
871
  PAYMENT_FLAGS: t,
@@ -880,13 +880,13 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
880
880
  ICONS: s
881
881
  }
882
882
  ) : /* @__PURE__ */ I(G, {});
883
- }, St = async ({
883
+ }, $t = async ({
884
884
  children: e,
885
885
  ClientHeaderProvider: t,
886
886
  ...o
887
887
  }) => {
888
888
  var a, i, c, u;
889
- const { data: r } = await R({
889
+ const { data: r } = await b({
890
890
  contentType: "header",
891
891
  ...o
892
892
  }), s = (a = r[0]) == null ? void 0 : a.sections.map((d) => d.data);
@@ -902,7 +902,7 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
902
902
  children: e
903
903
  }
904
904
  );
905
- }, Ot = async ({
905
+ }, Tt = async ({
906
906
  children: e,
907
907
  productId: t,
908
908
  COMMON_PAGE_COLUMN_GAP: o,
@@ -910,7 +910,7 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
910
910
  PDPContentProvider: s,
911
911
  ...a
912
912
  }) => {
913
- const { data: i } = await R({
913
+ const { data: i } = await b({
914
914
  contentType: "product_page",
915
915
  ...a
916
916
  });
@@ -924,9 +924,9 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
924
924
  children: e
925
925
  }
926
926
  );
927
- }, Tt = {
927
+ }, Ot = {
928
928
  "column-modifier": "_column-modifier_1tqap_1"
929
- }, Et = async ({
929
+ }, qt = async ({
930
930
  children: e,
931
931
  slug: t,
932
932
  SectionZone: o,
@@ -934,28 +934,28 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
934
934
  PLPContentProvider: s,
935
935
  ...a
936
936
  }) => {
937
- const { data: i } = await R({
937
+ const { data: i } = await b({
938
938
  contentType: "categories_page",
939
939
  ...a
940
940
  }), c = i.find(
941
941
  (l) => {
942
- var m, f, p;
943
- return ((m = l.config) == null ? void 0 : m.seo.slug) === t && ((p = (f = l.config) == null ? void 0 : f.responsive) == null ? void 0 : p.deviceType) === "desktop";
942
+ var p, g, m;
943
+ return ((p = l.config) == null ? void 0 : p.seo.slug) === t && ((m = (g = l.config) == null ? void 0 : g.responsive) == null ? void 0 : m.deviceType) === "desktop";
944
944
  }
945
945
  ), u = i.find(
946
946
  (l) => {
947
- var m, f, p;
948
- return ((m = l.config) == null ? void 0 : m.seo.slug) === t && ((p = (f = l.config) == null ? void 0 : f.responsive) == null ? void 0 : p.deviceType) === "mobile";
947
+ var p, g, m;
948
+ return ((p = l.config) == null ? void 0 : p.seo.slug) === t && ((m = (g = l.config) == null ? void 0 : g.responsive) == null ? void 0 : m.deviceType) === "mobile";
949
949
  }
950
950
  ), d = i.find(
951
951
  (l) => {
952
- var m, f, p;
953
- return ((m = l.config) == null ? void 0 : m.seo.slug) === "default" && ((p = (f = l.config) == null ? void 0 : f.responsive) == null ? void 0 : p.deviceType) === "desktop";
952
+ var p, g, m;
953
+ return ((p = l.config) == null ? void 0 : p.seo.slug) === "default" && ((m = (g = l.config) == null ? void 0 : g.responsive) == null ? void 0 : m.deviceType) === "desktop";
954
954
  }
955
- ), h = i.find(
955
+ ), f = i.find(
956
956
  (l) => {
957
- var m, f, p;
958
- return ((m = l.config) == null ? void 0 : m.seo.slug) === "default" && ((p = (f = l.config) == null ? void 0 : f.responsive) == null ? void 0 : p.deviceType) === "mobile";
957
+ var p, g, m;
958
+ return ((p = l.config) == null ? void 0 : p.seo.slug) === "default" && ((m = (g = l.config) == null ? void 0 : g.responsive) == null ? void 0 : m.deviceType) === "mobile";
959
959
  }
960
960
  );
961
961
  return /* @__PURE__ */ z(G, { children: [
@@ -963,8 +963,8 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
963
963
  j.Column,
964
964
  {
965
965
  className: B.classNameConcat(
966
- w["responsive-desktop-flex"],
967
- Tt["column-modifier"]
966
+ N["responsive-desktop-flex"],
967
+ Ot["column-modifier"]
968
968
  ),
969
969
  style: {
970
970
  minHeight: "100vh"
@@ -981,10 +981,10 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
981
981
  )
982
982
  }
983
983
  ),
984
- /* @__PURE__ */ I(j.Column, { className: w["responsive-mobile-flex"], children: /* @__PURE__ */ I(
984
+ /* @__PURE__ */ I(j.Column, { className: N["responsive-mobile-flex"], children: /* @__PURE__ */ I(
985
985
  s,
986
986
  {
987
- data: u ?? h,
987
+ data: u ?? f,
988
988
  device: "mobile",
989
989
  SectionZone: o,
990
990
  COMMON_PAGE_COLUMN_GAP_PDC: r,
@@ -992,43 +992,97 @@ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
992
992
  }
993
993
  ) })
994
994
  ] });
995
- }, qt = async ({
995
+ }, Et = async ({ slug: e, ...t }) => {
996
+ var i, c, u;
997
+ const { data: o } = await b({
998
+ contentType: "redirect_to_search",
999
+ ...t
1000
+ }), r = ((u = (c = (i = o[0]) == null ? void 0 : i.redirectToSearch) == null ? void 0 : c.redirectToSearch) == null ? void 0 : u.paths) ?? [];
1001
+ if (!!!r.length)
1002
+ return {
1003
+ slug: e,
1004
+ query: null,
1005
+ redirect: !1
1006
+ };
1007
+ const a = r.find(
1008
+ (d) => {
1009
+ var f, l;
1010
+ return ((f = d.path) == null ? void 0 : f.replace(/\//g, "-").toLowerCase()) === e.replace(/\//g, "-").toLowerCase() || ((l = d.path) == null ? void 0 : l.replace(/\//g, "-").toLowerCase()) === `/${e}`.replace(/\//g, "-").toLowerCase();
1011
+ }
1012
+ );
1013
+ return a ? {
1014
+ slug: e,
1015
+ query: a == null ? void 0 : a.searchQuery,
1016
+ redirect: !0,
1017
+ collectionId: a == null ? void 0 : a.collectionId,
1018
+ filters: a == null ? void 0 : a.filters,
1019
+ sort: a == null ? void 0 : a.sort
1020
+ } : {
1021
+ slug: e,
1022
+ query: null,
1023
+ redirect: !1,
1024
+ collectionId: null,
1025
+ filters: null,
1026
+ sort: null
1027
+ };
1028
+ }, wt = async ({ slug: e, ...t }) => {
1029
+ var i, c, u;
1030
+ const { data: o } = await b({
1031
+ contentType: "redirect_to_search",
1032
+ ...t
1033
+ }), r = ((u = (c = (i = o[0]) == null ? void 0 : i.redirectToSearch) == null ? void 0 : c.redirectToSearch) == null ? void 0 : u.paths) ?? [];
1034
+ if (!!!r.length)
1035
+ return null;
1036
+ const a = r.find(
1037
+ (d) => {
1038
+ var f, l;
1039
+ return ((f = d.path) == null ? void 0 : f.replace(/\//g, "-").toLowerCase()) === e.replace(/\//g, "-").toLowerCase() || ((l = d.path) == null ? void 0 : l.replace(/\//g, "-").toLowerCase()) === `/${e}`.replace(/\//g, "-").toLowerCase();
1040
+ }
1041
+ );
1042
+ return a ? {
1043
+ slug: e,
1044
+ title: a.pageTitle,
1045
+ description: a.pageDescription
1046
+ } : null;
1047
+ }, At = async ({
996
1048
  ClientTipbarContent: e,
997
1049
  ...t
998
1050
  }) => {
999
- const { data: o } = await R({
1051
+ const { data: o } = await b({
1000
1052
  contentType: "tipbar",
1001
1053
  ...t
1002
1054
  });
1003
1055
  return /* @__PURE__ */ I(e, { data: o });
1004
- }, At = {
1056
+ }, Pt = {
1005
1057
  CommonPageContent: Ft,
1006
- HeaderContent: St,
1007
- TipbarContent: qt,
1008
- FooterContent: $t,
1009
- PLPContent: Et,
1010
- PDPContent: Ot
1011
- }, sr = { Components: At }, kt = n.object({
1058
+ HeaderContent: $t,
1059
+ TipbarContent: At,
1060
+ FooterContent: St,
1061
+ PLPContent: qt,
1062
+ PDPContent: Tt,
1063
+ getRedirectData: Et,
1064
+ getPLPSynteticMetaData: wt
1065
+ }, ir = { Components: Pt }, kt = n.object({
1012
1066
  query: n.string()
1013
1067
  });
1014
- async function Pt({ apiUrl: e, body: t, fetchOptions: o }) {
1068
+ async function Nt({ apiUrl: e, body: t, fetchOptions: o }) {
1015
1069
  if (!t) {
1016
1070
  console.error("[ERROR FETCHING] Body is required");
1017
1071
  return;
1018
1072
  }
1019
1073
  await kt.validate(t);
1020
1074
  const { query: r = "" } = t, s = new URLSearchParams({ query: r });
1021
- return g(
1075
+ return h(
1022
1076
  `${e}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${s.toString()}`,
1023
1077
  {
1024
1078
  ...o
1025
1079
  }
1026
1080
  );
1027
1081
  }
1028
- const Nt = (e, t) => me(e, t), wt = (e) => ({
1082
+ const jt = (e, t) => pe(e, t), Dt = (e) => ({
1029
1083
  ...e,
1030
- description: e.description ? Nt(e.description) : e.description
1031
- }), jt = ({
1084
+ description: e.description ? jt(e.description) : e.description
1085
+ }), _t = ({
1032
1086
  offer: e,
1033
1087
  seller: t,
1034
1088
  product: o
@@ -1038,8 +1092,8 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1038
1092
  seller: t
1039
1093
  }), K = (e, t) => ({
1040
1094
  ...e,
1041
- isVariantOf: wt(t)
1042
- }), Dt = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", N = (e) => e.AvailableQuantity > 0, V = (e) => e.spotPrice ?? 0, Ht = (e) => e.Price ?? 0, W = (e, t) => N(e) && !N(t) ? -1 : !N(e) && N(t) ? 1 : V(e) - V(t), _t = (e, t) => {
1095
+ isVariantOf: Dt(t)
1096
+ }), Ht = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", k = (e) => e.AvailableQuantity > 0, U = (e) => e.spotPrice ?? 0, Bt = (e) => e.Price ?? 0, W = (e, t) => k(e) && !k(t) ? -1 : !k(e) && k(t) ? 1 : U(e) - U(t), Gt = (e, t) => {
1043
1097
  let o = 0;
1044
1098
  for (let r = 1; r < e.length; r++)
1045
1099
  t(e[o], e[r]) > 0 && (o = r);
@@ -1050,7 +1104,7 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1050
1104
  offer: s.commertialOffer,
1051
1105
  sku: r
1052
1106
  }))
1053
- ), o = _t(
1107
+ ), o = Gt(
1054
1108
  t,
1055
1109
  ({ offer: r }, { offer: s }) => W(r, s)
1056
1110
  );
@@ -1065,11 +1119,11 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1065
1119
  attachment: "ATTACHMENT",
1066
1120
  specification: "SPECIFICATION",
1067
1121
  attribute: "ATTRIBUTE"
1068
- }, Bt = (e) => ({
1122
+ }, Lt = (e) => ({
1069
1123
  name: e.name,
1070
1124
  value: e.content,
1071
1125
  valueReference: D.attachment
1072
- }), Gt = (e) => ({
1126
+ }), Ut = (e) => ({
1073
1127
  propertyID: e.id,
1074
1128
  name: e.name,
1075
1129
  value: e.value,
@@ -1077,7 +1131,7 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1077
1131
  valueReference: D.attribute,
1078
1132
  visible: e.visible
1079
1133
  }
1080
- }), H = (e, t, o) => {
1134
+ }), _ = (e, t, o) => {
1081
1135
  const r = e.flatMap(({ name: i, values: c }) => c ? c.map((u) => ({
1082
1136
  name: i,
1083
1137
  value: u,
@@ -1086,23 +1140,23 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1086
1140
  name: i,
1087
1141
  value: "",
1088
1142
  valueReference: D.specification
1089
- }), s = Array.isArray(o) ? o.map(Bt) : [], a = t ? t.map(Gt) : [];
1143
+ }), s = Array.isArray(o) ? o.map(Lt) : [], a = t ? t.map(Ut) : [];
1090
1144
  return [
1091
1145
  ...r,
1092
1146
  ...s,
1093
1147
  ...a
1094
1148
  ];
1095
- }, L = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", Ut = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", Vt = (e) => {
1149
+ }, V = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", Vt = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", Mt = (e) => {
1096
1150
  let t = e.slice(0);
1097
- for (let o = 0; o < L.length; o++)
1151
+ for (let o = 0; o < V.length; o++)
1098
1152
  t = t.replace(
1099
- new RegExp(L.charAt(o), "g"),
1100
- Ut.charAt(o)
1153
+ new RegExp(V.charAt(o), "g"),
1154
+ Vt.charAt(o)
1101
1155
  );
1102
1156
  return t;
1103
- }, Lt = (e) => e.replace(/[·/_,:]/, "-"), Z = (e) => {
1157
+ }, xt = (e) => e.replace(/[·/_,:]/, "-"), Z = (e) => {
1104
1158
  const o = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}|><=_^]/g, "-");
1105
- return Lt(Vt(o)).toLowerCase();
1159
+ return xt(Mt(o)).toLowerCase();
1106
1160
  }, ee = (e) => `/${e}/p`, te = (e) => {
1107
1161
  const t = Math.max(
1108
1162
  ...e.map((r) => r.NumberOfInstallments)
@@ -1119,7 +1173,7 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1119
1173
  listPrice: 0,
1120
1174
  sellerDefault: !1
1121
1175
  }, s = e.map(
1122
- (a) => jt({
1176
+ (a) => _t({
1123
1177
  offer: a.commertialOffer,
1124
1178
  seller: a,
1125
1179
  product: t
@@ -1127,7 +1181,7 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1127
1181
  ).sort(W).map((a) => (a.seller.sellerId === "1" && a.AvailableQuantity > 0 && (o.price = a.Price, o.listPrice = a.ListPrice, o.sellerDefault = !0), {
1128
1182
  availability: a.AvailableQuantity > 0,
1129
1183
  listPrice: a.ListPrice,
1130
- price: Ht(a),
1184
+ price: Bt(a),
1131
1185
  priceValidUntil: a.PriceValidUntil,
1132
1186
  priceCurrency: "BRL",
1133
1187
  installments: a.Installments,
@@ -1145,11 +1199,11 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1145
1199
  }, oe = (e) => {
1146
1200
  const { attributes: t, itemId: o, name: r, sellers: s, variations: a } = e;
1147
1201
  return {
1148
- additionalProperty: H(a, t, []),
1202
+ additionalProperty: _(a, t, []),
1149
1203
  name: r,
1150
1204
  offers: {
1151
1205
  offers: s.map(({ sellerId: i, commertialOffer: c }) => ({
1152
- availability: Dt(c.AvailableQuantity > 0),
1206
+ availability: Ht(c.AvailableQuantity > 0),
1153
1207
  listPrice: c.ListPrice,
1154
1208
  price: c.Price,
1155
1209
  quantity: c.AvailableQuantity,
@@ -1161,8 +1215,8 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1161
1215
  sku: o
1162
1216
  // slug: getSlug('', itemId), // getSlug('', itemId) que tipo de slug é esse?
1163
1217
  };
1164
- }, Mt = (e) => {
1165
- var y;
1218
+ }, zt = (e) => {
1219
+ var C;
1166
1220
  const {
1167
1221
  attributes: t,
1168
1222
  referenceId: o,
@@ -1174,69 +1228,69 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1174
1228
  videos: u,
1175
1229
  variations: d
1176
1230
  } = e, {
1177
- brand: h,
1231
+ brand: f,
1178
1232
  categories: l,
1179
- categoriesIds: m,
1180
- description: f,
1181
- linkText: p,
1182
- productClusters: S,
1233
+ categoriesIds: p,
1234
+ description: g,
1235
+ linkText: m,
1236
+ productClusters: $,
1183
1237
  clusterHighlights: F,
1184
- productName: $,
1185
- properties: O,
1186
- productId: T
1187
- } = r, E = l.slice().reverse(), b = re(c, e.isVariantOf), q = te(b.offers[0].installments);
1238
+ productName: S,
1239
+ properties: T,
1240
+ productId: O
1241
+ } = r, q = l.slice().reverse(), y = re(c, e.isVariantOf), E = te(y.offers[0].installments);
1188
1242
  return {
1189
1243
  sku: a,
1190
- gtin: ((y = o[0]) == null ? void 0 : y.Value) ?? "",
1191
- name: $ ?? i,
1192
- description: f,
1244
+ gtin: ((C = o[0]) == null ? void 0 : C.Value) ?? "",
1245
+ name: S ?? i,
1246
+ description: g,
1193
1247
  releaseDate: r.releaseDate ?? "",
1194
- slug: p,
1248
+ slug: m,
1195
1249
  video: u[0],
1196
1250
  categories: l,
1197
- categoriesIds: m,
1198
- id: T,
1199
- brand: { name: h, brandName: h },
1251
+ categoriesIds: p,
1252
+ id: O,
1253
+ brand: { name: f, brandName: f },
1200
1254
  seo: {
1201
- description: f,
1202
- title: $,
1203
- canonical: ee(p)
1255
+ description: g,
1256
+ title: S,
1257
+ canonical: ee(m)
1204
1258
  },
1205
1259
  cluster: {
1206
- generals: S,
1260
+ generals: $,
1207
1261
  highlights: F
1208
1262
  },
1209
- properties: O,
1210
- availability: { status: b.offers[0].availability },
1263
+ properties: T,
1264
+ availability: { status: y.offers[0].availability },
1211
1265
  breadcrumbList: {
1212
1266
  itemListElement: [
1213
- ...E.map((v, k) => {
1214
- const C = v.split("/"), A = C[C.length - 2], _ = C.map(Z).join("/");
1267
+ ...q.map((v, A) => {
1268
+ const R = v.split("/"), w = R[R.length - 2], H = R.map(Z).join("/");
1215
1269
  return {
1216
- name: A,
1217
- item: _,
1218
- position: k + 1
1270
+ name: w,
1271
+ item: H,
1272
+ position: A + 1
1219
1273
  };
1220
1274
  }),
1221
1275
  {
1222
1276
  name: r.productName,
1223
- item: p,
1277
+ item: m,
1224
1278
  position: l.length + 1
1225
1279
  }
1226
1280
  ],
1227
1281
  numberOfItems: l.length
1228
1282
  },
1229
1283
  image: Y(s),
1230
- offers: b,
1231
- additionalProperty: H(d, t, []),
1284
+ offers: y,
1285
+ additionalProperty: _(d, t, []),
1232
1286
  isVariantOf: {
1233
1287
  productGroupID: r.productId,
1234
1288
  hasVariant: r.items.map((v) => oe(v))
1235
1289
  },
1236
- installments: q
1290
+ installments: E
1237
1291
  };
1238
- }, xt = (e) => {
1239
- var y;
1292
+ }, Qt = (e) => {
1293
+ var C;
1240
1294
  const {
1241
1295
  attributes: t,
1242
1296
  referenceId: o,
@@ -1248,103 +1302,103 @@ const Nt = (e, t) => me(e, t), wt = (e) => ({
1248
1302
  Videos: u,
1249
1303
  variations: d
1250
1304
  } = e, {
1251
- brand: h,
1305
+ brand: f,
1252
1306
  categories: l,
1253
- categoriesIds: m,
1254
- description: f,
1255
- linkText: p,
1256
- productClusters: S,
1307
+ categoriesIds: p,
1308
+ description: g,
1309
+ linkText: m,
1310
+ productClusters: $,
1257
1311
  productName: F,
1258
- Coleção: $,
1259
- "ID Coleção": O,
1260
- productId: T
1261
- } = r, E = l.slice().reverse(), b = re(c, e.isVariantOf), q = te(b.offers[0].installments);
1312
+ Coleção: S,
1313
+ "ID Coleção": T,
1314
+ productId: O
1315
+ } = r, q = l.slice().reverse(), y = re(c, e.isVariantOf), E = te(y.offers[0].installments);
1262
1316
  return {
1263
1317
  sku: a,
1264
- gtin: ((y = o[0]) == null ? void 0 : y.Value) ?? "",
1318
+ gtin: ((C = o[0]) == null ? void 0 : C.Value) ?? "",
1265
1319
  name: F ?? i,
1266
- description: f,
1320
+ description: g,
1267
1321
  releaseDate: r.releaseDate ?? "",
1268
- slug: p,
1322
+ slug: m,
1269
1323
  video: u[0],
1270
1324
  categories: l,
1271
- categoriesIds: m,
1272
- collection: $,
1273
- collectionId: O,
1274
- id: T,
1275
- brand: { name: h, brandName: h },
1325
+ categoriesIds: p,
1326
+ collection: S,
1327
+ collectionId: T,
1328
+ id: O,
1329
+ brand: { name: f, brandName: f },
1276
1330
  seo: {
1277
- description: f,
1331
+ description: g,
1278
1332
  title: F,
1279
- canonical: ee(p)
1333
+ canonical: ee(m)
1280
1334
  },
1281
1335
  cluster: {
1282
- generals: S,
1336
+ generals: $,
1283
1337
  highlights: []
1284
1338
  // TODO: add highlights
1285
1339
  },
1286
- availability: { status: b.offers[0].availability },
1340
+ availability: { status: y.offers[0].availability },
1287
1341
  breadcrumbList: {
1288
1342
  itemListElement: [
1289
- ...E.map((v, k) => {
1290
- const C = v.split("/"), A = C[C.length - 2], _ = C.map(Z).join("/");
1343
+ ...q.map((v, A) => {
1344
+ const R = v.split("/"), w = R[R.length - 2], H = R.map(Z).join("/");
1291
1345
  return {
1292
- name: A,
1293
- item: _,
1294
- position: k + 1
1346
+ name: w,
1347
+ item: H,
1348
+ position: A + 1
1295
1349
  };
1296
1350
  }),
1297
1351
  {
1298
1352
  name: r.productName,
1299
- item: p,
1353
+ item: m,
1300
1354
  position: l.length + 1
1301
1355
  }
1302
1356
  ],
1303
1357
  numberOfItems: l.length
1304
1358
  },
1305
1359
  image: Y(s),
1306
- offers: b,
1307
- additionalProperty: H(d, t, []),
1360
+ offers: y,
1361
+ additionalProperty: _(d, t, []),
1308
1362
  isVariantOf: {
1309
1363
  productGroupID: r.productId,
1310
1364
  hasVariant: r.items.map((v) => {
1311
- const { variations: k } = v, C = k.map((A) => ({
1312
- name: A,
1313
- values: v[A]
1365
+ const { variations: A } = v, R = A.map((w) => ({
1366
+ name: w,
1367
+ values: v[w]
1314
1368
  }));
1315
1369
  return {
1316
1370
  ...oe(v),
1317
- additionalProperty: H(
1318
- C,
1371
+ additionalProperty: _(
1372
+ R,
1319
1373
  t,
1320
1374
  []
1321
1375
  )
1322
1376
  };
1323
1377
  })
1324
1378
  },
1325
- installments: q
1379
+ installments: E
1326
1380
  };
1327
- }, zt = n.array().of(n.object({
1381
+ }, Jt = n.array().of(n.object({
1328
1382
  key: n.string().required(),
1329
1383
  value: n.string().required()
1330
1384
  })).required("Facets are required");
1331
- async function Qt({ apiUrl: e, body: t, fetchOptions: o }) {
1385
+ async function Kt({ apiUrl: e, body: t, fetchOptions: o }) {
1332
1386
  if (!t) {
1333
1387
  console.error("[ERROR FETCHING] Body is required");
1334
1388
  return;
1335
1389
  }
1336
- await zt.validate(t);
1390
+ await Jt.validate(t);
1337
1391
  const r = new URLSearchParams({}), s = t.map(({ key: i, value: c }) => `${i}/${c}`).join("/");
1338
- ae(t, r);
1392
+ se(t, r);
1339
1393
  const a = `${e}/api/catalog_system/pub/products/crossselling/${s}`;
1340
- return g(a, {
1394
+ return h(a, {
1341
1395
  cache: "no-store",
1342
1396
  ...o
1343
1397
  }).then((i) => i.map((u) => {
1344
1398
  const d = X(u.items);
1345
1399
  return d && K(d, u);
1346
1400
  }).filter((u) => !!u).map((u) => ({
1347
- node: xt(u)
1401
+ node: Qt(u)
1348
1402
  })));
1349
1403
  }
1350
1404
  const ne = ({
@@ -1364,19 +1418,19 @@ const ne = ({
1364
1418
  sort: c = "",
1365
1419
  facets: u = [],
1366
1420
  type: d,
1367
- hideUnavailableItems: h = !0,
1421
+ hideUnavailableItems: f = !0,
1368
1422
  locale: l = ""
1369
- } = t, m = new URLSearchParams({
1423
+ } = t, p = new URLSearchParams({
1370
1424
  page: a.toString(),
1371
1425
  count: (i == null ? void 0 : i.toString()) ?? (r == null ? void 0 : r.ITEMS_PER_PAGE) ?? 24,
1372
1426
  query: s,
1373
1427
  sort: c,
1374
1428
  locale: l
1375
1429
  });
1376
- h !== void 0 && m.append("hideUnavailableItems", h.toString());
1377
- const f = u.map((p) => `${p.key}/${p.value}`).join("/") ?? "";
1378
- return pe(
1379
- `${e}/api/io/_v/api/intelligent-search/${d}/${f}?${m.toString()}`,
1430
+ f !== void 0 && p.append("hideUnavailableItems", f.toString());
1431
+ const g = u.map((m) => `${m.key}/${m.value}`).join("/") ?? "";
1432
+ return me(
1433
+ `${e}/api/io/_v/api/intelligent-search/${d}/${g}?${p.toString()}`,
1380
1434
  {
1381
1435
  headers: {
1382
1436
  Accept: "application/json",
@@ -1386,7 +1440,7 @@ const ne = ({
1386
1440
  }
1387
1441
  );
1388
1442
  };
1389
- async function Jt({ body: e, extraData: t, ...o }) {
1443
+ async function Wt({ body: e, extraData: t, ...o }) {
1390
1444
  if (!e) {
1391
1445
  console.error("[ERROR FETCHING] Body is required");
1392
1446
  return;
@@ -1416,13 +1470,13 @@ async function Jt({ body: e, extraData: t, ...o }) {
1416
1470
  total: a.count
1417
1471
  },
1418
1472
  products: s.map((c, u) => ({
1419
- node: Mt(c),
1473
+ node: zt(c),
1420
1474
  cursor: u.toString()
1421
1475
  }))
1422
1476
  }
1423
1477
  };
1424
1478
  }
1425
- async function Kt({ body: e, extraData: t, ...o }) {
1479
+ async function Xt({ body: e, extraData: t, ...o }) {
1426
1480
  if (!e) {
1427
1481
  console.error("[ERROR FETCHING] Body is required");
1428
1482
  return;
@@ -1442,51 +1496,51 @@ async function Kt({ body: e, extraData: t, ...o }) {
1442
1496
  }
1443
1497
  };
1444
1498
  }
1445
- const Wt = n.object({
1499
+ const Yt = n.object({
1446
1500
  query: n.string().optional(),
1447
1501
  locale: n.string().optional()
1448
1502
  });
1449
- async function Xt({ apiUrl: e, body: t, fetchOptions: o }) {
1503
+ async function Zt({ apiUrl: e, body: t, fetchOptions: o }) {
1450
1504
  if (!t) {
1451
1505
  console.error("[ERROR FETCHING] Body is required");
1452
1506
  return;
1453
1507
  }
1454
- await Wt.validate(t);
1508
+ await Yt.validate(t);
1455
1509
  const { query: r = "", locale: s = "default_locale" } = t, a = new URLSearchParams({ query: r, locale: s });
1456
- return g(
1510
+ return h(
1457
1511
  `${e}/api/io/_v/api/intelligent-search/search_suggestions?${a.toString()}`,
1458
1512
  {
1459
1513
  ...o
1460
1514
  }
1461
1515
  );
1462
1516
  }
1463
- async function Yt({ apiUrl: e }) {
1464
- return g(`${e}/api/io/_v/api/intelligent-search/top_searches`);
1517
+ async function er({ apiUrl: e }) {
1518
+ return h(`${e}/api/io/_v/api/intelligent-search/top_searches`);
1465
1519
  }
1466
- const Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1520
+ const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1467
1521
  __proto__: null,
1468
- getSearchAutoCompleteSuggestions: Pt,
1469
- getSearchCrossellingProducts: Qt,
1470
- getSearchFacets: Kt,
1471
- getSearchProducts: Jt,
1472
- getSearchSuggestedTerms: Xt,
1473
- getSearchTopSearchs: Yt
1474
- }, Symbol.toStringTag, { value: "Module" })), er = {
1522
+ getSearchAutoCompleteSuggestions: Nt,
1523
+ getSearchCrossellingProducts: Kt,
1524
+ getSearchFacets: Xt,
1525
+ getSearchProducts: Wt,
1526
+ getSearchSuggestedTerms: Zt,
1527
+ getSearchTopSearchs: er
1528
+ }, Symbol.toStringTag, { value: "Module" })), rr = {
1475
1529
  parseSearchState: de,
1476
1530
  convertSearchParams: ue,
1477
1531
  filterNonRootFacets: le,
1478
1532
  filterNonCategorySelected: ce
1479
- }, ar = {
1533
+ }, cr = {
1480
1534
  checkout: Ze,
1481
- catalog: at,
1482
- cms: Ct,
1483
- search: Zt
1484
- }, ir = {
1535
+ catalog: st,
1536
+ cms: vt,
1537
+ search: tr
1538
+ }, lr = {
1485
1539
  catalog: ht,
1486
- search: er
1540
+ search: rr
1487
1541
  };
1488
1542
  export {
1489
- ar as serverAPIs,
1490
- sr as serverCMS,
1491
- ir as serverHelpers
1543
+ cr as serverAPIs,
1544
+ ir as serverCMS,
1545
+ lr as serverHelpers
1492
1546
  };