@soma-vertical-web/multi-lib 0.0.54 → 0.0.55
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/cms/ContentTypes/CommonPage/CommonPage.d.ts +1 -1
- package/cms/ContentTypes/CommonPage/DataScreening.d.ts +1 -1
- package/cms/server.d.ts +1 -1
- package/index-BYY2x6mQ.js +1 -0
- package/index-DYpuW0tu.mjs +354 -0
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/index2.js +1 -1
- package/index2.mjs +275 -272
- package/package.json +1 -1
- package/types/cms/ContentTypes/CommonPage/index.d.ts +2 -0
package/index2.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as z, Fragment as H, jsx as I } from "react/jsx-runtime";
|
|
2
|
-
import { r as k, n as F, S as oe, o as ie, q as ce, a as le, t as ue, v as de, c as pe, p as me, w as fe, f as ge } from "./index-
|
|
2
|
+
import { r as k, n as F, S as oe, o as ie, q as ce, a as le, t as ue, v as de, c as pe, p as me, w as fe, f as ge } from "./index-DYpuW0tu.mjs";
|
|
3
3
|
import { Utils as j, helpers as G } from "@soma-vertical-web/core-components";
|
|
4
4
|
import * as a from "yup";
|
|
5
5
|
import he from "sanitize-html";
|
|
@@ -7,40 +7,41 @@ const ye = ({
|
|
|
7
7
|
slug: e,
|
|
8
8
|
data: t,
|
|
9
9
|
SectionZone: n,
|
|
10
|
-
COMMON_PAGE_COLUMN_GAP: r
|
|
10
|
+
COMMON_PAGE_COLUMN_GAP: r,
|
|
11
|
+
identifyWhoIsFirst: o
|
|
11
12
|
}) => {
|
|
12
13
|
const s = t == null ? void 0 : t.find(
|
|
13
|
-
(
|
|
14
|
-
var
|
|
15
|
-
return ((
|
|
14
|
+
(d) => {
|
|
15
|
+
var h, f, m, R;
|
|
16
|
+
return ((f = (h = d.config) == null ? void 0 : h.responsive) == null ? void 0 : f.deviceType) === "desktop" && ((R = (m = d.config) == null ? void 0 : m.seo) == null ? void 0 : R.slug) === e;
|
|
16
17
|
}
|
|
17
|
-
),
|
|
18
|
-
(
|
|
19
|
-
var
|
|
20
|
-
return ((
|
|
18
|
+
), i = s == null ? void 0 : s.config.responsive.gapCustom, l = s == null ? void 0 : s.config.responsive.gapSections, u = t == null ? void 0 : t.find(
|
|
19
|
+
(d) => {
|
|
20
|
+
var h, f, m, R;
|
|
21
|
+
return ((f = (h = d.config) == null ? void 0 : h.responsive) == null ? void 0 : f.deviceType) === "mobile" && ((R = (m = d.config) == null ? void 0 : m.seo) == null ? void 0 : R.slug) === e;
|
|
21
22
|
}
|
|
22
|
-
),
|
|
23
|
+
), p = u == null ? void 0 : u.config.responsive.gapCustom, c = u == null ? void 0 : u.config.responsive.gapSections;
|
|
23
24
|
return /* @__PURE__ */ z(H, { children: [
|
|
24
25
|
/* @__PURE__ */ I(
|
|
25
26
|
j.Column,
|
|
26
27
|
{
|
|
27
|
-
gap:
|
|
28
|
+
gap: i && l ? l : r,
|
|
28
29
|
className: G.classNameConcat(
|
|
29
30
|
k["responsive-desktop-flex"],
|
|
30
31
|
"utils-column-modifier"
|
|
31
32
|
),
|
|
32
|
-
children: /* @__PURE__ */ I(n, { data: (s == null ? void 0 : s.sections) ?? [] })
|
|
33
|
+
children: /* @__PURE__ */ I(n, { data: (s == null ? void 0 : s.sections) ?? [], identifyWhoIsFirst: o })
|
|
33
34
|
}
|
|
34
35
|
),
|
|
35
36
|
/* @__PURE__ */ I(
|
|
36
37
|
j.Column,
|
|
37
38
|
{
|
|
38
|
-
gap:
|
|
39
|
+
gap: p && c ? c : r,
|
|
39
40
|
className: G.classNameConcat(
|
|
40
41
|
k["responsive-mobile-flex"],
|
|
41
42
|
"utils-column-modifier"
|
|
42
43
|
),
|
|
43
|
-
children: /* @__PURE__ */ I(n, { data: (
|
|
44
|
+
children: /* @__PURE__ */ I(n, { data: (u == null ? void 0 : u.sections) ?? [], identifyWhoIsFirst: o })
|
|
44
45
|
}
|
|
45
46
|
)
|
|
46
47
|
] });
|
|
@@ -48,11 +49,12 @@ const ye = ({
|
|
|
48
49
|
slug: e,
|
|
49
50
|
SectionZone: t,
|
|
50
51
|
COMMON_PAGE_COLUMN_GAP: n,
|
|
51
|
-
|
|
52
|
+
identifyWhoIsFirst: r = !1,
|
|
53
|
+
...o
|
|
52
54
|
}) => {
|
|
53
55
|
const { data: s } = await F({
|
|
54
56
|
contentType: "common_page",
|
|
55
|
-
...
|
|
57
|
+
...o
|
|
56
58
|
});
|
|
57
59
|
return /* @__PURE__ */ I(
|
|
58
60
|
ye,
|
|
@@ -60,7 +62,8 @@ const ye = ({
|
|
|
60
62
|
data: s,
|
|
61
63
|
slug: e,
|
|
62
64
|
SectionZone: t,
|
|
63
|
-
COMMON_PAGE_COLUMN_GAP: n
|
|
65
|
+
COMMON_PAGE_COLUMN_GAP: n,
|
|
66
|
+
identifyWhoIsFirst: r
|
|
64
67
|
}
|
|
65
68
|
);
|
|
66
69
|
}, be = async ({
|
|
@@ -68,38 +71,38 @@ const ye = ({
|
|
|
68
71
|
PAYMENT_FLAGS: t,
|
|
69
72
|
LEGAL_INFORMATION_TEXT: n,
|
|
70
73
|
SectionZone: r,
|
|
71
|
-
ICONS:
|
|
72
|
-
Footer:
|
|
74
|
+
ICONS: o,
|
|
75
|
+
Footer: s,
|
|
73
76
|
FooterSupport: i,
|
|
74
|
-
...
|
|
77
|
+
...l
|
|
75
78
|
}) => {
|
|
76
|
-
var d, h, f, m,
|
|
79
|
+
var d, h, f, m, R, T, v, S, E, g, b;
|
|
77
80
|
const { data: u } = await F({
|
|
78
81
|
contentType: "footer",
|
|
79
|
-
...
|
|
80
|
-
}), p = Array.isArray(u) && ((
|
|
81
|
-
...(
|
|
82
|
+
...l
|
|
83
|
+
}), p = Array.isArray(u) && ((d = u[0]) == null ? void 0 : d.type) === "footer" ? u[0] : null, c = {
|
|
84
|
+
...(h = p == null ? void 0 : p.paymentInfo) == null ? void 0 : h.paymentInfo,
|
|
82
85
|
acceptedFlags: Array.isArray(
|
|
83
|
-
(
|
|
84
|
-
) ? (
|
|
86
|
+
(f = p == null ? void 0 : p.paymentInfo) == null ? void 0 : f.paymentInfo.acceptedFlags
|
|
87
|
+
) ? (m = p == null ? void 0 : p.paymentInfo) == null ? void 0 : m.paymentInfo.acceptedFlags.filter((C) => !!e[C]).map(
|
|
85
88
|
(C) => e[C]
|
|
86
89
|
) : []
|
|
87
90
|
};
|
|
88
91
|
return p ? /* @__PURE__ */ I(
|
|
89
|
-
|
|
92
|
+
s,
|
|
90
93
|
{
|
|
91
94
|
data: { ...p },
|
|
92
|
-
socialInfo: (
|
|
93
|
-
socialMedias: (
|
|
94
|
-
payments:
|
|
95
|
+
socialInfo: (R = p.socialMedia) == null ? void 0 : R.socialMedia,
|
|
96
|
+
socialMedias: (v = (T = p.socialMedia) == null ? void 0 : T.socialMedia) == null ? void 0 : v.medias,
|
|
97
|
+
payments: c,
|
|
95
98
|
adornment: {
|
|
96
|
-
...(
|
|
99
|
+
...(E = (S = p.supportInfo) == null ? void 0 : S.supportInfo) != null && E.content ? {
|
|
97
100
|
bottom: /* @__PURE__ */ I(
|
|
98
101
|
i,
|
|
99
102
|
{
|
|
100
|
-
content: (
|
|
103
|
+
content: (b = (g = p.supportInfo) == null ? void 0 : g.supportInfo) == null ? void 0 : b.content,
|
|
101
104
|
CONSTANTS: {
|
|
102
|
-
ICONS:
|
|
105
|
+
ICONS: o,
|
|
103
106
|
PAYMENT_FLAGS: t,
|
|
104
107
|
PAYMENT_FLAGS_DICTIONARY: e
|
|
105
108
|
}
|
|
@@ -109,7 +112,7 @@ const ye = ({
|
|
|
109
112
|
...p.sections.length ? { top: /* @__PURE__ */ I(r, { data: p.sections }) } : {}
|
|
110
113
|
},
|
|
111
114
|
LEGAL_INFORMATION_TEXT: n,
|
|
112
|
-
ICONS:
|
|
115
|
+
ICONS: o
|
|
113
116
|
}
|
|
114
117
|
) : /* @__PURE__ */ I(H, {});
|
|
115
118
|
}, Re = async ({
|
|
@@ -117,18 +120,18 @@ const ye = ({
|
|
|
117
120
|
ClientHeaderProvider: t,
|
|
118
121
|
...n
|
|
119
122
|
}) => {
|
|
120
|
-
var
|
|
123
|
+
var s, i, l, u;
|
|
121
124
|
const { data: r } = await F({
|
|
122
125
|
contentType: "header",
|
|
123
126
|
...n
|
|
124
|
-
}),
|
|
127
|
+
}), o = (s = r[0]) == null ? void 0 : s.sections.map((p) => p.data);
|
|
125
128
|
return /* @__PURE__ */ I(
|
|
126
129
|
t,
|
|
127
130
|
{
|
|
128
131
|
headerData: {
|
|
129
132
|
...(i = r[0]) == null ? void 0 : i.layerConfig.config,
|
|
130
|
-
subMenus:
|
|
131
|
-
categories: ((
|
|
133
|
+
subMenus: o ?? [],
|
|
134
|
+
categories: ((l = r[0]) == null ? void 0 : l.categories.categories.items) ?? [],
|
|
132
135
|
navigationLinks: ((u = r[0]) == null ? void 0 : u.navigationLinks.navigationLinks.items) ?? []
|
|
133
136
|
},
|
|
134
137
|
children: e
|
|
@@ -139,15 +142,15 @@ const ye = ({
|
|
|
139
142
|
productId: t,
|
|
140
143
|
COMMON_PAGE_COLUMN_GAP: n,
|
|
141
144
|
SectionZone: r,
|
|
142
|
-
PDPContentProvider:
|
|
143
|
-
...
|
|
145
|
+
PDPContentProvider: o,
|
|
146
|
+
...s
|
|
144
147
|
}) => {
|
|
145
148
|
const { data: i } = await F({
|
|
146
149
|
contentType: "product_page",
|
|
147
|
-
...
|
|
150
|
+
...s
|
|
148
151
|
});
|
|
149
152
|
return /* @__PURE__ */ I(
|
|
150
|
-
|
|
153
|
+
o,
|
|
151
154
|
{
|
|
152
155
|
data: i[0],
|
|
153
156
|
productId: t,
|
|
@@ -163,13 +166,13 @@ const ye = ({
|
|
|
163
166
|
slug: t,
|
|
164
167
|
SectionZone: n,
|
|
165
168
|
COMMON_PAGE_COLUMN_GAP_PDC: r,
|
|
166
|
-
PLPContentProvider:
|
|
167
|
-
...
|
|
169
|
+
PLPContentProvider: o,
|
|
170
|
+
...s
|
|
168
171
|
}) => {
|
|
169
172
|
const { data: i } = await F({
|
|
170
173
|
contentType: "categories_page",
|
|
171
|
-
...
|
|
172
|
-
}),
|
|
174
|
+
...s
|
|
175
|
+
}), l = i.find(
|
|
173
176
|
(d) => {
|
|
174
177
|
var h, f, m;
|
|
175
178
|
return ((h = d.config) == null ? void 0 : h.seo.slug) === t && ((m = (f = d.config) == null ? void 0 : f.responsive) == null ? void 0 : m.deviceType) === "desktop";
|
|
@@ -184,7 +187,7 @@ const ye = ({
|
|
|
184
187
|
var h, f, m;
|
|
185
188
|
return ((h = d.config) == null ? void 0 : h.seo.slug) === "default" && ((m = (f = d.config) == null ? void 0 : f.responsive) == null ? void 0 : m.deviceType) === "desktop";
|
|
186
189
|
}
|
|
187
|
-
),
|
|
190
|
+
), c = i.find(
|
|
188
191
|
(d) => {
|
|
189
192
|
var h, f, m;
|
|
190
193
|
return ((h = d.config) == null ? void 0 : h.seo.slug) === "default" && ((m = (f = d.config) == null ? void 0 : f.responsive) == null ? void 0 : m.deviceType) === "mobile";
|
|
@@ -202,9 +205,9 @@ const ye = ({
|
|
|
202
205
|
minHeight: "100vh"
|
|
203
206
|
},
|
|
204
207
|
children: /* @__PURE__ */ I(
|
|
205
|
-
|
|
208
|
+
o,
|
|
206
209
|
{
|
|
207
|
-
data:
|
|
210
|
+
data: l ?? p,
|
|
208
211
|
device: "desktop",
|
|
209
212
|
SectionZone: n,
|
|
210
213
|
COMMON_PAGE_COLUMN_GAP_PDC: r,
|
|
@@ -214,9 +217,9 @@ const ye = ({
|
|
|
214
217
|
}
|
|
215
218
|
),
|
|
216
219
|
/* @__PURE__ */ I(j.Column, { className: k["responsive-mobile-flex"], children: /* @__PURE__ */ I(
|
|
217
|
-
|
|
220
|
+
o,
|
|
218
221
|
{
|
|
219
|
-
data: u ??
|
|
222
|
+
data: u ?? c,
|
|
220
223
|
device: "mobile",
|
|
221
224
|
SectionZone: n,
|
|
222
225
|
COMMON_PAGE_COLUMN_GAP_PDC: r,
|
|
@@ -225,30 +228,30 @@ const ye = ({
|
|
|
225
228
|
) })
|
|
226
229
|
] });
|
|
227
230
|
}, Te = async ({ slug: e, ...t }) => {
|
|
228
|
-
var i,
|
|
231
|
+
var i, l, u;
|
|
229
232
|
const { data: n } = await F({
|
|
230
233
|
contentType: "redirect_to_search",
|
|
231
234
|
...t
|
|
232
|
-
}), r = ((u = (
|
|
235
|
+
}), r = ((u = (l = (i = n[0]) == null ? void 0 : i.redirectToSearch) == null ? void 0 : l.redirectToSearch) == null ? void 0 : u.paths) ?? [];
|
|
233
236
|
if (!!!r.length)
|
|
234
237
|
return {
|
|
235
238
|
slug: e,
|
|
236
239
|
query: null,
|
|
237
240
|
redirect: !1
|
|
238
241
|
};
|
|
239
|
-
const
|
|
242
|
+
const s = r.find(
|
|
240
243
|
(p) => {
|
|
241
|
-
var
|
|
242
|
-
return ((
|
|
244
|
+
var c, d;
|
|
245
|
+
return ((c = p.path) == null ? void 0 : c.replace(/\//g, "-").toLowerCase()) === e.replace(/\//g, "-").toLowerCase() || ((d = p.path) == null ? void 0 : d.replace(/\//g, "-").toLowerCase()) === `/${e}`.replace(/\//g, "-").toLowerCase();
|
|
243
246
|
}
|
|
244
247
|
);
|
|
245
|
-
return
|
|
248
|
+
return s ? {
|
|
246
249
|
slug: e,
|
|
247
|
-
query:
|
|
250
|
+
query: s == null ? void 0 : s.searchQuery,
|
|
248
251
|
redirect: !0,
|
|
249
|
-
collectionId:
|
|
250
|
-
filters:
|
|
251
|
-
sort:
|
|
252
|
+
collectionId: s == null ? void 0 : s.collectionId,
|
|
253
|
+
filters: s == null ? void 0 : s.filters,
|
|
254
|
+
sort: s == null ? void 0 : s.sort
|
|
252
255
|
} : {
|
|
253
256
|
slug: e,
|
|
254
257
|
query: null,
|
|
@@ -258,23 +261,23 @@ const ye = ({
|
|
|
258
261
|
sort: null
|
|
259
262
|
};
|
|
260
263
|
}, Ee = async ({ slug: e, ...t }) => {
|
|
261
|
-
var i,
|
|
264
|
+
var i, l, u;
|
|
262
265
|
const { data: n } = await F({
|
|
263
266
|
contentType: "redirect_to_search",
|
|
264
267
|
...t
|
|
265
|
-
}), r = ((u = (
|
|
268
|
+
}), r = ((u = (l = (i = n[0]) == null ? void 0 : i.redirectToSearch) == null ? void 0 : l.redirectToSearch) == null ? void 0 : u.paths) ?? [];
|
|
266
269
|
if (!!!r.length)
|
|
267
270
|
return null;
|
|
268
|
-
const
|
|
271
|
+
const s = r.find(
|
|
269
272
|
(p) => {
|
|
270
|
-
var
|
|
271
|
-
return ((
|
|
273
|
+
var c, d;
|
|
274
|
+
return ((c = p.path) == null ? void 0 : c.replace(/\//g, "-").toLowerCase()) === e.replace(/\//g, "-").toLowerCase() || ((d = p.path) == null ? void 0 : d.replace(/\//g, "-").toLowerCase()) === `/${e}`.replace(/\//g, "-").toLowerCase();
|
|
272
275
|
}
|
|
273
276
|
);
|
|
274
|
-
return
|
|
277
|
+
return s ? {
|
|
275
278
|
slug: e,
|
|
276
|
-
title:
|
|
277
|
-
description:
|
|
279
|
+
title: s.pageTitle,
|
|
280
|
+
description: s.pageDescription
|
|
278
281
|
} : null;
|
|
279
282
|
}, Fe = async ({
|
|
280
283
|
children: e,
|
|
@@ -282,14 +285,14 @@ const ye = ({
|
|
|
282
285
|
className: n,
|
|
283
286
|
...r
|
|
284
287
|
}) => {
|
|
285
|
-
const { data:
|
|
288
|
+
const { data: o } = await F({
|
|
286
289
|
contentType: "search_page",
|
|
287
290
|
...r
|
|
288
291
|
});
|
|
289
|
-
return Array.isArray(
|
|
292
|
+
return Array.isArray(o) && o.length > 0 ? /* @__PURE__ */ I(
|
|
290
293
|
oe,
|
|
291
294
|
{
|
|
292
|
-
data:
|
|
295
|
+
data: o,
|
|
293
296
|
SectionZone: t,
|
|
294
297
|
className: n,
|
|
295
298
|
children: e
|
|
@@ -315,32 +318,32 @@ const ye = ({
|
|
|
315
318
|
getPLPSynteticMetaData: Ee,
|
|
316
319
|
SearchPageContent: Fe
|
|
317
320
|
}, yr = { Components: qe }, y = async (e, t = {}) => {
|
|
318
|
-
const { method: n = "GET", body: r, headers:
|
|
321
|
+
const { method: n = "GET", body: r, headers: o = {}, priority: s = "auto", cache: i = "default" } = t;
|
|
319
322
|
return fetch(e, {
|
|
320
323
|
method: n,
|
|
321
324
|
headers: {
|
|
322
|
-
...
|
|
325
|
+
...o,
|
|
323
326
|
Accept: "application/json",
|
|
324
327
|
"Content-Type": "application/json"
|
|
325
328
|
},
|
|
326
|
-
priority:
|
|
329
|
+
priority: s,
|
|
327
330
|
cache: i,
|
|
328
331
|
...r ? { body: JSON.stringify(r) } : {}
|
|
329
332
|
// not body in get
|
|
330
|
-
}).then((
|
|
331
|
-
console.error("[ERROR FETCH VTEX]",
|
|
333
|
+
}).then((l) => l.json()).catch((l) => {
|
|
334
|
+
console.error("[ERROR FETCH VTEX]", l);
|
|
332
335
|
});
|
|
333
336
|
}, w = /* @__PURE__ */ new Map();
|
|
334
337
|
async function $e(e, t = {}) {
|
|
335
338
|
var n;
|
|
336
339
|
try {
|
|
337
|
-
const { abort: r = !1 } = t,
|
|
338
|
-
r && (w.has(e) && ((n = w.get(e)) == null || n.abort(), w.delete(e)), w.set(e,
|
|
339
|
-
const
|
|
340
|
+
const { abort: r = !1 } = t, o = new AbortController();
|
|
341
|
+
r && (w.has(e) && ((n = w.get(e)) == null || n.abort(), w.delete(e)), w.set(e, o));
|
|
342
|
+
const s = y(e, {
|
|
340
343
|
...t,
|
|
341
|
-
...r ? { signal:
|
|
344
|
+
...r ? { signal: o.signal } : {}
|
|
342
345
|
});
|
|
343
|
-
return r && w.delete(e),
|
|
346
|
+
return r && w.delete(e), s;
|
|
344
347
|
} catch (r) {
|
|
345
348
|
if (r.name === "AbortError") {
|
|
346
349
|
console.log(`[REQUEST CANCELLED]: ${e}`);
|
|
@@ -359,9 +362,9 @@ async function Ae({ apiUrl: e, body: t, fetchOptions: n }) {
|
|
|
359
362
|
return;
|
|
360
363
|
}
|
|
361
364
|
await Pe.validate(t);
|
|
362
|
-
const { country: r, postalCode:
|
|
365
|
+
const { country: r, postalCode: o } = t;
|
|
363
366
|
return await y(
|
|
364
|
-
`${e}/api/checkout/pub/postal-code/${r}/${
|
|
367
|
+
`${e}/api/checkout/pub/postal-code/${r}/${o}`,
|
|
365
368
|
{
|
|
366
369
|
method: "POST",
|
|
367
370
|
body: t,
|
|
@@ -384,7 +387,7 @@ async function Q({
|
|
|
384
387
|
return;
|
|
385
388
|
}
|
|
386
389
|
await we.validate(t);
|
|
387
|
-
const { orderFormId: r, sellerCode:
|
|
390
|
+
const { orderFormId: r, sellerCode: o, sellerName: s } = t, i = o ? `${o.trim()} - ${s}` : null;
|
|
388
391
|
return y(
|
|
389
392
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/openTextField`,
|
|
390
393
|
{
|
|
@@ -412,17 +415,17 @@ async function K({
|
|
|
412
415
|
return;
|
|
413
416
|
}
|
|
414
417
|
await Ne.validate(t);
|
|
415
|
-
const { orderFormId:
|
|
416
|
-
utmCampaign:
|
|
417
|
-
utmiCampaign:
|
|
418
|
+
const { orderFormId: o, sellerCode: s, marketingData: i } = t, l = s ? {
|
|
419
|
+
utmCampaign: s ? s.toUpperCase() : "",
|
|
420
|
+
utmiCampaign: s ? `${n.VENDOR_CODE}` : "semcodigo"
|
|
418
421
|
} : {};
|
|
419
422
|
return y(
|
|
420
|
-
`${e}/api/checkout/pub/orderForm/${
|
|
423
|
+
`${e}/api/checkout/pub/orderForm/${o}/attachments/marketingData`,
|
|
421
424
|
{
|
|
422
425
|
method: "POST",
|
|
423
426
|
body: {
|
|
424
427
|
...i,
|
|
425
|
-
...
|
|
428
|
+
...l
|
|
426
429
|
},
|
|
427
430
|
...r
|
|
428
431
|
}
|
|
@@ -463,9 +466,9 @@ async function _e({
|
|
|
463
466
|
return;
|
|
464
467
|
}
|
|
465
468
|
await De.validate(t);
|
|
466
|
-
const { coupon: r = "", orderFormId:
|
|
469
|
+
const { coupon: r = "", orderFormId: o } = t;
|
|
467
470
|
return y(
|
|
468
|
-
`${e}/api/checkout/pub/orderForm/${
|
|
471
|
+
`${e}/api/checkout/pub/orderForm/${o}/coupons`,
|
|
469
472
|
{
|
|
470
473
|
method: "POST",
|
|
471
474
|
body: { text: r },
|
|
@@ -488,9 +491,9 @@ async function Be({
|
|
|
488
491
|
return;
|
|
489
492
|
}
|
|
490
493
|
await He.validate(t);
|
|
491
|
-
const { appId: r = "faststore", orderFormId:
|
|
494
|
+
const { appId: r = "faststore", orderFormId: o, key: s } = t;
|
|
492
495
|
return y(
|
|
493
|
-
`${e}/api/checkout/pub/orderForm/${
|
|
496
|
+
`${e}/api/checkout/pub/orderForm/${o}/customData/${r}/${s}`,
|
|
494
497
|
{
|
|
495
498
|
method: "PUT",
|
|
496
499
|
...n
|
|
@@ -523,12 +526,12 @@ async function Ue({
|
|
|
523
526
|
return;
|
|
524
527
|
}
|
|
525
528
|
await Me.validate(t);
|
|
526
|
-
const { orderFormId: r, orderItems:
|
|
529
|
+
const { orderFormId: r, orderItems: o } = t;
|
|
527
530
|
return y(
|
|
528
531
|
`${e}/api/checkout/pub/orderForm/${r}/items`,
|
|
529
532
|
{
|
|
530
533
|
method: "POST",
|
|
531
|
-
body: { orderItems:
|
|
534
|
+
body: { orderItems: o },
|
|
532
535
|
...n
|
|
533
536
|
}
|
|
534
537
|
);
|
|
@@ -581,20 +584,20 @@ async function Je({
|
|
|
581
584
|
return;
|
|
582
585
|
}
|
|
583
586
|
await Ke.validate(t);
|
|
584
|
-
const { orderFormId: r, orderItems:
|
|
587
|
+
const { orderFormId: r, orderItems: o } = t;
|
|
585
588
|
return y(
|
|
586
589
|
`${e}/api/checkout/pub/orderForm/${r}/items/update`,
|
|
587
590
|
{
|
|
588
591
|
method: "POST",
|
|
589
|
-
body: { orderItems:
|
|
592
|
+
body: { orderItems: o },
|
|
590
593
|
...n
|
|
591
594
|
}
|
|
592
595
|
);
|
|
593
596
|
}
|
|
594
|
-
const
|
|
597
|
+
const Ye = a.object({
|
|
595
598
|
orderFormId: a.string().nullable()
|
|
596
599
|
});
|
|
597
|
-
async function
|
|
600
|
+
async function We({
|
|
598
601
|
apiUrl: e,
|
|
599
602
|
body: t,
|
|
600
603
|
fetchOptions: n
|
|
@@ -603,7 +606,7 @@ async function Ye({
|
|
|
603
606
|
console.error("[ERROR FETCHING] Body is required");
|
|
604
607
|
return;
|
|
605
608
|
}
|
|
606
|
-
await
|
|
609
|
+
await Ye.validate(t);
|
|
607
610
|
const { orderFormId: r } = t;
|
|
608
611
|
return y(
|
|
609
612
|
`${e}/api/checkout/pub/orderForm/${r}/messages/clear`,
|
|
@@ -626,10 +629,10 @@ async function Ze({ apiUrl: e, body: t, fetchOptions: n }) {
|
|
|
626
629
|
return;
|
|
627
630
|
}
|
|
628
631
|
await Xe.validate(t);
|
|
629
|
-
const { itemIndex: r, orderFormId:
|
|
632
|
+
const { itemIndex: r, orderFormId: o, id: s, remove: i } = t, l = i ? `/${s}/remove` : "", u = `${e}/api/checkout/pub/orderForm/${o}/items/${r}/offerings${l}`;
|
|
630
633
|
return y(u, {
|
|
631
634
|
method: "POST",
|
|
632
|
-
body: { id:
|
|
635
|
+
body: { id: s },
|
|
633
636
|
...n
|
|
634
637
|
});
|
|
635
638
|
}
|
|
@@ -648,10 +651,10 @@ async function tt({
|
|
|
648
651
|
return;
|
|
649
652
|
}
|
|
650
653
|
await et.validate(t);
|
|
651
|
-
const
|
|
654
|
+
const o = new URLSearchParams({
|
|
652
655
|
refreshOutdatedData: "true"
|
|
653
|
-
}),
|
|
654
|
-
return y(
|
|
656
|
+
}), s = t.orderFormId && ((i = r.orderFormPurchaseId) == null ? void 0 : i.value) !== t.orderFormId ? `${e}/api/checkout/pub/orderForm/${t.orderFormId}?${String(o)}` : `${e}/api/checkout/pub/orderForm`;
|
|
657
|
+
return y(s, { method: "GET", ...n });
|
|
655
658
|
}
|
|
656
659
|
const rt = a.object({
|
|
657
660
|
orderFormId: a.string().nullable(),
|
|
@@ -672,12 +675,12 @@ async function nt({
|
|
|
672
675
|
return;
|
|
673
676
|
}
|
|
674
677
|
await rt.validate(t);
|
|
675
|
-
const { orderFormId: r, ...
|
|
678
|
+
const { orderFormId: r, ...o } = t;
|
|
676
679
|
return y(
|
|
677
680
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/clientProfileData`,
|
|
678
681
|
{
|
|
679
682
|
method: "POST",
|
|
680
|
-
body: { ...
|
|
683
|
+
body: { ...o },
|
|
681
684
|
...n
|
|
682
685
|
}
|
|
683
686
|
);
|
|
@@ -696,9 +699,9 @@ async function st({
|
|
|
696
699
|
return;
|
|
697
700
|
}
|
|
698
701
|
await at.validate(t);
|
|
699
|
-
const { sellerCode:
|
|
702
|
+
const { sellerCode: o = "" } = t;
|
|
700
703
|
return y(
|
|
701
|
-
`${e}/api/dataentities/${n.ENTITIES}/search?_fields=${n.FIELDS}&${n.FILTER}=${
|
|
704
|
+
`${e}/api/dataentities/${n.ENTITIES}/search?_fields=${n.FIELDS}&${n.FILTER}=${o}`,
|
|
702
705
|
{
|
|
703
706
|
method: "GET",
|
|
704
707
|
headers: {
|
|
@@ -723,10 +726,10 @@ async function it({
|
|
|
723
726
|
return;
|
|
724
727
|
}
|
|
725
728
|
await ot.validate(t);
|
|
726
|
-
const { country: r, orderFormId:
|
|
729
|
+
const { country: r, orderFormId: o, postalCode: s } = t, i = s ? {
|
|
727
730
|
address: {
|
|
728
731
|
addressType: "residential",
|
|
729
|
-
postalCode:
|
|
732
|
+
postalCode: s,
|
|
730
733
|
country: r
|
|
731
734
|
}
|
|
732
735
|
} : {
|
|
@@ -734,7 +737,7 @@ async function it({
|
|
|
734
737
|
clearAddressIfPostalCodeNotFound: !0
|
|
735
738
|
};
|
|
736
739
|
return y(
|
|
737
|
-
`${e}/api/checkout/pub/orderForm/${
|
|
740
|
+
`${e}/api/checkout/pub/orderForm/${o}/attachments/shippingData`,
|
|
738
741
|
{
|
|
739
742
|
method: "POST",
|
|
740
743
|
body: i,
|
|
@@ -776,15 +779,15 @@ async function lt({ apiUrl: e, body: t, fetchOptions: n }) {
|
|
|
776
779
|
return;
|
|
777
780
|
}
|
|
778
781
|
await ct.validate(t);
|
|
779
|
-
const { orderFormId: r, options:
|
|
782
|
+
const { orderFormId: r, options: o, selectedAddresses: s } = t;
|
|
780
783
|
return y(
|
|
781
784
|
`${e}/api/checkout/pub/orderForm/${r}/attachments/shippingData`,
|
|
782
785
|
{
|
|
783
786
|
method: "POST",
|
|
784
787
|
body: {
|
|
785
|
-
selectedAddresses:
|
|
788
|
+
selectedAddresses: s,
|
|
786
789
|
clearAddressIfPostalCodeNotFound: !1,
|
|
787
|
-
logisticsInfo:
|
|
790
|
+
logisticsInfo: o
|
|
788
791
|
},
|
|
789
792
|
...n
|
|
790
793
|
}
|
|
@@ -804,10 +807,10 @@ async function dt({ apiUrl: e, body: t, fetchOptions: n }) {
|
|
|
804
807
|
return;
|
|
805
808
|
}
|
|
806
809
|
await ut.validate(t);
|
|
807
|
-
const { country: r = "", geoCoordinates:
|
|
808
|
-
return
|
|
810
|
+
const { country: r = "", geoCoordinates: o, postalCode: s = "" } = t, i = new URLSearchParams({ country: String(r) });
|
|
811
|
+
return s ? i.append("postalCode", s) : i.append(
|
|
809
812
|
"geoCoordinates",
|
|
810
|
-
`${
|
|
813
|
+
`${o == null ? void 0 : o.longitude};${o == null ? void 0 : o.latitude}`
|
|
811
814
|
), await y(
|
|
812
815
|
`${e}/api/checkout/pub/regions/?${i.toString()}`,
|
|
813
816
|
{
|
|
@@ -850,7 +853,7 @@ const gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
850
853
|
postOrderFormAttachShippingData: it,
|
|
851
854
|
postOrderFormAttachmentsMarketingData: K,
|
|
852
855
|
postOrderFormAttachmentsOpenTextField: Q,
|
|
853
|
-
postOrderFormClearMessages:
|
|
856
|
+
postOrderFormClearMessages: We,
|
|
854
857
|
postOrderFormFreightSimulation: ft,
|
|
855
858
|
postOrderFormItems: Ue,
|
|
856
859
|
postOrderFormRegion: dt,
|
|
@@ -888,7 +891,7 @@ async function bt({ apiUrl: e, body: t, fetchOptions: n }) {
|
|
|
888
891
|
await It.validate(t);
|
|
889
892
|
const { ids: r } = t;
|
|
890
893
|
return y(
|
|
891
|
-
`${e}/api/catalog_system/pub/products/search?fq=${r.map((
|
|
894
|
+
`${e}/api/catalog_system/pub/products/search?fq=${r.map((o) => `productId:${o}`).join("&fq=")}`,
|
|
892
895
|
{
|
|
893
896
|
...n
|
|
894
897
|
}
|
|
@@ -925,9 +928,9 @@ async function Tt({ apiUrl: e, body: t, fetchOptions: n }) {
|
|
|
925
928
|
return;
|
|
926
929
|
}
|
|
927
930
|
await St.validate(t);
|
|
928
|
-
const { query: r = "" } = t,
|
|
931
|
+
const { query: r = "" } = t, o = new URLSearchParams({ query: r });
|
|
929
932
|
return y(
|
|
930
|
-
`${e}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${
|
|
933
|
+
`${e}/api/io/_v/api/intelligent-search/autocomplete_suggestions?${o.toString()}`,
|
|
931
934
|
{
|
|
932
935
|
...n
|
|
933
936
|
}
|
|
@@ -947,20 +950,20 @@ const Et = (e, t) => he(e, t), Ft = (e) => ({
|
|
|
947
950
|
}), J = (e, t) => ({
|
|
948
951
|
...e,
|
|
949
952
|
isVariantOf: Ft(t)
|
|
950
|
-
}), qt = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", N = (e) => e.AvailableQuantity > 0, L = (e) => e.spotPrice ?? 0, $t = (e) => e.Price ?? 0,
|
|
953
|
+
}), qt = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", N = (e) => e.AvailableQuantity > 0, L = (e) => e.spotPrice ?? 0, $t = (e) => e.Price ?? 0, Y = (e, t) => N(e) && !N(t) ? -1 : !N(e) && N(t) ? 1 : L(e) - L(t), Pt = (e, t) => {
|
|
951
954
|
let n = 0;
|
|
952
955
|
for (let r = 1; r < e.length; r++)
|
|
953
956
|
t(e[n], e[r]) > 0 && (n = r);
|
|
954
957
|
return e[n];
|
|
955
|
-
},
|
|
958
|
+
}, W = (e) => {
|
|
956
959
|
const t = e.flatMap(
|
|
957
|
-
(r) => r.sellers.map((
|
|
958
|
-
offer:
|
|
960
|
+
(r) => r.sellers.map((o) => ({
|
|
961
|
+
offer: o.commertialOffer,
|
|
959
962
|
sku: r
|
|
960
963
|
}))
|
|
961
964
|
), n = Pt(
|
|
962
965
|
t,
|
|
963
|
-
({ offer: r }, { offer:
|
|
966
|
+
({ offer: r }, { offer: o }) => Y(r, o)
|
|
964
967
|
);
|
|
965
968
|
return n ? n.sku : e[0];
|
|
966
969
|
}, X = (e) => e.map(
|
|
@@ -986,7 +989,7 @@ const Et = (e, t) => he(e, t), Ft = (e) => ({
|
|
|
986
989
|
visible: e.visible
|
|
987
990
|
}
|
|
988
991
|
}), _ = (e, t, n) => {
|
|
989
|
-
const r = e.flatMap(({ name: i, values:
|
|
992
|
+
const r = e.flatMap(({ name: i, values: l }) => l ? l.map((u) => ({
|
|
990
993
|
name: i,
|
|
991
994
|
value: u,
|
|
992
995
|
valueReference: D.specification
|
|
@@ -994,11 +997,11 @@ const Et = (e, t) => he(e, t), Ft = (e) => ({
|
|
|
994
997
|
name: i,
|
|
995
998
|
value: "",
|
|
996
999
|
valueReference: D.specification
|
|
997
|
-
}),
|
|
1000
|
+
}), o = Array.isArray(n) ? n.map(At) : [], s = t ? t.map(wt) : [];
|
|
998
1001
|
return [
|
|
999
1002
|
...r,
|
|
1000
|
-
...
|
|
1001
|
-
...
|
|
1003
|
+
...o,
|
|
1004
|
+
...s
|
|
1002
1005
|
];
|
|
1003
1006
|
}, M = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", Nt = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", kt = (e) => {
|
|
1004
1007
|
let t = e.slice(0);
|
|
@@ -1026,41 +1029,41 @@ const Et = (e, t) => he(e, t), Ft = (e) => ({
|
|
|
1026
1029
|
price: 0,
|
|
1027
1030
|
listPrice: 0,
|
|
1028
1031
|
sellerDefault: !1
|
|
1029
|
-
},
|
|
1030
|
-
(
|
|
1031
|
-
offer:
|
|
1032
|
-
seller:
|
|
1032
|
+
}, o = e.map(
|
|
1033
|
+
(s) => Ot({
|
|
1034
|
+
offer: s.commertialOffer,
|
|
1035
|
+
seller: s,
|
|
1033
1036
|
product: t
|
|
1034
1037
|
})
|
|
1035
|
-
).sort(
|
|
1036
|
-
availability:
|
|
1037
|
-
listPrice:
|
|
1038
|
-
price: $t(
|
|
1039
|
-
priceValidUntil:
|
|
1038
|
+
).sort(Y).map((s) => (s.seller.sellerId === "1" && s.AvailableQuantity > 0 && (n.price = s.Price, n.listPrice = s.ListPrice, n.sellerDefault = !0), {
|
|
1039
|
+
availability: s.AvailableQuantity > 0,
|
|
1040
|
+
listPrice: s.ListPrice,
|
|
1041
|
+
price: $t(s),
|
|
1042
|
+
priceValidUntil: s.PriceValidUntil,
|
|
1040
1043
|
priceCurrency: "BRL",
|
|
1041
|
-
installments:
|
|
1042
|
-
lowPrice:
|
|
1043
|
-
quantity:
|
|
1044
|
+
installments: s.Installments,
|
|
1045
|
+
lowPrice: s.spotPrice,
|
|
1046
|
+
quantity: s.AvailableQuantity,
|
|
1044
1047
|
seller: {
|
|
1045
|
-
identifier:
|
|
1048
|
+
identifier: s.seller.sellerId
|
|
1046
1049
|
}
|
|
1047
1050
|
}));
|
|
1048
1051
|
return {
|
|
1049
|
-
lowPrice: n.sellerDefault ? n.price :
|
|
1050
|
-
highPrice: n.sellerDefault ? n.listPrice :
|
|
1051
|
-
offers:
|
|
1052
|
+
lowPrice: n.sellerDefault ? n.price : o[0].price,
|
|
1053
|
+
highPrice: n.sellerDefault ? n.listPrice : o[0].listPrice,
|
|
1054
|
+
offers: o
|
|
1052
1055
|
};
|
|
1053
1056
|
}, ne = (e) => {
|
|
1054
|
-
const { attributes: t, itemId: n, name: r, sellers:
|
|
1057
|
+
const { attributes: t, itemId: n, name: r, sellers: o, variations: s } = e;
|
|
1055
1058
|
return {
|
|
1056
|
-
additionalProperty: _(
|
|
1059
|
+
additionalProperty: _(s, t, []),
|
|
1057
1060
|
name: r,
|
|
1058
1061
|
offers: {
|
|
1059
|
-
offers:
|
|
1060
|
-
availability: qt(
|
|
1061
|
-
listPrice:
|
|
1062
|
-
price:
|
|
1063
|
-
quantity:
|
|
1062
|
+
offers: o.map(({ sellerId: i, commertialOffer: l }) => ({
|
|
1063
|
+
availability: qt(l.AvailableQuantity > 0),
|
|
1064
|
+
listPrice: l.ListPrice,
|
|
1065
|
+
price: l.Price,
|
|
1066
|
+
quantity: l.AvailableQuantity,
|
|
1064
1067
|
seller: {
|
|
1065
1068
|
identifier: i
|
|
1066
1069
|
}
|
|
@@ -1070,33 +1073,33 @@ const Et = (e, t) => he(e, t), Ft = (e) => ({
|
|
|
1070
1073
|
// slug: getSlug('', itemId), // getSlug('', itemId) que tipo de slug é esse?
|
|
1071
1074
|
};
|
|
1072
1075
|
}, Dt = (e) => {
|
|
1073
|
-
var
|
|
1076
|
+
var O;
|
|
1074
1077
|
const {
|
|
1075
1078
|
attributes: t,
|
|
1076
1079
|
referenceId: n,
|
|
1077
1080
|
isVariantOf: r,
|
|
1078
|
-
images:
|
|
1079
|
-
itemId:
|
|
1081
|
+
images: o,
|
|
1082
|
+
itemId: s,
|
|
1080
1083
|
name: i,
|
|
1081
|
-
sellers:
|
|
1084
|
+
sellers: l,
|
|
1082
1085
|
videos: u,
|
|
1083
1086
|
variations: p
|
|
1084
1087
|
} = e, {
|
|
1085
|
-
brand:
|
|
1088
|
+
brand: c,
|
|
1086
1089
|
categories: d,
|
|
1087
1090
|
categoriesIds: h,
|
|
1088
1091
|
description: f,
|
|
1089
1092
|
linkText: m,
|
|
1090
|
-
productClusters:
|
|
1093
|
+
productClusters: R,
|
|
1091
1094
|
clusterHighlights: T,
|
|
1092
1095
|
productName: v,
|
|
1093
1096
|
properties: S,
|
|
1094
1097
|
productId: E,
|
|
1095
1098
|
productReference: g
|
|
1096
|
-
} = r, b = d.slice().reverse(),
|
|
1099
|
+
} = r, b = d.slice().reverse(), C = re(l, e.isVariantOf), $ = te(C.offers[0].installments);
|
|
1097
1100
|
return {
|
|
1098
|
-
sku:
|
|
1099
|
-
gtin: ((
|
|
1101
|
+
sku: s,
|
|
1102
|
+
gtin: ((O = n == null ? void 0 : n[0]) == null ? void 0 : O.Value) ?? g ?? "",
|
|
1100
1103
|
name: v ?? i,
|
|
1101
1104
|
description: f,
|
|
1102
1105
|
releaseDate: r.releaseDate ?? "",
|
|
@@ -1105,22 +1108,22 @@ const Et = (e, t) => he(e, t), Ft = (e) => ({
|
|
|
1105
1108
|
categories: d,
|
|
1106
1109
|
categoriesIds: h,
|
|
1107
1110
|
id: E,
|
|
1108
|
-
brand: { name:
|
|
1111
|
+
brand: { name: c, brandName: c },
|
|
1109
1112
|
seo: {
|
|
1110
1113
|
description: f,
|
|
1111
1114
|
title: v,
|
|
1112
1115
|
canonical: ee(m)
|
|
1113
1116
|
},
|
|
1114
1117
|
cluster: {
|
|
1115
|
-
generals:
|
|
1118
|
+
generals: R,
|
|
1116
1119
|
highlights: T
|
|
1117
1120
|
},
|
|
1118
1121
|
properties: S,
|
|
1119
|
-
availability: { status:
|
|
1122
|
+
availability: { status: C.offers[0].availability },
|
|
1120
1123
|
breadcrumbList: {
|
|
1121
1124
|
itemListElement: [
|
|
1122
1125
|
...b.map((P, A) => {
|
|
1123
|
-
const
|
|
1126
|
+
const q = P.split("/"), B = q[q.length - 2], se = q.map(Z).join("/");
|
|
1124
1127
|
return {
|
|
1125
1128
|
name: B,
|
|
1126
1129
|
item: se,
|
|
@@ -1135,42 +1138,42 @@ const Et = (e, t) => he(e, t), Ft = (e) => ({
|
|
|
1135
1138
|
],
|
|
1136
1139
|
numberOfItems: d.length
|
|
1137
1140
|
},
|
|
1138
|
-
image: X(
|
|
1139
|
-
offers:
|
|
1141
|
+
image: X(o),
|
|
1142
|
+
offers: C,
|
|
1140
1143
|
additionalProperty: _(p, t, []),
|
|
1141
1144
|
isVariantOf: {
|
|
1142
1145
|
productGroupID: r.productId,
|
|
1143
1146
|
hasVariant: r.items.map((P) => ne(P))
|
|
1144
1147
|
},
|
|
1145
|
-
installments:
|
|
1148
|
+
installments: $
|
|
1146
1149
|
};
|
|
1147
1150
|
}, _t = (e) => {
|
|
1148
|
-
var
|
|
1151
|
+
var $;
|
|
1149
1152
|
const {
|
|
1150
1153
|
attributes: t,
|
|
1151
1154
|
referenceId: n,
|
|
1152
1155
|
isVariantOf: r,
|
|
1153
|
-
images:
|
|
1154
|
-
itemId:
|
|
1156
|
+
images: o,
|
|
1157
|
+
itemId: s,
|
|
1155
1158
|
name: i,
|
|
1156
|
-
sellers:
|
|
1159
|
+
sellers: l,
|
|
1157
1160
|
Videos: u,
|
|
1158
1161
|
variations: p
|
|
1159
1162
|
} = e, {
|
|
1160
|
-
brand:
|
|
1163
|
+
brand: c,
|
|
1161
1164
|
categories: d,
|
|
1162
1165
|
categoriesIds: h,
|
|
1163
1166
|
description: f,
|
|
1164
1167
|
linkText: m,
|
|
1165
|
-
productClusters:
|
|
1168
|
+
productClusters: R,
|
|
1166
1169
|
productName: T,
|
|
1167
1170
|
Coleção: v,
|
|
1168
1171
|
"ID Coleção": S,
|
|
1169
1172
|
productId: E
|
|
1170
|
-
} = r, g = d.slice().reverse(), b = re(
|
|
1173
|
+
} = r, g = d.slice().reverse(), b = re(l, e.isVariantOf), C = te(b.offers[0].installments);
|
|
1171
1174
|
return {
|
|
1172
|
-
sku:
|
|
1173
|
-
gtin: ((
|
|
1175
|
+
sku: s,
|
|
1176
|
+
gtin: (($ = n[0]) == null ? void 0 : $.Value) ?? "",
|
|
1174
1177
|
name: T ?? i,
|
|
1175
1178
|
description: f,
|
|
1176
1179
|
releaseDate: r.releaseDate ?? "",
|
|
@@ -1181,24 +1184,24 @@ const Et = (e, t) => he(e, t), Ft = (e) => ({
|
|
|
1181
1184
|
collection: v,
|
|
1182
1185
|
collectionId: S,
|
|
1183
1186
|
id: E,
|
|
1184
|
-
brand: { name:
|
|
1187
|
+
brand: { name: c, brandName: c },
|
|
1185
1188
|
seo: {
|
|
1186
1189
|
description: f,
|
|
1187
1190
|
title: T,
|
|
1188
1191
|
canonical: ee(m)
|
|
1189
1192
|
},
|
|
1190
1193
|
cluster: {
|
|
1191
|
-
generals:
|
|
1194
|
+
generals: R,
|
|
1192
1195
|
highlights: []
|
|
1193
1196
|
// TODO: add highlights
|
|
1194
1197
|
},
|
|
1195
1198
|
availability: { status: b.offers[0].availability },
|
|
1196
1199
|
breadcrumbList: {
|
|
1197
1200
|
itemListElement: [
|
|
1198
|
-
...g.map((
|
|
1199
|
-
const A =
|
|
1201
|
+
...g.map((O, P) => {
|
|
1202
|
+
const A = O.split("/"), q = A[A.length - 2], B = A.map(Z).join("/");
|
|
1200
1203
|
return {
|
|
1201
|
-
name:
|
|
1204
|
+
name: q,
|
|
1202
1205
|
item: B,
|
|
1203
1206
|
position: P + 1
|
|
1204
1207
|
};
|
|
@@ -1211,18 +1214,18 @@ const Et = (e, t) => he(e, t), Ft = (e) => ({
|
|
|
1211
1214
|
],
|
|
1212
1215
|
numberOfItems: d.length
|
|
1213
1216
|
},
|
|
1214
|
-
image: X(
|
|
1217
|
+
image: X(o),
|
|
1215
1218
|
offers: b,
|
|
1216
1219
|
additionalProperty: _(p, t, []),
|
|
1217
1220
|
isVariantOf: {
|
|
1218
1221
|
productGroupID: r.productId,
|
|
1219
|
-
hasVariant: r.items.map((
|
|
1220
|
-
const { variations: P } =
|
|
1221
|
-
name:
|
|
1222
|
-
values: q
|
|
1222
|
+
hasVariant: r.items.map((O) => {
|
|
1223
|
+
const { variations: P } = O, A = P.map((q) => ({
|
|
1224
|
+
name: q,
|
|
1225
|
+
values: O[q]
|
|
1223
1226
|
}));
|
|
1224
1227
|
return {
|
|
1225
|
-
...ne(
|
|
1228
|
+
...ne(O),
|
|
1226
1229
|
additionalProperty: _(
|
|
1227
1230
|
A,
|
|
1228
1231
|
t,
|
|
@@ -1231,7 +1234,7 @@ const Et = (e, t) => he(e, t), Ft = (e) => ({
|
|
|
1231
1234
|
};
|
|
1232
1235
|
})
|
|
1233
1236
|
},
|
|
1234
|
-
installments:
|
|
1237
|
+
installments: C
|
|
1235
1238
|
};
|
|
1236
1239
|
}, Ht = a.array().of(a.object({
|
|
1237
1240
|
key: a.string().required(),
|
|
@@ -1243,14 +1246,14 @@ async function Bt({ apiUrl: e, body: t, fetchOptions: n }) {
|
|
|
1243
1246
|
return;
|
|
1244
1247
|
}
|
|
1245
1248
|
await Ht.validate(t);
|
|
1246
|
-
const r = new URLSearchParams({}),
|
|
1249
|
+
const r = new URLSearchParams({}), o = t.map(({ key: i, value: l }) => `${i}/${l}`).join("/");
|
|
1247
1250
|
ie(t, r);
|
|
1248
|
-
const
|
|
1249
|
-
return y(
|
|
1251
|
+
const s = `${e}/api/catalog_system/pub/products/crossselling/${o}`;
|
|
1252
|
+
return y(s, {
|
|
1250
1253
|
cache: "no-store",
|
|
1251
1254
|
...n
|
|
1252
1255
|
}).then((i) => i.map((u) => {
|
|
1253
|
-
const p =
|
|
1256
|
+
const p = W(u.items);
|
|
1254
1257
|
return p && J(p, u);
|
|
1255
1258
|
}).filter((u) => !!u).map((u) => ({
|
|
1256
1259
|
node: _t(u)
|
|
@@ -1267,22 +1270,22 @@ const ae = ({
|
|
|
1267
1270
|
return;
|
|
1268
1271
|
}
|
|
1269
1272
|
const {
|
|
1270
|
-
query:
|
|
1271
|
-
page:
|
|
1273
|
+
query: o = "",
|
|
1274
|
+
page: s = 1,
|
|
1272
1275
|
count: i,
|
|
1273
|
-
sort:
|
|
1276
|
+
sort: l = "",
|
|
1274
1277
|
facets: u = [],
|
|
1275
1278
|
type: p,
|
|
1276
|
-
hideUnavailableItems:
|
|
1279
|
+
hideUnavailableItems: c = !0,
|
|
1277
1280
|
locale: d = ""
|
|
1278
1281
|
} = t, h = new URLSearchParams({
|
|
1279
|
-
page:
|
|
1282
|
+
page: s.toString(),
|
|
1280
1283
|
count: (i == null ? void 0 : i.toString()) ?? (r == null ? void 0 : r.ITEMS_PER_PAGE) ?? 24,
|
|
1281
|
-
query:
|
|
1282
|
-
sort:
|
|
1284
|
+
query: o,
|
|
1285
|
+
sort: l,
|
|
1283
1286
|
locale: d
|
|
1284
1287
|
});
|
|
1285
|
-
|
|
1288
|
+
c !== void 0 && h.append("hideUnavailableItems", c.toString());
|
|
1286
1289
|
const f = u.map((m) => `${m.key}/${m.value}`).join("/") ?? "";
|
|
1287
1290
|
return $e(
|
|
1288
1291
|
`${e}/api/io/_v/api/intelligent-search/${p}/${f}?${h.toString()}`,
|
|
@@ -1307,25 +1310,25 @@ async function Gt({ body: e, extraData: t, ...n }) {
|
|
|
1307
1310
|
},
|
|
1308
1311
|
extraData: t,
|
|
1309
1312
|
...n
|
|
1310
|
-
}),
|
|
1311
|
-
const u =
|
|
1312
|
-
return u && J(u,
|
|
1313
|
-
}).filter((
|
|
1314
|
-
pagination:
|
|
1313
|
+
}), o = (r == null ? void 0 : r.products.map((l) => {
|
|
1314
|
+
const u = W(l.items);
|
|
1315
|
+
return u && J(u, l);
|
|
1316
|
+
}).filter((l) => !!l)) ?? [], {
|
|
1317
|
+
pagination: s,
|
|
1315
1318
|
recordsFiltered: i
|
|
1316
1319
|
} = r;
|
|
1317
1320
|
return {
|
|
1318
1321
|
data: {
|
|
1319
1322
|
pagination: {
|
|
1320
|
-
nextPage:
|
|
1321
|
-
previousPage:
|
|
1323
|
+
nextPage: s.after.length > 0,
|
|
1324
|
+
previousPage: s.before.length > 0,
|
|
1322
1325
|
startCursor: "0",
|
|
1323
1326
|
endCursor: i.toString(),
|
|
1324
1327
|
count: i,
|
|
1325
|
-
total:
|
|
1328
|
+
total: s.count
|
|
1326
1329
|
},
|
|
1327
|
-
products:
|
|
1328
|
-
node: Dt(
|
|
1330
|
+
products: o.map((l, u) => ({
|
|
1331
|
+
node: Dt(l),
|
|
1329
1332
|
cursor: u.toString()
|
|
1330
1333
|
}))
|
|
1331
1334
|
}
|
|
@@ -1361,9 +1364,9 @@ async function Ut({ apiUrl: e, body: t, fetchOptions: n }) {
|
|
|
1361
1364
|
return;
|
|
1362
1365
|
}
|
|
1363
1366
|
await Mt.validate(t);
|
|
1364
|
-
const { query: r = "", locale:
|
|
1367
|
+
const { query: r = "", locale: o = "default_locale" } = t, s = new URLSearchParams({ query: r, locale: o });
|
|
1365
1368
|
return y(
|
|
1366
|
-
`${e}/api/io/_v/api/intelligent-search/search_suggestions?${
|
|
1369
|
+
`${e}/api/io/_v/api/intelligent-search/search_suggestions?${s.toString()}`,
|
|
1367
1370
|
{
|
|
1368
1371
|
...n
|
|
1369
1372
|
}
|
|
@@ -1394,11 +1397,11 @@ async function Qt({
|
|
|
1394
1397
|
return;
|
|
1395
1398
|
}
|
|
1396
1399
|
await zt.validate(t);
|
|
1397
|
-
const { masterDataEntity: r, payload:
|
|
1398
|
-
return y(
|
|
1400
|
+
const { masterDataEntity: r, payload: o } = t, s = `${e}/api/dataentities/${r}/documents`;
|
|
1401
|
+
return y(s, {
|
|
1399
1402
|
method: "POST",
|
|
1400
1403
|
body: {
|
|
1401
|
-
payload:
|
|
1404
|
+
payload: o
|
|
1402
1405
|
},
|
|
1403
1406
|
...n
|
|
1404
1407
|
});
|
|
@@ -1417,7 +1420,7 @@ const Kt = a.object().shape({
|
|
|
1417
1420
|
"REST-Range": a.string().notRequired()
|
|
1418
1421
|
})
|
|
1419
1422
|
});
|
|
1420
|
-
async function
|
|
1423
|
+
async function Yt({
|
|
1421
1424
|
apiUrl: e,
|
|
1422
1425
|
body: t,
|
|
1423
1426
|
fetchOptions: n
|
|
@@ -1428,12 +1431,12 @@ async function Wt({
|
|
|
1428
1431
|
}
|
|
1429
1432
|
const r = new URLSearchParams();
|
|
1430
1433
|
await Jt.validate(t);
|
|
1431
|
-
const { masterDataEntity:
|
|
1432
|
-
|
|
1434
|
+
const { masterDataEntity: o, searchFields: s, headers: i } = t;
|
|
1435
|
+
s && Object.entries(s).forEach(([u, p]) => {
|
|
1433
1436
|
r.append(u, String(p));
|
|
1434
|
-
}), "_fields" in
|
|
1435
|
-
const
|
|
1436
|
-
return y(
|
|
1437
|
+
}), "_fields" in s || r == null || r.append("_fields", "_all");
|
|
1438
|
+
const l = `${e}/api/dataentities/${o}/search?${r.toString()}`;
|
|
1439
|
+
return y(l, {
|
|
1437
1440
|
headers: {
|
|
1438
1441
|
"REST-Range": i["REST-Range"] ?? "resources=0-20"
|
|
1439
1442
|
},
|
|
@@ -1441,7 +1444,7 @@ async function Wt({
|
|
|
1441
1444
|
...n
|
|
1442
1445
|
});
|
|
1443
1446
|
}
|
|
1444
|
-
const
|
|
1447
|
+
const Wt = a.object({
|
|
1445
1448
|
dataEntityName: a.string().required(),
|
|
1446
1449
|
id: a.string().required(),
|
|
1447
1450
|
fieldsToBeUpdated: a.object().shape({})
|
|
@@ -1455,11 +1458,11 @@ async function Xt({
|
|
|
1455
1458
|
console.error("[ERROR FETCHING] Body is required");
|
|
1456
1459
|
return;
|
|
1457
1460
|
}
|
|
1458
|
-
await
|
|
1459
|
-
const { dataEntityName: r, id:
|
|
1461
|
+
await Wt.validate(t);
|
|
1462
|
+
const { dataEntityName: r, id: o, fieldsToBeUpdated: s } = t, i = `${e}/api/dataentities/${r}/documents/${o}`;
|
|
1460
1463
|
return y(i, {
|
|
1461
1464
|
body: {
|
|
1462
|
-
fieldsToBeUpdated:
|
|
1465
|
+
fieldsToBeUpdated: s
|
|
1463
1466
|
},
|
|
1464
1467
|
method: "PATCH",
|
|
1465
1468
|
...n
|
|
@@ -1467,54 +1470,54 @@ async function Xt({
|
|
|
1467
1470
|
}
|
|
1468
1471
|
const Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1469
1472
|
__proto__: null,
|
|
1470
|
-
getSearchMasterdata:
|
|
1473
|
+
getSearchMasterdata: Yt,
|
|
1471
1474
|
patchUpdateMasterdata: Xt,
|
|
1472
1475
|
postMasterdata: Qt
|
|
1473
1476
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1474
1477
|
async function er({ body: e, apiUrl: t, extraData: n, fetchOptions: r }) {
|
|
1475
|
-
const { productIds:
|
|
1476
|
-
if (!s)
|
|
1477
|
-
return console.error("[ERROR FETCHING] productIds is required"), [];
|
|
1478
|
-
const { NAME_SPLIT_SYMBOL: o } = n;
|
|
1478
|
+
const { productIds: o } = e;
|
|
1479
1479
|
if (!o)
|
|
1480
|
+
return console.error("[ERROR FETCHING] productIds is required"), [];
|
|
1481
|
+
const { NAME_SPLIT_SYMBOL: s } = n;
|
|
1482
|
+
if (!s)
|
|
1480
1483
|
return console.error("[ERROR FETCHING] NAME_SPLIT_SYMBOL is required"), [];
|
|
1481
|
-
const i =
|
|
1484
|
+
const i = o.map((c) => typeof c == "string" || typeof c == "number" ? `productId:${c}` : "").join("&fq="), l = await y(
|
|
1482
1485
|
`${t}/api/catalog_system/pub/products/search?fq=${i}`,
|
|
1483
1486
|
{
|
|
1484
1487
|
...r
|
|
1485
1488
|
}
|
|
1486
|
-
), u = (
|
|
1487
|
-
return
|
|
1489
|
+
), u = (c) => Object.keys(c).map((d) => ({ id: d, name: c[d] }));
|
|
1490
|
+
return l.map((c, d) => {
|
|
1488
1491
|
var E;
|
|
1489
|
-
const { installments: h, price: f, listPrice: m, sizes:
|
|
1492
|
+
const { installments: h, price: f, listPrice: m, sizes: R, allSizesAvailable: T } = le({ items: c.items, NAME_SPLIT_SYMBOL: s }), v = T ? !0 : R.some((g) => g.available), S = c.items[0].sellers[0].commertialOffer;
|
|
1490
1493
|
return {
|
|
1491
1494
|
node: {
|
|
1492
|
-
sku:
|
|
1493
|
-
gtin:
|
|
1494
|
-
name:
|
|
1495
|
-
description:
|
|
1496
|
-
releaseDate:
|
|
1497
|
-
slug:
|
|
1498
|
-
categories:
|
|
1499
|
-
categoriesIds:
|
|
1500
|
-
id:
|
|
1495
|
+
sku: c.items[0].itemId,
|
|
1496
|
+
gtin: c.productReference,
|
|
1497
|
+
name: c.productName,
|
|
1498
|
+
description: c.description,
|
|
1499
|
+
releaseDate: c.releaseDate,
|
|
1500
|
+
slug: c.linkText,
|
|
1501
|
+
categories: c.categories,
|
|
1502
|
+
categoriesIds: c.categoriesIds,
|
|
1503
|
+
id: c.items[0].itemId,
|
|
1501
1504
|
brand: {
|
|
1502
|
-
name:
|
|
1503
|
-
brandName:
|
|
1505
|
+
name: c.brand,
|
|
1506
|
+
brandName: c.brand
|
|
1504
1507
|
},
|
|
1505
1508
|
seo: {
|
|
1506
|
-
description:
|
|
1507
|
-
title:
|
|
1508
|
-
canonical: `/${
|
|
1509
|
+
description: c.description,
|
|
1510
|
+
title: c.productName,
|
|
1511
|
+
canonical: `/${c.linkText}/p`
|
|
1509
1512
|
},
|
|
1510
1513
|
cluster: {
|
|
1511
|
-
generals: u(
|
|
1512
|
-
highlights: u(
|
|
1514
|
+
generals: u(c.productClusters),
|
|
1515
|
+
highlights: u(c.clusterHighlights)
|
|
1513
1516
|
},
|
|
1514
1517
|
availability: {
|
|
1515
1518
|
status: v
|
|
1516
1519
|
},
|
|
1517
|
-
image:
|
|
1520
|
+
image: c.items[0].images.map(
|
|
1518
1521
|
({
|
|
1519
1522
|
imageLabel: g,
|
|
1520
1523
|
imageUrl: b
|
|
@@ -1538,37 +1541,37 @@ async function er({ body: e, apiUrl: t, extraData: n, fetchOptions: r }) {
|
|
|
1538
1541
|
lowPrice: f,
|
|
1539
1542
|
quantity: S.AvailableQuantity,
|
|
1540
1543
|
seller: {
|
|
1541
|
-
identifier:
|
|
1544
|
+
identifier: c.items[0].sellers[0].sellerId
|
|
1542
1545
|
}
|
|
1543
1546
|
}
|
|
1544
1547
|
]
|
|
1545
1548
|
},
|
|
1546
|
-
additionalProperty: (E =
|
|
1547
|
-
name:
|
|
1549
|
+
additionalProperty: (E = c == null ? void 0 : c.skuSpecifications) == null ? void 0 : E.map((g) => ({
|
|
1550
|
+
name: c == null ? void 0 : c.skuSpecifications[0].field.name,
|
|
1548
1551
|
value: g,
|
|
1549
1552
|
valueReference: "SPECIFICATION"
|
|
1550
1553
|
})),
|
|
1551
1554
|
isVariantOf: {
|
|
1552
|
-
productGroupID:
|
|
1553
|
-
hasVariant:
|
|
1555
|
+
productGroupID: c.productId,
|
|
1556
|
+
hasVariant: c.items.map((g) => ({
|
|
1554
1557
|
additionalProperty: g == null ? void 0 : g.variations.map(() => {
|
|
1555
|
-
var b,
|
|
1558
|
+
var b, C, $;
|
|
1556
1559
|
return {
|
|
1557
1560
|
name: (b = g == null ? void 0 : g.variations) == null ? void 0 : b[0],
|
|
1558
|
-
value: (
|
|
1561
|
+
value: ($ = g == null ? void 0 : g[(C = g == null ? void 0 : g.variations) == null ? void 0 : C[0]]) == null ? void 0 : $[0],
|
|
1559
1562
|
valueReference: "SPECIFICATION"
|
|
1560
1563
|
};
|
|
1561
1564
|
}),
|
|
1562
1565
|
name: g.name,
|
|
1563
1566
|
offers: {
|
|
1564
1567
|
offers: g.sellers.map(
|
|
1565
|
-
({ commertialOffer: b, sellerId:
|
|
1568
|
+
({ commertialOffer: b, sellerId: C }) => ({
|
|
1566
1569
|
availability: "https://schema.org/InStock",
|
|
1567
1570
|
listPrice: b.ListPrice,
|
|
1568
1571
|
price: b.Price,
|
|
1569
1572
|
quantity: b.AvailableQuantity,
|
|
1570
1573
|
seller: {
|
|
1571
|
-
identifier:
|
|
1574
|
+
identifier: C
|
|
1572
1575
|
}
|
|
1573
1576
|
})
|
|
1574
1577
|
)
|
|
@@ -1590,7 +1593,7 @@ const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1590
1593
|
const r = Array.isArray(n) ? n.join(", ") : n;
|
|
1591
1594
|
return {
|
|
1592
1595
|
id: 0,
|
|
1593
|
-
Title: `${Array.isArray(n) ? n.map((
|
|
1596
|
+
Title: `${Array.isArray(n) ? n.map((s) => U(s)).join(",") : U(n)} - ${t.title}`,
|
|
1594
1597
|
MetaTagDescription: t.description,
|
|
1595
1598
|
name: r,
|
|
1596
1599
|
hasChildren: !1,
|
|
@@ -1609,12 +1612,12 @@ const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1609
1612
|
images: Array.isArray(n) ? [...n] : []
|
|
1610
1613
|
}
|
|
1611
1614
|
}), sr = ({ items: e, parent: t, apiUrl: n, find: r }) => {
|
|
1612
|
-
const
|
|
1615
|
+
const o = e.find(
|
|
1613
1616
|
(i) => i.url.replace(n, "") === decodeURIComponent(t.toLowerCase())
|
|
1614
1617
|
);
|
|
1615
|
-
return (
|
|
1618
|
+
return (o == null ? void 0 : o.children.find(
|
|
1616
1619
|
(i) => i.name.toLowerCase() === decodeURIComponent(String(r))
|
|
1617
|
-
)) ??
|
|
1620
|
+
)) ?? o;
|
|
1618
1621
|
}, or = (e) => {
|
|
1619
1622
|
e instanceof Error ? (console.error(`[ERROR CATEGORY INFO]: ${e.message}`), console.error(e.stack)) : console.error("[ERROR CATEGORY INFO]: Unknown error", e);
|
|
1620
1623
|
}, ir = /* @__PURE__ */ new Set([
|
|
@@ -1631,17 +1634,17 @@ const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1631
1634
|
items: e.items
|
|
1632
1635
|
}), ur = (e, t) => e.reduce((n, r) => {
|
|
1633
1636
|
if (r.items.filter(
|
|
1634
|
-
(i) => i.sellers.find((
|
|
1637
|
+
(i) => i.sellers.find((l) => l.commertialOffer.IsAvailable)
|
|
1635
1638
|
).length === 0 || (n == null ? void 0 : n.find((i) => (i == null ? void 0 : i.productId) === (r == null ? void 0 : r.productId))) !== void 0)
|
|
1636
1639
|
return n;
|
|
1637
|
-
const
|
|
1640
|
+
const s = r.items[0].images.find(
|
|
1638
1641
|
(i) => t.includes(i.imageLabel)
|
|
1639
1642
|
);
|
|
1640
1643
|
return n.push({
|
|
1641
1644
|
slug: `/${r.linkText}/p`,
|
|
1642
1645
|
productId: r == null ? void 0 : r.productId,
|
|
1643
|
-
textureImage: (
|
|
1644
|
-
textureAlt: (
|
|
1646
|
+
textureImage: (s == null ? void 0 : s.imageUrl) ?? "",
|
|
1647
|
+
textureAlt: (s == null ? void 0 : s.imageText) ?? ""
|
|
1645
1648
|
}), n;
|
|
1646
1649
|
}, []), dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1647
1650
|
__proto__: null,
|