@soma-vertical-web/multi-lib 0.0.50 → 0.0.52

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