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