@faststore/api 4.5.1 → 4.6.0-dev.1
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/dist/cjs/index.js +45 -43
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +885 -883
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/observability/telemetry.d.ts +1 -1
- package/dist/src/observability/telemetry.d.ts.map +1 -1
- package/dist/src/platforms/vtex/index.d.ts +1 -1
- package/dist/src/platforms/vtex/index.d.ts.map +1 -1
- package/dist/src/typings/globals.d.ts +2 -5
- package/dist/src/typings/globals.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/observability/telemetry.ts +54 -37
- package/src/platforms/vtex/index.ts +18 -23
- package/src/typings/globals.ts +2 -5
package/dist/es/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
1
|
+
import { mergeTypeDefs as Ze } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as Tn, mergeSchemas as _n } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as en, MapperKind as nn, getDirective as tn } from "@graphql-tools/utils";
|
|
4
|
+
import { GraphQLScalarType as En, print as Rn, parse as Fn, isSchema as Nn } from "graphql";
|
|
5
|
+
import { logger as Ln, OTELAPI as $ } from "@faststore/diagnostics";
|
|
6
|
+
import Bn from "isomorphic-unfetch";
|
|
7
7
|
import { parse as Z } from "cookie";
|
|
8
|
-
import
|
|
8
|
+
import we from "p-limit";
|
|
9
9
|
import le from "dataloader";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const
|
|
10
|
+
import $n from "sanitize-html";
|
|
11
|
+
import De from "fast-deep-equal";
|
|
12
|
+
import Mn from "node:crypto";
|
|
13
|
+
var zn = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(zn || {}), Vn = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(Vn || {}), xn = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(xn || {}), qn = /* @__PURE__ */ ((e) => (e.DiscountDesc = "discount_desc", e.NameAsc = "name_asc", e.NameDesc = "name_desc", e.OrdersDesc = "orders_desc", e.PriceAsc = "price_asc", e.PriceDesc = "price_desc", e.ReleaseDesc = "release_desc", e.ScoreDesc = "score_desc", e))(qn || {}), jn = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(jn || {}), Wn = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(Wn || {});
|
|
14
|
+
const Gn = () => function(n = {}) {
|
|
15
15
|
const t = process.env.FS_DISCOVERY_APP_KEY ?? "", r = process.env.FS_DISCOVERY_APP_TOKEN ?? "";
|
|
16
16
|
if (!t || !r)
|
|
17
17
|
throw new J("No authentication AppKey and AppToken passed.");
|
|
@@ -20,7 +20,7 @@ const jn = () => function(n = {}) {
|
|
|
20
20
|
"X-VTEX-API-AppKey": t,
|
|
21
21
|
"X-VTEX-API-AppToken": r
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, Hn = async (e) => {
|
|
24
24
|
const {
|
|
25
25
|
clients: { commerce: n }
|
|
26
26
|
} = e;
|
|
@@ -31,86 +31,91 @@ const jn = () => function(n = {}) {
|
|
|
31
31
|
const r = t.extensions?.status ?? t.status;
|
|
32
32
|
throw r === 401 ? new te("Authentication required") : r === 403 ? new J("You are not allowed to access this resource") : new te("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, Xn = "auth", Yn = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (e) =>
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
36
|
+
transformer: (e) => en(e, {
|
|
37
|
+
[nn.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (tn(e, n, Xn)?.[0]) {
|
|
39
39
|
const r = n.resolve;
|
|
40
|
-
n.resolve = async (i,
|
|
40
|
+
n.resolve = async (i, o, a, s) => (await Hn(a), r?.(i, o, a, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, Jn = "cacheControl", Fo = (e, n) => {
|
|
46
46
|
const {
|
|
47
47
|
scope: t = "private",
|
|
48
48
|
sMaxAge: r = 0,
|
|
49
49
|
staleWhileRevalidate: i = 0
|
|
50
50
|
} = e;
|
|
51
51
|
return `${n ? "private" : t}, s-maxage=${r}, stale-while-revalidate=${i}`;
|
|
52
|
-
},
|
|
52
|
+
}, Pe = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, Kn = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, Qn = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (e) =>
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (e) => en(e, {
|
|
55
|
+
[nn.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = tn(e, n, Jn)?.[0];
|
|
57
57
|
if (t) {
|
|
58
|
-
const { sMaxAge: r, staleWhileRevalidate: i, scope:
|
|
58
|
+
const { sMaxAge: r, staleWhileRevalidate: i, scope: o } = t, a = n.resolve;
|
|
59
59
|
n.resolve = (s, c, l, g) => (l.cacheControl = {
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
60
|
+
sMaxAge: Pe(l.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: Pe(
|
|
62
62
|
l.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
66
|
-
},
|
|
65
|
+
scope: Kn(l.cacheControl?.scope, o)
|
|
66
|
+
}, a?.(s, c, l, g));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
71
|
+
}, Zn = (e) => (n, t) => {
|
|
72
|
+
const r = Ze([
|
|
73
73
|
...(e ?? []).map(({ typeDefs: i }) => i),
|
|
74
74
|
t
|
|
75
75
|
]);
|
|
76
76
|
return (e ?? []).reduce(
|
|
77
|
-
(i, { transformer:
|
|
78
|
-
|
|
77
|
+
(i, { transformer: o }) => o?.(i) ?? i,
|
|
78
|
+
Tn({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
},
|
|
84
|
-
name:
|
|
85
|
-
version:
|
|
86
|
-
},
|
|
87
|
-
if (
|
|
88
|
-
return e(t, r, i,
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"@faststore_version": ge,
|
|
100
|
-
"@faststore_package_name": pe,
|
|
101
|
-
"@faststore_account_name": i.account,
|
|
102
|
-
"@faststore_environment": process.env.NODE_ENV
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
if (!c) return e(t, r, i, a);
|
|
106
|
-
try {
|
|
107
|
-
const l = e(t, r, i, a);
|
|
108
|
-
return l instanceof Promise ? l.then((g) => (c.end(), g)) : (c.end(), l);
|
|
109
|
-
} catch (l) {
|
|
110
|
-
throw c.end(), console.error(`Error when executing resolver: ${n}`, l), l;
|
|
83
|
+
}, rn = "@faststore/api", on = "4.6.0-dev.0", ke = {
|
|
84
|
+
name: rn,
|
|
85
|
+
version: on
|
|
86
|
+
}, et = Ln("@faststore/api"), nt = (e, n = "Unknown Graphql Resolver") => (t, r, i, o) => {
|
|
87
|
+
if (!i?.OTEL_ENABLED)
|
|
88
|
+
return e(t, r, i, o);
|
|
89
|
+
const a = $.trace.getTracer("Graphql").startSpan(n, {
|
|
90
|
+
kind: $.SpanKind.INTERNAL,
|
|
91
|
+
attributes: {
|
|
92
|
+
timestamp: Date.now(),
|
|
93
|
+
"@faststore_version": on,
|
|
94
|
+
"@faststore_package_name": rn,
|
|
95
|
+
"@faststore_account_name": i.account,
|
|
96
|
+
"@faststore_environment": process.env.NODE_ENV,
|
|
97
|
+
"@faststore_resolver_parent_type": o?.parentType?.name,
|
|
98
|
+
"@faststore_resolver_field_name": o?.fieldName
|
|
111
99
|
}
|
|
112
|
-
});
|
|
100
|
+
}), s = $.trace.setSpan($.context.active(), a);
|
|
101
|
+
try {
|
|
102
|
+
const c = $.context.with(
|
|
103
|
+
s,
|
|
104
|
+
() => e(t, r, i, o)
|
|
105
|
+
);
|
|
106
|
+
return c instanceof Promise ? c.then(
|
|
107
|
+
(l) => (a.end(), l),
|
|
108
|
+
(l) => Ue(l, a, n)
|
|
109
|
+
) : (a.end(), c);
|
|
110
|
+
} catch (c) {
|
|
111
|
+
return Ue(c, a, n);
|
|
112
|
+
}
|
|
113
113
|
};
|
|
114
|
+
function Ue(e, n, t) {
|
|
115
|
+
throw n.setStatus({ code: $.SpanStatusCode.ERROR }), n.recordException(e), n.end(), console.error(`Error at resolver: ${t}:
|
|
116
|
+
%o`, e), et("error", `Error at resolver: %s
|
|
117
|
+
%o`, t, e), e;
|
|
118
|
+
}
|
|
114
119
|
class ee extends Error {
|
|
115
120
|
constructor(n, t) {
|
|
116
121
|
super(t), this.extensions = n, this.name = "FastStoreError";
|
|
@@ -131,17 +136,17 @@ class J extends ee {
|
|
|
131
136
|
super({ status: 403, type: "ForbiddenError" }, n);
|
|
132
137
|
}
|
|
133
138
|
}
|
|
134
|
-
class
|
|
139
|
+
class B extends ee {
|
|
135
140
|
constructor(n) {
|
|
136
141
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
137
142
|
}
|
|
138
143
|
}
|
|
139
|
-
const
|
|
140
|
-
const r = await
|
|
144
|
+
const No = (e) => e?.name === "FastStoreError", Lo = (e) => e?.extensions?.type === "BadRequestError", Bo = (e) => e?.extensions?.type === "UnauthorizedError", tt = (e) => e?.extensions?.type === "ForbiddenError", X = (e) => e?.extensions?.type === "NotFoundError", rt = `${ke.name}@${ke.version}`, I = async (e, n, t) => {
|
|
145
|
+
const r = await Bn(e, {
|
|
141
146
|
...n,
|
|
142
147
|
headers: {
|
|
143
148
|
...n?.headers ?? {},
|
|
144
|
-
"User-Agent":
|
|
149
|
+
"User-Agent": rt
|
|
145
150
|
}
|
|
146
151
|
});
|
|
147
152
|
if (r.ok)
|
|
@@ -157,7 +162,7 @@ const _a = (e) => e?.name === "FastStoreError", Ea = (e) => e?.extensions?.type
|
|
|
157
162
|
case 403:
|
|
158
163
|
throw new J(i);
|
|
159
164
|
case 404:
|
|
160
|
-
throw new
|
|
165
|
+
throw new B(i);
|
|
161
166
|
default:
|
|
162
167
|
throw new ee(
|
|
163
168
|
{ status: r.status, type: "UnknownError" },
|
|
@@ -165,7 +170,7 @@ const _a = (e) => e?.name === "FastStoreError", Ea = (e) => e?.extensions?.type
|
|
|
165
170
|
);
|
|
166
171
|
}
|
|
167
172
|
throw new Error(i);
|
|
168
|
-
},
|
|
173
|
+
}, it = ({ account: e, environment: n }) => {
|
|
169
174
|
const t = `https://${e}.${n}.com.br`;
|
|
170
175
|
return {
|
|
171
176
|
getLocalizedProduct: (r, i) => I(`${t}/api/catalog-dataplane/product/${r}`, {
|
|
@@ -181,17 +186,17 @@ const _a = (e) => e?.name === "FastStoreError", Ea = (e) => e?.extensions?.type
|
|
|
181
186
|
return e;
|
|
182
187
|
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
183
188
|
return t.forEach((i) => {
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
const s =
|
|
189
|
+
const o = i.trim();
|
|
190
|
+
if (o) {
|
|
191
|
+
const a = o.indexOf("=");
|
|
192
|
+
if (a > 0) {
|
|
193
|
+
const s = o.substring(0, a), c = o.substring(a + 1);
|
|
189
194
|
n.has(s) || r.push(s), n.set(s, c);
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
197
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
193
|
-
},
|
|
194
|
-
const t = n.match(
|
|
198
|
+
}, ot = /^([^=]+)=([^;]*)/, at = (e, n) => {
|
|
199
|
+
const t = n.match(ot);
|
|
195
200
|
if (t) {
|
|
196
201
|
const r = t[1], i = t[2];
|
|
197
202
|
e.storage.cookies.set(r, {
|
|
@@ -199,24 +204,24 @@ const _a = (e) => e?.name === "FastStoreError", Ea = (e) => e?.extensions?.type
|
|
|
199
204
|
setCookie: n
|
|
200
205
|
});
|
|
201
206
|
}
|
|
202
|
-
},
|
|
207
|
+
}, st = (e, n) => {
|
|
203
208
|
n.getSetCookie().forEach(
|
|
204
|
-
(t) =>
|
|
209
|
+
(t) => at(e, t)
|
|
205
210
|
);
|
|
206
|
-
},
|
|
211
|
+
}, ct = (e) => (n) => st(e, n), pe = (e) => {
|
|
207
212
|
if (!e.headers?.cookie)
|
|
208
213
|
return null;
|
|
209
214
|
const n = an(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
210
215
|
return t.length === 0 ? n : t.reduce(
|
|
211
|
-
(r, [i, { value:
|
|
216
|
+
(r, [i, { value: o }]) => lt(
|
|
212
217
|
r,
|
|
213
218
|
i,
|
|
214
|
-
|
|
219
|
+
o
|
|
215
220
|
),
|
|
216
221
|
n
|
|
217
222
|
);
|
|
218
|
-
},
|
|
219
|
-
const r =
|
|
223
|
+
}, sn = (e) => function(t) {
|
|
224
|
+
const r = pe(e);
|
|
220
225
|
return r ? {
|
|
221
226
|
...t,
|
|
222
227
|
cookie: r
|
|
@@ -224,7 +229,7 @@ const _a = (e) => e?.name === "FastStoreError", Ea = (e) => e?.extensions?.type
|
|
|
224
229
|
}, z = (e, n) => {
|
|
225
230
|
const t = an(e);
|
|
226
231
|
return Z(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
227
|
-
},
|
|
232
|
+
}, lt = (e, n, t) => {
|
|
228
233
|
const r = new RegExp(`(${n})=([^;]*)`), i = e.match(r);
|
|
229
234
|
return i ? e.replace(
|
|
230
235
|
i[0],
|
|
@@ -234,12 +239,12 @@ const _a = (e) => e?.name === "FastStoreError", Ea = (e) => e?.extensions?.type
|
|
|
234
239
|
function Y(e) {
|
|
235
240
|
return e ? JSON.parse(Buffer.from(e.split(".")[1], "base64").toString()) : null;
|
|
236
241
|
}
|
|
237
|
-
const
|
|
242
|
+
const dt = "storefront/faststore.recommendation-shelf@v4", j = {
|
|
238
243
|
method: "POST",
|
|
239
244
|
headers: {
|
|
240
245
|
"content-type": "application/json"
|
|
241
246
|
}
|
|
242
|
-
},
|
|
247
|
+
}, ut = (e) => e.split("/").map(encodeURIComponent).join("/"), ue = (e) => e ? { headers: { "Accept-Language": e } } : void 0, pt = /^\d{4}-\d{2}-\d{2}$/, gt = /* @__PURE__ */ new Set([
|
|
243
248
|
"Draft",
|
|
244
249
|
"Requested",
|
|
245
250
|
"InReview",
|
|
@@ -250,14 +255,14 @@ const st = "storefront/faststore.recommendation-shelf@v4", j = {
|
|
|
250
255
|
"ConvertedToCart",
|
|
251
256
|
"ConvertedToOrder"
|
|
252
257
|
]);
|
|
253
|
-
function
|
|
258
|
+
function mt({
|
|
254
259
|
page: e,
|
|
255
260
|
perPage: n,
|
|
256
261
|
status: t,
|
|
257
262
|
createdAtFrom: r,
|
|
258
263
|
createdAtTo: i,
|
|
259
|
-
expiresAtFrom:
|
|
260
|
-
expiresAtTo:
|
|
264
|
+
expiresAtFrom: o,
|
|
265
|
+
expiresAtTo: a
|
|
261
266
|
}) {
|
|
262
267
|
if (e !== void 0 && (!Number.isInteger(e) || e < 1))
|
|
263
268
|
throw new Error(
|
|
@@ -270,41 +275,41 @@ function ut({
|
|
|
270
275
|
for (const [s, c] of [
|
|
271
276
|
["createdAtFrom", r],
|
|
272
277
|
["createdAtTo", i],
|
|
273
|
-
["expiresAtFrom",
|
|
274
|
-
["expiresAtTo",
|
|
278
|
+
["expiresAtFrom", o],
|
|
279
|
+
["expiresAtTo", a]
|
|
275
280
|
])
|
|
276
|
-
if (c && !
|
|
281
|
+
if (c && !pt.test(c))
|
|
277
282
|
throw new Error(
|
|
278
283
|
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
279
284
|
);
|
|
280
285
|
if (t && t.length > 0) {
|
|
281
|
-
const s = t.filter((c) => !
|
|
286
|
+
const s = t.filter((c) => !gt.has(c));
|
|
282
287
|
if (s.length > 0)
|
|
283
288
|
throw new Error(
|
|
284
289
|
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
285
290
|
);
|
|
286
291
|
}
|
|
287
292
|
}
|
|
288
|
-
function
|
|
293
|
+
function ht({
|
|
289
294
|
page: e,
|
|
290
295
|
perPage: n,
|
|
291
296
|
status: t,
|
|
292
297
|
createdAtFrom: r,
|
|
293
298
|
createdAtTo: i,
|
|
294
|
-
expiresAtFrom:
|
|
295
|
-
expiresAtTo:
|
|
299
|
+
expiresAtFrom: o,
|
|
300
|
+
expiresAtTo: a,
|
|
296
301
|
label: s
|
|
297
302
|
}) {
|
|
298
303
|
const c = new URLSearchParams();
|
|
299
|
-
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((l) => c.append("status", l)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i),
|
|
304
|
+
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((l) => c.append("status", l)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i), o && c.append("expiresAtFrom", o), a && c.append("expiresAtTo", a), s?.trim() && c.append("label", s.trim()), c;
|
|
300
305
|
}
|
|
301
|
-
const
|
|
302
|
-
const
|
|
306
|
+
const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
307
|
+
const o = `https://${e}.${n}.com.br`, a = ct(i), s = sn(i), c = Gn(), l = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", g = r && r.map((d) => d + ".").find((d) => l.includes(d)) || "", u = l.replace(g, ""), h = `${o}/api/recommend-bff/v2`, f = s({
|
|
303
308
|
accept: "application/json",
|
|
304
309
|
"content-type": "application/json",
|
|
305
|
-
"x-vtex-rec-origin": `${e}/${
|
|
310
|
+
"x-vtex-rec-origin": `${e}/${dt}`
|
|
306
311
|
}), v = (d = {}) => {
|
|
307
|
-
const p = z(
|
|
312
|
+
const p = z(pe(i) ?? "", e);
|
|
308
313
|
return s({
|
|
309
314
|
...d,
|
|
310
315
|
"X-FORWARDED-HOST": u,
|
|
@@ -314,27 +319,27 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
314
319
|
return {
|
|
315
320
|
catalog: {
|
|
316
321
|
salesChannel: (d) => I(
|
|
317
|
-
`${
|
|
322
|
+
`${o}/api/catalog_system/pub/saleschannel/${d}`,
|
|
318
323
|
void 0,
|
|
319
|
-
{ storeCookies:
|
|
324
|
+
{ storeCookies: a }
|
|
320
325
|
),
|
|
321
326
|
brand: {
|
|
322
|
-
list: () => I(`${
|
|
323
|
-
storeCookies:
|
|
327
|
+
list: () => I(`${o}/api/catalog_system/pub/brand/list`, void 0, {
|
|
328
|
+
storeCookies: a
|
|
324
329
|
})
|
|
325
330
|
},
|
|
326
331
|
category: {
|
|
327
332
|
tree: (d = 3) => I(
|
|
328
|
-
`${
|
|
333
|
+
`${o}/api/catalog_system/pub/category/tree/${d}`,
|
|
329
334
|
void 0,
|
|
330
|
-
{ storeCookies:
|
|
335
|
+
{ storeCookies: a }
|
|
331
336
|
)
|
|
332
337
|
},
|
|
333
338
|
portal: {
|
|
334
339
|
pagetype: (d) => I(
|
|
335
|
-
`${
|
|
340
|
+
`${o}/api/catalog_system/pub/portal/pagetype/${d}`,
|
|
336
341
|
void 0,
|
|
337
|
-
{ storeCookies:
|
|
342
|
+
{ storeCookies: a }
|
|
338
343
|
)
|
|
339
344
|
},
|
|
340
345
|
byLinkId: {
|
|
@@ -344,7 +349,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
344
349
|
category: async (d, p) => {
|
|
345
350
|
try {
|
|
346
351
|
return await I(
|
|
347
|
-
`${
|
|
352
|
+
`${o}/api/catalog_system/pub/category/by-linkid/${ut(d)}`,
|
|
348
353
|
ue(p)
|
|
349
354
|
);
|
|
350
355
|
} catch (m) {
|
|
@@ -355,7 +360,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
355
360
|
brand: async (d, p) => {
|
|
356
361
|
try {
|
|
357
362
|
return await I(
|
|
358
|
-
`${
|
|
363
|
+
`${o}/api/catalog_system/pub/brand/by-linkid/${encodeURIComponent(d)}`,
|
|
359
364
|
ue(p)
|
|
360
365
|
);
|
|
361
366
|
} catch (m) {
|
|
@@ -366,7 +371,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
366
371
|
collection: async (d, p) => {
|
|
367
372
|
try {
|
|
368
373
|
return await I(
|
|
369
|
-
`${
|
|
374
|
+
`${o}/api/catalog_system/pub/collection/by-linkid/${encodeURIComponent(d)}`,
|
|
370
375
|
ue(p)
|
|
371
376
|
);
|
|
372
377
|
} catch (m) {
|
|
@@ -386,9 +391,9 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
386
391
|
groupByProduct: m.toString()
|
|
387
392
|
});
|
|
388
393
|
return I(
|
|
389
|
-
`${
|
|
394
|
+
`${o}/api/catalog_system/pub/products/crossselling/${d}/${p}?${y}`,
|
|
390
395
|
void 0,
|
|
391
|
-
{ storeCookies:
|
|
396
|
+
{ storeCookies: a }
|
|
392
397
|
);
|
|
393
398
|
}
|
|
394
399
|
}
|
|
@@ -402,13 +407,13 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
402
407
|
"X-FORWARDED-HOST": u
|
|
403
408
|
});
|
|
404
409
|
return I(
|
|
405
|
-
`${
|
|
410
|
+
`${o}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
406
411
|
{
|
|
407
412
|
...j,
|
|
408
413
|
headers: y,
|
|
409
414
|
body: JSON.stringify(d)
|
|
410
415
|
},
|
|
411
|
-
{ storeCookies:
|
|
416
|
+
{ storeCookies: a }
|
|
412
417
|
);
|
|
413
418
|
},
|
|
414
419
|
shippingData: ({
|
|
@@ -429,18 +434,18 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
429
434
|
})),
|
|
430
435
|
selectedAddresses: y,
|
|
431
436
|
clearAddressIfPostalCodeNotFound: t
|
|
432
|
-
},
|
|
437
|
+
}, P = s({
|
|
433
438
|
"content-type": "application/json",
|
|
434
439
|
"X-FORWARDED-HOST": u
|
|
435
440
|
});
|
|
436
441
|
return I(
|
|
437
|
-
`${
|
|
442
|
+
`${o}/api/checkout/pub/orderForm/${d}/attachments/shippingData`,
|
|
438
443
|
{
|
|
439
444
|
...j,
|
|
440
|
-
headers:
|
|
445
|
+
headers: P,
|
|
441
446
|
body: JSON.stringify(C)
|
|
442
447
|
},
|
|
443
|
-
{ storeCookies:
|
|
448
|
+
{ storeCookies: a }
|
|
444
449
|
);
|
|
445
450
|
},
|
|
446
451
|
marketingData: ({
|
|
@@ -452,13 +457,13 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
452
457
|
"X-FORWARDED-HOST": u
|
|
453
458
|
});
|
|
454
459
|
return I(
|
|
455
|
-
`${
|
|
460
|
+
`${o}/api/checkout/pub/orderForm/${d}/attachments/marketingData`,
|
|
456
461
|
{
|
|
457
462
|
headers: m,
|
|
458
463
|
body: JSON.stringify(p),
|
|
459
464
|
method: "POST"
|
|
460
465
|
},
|
|
461
|
-
{ storeCookies:
|
|
466
|
+
{ storeCookies: a }
|
|
462
467
|
);
|
|
463
468
|
},
|
|
464
469
|
clientPreferencesData: ({
|
|
@@ -470,13 +475,13 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
470
475
|
"X-FORWARDED-HOST": u
|
|
471
476
|
});
|
|
472
477
|
return I(
|
|
473
|
-
`${
|
|
478
|
+
`${o}/api/checkout/pub/orderForm/${d}/attachments/clientPreferencesData`,
|
|
474
479
|
{
|
|
475
480
|
headers: m,
|
|
476
481
|
body: JSON.stringify(p),
|
|
477
482
|
method: "POST"
|
|
478
483
|
},
|
|
479
|
-
{ storeCookies:
|
|
484
|
+
{ storeCookies: a }
|
|
480
485
|
);
|
|
481
486
|
},
|
|
482
487
|
orderForm: ({
|
|
@@ -489,7 +494,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
489
494
|
"X-FORWARDED-HOST": u
|
|
490
495
|
}), w = new URLSearchParams({ sc: y });
|
|
491
496
|
d && w.set("refreshOutdatedData", p.toString());
|
|
492
|
-
const C = `${
|
|
497
|
+
const C = `${o}/api/checkout/pub/orderForm${d ? `/${d}` : ""}?${w.toString()}`;
|
|
493
498
|
return I(
|
|
494
499
|
C,
|
|
495
500
|
{
|
|
@@ -497,7 +502,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
497
502
|
headers: O,
|
|
498
503
|
...d ? {} : { body: "{}" }
|
|
499
504
|
},
|
|
500
|
-
{ storeCookies:
|
|
505
|
+
{ storeCookies: a }
|
|
501
506
|
);
|
|
502
507
|
},
|
|
503
508
|
clearOrderFormMessages: ({ id: d }) => {
|
|
@@ -506,7 +511,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
506
511
|
"X-FORWARDED-HOST": u
|
|
507
512
|
});
|
|
508
513
|
return I(
|
|
509
|
-
`${
|
|
514
|
+
`${o}/api/checkout/pub/orderForm/${d}/messages/clear`,
|
|
510
515
|
{
|
|
511
516
|
...j,
|
|
512
517
|
headers: p,
|
|
@@ -529,7 +534,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
529
534
|
"X-FORWARDED-HOST": u
|
|
530
535
|
});
|
|
531
536
|
return I(
|
|
532
|
-
`${
|
|
537
|
+
`${o}/api/checkout/pub/orderForm/${d}/items?${w}`,
|
|
533
538
|
{
|
|
534
539
|
headers: C,
|
|
535
540
|
body: JSON.stringify({
|
|
@@ -538,7 +543,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
538
543
|
}),
|
|
539
544
|
method: "PATCH"
|
|
540
545
|
},
|
|
541
|
-
{ storeCookies:
|
|
546
|
+
{ storeCookies: a }
|
|
542
547
|
);
|
|
543
548
|
},
|
|
544
549
|
setCustomData: ({
|
|
@@ -552,7 +557,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
552
557
|
"X-FORWARDED-HOST": u
|
|
553
558
|
});
|
|
554
559
|
return I(
|
|
555
|
-
`${
|
|
560
|
+
`${o}/api/checkout/pub/orderForm/${d}/customData/${p}/${m}`,
|
|
556
561
|
{
|
|
557
562
|
headers: O,
|
|
558
563
|
body: JSON.stringify({ value: y }),
|
|
@@ -574,7 +579,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
574
579
|
"geoCoordinates",
|
|
575
580
|
`${p?.longitude};${p?.latitude}`
|
|
576
581
|
);
|
|
577
|
-
const w = `${
|
|
582
|
+
const w = `${o}/api/checkout/pub/regions/?${O.toString()}`, C = s({
|
|
578
583
|
"content-type": "application/json",
|
|
579
584
|
"X-FORWARDED-HOST": u
|
|
580
585
|
});
|
|
@@ -583,7 +588,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
583
588
|
{
|
|
584
589
|
headers: C
|
|
585
590
|
},
|
|
586
|
-
{ storeCookies:
|
|
591
|
+
{ storeCookies: a }
|
|
587
592
|
);
|
|
588
593
|
},
|
|
589
594
|
address: async ({
|
|
@@ -595,11 +600,11 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
595
600
|
"X-FORWARDED-HOST": u
|
|
596
601
|
});
|
|
597
602
|
return I(
|
|
598
|
-
`${
|
|
603
|
+
`${o}/api/checkout/pub/postal-code/${p}/${d}`,
|
|
599
604
|
{
|
|
600
605
|
headers: m
|
|
601
606
|
},
|
|
602
|
-
{ storeCookies:
|
|
607
|
+
{ storeCookies: a }
|
|
603
608
|
);
|
|
604
609
|
},
|
|
605
610
|
cancelOrder: ({
|
|
@@ -612,7 +617,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
612
617
|
"X-FORWARDED-HOST": u
|
|
613
618
|
});
|
|
614
619
|
return I(
|
|
615
|
-
`${
|
|
620
|
+
`${o}/api/checkout/pub/orders/${d}/user-cancel-request`,
|
|
616
621
|
{
|
|
617
622
|
method: "POST",
|
|
618
623
|
headers: y,
|
|
@@ -636,13 +641,13 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
636
641
|
"X-FORWARDED-HOST": u
|
|
637
642
|
});
|
|
638
643
|
return I(
|
|
639
|
-
`${
|
|
644
|
+
`${o}/api/logistics-shipping/pickuppoints/_search`,
|
|
640
645
|
{
|
|
641
646
|
method: "POST",
|
|
642
647
|
headers: p,
|
|
643
648
|
body: JSON.stringify({ coordinate: d })
|
|
644
649
|
},
|
|
645
|
-
{ storeCookies:
|
|
650
|
+
{ storeCookies: a }
|
|
646
651
|
);
|
|
647
652
|
}
|
|
648
653
|
},
|
|
@@ -656,23 +661,23 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
656
661
|
"content-type": "application/json"
|
|
657
662
|
}), y = Z(i?.headers?.cookie ?? "")?.vtex_session;
|
|
658
663
|
return I(
|
|
659
|
-
`${
|
|
664
|
+
`${o}/api/sessions?${p.toString()}`,
|
|
660
665
|
{
|
|
661
666
|
method: y ? "PATCH" : "POST",
|
|
662
667
|
headers: m,
|
|
663
668
|
body: "{}"
|
|
664
669
|
},
|
|
665
|
-
{ storeCookies:
|
|
670
|
+
{ storeCookies: a }
|
|
666
671
|
);
|
|
667
672
|
},
|
|
668
673
|
subscribeToNewsletter: (d) => I(
|
|
669
|
-
`${
|
|
674
|
+
`${o}/api/dataentities/NL/documents/`,
|
|
670
675
|
{
|
|
671
676
|
...j,
|
|
672
677
|
body: JSON.stringify({ ...d, isNewsletterOptIn: !0 }),
|
|
673
678
|
method: "PATCH"
|
|
674
679
|
},
|
|
675
|
-
{ storeCookies:
|
|
680
|
+
{ storeCookies: a }
|
|
676
681
|
),
|
|
677
682
|
profile: {
|
|
678
683
|
addresses: async (d) => {
|
|
@@ -681,9 +686,9 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
681
686
|
"X-FORWARDED-HOST": u
|
|
682
687
|
});
|
|
683
688
|
return I(
|
|
684
|
-
`${
|
|
689
|
+
`${o}/api/profile-system/pvt/profiles/${d}/addresses`,
|
|
685
690
|
{ headers: p },
|
|
686
|
-
{ storeCookies:
|
|
691
|
+
{ storeCookies: a }
|
|
687
692
|
);
|
|
688
693
|
}
|
|
689
694
|
},
|
|
@@ -694,12 +699,12 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
694
699
|
"X-FORWARDED-HOST": u
|
|
695
700
|
});
|
|
696
701
|
return I(
|
|
697
|
-
`${
|
|
702
|
+
`${o}/api/oms/user/orders/${d}`,
|
|
698
703
|
{
|
|
699
704
|
method: "GET",
|
|
700
705
|
headers: p
|
|
701
706
|
},
|
|
702
|
-
{ storeCookies:
|
|
707
|
+
{ storeCookies: a }
|
|
703
708
|
);
|
|
704
709
|
},
|
|
705
710
|
listUserOrders: ({
|
|
@@ -710,42 +715,42 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
710
715
|
text: O,
|
|
711
716
|
clientEmail: w,
|
|
712
717
|
perPage: C,
|
|
713
|
-
pendingMyApproval:
|
|
718
|
+
pendingMyApproval: P
|
|
714
719
|
}) => {
|
|
715
720
|
const S = new URLSearchParams();
|
|
716
721
|
if (m) {
|
|
717
|
-
const
|
|
722
|
+
const A = new Date(m).setHours(
|
|
718
723
|
0,
|
|
719
724
|
0,
|
|
720
725
|
0,
|
|
721
726
|
0
|
|
722
727
|
);
|
|
723
|
-
m = new Date(
|
|
728
|
+
m = new Date(A).toISOString();
|
|
724
729
|
}
|
|
725
730
|
if (y) {
|
|
726
|
-
const
|
|
731
|
+
const A = new Date(y).setHours(
|
|
727
732
|
23,
|
|
728
733
|
59,
|
|
729
734
|
59,
|
|
730
735
|
999
|
|
731
736
|
);
|
|
732
|
-
y = new Date(
|
|
737
|
+
y = new Date(A).toISOString();
|
|
733
738
|
}
|
|
734
739
|
O && S.append("text", O), p && p.length > 0 && S.append("status", p.filter(Boolean).join(",")), m && y ? S.append(
|
|
735
740
|
"creation_date",
|
|
736
741
|
`creationDate:[${m} TO ${y}]`
|
|
737
|
-
) : m ? S.append("creation_date", `creationDate:[${m} TO *]`) : y && S.append("creation_date", `creationDate:[* TO ${y}]`), w && S.append("clientEmail", w), d && S.append("page", d.toString()), C && S.append("per_page", C.toString()),
|
|
742
|
+
) : m ? S.append("creation_date", `creationDate:[${m} TO *]`) : y && S.append("creation_date", `creationDate:[* TO ${y}]`), w && S.append("clientEmail", w), d && S.append("page", d.toString()), C && S.append("per_page", C.toString()), P && S.append("my_pending_approvals", String(!0));
|
|
738
743
|
const D = s({
|
|
739
744
|
"content-type": "application/json",
|
|
740
745
|
"X-FORWARDED-HOST": u
|
|
741
746
|
});
|
|
742
747
|
return I(
|
|
743
|
-
`${
|
|
748
|
+
`${o}/api/oms/user/orders?${S.toString()}`,
|
|
744
749
|
{
|
|
745
750
|
method: "GET",
|
|
746
751
|
headers: D
|
|
747
752
|
},
|
|
748
|
-
{ storeCookies:
|
|
753
|
+
{ storeCookies: a }
|
|
749
754
|
);
|
|
750
755
|
},
|
|
751
756
|
getCommercialAuthorizationsByOrderId: ({
|
|
@@ -756,12 +761,12 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
756
761
|
"X-FORWARDED-HOST": u
|
|
757
762
|
});
|
|
758
763
|
return I(
|
|
759
|
-
`${
|
|
764
|
+
`${o}/${e}/commercial-authorizations/order/${d}`,
|
|
760
765
|
{
|
|
761
766
|
method: "GET",
|
|
762
767
|
headers: p
|
|
763
768
|
},
|
|
764
|
-
{ storeCookies:
|
|
769
|
+
{ storeCookies: a }
|
|
765
770
|
);
|
|
766
771
|
},
|
|
767
772
|
processOrderAuthorization: async ({
|
|
@@ -773,7 +778,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
773
778
|
const O = s({
|
|
774
779
|
"content-type": "application/json",
|
|
775
780
|
"X-FORWARDED-HOST": u
|
|
776
|
-
}),
|
|
781
|
+
}), P = {
|
|
777
782
|
params: {
|
|
778
783
|
ruleId: m,
|
|
779
784
|
dimensionId: p,
|
|
@@ -781,13 +786,13 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
781
786
|
}
|
|
782
787
|
};
|
|
783
788
|
return I(
|
|
784
|
-
`${
|
|
789
|
+
`${o}/${e}/commercial-authorizations/${d}/callback`,
|
|
785
790
|
{
|
|
786
791
|
method: "POST",
|
|
787
792
|
headers: O,
|
|
788
|
-
body: JSON.stringify(
|
|
793
|
+
body: JSON.stringify(P)
|
|
789
794
|
},
|
|
790
|
-
{ storeCookies:
|
|
795
|
+
{ storeCookies: a }
|
|
791
796
|
);
|
|
792
797
|
}
|
|
793
798
|
},
|
|
@@ -800,7 +805,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
800
805
|
"X-FORWARDED-HOST": u
|
|
801
806
|
});
|
|
802
807
|
return I(
|
|
803
|
-
`${
|
|
808
|
+
`${o}/api/units/v1/${d}/unit`,
|
|
804
809
|
{
|
|
805
810
|
method: "GET",
|
|
806
811
|
headers: p
|
|
@@ -816,7 +821,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
816
821
|
"X-FORWARDED-HOST": u
|
|
817
822
|
});
|
|
818
823
|
return I(
|
|
819
|
-
`${
|
|
824
|
+
`${o}/api/units/v1/${d}`,
|
|
820
825
|
{
|
|
821
826
|
method: "GET",
|
|
822
827
|
headers: p
|
|
@@ -832,7 +837,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
832
837
|
"X-FORWARDED-HOST": u
|
|
833
838
|
});
|
|
834
839
|
return I(
|
|
835
|
-
`${
|
|
840
|
+
`${o}/api/units/v1/${d}/scopes`,
|
|
836
841
|
{
|
|
837
842
|
method: "GET",
|
|
838
843
|
headers: p
|
|
@@ -850,7 +855,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
850
855
|
"X-FORWARDED-HOST": u
|
|
851
856
|
});
|
|
852
857
|
return I(
|
|
853
|
-
`${
|
|
858
|
+
`${o}/api/license-manager/users/${d}`,
|
|
854
859
|
{
|
|
855
860
|
method: "GET",
|
|
856
861
|
headers: p
|
|
@@ -866,7 +871,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
866
871
|
"X-FORWARDED-HOST": u
|
|
867
872
|
});
|
|
868
873
|
return I(
|
|
869
|
-
`${
|
|
874
|
+
`${o}/api/license-manager/pvt/users/${d}`,
|
|
870
875
|
{
|
|
871
876
|
method: "GET",
|
|
872
877
|
headers: p
|
|
@@ -882,7 +887,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
882
887
|
"X-FORWARDED-HOST": u
|
|
883
888
|
});
|
|
884
889
|
return I(
|
|
885
|
-
`${
|
|
890
|
+
`${o}/api/license-manager/storefront/users/${d}/roles`,
|
|
886
891
|
{
|
|
887
892
|
method: "GET",
|
|
888
893
|
headers: p
|
|
@@ -902,7 +907,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
902
907
|
"content-type": "application/json"
|
|
903
908
|
});
|
|
904
909
|
return I(
|
|
905
|
-
`${
|
|
910
|
+
`${o}/api/dataentities/CL/documents/${d}?_fields=_all`,
|
|
906
911
|
{
|
|
907
912
|
method: "GET",
|
|
908
913
|
headers: p
|
|
@@ -921,7 +926,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
921
926
|
"X-FORWARDED-HOST": u
|
|
922
927
|
}), m = d.replace(/-/g, "");
|
|
923
928
|
return I(
|
|
924
|
-
`${
|
|
929
|
+
`${o}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${d})&_fields=_all&_schema=v1`,
|
|
925
930
|
{
|
|
926
931
|
method: "GET",
|
|
927
932
|
headers: p
|
|
@@ -932,18 +937,18 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
932
937
|
},
|
|
933
938
|
quotes: {
|
|
934
939
|
listUserQuotes: (d) => {
|
|
935
|
-
|
|
936
|
-
const p =
|
|
940
|
+
mt(d);
|
|
941
|
+
const p = ht(d), m = s({
|
|
937
942
|
"content-type": "application/json",
|
|
938
943
|
"X-FORWARDED-HOST": u
|
|
939
944
|
});
|
|
940
945
|
return I(
|
|
941
|
-
`${
|
|
946
|
+
`${o}/api/quoting/quotes?${p.toString()}`,
|
|
942
947
|
{
|
|
943
948
|
method: "GET",
|
|
944
949
|
headers: m
|
|
945
950
|
},
|
|
946
|
-
{ storeCookies:
|
|
951
|
+
{ storeCookies: a }
|
|
947
952
|
);
|
|
948
953
|
}
|
|
949
954
|
},
|
|
@@ -952,15 +957,15 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
952
957
|
const d = s({
|
|
953
958
|
"content-type": "application/json",
|
|
954
959
|
"X-FORWARDED-HOST": u
|
|
955
|
-
}), p = z(
|
|
960
|
+
}), p = z(pe(i) ?? "", e);
|
|
956
961
|
return I(
|
|
957
|
-
`${
|
|
962
|
+
`${o}/api/vtexid/credential/validate`,
|
|
958
963
|
{
|
|
959
964
|
headers: d,
|
|
960
965
|
body: JSON.stringify({ token: p }),
|
|
961
966
|
method: "POST"
|
|
962
967
|
},
|
|
963
|
-
{ storeCookies:
|
|
968
|
+
{ storeCookies: a }
|
|
964
969
|
);
|
|
965
970
|
}
|
|
966
971
|
},
|
|
@@ -974,18 +979,18 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
974
979
|
"content-type": "application/json",
|
|
975
980
|
"X-FORWARDED-HOST": u
|
|
976
981
|
}), O = `----FastStoreUploadBoundary${Date.now()}`, w = `\r
|
|
977
|
-
`,
|
|
982
|
+
`, P = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", S = p.replaceAll(/[\r\n"]/g, "_"), D = [
|
|
978
983
|
`--${O}`,
|
|
979
984
|
`Content-Disposition: form-data; name="file"; filename="${S}"`,
|
|
980
|
-
`Content-Type: ${
|
|
985
|
+
`Content-Type: ${P}`,
|
|
981
986
|
"",
|
|
982
987
|
""
|
|
983
|
-
].join(w),
|
|
988
|
+
].join(w), A = `${w}--${O}--${w}`, k = Buffer.from(D), b = Buffer.from(A), U = new Uint8Array(
|
|
984
989
|
k.byteLength + d.byteLength + b.byteLength
|
|
985
990
|
);
|
|
986
991
|
let T = 0;
|
|
987
992
|
return U.set(k, T), T += k.byteLength, U.set(d, T), T += d.byteLength, U.set(b, T), I(
|
|
988
|
-
`${
|
|
993
|
+
`${o}/api/order-entry/upload?an=${e}`,
|
|
989
994
|
{
|
|
990
995
|
method: "POST",
|
|
991
996
|
headers: {
|
|
@@ -1012,7 +1017,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1012
1017
|
...m ? { sessionToken: m } : {}
|
|
1013
1018
|
});
|
|
1014
1019
|
return I(
|
|
1015
|
-
`${
|
|
1020
|
+
`${o}/api/order-entry/operation?an=${e}`,
|
|
1016
1021
|
{
|
|
1017
1022
|
method: "POST",
|
|
1018
1023
|
headers: y,
|
|
@@ -1029,7 +1034,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1029
1034
|
"X-FORWARDED-HOST": u
|
|
1030
1035
|
});
|
|
1031
1036
|
return I(
|
|
1032
|
-
`${
|
|
1037
|
+
`${o}/api/order-entry/operation/${d}?an=${e}`,
|
|
1033
1038
|
{
|
|
1034
1039
|
method: "GET",
|
|
1035
1040
|
headers: p
|
|
@@ -1043,7 +1048,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1043
1048
|
"X-FORWARDED-HOST": u
|
|
1044
1049
|
});
|
|
1045
1050
|
return I(
|
|
1046
|
-
`${
|
|
1051
|
+
`${o}/api/checkout/pub/orderForm?sc=${i.storage.channel.salesChannel}`,
|
|
1047
1052
|
{
|
|
1048
1053
|
method: "POST",
|
|
1049
1054
|
headers: d,
|
|
@@ -1060,7 +1065,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1060
1065
|
"X-FORWARDED-HOST": u
|
|
1061
1066
|
});
|
|
1062
1067
|
return I(
|
|
1063
|
-
`${
|
|
1068
|
+
`${o}/api/checkout/pub/orderForm/${d}`,
|
|
1064
1069
|
{
|
|
1065
1070
|
method: "GET",
|
|
1066
1071
|
headers: p
|
|
@@ -1085,7 +1090,7 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1085
1090
|
return p && w.append("userId", p), m.length > 0 && w.append("products", m.join(",")), y && w.append("salesChannel", y), O && w.append("locale", O), I(
|
|
1086
1091
|
`${h}/recommendations?${w.toString()}`,
|
|
1087
1092
|
{ headers: f },
|
|
1088
|
-
{ storeCookies:
|
|
1093
|
+
{ storeCookies: a }
|
|
1089
1094
|
);
|
|
1090
1095
|
},
|
|
1091
1096
|
startRecommendationSession: () => {
|
|
@@ -1093,28 +1098,28 @@ const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1093
1098
|
return I(
|
|
1094
1099
|
`${h}/users/start-session?${d.toString()}`,
|
|
1095
1100
|
{ method: "POST", headers: f },
|
|
1096
|
-
{ storeCookies:
|
|
1101
|
+
{ storeCookies: a }
|
|
1097
1102
|
);
|
|
1098
1103
|
}
|
|
1099
1104
|
}
|
|
1100
1105
|
};
|
|
1101
|
-
}, K = (e) => e.discoveryConfig?.localization ?? {}, Q = (e) => K(e).enabled === !0,
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
]),
|
|
1106
|
+
}, K = (e) => e.discoveryConfig?.localization ?? {}, Q = (e) => K(e).enabled === !0, St = (e) => Object.keys(K(e).locales ?? {}), yt = (e) => K(e).defaultLocale, re = (e) => Q(e) && e.storage.locale || void 0, ge = "fuzzy", me = "operator", he = "pickupPoint", Te = "shipping", _e = "delivery-options", It = "in-stock", vt = "trade-policy", Ot = "region-id", Ct = /* @__PURE__ */ new Set([
|
|
1107
|
+
vt,
|
|
1108
|
+
Ot,
|
|
1109
|
+
ge,
|
|
1110
|
+
me,
|
|
1111
|
+
he
|
|
1112
|
+
]), bt = /* @__PURE__ */ new Set([
|
|
1108
1113
|
"zip-code",
|
|
1109
1114
|
"pickupPoint",
|
|
1110
1115
|
"country",
|
|
1111
1116
|
"coordinates",
|
|
1112
1117
|
"deliveryZonesHash",
|
|
1113
1118
|
"pickupPointsHash"
|
|
1114
|
-
]),
|
|
1119
|
+
]), Ee = (e) => encodeURI(decodeURI(e)), wt = (e) => encodeURIComponent(
|
|
1115
1120
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
1116
|
-
),
|
|
1117
|
-
function
|
|
1121
|
+
), Dt = /^pickup-in-point-(.+)$/;
|
|
1122
|
+
function cn(e) {
|
|
1118
1123
|
if (!e)
|
|
1119
1124
|
return {};
|
|
1120
1125
|
try {
|
|
@@ -1127,18 +1132,18 @@ function sn(e) {
|
|
|
1127
1132
|
return {};
|
|
1128
1133
|
}
|
|
1129
1134
|
}
|
|
1130
|
-
function
|
|
1135
|
+
function At(e) {
|
|
1131
1136
|
const n = {}, t = [];
|
|
1132
1137
|
for (const r of e.split(";")) {
|
|
1133
1138
|
const i = r.indexOf("=");
|
|
1134
1139
|
if (i < 0) continue;
|
|
1135
|
-
const
|
|
1136
|
-
!
|
|
1140
|
+
const o = r.slice(0, i), a = r.slice(i + 1);
|
|
1141
|
+
!o || !a || (bt.has(o) ? n[o] = a : t.push({ key: o, value: a }));
|
|
1137
1142
|
}
|
|
1138
1143
|
return { shipping: n, extraFacets: t };
|
|
1139
1144
|
}
|
|
1140
|
-
function
|
|
1141
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } =
|
|
1145
|
+
function Pt(e) {
|
|
1146
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } = At(n);
|
|
1142
1147
|
return {
|
|
1143
1148
|
segmentParams: {
|
|
1144
1149
|
sc: e.channel,
|
|
@@ -1159,7 +1164,7 @@ function wt(e) {
|
|
|
1159
1164
|
extraFacets: r
|
|
1160
1165
|
};
|
|
1161
1166
|
}
|
|
1162
|
-
function
|
|
1167
|
+
function ln(e, n) {
|
|
1163
1168
|
const t = [
|
|
1164
1169
|
["sc", n.sc],
|
|
1165
1170
|
["regionId", n.regionId],
|
|
@@ -1179,11 +1184,11 @@ function cn(e, n) {
|
|
|
1179
1184
|
for (const [r, i] of t)
|
|
1180
1185
|
i != null && i !== "" && e.append(r, String(i));
|
|
1181
1186
|
}
|
|
1182
|
-
function
|
|
1183
|
-
return
|
|
1187
|
+
function dn(e) {
|
|
1188
|
+
return Dt.exec(e)?.[1];
|
|
1184
1189
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const n = e.find((r) => r.key === "shipping"), t = n ?
|
|
1190
|
+
function kt(e) {
|
|
1191
|
+
const n = e.find((r) => r.key === "shipping"), t = n ? dn(n.value) : void 0;
|
|
1187
1192
|
if (t !== void 0)
|
|
1188
1193
|
try {
|
|
1189
1194
|
return decodeURIComponent(t);
|
|
@@ -1191,8 +1196,8 @@ function Dt(e) {
|
|
|
1191
1196
|
return t;
|
|
1192
1197
|
}
|
|
1193
1198
|
}
|
|
1194
|
-
function
|
|
1195
|
-
const t =
|
|
1199
|
+
function Ut(e, n) {
|
|
1200
|
+
const t = kt(
|
|
1196
1201
|
n
|
|
1197
1202
|
);
|
|
1198
1203
|
return t === void 0 ? e : {
|
|
@@ -1200,56 +1205,56 @@ function Pt(e, n) {
|
|
|
1200
1205
|
pickupPoint: t
|
|
1201
1206
|
};
|
|
1202
1207
|
}
|
|
1203
|
-
function
|
|
1204
|
-
return e.map((n) => n.key !== "shipping" ||
|
|
1208
|
+
function Tt(e) {
|
|
1209
|
+
return e.map((n) => n.key !== "shipping" || dn(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1205
1210
|
}
|
|
1206
|
-
function
|
|
1211
|
+
function _t(e, n) {
|
|
1207
1212
|
let t = [...e];
|
|
1208
1213
|
const r = t.some((i) => i.key === "shipping");
|
|
1209
1214
|
for (const i of n)
|
|
1210
1215
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1211
|
-
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")),
|
|
1216
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), Tt(t);
|
|
1212
1217
|
}
|
|
1213
|
-
function
|
|
1218
|
+
function Et(e) {
|
|
1214
1219
|
return e.reduce((n, t) => {
|
|
1215
1220
|
let { key: r, value: i } = t;
|
|
1216
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${
|
|
1221
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Ee(r)}/${wt(Ee(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1217
1222
|
}, "");
|
|
1218
1223
|
}
|
|
1219
|
-
const
|
|
1220
|
-
function
|
|
1221
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1224
|
+
const Rt = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), Ft = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1225
|
+
function Nt(e, n) {
|
|
1226
|
+
const { segmentParams: t, extraFacets: r } = Pt(e ?? {}), i = n?.salesChannel ?? t.sc, o = n?.regionId ?? t.regionId, a = n?.locale ?? t.locale ?? "";
|
|
1222
1227
|
return {
|
|
1223
1228
|
segmentParams: {
|
|
1224
1229
|
...t,
|
|
1225
1230
|
...i ? { sc: i } : {},
|
|
1226
|
-
...
|
|
1227
|
-
locale:
|
|
1231
|
+
...o ? { regionId: o } : {},
|
|
1232
|
+
locale: a
|
|
1228
1233
|
},
|
|
1229
1234
|
extraFacets: r
|
|
1230
1235
|
};
|
|
1231
1236
|
}
|
|
1232
|
-
function
|
|
1233
|
-
const t = e.filter(({ key: c }) => !
|
|
1234
|
-
({ key: c, value: l }) => c ===
|
|
1237
|
+
function Lt(e, n) {
|
|
1238
|
+
const t = e.filter(({ key: c }) => !Ct.has(c)), r = e.find(
|
|
1239
|
+
({ key: c, value: l }) => c === Te && l !== "all-delivery-methods"
|
|
1235
1240
|
) ?? null, i = e.find(
|
|
1236
|
-
({ key: c, value: l }) => c ===
|
|
1237
|
-
) ?? null,
|
|
1241
|
+
({ key: c, value: l }) => c === _e && l !== "all-delivery-options"
|
|
1242
|
+
) ?? null, o = [...t], a = o.some(
|
|
1243
|
+
({ key: c }) => c === Te
|
|
1244
|
+
), s = o.some(
|
|
1238
1245
|
({ key: c }) => c === _e
|
|
1239
|
-
), s = a.some(
|
|
1240
|
-
({ key: c }) => c === Ee
|
|
1241
1246
|
);
|
|
1242
|
-
return r !== null && !
|
|
1247
|
+
return r !== null && !a && o.push(r), i !== null && !s && o.push(i), _t(o, n);
|
|
1243
1248
|
}
|
|
1244
|
-
function
|
|
1245
|
-
const t = e.find(({ key:
|
|
1246
|
-
t &&
|
|
1249
|
+
function Bt(e, n) {
|
|
1250
|
+
const t = e.find(({ key: o }) => o === ge) ?? null, r = e.find(({ key: o }) => o === me) ?? null, i = e.find(({ key: o }) => o === he) ?? null;
|
|
1251
|
+
t && Rt(t) && n.append(ge, t.value), r && Ft(r) && n.append(me, r.value), i && n.append(he, i.value);
|
|
1247
1252
|
}
|
|
1248
|
-
function
|
|
1253
|
+
function Re(e, n, t, r) {
|
|
1249
1254
|
const {
|
|
1250
1255
|
query: i = "",
|
|
1251
|
-
page:
|
|
1252
|
-
count:
|
|
1256
|
+
page: o,
|
|
1257
|
+
count: a,
|
|
1253
1258
|
sort: s,
|
|
1254
1259
|
selectedFacets: c = [],
|
|
1255
1260
|
showInvisibleItems: l,
|
|
@@ -1257,31 +1262,31 @@ function Fe(e, n, t, r) {
|
|
|
1257
1262
|
hideUnavailableItems: u,
|
|
1258
1263
|
allowRedirect: h = !1
|
|
1259
1264
|
} = e, f = new URLSearchParams();
|
|
1260
|
-
if (r.includePagination &&
|
|
1261
|
-
const p =
|
|
1265
|
+
if (r.includePagination && o !== void 0 && a !== void 0) {
|
|
1266
|
+
const p = o * a, m = a === 0 ? p : p + a - 1;
|
|
1262
1267
|
f.append("from", p.toString()), f.append("to", m.toString());
|
|
1263
1268
|
}
|
|
1264
1269
|
i && f.append("query", i), r.includeSort && s && f.append("sort", s);
|
|
1265
|
-
const v =
|
|
1270
|
+
const v = Ut(
|
|
1266
1271
|
t.segmentParams,
|
|
1267
1272
|
c
|
|
1268
1273
|
);
|
|
1269
|
-
if (
|
|
1270
|
-
const p = c.find(({ key: y }) => y ===
|
|
1274
|
+
if (ln(f, v ?? t.segmentParams), Bt(c, f), l && f.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1275
|
+
const p = c.find(({ key: y }) => y === It), m = p ? p.value : u?.toString() ?? n.hideUnavailableItems.toString();
|
|
1271
1276
|
f.append("hideUnavailableItems", m);
|
|
1272
1277
|
}
|
|
1273
1278
|
n?.simulationBehavior !== void 0 && f.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && f.append("showSponsored", n.showSponsored.toString()), g !== void 0 && f.append("sponsoredCount", g.toString()), h !== void 0 && f.append("allowRedirect", h.toString());
|
|
1274
|
-
const d =
|
|
1275
|
-
|
|
1279
|
+
const d = Et(
|
|
1280
|
+
Lt(c, t.extraFacets)
|
|
1276
1281
|
);
|
|
1277
1282
|
return { params: f, path: d };
|
|
1278
1283
|
}
|
|
1279
|
-
function
|
|
1280
|
-
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems:
|
|
1284
|
+
function $t(e, n) {
|
|
1285
|
+
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: o } = e, a = new URLSearchParams({
|
|
1281
1286
|
field: t ?? "",
|
|
1282
1287
|
value: r ?? ""
|
|
1283
1288
|
});
|
|
1284
|
-
return
|
|
1289
|
+
return ln(a, n), i && a.append("hideUnavailableItems", "true"), o && a.append("show-invisible-items", "true"), a;
|
|
1285
1290
|
}
|
|
1286
1291
|
function W(e, n) {
|
|
1287
1292
|
return {
|
|
@@ -1294,92 +1299,92 @@ function W(e, n) {
|
|
|
1294
1299
|
};
|
|
1295
1300
|
}
|
|
1296
1301
|
function G(e) {
|
|
1297
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e,
|
|
1302
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, o = Nt(t, r);
|
|
1298
1303
|
switch (n) {
|
|
1299
1304
|
case "product-search":
|
|
1300
1305
|
case "facets": {
|
|
1301
|
-
const { params:
|
|
1306
|
+
const { params: a, path: s } = Re(
|
|
1302
1307
|
i,
|
|
1303
1308
|
r,
|
|
1304
|
-
|
|
1309
|
+
o,
|
|
1305
1310
|
{ includePagination: !0, includeSort: !0 }
|
|
1306
1311
|
);
|
|
1307
|
-
return W(s,
|
|
1312
|
+
return W(s, a);
|
|
1308
1313
|
}
|
|
1309
1314
|
case "catalog-count": {
|
|
1310
|
-
const { params:
|
|
1315
|
+
const { params: a, path: s } = Re(
|
|
1311
1316
|
i,
|
|
1312
1317
|
r,
|
|
1313
|
-
|
|
1318
|
+
o,
|
|
1314
1319
|
{ includePagination: !1, includeSort: !1 }
|
|
1315
1320
|
);
|
|
1316
|
-
return W(s,
|
|
1321
|
+
return W(s, a);
|
|
1317
1322
|
}
|
|
1318
1323
|
case "products": {
|
|
1319
|
-
const
|
|
1320
|
-
return W("",
|
|
1324
|
+
const a = $t(i, o.segmentParams);
|
|
1325
|
+
return W("", a);
|
|
1321
1326
|
}
|
|
1322
1327
|
case "search-suggestions": {
|
|
1323
|
-
const
|
|
1328
|
+
const a = new URLSearchParams({
|
|
1324
1329
|
query: i.query?.toString() ?? "",
|
|
1325
|
-
locale: r?.locale ??
|
|
1330
|
+
locale: r?.locale ?? o.segmentParams.locale ?? ""
|
|
1326
1331
|
});
|
|
1327
|
-
return W("",
|
|
1332
|
+
return W("", a);
|
|
1328
1333
|
}
|
|
1329
1334
|
case "top-searches": {
|
|
1330
|
-
const
|
|
1331
|
-
locale: r?.locale ??
|
|
1335
|
+
const a = new URLSearchParams({
|
|
1336
|
+
locale: r?.locale ?? o.segmentParams.locale ?? ""
|
|
1332
1337
|
});
|
|
1333
|
-
return W("",
|
|
1338
|
+
return W("", a);
|
|
1334
1339
|
}
|
|
1335
1340
|
default: {
|
|
1336
|
-
const
|
|
1337
|
-
throw new Error(`Unknown intelligent-search endpoint: ${
|
|
1341
|
+
const a = n;
|
|
1342
|
+
throw new Error(`Unknown intelligent-search endpoint: ${a}`);
|
|
1338
1343
|
}
|
|
1339
1344
|
}
|
|
1340
1345
|
}
|
|
1341
|
-
const
|
|
1342
|
-
function
|
|
1346
|
+
const Mt = 10;
|
|
1347
|
+
function zt(e) {
|
|
1343
1348
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1344
1349
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1345
1350
|
}
|
|
1346
|
-
function
|
|
1347
|
-
const t =
|
|
1351
|
+
function Vt(e) {
|
|
1352
|
+
const t = cn(e.headers?.cookie).cultureInfo || "";
|
|
1348
1353
|
return Q(e) ? e.storage.locale || t : t || e.storage.locale || "";
|
|
1349
1354
|
}
|
|
1350
|
-
const
|
|
1355
|
+
const xt = ({
|
|
1351
1356
|
account: e,
|
|
1352
1357
|
environment: n,
|
|
1353
1358
|
hideUnavailableItems: t,
|
|
1354
1359
|
simulationBehavior: r,
|
|
1355
1360
|
showSponsored: i,
|
|
1356
|
-
subDomainPrefix:
|
|
1357
|
-
},
|
|
1358
|
-
const s = `https://${e}.${n}.com.br`, c =
|
|
1359
|
-
salesChannel:
|
|
1360
|
-
regionId:
|
|
1361
|
-
locale:
|
|
1361
|
+
subDomainPrefix: o
|
|
1362
|
+
}, a) => {
|
|
1363
|
+
const s = `https://${e}.${n}.com.br`, c = sn(a), l = cn(a.headers?.cookie), g = () => ({
|
|
1364
|
+
salesChannel: a.storage.channel.salesChannel,
|
|
1365
|
+
regionId: zt(a),
|
|
1366
|
+
locale: Vt(a),
|
|
1362
1367
|
hideUnavailableItems: t,
|
|
1363
1368
|
simulationBehavior: r,
|
|
1364
1369
|
showSponsored: i
|
|
1365
|
-
}), u = new Headers(
|
|
1370
|
+
}), u = new Headers(a.headers).get("x-forwarded-host") ?? a.headers?.host ?? "", h = o && o.map((S) => S + ".").find((S) => u.includes(S)) || "", f = u.replace(h, ""), v = c({
|
|
1366
1371
|
"content-type": "application/json",
|
|
1367
1372
|
"X-FORWARDED-HOST": f
|
|
1368
1373
|
}), d = ({ type: S, ...D }) => {
|
|
1369
|
-
const
|
|
1370
|
-
endpoint:
|
|
1374
|
+
const A = S === "facets" ? "facets" : "product-search", k = G({
|
|
1375
|
+
endpoint: A,
|
|
1371
1376
|
segment: l,
|
|
1372
1377
|
defaults: g(),
|
|
1373
1378
|
args: D
|
|
1374
1379
|
});
|
|
1375
1380
|
return I(
|
|
1376
|
-
`${s}/api/intelligent-search/v1/${
|
|
1381
|
+
`${s}/api/intelligent-search/v1/${A}/${k.path}?${k.params.toString()}`,
|
|
1377
1382
|
{ headers: v }
|
|
1378
1383
|
);
|
|
1379
1384
|
}, p = (S) => d({ ...S, type: "product_search" }), m = ({
|
|
1380
1385
|
field: S,
|
|
1381
1386
|
value: D,
|
|
1382
|
-
hideUnavailableItems:
|
|
1387
|
+
hideUnavailableItems: A,
|
|
1383
1388
|
showInvisibleItems: k
|
|
1384
1389
|
}) => {
|
|
1385
1390
|
const b = G({
|
|
@@ -1389,7 +1394,7 @@ const Mt = ({
|
|
|
1389
1394
|
args: {
|
|
1390
1395
|
field: S,
|
|
1391
1396
|
value: D,
|
|
1392
|
-
hideUnavailableItems:
|
|
1397
|
+
hideUnavailableItems: A,
|
|
1393
1398
|
showInvisibleItems: k
|
|
1394
1399
|
}
|
|
1395
1400
|
});
|
|
@@ -1405,10 +1410,10 @@ const Mt = ({
|
|
|
1405
1410
|
productsByIdentifier: async ({
|
|
1406
1411
|
field: S,
|
|
1407
1412
|
values: D,
|
|
1408
|
-
showInvisibleItems:
|
|
1413
|
+
showInvisibleItems: A,
|
|
1409
1414
|
hideUnavailableItems: k
|
|
1410
1415
|
}) => {
|
|
1411
|
-
const b =
|
|
1416
|
+
const b = we(Mt);
|
|
1412
1417
|
return (await Promise.all(
|
|
1413
1418
|
D.map(
|
|
1414
1419
|
(T) => b(async () => {
|
|
@@ -1417,7 +1422,7 @@ const Mt = ({
|
|
|
1417
1422
|
field: S,
|
|
1418
1423
|
value: T,
|
|
1419
1424
|
hideUnavailableItems: k,
|
|
1420
|
-
showInvisibleItems:
|
|
1425
|
+
showInvisibleItems: A
|
|
1421
1426
|
});
|
|
1422
1427
|
} catch {
|
|
1423
1428
|
return null;
|
|
@@ -1464,41 +1469,41 @@ const Mt = ({
|
|
|
1464
1469
|
);
|
|
1465
1470
|
}
|
|
1466
1471
|
};
|
|
1467
|
-
},
|
|
1468
|
-
const t =
|
|
1472
|
+
}, qt = (e, n) => {
|
|
1473
|
+
const t = xt(e, n), r = ft(e, n), i = it(e);
|
|
1469
1474
|
return {
|
|
1470
1475
|
search: t,
|
|
1471
1476
|
commerce: r,
|
|
1472
1477
|
catalog: i
|
|
1473
1478
|
};
|
|
1474
|
-
},
|
|
1475
|
-
const t =
|
|
1479
|
+
}, jt = 20, Wt = (e) => e.entityType === "category", fe = (e) => e.entityType === "brand", Fe = (e) => e.entityType === "collection", Gt = (e, n) => {
|
|
1480
|
+
const t = we(jt), r = async (i) => Promise.all(
|
|
1476
1481
|
i.map(
|
|
1477
|
-
(
|
|
1478
|
-
const
|
|
1479
|
-
|
|
1482
|
+
(o) => t(async () => {
|
|
1483
|
+
const a = o.slug.toLowerCase(), s = o.locale, c = await n.commerce.catalog.byLinkId.category(
|
|
1484
|
+
a,
|
|
1480
1485
|
s
|
|
1481
1486
|
);
|
|
1482
1487
|
if (c)
|
|
1483
1488
|
return {
|
|
1484
1489
|
...c,
|
|
1485
1490
|
entityType: "category",
|
|
1486
|
-
slug:
|
|
1491
|
+
slug: a
|
|
1487
1492
|
};
|
|
1488
1493
|
const l = await n.commerce.catalog.byLinkId.brand(
|
|
1489
|
-
|
|
1494
|
+
a,
|
|
1490
1495
|
s
|
|
1491
1496
|
);
|
|
1492
1497
|
if (l)
|
|
1493
1498
|
return { ...l, entityType: "brand" };
|
|
1494
1499
|
const g = await n.commerce.catalog.byLinkId.collection(
|
|
1495
|
-
|
|
1500
|
+
a,
|
|
1496
1501
|
s
|
|
1497
1502
|
);
|
|
1498
1503
|
if (g)
|
|
1499
1504
|
return { ...g, entityType: "collection" };
|
|
1500
|
-
throw new
|
|
1501
|
-
`No catalog entity found for slug: ${
|
|
1505
|
+
throw new B(
|
|
1506
|
+
`No catalog entity found for slug: ${o.slug}. Cascade exhausted (category → brand → collection).`
|
|
1502
1507
|
);
|
|
1503
1508
|
})
|
|
1504
1509
|
)
|
|
@@ -1508,16 +1513,16 @@ const Mt = ({
|
|
|
1508
1513
|
batch: !1,
|
|
1509
1514
|
// Dedup by lowercased slug + captured locale so casing variants share an
|
|
1510
1515
|
// entry while same-slug / different-locale loads stay isolated.
|
|
1511
|
-
cacheKeyFn: ({ slug: i, locale:
|
|
1516
|
+
cacheKeyFn: ({ slug: i, locale: o }) => `${i.toLowerCase()}::${o ?? ""}`
|
|
1512
1517
|
});
|
|
1513
|
-
},
|
|
1518
|
+
}, Ht = (e, n) => {
|
|
1514
1519
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1515
1520
|
return new le(t);
|
|
1516
|
-
},
|
|
1517
|
-
const t =
|
|
1518
|
-
const
|
|
1519
|
-
country:
|
|
1520
|
-
postalCode:
|
|
1521
|
+
}, Xt = 1, Yt = (e, n) => {
|
|
1522
|
+
const t = we(Xt), r = async (o) => {
|
|
1523
|
+
const a = o.reduce((u, { items: h }) => [...u, h], []), s = [...a.flat()], c = await n.commerce.checkout.simulation({
|
|
1524
|
+
country: o[0].country,
|
|
1525
|
+
postalCode: o[0].postalCode,
|
|
1521
1526
|
items: s
|
|
1522
1527
|
}), l = c.items.reduce(
|
|
1523
1528
|
(u, h) => {
|
|
@@ -1525,36 +1530,36 @@ const Mt = ({
|
|
|
1525
1530
|
return typeof f == "number" && f < u.length && (u[f] = h), u;
|
|
1526
1531
|
},
|
|
1527
1532
|
Array(s.length).fill(null)
|
|
1528
|
-
), g =
|
|
1533
|
+
), g = a.reduce(
|
|
1529
1534
|
(u, h) => [...u, h.length + u[u.length - 1]],
|
|
1530
1535
|
[0]
|
|
1531
1536
|
);
|
|
1532
|
-
return
|
|
1537
|
+
return a.map((u, h) => ({
|
|
1533
1538
|
...c,
|
|
1534
1539
|
items: l.slice(g[h], g[h + 1]).filter((f) => !!f)
|
|
1535
1540
|
}));
|
|
1536
|
-
}, i = async (
|
|
1541
|
+
}, i = async (o) => t(r, o);
|
|
1537
1542
|
return new le(i, {
|
|
1538
1543
|
maxBatchSize: 50
|
|
1539
1544
|
});
|
|
1540
|
-
},
|
|
1541
|
-
function
|
|
1545
|
+
}, Jt = (e, n) => $n(e, n);
|
|
1546
|
+
function Kt(e) {
|
|
1542
1547
|
return {
|
|
1543
1548
|
...e,
|
|
1544
|
-
description: e.description ?
|
|
1549
|
+
description: e.description ? Jt(e.description) : e.description
|
|
1545
1550
|
};
|
|
1546
1551
|
}
|
|
1547
1552
|
const N = (e, n) => ({
|
|
1548
1553
|
...e,
|
|
1549
|
-
isVariantOf:
|
|
1550
|
-
}),
|
|
1554
|
+
isVariantOf: Kt(n)
|
|
1555
|
+
}), Qt = ({ flags: e }, n) => {
|
|
1551
1556
|
const t = async (r) => {
|
|
1552
|
-
const i = r.map((g) => g.split("-")[0]),
|
|
1557
|
+
const i = r.map((g) => g.split("-")[0]), o = r.some(
|
|
1553
1558
|
(g) => g.split("-")[1] === "invisibleItems"
|
|
1554
1559
|
), s = (await n.search.productsByIdentifier({
|
|
1555
1560
|
field: "sku",
|
|
1556
1561
|
values: i,
|
|
1557
|
-
showInvisibleItems:
|
|
1562
|
+
showInvisibleItems: o,
|
|
1558
1563
|
...e?.enableUnavailableItemsOnCart && {
|
|
1559
1564
|
hideUnavailableItems: !1
|
|
1560
1565
|
}
|
|
@@ -1567,7 +1572,7 @@ const N = (e, n) => ({
|
|
|
1567
1572
|
{}
|
|
1568
1573
|
), c = i.map((g) => s[g]), l = i.filter((g) => !s[g]);
|
|
1569
1574
|
if (l.length > 0)
|
|
1570
|
-
throw new
|
|
1575
|
+
throw new B(
|
|
1571
1576
|
`Search API did not found the following skus: ${l.join(",")}`
|
|
1572
1577
|
);
|
|
1573
1578
|
return c;
|
|
@@ -1576,27 +1581,27 @@ const N = (e, n) => ({
|
|
|
1576
1581
|
maxBatchSize: 99
|
|
1577
1582
|
// Max allowed batch size of Search API
|
|
1578
1583
|
});
|
|
1579
|
-
},
|
|
1580
|
-
const { clients: t } = n, r =
|
|
1584
|
+
}, Zt = (e, n) => {
|
|
1585
|
+
const { clients: t } = n, r = Qt(e, t), i = Yt(e, t), o = Gt(e, t), a = Ht(e, t);
|
|
1581
1586
|
return {
|
|
1582
1587
|
skuLoader: r,
|
|
1583
1588
|
simulationLoader: i,
|
|
1584
|
-
collectionLoader:
|
|
1585
|
-
salesChannelLoader:
|
|
1589
|
+
collectionLoader: o,
|
|
1590
|
+
salesChannelLoader: a
|
|
1586
1591
|
};
|
|
1587
|
-
},
|
|
1592
|
+
}, L = (e) => e.AvailableQuantity > 0, V = (e) => e.spotPrice ?? 0, er = (e) => e.Price ?? 0, Ne = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", un = (e, n) => L(e) && !L(n) ? -1 : !L(e) && L(n) ? 1 : V(e) - V(n), nr = (e) => e === "available", M = (e, n = 0, t = 1) => {
|
|
1588
1593
|
const r = n / t;
|
|
1589
1594
|
return Math.round((e + r) * 100) / 100;
|
|
1590
|
-
},
|
|
1591
|
-
const t = e.filter(
|
|
1595
|
+
}, tr = (e, n = { includeTaxes: !1 }) => {
|
|
1596
|
+
const t = e.filter(L), r = t[t.length - 1], i = r ? V(r) : 0;
|
|
1592
1597
|
return n.includeTaxes ? M(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1593
|
-
},
|
|
1594
|
-
const [t] = e.filter(
|
|
1598
|
+
}, Le = (e, n = { includeTaxes: !1 }) => {
|
|
1599
|
+
const [t] = e.filter(L), r = t ? V(t) : 0;
|
|
1595
1600
|
return n.includeTaxes ? M(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1596
|
-
},
|
|
1597
|
-
highPrice: (e) =>
|
|
1598
|
-
lowPrice: (e) =>
|
|
1599
|
-
lowPriceWithTaxes: (e) =>
|
|
1601
|
+
}, rr = {
|
|
1602
|
+
highPrice: (e) => tr(e),
|
|
1603
|
+
lowPrice: (e) => Le(e),
|
|
1604
|
+
lowPriceWithTaxes: (e) => Le(e, { includeTaxes: !0 }),
|
|
1600
1605
|
offerCount: (e) => e.length,
|
|
1601
1606
|
priceCurrency: async (e, n, t) => {
|
|
1602
1607
|
const {
|
|
@@ -1606,20 +1611,20 @@ const N = (e, n) => ({
|
|
|
1606
1611
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1607
1612
|
},
|
|
1608
1613
|
offers: (e) => e
|
|
1609
|
-
},
|
|
1614
|
+
}, ir = {
|
|
1610
1615
|
ratingValue: () => 5,
|
|
1611
1616
|
reviewCount: () => 0
|
|
1612
|
-
},
|
|
1617
|
+
}, Be = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", or = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", ar = (e) => {
|
|
1613
1618
|
let n = e.slice(0);
|
|
1614
|
-
for (let t = 0; t <
|
|
1615
|
-
n = n.replace(new RegExp(
|
|
1619
|
+
for (let t = 0; t < Be.length; t++)
|
|
1620
|
+
n = n.replace(new RegExp(Be.charAt(t), "g"), or.charAt(t));
|
|
1616
1621
|
return n;
|
|
1617
|
-
},
|
|
1618
|
-
function
|
|
1622
|
+
}, sr = (e) => e.replace(/[·/_,:]/, "-");
|
|
1623
|
+
function oe(e) {
|
|
1619
1624
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1620
|
-
return
|
|
1625
|
+
return sr(ar(t)).toLowerCase();
|
|
1621
1626
|
}
|
|
1622
|
-
const H = (e) =>
|
|
1627
|
+
const H = (e) => Wt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? oe(e.name), pn = {
|
|
1623
1628
|
id: ({ id: e }) => e.toString(),
|
|
1624
1629
|
slug: (e) => H(e),
|
|
1625
1630
|
seo: (e) => ({
|
|
@@ -1629,21 +1634,21 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), un
|
|
|
1629
1634
|
// for forward-compat; fall back to description for by-linkid parity.
|
|
1630
1635
|
description: e.metaTagDescription ?? e.description
|
|
1631
1636
|
}),
|
|
1632
|
-
type: (e) =>
|
|
1637
|
+
type: (e) => fe(e) ? "Brand" : Fe(e) ? "Collection" : e.fatherCategoryId === null ? "Department" : "Category",
|
|
1633
1638
|
meta: async (e, n, t) => {
|
|
1634
1639
|
const r = H(e);
|
|
1635
|
-
if (
|
|
1640
|
+
if (fe(e))
|
|
1636
1641
|
return { selectedFacets: [{ key: "brand", value: r }] };
|
|
1637
|
-
if (
|
|
1642
|
+
if (Fe(e))
|
|
1638
1643
|
return { selectedFacets: [{ key: "productclusterids", value: e.id }] };
|
|
1639
|
-
const { defaultLocale: i } = K(t),
|
|
1640
|
-
(l, g) =>
|
|
1644
|
+
const { defaultLocale: i } = K(t), o = r.split("/").filter(Boolean), a = o.map(
|
|
1645
|
+
(l, g) => o.slice(0, g + 1).join("/")
|
|
1641
1646
|
), {
|
|
1642
1647
|
loaders: { collectionLoader: s }
|
|
1643
1648
|
} = t;
|
|
1644
1649
|
return {
|
|
1645
1650
|
selectedFacets: (await Promise.all(
|
|
1646
|
-
|
|
1651
|
+
a.map(
|
|
1647
1652
|
(l) => s.load({ slug: l, locale: re(t) })
|
|
1648
1653
|
)
|
|
1649
1654
|
)).map((l, g) => ({
|
|
@@ -1655,10 +1660,10 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), un
|
|
|
1655
1660
|
breadcrumbList: async (e, n, t) => {
|
|
1656
1661
|
const {
|
|
1657
1662
|
loaders: { collectionLoader: r }
|
|
1658
|
-
} = t,
|
|
1659
|
-
(c, l) =>
|
|
1663
|
+
} = t, o = H(e).split("/").filter(Boolean), a = o.map(
|
|
1664
|
+
(c, l) => o.slice(0, l + 1).join("/")
|
|
1660
1665
|
), s = await Promise.all(
|
|
1661
|
-
|
|
1666
|
+
a.map(
|
|
1662
1667
|
(c) => r.load({ slug: c, locale: re(t) })
|
|
1663
1668
|
)
|
|
1664
1669
|
);
|
|
@@ -1676,7 +1681,7 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), un
|
|
|
1676
1681
|
if (!r.enabled) return null;
|
|
1677
1682
|
const i = Object.keys(r.locales ?? {});
|
|
1678
1683
|
if (i.length === 0) return null;
|
|
1679
|
-
const
|
|
1684
|
+
const o = t.storage.locale, a = H(e), s = a.split("/").filter(Boolean);
|
|
1680
1685
|
if (s.length === 0) return null;
|
|
1681
1686
|
const {
|
|
1682
1687
|
loaders: { collectionLoader: c }
|
|
@@ -1694,8 +1699,8 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), un
|
|
|
1694
1699
|
return console.warn("[otherLocales] failed to load collection entities:", u), null;
|
|
1695
1700
|
}
|
|
1696
1701
|
return i.map((u) => {
|
|
1697
|
-
if (u ===
|
|
1698
|
-
return { locale: u, slug:
|
|
1702
|
+
if (u === o)
|
|
1703
|
+
return { locale: u, slug: a };
|
|
1699
1704
|
const h = [];
|
|
1700
1705
|
for (const f of g) {
|
|
1701
1706
|
const v = f.availableLinkIds?.[u];
|
|
@@ -1705,14 +1710,14 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), un
|
|
|
1705
1710
|
return h.length > 0 ? { locale: u, slug: h.join("/") } : null;
|
|
1706
1711
|
}).filter((u) => u !== null);
|
|
1707
1712
|
}
|
|
1708
|
-
},
|
|
1713
|
+
}, gn = {
|
|
1709
1714
|
buy: "whoboughtalsobought",
|
|
1710
1715
|
view: "whosawalsosaw",
|
|
1711
1716
|
similars: "similars",
|
|
1712
1717
|
viewAndBought: "whosawalsobought",
|
|
1713
1718
|
accessories: "accessories",
|
|
1714
1719
|
suggestions: "suggestions"
|
|
1715
|
-
},
|
|
1720
|
+
}, $e = ({ key: e, value: n }) => {
|
|
1716
1721
|
switch (e) {
|
|
1717
1722
|
case "price":
|
|
1718
1723
|
return { key: e, value: n.replace("-to-", ":") };
|
|
@@ -1728,61 +1733,61 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), un
|
|
|
1728
1733
|
default:
|
|
1729
1734
|
return { key: e, value: n };
|
|
1730
1735
|
}
|
|
1731
|
-
},
|
|
1736
|
+
}, Me = (e) => {
|
|
1732
1737
|
const n = e.split(":").map(Number);
|
|
1733
1738
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1734
|
-
},
|
|
1739
|
+
}, cr = (e) => typeof gn[e] == "string", lr = (e) => {
|
|
1735
1740
|
const n = e?.filter(
|
|
1736
|
-
(t) =>
|
|
1741
|
+
(t) => cr(t.key)
|
|
1737
1742
|
);
|
|
1738
1743
|
if (Array.isArray(n) && n.length > 1)
|
|
1739
1744
|
throw new _(
|
|
1740
1745
|
`You passed ${n.length} cross selling facets but only one is allowed. Please leave one of the following facet: ${n.map((t) => t.key).join(",")}`
|
|
1741
1746
|
);
|
|
1742
1747
|
return n?.[0] ?? null;
|
|
1743
|
-
},
|
|
1748
|
+
}, dr = (e) => e?.find((n) => n.key === "slug")?.value ?? null, ur = (e) => e?.find((n) => n.key === "id")?.value ?? null, ze = (e) => e?.find((n) => n.key === "locale")?.value ?? null, Ve = (e) => e?.find((n) => n.key === "channel")?.value ?? null, Se = (e, n) => {
|
|
1744
1749
|
let t = 0;
|
|
1745
1750
|
for (let r = 1; r < e.length; r++)
|
|
1746
1751
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1747
1752
|
return e[t];
|
|
1748
|
-
},
|
|
1753
|
+
}, pr = {
|
|
1749
1754
|
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1750
|
-
},
|
|
1755
|
+
}, gr = {
|
|
1751
1756
|
key: ({ key: e }) => e,
|
|
1752
1757
|
label: ({ name: e }) => e,
|
|
1753
1758
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1754
|
-
},
|
|
1759
|
+
}, mr = {
|
|
1755
1760
|
key: ({ key: e }) => e,
|
|
1756
1761
|
label: ({ name: e }) => e,
|
|
1757
1762
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1758
|
-
const i =
|
|
1763
|
+
const i = Me(
|
|
1759
1764
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1760
|
-
),
|
|
1765
|
+
), a = Se(e, (s, c) => s.range.from - c.range.from)?.range?.from ?? 0;
|
|
1761
1766
|
return {
|
|
1762
|
-
selected: i?.[0] ??
|
|
1763
|
-
absolute:
|
|
1767
|
+
selected: i?.[0] ?? a,
|
|
1768
|
+
absolute: a
|
|
1764
1769
|
};
|
|
1765
1770
|
},
|
|
1766
1771
|
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1767
|
-
const i =
|
|
1772
|
+
const i = Me(
|
|
1768
1773
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1769
|
-
),
|
|
1774
|
+
), a = Se(e, (s, c) => c.range.to - s.range.to)?.range?.to ?? 0;
|
|
1770
1775
|
return {
|
|
1771
|
-
selected: i?.[1] ??
|
|
1772
|
-
absolute:
|
|
1776
|
+
selected: i?.[1] ?? a,
|
|
1777
|
+
absolute: a
|
|
1773
1778
|
};
|
|
1774
1779
|
}
|
|
1775
|
-
},
|
|
1780
|
+
}, hr = {
|
|
1776
1781
|
value: ({ value: e }) => e,
|
|
1777
1782
|
label: ({ name: e }) => e || "unknown",
|
|
1778
1783
|
selected: ({ selected: e }) => e,
|
|
1779
1784
|
quantity: ({ quantity: e }) => e
|
|
1780
|
-
},
|
|
1785
|
+
}, fr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1781
1786
|
if (!n?.orderId)
|
|
1782
1787
|
throw new _("Missing orderId");
|
|
1783
1788
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1784
1789
|
};
|
|
1785
|
-
function
|
|
1790
|
+
function mn(e) {
|
|
1786
1791
|
if (!e || e.status !== "pending")
|
|
1787
1792
|
return null;
|
|
1788
1793
|
for (const n of e.dimensionStatus) {
|
|
@@ -1800,18 +1805,18 @@ function gn(e) {
|
|
|
1800
1805
|
}
|
|
1801
1806
|
return null;
|
|
1802
1807
|
}
|
|
1803
|
-
function
|
|
1808
|
+
function Sr(e) {
|
|
1804
1809
|
if (!e || e.status !== "pending") return !1;
|
|
1805
1810
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1806
1811
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1807
1812
|
}
|
|
1808
|
-
const
|
|
1809
|
-
const r = await t.oms.processOrderAuthorization(n), i =
|
|
1813
|
+
const yr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1814
|
+
const r = await t.oms.processOrderAuthorization(n), i = mn(r);
|
|
1810
1815
|
return {
|
|
1811
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1816
|
+
isPendingForOtherAuthorizer: !i && Sr(r),
|
|
1812
1817
|
ruleForAuthorization: i
|
|
1813
1818
|
};
|
|
1814
|
-
},
|
|
1819
|
+
}, Ir = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1815
1820
|
if (!n?.objectKey)
|
|
1816
1821
|
throw new _("Missing objectKey");
|
|
1817
1822
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
@@ -1820,33 +1825,33 @@ const hr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
|
1820
1825
|
orderFormId: r,
|
|
1821
1826
|
sessionToken: n.sessionToken ?? void 0
|
|
1822
1827
|
});
|
|
1823
|
-
},
|
|
1828
|
+
}, vr = async (e, n, t) => {
|
|
1824
1829
|
if (!(await t.clients.commerce.recommendation.startRecommendationSession())?.recommendationsUserId)
|
|
1825
1830
|
throw new Error(
|
|
1826
1831
|
"Failed to start recommendation session: no session data returned"
|
|
1827
1832
|
);
|
|
1828
1833
|
return !0;
|
|
1829
|
-
},
|
|
1830
|
-
const { fileContent: r, fileName: i, mimeType:
|
|
1831
|
-
if (!r || !i || !
|
|
1834
|
+
}, Or = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), Cr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1835
|
+
const { fileContent: r, fileName: i, mimeType: o } = n;
|
|
1836
|
+
if (!r || !i || !o)
|
|
1832
1837
|
throw new _(
|
|
1833
1838
|
"Missing required fields: fileContent, fileName, mimeType"
|
|
1834
1839
|
);
|
|
1835
|
-
const
|
|
1836
|
-
if (Math.floor(
|
|
1840
|
+
const a = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
|
|
1841
|
+
if (Math.floor(a.length * 3 / 4) > s)
|
|
1837
1842
|
throw new _("File exceeds maximum allowed size of 5MB");
|
|
1838
1843
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
|
|
1839
|
-
|
|
1844
|
+
a
|
|
1840
1845
|
))
|
|
1841
1846
|
throw new _("Invalid Base64 fileContent");
|
|
1842
|
-
const g = Buffer.from(
|
|
1847
|
+
const g = Buffer.from(a, "base64");
|
|
1843
1848
|
return await t.orderEntry.uploadFile({
|
|
1844
1849
|
fileBuffer: g,
|
|
1845
1850
|
fileName: i,
|
|
1846
|
-
mimeType:
|
|
1851
|
+
mimeType: o
|
|
1847
1852
|
});
|
|
1848
1853
|
};
|
|
1849
|
-
class
|
|
1854
|
+
class ae {
|
|
1850
1855
|
static parse(n) {
|
|
1851
1856
|
try {
|
|
1852
1857
|
const t = JSON.parse(n);
|
|
@@ -1864,23 +1869,23 @@ class oe {
|
|
|
1864
1869
|
return JSON.stringify(n);
|
|
1865
1870
|
}
|
|
1866
1871
|
}
|
|
1867
|
-
const
|
|
1868
|
-
e.storage.channel =
|
|
1869
|
-
},
|
|
1872
|
+
const ye = (e, n) => {
|
|
1873
|
+
e.storage.channel = ae.parse(n);
|
|
1874
|
+
}, Ie = (e, n) => {
|
|
1870
1875
|
e.storage.locale = n;
|
|
1871
|
-
},
|
|
1876
|
+
}, hn = (e) => Mn.createHash("md5").update(e).digest("hex"), ne = {
|
|
1872
1877
|
attachment: "ATTACHMENT",
|
|
1873
1878
|
specification: "SPECIFICATION",
|
|
1874
1879
|
attribute: "ATTRIBUTE"
|
|
1875
1880
|
};
|
|
1876
|
-
function
|
|
1881
|
+
function fn(e) {
|
|
1877
1882
|
return {
|
|
1878
1883
|
name: e.name,
|
|
1879
1884
|
value: e.content,
|
|
1880
1885
|
valueReference: ne.attachment
|
|
1881
1886
|
};
|
|
1882
1887
|
}
|
|
1883
|
-
function
|
|
1888
|
+
function br(e) {
|
|
1884
1889
|
return {
|
|
1885
1890
|
propertyID: e.id,
|
|
1886
1891
|
name: e.name,
|
|
@@ -1891,12 +1896,12 @@ function vr(e) {
|
|
|
1891
1896
|
}
|
|
1892
1897
|
};
|
|
1893
1898
|
}
|
|
1894
|
-
function
|
|
1895
|
-
return
|
|
1899
|
+
function Sn(e) {
|
|
1900
|
+
return hn(
|
|
1896
1901
|
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
1897
1902
|
);
|
|
1898
1903
|
}
|
|
1899
|
-
const
|
|
1904
|
+
const wr = (e) => {
|
|
1900
1905
|
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
1901
1906
|
addressType: e.addressType || null,
|
|
1902
1907
|
postalCode: n || null,
|
|
@@ -1911,16 +1916,16 @@ const Or = (e) => {
|
|
|
1911
1916
|
geoCoordinates: []
|
|
1912
1917
|
};
|
|
1913
1918
|
if (t) {
|
|
1914
|
-
const i = typeof t == "object" && "latitude" in t ? t.latitude : null,
|
|
1915
|
-
r.geoCoordinates = i !== null &&
|
|
1919
|
+
const i = typeof t == "object" && "latitude" in t ? t.latitude : null, o = typeof t == "object" && "longitude" in t ? t.longitude : null;
|
|
1920
|
+
r.geoCoordinates = i !== null && o !== null ? [o, i] : [];
|
|
1916
1921
|
}
|
|
1917
1922
|
return [r];
|
|
1918
|
-
},
|
|
1919
|
-
const r = n.postalCode, i = n.geoCoordinates,
|
|
1920
|
-
if (!t &&
|
|
1921
|
-
return [
|
|
1922
|
-
if (t &&
|
|
1923
|
-
for (const s of
|
|
1923
|
+
}, Dr = (e, n, t) => {
|
|
1924
|
+
const r = n.postalCode, i = n.geoCoordinates, o = e?.shippingData?.availableAddresses ?? [], a = e?.shippingData?.selectedAddresses ?? [];
|
|
1925
|
+
if (!t && a.length > 0)
|
|
1926
|
+
return [a[0]];
|
|
1927
|
+
if (t && o.length > 0)
|
|
1928
|
+
for (const s of o) {
|
|
1924
1929
|
if (r && i && (s.postalCode === r || s.geoCoordinates[0] === i.longitude && s.geoCoordinates[1] === i.latitude))
|
|
1925
1930
|
return [s];
|
|
1926
1931
|
if (r && !i && s.postalCode === r)
|
|
@@ -1929,31 +1934,31 @@ const Or = (e) => {
|
|
|
1929
1934
|
return [s];
|
|
1930
1935
|
}
|
|
1931
1936
|
return null;
|
|
1932
|
-
},
|
|
1933
|
-
if (!
|
|
1937
|
+
}, yn = (e, n) => {
|
|
1938
|
+
if (!Ar(n))
|
|
1934
1939
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1935
|
-
if (!
|
|
1940
|
+
if (!Tr(e))
|
|
1936
1941
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1937
1942
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
1938
|
-
if (
|
|
1943
|
+
if (Pr(t, n.postalCode) || kr(t, n.geoCoordinates) || Ur(t, n.addressType))
|
|
1939
1944
|
return { updateShipping: !0, addressChanged: !0 };
|
|
1940
1945
|
const { logisticsInfo: r } = e.shippingData;
|
|
1941
|
-
return
|
|
1942
|
-
},
|
|
1943
|
-
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate:
|
|
1946
|
+
return _r(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
1947
|
+
}, Ar = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, Pr = (e, n) => typeof n == "string" && e?.postalCode !== n, kr = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), Ur = (e, n) => typeof n == "string" && e?.addressType !== n, Tr = (e) => e.items.length !== 0, _r = (e, n) => {
|
|
1948
|
+
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: o } = n?.deliveryMode?.deliveryWindow || {};
|
|
1944
1949
|
return e.some(
|
|
1945
|
-
({ selectedDeliveryChannel:
|
|
1946
|
-
const l = t &&
|
|
1947
|
-
return c?.some((u) => l && u.deliveryChannel === t || g && u.id === r ? !0 : i &&
|
|
1948
|
-
(h) => h?.startDateUtc === i && h?.endDateUtc ===
|
|
1950
|
+
({ selectedDeliveryChannel: a, selectedSla: s, slas: c }) => {
|
|
1951
|
+
const l = t && a !== t, g = r && s !== r;
|
|
1952
|
+
return c?.some((u) => l && u.deliveryChannel === t || g && u.id === r ? !0 : i && o && u.deliveryChannel === t && u.id === r && (!u?.deliveryWindow || u?.deliveryWindow?.startDateUtc !== i || u?.deliveryWindow?.endDateUtc !== o) && u.availableDeliveryWindows?.some(
|
|
1953
|
+
(h) => h?.startDateUtc === i && h?.endDateUtc === o
|
|
1949
1954
|
));
|
|
1950
1955
|
}
|
|
1951
1956
|
);
|
|
1952
|
-
},
|
|
1957
|
+
}, In = (e) => e.valueReference === ne.attachment, ve = (e) => [
|
|
1953
1958
|
e.itemOffered.sku,
|
|
1954
1959
|
e.seller.identifier,
|
|
1955
1960
|
e.price < 0.01 ? "Gift" : void 0,
|
|
1956
|
-
e.itemOffered.additionalProperty?.filter(
|
|
1961
|
+
e.itemOffered.additionalProperty?.filter(In).map(Sn).join("-")
|
|
1957
1962
|
].filter(Boolean).join("::"), se = (e, n) => ({
|
|
1958
1963
|
listPrice: e.listPrice / 100,
|
|
1959
1964
|
price: e.sellingPrice / 100,
|
|
@@ -1963,65 +1968,65 @@ const Or = (e) => {
|
|
|
1963
1968
|
sku: e.id,
|
|
1964
1969
|
image: [],
|
|
1965
1970
|
name: e.name,
|
|
1966
|
-
additionalProperty: e.attachments.map(
|
|
1971
|
+
additionalProperty: e.attachments.map(fn)
|
|
1967
1972
|
},
|
|
1968
1973
|
index: n
|
|
1969
|
-
}),
|
|
1974
|
+
}), Er = (e) => ({
|
|
1970
1975
|
quantity: e.quantity,
|
|
1971
1976
|
seller: e.seller.identifier,
|
|
1972
1977
|
id: e.itemOffered.sku,
|
|
1973
1978
|
index: e.index,
|
|
1974
|
-
attachments: (e.itemOffered.additionalProperty?.filter(
|
|
1979
|
+
attachments: (e.itemOffered.additionalProperty?.filter(In) ?? []).map((n) => ({
|
|
1975
1980
|
name: n.name,
|
|
1976
1981
|
content: n.value
|
|
1977
1982
|
})),
|
|
1978
1983
|
...e.priceToken ? { priceToken: e.priceToken } : {}
|
|
1979
|
-
}),
|
|
1980
|
-
const r =
|
|
1984
|
+
}), xe = (e) => e.reduce((n, t) => {
|
|
1985
|
+
const r = ve(t);
|
|
1981
1986
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
1982
|
-
}, /* @__PURE__ */ new Map()),
|
|
1987
|
+
}, /* @__PURE__ */ new Map()), Rr = (e, n) => {
|
|
1983
1988
|
const t = ({ priceToken: s, ...c }, l) => ({
|
|
1984
1989
|
...c,
|
|
1985
1990
|
itemOffered: {
|
|
1986
1991
|
sku: c.itemOffered.sku
|
|
1987
1992
|
},
|
|
1988
1993
|
index: l
|
|
1989
|
-
}), r = n.items.map(se).map(t), i = e.acceptedOffer.map(t),
|
|
1990
|
-
return
|
|
1994
|
+
}), r = n.items.map(se).map(t), i = e.acceptedOffer.map(t), o = e.orderNumber === n.orderFormId, a = De(r, i);
|
|
1995
|
+
return o && a;
|
|
1991
1996
|
};
|
|
1992
|
-
function
|
|
1997
|
+
function vn(e, n) {
|
|
1993
1998
|
return e?.some(
|
|
1994
1999
|
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 && e[t.parentItemIndex]?.id === n
|
|
1995
2000
|
);
|
|
1996
2001
|
}
|
|
1997
|
-
function
|
|
2002
|
+
function On(e, n) {
|
|
1998
2003
|
return e?.some(
|
|
1999
2004
|
(t) => t.id === n && t.parentItemIndex !== null
|
|
2000
2005
|
);
|
|
2001
2006
|
}
|
|
2002
|
-
const
|
|
2007
|
+
const qe = (e) => {
|
|
2003
2008
|
const n = e.items.reduce(
|
|
2004
2009
|
(t, r, i) => {
|
|
2005
|
-
const
|
|
2006
|
-
return t[
|
|
2010
|
+
const o = On(e.items, r.id) || vn(e.items, r.id) ? `${ve(se(r))}::${i}` : ve(se(r));
|
|
2011
|
+
return t[o] || (t[o] = []), t[o].push(r), t;
|
|
2007
2012
|
},
|
|
2008
2013
|
{}
|
|
2009
2014
|
);
|
|
2010
2015
|
return {
|
|
2011
2016
|
...e,
|
|
2012
2017
|
items: Object.values(n).map((t) => {
|
|
2013
|
-
const [r] = t, i = t.reduce((
|
|
2014
|
-
(
|
|
2018
|
+
const [r] = t, i = t.reduce((a, s) => a + s.quantity, 0), o = t.reduce(
|
|
2019
|
+
(a, s) => a + (s?.priceDefinition?.total ?? (s?.quantity ?? 0) * (s?.sellingPrice ?? 0)),
|
|
2015
2020
|
0
|
|
2016
2021
|
);
|
|
2017
2022
|
return {
|
|
2018
2023
|
...r,
|
|
2019
2024
|
quantity: i,
|
|
2020
|
-
sellingPrice:
|
|
2025
|
+
sellingPrice: o / i
|
|
2021
2026
|
};
|
|
2022
2027
|
})
|
|
2023
2028
|
};
|
|
2024
|
-
},
|
|
2029
|
+
}, je = async (e, n, t) => ({
|
|
2025
2030
|
order: {
|
|
2026
2031
|
orderNumber: e.orderFormId,
|
|
2027
2032
|
acceptedOffer: e.items.map(async (r) => ({
|
|
@@ -2034,7 +2039,7 @@ const je = (e) => {
|
|
|
2034
2039
|
text: r,
|
|
2035
2040
|
status: i.toUpperCase()
|
|
2036
2041
|
}))
|
|
2037
|
-
}),
|
|
2042
|
+
}), Cn = ({ items: e }, n) => {
|
|
2038
2043
|
const t = e.map((r) => ({
|
|
2039
2044
|
id: r.id,
|
|
2040
2045
|
quantity: r.quantity,
|
|
@@ -2042,16 +2047,16 @@ const je = (e) => {
|
|
|
2042
2047
|
attachments: r.attachments
|
|
2043
2048
|
// customizations
|
|
2044
2049
|
}));
|
|
2045
|
-
return
|
|
2050
|
+
return hn(
|
|
2046
2051
|
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
2047
2052
|
);
|
|
2048
|
-
},
|
|
2053
|
+
}, We = async (e, n, t) => {
|
|
2049
2054
|
try {
|
|
2050
2055
|
return await n.checkout.setCustomData({
|
|
2051
2056
|
id: e.orderFormId,
|
|
2052
2057
|
appId: "faststore",
|
|
2053
2058
|
key: "cartEtag",
|
|
2054
|
-
value:
|
|
2059
|
+
value: Cn(e, t)
|
|
2055
2060
|
});
|
|
2056
2061
|
} catch (r) {
|
|
2057
2062
|
throw console.error(
|
|
@@ -2061,22 +2066,22 @@ const je = (e) => {
|
|
|
2061
2066
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
2062
2067
|
), r;
|
|
2063
2068
|
}
|
|
2064
|
-
},
|
|
2069
|
+
}, Fr = (e, n) => {
|
|
2065
2070
|
const r = e.customData?.customApps.find(
|
|
2066
|
-
(
|
|
2071
|
+
(o) => o.id === "faststore"
|
|
2067
2072
|
)?.fields?.cartEtag;
|
|
2068
|
-
return r == null ? !0 :
|
|
2069
|
-
},
|
|
2073
|
+
return r == null ? !0 : Cn(e, n) !== r;
|
|
2074
|
+
}, Nr = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
2070
2075
|
id: e
|
|
2071
|
-
}),
|
|
2076
|
+
}), Ge = async (e, n, { clients: { commerce: t } }) => {
|
|
2072
2077
|
if (!n)
|
|
2073
2078
|
return e;
|
|
2074
|
-
const { updateShipping: r, addressChanged: i } =
|
|
2079
|
+
const { updateShipping: r, addressChanged: i } = yn(
|
|
2075
2080
|
e,
|
|
2076
2081
|
n
|
|
2077
2082
|
);
|
|
2078
2083
|
if (r) {
|
|
2079
|
-
const
|
|
2084
|
+
const o = Dr(e, n, i), s = o || wr(n);
|
|
2080
2085
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
2081
2086
|
{
|
|
2082
2087
|
id: e.orderFormId,
|
|
@@ -2096,116 +2101,116 @@ const je = (e) => {
|
|
|
2096
2101
|
);
|
|
2097
2102
|
}
|
|
2098
2103
|
return e;
|
|
2099
|
-
},
|
|
2104
|
+
}, Lr = (e, n) => {
|
|
2100
2105
|
if (!e)
|
|
2101
2106
|
return "";
|
|
2102
2107
|
const r = Z(e)[n];
|
|
2103
2108
|
return r ? r.split("=")[1] : "";
|
|
2104
|
-
},
|
|
2105
|
-
const i =
|
|
2109
|
+
}, Br = async (e, { cart: { order: n }, session: t }, r) => {
|
|
2110
|
+
const i = Lr(
|
|
2106
2111
|
r.headers.cookie,
|
|
2107
2112
|
"checkout.vtex.com"
|
|
2108
2113
|
), {
|
|
2109
|
-
clients: { commerce:
|
|
2110
|
-
loaders: { skuLoader:
|
|
2114
|
+
clients: { commerce: o },
|
|
2115
|
+
loaders: { skuLoader: a }
|
|
2111
2116
|
} = r, s = t?.channel, c = t?.locale;
|
|
2112
|
-
s &&
|
|
2113
|
-
const l = await
|
|
2117
|
+
s && ye(r, s), c && Ie(r, c);
|
|
2118
|
+
const l = await o.checkout.orderForm({
|
|
2114
2119
|
id: i || void 0,
|
|
2115
2120
|
channel: r.storage.channel
|
|
2116
2121
|
}), g = l.orderFormId;
|
|
2117
|
-
l.messages.length !== 0 && await
|
|
2122
|
+
l.messages.length !== 0 && await Nr(g, r);
|
|
2118
2123
|
const u = Z(r?.headers?.cookie ?? "")?.vtex_session, h = Y(u), { acceptedOffer: f, shouldSplitItem: v } = n;
|
|
2119
|
-
if (
|
|
2120
|
-
const b = await
|
|
2124
|
+
if (Fr(l, h)) {
|
|
2125
|
+
const b = await We(
|
|
2121
2126
|
l,
|
|
2122
|
-
|
|
2127
|
+
o,
|
|
2123
2128
|
h
|
|
2124
|
-
).then(
|
|
2129
|
+
).then(qe);
|
|
2125
2130
|
if (g)
|
|
2126
|
-
return
|
|
2131
|
+
return je(b, a, v);
|
|
2127
2132
|
}
|
|
2128
|
-
const p =
|
|
2133
|
+
const p = xe(f), m = xe(l.items.map(se)), y = Array.from(m.entries()), O = Array.from(p.entries()), { itemsToAdd: w, itemsToUpdate: C } = O.reduce(
|
|
2129
2134
|
(b, [U, T]) => {
|
|
2130
2135
|
const x = m.get(U);
|
|
2131
2136
|
if (!x)
|
|
2132
2137
|
return T.forEach((q) => b.itemsToAdd.push(q)), b;
|
|
2133
|
-
const [E, ...
|
|
2134
|
-
if (
|
|
2138
|
+
const [E, ...Ae] = x;
|
|
2139
|
+
if (On(l.items, E.itemOffered.sku) || vn(l.items, E.itemOffered.sku))
|
|
2135
2140
|
return b.itemsToUpdate.push(E), b;
|
|
2136
|
-
const de = T.reduce((q,
|
|
2141
|
+
const de = T.reduce((q, Un) => q + Un.quantity, 0);
|
|
2137
2142
|
return b.itemsToUpdate.push({
|
|
2138
2143
|
...E,
|
|
2139
2144
|
quantity: de
|
|
2140
|
-
}),
|
|
2145
|
+
}), Ae.forEach((q) => b.itemsToUpdate.push({ ...q, quantity: 0 })), b;
|
|
2141
2146
|
},
|
|
2142
2147
|
{
|
|
2143
2148
|
itemsToAdd: [],
|
|
2144
2149
|
itemsToUpdate: []
|
|
2145
2150
|
}
|
|
2146
|
-
),
|
|
2147
|
-
|
|
2148
|
-
), { updateShipping: D } = t ?
|
|
2151
|
+
), P = y.filter(([b]) => !p.has(b)).flatMap(([, b]) => b.map((U) => ({ ...U, quantity: 0 }))), S = [...w, ...C, ...P].map(
|
|
2152
|
+
Er
|
|
2153
|
+
), { updateShipping: D } = t ? yn(l, t) : { updateShipping: !1 };
|
|
2149
2154
|
if (S.length === 0 && !D)
|
|
2150
2155
|
return null;
|
|
2151
|
-
let
|
|
2152
|
-
S.length > 0 ?
|
|
2156
|
+
let A;
|
|
2157
|
+
S.length > 0 ? A = await o.checkout.updateOrderFormItems({
|
|
2153
2158
|
id: l.orderFormId,
|
|
2154
2159
|
orderItems: S,
|
|
2155
2160
|
shouldSplitItem: v
|
|
2156
2161
|
}).then(
|
|
2157
|
-
(b) =>
|
|
2158
|
-
) :
|
|
2162
|
+
(b) => Ge(b, t, r)
|
|
2163
|
+
) : A = await Ge(
|
|
2159
2164
|
l,
|
|
2160
2165
|
t,
|
|
2161
2166
|
r
|
|
2162
|
-
),
|
|
2167
|
+
), A = await Promise.resolve(A).then((b) => {
|
|
2163
2168
|
if (t?.marketingData) {
|
|
2164
2169
|
const U = {
|
|
2165
2170
|
...b.marketingData,
|
|
2166
2171
|
...t.marketingData
|
|
2167
2172
|
};
|
|
2168
|
-
return
|
|
2173
|
+
return o.checkout.marketingData({
|
|
2169
2174
|
id: l.orderFormId,
|
|
2170
2175
|
marketingData: U
|
|
2171
2176
|
});
|
|
2172
2177
|
}
|
|
2173
2178
|
return b;
|
|
2174
|
-
}).then((b) => c && b.clientPreferencesData?.locale !== c ?
|
|
2179
|
+
}).then((b) => c && b.clientPreferencesData?.locale !== c ? o.checkout.clientPreferencesData({
|
|
2175
2180
|
id: b.orderFormId,
|
|
2176
2181
|
clientPreferencesData: {
|
|
2177
2182
|
...b.clientPreferencesData,
|
|
2178
2183
|
locale: c
|
|
2179
2184
|
}
|
|
2180
|
-
}) : b).then((b) =>
|
|
2181
|
-
const k =
|
|
2185
|
+
}) : b).then((b) => We(b, o, h)).then(qe);
|
|
2186
|
+
const k = De(
|
|
2182
2187
|
l.messages,
|
|
2183
|
-
|
|
2188
|
+
A.messages
|
|
2184
2189
|
);
|
|
2185
|
-
return
|
|
2186
|
-
},
|
|
2190
|
+
return Rr(n, A) && k ? null : je(A, a, v);
|
|
2191
|
+
}, $r = (e) => {
|
|
2187
2192
|
const n = (e?.corporateName ?? "").trim();
|
|
2188
2193
|
return n || (e?.firstName ?? "").trim();
|
|
2189
|
-
},
|
|
2194
|
+
}, Mr = (e) => {
|
|
2190
2195
|
if (!e || typeof e != "object")
|
|
2191
2196
|
return !1;
|
|
2192
2197
|
const n = e;
|
|
2193
2198
|
return typeof n.customerId == "string" && n.customerId.trim() !== "" && typeof n.contractName == "string" && typeof n.isActive == "boolean" && typeof n.isCurrent == "boolean";
|
|
2194
|
-
},
|
|
2199
|
+
}, zr = (e) => {
|
|
2195
2200
|
const n = e?.availableContracts?.value;
|
|
2196
|
-
return Array.isArray(n) ? n.filter(
|
|
2197
|
-
},
|
|
2201
|
+
return Array.isArray(n) ? n.filter(Mr) : [];
|
|
2202
|
+
}, Vr = (e) => e?.customerId ? !!((e.contractName ?? "").trim() && e.isActive) : !1, He = (e) => e?.namespaces?.shopper?.activeContractId?.value?.trim() ?? e?.namespaces?.authentication?.customerId?.value?.trim() ?? e?.namespaces?.profile?.id?.value?.trim() ?? "", xr = (e, n = "") => {
|
|
2198
2203
|
const t = n.trim();
|
|
2199
|
-
return e.filter(
|
|
2204
|
+
return e.filter(Vr).map((r) => ({
|
|
2200
2205
|
id: r.customerId,
|
|
2201
2206
|
corporateName: r.contractName.trim(),
|
|
2202
2207
|
isActive: t ? r.customerId === t : r.isCurrent
|
|
2203
2208
|
}));
|
|
2204
|
-
},
|
|
2205
|
-
const t =
|
|
2209
|
+
}, bn = (e, n) => {
|
|
2210
|
+
const t = $r(e);
|
|
2206
2211
|
return t || (n?.firstName?.value ?? "").trim();
|
|
2207
2212
|
};
|
|
2208
|
-
async function
|
|
2213
|
+
async function qr(e, n, t) {
|
|
2209
2214
|
try {
|
|
2210
2215
|
const r = await e.commerce.checkout.address({
|
|
2211
2216
|
postalCode: t,
|
|
@@ -2222,11 +2227,11 @@ async function zr(e, n, t) {
|
|
|
2222
2227
|
), r;
|
|
2223
2228
|
}
|
|
2224
2229
|
}
|
|
2225
|
-
const
|
|
2226
|
-
const
|
|
2230
|
+
const jr = async (e, { session: n, search: t }, { clients: r, headers: i, account: o }) => {
|
|
2231
|
+
const a = ae.parse(n.channel ?? ""), s = String(n.postalCode ?? ""), c = n.country ?? "";
|
|
2227
2232
|
let l = n.city ?? null, g = n.geoCoordinates ?? null;
|
|
2228
2233
|
if ((!l || !g) && s !== "" && c !== "") {
|
|
2229
|
-
const E = await
|
|
2234
|
+
const E = await qr(
|
|
2230
2235
|
r,
|
|
2231
2236
|
c,
|
|
2232
2237
|
s
|
|
@@ -2235,7 +2240,7 @@ const Vr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2235
2240
|
}
|
|
2236
2241
|
const h = new URLSearchParams(t);
|
|
2237
2242
|
h.has("facets") && h.delete("facets");
|
|
2238
|
-
const f = h.get("sc") ??
|
|
2243
|
+
const f = h.get("sc") ?? a.salesChannel;
|
|
2239
2244
|
h.set("sc", f), s && h.set("postalCode", s), c && h.set("country", c), g && h.set(
|
|
2240
2245
|
"geoCoordinates",
|
|
2241
2246
|
`${g.longitude},${g.latitude}`
|
|
@@ -2248,7 +2253,7 @@ const Vr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2248
2253
|
utmiCampaign: h.get("utmi_cp") ?? v?.utmiCampaign ?? "",
|
|
2249
2254
|
utmiPage: h.get("utmi_p") ?? v?.utmiPage ?? "",
|
|
2250
2255
|
utmiPart: h.get("utmi_pc") ?? v?.utmiPart ?? ""
|
|
2251
|
-
}, p = Y(z(i?.cookie ?? "",
|
|
2256
|
+
}, p = Y(z(i?.cookie ?? "", o));
|
|
2252
2257
|
let m = !1;
|
|
2253
2258
|
if (p)
|
|
2254
2259
|
try {
|
|
@@ -2256,26 +2261,26 @@ const Vr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2256
2261
|
} catch (E) {
|
|
2257
2262
|
console.warn("JWT validation failed:", E), m = !1;
|
|
2258
2263
|
}
|
|
2259
|
-
const y = m ? p?.isRepresentative : !1, O = m ? p?.customerId : void 0, w = m ? p?.unitId : void 0, C = await r.commerce.session(h.toString()).catch(() => null),
|
|
2264
|
+
const y = m ? p?.isRepresentative : !1, O = m ? p?.customerId : void 0, w = m ? p?.unitId : void 0, C = await r.commerce.session(h.toString()).catch(() => null), P = C?.namespaces.profile ?? null, S = C?.namespaces.shopper ?? null, D = C?.namespaces.store ?? null, A = C?.namespaces.authentication ?? null, k = C?.namespaces.checkout ?? null, b = C?.namespaces.public ?? null;
|
|
2260
2265
|
let U = null;
|
|
2261
|
-
if (y &&
|
|
2266
|
+
if (y && P?.id?.value)
|
|
2262
2267
|
try {
|
|
2263
2268
|
U = await r.commerce.masterData.getContractById({
|
|
2264
|
-
contractId:
|
|
2269
|
+
contractId: P.id.value
|
|
2265
2270
|
});
|
|
2266
2271
|
} catch {
|
|
2267
2272
|
console.error(
|
|
2268
|
-
`Error while getting contract data for profile ID (${
|
|
2273
|
+
`Error while getting contract data for profile ID (${P.id.value}).
|
|
2269
2274
|
`
|
|
2270
2275
|
);
|
|
2271
2276
|
}
|
|
2272
2277
|
let T;
|
|
2273
|
-
|
|
2278
|
+
a.seller && (s || g) && (T = (await r.commerce.checkout.region({
|
|
2274
2279
|
postalCode: s,
|
|
2275
2280
|
geoCoordinates: g,
|
|
2276
2281
|
country: c,
|
|
2277
2282
|
salesChannel: f
|
|
2278
|
-
}))?.[0]?.sellers.find((de) =>
|
|
2283
|
+
}))?.[0]?.sellers.find((de) => a.seller === de.id));
|
|
2279
2284
|
const x = {
|
|
2280
2285
|
...n,
|
|
2281
2286
|
currency: {
|
|
@@ -2283,9 +2288,9 @@ const Vr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2283
2288
|
symbol: D?.currencySymbol?.value ?? n.currency.symbol
|
|
2284
2289
|
},
|
|
2285
2290
|
country: D?.countryCode?.value ?? c,
|
|
2286
|
-
channel:
|
|
2287
|
-
salesChannel: D?.channel?.value ??
|
|
2288
|
-
regionId: k?.regionId?.value ??
|
|
2291
|
+
channel: ae.stringify({
|
|
2292
|
+
salesChannel: D?.channel?.value ?? a.salesChannel,
|
|
2293
|
+
regionId: k?.regionId?.value ?? a.regionId,
|
|
2289
2294
|
seller: T?.id,
|
|
2290
2295
|
hasOnlyDefaultSalesChannel: !D?.channel?.value
|
|
2291
2296
|
}),
|
|
@@ -2297,59 +2302,59 @@ const Vr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2297
2302
|
*/
|
|
2298
2303
|
b2b: y ? {
|
|
2299
2304
|
isRepresentative: y ?? !1,
|
|
2300
|
-
customerId:
|
|
2301
|
-
unitName:
|
|
2302
|
-
unitId:
|
|
2305
|
+
customerId: A?.customerId?.value ?? O ?? "",
|
|
2306
|
+
unitName: A?.unitName?.value ?? "",
|
|
2307
|
+
unitId: A?.unitId?.value ?? w ?? "",
|
|
2303
2308
|
firstName: typeof S?.firstName?.value == "string" ? S.firstName.value : "",
|
|
2304
2309
|
lastName: typeof S?.lastName?.value == "string" ? S.lastName.value : "",
|
|
2305
2310
|
userName: `${typeof S?.firstName?.value == "string" ? S.firstName.value : ""} ${typeof S?.lastName?.value == "string" ? S.lastName.value : ""}`.trim(),
|
|
2306
|
-
userEmail:
|
|
2311
|
+
userEmail: A?.storeUserEmail.value ?? "",
|
|
2307
2312
|
savedPostalCode: b?.postalCode?.value ?? "",
|
|
2308
|
-
contractName:
|
|
2313
|
+
contractName: bn(U, P),
|
|
2309
2314
|
organizationManager: S?.organizationManager?.value ?? !1
|
|
2310
2315
|
} : null,
|
|
2311
2316
|
marketingData: d,
|
|
2312
|
-
person:
|
|
2313
|
-
id:
|
|
2314
|
-
email:
|
|
2315
|
-
givenName:
|
|
2316
|
-
familyName:
|
|
2317
|
+
person: P?.id ? {
|
|
2318
|
+
id: P.id?.value ?? "",
|
|
2319
|
+
email: P.email?.value ?? "",
|
|
2320
|
+
givenName: P.firstName?.value ?? "",
|
|
2321
|
+
familyName: P.lastName?.value ?? ""
|
|
2317
2322
|
} : null,
|
|
2318
2323
|
geoCoordinates: g?.latitude && g?.longitude && g || null,
|
|
2319
2324
|
city: l
|
|
2320
2325
|
};
|
|
2321
|
-
return
|
|
2322
|
-
},
|
|
2323
|
-
validateCart:
|
|
2324
|
-
validateSession:
|
|
2325
|
-
subscribeToNewsletter:
|
|
2326
|
-
cancelOrder:
|
|
2327
|
-
processOrderAuthorization:
|
|
2328
|
-
uploadFileToOrderEntry:
|
|
2329
|
-
startOrderEntryOperation:
|
|
2330
|
-
startRecommendationSession:
|
|
2326
|
+
return De(n, x) ? null : x;
|
|
2327
|
+
}, Wr = {
|
|
2328
|
+
validateCart: Br,
|
|
2329
|
+
validateSession: jr,
|
|
2330
|
+
subscribeToNewsletter: Or,
|
|
2331
|
+
cancelOrder: fr,
|
|
2332
|
+
processOrderAuthorization: yr,
|
|
2333
|
+
uploadFileToOrderEntry: Cr,
|
|
2334
|
+
startOrderEntryOperation: Ir,
|
|
2335
|
+
startRecommendationSession: vr
|
|
2331
2336
|
};
|
|
2332
|
-
var
|
|
2337
|
+
var Oe;
|
|
2333
2338
|
(function(e) {
|
|
2334
2339
|
e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension";
|
|
2335
|
-
})(
|
|
2336
|
-
const
|
|
2337
|
-
function
|
|
2340
|
+
})(Oe || (Oe = {}));
|
|
2341
|
+
const Gr = (e) => typeof e == "string" ? wn(e) : null;
|
|
2342
|
+
function wn(e) {
|
|
2338
2343
|
try {
|
|
2339
2344
|
return JSON.parse(e);
|
|
2340
2345
|
} catch {
|
|
2341
2346
|
return e;
|
|
2342
2347
|
}
|
|
2343
2348
|
}
|
|
2344
|
-
const
|
|
2349
|
+
const Hr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Xr = new En({
|
|
2345
2350
|
name: "ObjectOrString",
|
|
2346
2351
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2347
|
-
parseValue:
|
|
2348
|
-
serialize:
|
|
2352
|
+
parseValue: Gr,
|
|
2353
|
+
serialize: Hr,
|
|
2349
2354
|
parseLiteral(e) {
|
|
2350
|
-
return e.kind ===
|
|
2355
|
+
return e.kind === Oe.STRING ? wn(e.value) : null;
|
|
2351
2356
|
}
|
|
2352
|
-
}), R = (e) => "Price" in e && "seller" in e && "product" in e, F = (e) => "skuName" in e,
|
|
2357
|
+
}), R = (e) => "Price" in e && "seller" in e && "product" in e, F = (e) => "skuName" in e, Yr = {
|
|
2353
2358
|
priceCurrency: async (e, n, t) => {
|
|
2354
2359
|
const {
|
|
2355
2360
|
loaders: { salesChannelLoader: r },
|
|
@@ -2359,7 +2364,7 @@ const jr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2359
2364
|
},
|
|
2360
2365
|
priceValidUntil: (e) => R(e) ? e.PriceValidUntil ?? "" : F(e) ? e.priceValidUntil ?? "" : null,
|
|
2361
2366
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2362
|
-
availability: async (e) => R(e) ?
|
|
2367
|
+
availability: async (e) => R(e) ? Ne(L(e)) : F(e) ? Ne(nr(e.availability)) : null,
|
|
2363
2368
|
seller: (e, n, t) => R(e) ? {
|
|
2364
2369
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2365
2370
|
} : F(e) ? {
|
|
@@ -2371,7 +2376,7 @@ const jr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2371
2376
|
e.tax / 100,
|
|
2372
2377
|
e.unitMultiplier
|
|
2373
2378
|
) : null,
|
|
2374
|
-
sellingPrice: (e) => R(e) ?
|
|
2379
|
+
sellingPrice: (e) => R(e) ? er(e) : F(e) ? e.sellingPrice / 100 : null,
|
|
2375
2380
|
listPrice: (e) => R(e) ? e.ListPrice ?? 0 : F(e) ? e.listPrice / 100 : null,
|
|
2376
2381
|
listPriceWithTaxes: (e) => R(e) ? M(
|
|
2377
2382
|
e.ListPrice ?? 0,
|
|
@@ -2385,7 +2390,7 @@ const jr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2385
2390
|
quantity: (e) => R(e) ? e.AvailableQuantity ?? 0 : F(e) ? e.quantity : null,
|
|
2386
2391
|
isGift: (e) => F(e) ? e.isGift ?? !1 : null,
|
|
2387
2392
|
priceToken: (e) => R(e) ? e.PriceToken ?? null : null
|
|
2388
|
-
},
|
|
2393
|
+
}, Jr = ({ linkText: e }) => `/${e}/p`, Kr = ({
|
|
2389
2394
|
offer: e,
|
|
2390
2395
|
seller: n,
|
|
2391
2396
|
product: t
|
|
@@ -2393,20 +2398,20 @@ const jr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2393
2398
|
...e,
|
|
2394
2399
|
product: t,
|
|
2395
2400
|
seller: n
|
|
2396
|
-
}),
|
|
2401
|
+
}), Qr = {
|
|
2397
2402
|
imageText: "image",
|
|
2398
2403
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2399
2404
|
imageLabel: "label"
|
|
2400
|
-
}, ie = (e, n) => `${e}-${n}`,
|
|
2401
|
-
function
|
|
2405
|
+
}, ie = (e, n) => `${e}-${n}`, Xe = (e, n) => `/${ie(e, n)}/p`, Zr = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2406
|
+
function Ce(e) {
|
|
2402
2407
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2403
2408
|
}
|
|
2404
|
-
async function
|
|
2409
|
+
async function be(e, n, t) {
|
|
2405
2410
|
const r = `${n}:${t}`;
|
|
2406
2411
|
e.storage.productTranslationsCache ??= /* @__PURE__ */ new Map();
|
|
2407
|
-
const i = e.storage.productTranslationsCache,
|
|
2408
|
-
if (
|
|
2409
|
-
const
|
|
2412
|
+
const i = e.storage.productTranslationsCache, o = i.get(r);
|
|
2413
|
+
if (o) return o;
|
|
2414
|
+
const a = (async () => {
|
|
2410
2415
|
try {
|
|
2411
2416
|
const s = await e.clients.catalog.getLocalizedProduct(
|
|
2412
2417
|
n,
|
|
@@ -2421,12 +2426,12 @@ async function De(e, n, t) {
|
|
|
2421
2426
|
return null;
|
|
2422
2427
|
}
|
|
2423
2428
|
})();
|
|
2424
|
-
return i.set(r,
|
|
2429
|
+
return i.set(r, a), a;
|
|
2425
2430
|
}
|
|
2426
|
-
const
|
|
2427
|
-
const t = e.findIndex((r) =>
|
|
2431
|
+
const ei = (e, n) => {
|
|
2432
|
+
const t = e.findIndex((r) => Ce(r).split("/").at(-1) === n);
|
|
2428
2433
|
return t < 0 ? 0 : t;
|
|
2429
|
-
},
|
|
2434
|
+
}, ni = {
|
|
2430
2435
|
productID: ({ itemId: e }) => e,
|
|
2431
2436
|
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2432
2437
|
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => ie(e, n),
|
|
@@ -2434,7 +2439,7 @@ const Kr = (e, n) => {
|
|
|
2434
2439
|
seo: ({ isVariantOf: e }) => ({
|
|
2435
2440
|
title: e.productTitle || e.productName,
|
|
2436
2441
|
description: e.metaTagDescription || e.description,
|
|
2437
|
-
canonical:
|
|
2442
|
+
canonical: Jr(e)
|
|
2438
2443
|
}),
|
|
2439
2444
|
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2440
2445
|
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
@@ -2443,18 +2448,18 @@ const Kr = (e, n) => {
|
|
|
2443
2448
|
isVariantOf: {
|
|
2444
2449
|
categories: r,
|
|
2445
2450
|
productName: i,
|
|
2446
|
-
linkText:
|
|
2447
|
-
categoryId:
|
|
2451
|
+
linkText: o,
|
|
2452
|
+
categoryId: a,
|
|
2448
2453
|
categoriesIds: s,
|
|
2449
2454
|
productId: c
|
|
2450
2455
|
},
|
|
2451
2456
|
itemId: l
|
|
2452
|
-
} = e, g =
|
|
2457
|
+
} = e, g = ei(s, a), u = r[g], h = Ce(u).split("/"), f = t.storage.locale;
|
|
2453
2458
|
if (Q(t) && f) {
|
|
2454
|
-
const v = await
|
|
2459
|
+
const v = await be(t, c, f);
|
|
2455
2460
|
if (v) {
|
|
2456
2461
|
const d = new Set(
|
|
2457
|
-
|
|
2462
|
+
Ce(s[g]).split("/").filter(Boolean)
|
|
2458
2463
|
), p = v.categories.filter((y) => d.has(y.id.toString())).sort(
|
|
2459
2464
|
(y, O) => y.fullPath.split("/").length - O.fullPath.split("/").length
|
|
2460
2465
|
);
|
|
@@ -2470,7 +2475,7 @@ const Kr = (e, n) => {
|
|
|
2470
2475
|
})),
|
|
2471
2476
|
{
|
|
2472
2477
|
name: i,
|
|
2473
|
-
item:
|
|
2478
|
+
item: Xe(v.linkId, l),
|
|
2474
2479
|
position: h.length + 1
|
|
2475
2480
|
}
|
|
2476
2481
|
],
|
|
@@ -2481,7 +2486,7 @@ const Kr = (e, n) => {
|
|
|
2481
2486
|
return {
|
|
2482
2487
|
itemListElement: [
|
|
2483
2488
|
...h.map((v, d) => {
|
|
2484
|
-
const p = `/${h.slice(0, d + 1).map(
|
|
2489
|
+
const p = `/${h.slice(0, d + 1).map(oe).join("/")}/`;
|
|
2485
2490
|
return {
|
|
2486
2491
|
name: v,
|
|
2487
2492
|
item: p,
|
|
@@ -2490,7 +2495,7 @@ const Kr = (e, n) => {
|
|
|
2490
2495
|
}),
|
|
2491
2496
|
{
|
|
2492
2497
|
name: i,
|
|
2493
|
-
item:
|
|
2498
|
+
item: Xe(o, l),
|
|
2494
2499
|
position: h.length + 1
|
|
2495
2500
|
}
|
|
2496
2501
|
],
|
|
@@ -2498,7 +2503,7 @@ const Kr = (e, n) => {
|
|
|
2498
2503
|
};
|
|
2499
2504
|
},
|
|
2500
2505
|
image: ({ images: e }, n) => {
|
|
2501
|
-
const t = (
|
|
2506
|
+
const t = (Zr(e) ?? [Qr]).map(
|
|
2502
2507
|
({ imageUrl: s, imageText: c, imageLabel: l }) => ({
|
|
2503
2508
|
alternateName: c ?? "",
|
|
2504
2509
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
@@ -2508,12 +2513,12 @@ const Kr = (e, n) => {
|
|
|
2508
2513
|
if (typeof n != "object")
|
|
2509
2514
|
return t;
|
|
2510
2515
|
let { context: r, limit: i } = n;
|
|
2511
|
-
const
|
|
2516
|
+
const o = r !== "generic";
|
|
2512
2517
|
i = i || -1, i = i <= -1 ? void 0 : i;
|
|
2513
|
-
let
|
|
2518
|
+
let a = o ? t.filter(
|
|
2514
2519
|
({ keywords: s }) => s === r
|
|
2515
2520
|
) : t;
|
|
2516
|
-
return
|
|
2521
|
+
return a = a.length === 0 ? t : a, a.slice(0, i);
|
|
2517
2522
|
},
|
|
2518
2523
|
sku: ({ itemId: e }) => e,
|
|
2519
2524
|
gtin: ({ ean: e, referenceId: n }) => e || (n[0]?.Value ?? ""),
|
|
@@ -2521,12 +2526,12 @@ const Kr = (e, n) => {
|
|
|
2521
2526
|
review: () => [],
|
|
2522
2527
|
aggregateRating: () => ({}),
|
|
2523
2528
|
offers: (e) => e.sellers.map(
|
|
2524
|
-
(n) =>
|
|
2529
|
+
(n) => Kr({
|
|
2525
2530
|
offer: n.commertialOffer,
|
|
2526
2531
|
seller: n,
|
|
2527
2532
|
product: e
|
|
2528
2533
|
})
|
|
2529
|
-
).sort(
|
|
2534
|
+
).sort(un),
|
|
2530
2535
|
isVariantOf: (e) => e,
|
|
2531
2536
|
additionalProperty: ({
|
|
2532
2537
|
// Search uses the name variations for specifications
|
|
@@ -2535,18 +2540,18 @@ const Kr = (e, n) => {
|
|
|
2535
2540
|
attributes: t = []
|
|
2536
2541
|
}) => {
|
|
2537
2542
|
const r = e.flatMap(
|
|
2538
|
-
({ name:
|
|
2539
|
-
name:
|
|
2543
|
+
({ name: a, values: s }) => s.map((c) => ({
|
|
2544
|
+
name: a,
|
|
2540
2545
|
value: c,
|
|
2541
2546
|
valueReference: ne.specification
|
|
2542
2547
|
}))
|
|
2543
2548
|
), i = n.map(
|
|
2544
|
-
|
|
2545
|
-
),
|
|
2549
|
+
fn
|
|
2550
|
+
), o = t.map(br);
|
|
2546
2551
|
return [
|
|
2547
2552
|
...r,
|
|
2548
2553
|
...i,
|
|
2549
|
-
...
|
|
2554
|
+
...o
|
|
2550
2555
|
];
|
|
2551
2556
|
},
|
|
2552
2557
|
hasSpecifications: ({ isVariantOf: e }) => !!e.skuSpecifications?.length,
|
|
@@ -2557,25 +2562,25 @@ const Kr = (e, n) => {
|
|
|
2557
2562
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e,
|
|
2558
2563
|
otherLocales: async (e, n, t) => {
|
|
2559
2564
|
if (!Q(t)) return null;
|
|
2560
|
-
const r =
|
|
2565
|
+
const r = St(t);
|
|
2561
2566
|
if (r.length === 0) return null;
|
|
2562
|
-
const i = e.isVariantOf.productId,
|
|
2567
|
+
const i = e.isVariantOf.productId, o = e.itemId, a = t.storage.locale, s = yt(t), c = await be(t, i, a);
|
|
2563
2568
|
if (!c?.availableLinkIds) return null;
|
|
2564
2569
|
const { availableLinkIds: l } = c, { linkText: g } = e.isVariantOf;
|
|
2565
2570
|
return r.map((u) => {
|
|
2566
2571
|
if (u === s)
|
|
2567
|
-
return { locale: u, slug: ie(g,
|
|
2572
|
+
return { locale: u, slug: ie(g, o) };
|
|
2568
2573
|
const h = l[u];
|
|
2569
|
-
return h ? { locale: u, slug: ie(h,
|
|
2574
|
+
return h ? { locale: u, slug: ie(h, o) } : null;
|
|
2570
2575
|
}).filter((u) => u !== null);
|
|
2571
2576
|
}
|
|
2572
|
-
},
|
|
2577
|
+
}, ti = /* @__PURE__ */ new Set(["allSpecifications"]), ri = {
|
|
2573
2578
|
hasVariant: (e) => e.isVariantOf.items.map((n) => N(n, e.isVariantOf)),
|
|
2574
2579
|
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
2575
2580
|
name: (e) => e.isVariantOf.productName,
|
|
2576
2581
|
skuVariants: (e) => e,
|
|
2577
2582
|
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
2578
|
-
(n) => !
|
|
2583
|
+
(n) => !ti.has(n.name)
|
|
2579
2584
|
).flatMap(
|
|
2580
2585
|
({ specifications: n }) => n.flatMap(
|
|
2581
2586
|
({ name: t, values: r }) => r.map((i) => ({
|
|
@@ -2585,8 +2590,8 @@ const Kr = (e, n) => {
|
|
|
2585
2590
|
}))
|
|
2586
2591
|
)
|
|
2587
2592
|
)
|
|
2588
|
-
},
|
|
2589
|
-
propertyID: (e) => e.propertyID ||
|
|
2593
|
+
}, ii = {
|
|
2594
|
+
propertyID: (e) => e.propertyID || Sn(e),
|
|
2590
2595
|
name: ({ name: e }) => e,
|
|
2591
2596
|
value: ({ value: e }) => e,
|
|
2592
2597
|
valueReference: ({ valueReference: e }) => e
|
|
@@ -2596,16 +2601,16 @@ const Kr = (e, n) => {
|
|
|
2596
2601
|
offer: i.commertialOffer,
|
|
2597
2602
|
sku: r
|
|
2598
2603
|
}))
|
|
2599
|
-
), t =
|
|
2604
|
+
), t = Se(
|
|
2600
2605
|
n,
|
|
2601
|
-
({ offer: r }, { offer: i }) =>
|
|
2606
|
+
({ offer: r }, { offer: i }) => un(r, i)
|
|
2602
2607
|
);
|
|
2603
2608
|
return t ? t.sku : e[0];
|
|
2604
|
-
},
|
|
2609
|
+
}, Dn = (e) => e !== "" && !Number.isNaN(Number(e)), oi = /^vrn:recommendations:[^:]+:[^:]+:[^:]+$/, ai = async (e, { campaignVrn: n, userId: t, products: r }, i) => {
|
|
2605
2610
|
const {
|
|
2606
|
-
clients: { commerce:
|
|
2607
|
-
} = i, { salesChannel:
|
|
2608
|
-
if (!s || !
|
|
2611
|
+
clients: { commerce: o }
|
|
2612
|
+
} = i, { salesChannel: a } = i.storage.channel, s = n?.trim();
|
|
2613
|
+
if (!s || !oi.test(s))
|
|
2609
2614
|
throw new _(`Invalid campaignVrn: "${n}"`);
|
|
2610
2615
|
const c = t?.trim();
|
|
2611
2616
|
if (t != null && !c)
|
|
@@ -2614,11 +2619,11 @@ const Kr = (e, n) => {
|
|
|
2614
2619
|
throw new _(
|
|
2615
2620
|
"Invalid products: must be an array of non-empty strings"
|
|
2616
2621
|
);
|
|
2617
|
-
const l = await
|
|
2622
|
+
const l = await o.recommendation.recommendations({
|
|
2618
2623
|
campaignVrn: s,
|
|
2619
2624
|
userId: c || void 0,
|
|
2620
2625
|
products: r ?? [],
|
|
2621
|
-
salesChannel:
|
|
2626
|
+
salesChannel: a ?? void 0,
|
|
2622
2627
|
locale: i.storage.locale
|
|
2623
2628
|
}), { campaign: g, correlationId: u } = l;
|
|
2624
2629
|
return {
|
|
@@ -2629,7 +2634,7 @@ const Kr = (e, n) => {
|
|
|
2629
2634
|
correlationId: u,
|
|
2630
2635
|
campaign: g
|
|
2631
2636
|
};
|
|
2632
|
-
},
|
|
2637
|
+
}, Ye = {
|
|
2633
2638
|
price_desc: "price:desc",
|
|
2634
2639
|
price_asc: "price:asc",
|
|
2635
2640
|
orders_desc: "orders:desc",
|
|
@@ -2638,11 +2643,11 @@ const Kr = (e, n) => {
|
|
|
2638
2643
|
release_desc: "release:desc",
|
|
2639
2644
|
discount_desc: "discount:desc",
|
|
2640
2645
|
score_desc: ""
|
|
2641
|
-
},
|
|
2646
|
+
}, si = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
2642
2647
|
if (!n)
|
|
2643
2648
|
throw new _("Missing operationId");
|
|
2644
2649
|
return t.orderEntry.getOperation({ operationId: n });
|
|
2645
|
-
},
|
|
2650
|
+
}, ci = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
2646
2651
|
if (!n)
|
|
2647
2652
|
throw new _("Missing orderFormId");
|
|
2648
2653
|
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
@@ -2658,49 +2663,49 @@ const Kr = (e, n) => {
|
|
|
2658
2663
|
unitMultiplier: i.unitMultiplier ?? 1
|
|
2659
2664
|
}));
|
|
2660
2665
|
};
|
|
2661
|
-
async function
|
|
2666
|
+
async function li(e, n, t, r) {
|
|
2662
2667
|
const i = n.slice(0, n.lastIndexOf("-"));
|
|
2663
|
-
return (await
|
|
2668
|
+
return (await be(e, t, r))?.linkId === i;
|
|
2664
2669
|
}
|
|
2665
|
-
const
|
|
2666
|
-
async function
|
|
2667
|
-
const { linkText: i, productId:
|
|
2668
|
-
if (!(!t || !i || t.startsWith(i) || Q(e) && r &&
|
|
2670
|
+
const An = "Invalid SkuId", Pn = "Slug was set but the fetched sku does not satisfy the slug condition.", di = (e) => X(e) || e instanceof Error && (e.message === An || e.message.startsWith(Pn));
|
|
2671
|
+
async function ui(e, n, t, r) {
|
|
2672
|
+
const { linkText: i, productId: o } = n.isVariantOf;
|
|
2673
|
+
if (!(!t || !i || t.startsWith(i) || Q(e) && r && Dn(t.split("-").pop() ?? "") && await li(e, t, o, r)))
|
|
2669
2674
|
throw new Error(`${Pn} slug: ${t}, linkText: ${i}`);
|
|
2670
2675
|
}
|
|
2671
|
-
async function
|
|
2676
|
+
async function pi(e, n) {
|
|
2672
2677
|
if (n == null)
|
|
2673
2678
|
throw new _("Missing slug or id");
|
|
2674
2679
|
const {
|
|
2675
2680
|
clients: { commerce: t, search: r }
|
|
2676
2681
|
} = e, i = await t.catalog.portal.pagetype(`${n}/p`);
|
|
2677
2682
|
if (i.pageType !== "Product" || !i.id)
|
|
2678
|
-
throw new
|
|
2679
|
-
const
|
|
2683
|
+
throw new B(`No product found for slug ${n}`);
|
|
2684
|
+
const o = await r.fetchProduct({
|
|
2680
2685
|
field: "id",
|
|
2681
2686
|
value: String(i.id)
|
|
2682
2687
|
}).catch(() => null);
|
|
2683
|
-
if (!
|
|
2684
|
-
throw new
|
|
2685
|
-
return N(ce(
|
|
2688
|
+
if (!o)
|
|
2689
|
+
throw new B(`No product found for id ${i.id}`);
|
|
2690
|
+
return N(ce(o.items), o);
|
|
2686
2691
|
}
|
|
2687
|
-
const
|
|
2692
|
+
const gi = {
|
|
2688
2693
|
product: async (e, { locator: n }, t) => {
|
|
2689
|
-
const r =
|
|
2690
|
-
r &&
|
|
2694
|
+
const r = Ve(n), i = ze(n), o = ur(n), a = dr(n);
|
|
2695
|
+
r && ye(t, r), i && Ie(t, i);
|
|
2691
2696
|
const {
|
|
2692
2697
|
loaders: { skuLoader: s }
|
|
2693
2698
|
} = t;
|
|
2694
2699
|
try {
|
|
2695
|
-
const c =
|
|
2696
|
-
if (!
|
|
2697
|
-
throw new Error(
|
|
2700
|
+
const c = o ?? a?.split("-").pop() ?? "";
|
|
2701
|
+
if (!Dn(c))
|
|
2702
|
+
throw new Error(An);
|
|
2698
2703
|
const l = await s.load(c);
|
|
2699
|
-
return await
|
|
2704
|
+
return await ui(t, l, a, i), l;
|
|
2700
2705
|
} catch (c) {
|
|
2701
|
-
if (!
|
|
2706
|
+
if (!di(c))
|
|
2702
2707
|
throw c;
|
|
2703
|
-
return
|
|
2708
|
+
return pi(t, a);
|
|
2704
2709
|
}
|
|
2705
2710
|
},
|
|
2706
2711
|
collection: (e, { slug: n }, t) => {
|
|
@@ -2717,22 +2722,22 @@ const di = {
|
|
|
2717
2722
|
after: t,
|
|
2718
2723
|
sort: r,
|
|
2719
2724
|
term: i,
|
|
2720
|
-
selectedFacets:
|
|
2721
|
-
sponsoredCount:
|
|
2725
|
+
selectedFacets: o,
|
|
2726
|
+
sponsoredCount: a
|
|
2722
2727
|
}, s) => {
|
|
2723
|
-
const c =
|
|
2724
|
-
c &&
|
|
2728
|
+
const c = Ve(o), l = ze(o), g = lr(o);
|
|
2729
|
+
c && ye(s, c), l && Ie(s, l);
|
|
2725
2730
|
const u = t ? Number(t) : 0, h = {
|
|
2726
2731
|
page: Math.ceil(u / n) || 0,
|
|
2727
2732
|
count: n,
|
|
2728
2733
|
query: i ?? void 0,
|
|
2729
|
-
sort:
|
|
2730
|
-
selectedFacets:
|
|
2731
|
-
sponsoredCount:
|
|
2734
|
+
sort: Ye[r ?? "score_desc"] ?? Ye.score_desc,
|
|
2735
|
+
selectedFacets: o?.flatMap($e) ?? [],
|
|
2736
|
+
sponsoredCount: a ?? void 0
|
|
2732
2737
|
};
|
|
2733
2738
|
if (g) {
|
|
2734
2739
|
const d = (await s.clients.commerce.catalog.products.crossselling({
|
|
2735
|
-
type:
|
|
2740
|
+
type: gn[g.key],
|
|
2736
2741
|
productId: g.value
|
|
2737
2742
|
})).map((m) => m.productId).slice(0, n), p = s.clients.search.productsByIdentifier({ field: "id", values: d }).then((m) => ({
|
|
2738
2743
|
products: m,
|
|
@@ -2765,24 +2770,24 @@ const di = {
|
|
|
2765
2770
|
allProducts: async (e, { first: n, after: t }, r) => {
|
|
2766
2771
|
const {
|
|
2767
2772
|
clients: { search: i }
|
|
2768
|
-
} = r,
|
|
2769
|
-
page: Math.ceil(
|
|
2773
|
+
} = r, o = t ? Number(t) : 0, a = await i.products({
|
|
2774
|
+
page: Math.ceil(o / n),
|
|
2770
2775
|
count: n
|
|
2771
|
-
}), s =
|
|
2776
|
+
}), s = a.products.flatMap(
|
|
2772
2777
|
(c) => c.items.map((l) => N(l, c))
|
|
2773
2778
|
).filter((c) => c.sellers.length > 0);
|
|
2774
2779
|
return {
|
|
2775
2780
|
pageInfo: {
|
|
2776
|
-
hasNextPage:
|
|
2777
|
-
hasPreviousPage:
|
|
2781
|
+
hasNextPage: a.pagination.after.length > 0,
|
|
2782
|
+
hasPreviousPage: a.pagination.before.length > 0,
|
|
2778
2783
|
startCursor: "0",
|
|
2779
|
-
endCursor:
|
|
2780
|
-
totalCount:
|
|
2784
|
+
endCursor: a.recordsFiltered.toString(),
|
|
2785
|
+
totalCount: a.recordsFiltered
|
|
2781
2786
|
},
|
|
2782
2787
|
// after + index is bigger than after+first itself because of the array flat() above
|
|
2783
2788
|
edges: s.map((c, l) => ({
|
|
2784
2789
|
node: c,
|
|
2785
|
-
cursor: (
|
|
2790
|
+
cursor: (o + l).toString()
|
|
2786
2791
|
}))
|
|
2787
2792
|
};
|
|
2788
2793
|
},
|
|
@@ -2794,15 +2799,15 @@ const di = {
|
|
|
2794
2799
|
field: "id",
|
|
2795
2800
|
values: n
|
|
2796
2801
|
})).flatMap(
|
|
2797
|
-
(
|
|
2802
|
+
(o) => o.items.map((a) => N(a, o))
|
|
2798
2803
|
).filter(
|
|
2799
|
-
(
|
|
2804
|
+
(o) => n.includes(o.itemId) && o.sellers.length > 0
|
|
2800
2805
|
) : [];
|
|
2801
2806
|
},
|
|
2802
2807
|
allCollections: async (e, { first: n, after: t }, r) => {
|
|
2803
2808
|
const {
|
|
2804
2809
|
clients: { commerce: i }
|
|
2805
|
-
} = r,
|
|
2810
|
+
} = r, o = t ? Number(t) : 0, [a, s] = await Promise.all([
|
|
2806
2811
|
i.catalog.brand.list(),
|
|
2807
2812
|
i.catalog.category.tree()
|
|
2808
2813
|
]), c = [], l = (f, v) => {
|
|
@@ -2810,7 +2815,7 @@ const di = {
|
|
|
2810
2815
|
id: f.id,
|
|
2811
2816
|
name: f.name,
|
|
2812
2817
|
fatherCategoryId: v,
|
|
2813
|
-
linkId:
|
|
2818
|
+
linkId: oe(f.name),
|
|
2814
2819
|
title: f.Title,
|
|
2815
2820
|
description: null,
|
|
2816
2821
|
metaTagDescription: f.MetaTagDescription,
|
|
@@ -2823,37 +2828,37 @@ const di = {
|
|
|
2823
2828
|
};
|
|
2824
2829
|
for (const f of s)
|
|
2825
2830
|
l(f, null);
|
|
2826
|
-
const h = [...
|
|
2831
|
+
const h = [...a.filter((f) => f.isActive).map((f) => ({
|
|
2827
2832
|
id: f.id,
|
|
2828
2833
|
name: f.name,
|
|
2829
|
-
linkId:
|
|
2834
|
+
linkId: oe(f.name),
|
|
2830
2835
|
title: f.title,
|
|
2831
2836
|
description: null,
|
|
2832
2837
|
metaTagDescription: f.metaTagDescription,
|
|
2833
2838
|
availableLinkIds: null,
|
|
2834
2839
|
entityType: "brand"
|
|
2835
|
-
})), ...c].filter((f) => !!
|
|
2840
|
+
})), ...c].filter((f) => !!pn.slug(f, null, r, null));
|
|
2836
2841
|
return {
|
|
2837
2842
|
pageInfo: {
|
|
2838
|
-
hasNextPage: h.length -
|
|
2839
|
-
hasPreviousPage:
|
|
2843
|
+
hasNextPage: h.length - o > n,
|
|
2844
|
+
hasPreviousPage: o > 0,
|
|
2840
2845
|
startCursor: "0",
|
|
2841
|
-
endCursor: (Math.min(n, h.length -
|
|
2846
|
+
endCursor: (Math.min(n, h.length - o) - 1).toString(),
|
|
2842
2847
|
totalCount: h.length
|
|
2843
2848
|
},
|
|
2844
|
-
edges: h.slice(
|
|
2849
|
+
edges: h.slice(o, o + n).map((f, v) => ({
|
|
2845
2850
|
node: f,
|
|
2846
|
-
cursor: (
|
|
2851
|
+
cursor: (o + v).toString()
|
|
2847
2852
|
}))
|
|
2848
2853
|
};
|
|
2849
2854
|
},
|
|
2850
2855
|
shipping: async (e, { country: n, items: t, postalCode: r }, i) => {
|
|
2851
2856
|
const {
|
|
2852
|
-
loaders: { simulationLoader:
|
|
2853
|
-
clients: { commerce:
|
|
2857
|
+
loaders: { simulationLoader: o },
|
|
2858
|
+
clients: { commerce: a }
|
|
2854
2859
|
} = i, [s, c] = await Promise.all([
|
|
2855
|
-
|
|
2856
|
-
|
|
2860
|
+
o.load({ country: n, items: t, postalCode: r }),
|
|
2861
|
+
a.checkout.address({ postalCode: r, country: n })
|
|
2857
2862
|
]);
|
|
2858
2863
|
return {
|
|
2859
2864
|
...s,
|
|
@@ -2867,17 +2872,17 @@ const di = {
|
|
|
2867
2872
|
page: 1,
|
|
2868
2873
|
count: 1,
|
|
2869
2874
|
query: n ?? void 0,
|
|
2870
|
-
selectedFacets: t?.flatMap(
|
|
2875
|
+
selectedFacets: t?.flatMap($e) ?? [],
|
|
2871
2876
|
allowRedirect: !0
|
|
2872
2877
|
});
|
|
2873
2878
|
return {
|
|
2874
2879
|
url: i
|
|
2875
2880
|
};
|
|
2876
2881
|
},
|
|
2877
|
-
sellers: async (e, { postalCode: n, geoCoordinates: t, country: r, salesChannel: i },
|
|
2882
|
+
sellers: async (e, { postalCode: n, geoCoordinates: t, country: r, salesChannel: i }, o) => {
|
|
2878
2883
|
const {
|
|
2879
|
-
clients: { commerce:
|
|
2880
|
-
} =
|
|
2884
|
+
clients: { commerce: a }
|
|
2885
|
+
} = o, c = (await a.checkout.region({
|
|
2881
2886
|
postalCode: n,
|
|
2882
2887
|
geoCoordinates: t,
|
|
2883
2888
|
country: r,
|
|
@@ -2892,12 +2897,12 @@ const di = {
|
|
|
2892
2897
|
const {
|
|
2893
2898
|
clients: { commerce: r }
|
|
2894
2899
|
} = t, i = await r.profile.addresses(n);
|
|
2895
|
-
function
|
|
2900
|
+
function o(s) {
|
|
2896
2901
|
return !s || Object.keys(s).length === 0 ? [] : Object.values(s).map(
|
|
2897
2902
|
(c) => JSON.parse(c)
|
|
2898
2903
|
);
|
|
2899
2904
|
}
|
|
2900
|
-
return { addresses:
|
|
2905
|
+
return { addresses: o(i) };
|
|
2901
2906
|
},
|
|
2902
2907
|
productCount: async (e, { term: n }, t) => {
|
|
2903
2908
|
const {
|
|
@@ -2915,11 +2920,11 @@ const di = {
|
|
|
2915
2920
|
clients: { commerce: r }
|
|
2916
2921
|
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
2917
2922
|
if (!i)
|
|
2918
|
-
throw new
|
|
2919
|
-
let
|
|
2923
|
+
throw new B(`No order found for id ${n}`);
|
|
2924
|
+
let o = null;
|
|
2920
2925
|
try {
|
|
2921
2926
|
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
2922
|
-
|
|
2927
|
+
o = mn(c);
|
|
2923
2928
|
} catch {
|
|
2924
2929
|
}
|
|
2925
2930
|
const s = (await r.masterData.getShopperById({
|
|
@@ -2938,8 +2943,8 @@ const di = {
|
|
|
2938
2943
|
allowCancellation: i.allowCancellation,
|
|
2939
2944
|
storePreferencesData: i.storePreferencesData,
|
|
2940
2945
|
clientProfileData: i.clientProfileData,
|
|
2941
|
-
canProcessOrderAuthorization: (i.status === "waiting-for-confirmation" || i.status === "waiting-for-authorization") && !!
|
|
2942
|
-
ruleForAuthorization:
|
|
2946
|
+
canProcessOrderAuthorization: (i.status === "waiting-for-confirmation" || i.status === "waiting-for-authorization") && !!o,
|
|
2947
|
+
ruleForAuthorization: o,
|
|
2943
2948
|
shopper: {
|
|
2944
2949
|
firstName: s?.firstName || "",
|
|
2945
2950
|
lastName: s?.lastName || "",
|
|
@@ -2950,16 +2955,16 @@ const di = {
|
|
|
2950
2955
|
};
|
|
2951
2956
|
} catch (r) {
|
|
2952
2957
|
const i = r.message;
|
|
2953
|
-
let
|
|
2958
|
+
let o = {};
|
|
2954
2959
|
try {
|
|
2955
2960
|
const s = JSON.parse(i);
|
|
2956
|
-
|
|
2961
|
+
o = s.error || s;
|
|
2957
2962
|
} catch {
|
|
2958
|
-
|
|
2963
|
+
o = { message: i };
|
|
2959
2964
|
}
|
|
2960
|
-
const
|
|
2961
|
-
throw X(r) ? new
|
|
2962
|
-
`You are forbidden to interact with order with id ${n}. ${
|
|
2965
|
+
const a = o?.message || i;
|
|
2966
|
+
throw X(r) ? new B(`No order found for id ${n}. ${a}.`) : tt(r) ? new J(
|
|
2967
|
+
`You are forbidden to interact with order with id ${n}. ${a}.`
|
|
2963
2968
|
) : r;
|
|
2964
2969
|
}
|
|
2965
2970
|
},
|
|
@@ -2968,17 +2973,17 @@ const di = {
|
|
|
2968
2973
|
clients: { commerce: r }
|
|
2969
2974
|
} = t, i = await r.oms.listUserOrders(n);
|
|
2970
2975
|
return {
|
|
2971
|
-
list: i.list?.map((
|
|
2972
|
-
orderId:
|
|
2973
|
-
creationDate:
|
|
2974
|
-
clientName:
|
|
2975
|
-
items:
|
|
2976
|
-
totalValue:
|
|
2977
|
-
status:
|
|
2978
|
-
statusDescription:
|
|
2979
|
-
ShippingEstimatedDate:
|
|
2980
|
-
customFields:
|
|
2981
|
-
currencyCode:
|
|
2976
|
+
list: i.list?.map((o) => ({
|
|
2977
|
+
orderId: o.orderId,
|
|
2978
|
+
creationDate: o.creationDate,
|
|
2979
|
+
clientName: o.clientName,
|
|
2980
|
+
items: o.items,
|
|
2981
|
+
totalValue: o.totalValue,
|
|
2982
|
+
status: o.status,
|
|
2983
|
+
statusDescription: o.statusDescription,
|
|
2984
|
+
ShippingEstimatedDate: o.ShippingEstimatedDate,
|
|
2985
|
+
customFields: o.customFields,
|
|
2986
|
+
currencyCode: o.currencyCode
|
|
2982
2987
|
})),
|
|
2983
2988
|
paging: i.paging
|
|
2984
2989
|
};
|
|
@@ -2986,18 +2991,18 @@ const di = {
|
|
|
2986
2991
|
listUserQuotes: async (e, n, t) => {
|
|
2987
2992
|
const {
|
|
2988
2993
|
clients: { commerce: r }
|
|
2989
|
-
} = t, i = await r.quotes.listUserQuotes(n),
|
|
2994
|
+
} = t, i = await r.quotes.listUserQuotes(n), o = [
|
|
2990
2995
|
...new Set(i.items.map((c) => c.createdBy).filter(Boolean))
|
|
2991
|
-
],
|
|
2996
|
+
], a = /* @__PURE__ */ new Map();
|
|
2992
2997
|
return await Promise.all(
|
|
2993
|
-
|
|
2998
|
+
o.map(async (c) => {
|
|
2994
2999
|
try {
|
|
2995
3000
|
const [l] = await r.masterData.getShopperById({
|
|
2996
3001
|
userId: c
|
|
2997
3002
|
});
|
|
2998
3003
|
if (l) {
|
|
2999
3004
|
const g = [l.firstName, l.lastName].filter(Boolean).join(" ");
|
|
3000
|
-
g &&
|
|
3005
|
+
g && a.set(c, g);
|
|
3001
3006
|
}
|
|
3002
3007
|
} catch {
|
|
3003
3008
|
}
|
|
@@ -3010,7 +3015,7 @@ const di = {
|
|
|
3010
3015
|
createdAt: c.createdAt,
|
|
3011
3016
|
expiresAt: c.expiresAt,
|
|
3012
3017
|
amount: c.amount,
|
|
3013
|
-
createdBy: c.createdBy ?
|
|
3018
|
+
createdBy: c.createdBy ? a.get(c.createdBy) ?? c.createdBy : null
|
|
3014
3019
|
})),
|
|
3015
3020
|
paging: {
|
|
3016
3021
|
total: i.totalItems,
|
|
@@ -3033,11 +3038,11 @@ const di = {
|
|
|
3033
3038
|
const {
|
|
3034
3039
|
account: r,
|
|
3035
3040
|
headers: i,
|
|
3036
|
-
clients: { commerce:
|
|
3041
|
+
clients: { commerce: o }
|
|
3037
3042
|
} = t, s = Y(z(i?.cookie ?? "", r))?.userId ?? "", [c, l, g] = await Promise.all([
|
|
3038
|
-
|
|
3039
|
-
s ?
|
|
3040
|
-
s ?
|
|
3043
|
+
o.session("").catch(() => null),
|
|
3044
|
+
s ? o.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
3045
|
+
s ? o.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
3041
3046
|
]), u = l?.[0], h = c?.namespaces.authentication ?? null, f = `${(u?.firstName ?? "").trim()} ${(u?.lastName ?? "").trim()}`.trim();
|
|
3042
3047
|
return {
|
|
3043
3048
|
username: h?.storeUserEmail?.value ?? "",
|
|
@@ -3054,19 +3059,19 @@ const di = {
|
|
|
3054
3059
|
const {
|
|
3055
3060
|
account: r,
|
|
3056
3061
|
headers: i,
|
|
3057
|
-
clients: { commerce:
|
|
3058
|
-
} = t,
|
|
3059
|
-
if (!
|
|
3062
|
+
clients: { commerce: o }
|
|
3063
|
+
} = t, a = Y(z(i?.cookie ?? "", r));
|
|
3064
|
+
if (!a?.userId)
|
|
3060
3065
|
return null;
|
|
3061
|
-
if (
|
|
3062
|
-
const c = await
|
|
3066
|
+
if (a?.isRepresentative) {
|
|
3067
|
+
const c = await o.session("").catch(() => null);
|
|
3063
3068
|
if (!c)
|
|
3064
3069
|
return null;
|
|
3065
|
-
const l = c.namespaces.profile ?? null, g = c.namespaces.shopper ?? null, u = c.namespaces.authentication ?? null, h =
|
|
3070
|
+
const l = c.namespaces.profile ?? null, g = c.namespaces.shopper ?? null, u = c.namespaces.authentication ?? null, h = He(c) || a?.customerId?.trim() || "";
|
|
3066
3071
|
let f = null;
|
|
3067
3072
|
if (h)
|
|
3068
3073
|
try {
|
|
3069
|
-
f = await
|
|
3074
|
+
f = await o.masterData.getContractById({ contractId: h });
|
|
3070
3075
|
} catch (p) {
|
|
3071
3076
|
console.error(
|
|
3072
3077
|
`Error while getting contract data for contract ID (${h}).`,
|
|
@@ -3075,14 +3080,14 @@ const di = {
|
|
|
3075
3080
|
}
|
|
3076
3081
|
const v = `${(g?.firstName?.value ?? "").trim()} ${(g?.lastName?.value ?? "").trim()}`.trim();
|
|
3077
3082
|
return {
|
|
3078
|
-
name:
|
|
3083
|
+
name: bn(f, l) || v || "",
|
|
3079
3084
|
email: l?.email?.value || u?.storeUserEmail?.value || "",
|
|
3080
|
-
id: l?.id?.value || u?.customerId?.value ||
|
|
3085
|
+
id: l?.id?.value || u?.customerId?.value || a?.customerId?.trim() || ""
|
|
3081
3086
|
// createdAt: '',
|
|
3082
3087
|
};
|
|
3083
3088
|
}
|
|
3084
|
-
const s = await
|
|
3085
|
-
userId:
|
|
3089
|
+
const s = await o.licenseManager.getUserById({
|
|
3090
|
+
userId: a?.userId
|
|
3086
3091
|
}).catch(() => null);
|
|
3087
3092
|
return {
|
|
3088
3093
|
name: s?.name || "",
|
|
@@ -3099,23 +3104,23 @@ const di = {
|
|
|
3099
3104
|
const {
|
|
3100
3105
|
account: r,
|
|
3101
3106
|
headers: i,
|
|
3102
|
-
clients: { commerce:
|
|
3103
|
-
} = t,
|
|
3107
|
+
clients: { commerce: o }
|
|
3108
|
+
} = t, a = await o.session("").catch(() => null), s = z(i?.cookie ?? "", r);
|
|
3104
3109
|
let c = null;
|
|
3105
3110
|
try {
|
|
3106
3111
|
c = s ? Y(s) : null;
|
|
3107
3112
|
} catch {
|
|
3108
3113
|
c = null;
|
|
3109
3114
|
}
|
|
3110
|
-
const l =
|
|
3115
|
+
const l = a?.namespaces.authentication?.unitId?.value?.trim() ?? c?.unitId?.trim() ?? "";
|
|
3111
3116
|
if (!l || l !== n)
|
|
3112
3117
|
throw new J(
|
|
3113
3118
|
"You are not allowed to list contracts for this organization unit"
|
|
3114
3119
|
);
|
|
3115
|
-
const g =
|
|
3116
|
-
|
|
3117
|
-
), u =
|
|
3118
|
-
return
|
|
3120
|
+
const g = zr(
|
|
3121
|
+
a?.namespaces.shopper
|
|
3122
|
+
), u = He(a) || c?.customerId?.trim() || "";
|
|
3123
|
+
return xr(g, u);
|
|
3119
3124
|
},
|
|
3120
3125
|
pickupPoints: async (e, { geoCoordinates: n }, t) => {
|
|
3121
3126
|
const {
|
|
@@ -3125,10 +3130,10 @@ const di = {
|
|
|
3125
3130
|
geoCoordinates: n
|
|
3126
3131
|
});
|
|
3127
3132
|
},
|
|
3128
|
-
orderEntryOperation:
|
|
3129
|
-
orderFormItems:
|
|
3130
|
-
recommendations:
|
|
3131
|
-
},
|
|
3133
|
+
orderEntryOperation: si,
|
|
3134
|
+
orderFormItems: ci,
|
|
3135
|
+
recommendations: ai
|
|
3136
|
+
}, mi = {
|
|
3132
3137
|
reviewRating: () => ({
|
|
3133
3138
|
ratingValue: 5,
|
|
3134
3139
|
bestRating: 5
|
|
@@ -3136,7 +3141,7 @@ const di = {
|
|
|
3136
3141
|
author: () => ({
|
|
3137
3142
|
name: ""
|
|
3138
3143
|
})
|
|
3139
|
-
},
|
|
3144
|
+
}, hi = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, fi = {
|
|
3140
3145
|
suggestions: async (e, n, t) => {
|
|
3141
3146
|
const {
|
|
3142
3147
|
clients: { search: r }
|
|
@@ -3149,13 +3154,13 @@ const di = {
|
|
|
3149
3154
|
})),
|
|
3150
3155
|
products: []
|
|
3151
3156
|
};
|
|
3152
|
-
const { productSearchPromise:
|
|
3157
|
+
const { productSearchPromise: o } = e, [a, s] = await Promise.all([
|
|
3153
3158
|
r.suggestedTerms(i),
|
|
3154
|
-
|
|
3159
|
+
o
|
|
3155
3160
|
]), c = s.products.map((g) => {
|
|
3156
3161
|
const u = ce(g.items);
|
|
3157
3162
|
return u && N(u, g);
|
|
3158
|
-
}).filter((g) => !!g), { searches: l } =
|
|
3163
|
+
}).filter((g) => !!g), { searches: l } = a;
|
|
3159
3164
|
return {
|
|
3160
3165
|
terms: l.map((g) => ({ value: g.term, count: g.count })),
|
|
3161
3166
|
products: c
|
|
@@ -3185,9 +3190,9 @@ const di = {
|
|
|
3185
3190
|
clients: { search: r }
|
|
3186
3191
|
} = t;
|
|
3187
3192
|
t.storage.searchArgs = e;
|
|
3188
|
-
const { facets: i = [] } = await r.facets(e),
|
|
3193
|
+
const { facets: i = [] } = await r.facets(e), o = !e.query, a = e.selectedFacets?.length ? e.selectedFacets[0].key === "category-1" : !1, s = e.selectedFacets?.length ? e.selectedFacets[0].key === "brand" : !1;
|
|
3189
3194
|
return i.filter(
|
|
3190
|
-
(l) => !
|
|
3195
|
+
(l) => !o || !hi(l, a, s)
|
|
3191
3196
|
);
|
|
3192
3197
|
},
|
|
3193
3198
|
metadata: async ({ productSearchPromise: e }) => {
|
|
@@ -3199,12 +3204,12 @@ const di = {
|
|
|
3199
3204
|
};
|
|
3200
3205
|
},
|
|
3201
3206
|
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
3202
|
-
},
|
|
3207
|
+
}, Si = {
|
|
3203
3208
|
title: ({ title: e }) => e ?? "",
|
|
3204
3209
|
description: ({ description: e }) => e ?? "",
|
|
3205
3210
|
canonical: ({ canonical: e }) => e ?? "",
|
|
3206
3211
|
titleTemplate: () => ""
|
|
3207
|
-
},
|
|
3212
|
+
}, yi = ["bd", "d", "h", "m"], Ii = (e) => yi.includes(e), vi = {
|
|
3208
3213
|
bd: {
|
|
3209
3214
|
0: "Today",
|
|
3210
3215
|
1: "In 1 business day",
|
|
@@ -3225,95 +3230,95 @@ const di = {
|
|
|
3225
3230
|
1: "In 1 minute",
|
|
3226
3231
|
other: "Up to # minutes"
|
|
3227
3232
|
}
|
|
3228
|
-
},
|
|
3229
|
-
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i =
|
|
3233
|
+
}, kn = (e) => {
|
|
3234
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = Ii(t);
|
|
3230
3235
|
if (!r || !i)
|
|
3231
3236
|
return "";
|
|
3232
|
-
const
|
|
3233
|
-
return
|
|
3234
|
-
},
|
|
3237
|
+
const o = Number(n) < 2 ? Number(n) : "other";
|
|
3238
|
+
return vi[t][o].replace("#", n) ?? "";
|
|
3239
|
+
}, Oi = {
|
|
3235
3240
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
3236
3241
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
3237
|
-
localizedEstimates: (e) => e?.shippingEstimate ?
|
|
3238
|
-
},
|
|
3239
|
-
function
|
|
3240
|
-
const t = `${
|
|
3241
|
-
(
|
|
3242
|
+
localizedEstimates: (e) => e?.shippingEstimate ? kn(e.shippingEstimate) : ""
|
|
3243
|
+
}, Je = "skuvariation";
|
|
3244
|
+
function Ke(e, n) {
|
|
3245
|
+
const t = `${Je}${n}`.toLowerCase(), r = e.find(
|
|
3246
|
+
(o) => o.imageLabel === t
|
|
3242
3247
|
);
|
|
3243
3248
|
if (r)
|
|
3244
3249
|
return r;
|
|
3245
3250
|
const i = e.find(
|
|
3246
|
-
(
|
|
3251
|
+
(o) => o.imageLabel === Je
|
|
3247
3252
|
);
|
|
3248
3253
|
return i || e[0];
|
|
3249
3254
|
}
|
|
3250
|
-
function
|
|
3255
|
+
function Ci(e, n, t) {
|
|
3251
3256
|
const r = {};
|
|
3252
3257
|
return e.forEach((i) => {
|
|
3253
|
-
const
|
|
3254
|
-
if (
|
|
3258
|
+
const o = i.variations;
|
|
3259
|
+
if (o.length === 0)
|
|
3255
3260
|
return;
|
|
3256
|
-
const
|
|
3261
|
+
const a = `${n}-${o.find(
|
|
3257
3262
|
(c) => c.name === n
|
|
3258
|
-
)?.values[0] ?? ""}`, s =
|
|
3263
|
+
)?.values[0] ?? ""}`, s = o.reduce((c, l) => l.name === n ? c : c + `-${l.name}-${l.values[0]}`, a);
|
|
3259
3264
|
r[s] = `${t}-${i.itemId}`;
|
|
3260
3265
|
}), r;
|
|
3261
3266
|
}
|
|
3262
|
-
function
|
|
3267
|
+
function Qe(e) {
|
|
3263
3268
|
const n = {};
|
|
3264
3269
|
return e.forEach((t) => {
|
|
3265
3270
|
n[t.name] = t.values[0];
|
|
3266
3271
|
}), n;
|
|
3267
3272
|
}
|
|
3268
|
-
function
|
|
3273
|
+
function bi(e) {
|
|
3269
3274
|
const n = {};
|
|
3270
3275
|
return e?.forEach((t) => {
|
|
3271
3276
|
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
3272
3277
|
}), n;
|
|
3273
3278
|
}
|
|
3274
|
-
function
|
|
3279
|
+
function wi(e, n) {
|
|
3275
3280
|
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
3276
3281
|
}
|
|
3277
|
-
function
|
|
3282
|
+
function Di(e) {
|
|
3278
3283
|
const n = e;
|
|
3279
3284
|
for (const t in e)
|
|
3280
3285
|
e[t].every(
|
|
3281
3286
|
(i) => !Number.isNaN(Number(i.value))
|
|
3282
|
-
) && e[t].sort((i,
|
|
3287
|
+
) && e[t].sort((i, o) => wi(i.value, o.value));
|
|
3283
3288
|
return n;
|
|
3284
3289
|
}
|
|
3285
|
-
function
|
|
3290
|
+
function Ai(e, n, t) {
|
|
3286
3291
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
3287
|
-
return e.forEach((
|
|
3288
|
-
if (
|
|
3292
|
+
return e.forEach((o) => {
|
|
3293
|
+
if (o.variations.length === 0)
|
|
3289
3294
|
return;
|
|
3290
|
-
const
|
|
3295
|
+
const a = o.variations.find(
|
|
3291
3296
|
(c) => c.name === n
|
|
3292
3297
|
);
|
|
3293
|
-
if (!(
|
|
3294
|
-
const c = `${n}-${
|
|
3295
|
-
if (!
|
|
3298
|
+
if (!(a?.values[0] === t)) {
|
|
3299
|
+
const c = `${n}-${a?.values[0]}`;
|
|
3300
|
+
if (!a || i.has(c))
|
|
3296
3301
|
return;
|
|
3297
3302
|
i.add(c);
|
|
3298
|
-
const l =
|
|
3299
|
-
|
|
3303
|
+
const l = Ke(
|
|
3304
|
+
o.images,
|
|
3300
3305
|
n
|
|
3301
3306
|
), g = {
|
|
3302
3307
|
src: l.imageUrl,
|
|
3303
3308
|
alt: l.imageLabel ?? "",
|
|
3304
|
-
label: `${n}: ${
|
|
3305
|
-
value:
|
|
3309
|
+
label: `${n}: ${a.values[0]}`,
|
|
3310
|
+
value: a.values[0]
|
|
3306
3311
|
};
|
|
3307
|
-
r[
|
|
3312
|
+
r[a.name] ? r[a.name].push(g) : r[a.name] = [g];
|
|
3308
3313
|
return;
|
|
3309
3314
|
}
|
|
3310
|
-
|
|
3315
|
+
o.variations.forEach((c) => {
|
|
3311
3316
|
const l = `${c.name}-${c.values[0]}`;
|
|
3312
3317
|
if (i.has(l))
|
|
3313
3318
|
return;
|
|
3314
3319
|
i.add(l);
|
|
3315
|
-
const g =
|
|
3316
|
-
|
|
3320
|
+
const g = Ke(
|
|
3321
|
+
o.images,
|
|
3317
3322
|
c.name
|
|
3318
3323
|
), u = {
|
|
3319
3324
|
src: g.imageUrl,
|
|
@@ -3323,38 +3328,38 @@ function bi(e, n, t) {
|
|
|
3323
3328
|
};
|
|
3324
3329
|
r[c.name] ? r[c.name].push(u) : r[c.name] = [u];
|
|
3325
3330
|
});
|
|
3326
|
-
}),
|
|
3331
|
+
}), Di(r);
|
|
3327
3332
|
}
|
|
3328
|
-
const
|
|
3329
|
-
activeVariations: (e) =>
|
|
3330
|
-
allVariantsByName: (e) =>
|
|
3331
|
-
slugsMap: (e, n) =>
|
|
3333
|
+
const Pi = {
|
|
3334
|
+
activeVariations: (e) => Qe(e.variations),
|
|
3335
|
+
allVariantsByName: (e) => bi(e.isVariantOf.skuSpecifications),
|
|
3336
|
+
slugsMap: (e, n) => Ci(
|
|
3332
3337
|
e.isVariantOf.items,
|
|
3333
3338
|
n.dominantVariantName ?? e.variations[0]?.name,
|
|
3334
3339
|
e.isVariantOf.linkText
|
|
3335
3340
|
),
|
|
3336
3341
|
availableVariations: (e, n) => {
|
|
3337
|
-
const t = n.dominantVariantName ?? e.variations[0]?.name, i =
|
|
3338
|
-
return
|
|
3342
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = Qe(e.variations)[t];
|
|
3343
|
+
return Ai(
|
|
3339
3344
|
e.isVariantOf.items,
|
|
3340
3345
|
t,
|
|
3341
3346
|
i
|
|
3342
3347
|
);
|
|
3343
3348
|
},
|
|
3344
3349
|
allVariantProducts: (e) => e.isVariantOf.items.map((n) => N(n, e.isVariantOf))
|
|
3345
|
-
},
|
|
3350
|
+
}, ki = {
|
|
3346
3351
|
"pickup-in-point": "Pickup",
|
|
3347
3352
|
delivery: "Delivery",
|
|
3348
3353
|
pickup: "Pickup",
|
|
3349
3354
|
"take-away": "Take away",
|
|
3350
3355
|
"": ""
|
|
3351
|
-
},
|
|
3356
|
+
}, Ui = {
|
|
3352
3357
|
deliveryOptionsData: (e) => {
|
|
3353
|
-
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address],
|
|
3358
|
+
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], o = r.reduce(
|
|
3354
3359
|
(l, g) => {
|
|
3355
|
-
const u = g?.selectedSla || "", h = g?.selectedDeliveryChannel || g?.deliveryChannel || "", f = g?.deliveryCompany || "", v = g?.deliveryWindow, d = g?.pickupStoreInfo, p = g?.shippingEstimate || "", m = g?.shippingEstimate ?
|
|
3360
|
+
const u = g?.selectedSla || "", h = g?.selectedDeliveryChannel || g?.deliveryChannel || "", f = g?.deliveryCompany || "", v = g?.deliveryWindow, d = g?.pickupStoreInfo, p = g?.shippingEstimate || "", m = g?.shippingEstimate ? kn(g?.shippingEstimate) : "", y = g?.shippingEstimateDate || "", O = g?.addressId || "", w = g?.itemIndex ?? 0, C = t?.[w], P = C?.seller || "", S = `${u}|${h}|${f}|${P}|${p}|${y}|${O}|${v?.startDateUtc}|${v?.endDateUtc}`, D = i?.find(
|
|
3356
3361
|
(T) => T?.addressId === O
|
|
3357
|
-
),
|
|
3362
|
+
), A = `${ki[h] || ""} ${m} ${D?.neighborhood ? `to ${D?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: k, taxPriceTags: b } = Ti(
|
|
3358
3363
|
C?.priceTags ?? []
|
|
3359
3364
|
), U = (C?.sellingPrice ?? 0) * (C?.quantity ?? 0) + (C?.tax ?? 0) + (k ?? 0);
|
|
3360
3365
|
return l[S] || (l[S] = {
|
|
@@ -3365,9 +3370,9 @@ const wi = {
|
|
|
3365
3370
|
deliveryWindow: v,
|
|
3366
3371
|
shippingEstimate: p,
|
|
3367
3372
|
shippingEstimateDate: y,
|
|
3368
|
-
seller:
|
|
3373
|
+
seller: P,
|
|
3369
3374
|
friendlyShippingEstimate: m,
|
|
3370
|
-
friendlyDeliveryOptionName:
|
|
3375
|
+
friendlyDeliveryOptionName: A,
|
|
3371
3376
|
address: D,
|
|
3372
3377
|
pickupStoreInfo: d,
|
|
3373
3378
|
// dynamic fields
|
|
@@ -3389,13 +3394,13 @@ const wi = {
|
|
|
3389
3394
|
}), l[S].quantityOfDifferentItems = (l[S].quantityOfDifferentItems ?? 0) + 1, l[S].total = (l[S].total ?? 0) + U), l;
|
|
3390
3395
|
},
|
|
3391
3396
|
{}
|
|
3392
|
-
),
|
|
3393
|
-
name: `${s?.firstName ?? ""} ${s?.lastName ?? ""}`.trim() ||
|
|
3397
|
+
), a = Object.values(o), s = n?.contactInformation?.[0], c = {
|
|
3398
|
+
name: `${s?.firstName ?? ""} ${s?.lastName ?? ""}`.trim() || a?.[0]?.address?.receiverName || "",
|
|
3394
3399
|
email: s?.email || "",
|
|
3395
3400
|
phone: s?.phone || ""
|
|
3396
3401
|
};
|
|
3397
3402
|
return {
|
|
3398
|
-
deliveryOptions:
|
|
3403
|
+
deliveryOptions: a,
|
|
3399
3404
|
contact: c
|
|
3400
3405
|
};
|
|
3401
3406
|
},
|
|
@@ -3404,19 +3409,19 @@ const wi = {
|
|
|
3404
3409
|
return Object.values(
|
|
3405
3410
|
n.reduce(
|
|
3406
3411
|
(t, r) => {
|
|
3407
|
-
const i = r?.linkedEntity?.type || "",
|
|
3408
|
-
return t[
|
|
3412
|
+
const i = r?.linkedEntity?.type || "", o = r?.linkedEntity?.id || "", a = `${i}|${o || ""}`;
|
|
3413
|
+
return t[a] || (t[a] = { type: i, id: o, fields: [] }), t[a].fields.push(...r?.fields || []), t;
|
|
3409
3414
|
},
|
|
3410
3415
|
{}
|
|
3411
3416
|
)
|
|
3412
3417
|
) || [];
|
|
3413
3418
|
}
|
|
3414
3419
|
};
|
|
3415
|
-
function
|
|
3420
|
+
function Ti(e) {
|
|
3416
3421
|
const t = e.filter(
|
|
3417
3422
|
(i) => i?.name?.includes("TAX")
|
|
3418
3423
|
), r = t.reduce(
|
|
3419
|
-
(i,
|
|
3424
|
+
(i, o) => i + (o.rawValue ? o.rawValue * 100 : 0),
|
|
3420
3425
|
0
|
|
3421
3426
|
);
|
|
3422
3427
|
return {
|
|
@@ -3424,28 +3429,28 @@ function Ai(e) {
|
|
|
3424
3429
|
taxPriceTagsTotal: r
|
|
3425
3430
|
};
|
|
3426
3431
|
}
|
|
3427
|
-
const
|
|
3428
|
-
StoreCollection:
|
|
3429
|
-
StoreAggregateOffer:
|
|
3430
|
-
StoreProduct:
|
|
3431
|
-
StoreSeo:
|
|
3432
|
-
StoreFacet:
|
|
3433
|
-
StoreFacetBoolean:
|
|
3434
|
-
StoreFacetRange:
|
|
3435
|
-
StoreFacetValueBoolean:
|
|
3436
|
-
StoreOffer:
|
|
3437
|
-
StoreAggregateRating:
|
|
3438
|
-
StoreReview:
|
|
3439
|
-
StoreProductGroup:
|
|
3440
|
-
StoreSearchResult:
|
|
3441
|
-
StorePropertyValue:
|
|
3442
|
-
SkuVariants:
|
|
3443
|
-
ShippingSLA:
|
|
3444
|
-
UserOrderResult:
|
|
3445
|
-
ObjectOrString:
|
|
3446
|
-
Query:
|
|
3447
|
-
Mutation:
|
|
3448
|
-
},
|
|
3432
|
+
const _i = {
|
|
3433
|
+
StoreCollection: pn,
|
|
3434
|
+
StoreAggregateOffer: rr,
|
|
3435
|
+
StoreProduct: ni,
|
|
3436
|
+
StoreSeo: Si,
|
|
3437
|
+
StoreFacet: pr,
|
|
3438
|
+
StoreFacetBoolean: gr,
|
|
3439
|
+
StoreFacetRange: mr,
|
|
3440
|
+
StoreFacetValueBoolean: hr,
|
|
3441
|
+
StoreOffer: Yr,
|
|
3442
|
+
StoreAggregateRating: ir,
|
|
3443
|
+
StoreReview: mi,
|
|
3444
|
+
StoreProductGroup: ri,
|
|
3445
|
+
StoreSearchResult: fi,
|
|
3446
|
+
StorePropertyValue: ii,
|
|
3447
|
+
SkuVariants: Pi,
|
|
3448
|
+
ShippingSLA: Oi,
|
|
3449
|
+
UserOrderResult: Ui,
|
|
3450
|
+
ObjectOrString: Xr,
|
|
3451
|
+
Query: gi,
|
|
3452
|
+
Mutation: Wr
|
|
3453
|
+
}, Ei = () => _i, Ri = `"""
|
|
3449
3454
|
Address information.
|
|
3450
3455
|
"""
|
|
3451
3456
|
type Address {
|
|
@@ -3490,7 +3495,7 @@ type Address {
|
|
|
3490
3495
|
"""
|
|
3491
3496
|
geoCoordinates: [Float]
|
|
3492
3497
|
}
|
|
3493
|
-
`,
|
|
3498
|
+
`, Fi = `"""
|
|
3494
3499
|
Advertisement information about a specific product in a campaign
|
|
3495
3500
|
"""
|
|
3496
3501
|
type Advertisement {
|
|
@@ -3515,7 +3520,7 @@ type Advertisement {
|
|
|
3515
3520
|
"""
|
|
3516
3521
|
adResponseId: String!
|
|
3517
3522
|
}
|
|
3518
|
-
`,
|
|
3523
|
+
`, Ni = `"""
|
|
3519
3524
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
3520
3525
|
"""
|
|
3521
3526
|
type StoreAggregateOffer {
|
|
@@ -3544,7 +3549,7 @@ type StoreAggregateOffer {
|
|
|
3544
3549
|
"""
|
|
3545
3550
|
offers: [StoreOffer!]!
|
|
3546
3551
|
}
|
|
3547
|
-
`,
|
|
3552
|
+
`, Li = `"""
|
|
3548
3553
|
Average rating, based on multiple ratings or reviews.
|
|
3549
3554
|
"""
|
|
3550
3555
|
type StoreAggregateRating {
|
|
@@ -3557,7 +3562,7 @@ type StoreAggregateRating {
|
|
|
3557
3562
|
"""
|
|
3558
3563
|
reviewCount: Int!
|
|
3559
3564
|
}
|
|
3560
|
-
`,
|
|
3565
|
+
`, Bi = `"""
|
|
3561
3566
|
information about the author of a product review or rating.
|
|
3562
3567
|
"""
|
|
3563
3568
|
type StoreAuthor {
|
|
@@ -3566,7 +3571,7 @@ type StoreAuthor {
|
|
|
3566
3571
|
"""
|
|
3567
3572
|
name: String!
|
|
3568
3573
|
}
|
|
3569
|
-
`,
|
|
3574
|
+
`, $i = `"""
|
|
3570
3575
|
Brand of a given product.
|
|
3571
3576
|
"""
|
|
3572
3577
|
type StoreBrand {
|
|
@@ -3575,7 +3580,7 @@ type StoreBrand {
|
|
|
3575
3580
|
"""
|
|
3576
3581
|
name: String!
|
|
3577
3582
|
}
|
|
3578
|
-
`,
|
|
3583
|
+
`, Mi = `"""
|
|
3579
3584
|
Item of a list.
|
|
3580
3585
|
"""
|
|
3581
3586
|
type StoreListItem {
|
|
@@ -3606,7 +3611,7 @@ type StoreBreadcrumbList {
|
|
|
3606
3611
|
"""
|
|
3607
3612
|
numberOfItems: Int!
|
|
3608
3613
|
}
|
|
3609
|
-
`,
|
|
3614
|
+
`, zi = `"""
|
|
3610
3615
|
Shopping cart message.
|
|
3611
3616
|
"""
|
|
3612
3617
|
type StoreCartMessage {
|
|
@@ -3643,7 +3648,7 @@ input IStoreCart {
|
|
|
3643
3648
|
"""
|
|
3644
3649
|
order: IStoreOrder!
|
|
3645
3650
|
}
|
|
3646
|
-
`,
|
|
3651
|
+
`, Vi = `"""
|
|
3647
3652
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\` or \`Collection\`.
|
|
3648
3653
|
|
|
3649
3654
|
\`SubCategory\` and \`Cluster\` are still declared for backward compatibility but are
|
|
@@ -3758,7 +3763,7 @@ type StoreCollectionLocale {
|
|
|
3758
3763
|
"""
|
|
3759
3764
|
slug: String!
|
|
3760
3765
|
}
|
|
3761
|
-
`,
|
|
3766
|
+
`, xi = `"""
|
|
3762
3767
|
Delivery Promise badge.
|
|
3763
3768
|
"""
|
|
3764
3769
|
type DeliveryPromiseBadge {
|
|
@@ -3767,7 +3772,7 @@ type DeliveryPromiseBadge {
|
|
|
3767
3772
|
"""
|
|
3768
3773
|
typeName: String
|
|
3769
3774
|
}
|
|
3770
|
-
`,
|
|
3775
|
+
`, qi = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
3771
3776
|
|
|
3772
3777
|
"""
|
|
3773
3778
|
Search facet range information.
|
|
@@ -3844,7 +3849,7 @@ type StoreFacetValueBoolean {
|
|
|
3844
3849
|
"""
|
|
3845
3850
|
quantity: Int
|
|
3846
3851
|
}
|
|
3847
|
-
`,
|
|
3852
|
+
`, ji = `"""
|
|
3848
3853
|
Image.
|
|
3849
3854
|
"""
|
|
3850
3855
|
type StoreImage {
|
|
@@ -3871,7 +3876,7 @@ input IStoreImage {
|
|
|
3871
3876
|
"""
|
|
3872
3877
|
alternateName: String!
|
|
3873
3878
|
}
|
|
3874
|
-
`,
|
|
3879
|
+
`, Wi = `type Mutation {
|
|
3875
3880
|
"""
|
|
3876
3881
|
Checks for changes between the cart presented in the UI and the cart stored in the ecommerce platform. If changes are detected, it returns the cart stored on the platform. Otherwise, it returns \`null\`.
|
|
3877
3882
|
"""
|
|
@@ -3913,7 +3918,7 @@ input IStoreImage {
|
|
|
3913
3918
|
"""
|
|
3914
3919
|
startRecommendationSession: Boolean!
|
|
3915
3920
|
}
|
|
3916
|
-
`,
|
|
3921
|
+
`, Gi = `"""
|
|
3917
3922
|
Newsletter information.
|
|
3918
3923
|
"""
|
|
3919
3924
|
type PersonNewsletter {
|
|
@@ -3936,8 +3941,8 @@ input IPersonNewsletter {
|
|
|
3936
3941
|
"""
|
|
3937
3942
|
email: String!
|
|
3938
3943
|
}
|
|
3939
|
-
`,
|
|
3940
|
-
`,
|
|
3944
|
+
`, Hi = `scalar ObjectOrString
|
|
3945
|
+
`, Xi = `"""
|
|
3941
3946
|
Offer information.
|
|
3942
3947
|
"""
|
|
3943
3948
|
type StoreOffer {
|
|
@@ -4030,7 +4035,7 @@ input IStoreOffer {
|
|
|
4030
4035
|
"""
|
|
4031
4036
|
priceToken: String
|
|
4032
4037
|
}
|
|
4033
|
-
`,
|
|
4038
|
+
`, Yi = `"""
|
|
4034
4039
|
Information of a specific order.
|
|
4035
4040
|
"""
|
|
4036
4041
|
type StoreOrder {
|
|
@@ -4065,7 +4070,7 @@ input IStoreOrder {
|
|
|
4065
4070
|
"""
|
|
4066
4071
|
shouldSplitItem: Boolean
|
|
4067
4072
|
}
|
|
4068
|
-
`,
|
|
4073
|
+
`, Ji = `"""
|
|
4069
4074
|
Commercial Authorization response.
|
|
4070
4075
|
"""
|
|
4071
4076
|
type CommercialAuthorizationResponse {
|
|
@@ -4464,7 +4469,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
4464
4469
|
"""
|
|
4465
4470
|
rule: CommercialAuthorizationRule!
|
|
4466
4471
|
}
|
|
4467
|
-
`,
|
|
4472
|
+
`, Ki = `"""
|
|
4468
4473
|
Input for uploading a file to the Order Entry Service.
|
|
4469
4474
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
4470
4475
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -4525,7 +4530,7 @@ type StoreOrderFormCartItem {
|
|
|
4525
4530
|
seller: String!
|
|
4526
4531
|
unitMultiplier: Float
|
|
4527
4532
|
}
|
|
4528
|
-
`,
|
|
4533
|
+
`, Qi = `"""
|
|
4529
4534
|
Organization.
|
|
4530
4535
|
"""
|
|
4531
4536
|
type StoreOrganization {
|
|
@@ -4562,7 +4567,7 @@ type StoreContract {
|
|
|
4562
4567
|
"""
|
|
4563
4568
|
isActive: Boolean!
|
|
4564
4569
|
}
|
|
4565
|
-
`,
|
|
4570
|
+
`, Zi = `"""
|
|
4566
4571
|
Whenever you make a query that allows for pagination, such as \`allProducts\` or \`allCollections\`, you can check \`StorePageInfo\` to learn more about the complete set of items and use it to paginate your queries.
|
|
4567
4572
|
"""
|
|
4568
4573
|
type StorePageInfo {
|
|
@@ -4587,7 +4592,7 @@ type StorePageInfo {
|
|
|
4587
4592
|
"""
|
|
4588
4593
|
totalCount: Int!
|
|
4589
4594
|
}
|
|
4590
|
-
`,
|
|
4595
|
+
`, eo = `"""
|
|
4591
4596
|
Input type for setting a new password.
|
|
4592
4597
|
"""
|
|
4593
4598
|
input ISetPassword {
|
|
@@ -4630,7 +4635,7 @@ type SetPasswordResponse {
|
|
|
4630
4635
|
"""
|
|
4631
4636
|
message: String
|
|
4632
4637
|
}
|
|
4633
|
-
`,
|
|
4638
|
+
`, no = `"""
|
|
4634
4639
|
Client profile data.
|
|
4635
4640
|
"""
|
|
4636
4641
|
type StorePerson {
|
|
@@ -4673,7 +4678,7 @@ input IStorePerson {
|
|
|
4673
4678
|
"""
|
|
4674
4679
|
familyName: String!
|
|
4675
4680
|
}
|
|
4676
|
-
`,
|
|
4681
|
+
`, to = `type PickupPointAddress {
|
|
4677
4682
|
"""
|
|
4678
4683
|
Address city.
|
|
4679
4684
|
"""
|
|
@@ -4752,7 +4757,7 @@ type PickupPoints {
|
|
|
4752
4757
|
"""
|
|
4753
4758
|
pickupPointsHash: String
|
|
4754
4759
|
}
|
|
4755
|
-
`,
|
|
4760
|
+
`, ro = `"""
|
|
4756
4761
|
Product information. Products are variants within product groups, equivalent to VTEX [SKUs](https://help.vtex.com/en/tutorial/what-is-an-sku--1K75s4RXAQyOuGUYKMM68u#). For example, you may have a **Shirt** product group with associated products such as **Blue shirt size L**, **Green shirt size XL** and so on.
|
|
4757
4762
|
"""
|
|
4758
4763
|
type StoreProduct {
|
|
@@ -4920,7 +4925,7 @@ input IStoreProduct {
|
|
|
4920
4925
|
"""
|
|
4921
4926
|
additionalProperty: [IStorePropertyValue!]
|
|
4922
4927
|
}
|
|
4923
|
-
`,
|
|
4928
|
+
`, io = `"""
|
|
4924
4929
|
Product group information. Product groups are catalog entities that may contain variants. They are equivalent to VTEX [Products](https://help.vtex.com/en/tutorial/what-is-a-product--2zrB2gFCHyQokCKKE8kuAw#), whereas each variant is equivalent to a VTEX [SKU](https://help.vtex.com/en/tutorial/what-is-an-sku--1K75s4RXAQyOuGUYKMM68u#). For example, you may have a **Shirt** product group with associated products such as **Blue shirt size L**, **Green shirt size XL** and so on.
|
|
4925
4930
|
"""
|
|
4926
4931
|
type StoreProductGroup {
|
|
@@ -4947,7 +4952,7 @@ type StoreProductGroup {
|
|
|
4947
4952
|
"""
|
|
4948
4953
|
skuVariants: SkuVariants
|
|
4949
4954
|
}
|
|
4950
|
-
`,
|
|
4955
|
+
`, oo = `type Profile {
|
|
4951
4956
|
"""
|
|
4952
4957
|
Collection of user's address
|
|
4953
4958
|
"""
|
|
@@ -5008,7 +5013,7 @@ type ProfileAddress {
|
|
|
5008
5013
|
"""
|
|
5009
5014
|
geoCoordinate: [Float]
|
|
5010
5015
|
}
|
|
5011
|
-
`,
|
|
5016
|
+
`, ao = `"""
|
|
5012
5017
|
Properties that can be associated with products and products groups.
|
|
5013
5018
|
"""
|
|
5014
5019
|
type StorePropertyValue {
|
|
@@ -5048,7 +5053,7 @@ input IStorePropertyValue {
|
|
|
5048
5053
|
"""
|
|
5049
5054
|
valueReference: ObjectOrString!
|
|
5050
5055
|
}
|
|
5051
|
-
`,
|
|
5056
|
+
`, so = `"""
|
|
5052
5057
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
5053
5058
|
"""
|
|
5054
5059
|
type StoreProductEdge {
|
|
@@ -5678,7 +5683,7 @@ type StoreAccountProfile {
|
|
|
5678
5683
|
email: String
|
|
5679
5684
|
id: String
|
|
5680
5685
|
}
|
|
5681
|
-
`,
|
|
5686
|
+
`, co = `"""
|
|
5682
5687
|
Summary of a quote returned in list results.
|
|
5683
5688
|
"""
|
|
5684
5689
|
type UserQuoteSummary {
|
|
@@ -5743,7 +5748,7 @@ type UserQuoteListPaging {
|
|
|
5743
5748
|
"""
|
|
5744
5749
|
perPage: Int!
|
|
5745
5750
|
}
|
|
5746
|
-
`,
|
|
5751
|
+
`, lo = `type RecommendationResponse {
|
|
5747
5752
|
products: [StoreProduct!]!
|
|
5748
5753
|
correlationId: String!
|
|
5749
5754
|
campaign: RecommendationCampaign!
|
|
@@ -5754,7 +5759,7 @@ type RecommendationCampaign {
|
|
|
5754
5759
|
title: String
|
|
5755
5760
|
type: String!
|
|
5756
5761
|
}
|
|
5757
|
-
`,
|
|
5762
|
+
`, uo = `"""
|
|
5758
5763
|
Information of a given review rating.
|
|
5759
5764
|
"""
|
|
5760
5765
|
type StoreReviewRating {
|
|
@@ -5781,7 +5786,7 @@ type StoreReview {
|
|
|
5781
5786
|
"""
|
|
5782
5787
|
author: StoreAuthor!
|
|
5783
5788
|
}
|
|
5784
|
-
`,
|
|
5789
|
+
`, po = `"""
|
|
5785
5790
|
Search Engine Optimization (SEO) tags data.
|
|
5786
5791
|
"""
|
|
5787
5792
|
type StoreSeo {
|
|
@@ -5802,7 +5807,7 @@ type StoreSeo {
|
|
|
5802
5807
|
"""
|
|
5803
5808
|
canonical: String!
|
|
5804
5809
|
}
|
|
5805
|
-
`,
|
|
5810
|
+
`, go = `"""
|
|
5806
5811
|
Currency information.
|
|
5807
5812
|
"""
|
|
5808
5813
|
type StoreCurrency {
|
|
@@ -6077,7 +6082,7 @@ input IStoreSession {
|
|
|
6077
6082
|
"""
|
|
6078
6083
|
refreshAfter: String
|
|
6079
6084
|
}
|
|
6080
|
-
`,
|
|
6085
|
+
`, mo = `"""
|
|
6081
6086
|
Shipping Simulation item input.
|
|
6082
6087
|
"""
|
|
6083
6088
|
input IShippingItem {
|
|
@@ -6408,7 +6413,7 @@ type MessageFields {
|
|
|
6408
6413
|
"""
|
|
6409
6414
|
skuName: String
|
|
6410
6415
|
}
|
|
6411
|
-
`,
|
|
6416
|
+
`, ho = `type SkuVariants {
|
|
6412
6417
|
"""
|
|
6413
6418
|
SKU property values for the current SKU.
|
|
6414
6419
|
"""
|
|
@@ -6503,7 +6508,7 @@ Example:
|
|
|
6503
6508
|
\`\`\`
|
|
6504
6509
|
"""
|
|
6505
6510
|
scalar FormattedVariants
|
|
6506
|
-
`,
|
|
6511
|
+
`, fo = `"""
|
|
6507
6512
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
6508
6513
|
"""
|
|
6509
6514
|
enum StoreStatus {
|
|
@@ -6511,7 +6516,7 @@ enum StoreStatus {
|
|
|
6511
6516
|
WARNING
|
|
6512
6517
|
ERROR
|
|
6513
6518
|
}
|
|
6514
|
-
`,
|
|
6519
|
+
`, So = `scalar JSONObject
|
|
6515
6520
|
|
|
6516
6521
|
type UserOrder {
|
|
6517
6522
|
orderId: String
|
|
@@ -7335,97 +7340,94 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
7335
7340
|
type: String
|
|
7336
7341
|
id: String
|
|
7337
7342
|
}
|
|
7338
|
-
`,
|
|
7339
|
-
"./address.graphql":
|
|
7340
|
-
"./advertisement.graphql":
|
|
7341
|
-
"./aggregateOffer.graphql":
|
|
7342
|
-
"./aggregateRating.graphql":
|
|
7343
|
-
"./author.graphql":
|
|
7344
|
-
"./brand.graphql":
|
|
7345
|
-
"./breadcrumb.graphql":
|
|
7346
|
-
"./cart.graphql":
|
|
7347
|
-
"./collection.graphql":
|
|
7348
|
-
"./deliveryPromisesBadge.graphql":
|
|
7349
|
-
"./facet.graphql":
|
|
7350
|
-
"./image.graphql":
|
|
7351
|
-
"./mutation.graphql":
|
|
7352
|
-
"./newsletter.graphql":
|
|
7353
|
-
"./objectOrString.graphql":
|
|
7354
|
-
"./offer.graphql":
|
|
7355
|
-
"./order.graphql":
|
|
7356
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
7357
|
-
"./orderEntry.graphql":
|
|
7358
|
-
"./organization.graphql":
|
|
7359
|
-
"./pageInfo.graphql":
|
|
7360
|
-
"./password.graphql":
|
|
7361
|
-
"./person.graphql":
|
|
7362
|
-
"./pickupPoints.graphql":
|
|
7363
|
-
"./product.graphql":
|
|
7364
|
-
"./productGroup.graphql":
|
|
7365
|
-
"./profile.graphql":
|
|
7366
|
-
"./propertyValue.graphql":
|
|
7367
|
-
"./query.graphql":
|
|
7368
|
-
"./quote.graphql":
|
|
7369
|
-
"./recommendation.graphql":
|
|
7370
|
-
"./review.graphql":
|
|
7371
|
-
"./seo.graphql":
|
|
7372
|
-
"./session.graphql":
|
|
7373
|
-
"./shipping.graphql":
|
|
7374
|
-
"./skuVariants.graphql":
|
|
7375
|
-
"./status.graphql":
|
|
7376
|
-
"./userOrder.graphql":
|
|
7377
|
-
}),
|
|
7378
|
-
Object.values(
|
|
7379
|
-
(e, n) =>
|
|
7343
|
+
`, yo = /* @__PURE__ */ Object.assign({
|
|
7344
|
+
"./address.graphql": Ri,
|
|
7345
|
+
"./advertisement.graphql": Fi,
|
|
7346
|
+
"./aggregateOffer.graphql": Ni,
|
|
7347
|
+
"./aggregateRating.graphql": Li,
|
|
7348
|
+
"./author.graphql": Bi,
|
|
7349
|
+
"./brand.graphql": $i,
|
|
7350
|
+
"./breadcrumb.graphql": Mi,
|
|
7351
|
+
"./cart.graphql": zi,
|
|
7352
|
+
"./collection.graphql": Vi,
|
|
7353
|
+
"./deliveryPromisesBadge.graphql": xi,
|
|
7354
|
+
"./facet.graphql": qi,
|
|
7355
|
+
"./image.graphql": ji,
|
|
7356
|
+
"./mutation.graphql": Wi,
|
|
7357
|
+
"./newsletter.graphql": Gi,
|
|
7358
|
+
"./objectOrString.graphql": Hi,
|
|
7359
|
+
"./offer.graphql": Xi,
|
|
7360
|
+
"./order.graphql": Yi,
|
|
7361
|
+
"./orderCommercialAuthorizaton.graphql": Ji,
|
|
7362
|
+
"./orderEntry.graphql": Ki,
|
|
7363
|
+
"./organization.graphql": Qi,
|
|
7364
|
+
"./pageInfo.graphql": Zi,
|
|
7365
|
+
"./password.graphql": eo,
|
|
7366
|
+
"./person.graphql": no,
|
|
7367
|
+
"./pickupPoints.graphql": to,
|
|
7368
|
+
"./product.graphql": ro,
|
|
7369
|
+
"./productGroup.graphql": io,
|
|
7370
|
+
"./profile.graphql": oo,
|
|
7371
|
+
"./propertyValue.graphql": ao,
|
|
7372
|
+
"./query.graphql": so,
|
|
7373
|
+
"./quote.graphql": co,
|
|
7374
|
+
"./recommendation.graphql": lo,
|
|
7375
|
+
"./review.graphql": uo,
|
|
7376
|
+
"./seo.graphql": po,
|
|
7377
|
+
"./session.graphql": go,
|
|
7378
|
+
"./shipping.graphql": mo,
|
|
7379
|
+
"./skuVariants.graphql": ho,
|
|
7380
|
+
"./status.graphql": fo,
|
|
7381
|
+
"./userOrder.graphql": So
|
|
7382
|
+
}), Io = Rn(
|
|
7383
|
+
Object.values(yo).map((e) => Fn(e)).reduce(
|
|
7384
|
+
(e, n) => Ze([e, n], { sort: !0 })
|
|
7380
7385
|
)
|
|
7381
|
-
),
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
);
|
|
7390
|
-
function Sa() {
|
|
7391
|
-
const e = Ui(), n = {};
|
|
7386
|
+
), vo = Io, $o = async (e) => (n) => (n.storage = {
|
|
7387
|
+
channel: ae.parse(e.channel),
|
|
7388
|
+
flags: e.flags ?? {},
|
|
7389
|
+
locale: e.locale,
|
|
7390
|
+
cookies: /* @__PURE__ */ new Map()
|
|
7391
|
+
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients = qt(e, n), n.loaders = Zt(e, n), n);
|
|
7392
|
+
function Oo() {
|
|
7393
|
+
const e = Ei(), n = {};
|
|
7392
7394
|
for (const [t, r] of Object.entries(e))
|
|
7393
7395
|
n[t] = Object.fromEntries(
|
|
7394
|
-
Object.entries(r).map(([i,
|
|
7396
|
+
Object.entries(r).map(([i, o]) => typeof o != "function" ? [i, o] : [i, nt(o, `${t}(${i})`)])
|
|
7395
7397
|
);
|
|
7396
7398
|
return n;
|
|
7397
7399
|
}
|
|
7398
|
-
function
|
|
7399
|
-
const t =
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
])(
|
|
7403
|
-
return e &&
|
|
7400
|
+
function Mo(e) {
|
|
7401
|
+
const t = Zn([
|
|
7402
|
+
Qn,
|
|
7403
|
+
Yn
|
|
7404
|
+
])(Oo(), vo);
|
|
7405
|
+
return e && Nn(e) ? _n({
|
|
7404
7406
|
schemas: [t, e]
|
|
7405
7407
|
}) : t;
|
|
7406
7408
|
}
|
|
7407
7409
|
export {
|
|
7408
|
-
|
|
7410
|
+
Yn as AuthDirective,
|
|
7409
7411
|
_ as BadRequestError,
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
+
Qn as CacheControlDirective,
|
|
7413
|
+
zn as CommercialAuthorizationStatus,
|
|
7412
7414
|
ee as FastStoreError,
|
|
7413
7415
|
J as ForbiddenError,
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7416
|
+
$o as GraphqlVtexContextFactory,
|
|
7417
|
+
Mo as GraphqlVtexSchema,
|
|
7418
|
+
B as NotFoundError,
|
|
7419
|
+
Vn as StoreCollectionType,
|
|
7420
|
+
xn as StoreFacetType,
|
|
7421
|
+
qn as StoreSort,
|
|
7422
|
+
jn as StoreStatus,
|
|
7421
7423
|
te as UnauthorizedError,
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7424
|
+
Wn as UserOrderInvoiceType,
|
|
7425
|
+
Lo as isBadRequestError,
|
|
7426
|
+
No as isFastStoreError,
|
|
7427
|
+
tt as isForbiddenError,
|
|
7426
7428
|
X as isNotFoundError,
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7429
|
+
Bo as isUnauthorizedError,
|
|
7430
|
+
Fo as stringifyCacheControl,
|
|
7431
|
+
vo as typeDefs,
|
|
7432
|
+
Zn as withDirectives
|
|
7431
7433
|
};
|