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