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