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