@faststore/api 4.5.0-dev.5 → 4.5.0-dev.7
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 +8 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +443 -434
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/platforms/vtex/index.d.ts +1 -1
- package/dist/src/platforms/vtex/resolvers/index.d.ts +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/platforms/vtex/resolvers/query.ts +30 -6
package/dist/es/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
1
|
+
import { mergeTypeDefs as en } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as Un, mergeSchemas as Tn } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as nn, MapperKind as tn, getDirective as rn } from "@graphql-tools/utils";
|
|
4
4
|
import { OTELAPI as L } from "@faststore/diagnostics";
|
|
5
|
-
import { GraphQLScalarType as
|
|
6
|
-
import
|
|
5
|
+
import { GraphQLScalarType as _n, print as En, parse as Rn, isSchema as Fn } from "graphql";
|
|
6
|
+
import Nn from "isomorphic-unfetch";
|
|
7
7
|
import { parse as Z } from "cookie";
|
|
8
8
|
import Pe from "p-limit";
|
|
9
9
|
import le from "dataloader";
|
|
10
|
-
import
|
|
10
|
+
import Ln from "sanitize-html";
|
|
11
11
|
import Ae from "fast-deep-equal";
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const
|
|
12
|
+
import Bn from "node:crypto";
|
|
13
|
+
var $n = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))($n || {}), Mn = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(Mn || {}), zn = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(zn || {}), Vn = /* @__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))(Vn || {}), xn = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(xn || {}), qn = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(qn || {});
|
|
14
|
+
const jn = () => 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 qn = () => function(n = {}) {
|
|
|
20
20
|
"X-VTEX-API-AppKey": t,
|
|
21
21
|
"X-VTEX-API-AppToken": r
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, Wn = async (e) => {
|
|
24
24
|
const {
|
|
25
25
|
clients: { commerce: n }
|
|
26
26
|
} = e;
|
|
@@ -31,59 +31,59 @@ const qn = () => 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
|
+
}, Gn = "auth", Hn = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (e) =>
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
36
|
+
transformer: (e) => nn(e, {
|
|
37
|
+
[tn.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (rn(e, n, Gn)?.[0]) {
|
|
39
39
|
const r = n.resolve;
|
|
40
|
-
n.resolve = async (i, a, o, s) => (await
|
|
40
|
+
n.resolve = async (i, a, o, s) => (await Wn(o), r?.(i, a, o, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, Xn = "cacheControl", _a = (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
|
-
}, Ue = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n,
|
|
52
|
+
}, Ue = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, Yn = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, Jn = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (e) =>
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (e) => nn(e, {
|
|
55
|
+
[tn.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = rn(e, n, Xn)?.[0];
|
|
57
57
|
if (t) {
|
|
58
58
|
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
|
|
59
|
-
n.resolve = (s, c, l,
|
|
59
|
+
n.resolve = (s, c, l, g) => (l.cacheControl = {
|
|
60
60
|
sMaxAge: Ue(l.cacheControl?.sMaxAge, r),
|
|
61
61
|
staleWhileRevalidate: Ue(
|
|
62
62
|
l.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
66
|
-
}, o?.(s, c, l,
|
|
65
|
+
scope: Yn(l.cacheControl?.scope, a)
|
|
66
|
+
}, o?.(s, c, l, g));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
71
|
+
}, Kn = (e) => (n, t) => {
|
|
72
|
+
const r = en([
|
|
73
73
|
...(e ?? []).map(({ typeDefs: i }) => i),
|
|
74
74
|
t
|
|
75
75
|
]);
|
|
76
76
|
return (e ?? []).reduce(
|
|
77
77
|
(i, { transformer: a }) => a?.(i) ?? i,
|
|
78
|
-
|
|
78
|
+
Un({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
}, pe = "@faststore/api", ge = "4.5.0-dev.
|
|
83
|
+
}, pe = "@faststore/api", ge = "4.5.0-dev.6", Te = {
|
|
84
84
|
name: pe,
|
|
85
85
|
version: ge
|
|
86
|
-
},
|
|
86
|
+
}, Qn = (e, n) => (t, r, i, a) => {
|
|
87
87
|
if ((i?.OTEL?.enabled ?? !1) === !1)
|
|
88
88
|
return e(t, r, i, a);
|
|
89
89
|
const o = L.trace.getTracer(pe, ge), s = L.propagation.extract(
|
|
@@ -105,7 +105,7 @@ const qn = () => function(n = {}) {
|
|
|
105
105
|
if (!c) return e(t, r, i, a);
|
|
106
106
|
try {
|
|
107
107
|
const l = e(t, r, i, a);
|
|
108
|
-
return l instanceof Promise ? l.then((
|
|
108
|
+
return l instanceof Promise ? l.then((g) => (c.end(), g)) : (c.end(), l);
|
|
109
109
|
} catch (l) {
|
|
110
110
|
throw c.end(), console.error(`Error when executing resolver: ${n}`, l), l;
|
|
111
111
|
}
|
|
@@ -136,12 +136,12 @@ class $ extends ee {
|
|
|
136
136
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type === "BadRequestError", Fa = (e) => e?.extensions?.type === "UnauthorizedError",
|
|
140
|
-
const r = await
|
|
139
|
+
const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type === "BadRequestError", Fa = (e) => e?.extensions?.type === "UnauthorizedError", Zn = (e) => e?.extensions?.type === "ForbiddenError", X = (e) => e?.extensions?.type === "NotFoundError", et = `${Te.name}@${Te.version}`, I = async (e, n, t) => {
|
|
140
|
+
const r = await Nn(e, {
|
|
141
141
|
...n,
|
|
142
142
|
headers: {
|
|
143
143
|
...n?.headers ?? {},
|
|
144
|
-
"User-Agent":
|
|
144
|
+
"User-Agent": et
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
if (r.ok)
|
|
@@ -165,7 +165,7 @@ const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type
|
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
throw new Error(i);
|
|
168
|
-
},
|
|
168
|
+
}, nt = ({ account: e, environment: n }) => {
|
|
169
169
|
const t = `https://${e}.${n}.com.br`;
|
|
170
170
|
return {
|
|
171
171
|
getLocalizedProduct: (r, i) => I(`${t}/api/catalog-dataplane/product/${r}`, {
|
|
@@ -176,7 +176,7 @@ const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type
|
|
|
176
176
|
}
|
|
177
177
|
})
|
|
178
178
|
};
|
|
179
|
-
},
|
|
179
|
+
}, an = (e) => {
|
|
180
180
|
if (!e)
|
|
181
181
|
return e;
|
|
182
182
|
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
@@ -190,8 +190,8 @@ const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
193
|
-
},
|
|
194
|
-
const t = n.match(
|
|
193
|
+
}, tt = /^([^=]+)=([^;]*)/, rt = (e, n) => {
|
|
194
|
+
const t = n.match(tt);
|
|
195
195
|
if (t) {
|
|
196
196
|
const r = t[1], i = t[2];
|
|
197
197
|
e.storage.cookies.set(r, {
|
|
@@ -199,32 +199,32 @@ const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type
|
|
|
199
199
|
setCookie: n
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
|
-
},
|
|
202
|
+
}, it = (e, n) => {
|
|
203
203
|
n.getSetCookie().forEach(
|
|
204
|
-
(t) =>
|
|
204
|
+
(t) => rt(e, t)
|
|
205
205
|
);
|
|
206
|
-
},
|
|
206
|
+
}, at = (e) => (n) => it(e, n), me = (e) => {
|
|
207
207
|
if (!e.headers?.cookie)
|
|
208
208
|
return null;
|
|
209
|
-
const n =
|
|
209
|
+
const n = an(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
210
210
|
return t.length === 0 ? n : t.reduce(
|
|
211
|
-
(r, [i, { value: a }]) =>
|
|
211
|
+
(r, [i, { value: a }]) => ot(
|
|
212
212
|
r,
|
|
213
213
|
i,
|
|
214
214
|
a
|
|
215
215
|
),
|
|
216
216
|
n
|
|
217
217
|
);
|
|
218
|
-
},
|
|
218
|
+
}, on = (e) => function(t) {
|
|
219
219
|
const r = me(e);
|
|
220
220
|
return r ? {
|
|
221
221
|
...t,
|
|
222
222
|
cookie: r
|
|
223
223
|
} : t;
|
|
224
224
|
}, z = (e, n) => {
|
|
225
|
-
const t =
|
|
225
|
+
const t = an(e);
|
|
226
226
|
return Z(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
227
|
-
},
|
|
227
|
+
}, ot = (e, n, t) => {
|
|
228
228
|
const r = new RegExp(`(${n})=([^;]*)`), i = e.match(r);
|
|
229
229
|
return i ? e.replace(
|
|
230
230
|
i[0],
|
|
@@ -234,12 +234,12 @@ const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type
|
|
|
234
234
|
function Y(e) {
|
|
235
235
|
return e ? JSON.parse(Buffer.from(e.split(".")[1], "base64").toString()) : null;
|
|
236
236
|
}
|
|
237
|
-
const
|
|
237
|
+
const st = "storefront/faststore.recommendation-shelf@v4", j = {
|
|
238
238
|
method: "POST",
|
|
239
239
|
headers: {
|
|
240
240
|
"content-type": "application/json"
|
|
241
241
|
}
|
|
242
|
-
},
|
|
242
|
+
}, ct = (e) => e.split("/").map(encodeURIComponent).join("/"), ue = (e) => e ? { headers: { "Accept-Language": e } } : void 0, lt = /^\d{4}-\d{2}-\d{2}$/, dt = /* @__PURE__ */ new Set([
|
|
243
243
|
"Draft",
|
|
244
244
|
"Requested",
|
|
245
245
|
"InReview",
|
|
@@ -250,7 +250,7 @@ const ot = "storefront/faststore.recommendation-shelf@v4", j = {
|
|
|
250
250
|
"ConvertedToCart",
|
|
251
251
|
"ConvertedToOrder"
|
|
252
252
|
]);
|
|
253
|
-
function
|
|
253
|
+
function ut({
|
|
254
254
|
page: e,
|
|
255
255
|
perPage: n,
|
|
256
256
|
status: t,
|
|
@@ -273,19 +273,19 @@ function dt({
|
|
|
273
273
|
["expiresAtFrom", a],
|
|
274
274
|
["expiresAtTo", o]
|
|
275
275
|
])
|
|
276
|
-
if (c && !
|
|
276
|
+
if (c && !lt.test(c))
|
|
277
277
|
throw new Error(
|
|
278
278
|
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
279
279
|
);
|
|
280
280
|
if (t && t.length > 0) {
|
|
281
|
-
const s = t.filter((c) => !
|
|
281
|
+
const s = t.filter((c) => !dt.has(c));
|
|
282
282
|
if (s.length > 0)
|
|
283
283
|
throw new Error(
|
|
284
284
|
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
285
285
|
);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function pt({
|
|
289
289
|
page: e,
|
|
290
290
|
perPage: n,
|
|
291
291
|
status: t,
|
|
@@ -298,17 +298,17 @@ function ut({
|
|
|
298
298
|
const c = new URLSearchParams();
|
|
299
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), a && c.append("expiresAtFrom", a), o && c.append("expiresAtTo", o), s?.trim() && c.append("label", s.trim()), c;
|
|
300
300
|
}
|
|
301
|
-
const
|
|
302
|
-
const a = `https://${e}.${n}.com.br`, o =
|
|
301
|
+
const gt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
302
|
+
const a = `https://${e}.${n}.com.br`, o = at(i), s = on(i), c = jn(), 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 = `${a}/api/recommend-bff/v2`, f = s({
|
|
303
303
|
accept: "application/json",
|
|
304
304
|
"content-type": "application/json",
|
|
305
|
-
"x-vtex-rec-origin": `${e}/${
|
|
305
|
+
"x-vtex-rec-origin": `${e}/${st}`
|
|
306
306
|
}), v = (d = {}) => {
|
|
307
|
-
const
|
|
307
|
+
const p = z(me(i) ?? "", e);
|
|
308
308
|
return s({
|
|
309
309
|
...d,
|
|
310
310
|
"X-FORWARDED-HOST": u,
|
|
311
|
-
...
|
|
311
|
+
...p ? { [`VtexIdclientAutCookie_${e}`]: p } : {}
|
|
312
312
|
});
|
|
313
313
|
};
|
|
314
314
|
return {
|
|
@@ -341,33 +341,33 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
341
341
|
// The by-linkid endpoints resolve a slug to a single catalog entity
|
|
342
342
|
// (or 404 when there is no match). We surface a 404 as `null` so the
|
|
343
343
|
// loader can cascade category → brand → collection.
|
|
344
|
-
category: async (d,
|
|
344
|
+
category: async (d, p) => {
|
|
345
345
|
try {
|
|
346
346
|
return await I(
|
|
347
|
-
`${a}/api/catalog_system/pub/category/by-linkid/${
|
|
348
|
-
ue(
|
|
347
|
+
`${a}/api/catalog_system/pub/category/by-linkid/${ct(d)}`,
|
|
348
|
+
ue(p)
|
|
349
349
|
);
|
|
350
350
|
} catch (m) {
|
|
351
351
|
if (X(m)) return null;
|
|
352
352
|
throw m;
|
|
353
353
|
}
|
|
354
354
|
},
|
|
355
|
-
brand: async (d,
|
|
355
|
+
brand: async (d, p) => {
|
|
356
356
|
try {
|
|
357
357
|
return await I(
|
|
358
358
|
`${a}/api/catalog_system/pub/brand/by-linkid/${encodeURIComponent(d)}`,
|
|
359
|
-
ue(
|
|
359
|
+
ue(p)
|
|
360
360
|
);
|
|
361
361
|
} catch (m) {
|
|
362
362
|
if (X(m)) return null;
|
|
363
363
|
throw m;
|
|
364
364
|
}
|
|
365
365
|
},
|
|
366
|
-
collection: async (d,
|
|
366
|
+
collection: async (d, p) => {
|
|
367
367
|
try {
|
|
368
368
|
return await I(
|
|
369
369
|
`${a}/api/catalog_system/pub/collection/by-linkid/${encodeURIComponent(d)}`,
|
|
370
|
-
ue(
|
|
370
|
+
ue(p)
|
|
371
371
|
);
|
|
372
372
|
} catch (m) {
|
|
373
373
|
if (X(m)) return null;
|
|
@@ -378,7 +378,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
378
378
|
products: {
|
|
379
379
|
crossselling: ({
|
|
380
380
|
type: d,
|
|
381
|
-
productId:
|
|
381
|
+
productId: p,
|
|
382
382
|
groupByProduct: m = !0
|
|
383
383
|
}) => {
|
|
384
384
|
const y = new URLSearchParams({
|
|
@@ -386,7 +386,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
386
386
|
groupByProduct: m.toString()
|
|
387
387
|
});
|
|
388
388
|
return I(
|
|
389
|
-
`${a}/api/catalog_system/pub/products/crossselling/${d}/${
|
|
389
|
+
`${a}/api/catalog_system/pub/products/crossselling/${d}/${p}?${y}`,
|
|
390
390
|
void 0,
|
|
391
391
|
{ storeCookies: o }
|
|
392
392
|
);
|
|
@@ -394,9 +394,9 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
394
394
|
}
|
|
395
395
|
},
|
|
396
396
|
checkout: {
|
|
397
|
-
simulation: (d, { salesChannel:
|
|
397
|
+
simulation: (d, { salesChannel: p } = i.storage.channel) => {
|
|
398
398
|
const m = new URLSearchParams({
|
|
399
|
-
sc:
|
|
399
|
+
sc: p
|
|
400
400
|
}), y = s({
|
|
401
401
|
"content-type": "application/json",
|
|
402
402
|
"X-FORWARDED-HOST": u
|
|
@@ -413,7 +413,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
413
413
|
},
|
|
414
414
|
shippingData: ({
|
|
415
415
|
id: d,
|
|
416
|
-
index:
|
|
416
|
+
index: p,
|
|
417
417
|
deliveryMode: m,
|
|
418
418
|
selectedAddresses: y
|
|
419
419
|
}, O) => {
|
|
@@ -421,7 +421,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
421
421
|
startDateUtc: m?.deliveryWindow?.startDate,
|
|
422
422
|
endDateUtc: m?.deliveryWindow?.endDate
|
|
423
423
|
} : null, C = {
|
|
424
|
-
logisticsInfo: Array.from({ length:
|
|
424
|
+
logisticsInfo: Array.from({ length: p }, (S, D) => ({
|
|
425
425
|
itemIndex: D,
|
|
426
426
|
selectedDeliveryChannel: m?.deliveryChannel || null,
|
|
427
427
|
selectedSla: m?.deliveryMethod || null,
|
|
@@ -445,7 +445,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
445
445
|
},
|
|
446
446
|
marketingData: ({
|
|
447
447
|
id: d,
|
|
448
|
-
marketingData:
|
|
448
|
+
marketingData: p
|
|
449
449
|
}) => {
|
|
450
450
|
const m = s({
|
|
451
451
|
"content-type": "application/json",
|
|
@@ -455,7 +455,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
455
455
|
`${a}/api/checkout/pub/orderForm/${d}/attachments/marketingData`,
|
|
456
456
|
{
|
|
457
457
|
headers: m,
|
|
458
|
-
body: JSON.stringify(
|
|
458
|
+
body: JSON.stringify(p),
|
|
459
459
|
method: "POST"
|
|
460
460
|
},
|
|
461
461
|
{ storeCookies: o }
|
|
@@ -463,7 +463,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
463
463
|
},
|
|
464
464
|
clientPreferencesData: ({
|
|
465
465
|
id: d,
|
|
466
|
-
clientPreferencesData:
|
|
466
|
+
clientPreferencesData: p
|
|
467
467
|
}) => {
|
|
468
468
|
const m = s({
|
|
469
469
|
"content-type": "application/json",
|
|
@@ -473,7 +473,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
473
473
|
`${a}/api/checkout/pub/orderForm/${d}/attachments/clientPreferencesData`,
|
|
474
474
|
{
|
|
475
475
|
headers: m,
|
|
476
|
-
body: JSON.stringify(
|
|
476
|
+
body: JSON.stringify(p),
|
|
477
477
|
method: "POST"
|
|
478
478
|
},
|
|
479
479
|
{ storeCookies: o }
|
|
@@ -481,14 +481,14 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
481
481
|
},
|
|
482
482
|
orderForm: ({
|
|
483
483
|
id: d,
|
|
484
|
-
refreshOutdatedData:
|
|
484
|
+
refreshOutdatedData: p = !0,
|
|
485
485
|
channel: m = i.storage.channel
|
|
486
486
|
}) => {
|
|
487
487
|
const { salesChannel: y } = m, O = s({
|
|
488
488
|
"content-type": "application/json",
|
|
489
489
|
"X-FORWARDED-HOST": u
|
|
490
490
|
}), w = new URLSearchParams({ sc: y });
|
|
491
|
-
d && w.set("refreshOutdatedData",
|
|
491
|
+
d && w.set("refreshOutdatedData", p.toString());
|
|
492
492
|
const C = `${a}/api/checkout/pub/orderForm${d ? `/${d}` : ""}?${w.toString()}`;
|
|
493
493
|
return I(
|
|
494
494
|
C,
|
|
@@ -501,7 +501,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
501
501
|
);
|
|
502
502
|
},
|
|
503
503
|
clearOrderFormMessages: ({ id: d }) => {
|
|
504
|
-
const
|
|
504
|
+
const p = s({
|
|
505
505
|
"content-type": "application/json",
|
|
506
506
|
"X-FORWARDED-HOST": u
|
|
507
507
|
});
|
|
@@ -509,14 +509,14 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
509
509
|
`${a}/api/checkout/pub/orderForm/${d}/messages/clear`,
|
|
510
510
|
{
|
|
511
511
|
...j,
|
|
512
|
-
headers:
|
|
512
|
+
headers: p,
|
|
513
513
|
body: "{}"
|
|
514
514
|
}
|
|
515
515
|
);
|
|
516
516
|
},
|
|
517
517
|
updateOrderFormItems: ({
|
|
518
518
|
id: d,
|
|
519
|
-
orderItems:
|
|
519
|
+
orderItems: p,
|
|
520
520
|
allowOutdatedData: m = "paymentData",
|
|
521
521
|
salesChannel: y = i.storage.channel.salesChannel,
|
|
522
522
|
shouldSplitItem: O = !0
|
|
@@ -533,7 +533,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
533
533
|
{
|
|
534
534
|
headers: C,
|
|
535
535
|
body: JSON.stringify({
|
|
536
|
-
orderItems:
|
|
536
|
+
orderItems: p,
|
|
537
537
|
noSplitItem: !O
|
|
538
538
|
}),
|
|
539
539
|
method: "PATCH"
|
|
@@ -543,7 +543,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
543
543
|
},
|
|
544
544
|
setCustomData: ({
|
|
545
545
|
id: d,
|
|
546
|
-
appId:
|
|
546
|
+
appId: p,
|
|
547
547
|
key: m,
|
|
548
548
|
value: y
|
|
549
549
|
}) => {
|
|
@@ -552,7 +552,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
552
552
|
"X-FORWARDED-HOST": u
|
|
553
553
|
});
|
|
554
554
|
return I(
|
|
555
|
-
`${a}/api/checkout/pub/orderForm/${d}/customData/${
|
|
555
|
+
`${a}/api/checkout/pub/orderForm/${d}/customData/${p}/${m}`,
|
|
556
556
|
{
|
|
557
557
|
headers: O,
|
|
558
558
|
body: JSON.stringify({ value: y }),
|
|
@@ -562,7 +562,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
562
562
|
},
|
|
563
563
|
region: async ({
|
|
564
564
|
postalCode: d,
|
|
565
|
-
geoCoordinates:
|
|
565
|
+
geoCoordinates: p,
|
|
566
566
|
country: m,
|
|
567
567
|
salesChannel: y
|
|
568
568
|
}) => {
|
|
@@ -572,7 +572,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
572
572
|
});
|
|
573
573
|
d ? O.append("postalCode", d) : O.append(
|
|
574
574
|
"geoCoordinates",
|
|
575
|
-
`${
|
|
575
|
+
`${p?.longitude};${p?.latitude}`
|
|
576
576
|
);
|
|
577
577
|
const w = `${a}/api/checkout/pub/regions/?${O.toString()}`, C = s({
|
|
578
578
|
"content-type": "application/json",
|
|
@@ -588,14 +588,14 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
588
588
|
},
|
|
589
589
|
address: async ({
|
|
590
590
|
postalCode: d,
|
|
591
|
-
country:
|
|
591
|
+
country: p
|
|
592
592
|
}) => {
|
|
593
593
|
const m = s({
|
|
594
594
|
"content-type": "application/json",
|
|
595
595
|
"X-FORWARDED-HOST": u
|
|
596
596
|
});
|
|
597
597
|
return I(
|
|
598
|
-
`${a}/api/checkout/pub/postal-code/${
|
|
598
|
+
`${a}/api/checkout/pub/postal-code/${p}/${d}`,
|
|
599
599
|
{
|
|
600
600
|
headers: m
|
|
601
601
|
},
|
|
@@ -604,7 +604,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
604
604
|
},
|
|
605
605
|
cancelOrder: ({
|
|
606
606
|
orderId: d,
|
|
607
|
-
customerEmail:
|
|
607
|
+
customerEmail: p,
|
|
608
608
|
reason: m
|
|
609
609
|
}) => {
|
|
610
610
|
const y = s({
|
|
@@ -617,7 +617,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
617
617
|
method: "POST",
|
|
618
618
|
headers: y,
|
|
619
619
|
body: JSON.stringify({
|
|
620
|
-
customerEmail:
|
|
620
|
+
customerEmail: p,
|
|
621
621
|
reason: m
|
|
622
622
|
})
|
|
623
623
|
},
|
|
@@ -631,7 +631,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
631
631
|
throw new Error(
|
|
632
632
|
"Missing required parameter for listing pickup points."
|
|
633
633
|
);
|
|
634
|
-
const
|
|
634
|
+
const p = s({
|
|
635
635
|
"content-type": "application/json",
|
|
636
636
|
"X-FORWARDED-HOST": u
|
|
637
637
|
});
|
|
@@ -639,7 +639,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
639
639
|
`${a}/api/logistics-shipping/pickuppoints/_search`,
|
|
640
640
|
{
|
|
641
641
|
method: "POST",
|
|
642
|
-
headers:
|
|
642
|
+
headers: p,
|
|
643
643
|
body: JSON.stringify({ coordinate: d })
|
|
644
644
|
},
|
|
645
645
|
{ storeCookies: o }
|
|
@@ -647,8 +647,8 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
647
647
|
}
|
|
648
648
|
},
|
|
649
649
|
session: (d) => {
|
|
650
|
-
const
|
|
651
|
-
|
|
650
|
+
const p = new URLSearchParams(d);
|
|
651
|
+
p.set(
|
|
652
652
|
"items",
|
|
653
653
|
"profile.id,profile.email,profile.firstName,profile.lastName,profile.phone,shopper.firstName,shopper.lastName,shopper.organizationManager,shopper.availableContracts,shopper.activeContractId,store.channel,store.countryCode,store.cultureInfo,store.currencyCode,store.currencySymbol,authentication.customerId,authentication.storeUserId,authentication.storeUserEmail,authentication.unitId,authentication.unitName,checkout.regionId,public.postalCode"
|
|
654
654
|
);
|
|
@@ -656,7 +656,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
656
656
|
"content-type": "application/json"
|
|
657
657
|
}), y = Z(i?.headers?.cookie ?? "")?.vtex_session;
|
|
658
658
|
return I(
|
|
659
|
-
`${a}/api/sessions?${
|
|
659
|
+
`${a}/api/sessions?${p.toString()}`,
|
|
660
660
|
{
|
|
661
661
|
method: y ? "PATCH" : "POST",
|
|
662
662
|
headers: m,
|
|
@@ -676,20 +676,20 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
676
676
|
),
|
|
677
677
|
profile: {
|
|
678
678
|
addresses: async (d) => {
|
|
679
|
-
const
|
|
679
|
+
const p = s({
|
|
680
680
|
"content-type": "application/json",
|
|
681
681
|
"X-FORWARDED-HOST": u
|
|
682
682
|
});
|
|
683
683
|
return I(
|
|
684
684
|
`${a}/api/profile-system/pvt/profiles/${d}/addresses`,
|
|
685
|
-
{ headers:
|
|
685
|
+
{ headers: p },
|
|
686
686
|
{ storeCookies: o }
|
|
687
687
|
);
|
|
688
688
|
}
|
|
689
689
|
},
|
|
690
690
|
oms: {
|
|
691
691
|
userOrder: ({ orderId: d }) => {
|
|
692
|
-
const
|
|
692
|
+
const p = s({
|
|
693
693
|
"content-type": "application/json",
|
|
694
694
|
"X-FORWARDED-HOST": u
|
|
695
695
|
});
|
|
@@ -697,14 +697,14 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
697
697
|
`${a}/api/oms/user/orders/${d}`,
|
|
698
698
|
{
|
|
699
699
|
method: "GET",
|
|
700
|
-
headers:
|
|
700
|
+
headers: p
|
|
701
701
|
},
|
|
702
702
|
{ storeCookies: o }
|
|
703
703
|
);
|
|
704
704
|
},
|
|
705
705
|
listUserOrders: ({
|
|
706
706
|
page: d,
|
|
707
|
-
status:
|
|
707
|
+
status: p,
|
|
708
708
|
dateInitial: m,
|
|
709
709
|
dateFinal: y,
|
|
710
710
|
text: O,
|
|
@@ -731,7 +731,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
731
731
|
);
|
|
732
732
|
y = new Date(P).toISOString();
|
|
733
733
|
}
|
|
734
|
-
O && S.append("text", O),
|
|
734
|
+
O && S.append("text", O), p && p.length > 0 && S.append("status", p.filter(Boolean).join(",")), m && y ? S.append(
|
|
735
735
|
"creation_date",
|
|
736
736
|
`creationDate:[${m} TO ${y}]`
|
|
737
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()), A && S.append("my_pending_approvals", String(!0));
|
|
@@ -751,7 +751,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
751
751
|
getCommercialAuthorizationsByOrderId: ({
|
|
752
752
|
orderId: d
|
|
753
753
|
}) => {
|
|
754
|
-
const
|
|
754
|
+
const p = s({
|
|
755
755
|
"content-type": "application/json",
|
|
756
756
|
"X-FORWARDED-HOST": u
|
|
757
757
|
});
|
|
@@ -759,14 +759,14 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
759
759
|
`${a}/${e}/commercial-authorizations/order/${d}`,
|
|
760
760
|
{
|
|
761
761
|
method: "GET",
|
|
762
|
-
headers:
|
|
762
|
+
headers: p
|
|
763
763
|
},
|
|
764
764
|
{ storeCookies: o }
|
|
765
765
|
);
|
|
766
766
|
},
|
|
767
767
|
processOrderAuthorization: async ({
|
|
768
768
|
orderAuthorizationId: d,
|
|
769
|
-
dimensionId:
|
|
769
|
+
dimensionId: p,
|
|
770
770
|
ruleId: m,
|
|
771
771
|
approved: y
|
|
772
772
|
}) => {
|
|
@@ -776,7 +776,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
776
776
|
}), A = {
|
|
777
777
|
params: {
|
|
778
778
|
ruleId: m,
|
|
779
|
-
dimensionId:
|
|
779
|
+
dimensionId: p,
|
|
780
780
|
score: y ? 100 : 0
|
|
781
781
|
}
|
|
782
782
|
};
|
|
@@ -795,7 +795,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
795
795
|
getUnitByUserId: ({
|
|
796
796
|
userId: d
|
|
797
797
|
}) => {
|
|
798
|
-
const
|
|
798
|
+
const p = s({
|
|
799
799
|
"content-type": "application/json",
|
|
800
800
|
"X-FORWARDED-HOST": u
|
|
801
801
|
});
|
|
@@ -803,7 +803,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
803
803
|
`${a}/api/units/v1/${d}/unit`,
|
|
804
804
|
{
|
|
805
805
|
method: "GET",
|
|
806
|
-
headers:
|
|
806
|
+
headers: p
|
|
807
807
|
},
|
|
808
808
|
{}
|
|
809
809
|
);
|
|
@@ -811,7 +811,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
811
811
|
getOrgUnitById: ({
|
|
812
812
|
orgUnitId: d
|
|
813
813
|
}) => {
|
|
814
|
-
const
|
|
814
|
+
const p = s({
|
|
815
815
|
"content-type": "application/json",
|
|
816
816
|
"X-FORWARDED-HOST": u
|
|
817
817
|
});
|
|
@@ -819,7 +819,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
819
819
|
`${a}/api/units/v1/${d}`,
|
|
820
820
|
{
|
|
821
821
|
method: "GET",
|
|
822
|
-
headers:
|
|
822
|
+
headers: p
|
|
823
823
|
},
|
|
824
824
|
{}
|
|
825
825
|
);
|
|
@@ -827,7 +827,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
827
827
|
getScopesByOrgUnit: ({
|
|
828
828
|
orgUnitId: d
|
|
829
829
|
}) => {
|
|
830
|
-
const
|
|
830
|
+
const p = s({
|
|
831
831
|
"content-type": "application/json",
|
|
832
832
|
"X-FORWARDED-HOST": u
|
|
833
833
|
});
|
|
@@ -835,7 +835,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
835
835
|
`${a}/api/units/v1/${d}/scopes`,
|
|
836
836
|
{
|
|
837
837
|
method: "GET",
|
|
838
|
-
headers:
|
|
838
|
+
headers: p
|
|
839
839
|
},
|
|
840
840
|
{}
|
|
841
841
|
);
|
|
@@ -845,7 +845,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
845
845
|
getUserById: ({
|
|
846
846
|
userId: d
|
|
847
847
|
}) => {
|
|
848
|
-
const
|
|
848
|
+
const p = s({
|
|
849
849
|
"content-type": "application/json",
|
|
850
850
|
"X-FORWARDED-HOST": u
|
|
851
851
|
});
|
|
@@ -853,7 +853,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
853
853
|
`${a}/api/license-manager/users/${d}`,
|
|
854
854
|
{
|
|
855
855
|
method: "GET",
|
|
856
|
-
headers:
|
|
856
|
+
headers: p
|
|
857
857
|
},
|
|
858
858
|
{}
|
|
859
859
|
);
|
|
@@ -861,7 +861,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
861
861
|
getUserByEmail: ({
|
|
862
862
|
email: d
|
|
863
863
|
}) => {
|
|
864
|
-
const
|
|
864
|
+
const p = s({
|
|
865
865
|
"content-type": "application/json",
|
|
866
866
|
"X-FORWARDED-HOST": u
|
|
867
867
|
});
|
|
@@ -869,7 +869,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
869
869
|
`${a}/api/license-manager/pvt/users/${d}`,
|
|
870
870
|
{
|
|
871
871
|
method: "GET",
|
|
872
|
-
headers:
|
|
872
|
+
headers: p
|
|
873
873
|
},
|
|
874
874
|
{}
|
|
875
875
|
);
|
|
@@ -877,7 +877,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
877
877
|
getUserRoles: ({
|
|
878
878
|
userId: d
|
|
879
879
|
}) => {
|
|
880
|
-
const
|
|
880
|
+
const p = s({
|
|
881
881
|
"content-type": "application/json",
|
|
882
882
|
"X-FORWARDED-HOST": u
|
|
883
883
|
});
|
|
@@ -885,7 +885,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
885
885
|
`${a}/api/license-manager/storefront/users/${d}/roles`,
|
|
886
886
|
{
|
|
887
887
|
method: "GET",
|
|
888
|
-
headers:
|
|
888
|
+
headers: p
|
|
889
889
|
},
|
|
890
890
|
{}
|
|
891
891
|
);
|
|
@@ -897,7 +897,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
897
897
|
}) => {
|
|
898
898
|
if (!d)
|
|
899
899
|
throw new _("Missing contractId to fetch CL fields.");
|
|
900
|
-
const
|
|
900
|
+
const p = v({
|
|
901
901
|
Accept: "application/json",
|
|
902
902
|
"content-type": "application/json"
|
|
903
903
|
});
|
|
@@ -905,7 +905,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
905
905
|
`${a}/api/dataentities/CL/documents/${d}?_fields=_all`,
|
|
906
906
|
{
|
|
907
907
|
method: "GET",
|
|
908
|
-
headers:
|
|
908
|
+
headers: p
|
|
909
909
|
},
|
|
910
910
|
{}
|
|
911
911
|
);
|
|
@@ -915,7 +915,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
915
915
|
}) => {
|
|
916
916
|
if (!d)
|
|
917
917
|
throw new _("Missing userId to fetch shopper name.");
|
|
918
|
-
const
|
|
918
|
+
const p = c({
|
|
919
919
|
Accept: "application/json",
|
|
920
920
|
"content-type": "application/json",
|
|
921
921
|
"X-FORWARDED-HOST": u
|
|
@@ -924,7 +924,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
924
924
|
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${d})&_fields=_all&_schema=v1`,
|
|
925
925
|
{
|
|
926
926
|
method: "GET",
|
|
927
|
-
headers:
|
|
927
|
+
headers: p
|
|
928
928
|
},
|
|
929
929
|
{}
|
|
930
930
|
);
|
|
@@ -932,13 +932,13 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
932
932
|
},
|
|
933
933
|
quotes: {
|
|
934
934
|
listUserQuotes: (d) => {
|
|
935
|
-
|
|
936
|
-
const
|
|
935
|
+
ut(d);
|
|
936
|
+
const p = pt(d), m = s({
|
|
937
937
|
"content-type": "application/json",
|
|
938
938
|
"X-FORWARDED-HOST": u
|
|
939
939
|
});
|
|
940
940
|
return I(
|
|
941
|
-
`${a}/api/quoting/quotes?${
|
|
941
|
+
`${a}/api/quoting/quotes?${p.toString()}`,
|
|
942
942
|
{
|
|
943
943
|
method: "GET",
|
|
944
944
|
headers: m
|
|
@@ -952,12 +952,12 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
952
952
|
const d = s({
|
|
953
953
|
"content-type": "application/json",
|
|
954
954
|
"X-FORWARDED-HOST": u
|
|
955
|
-
}),
|
|
955
|
+
}), p = z(me(i) ?? "", e);
|
|
956
956
|
return I(
|
|
957
957
|
`${a}/api/vtexid/credential/validate`,
|
|
958
958
|
{
|
|
959
959
|
headers: d,
|
|
960
|
-
body: JSON.stringify({ token:
|
|
960
|
+
body: JSON.stringify({ token: p }),
|
|
961
961
|
method: "POST"
|
|
962
962
|
},
|
|
963
963
|
{ storeCookies: o }
|
|
@@ -967,14 +967,14 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
967
967
|
orderEntry: {
|
|
968
968
|
uploadFile: ({
|
|
969
969
|
fileBuffer: d,
|
|
970
|
-
fileName:
|
|
970
|
+
fileName: p,
|
|
971
971
|
mimeType: m
|
|
972
972
|
}) => {
|
|
973
973
|
const y = s({
|
|
974
974
|
"content-type": "application/json",
|
|
975
975
|
"X-FORWARDED-HOST": u
|
|
976
976
|
}), O = `----FastStoreUploadBoundary${Date.now()}`, w = `\r
|
|
977
|
-
`, A = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", S =
|
|
977
|
+
`, A = /^[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
978
|
`--${O}`,
|
|
979
979
|
`Content-Disposition: form-data; name="file"; filename="${S}"`,
|
|
980
980
|
`Content-Type: ${A}`,
|
|
@@ -999,7 +999,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
999
999
|
},
|
|
1000
1000
|
startOperation: ({
|
|
1001
1001
|
objectKey: d,
|
|
1002
|
-
orderFormId:
|
|
1002
|
+
orderFormId: p,
|
|
1003
1003
|
sessionToken: m
|
|
1004
1004
|
}) => {
|
|
1005
1005
|
const y = s({
|
|
@@ -1007,7 +1007,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1007
1007
|
"X-FORWARDED-HOST": u
|
|
1008
1008
|
}), O = JSON.stringify({
|
|
1009
1009
|
objectKey: d,
|
|
1010
|
-
orderFormId:
|
|
1010
|
+
orderFormId: p,
|
|
1011
1011
|
operation: "CreateCart",
|
|
1012
1012
|
...m ? { sessionToken: m } : {}
|
|
1013
1013
|
});
|
|
@@ -1024,7 +1024,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1024
1024
|
getOperation: ({
|
|
1025
1025
|
operationId: d
|
|
1026
1026
|
}) => {
|
|
1027
|
-
const
|
|
1027
|
+
const p = s({
|
|
1028
1028
|
"content-type": "application/json",
|
|
1029
1029
|
"X-FORWARDED-HOST": u
|
|
1030
1030
|
});
|
|
@@ -1032,7 +1032,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1032
1032
|
`${a}/api/order-entry/operation/${d}?an=${e}`,
|
|
1033
1033
|
{
|
|
1034
1034
|
method: "GET",
|
|
1035
|
-
headers:
|
|
1035
|
+
headers: p
|
|
1036
1036
|
},
|
|
1037
1037
|
{}
|
|
1038
1038
|
);
|
|
@@ -1055,7 +1055,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1055
1055
|
getOrderFormItems: ({
|
|
1056
1056
|
orderFormId: d
|
|
1057
1057
|
}) => {
|
|
1058
|
-
const
|
|
1058
|
+
const p = s({
|
|
1059
1059
|
"content-type": "application/json",
|
|
1060
1060
|
"X-FORWARDED-HOST": u
|
|
1061
1061
|
});
|
|
@@ -1063,7 +1063,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1063
1063
|
`${a}/api/checkout/pub/orderForm/${d}`,
|
|
1064
1064
|
{
|
|
1065
1065
|
method: "GET",
|
|
1066
|
-
headers:
|
|
1066
|
+
headers: p
|
|
1067
1067
|
},
|
|
1068
1068
|
{}
|
|
1069
1069
|
);
|
|
@@ -1076,13 +1076,13 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1076
1076
|
recommendation: {
|
|
1077
1077
|
recommendations: ({
|
|
1078
1078
|
campaignVrn: d,
|
|
1079
|
-
userId:
|
|
1079
|
+
userId: p,
|
|
1080
1080
|
products: m = [],
|
|
1081
1081
|
salesChannel: y,
|
|
1082
1082
|
locale: O
|
|
1083
1083
|
}) => {
|
|
1084
1084
|
const w = new URLSearchParams({ an: e, campaignVrn: d });
|
|
1085
|
-
return
|
|
1085
|
+
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
1086
|
`${h}/recommendations?${w.toString()}`,
|
|
1087
1087
|
{ headers: f },
|
|
1088
1088
|
{ storeCookies: o }
|
|
@@ -1098,23 +1098,23 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
1100
|
};
|
|
1101
|
-
}, K = (e) => e.discoveryConfig?.localization ?? {}, Q = (e) => K(e).enabled === !0,
|
|
1102
|
-
ft,
|
|
1101
|
+
}, K = (e) => e.discoveryConfig?.localization ?? {}, Q = (e) => K(e).enabled === !0, mt = (e) => Object.keys(K(e).locales ?? {}), ht = (e) => K(e).defaultLocale, re = (e) => Q(e) && e.storage.locale || void 0, he = "fuzzy", fe = "operator", Se = "pickupPoint", _e = "shipping", Ee = "delivery-options", ft = "in-stock", St = "trade-policy", yt = "region-id", It = /* @__PURE__ */ new Set([
|
|
1103
1102
|
St,
|
|
1103
|
+
yt,
|
|
1104
1104
|
he,
|
|
1105
1105
|
fe,
|
|
1106
1106
|
Se
|
|
1107
|
-
]),
|
|
1107
|
+
]), vt = /* @__PURE__ */ new Set([
|
|
1108
1108
|
"zip-code",
|
|
1109
1109
|
"pickupPoint",
|
|
1110
1110
|
"country",
|
|
1111
1111
|
"coordinates",
|
|
1112
1112
|
"deliveryZonesHash",
|
|
1113
1113
|
"pickupPointsHash"
|
|
1114
|
-
]),
|
|
1114
|
+
]), Ot = /* @__PURE__ */ new Set(["productClusterIds"]), Re = (e) => encodeURI(decodeURI(e)), Ct = (e) => encodeURIComponent(
|
|
1115
1115
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
1116
|
-
),
|
|
1117
|
-
function
|
|
1116
|
+
), bt = /^pickup-in-point-(.+)$/;
|
|
1117
|
+
function sn(e) {
|
|
1118
1118
|
if (!e)
|
|
1119
1119
|
return {};
|
|
1120
1120
|
try {
|
|
@@ -1127,18 +1127,18 @@ function on(e) {
|
|
|
1127
1127
|
return {};
|
|
1128
1128
|
}
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1130
|
+
function wt(e) {
|
|
1131
1131
|
const n = {}, t = {}, r = [];
|
|
1132
1132
|
for (const i of e.split(";")) {
|
|
1133
1133
|
const a = i.indexOf("=");
|
|
1134
1134
|
if (a < 0) continue;
|
|
1135
1135
|
const o = i.slice(0, a), s = i.slice(a + 1);
|
|
1136
|
-
!o || !s || (
|
|
1136
|
+
!o || !s || (vt.has(o) ? n[o] = s : Ot.has(o) ? t[o] = s : r.push({ key: o, value: s }));
|
|
1137
1137
|
}
|
|
1138
1138
|
return { shipping: n, queryParams: t, extraFacets: r };
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1141
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, queryParams: r, extraFacets: i } =
|
|
1140
|
+
function Dt(e) {
|
|
1141
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, queryParams: r, extraFacets: i } = wt(n);
|
|
1142
1142
|
return {
|
|
1143
1143
|
segmentParams: {
|
|
1144
1144
|
sc: e.channel,
|
|
@@ -1160,7 +1160,7 @@ function wt(e) {
|
|
|
1160
1160
|
extraFacets: i
|
|
1161
1161
|
};
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1163
|
+
function cn(e, n) {
|
|
1164
1164
|
const t = [
|
|
1165
1165
|
["sc", n.sc],
|
|
1166
1166
|
["regionId", n.regionId],
|
|
@@ -1181,11 +1181,11 @@ function sn(e, n) {
|
|
|
1181
1181
|
for (const [r, i] of t)
|
|
1182
1182
|
i != null && i !== "" && e.append(r, String(i));
|
|
1183
1183
|
}
|
|
1184
|
-
function
|
|
1185
|
-
return
|
|
1184
|
+
function ln(e) {
|
|
1185
|
+
return bt.exec(e)?.[1];
|
|
1186
1186
|
}
|
|
1187
|
-
function
|
|
1188
|
-
const n = e.find((r) => r.key === "shipping"), t = n ?
|
|
1187
|
+
function Pt(e) {
|
|
1188
|
+
const n = e.find((r) => r.key === "shipping"), t = n ? ln(n.value) : void 0;
|
|
1189
1189
|
if (t !== void 0)
|
|
1190
1190
|
try {
|
|
1191
1191
|
return decodeURIComponent(t);
|
|
@@ -1193,8 +1193,8 @@ function Dt(e) {
|
|
|
1193
1193
|
return t;
|
|
1194
1194
|
}
|
|
1195
1195
|
}
|
|
1196
|
-
function
|
|
1197
|
-
const t =
|
|
1196
|
+
function At(e, n) {
|
|
1197
|
+
const t = Pt(
|
|
1198
1198
|
n
|
|
1199
1199
|
);
|
|
1200
1200
|
return t === void 0 ? e : {
|
|
@@ -1202,25 +1202,25 @@ function Pt(e, n) {
|
|
|
1202
1202
|
pickupPoint: t
|
|
1203
1203
|
};
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1206
|
-
return e.map((n) => n.key !== "shipping" ||
|
|
1205
|
+
function kt(e) {
|
|
1206
|
+
return e.map((n) => n.key !== "shipping" || ln(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function Ut(e, n) {
|
|
1209
1209
|
let t = [...e];
|
|
1210
1210
|
const r = t.some((i) => i.key === "shipping");
|
|
1211
1211
|
for (const i of n)
|
|
1212
1212
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1213
|
-
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")),
|
|
1213
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), kt(t);
|
|
1214
1214
|
}
|
|
1215
|
-
function
|
|
1215
|
+
function Tt(e) {
|
|
1216
1216
|
return e.reduce((n, t) => {
|
|
1217
1217
|
let { key: r, value: i } = t;
|
|
1218
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Re(r)}/${
|
|
1218
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Re(r)}/${Ct(Re(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1219
1219
|
}, "");
|
|
1220
1220
|
}
|
|
1221
|
-
const
|
|
1222
|
-
function
|
|
1223
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1221
|
+
const _t = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), Et = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1222
|
+
function Rt(e, n) {
|
|
1223
|
+
const { segmentParams: t, extraFacets: r } = Dt(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
|
|
1224
1224
|
return {
|
|
1225
1225
|
segmentParams: {
|
|
1226
1226
|
...t,
|
|
@@ -1231,8 +1231,8 @@ function Et(e, n) {
|
|
|
1231
1231
|
extraFacets: r
|
|
1232
1232
|
};
|
|
1233
1233
|
}
|
|
1234
|
-
function
|
|
1235
|
-
const t = e.filter(({ key: c }) => !
|
|
1234
|
+
function Ft(e, n) {
|
|
1235
|
+
const t = e.filter(({ key: c }) => !It.has(c)), r = e.find(
|
|
1236
1236
|
({ key: c, value: l }) => c === _e && l !== "all-delivery-methods"
|
|
1237
1237
|
) ?? null, i = e.find(
|
|
1238
1238
|
({ key: c, value: l }) => c === Ee && l !== "all-delivery-options"
|
|
@@ -1241,11 +1241,11 @@ function Rt(e, n) {
|
|
|
1241
1241
|
), s = a.some(
|
|
1242
1242
|
({ key: c }) => c === Ee
|
|
1243
1243
|
);
|
|
1244
|
-
return r !== null && !o && a.push(r), i !== null && !s && a.push(i),
|
|
1244
|
+
return r !== null && !o && a.push(r), i !== null && !s && a.push(i), Ut(a, n);
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Nt(e, n) {
|
|
1247
1247
|
const t = e.find(({ key: a }) => a === he) ?? null, r = e.find(({ key: a }) => a === fe) ?? null, i = e.find(({ key: a }) => a === Se) ?? null;
|
|
1248
|
-
t &&
|
|
1248
|
+
t && _t(t) && n.append(he, t.value), r && Et(r) && n.append(fe, r.value), i && n.append(Se, i.value);
|
|
1249
1249
|
}
|
|
1250
1250
|
function Fe(e, n, t, r) {
|
|
1251
1251
|
const {
|
|
@@ -1255,35 +1255,35 @@ function Fe(e, n, t, r) {
|
|
|
1255
1255
|
sort: s,
|
|
1256
1256
|
selectedFacets: c = [],
|
|
1257
1257
|
showInvisibleItems: l,
|
|
1258
|
-
sponsoredCount:
|
|
1258
|
+
sponsoredCount: g,
|
|
1259
1259
|
hideUnavailableItems: u,
|
|
1260
1260
|
allowRedirect: h = !1
|
|
1261
1261
|
} = e, f = new URLSearchParams();
|
|
1262
1262
|
if (r.includePagination && a !== void 0 && o !== void 0) {
|
|
1263
|
-
const
|
|
1264
|
-
f.append("from",
|
|
1263
|
+
const p = a * o, m = o === 0 ? p : p + o - 1;
|
|
1264
|
+
f.append("from", p.toString()), f.append("to", m.toString());
|
|
1265
1265
|
}
|
|
1266
1266
|
i && f.append("query", i), r.includeSort && s && f.append("sort", s);
|
|
1267
|
-
const v =
|
|
1267
|
+
const v = At(
|
|
1268
1268
|
t.segmentParams,
|
|
1269
1269
|
c
|
|
1270
1270
|
);
|
|
1271
|
-
if (
|
|
1272
|
-
const
|
|
1271
|
+
if (cn(f, v ?? t.segmentParams), Nt(c, f), l && f.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1272
|
+
const p = c.find(({ key: y }) => y === ft), m = p ? p.value : u?.toString() ?? n.hideUnavailableItems.toString();
|
|
1273
1273
|
f.append("hideUnavailableItems", m);
|
|
1274
1274
|
}
|
|
1275
|
-
n?.simulationBehavior !== void 0 && f.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && f.append("showSponsored", n.showSponsored.toString()),
|
|
1276
|
-
const d =
|
|
1277
|
-
|
|
1275
|
+
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());
|
|
1276
|
+
const d = Tt(
|
|
1277
|
+
Ft(c, t.extraFacets)
|
|
1278
1278
|
);
|
|
1279
1279
|
return { params: f, path: d };
|
|
1280
1280
|
}
|
|
1281
|
-
function
|
|
1281
|
+
function Lt(e, n) {
|
|
1282
1282
|
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: a } = e, o = new URLSearchParams({
|
|
1283
1283
|
field: t ?? "",
|
|
1284
1284
|
value: r ?? ""
|
|
1285
1285
|
});
|
|
1286
|
-
return
|
|
1286
|
+
return cn(o, n), i && o.append("hideUnavailableItems", "true"), a && o.append("show-invisible-items", "true"), o;
|
|
1287
1287
|
}
|
|
1288
1288
|
function W(e, n) {
|
|
1289
1289
|
return {
|
|
@@ -1296,7 +1296,7 @@ function W(e, n) {
|
|
|
1296
1296
|
};
|
|
1297
1297
|
}
|
|
1298
1298
|
function G(e) {
|
|
1299
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a =
|
|
1299
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a = Rt(t, r);
|
|
1300
1300
|
switch (n) {
|
|
1301
1301
|
case "product-search":
|
|
1302
1302
|
case "facets": {
|
|
@@ -1318,7 +1318,7 @@ function G(e) {
|
|
|
1318
1318
|
return W(s, o);
|
|
1319
1319
|
}
|
|
1320
1320
|
case "products": {
|
|
1321
|
-
const o =
|
|
1321
|
+
const o = Lt(i, a.segmentParams);
|
|
1322
1322
|
return W("", o);
|
|
1323
1323
|
}
|
|
1324
1324
|
case "search-suggestions": {
|
|
@@ -1340,16 +1340,16 @@ function G(e) {
|
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
1342
|
}
|
|
1343
|
-
const
|
|
1344
|
-
function
|
|
1343
|
+
const Bt = 10;
|
|
1344
|
+
function $t(e) {
|
|
1345
1345
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1346
1346
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1349
|
-
const t =
|
|
1348
|
+
function Mt(e) {
|
|
1349
|
+
const t = sn(e.headers?.cookie).cultureInfo || "";
|
|
1350
1350
|
return Q(e) ? e.storage.locale || t : t || e.storage.locale || "";
|
|
1351
1351
|
}
|
|
1352
|
-
const
|
|
1352
|
+
const zt = ({
|
|
1353
1353
|
account: e,
|
|
1354
1354
|
environment: n,
|
|
1355
1355
|
hideUnavailableItems: t,
|
|
@@ -1357,10 +1357,10 @@ const Mt = ({
|
|
|
1357
1357
|
showSponsored: i,
|
|
1358
1358
|
subDomainPrefix: a
|
|
1359
1359
|
}, o) => {
|
|
1360
|
-
const s = `https://${e}.${n}.com.br`, c =
|
|
1360
|
+
const s = `https://${e}.${n}.com.br`, c = on(o), l = sn(o.headers?.cookie), g = () => ({
|
|
1361
1361
|
salesChannel: o.storage.channel.salesChannel,
|
|
1362
|
-
regionId:
|
|
1363
|
-
locale:
|
|
1362
|
+
regionId: $t(o),
|
|
1363
|
+
locale: Mt(o),
|
|
1364
1364
|
hideUnavailableItems: t,
|
|
1365
1365
|
simulationBehavior: r,
|
|
1366
1366
|
showSponsored: i
|
|
@@ -1371,14 +1371,14 @@ const Mt = ({
|
|
|
1371
1371
|
const P = S === "facets" ? "facets" : "product-search", k = G({
|
|
1372
1372
|
endpoint: P,
|
|
1373
1373
|
segment: l,
|
|
1374
|
-
defaults:
|
|
1374
|
+
defaults: g(),
|
|
1375
1375
|
args: D
|
|
1376
1376
|
});
|
|
1377
1377
|
return I(
|
|
1378
1378
|
`${s}/api/intelligent-search/v1/${P}/${k.path}?${k.params.toString()}`,
|
|
1379
1379
|
{ headers: v }
|
|
1380
1380
|
);
|
|
1381
|
-
},
|
|
1381
|
+
}, p = (S) => d({ ...S, type: "product_search" }), m = ({
|
|
1382
1382
|
field: S,
|
|
1383
1383
|
value: D,
|
|
1384
1384
|
hideUnavailableItems: P,
|
|
@@ -1387,7 +1387,7 @@ const Mt = ({
|
|
|
1387
1387
|
const b = G({
|
|
1388
1388
|
endpoint: "products",
|
|
1389
1389
|
segment: l,
|
|
1390
|
-
defaults:
|
|
1390
|
+
defaults: g(),
|
|
1391
1391
|
args: {
|
|
1392
1392
|
field: S,
|
|
1393
1393
|
value: D,
|
|
@@ -1402,7 +1402,7 @@ const Mt = ({
|
|
|
1402
1402
|
};
|
|
1403
1403
|
return {
|
|
1404
1404
|
facets: (S) => d({ ...S, type: "facets" }),
|
|
1405
|
-
products:
|
|
1405
|
+
products: p,
|
|
1406
1406
|
fetchProduct: m,
|
|
1407
1407
|
productsByIdentifier: async ({
|
|
1408
1408
|
field: S,
|
|
@@ -1410,7 +1410,7 @@ const Mt = ({
|
|
|
1410
1410
|
showInvisibleItems: P,
|
|
1411
1411
|
hideUnavailableItems: k
|
|
1412
1412
|
}) => {
|
|
1413
|
-
const b = Pe(
|
|
1413
|
+
const b = Pe(Bt);
|
|
1414
1414
|
return (await Promise.all(
|
|
1415
1415
|
D.map(
|
|
1416
1416
|
(T) => b(async () => {
|
|
@@ -1434,7 +1434,7 @@ const Mt = ({
|
|
|
1434
1434
|
const D = G({
|
|
1435
1435
|
endpoint: "search-suggestions",
|
|
1436
1436
|
segment: l,
|
|
1437
|
-
defaults:
|
|
1437
|
+
defaults: g(),
|
|
1438
1438
|
args: { query: S.query }
|
|
1439
1439
|
});
|
|
1440
1440
|
return I(
|
|
@@ -1446,7 +1446,7 @@ const Mt = ({
|
|
|
1446
1446
|
const S = G({
|
|
1447
1447
|
endpoint: "top-searches",
|
|
1448
1448
|
segment: l,
|
|
1449
|
-
defaults:
|
|
1449
|
+
defaults: g()
|
|
1450
1450
|
});
|
|
1451
1451
|
return I(
|
|
1452
1452
|
`${s}/api/intelligent-search/v1/top-searches?${S.params.toString()}`,
|
|
@@ -1457,7 +1457,7 @@ const Mt = ({
|
|
|
1457
1457
|
const D = G({
|
|
1458
1458
|
endpoint: "catalog-count",
|
|
1459
1459
|
segment: l,
|
|
1460
|
-
defaults:
|
|
1460
|
+
defaults: g(),
|
|
1461
1461
|
args: S
|
|
1462
1462
|
});
|
|
1463
1463
|
return I(
|
|
@@ -1466,15 +1466,15 @@ const Mt = ({
|
|
|
1466
1466
|
);
|
|
1467
1467
|
}
|
|
1468
1468
|
};
|
|
1469
|
-
},
|
|
1470
|
-
const t =
|
|
1469
|
+
}, Vt = (e, n) => {
|
|
1470
|
+
const t = zt(e, n), r = gt(e, n), i = nt(e);
|
|
1471
1471
|
return {
|
|
1472
1472
|
search: t,
|
|
1473
1473
|
commerce: r,
|
|
1474
1474
|
catalog: i
|
|
1475
1475
|
};
|
|
1476
|
-
},
|
|
1477
|
-
const t = Pe(
|
|
1476
|
+
}, xt = 20, qt = (e) => e.entityType === "category", ye = (e) => e.entityType === "brand", Ne = (e) => e.entityType === "collection", jt = (e, n) => {
|
|
1477
|
+
const t = Pe(xt), r = async (i) => Promise.all(
|
|
1478
1478
|
i.map(
|
|
1479
1479
|
(a) => t(async () => {
|
|
1480
1480
|
const o = a.slug.toLowerCase(), s = a.locale, c = await n.commerce.catalog.byLinkId.category(
|
|
@@ -1493,12 +1493,12 @@ const Mt = ({
|
|
|
1493
1493
|
);
|
|
1494
1494
|
if (l)
|
|
1495
1495
|
return { ...l, entityType: "brand" };
|
|
1496
|
-
const
|
|
1496
|
+
const g = await n.commerce.catalog.byLinkId.collection(
|
|
1497
1497
|
o,
|
|
1498
1498
|
s
|
|
1499
1499
|
);
|
|
1500
|
-
if (
|
|
1501
|
-
return { ...
|
|
1500
|
+
if (g)
|
|
1501
|
+
return { ...g, entityType: "collection" };
|
|
1502
1502
|
throw new $(
|
|
1503
1503
|
`No catalog entity found for slug: ${a.slug}. Cascade exhausted (category → brand → collection).`
|
|
1504
1504
|
);
|
|
@@ -1512,11 +1512,11 @@ const Mt = ({
|
|
|
1512
1512
|
// entry while same-slug / different-locale loads stay isolated.
|
|
1513
1513
|
cacheKeyFn: ({ slug: i, locale: a }) => `${i.toLowerCase()}::${a ?? ""}`
|
|
1514
1514
|
});
|
|
1515
|
-
},
|
|
1515
|
+
}, Wt = (e, n) => {
|
|
1516
1516
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1517
1517
|
return new le(t);
|
|
1518
|
-
},
|
|
1519
|
-
const t = Pe(
|
|
1518
|
+
}, Gt = 1, Ht = (e, n) => {
|
|
1519
|
+
const t = Pe(Gt), r = async (a) => {
|
|
1520
1520
|
const o = a.reduce((u, { items: h }) => [...u, h], []), s = [...o.flat()], c = await n.commerce.checkout.simulation({
|
|
1521
1521
|
country: a[0].country,
|
|
1522
1522
|
postalCode: a[0].postalCode,
|
|
@@ -1527,32 +1527,32 @@ const Mt = ({
|
|
|
1527
1527
|
return typeof f == "number" && f < u.length && (u[f] = h), u;
|
|
1528
1528
|
},
|
|
1529
1529
|
Array(s.length).fill(null)
|
|
1530
|
-
),
|
|
1530
|
+
), g = o.reduce(
|
|
1531
1531
|
(u, h) => [...u, h.length + u[u.length - 1]],
|
|
1532
1532
|
[0]
|
|
1533
1533
|
);
|
|
1534
1534
|
return o.map((u, h) => ({
|
|
1535
1535
|
...c,
|
|
1536
|
-
items: l.slice(
|
|
1536
|
+
items: l.slice(g[h], g[h + 1]).filter((f) => !!f)
|
|
1537
1537
|
}));
|
|
1538
1538
|
}, i = async (a) => t(r, a);
|
|
1539
1539
|
return new le(i, {
|
|
1540
1540
|
maxBatchSize: 50
|
|
1541
1541
|
});
|
|
1542
|
-
},
|
|
1543
|
-
function
|
|
1542
|
+
}, Xt = (e, n) => Ln(e, n);
|
|
1543
|
+
function Yt(e) {
|
|
1544
1544
|
return {
|
|
1545
1545
|
...e,
|
|
1546
|
-
description: e.description ?
|
|
1546
|
+
description: e.description ? Xt(e.description) : e.description
|
|
1547
1547
|
};
|
|
1548
1548
|
}
|
|
1549
1549
|
const N = (e, n) => ({
|
|
1550
1550
|
...e,
|
|
1551
|
-
isVariantOf:
|
|
1552
|
-
}),
|
|
1551
|
+
isVariantOf: Yt(n)
|
|
1552
|
+
}), Jt = ({ flags: e }, n) => {
|
|
1553
1553
|
const t = async (r) => {
|
|
1554
|
-
const i = r.map((
|
|
1555
|
-
(
|
|
1554
|
+
const i = r.map((g) => g.split("-")[0]), a = r.some(
|
|
1555
|
+
(g) => g.split("-")[1] === "invisibleItems"
|
|
1556
1556
|
), s = (await n.search.productsByIdentifier({
|
|
1557
1557
|
field: "sku",
|
|
1558
1558
|
values: i,
|
|
@@ -1561,13 +1561,13 @@ const N = (e, n) => ({
|
|
|
1561
1561
|
hideUnavailableItems: !1
|
|
1562
1562
|
}
|
|
1563
1563
|
})).reduce(
|
|
1564
|
-
(
|
|
1564
|
+
(g, u) => {
|
|
1565
1565
|
for (const h of u.items)
|
|
1566
|
-
|
|
1567
|
-
return
|
|
1566
|
+
g[h.itemId] = N(h, u);
|
|
1567
|
+
return g;
|
|
1568
1568
|
},
|
|
1569
1569
|
{}
|
|
1570
|
-
), c = i.map((
|
|
1570
|
+
), c = i.map((g) => s[g]), l = i.filter((g) => !s[g]);
|
|
1571
1571
|
if (l.length > 0)
|
|
1572
1572
|
throw new $(
|
|
1573
1573
|
`Search API did not found the following skus: ${l.join(",")}`
|
|
@@ -1578,25 +1578,25 @@ const N = (e, n) => ({
|
|
|
1578
1578
|
maxBatchSize: 99
|
|
1579
1579
|
// Max allowed batch size of Search API
|
|
1580
1580
|
});
|
|
1581
|
-
},
|
|
1582
|
-
const { clients: t } = n, r =
|
|
1581
|
+
}, Kt = (e, n) => {
|
|
1582
|
+
const { clients: t } = n, r = Jt(e, t), i = Ht(e, t), a = jt(e, t), o = Wt(e, t);
|
|
1583
1583
|
return {
|
|
1584
1584
|
skuLoader: r,
|
|
1585
1585
|
simulationLoader: i,
|
|
1586
1586
|
collectionLoader: a,
|
|
1587
1587
|
salesChannelLoader: o
|
|
1588
1588
|
};
|
|
1589
|
-
}, B = (e) => e.AvailableQuantity > 0, V = (e) => e.spotPrice ?? 0,
|
|
1589
|
+
}, B = (e) => e.AvailableQuantity > 0, V = (e) => e.spotPrice ?? 0, Qt = (e) => e.Price ?? 0, Le = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", dn = (e, n) => B(e) && !B(n) ? -1 : !B(e) && B(n) ? 1 : V(e) - V(n), Zt = (e) => e === "available", M = (e, n = 0, t = 1) => {
|
|
1590
1590
|
const r = n / t;
|
|
1591
1591
|
return Math.round((e + r) * 100) / 100;
|
|
1592
|
-
},
|
|
1592
|
+
}, er = (e, n = { includeTaxes: !1 }) => {
|
|
1593
1593
|
const t = e.filter(B), r = t[t.length - 1], i = r ? V(r) : 0;
|
|
1594
1594
|
return n.includeTaxes ? M(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1595
1595
|
}, Be = (e, n = { includeTaxes: !1 }) => {
|
|
1596
1596
|
const [t] = e.filter(B), r = t ? V(t) : 0;
|
|
1597
1597
|
return n.includeTaxes ? M(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1598
|
-
},
|
|
1599
|
-
highPrice: (e) =>
|
|
1598
|
+
}, nr = {
|
|
1599
|
+
highPrice: (e) => er(e),
|
|
1600
1600
|
lowPrice: (e) => Be(e),
|
|
1601
1601
|
lowPriceWithTaxes: (e) => Be(e, { includeTaxes: !0 }),
|
|
1602
1602
|
offerCount: (e) => e.length,
|
|
@@ -1608,20 +1608,20 @@ const N = (e, n) => ({
|
|
|
1608
1608
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1609
1609
|
},
|
|
1610
1610
|
offers: (e) => e
|
|
1611
|
-
},
|
|
1611
|
+
}, tr = {
|
|
1612
1612
|
ratingValue: () => 5,
|
|
1613
1613
|
reviewCount: () => 0
|
|
1614
|
-
}, $e = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a",
|
|
1614
|
+
}, $e = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", rr = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", ir = (e) => {
|
|
1615
1615
|
let n = e.slice(0);
|
|
1616
1616
|
for (let t = 0; t < $e.length; t++)
|
|
1617
|
-
n = n.replace(new RegExp($e.charAt(t), "g"),
|
|
1617
|
+
n = n.replace(new RegExp($e.charAt(t), "g"), rr.charAt(t));
|
|
1618
1618
|
return n;
|
|
1619
|
-
},
|
|
1619
|
+
}, ar = (e) => e.replace(/[·/_,:]/, "-");
|
|
1620
1620
|
function ae(e) {
|
|
1621
1621
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1622
|
-
return ir(
|
|
1622
|
+
return ar(ir(t)).toLowerCase();
|
|
1623
1623
|
}
|
|
1624
|
-
const H = (e) =>
|
|
1624
|
+
const H = (e) => qt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), un = {
|
|
1625
1625
|
id: ({ id: e }) => e.toString(),
|
|
1626
1626
|
slug: (e) => H(e),
|
|
1627
1627
|
seo: (e) => ({
|
|
@@ -1639,7 +1639,7 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), dn
|
|
|
1639
1639
|
if (Ne(e))
|
|
1640
1640
|
return { selectedFacets: [{ key: "productclusterids", value: e.id }] };
|
|
1641
1641
|
const { defaultLocale: i } = K(t), a = r.split("/").filter(Boolean), o = a.map(
|
|
1642
|
-
(l,
|
|
1642
|
+
(l, g) => a.slice(0, g + 1).join("/")
|
|
1643
1643
|
), {
|
|
1644
1644
|
loaders: { collectionLoader: s }
|
|
1645
1645
|
} = t;
|
|
@@ -1648,8 +1648,8 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), dn
|
|
|
1648
1648
|
o.map(
|
|
1649
1649
|
(l) => s.load({ slug: l, locale: re(t) })
|
|
1650
1650
|
)
|
|
1651
|
-
)).map((l,
|
|
1652
|
-
key: `category-${
|
|
1651
|
+
)).map((l, g) => ({
|
|
1652
|
+
key: `category-${g + 1}`,
|
|
1653
1653
|
value: i && l.availableLinkIds?.[i] || l.linkId
|
|
1654
1654
|
}))
|
|
1655
1655
|
};
|
|
@@ -1685,9 +1685,9 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), dn
|
|
|
1685
1685
|
} = t, l = s.map(
|
|
1686
1686
|
(u, h) => s.slice(0, h + 1).join("/")
|
|
1687
1687
|
);
|
|
1688
|
-
let
|
|
1688
|
+
let g;
|
|
1689
1689
|
try {
|
|
1690
|
-
|
|
1690
|
+
g = await Promise.all(
|
|
1691
1691
|
l.map(
|
|
1692
1692
|
(u) => c.load({ slug: u, locale: re(t) })
|
|
1693
1693
|
)
|
|
@@ -1699,7 +1699,7 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), dn
|
|
|
1699
1699
|
if (u === a)
|
|
1700
1700
|
return { locale: u, slug: o };
|
|
1701
1701
|
const h = [];
|
|
1702
|
-
for (const f of
|
|
1702
|
+
for (const f of g) {
|
|
1703
1703
|
const v = f.availableLinkIds?.[u];
|
|
1704
1704
|
if (!v) return null;
|
|
1705
1705
|
h.push(v);
|
|
@@ -1707,7 +1707,7 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), dn
|
|
|
1707
1707
|
return h.length > 0 ? { locale: u, slug: h.join("/") } : null;
|
|
1708
1708
|
}).filter((u) => u !== null);
|
|
1709
1709
|
}
|
|
1710
|
-
},
|
|
1710
|
+
}, pn = {
|
|
1711
1711
|
buy: "whoboughtalsobought",
|
|
1712
1712
|
view: "whosawalsosaw",
|
|
1713
1713
|
similars: "similars",
|
|
@@ -1733,27 +1733,27 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), dn
|
|
|
1733
1733
|
}, ze = (e) => {
|
|
1734
1734
|
const n = e.split(":").map(Number);
|
|
1735
1735
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1736
|
-
},
|
|
1736
|
+
}, or = (e) => typeof pn[e] == "string", sr = (e) => {
|
|
1737
1737
|
const n = e?.filter(
|
|
1738
|
-
(t) =>
|
|
1738
|
+
(t) => or(t.key)
|
|
1739
1739
|
);
|
|
1740
1740
|
if (Array.isArray(n) && n.length > 1)
|
|
1741
1741
|
throw new _(
|
|
1742
1742
|
`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(",")}`
|
|
1743
1743
|
);
|
|
1744
1744
|
return n?.[0] ?? null;
|
|
1745
|
-
},
|
|
1745
|
+
}, cr = (e) => e?.find((n) => n.key === "slug")?.value ?? null, lr = (e) => e?.find((n) => n.key === "id")?.value ?? null, Ve = (e) => e?.find((n) => n.key === "locale")?.value ?? null, xe = (e) => e?.find((n) => n.key === "channel")?.value ?? null, Ie = (e, n) => {
|
|
1746
1746
|
let t = 0;
|
|
1747
1747
|
for (let r = 1; r < e.length; r++)
|
|
1748
1748
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1749
1749
|
return e[t];
|
|
1750
|
-
}, lr = {
|
|
1751
|
-
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1752
1750
|
}, dr = {
|
|
1751
|
+
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1752
|
+
}, ur = {
|
|
1753
1753
|
key: ({ key: e }) => e,
|
|
1754
1754
|
label: ({ name: e }) => e,
|
|
1755
1755
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1756
|
-
},
|
|
1756
|
+
}, pr = {
|
|
1757
1757
|
key: ({ key: e }) => e,
|
|
1758
1758
|
label: ({ name: e }) => e,
|
|
1759
1759
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
@@ -1774,17 +1774,17 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), dn
|
|
|
1774
1774
|
absolute: o
|
|
1775
1775
|
};
|
|
1776
1776
|
}
|
|
1777
|
-
},
|
|
1777
|
+
}, gr = {
|
|
1778
1778
|
value: ({ value: e }) => e,
|
|
1779
1779
|
label: ({ name: e }) => e || "unknown",
|
|
1780
1780
|
selected: ({ selected: e }) => e,
|
|
1781
1781
|
quantity: ({ quantity: e }) => e
|
|
1782
|
-
},
|
|
1782
|
+
}, mr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1783
1783
|
if (!n?.orderId)
|
|
1784
1784
|
throw new _("Missing orderId");
|
|
1785
1785
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1786
1786
|
};
|
|
1787
|
-
function
|
|
1787
|
+
function gn(e) {
|
|
1788
1788
|
if (!e || e.status !== "pending")
|
|
1789
1789
|
return null;
|
|
1790
1790
|
for (const n of e.dimensionStatus) {
|
|
@@ -1802,18 +1802,18 @@ function pn(e) {
|
|
|
1802
1802
|
}
|
|
1803
1803
|
return null;
|
|
1804
1804
|
}
|
|
1805
|
-
function
|
|
1805
|
+
function hr(e) {
|
|
1806
1806
|
if (!e || e.status !== "pending") return !1;
|
|
1807
1807
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1808
1808
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1809
1809
|
}
|
|
1810
|
-
const
|
|
1811
|
-
const r = await t.oms.processOrderAuthorization(n), i =
|
|
1810
|
+
const fr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1811
|
+
const r = await t.oms.processOrderAuthorization(n), i = gn(r);
|
|
1812
1812
|
return {
|
|
1813
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1813
|
+
isPendingForOtherAuthorizer: !i && hr(r),
|
|
1814
1814
|
ruleForAuthorization: i
|
|
1815
1815
|
};
|
|
1816
|
-
},
|
|
1816
|
+
}, Sr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1817
1817
|
if (!n?.objectKey)
|
|
1818
1818
|
throw new _("Missing objectKey");
|
|
1819
1819
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
@@ -1822,13 +1822,13 @@ const hr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
|
1822
1822
|
orderFormId: r,
|
|
1823
1823
|
sessionToken: n.sessionToken ?? void 0
|
|
1824
1824
|
});
|
|
1825
|
-
},
|
|
1825
|
+
}, yr = async (e, n, t) => {
|
|
1826
1826
|
if (!(await t.clients.commerce.recommendation.startRecommendationSession())?.recommendationsUserId)
|
|
1827
1827
|
throw new Error(
|
|
1828
1828
|
"Failed to start recommendation session: no session data returned"
|
|
1829
1829
|
);
|
|
1830
1830
|
return !0;
|
|
1831
|
-
},
|
|
1831
|
+
}, Ir = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), vr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1832
1832
|
const { fileContent: r, fileName: i, mimeType: a } = n;
|
|
1833
1833
|
if (!r || !i || !a)
|
|
1834
1834
|
throw new _(
|
|
@@ -1841,9 +1841,9 @@ const hr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
|
1841
1841
|
o
|
|
1842
1842
|
))
|
|
1843
1843
|
throw new _("Invalid Base64 fileContent");
|
|
1844
|
-
const
|
|
1844
|
+
const g = Buffer.from(o, "base64");
|
|
1845
1845
|
return await t.orderEntry.uploadFile({
|
|
1846
|
-
fileBuffer:
|
|
1846
|
+
fileBuffer: g,
|
|
1847
1847
|
fileName: i,
|
|
1848
1848
|
mimeType: a
|
|
1849
1849
|
});
|
|
@@ -1870,19 +1870,19 @@ const ve = (e, n) => {
|
|
|
1870
1870
|
e.storage.channel = oe.parse(n);
|
|
1871
1871
|
}, Oe = (e, n) => {
|
|
1872
1872
|
e.storage.locale = n;
|
|
1873
|
-
},
|
|
1873
|
+
}, mn = (e) => Bn.createHash("md5").update(e).digest("hex"), ne = {
|
|
1874
1874
|
attachment: "ATTACHMENT",
|
|
1875
1875
|
specification: "SPECIFICATION",
|
|
1876
1876
|
attribute: "ATTRIBUTE"
|
|
1877
1877
|
};
|
|
1878
|
-
function
|
|
1878
|
+
function hn(e) {
|
|
1879
1879
|
return {
|
|
1880
1880
|
name: e.name,
|
|
1881
1881
|
value: e.content,
|
|
1882
1882
|
valueReference: ne.attachment
|
|
1883
1883
|
};
|
|
1884
1884
|
}
|
|
1885
|
-
function
|
|
1885
|
+
function Or(e) {
|
|
1886
1886
|
return {
|
|
1887
1887
|
propertyID: e.id,
|
|
1888
1888
|
name: e.name,
|
|
@@ -1893,12 +1893,12 @@ function vr(e) {
|
|
|
1893
1893
|
}
|
|
1894
1894
|
};
|
|
1895
1895
|
}
|
|
1896
|
-
function
|
|
1897
|
-
return
|
|
1896
|
+
function fn(e) {
|
|
1897
|
+
return mn(
|
|
1898
1898
|
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
1899
1899
|
);
|
|
1900
1900
|
}
|
|
1901
|
-
const
|
|
1901
|
+
const Cr = (e) => {
|
|
1902
1902
|
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
1903
1903
|
addressType: e.addressType || null,
|
|
1904
1904
|
postalCode: n || null,
|
|
@@ -1917,7 +1917,7 @@ const Or = (e) => {
|
|
|
1917
1917
|
r.geoCoordinates = i !== null && a !== null ? [a, i] : [];
|
|
1918
1918
|
}
|
|
1919
1919
|
return [r];
|
|
1920
|
-
},
|
|
1920
|
+
}, br = (e, n, t) => {
|
|
1921
1921
|
const r = n.postalCode, i = n.geoCoordinates, a = e?.shippingData?.availableAddresses ?? [], o = e?.shippingData?.selectedAddresses ?? [];
|
|
1922
1922
|
if (!t && o.length > 0)
|
|
1923
1923
|
return [o[0]];
|
|
@@ -1931,31 +1931,31 @@ const Or = (e) => {
|
|
|
1931
1931
|
return [s];
|
|
1932
1932
|
}
|
|
1933
1933
|
return null;
|
|
1934
|
-
},
|
|
1935
|
-
if (!
|
|
1934
|
+
}, Sn = (e, n) => {
|
|
1935
|
+
if (!wr(n))
|
|
1936
1936
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1937
|
-
if (!
|
|
1937
|
+
if (!kr(e))
|
|
1938
1938
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1939
1939
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
1940
|
-
if (
|
|
1940
|
+
if (Dr(t, n.postalCode) || Pr(t, n.geoCoordinates) || Ar(t, n.addressType))
|
|
1941
1941
|
return { updateShipping: !0, addressChanged: !0 };
|
|
1942
1942
|
const { logisticsInfo: r } = e.shippingData;
|
|
1943
|
-
return
|
|
1944
|
-
},
|
|
1943
|
+
return Ur(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
1944
|
+
}, wr = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, Dr = (e, n) => typeof n == "string" && e?.postalCode !== n, Pr = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), Ar = (e, n) => typeof n == "string" && e?.addressType !== n, kr = (e) => e.items.length !== 0, Ur = (e, n) => {
|
|
1945
1945
|
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
|
|
1946
1946
|
return e.some(
|
|
1947
1947
|
({ selectedDeliveryChannel: o, selectedSla: s, slas: c }) => {
|
|
1948
|
-
const l = t && o !== t,
|
|
1949
|
-
return c?.some((u) => l && u.deliveryChannel === t ||
|
|
1948
|
+
const l = t && o !== t, g = r && s !== r;
|
|
1949
|
+
return c?.some((u) => l && u.deliveryChannel === t || g && u.id === r ? !0 : i && a && u.deliveryChannel === t && u.id === r && (!u?.deliveryWindow || u?.deliveryWindow?.startDateUtc !== i || u?.deliveryWindow?.endDateUtc !== a) && u.availableDeliveryWindows?.some(
|
|
1950
1950
|
(h) => h?.startDateUtc === i && h?.endDateUtc === a
|
|
1951
1951
|
));
|
|
1952
1952
|
}
|
|
1953
1953
|
);
|
|
1954
|
-
},
|
|
1954
|
+
}, yn = (e) => e.valueReference === ne.attachment, Ce = (e) => [
|
|
1955
1955
|
e.itemOffered.sku,
|
|
1956
1956
|
e.seller.identifier,
|
|
1957
1957
|
e.price < 0.01 ? "Gift" : void 0,
|
|
1958
|
-
e.itemOffered.additionalProperty?.filter(
|
|
1958
|
+
e.itemOffered.additionalProperty?.filter(yn).map(fn).join("-")
|
|
1959
1959
|
].filter(Boolean).join("::"), se = (e, n) => ({
|
|
1960
1960
|
listPrice: e.listPrice / 100,
|
|
1961
1961
|
price: e.sellingPrice / 100,
|
|
@@ -1965,15 +1965,15 @@ const Or = (e) => {
|
|
|
1965
1965
|
sku: e.id,
|
|
1966
1966
|
image: [],
|
|
1967
1967
|
name: e.name,
|
|
1968
|
-
additionalProperty: e.attachments.map(
|
|
1968
|
+
additionalProperty: e.attachments.map(hn)
|
|
1969
1969
|
},
|
|
1970
1970
|
index: n
|
|
1971
|
-
}),
|
|
1971
|
+
}), Tr = (e) => ({
|
|
1972
1972
|
quantity: e.quantity,
|
|
1973
1973
|
seller: e.seller.identifier,
|
|
1974
1974
|
id: e.itemOffered.sku,
|
|
1975
1975
|
index: e.index,
|
|
1976
|
-
attachments: (e.itemOffered.additionalProperty?.filter(
|
|
1976
|
+
attachments: (e.itemOffered.additionalProperty?.filter(yn) ?? []).map((n) => ({
|
|
1977
1977
|
name: n.name,
|
|
1978
1978
|
content: n.value
|
|
1979
1979
|
})),
|
|
@@ -1981,7 +1981,7 @@ const Or = (e) => {
|
|
|
1981
1981
|
}), qe = (e) => e.reduce((n, t) => {
|
|
1982
1982
|
const r = Ce(t);
|
|
1983
1983
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
1984
|
-
}, /* @__PURE__ */ new Map()),
|
|
1984
|
+
}, /* @__PURE__ */ new Map()), _r = (e, n) => {
|
|
1985
1985
|
const t = ({ priceToken: s, ...c }, l) => ({
|
|
1986
1986
|
...c,
|
|
1987
1987
|
itemOffered: {
|
|
@@ -1991,12 +1991,12 @@ const Or = (e) => {
|
|
|
1991
1991
|
}), r = n.items.map(se).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = Ae(r, i);
|
|
1992
1992
|
return a && o;
|
|
1993
1993
|
};
|
|
1994
|
-
function
|
|
1994
|
+
function In(e, n) {
|
|
1995
1995
|
return e?.some(
|
|
1996
1996
|
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 && e[t.parentItemIndex]?.id === n
|
|
1997
1997
|
);
|
|
1998
1998
|
}
|
|
1999
|
-
function
|
|
1999
|
+
function vn(e, n) {
|
|
2000
2000
|
return e?.some(
|
|
2001
2001
|
(t) => t.id === n && t.parentItemIndex !== null
|
|
2002
2002
|
);
|
|
@@ -2004,7 +2004,7 @@ function In(e, n) {
|
|
|
2004
2004
|
const je = (e) => {
|
|
2005
2005
|
const n = e.items.reduce(
|
|
2006
2006
|
(t, r, i) => {
|
|
2007
|
-
const a =
|
|
2007
|
+
const a = vn(e.items, r.id) || In(e.items, r.id) ? `${Ce(se(r))}::${i}` : Ce(se(r));
|
|
2008
2008
|
return t[a] || (t[a] = []), t[a].push(r), t;
|
|
2009
2009
|
},
|
|
2010
2010
|
{}
|
|
@@ -2036,7 +2036,7 @@ const je = (e) => {
|
|
|
2036
2036
|
text: r,
|
|
2037
2037
|
status: i.toUpperCase()
|
|
2038
2038
|
}))
|
|
2039
|
-
}),
|
|
2039
|
+
}), On = ({ items: e }, n) => {
|
|
2040
2040
|
const t = e.map((r) => ({
|
|
2041
2041
|
id: r.id,
|
|
2042
2042
|
quantity: r.quantity,
|
|
@@ -2044,7 +2044,7 @@ const je = (e) => {
|
|
|
2044
2044
|
attachments: r.attachments
|
|
2045
2045
|
// customizations
|
|
2046
2046
|
}));
|
|
2047
|
-
return
|
|
2047
|
+
return mn(
|
|
2048
2048
|
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
2049
2049
|
);
|
|
2050
2050
|
}, Ge = async (e, n, t) => {
|
|
@@ -2053,7 +2053,7 @@ const je = (e) => {
|
|
|
2053
2053
|
id: e.orderFormId,
|
|
2054
2054
|
appId: "faststore",
|
|
2055
2055
|
key: "cartEtag",
|
|
2056
|
-
value:
|
|
2056
|
+
value: On(e, t)
|
|
2057
2057
|
});
|
|
2058
2058
|
} catch (r) {
|
|
2059
2059
|
throw console.error(
|
|
@@ -2063,22 +2063,22 @@ const je = (e) => {
|
|
|
2063
2063
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
2064
2064
|
), r;
|
|
2065
2065
|
}
|
|
2066
|
-
},
|
|
2066
|
+
}, Er = (e, n) => {
|
|
2067
2067
|
const r = e.customData?.customApps.find(
|
|
2068
2068
|
(a) => a.id === "faststore"
|
|
2069
2069
|
)?.fields?.cartEtag;
|
|
2070
|
-
return r == null ? !0 :
|
|
2071
|
-
},
|
|
2070
|
+
return r == null ? !0 : On(e, n) !== r;
|
|
2071
|
+
}, Rr = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
2072
2072
|
id: e
|
|
2073
2073
|
}), He = async (e, n, { clients: { commerce: t } }) => {
|
|
2074
2074
|
if (!n)
|
|
2075
2075
|
return e;
|
|
2076
|
-
const { updateShipping: r, addressChanged: i } =
|
|
2076
|
+
const { updateShipping: r, addressChanged: i } = Sn(
|
|
2077
2077
|
e,
|
|
2078
2078
|
n
|
|
2079
2079
|
);
|
|
2080
2080
|
if (r) {
|
|
2081
|
-
const a =
|
|
2081
|
+
const a = br(e, n, i), s = a || Cr(n);
|
|
2082
2082
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
2083
2083
|
{
|
|
2084
2084
|
id: e.orderFormId,
|
|
@@ -2098,13 +2098,13 @@ const je = (e) => {
|
|
|
2098
2098
|
);
|
|
2099
2099
|
}
|
|
2100
2100
|
return e;
|
|
2101
|
-
},
|
|
2101
|
+
}, Fr = (e, n) => {
|
|
2102
2102
|
if (!e)
|
|
2103
2103
|
return "";
|
|
2104
2104
|
const r = Z(e)[n];
|
|
2105
2105
|
return r ? r.split("=")[1] : "";
|
|
2106
|
-
},
|
|
2107
|
-
const i =
|
|
2106
|
+
}, Nr = async (e, { cart: { order: n }, session: t }, r) => {
|
|
2107
|
+
const i = Fr(
|
|
2108
2108
|
r.headers.cookie,
|
|
2109
2109
|
"checkout.vtex.com"
|
|
2110
2110
|
), {
|
|
@@ -2115,27 +2115,27 @@ const je = (e) => {
|
|
|
2115
2115
|
const l = await a.checkout.orderForm({
|
|
2116
2116
|
id: i || void 0,
|
|
2117
2117
|
channel: r.storage.channel
|
|
2118
|
-
}),
|
|
2119
|
-
l.messages.length !== 0 && await
|
|
2118
|
+
}), g = l.orderFormId;
|
|
2119
|
+
l.messages.length !== 0 && await Rr(g, r);
|
|
2120
2120
|
const u = Z(r?.headers?.cookie ?? "")?.vtex_session, h = Y(u), { acceptedOffer: f, shouldSplitItem: v } = n;
|
|
2121
|
-
if (
|
|
2121
|
+
if (Er(l, h)) {
|
|
2122
2122
|
const b = await Ge(
|
|
2123
2123
|
l,
|
|
2124
2124
|
a,
|
|
2125
2125
|
h
|
|
2126
2126
|
).then(je);
|
|
2127
|
-
if (
|
|
2127
|
+
if (g)
|
|
2128
2128
|
return We(b, o, v);
|
|
2129
2129
|
}
|
|
2130
|
-
const
|
|
2130
|
+
const p = qe(f), m = qe(l.items.map(se)), y = Array.from(m.entries()), O = Array.from(p.entries()), { itemsToAdd: w, itemsToUpdate: C } = O.reduce(
|
|
2131
2131
|
(b, [U, T]) => {
|
|
2132
2132
|
const x = m.get(U);
|
|
2133
2133
|
if (!x)
|
|
2134
2134
|
return T.forEach((q) => b.itemsToAdd.push(q)), b;
|
|
2135
2135
|
const [E, ...ke] = x;
|
|
2136
|
-
if (
|
|
2136
|
+
if (vn(l.items, E.itemOffered.sku) || In(l.items, E.itemOffered.sku))
|
|
2137
2137
|
return b.itemsToUpdate.push(E), b;
|
|
2138
|
-
const de = T.reduce((q,
|
|
2138
|
+
const de = T.reduce((q, kn) => q + kn.quantity, 0);
|
|
2139
2139
|
return b.itemsToUpdate.push({
|
|
2140
2140
|
...E,
|
|
2141
2141
|
quantity: de
|
|
@@ -2145,9 +2145,9 @@ const je = (e) => {
|
|
|
2145
2145
|
itemsToAdd: [],
|
|
2146
2146
|
itemsToUpdate: []
|
|
2147
2147
|
}
|
|
2148
|
-
), A = y.filter(([b]) => !
|
|
2149
|
-
|
|
2150
|
-
), { updateShipping: D } = t ?
|
|
2148
|
+
), A = y.filter(([b]) => !p.has(b)).flatMap(([, b]) => b.map((U) => ({ ...U, quantity: 0 }))), S = [...w, ...C, ...A].map(
|
|
2149
|
+
Tr
|
|
2150
|
+
), { updateShipping: D } = t ? Sn(l, t) : { updateShipping: !1 };
|
|
2151
2151
|
if (S.length === 0 && !D)
|
|
2152
2152
|
return null;
|
|
2153
2153
|
let P;
|
|
@@ -2184,27 +2184,27 @@ const je = (e) => {
|
|
|
2184
2184
|
l.messages,
|
|
2185
2185
|
P.messages
|
|
2186
2186
|
);
|
|
2187
|
-
return
|
|
2188
|
-
},
|
|
2187
|
+
return _r(n, P) && k ? null : We(P, o, v);
|
|
2188
|
+
}, Lr = (e) => {
|
|
2189
2189
|
const n = (e?.corporateName ?? "").trim();
|
|
2190
2190
|
return n || (e?.firstName ?? "").trim();
|
|
2191
|
-
},
|
|
2191
|
+
}, Br = (e) => {
|
|
2192
2192
|
if (!e || typeof e != "object")
|
|
2193
2193
|
return !1;
|
|
2194
2194
|
const n = e;
|
|
2195
2195
|
return typeof n.customerId == "string" && n.customerId.trim() !== "" && typeof n.contractName == "string" && typeof n.isActive == "boolean" && typeof n.isCurrent == "boolean";
|
|
2196
|
-
},
|
|
2196
|
+
}, $r = (e) => {
|
|
2197
2197
|
const n = e?.availableContracts?.value;
|
|
2198
|
-
return Array.isArray(n) ? n.filter(
|
|
2199
|
-
},
|
|
2198
|
+
return Array.isArray(n) ? n.filter(Br) : [];
|
|
2199
|
+
}, Mr = (e) => e?.customerId ? !!((e.contractName ?? "").trim() && e.isActive) : !1, Xe = (e) => e?.namespaces?.shopper?.activeContractId?.value?.trim() ?? e?.namespaces?.authentication?.customerId?.value?.trim() ?? e?.namespaces?.profile?.id?.value?.trim() ?? "", zr = (e, n = "") => {
|
|
2200
2200
|
const t = n.trim();
|
|
2201
|
-
return e.filter(
|
|
2201
|
+
return e.filter(Mr).map((r) => ({
|
|
2202
2202
|
id: r.customerId,
|
|
2203
2203
|
corporateName: r.contractName.trim(),
|
|
2204
2204
|
isActive: t ? r.customerId === t : r.isCurrent
|
|
2205
2205
|
}));
|
|
2206
|
-
},
|
|
2207
|
-
const t =
|
|
2206
|
+
}, Cn = (e, n) => {
|
|
2207
|
+
const t = Lr(e);
|
|
2208
2208
|
return t || (n?.firstName?.value ?? "").trim();
|
|
2209
2209
|
};
|
|
2210
2210
|
async function Vr(e, n, t) {
|
|
@@ -2226,21 +2226,21 @@ async function Vr(e, n, t) {
|
|
|
2226
2226
|
}
|
|
2227
2227
|
const xr = async (e, { session: n, search: t }, { clients: r, headers: i, account: a }) => {
|
|
2228
2228
|
const o = oe.parse(n.channel ?? ""), s = String(n.postalCode ?? ""), c = n.country ?? "";
|
|
2229
|
-
let l = n.city ?? null,
|
|
2230
|
-
if ((!l || !
|
|
2229
|
+
let l = n.city ?? null, g = n.geoCoordinates ?? null;
|
|
2230
|
+
if ((!l || !g) && s !== "" && c !== "") {
|
|
2231
2231
|
const E = await Vr(
|
|
2232
2232
|
r,
|
|
2233
2233
|
c,
|
|
2234
2234
|
s
|
|
2235
2235
|
);
|
|
2236
|
-
l = E.city,
|
|
2236
|
+
l = E.city, g = E.geoCoordinates;
|
|
2237
2237
|
}
|
|
2238
2238
|
const h = new URLSearchParams(t);
|
|
2239
2239
|
h.has("facets") && h.delete("facets");
|
|
2240
2240
|
const f = h.get("sc") ?? o.salesChannel;
|
|
2241
|
-
h.set("sc", f), s && h.set("postalCode", s), c && h.set("country", c),
|
|
2241
|
+
h.set("sc", f), s && h.set("postalCode", s), c && h.set("country", c), g && h.set(
|
|
2242
2242
|
"geoCoordinates",
|
|
2243
|
-
`${
|
|
2243
|
+
`${g.longitude},${g.latitude}`
|
|
2244
2244
|
// long,lat is the format expected
|
|
2245
2245
|
), h.set("locale", n.locale);
|
|
2246
2246
|
const { marketingData: v } = n, d = {
|
|
@@ -2250,15 +2250,15 @@ const xr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2250
2250
|
utmiCampaign: h.get("utmi_cp") ?? v?.utmiCampaign ?? "",
|
|
2251
2251
|
utmiPage: h.get("utmi_p") ?? v?.utmiPage ?? "",
|
|
2252
2252
|
utmiPart: h.get("utmi_pc") ?? v?.utmiPart ?? ""
|
|
2253
|
-
},
|
|
2253
|
+
}, p = Y(z(i?.cookie ?? "", a));
|
|
2254
2254
|
let m = !1;
|
|
2255
|
-
if (
|
|
2255
|
+
if (p)
|
|
2256
2256
|
try {
|
|
2257
2257
|
m = (await r.commerce.vtexid.validate())?.authStatus?.toLowerCase() === "success";
|
|
2258
2258
|
} catch (E) {
|
|
2259
2259
|
console.warn("JWT validation failed:", E), m = !1;
|
|
2260
2260
|
}
|
|
2261
|
-
const y = m ?
|
|
2261
|
+
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), A = C?.namespaces.profile ?? null, S = C?.namespaces.shopper ?? null, D = C?.namespaces.store ?? null, P = C?.namespaces.authentication ?? null, k = C?.namespaces.checkout ?? null, b = C?.namespaces.public ?? null;
|
|
2262
2262
|
let U = null;
|
|
2263
2263
|
if (y && A?.id?.value)
|
|
2264
2264
|
try {
|
|
@@ -2272,9 +2272,9 @@ const xr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2272
2272
|
);
|
|
2273
2273
|
}
|
|
2274
2274
|
let T;
|
|
2275
|
-
o.seller && (s ||
|
|
2275
|
+
o.seller && (s || g) && (T = (await r.commerce.checkout.region({
|
|
2276
2276
|
postalCode: s,
|
|
2277
|
-
geoCoordinates:
|
|
2277
|
+
geoCoordinates: g,
|
|
2278
2278
|
country: c,
|
|
2279
2279
|
salesChannel: f
|
|
2280
2280
|
}))?.[0]?.sellers.find((de) => o.seller === de.id));
|
|
@@ -2307,7 +2307,7 @@ const xr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2307
2307
|
userName: `${typeof S?.firstName?.value == "string" ? S.firstName.value : ""} ${typeof S?.lastName?.value == "string" ? S.lastName.value : ""}`.trim(),
|
|
2308
2308
|
userEmail: P?.storeUserEmail.value ?? "",
|
|
2309
2309
|
savedPostalCode: b?.postalCode?.value ?? "",
|
|
2310
|
-
contractName:
|
|
2310
|
+
contractName: Cn(U, A),
|
|
2311
2311
|
organizationManager: S?.organizationManager?.value ?? !1
|
|
2312
2312
|
} : null,
|
|
2313
2313
|
marketingData: d,
|
|
@@ -2317,39 +2317,39 @@ const xr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2317
2317
|
givenName: A.firstName?.value ?? "",
|
|
2318
2318
|
familyName: A.lastName?.value ?? ""
|
|
2319
2319
|
} : null,
|
|
2320
|
-
geoCoordinates:
|
|
2320
|
+
geoCoordinates: g?.latitude && g?.longitude && g || null,
|
|
2321
2321
|
city: l
|
|
2322
2322
|
};
|
|
2323
2323
|
return Ae(n, x) ? null : x;
|
|
2324
2324
|
}, qr = {
|
|
2325
|
-
validateCart:
|
|
2325
|
+
validateCart: Nr,
|
|
2326
2326
|
validateSession: xr,
|
|
2327
|
-
subscribeToNewsletter:
|
|
2328
|
-
cancelOrder:
|
|
2329
|
-
processOrderAuthorization:
|
|
2330
|
-
uploadFileToOrderEntry:
|
|
2331
|
-
startOrderEntryOperation:
|
|
2332
|
-
startRecommendationSession:
|
|
2327
|
+
subscribeToNewsletter: Ir,
|
|
2328
|
+
cancelOrder: mr,
|
|
2329
|
+
processOrderAuthorization: fr,
|
|
2330
|
+
uploadFileToOrderEntry: vr,
|
|
2331
|
+
startOrderEntryOperation: Sr,
|
|
2332
|
+
startRecommendationSession: yr
|
|
2333
2333
|
};
|
|
2334
2334
|
var be;
|
|
2335
2335
|
(function(e) {
|
|
2336
2336
|
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";
|
|
2337
2337
|
})(be || (be = {}));
|
|
2338
|
-
const jr = (e) => typeof e == "string" ?
|
|
2339
|
-
function
|
|
2338
|
+
const jr = (e) => typeof e == "string" ? bn(e) : null;
|
|
2339
|
+
function bn(e) {
|
|
2340
2340
|
try {
|
|
2341
2341
|
return JSON.parse(e);
|
|
2342
2342
|
} catch {
|
|
2343
2343
|
return e;
|
|
2344
2344
|
}
|
|
2345
2345
|
}
|
|
2346
|
-
const Wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Gr = new
|
|
2346
|
+
const Wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Gr = new _n({
|
|
2347
2347
|
name: "ObjectOrString",
|
|
2348
2348
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2349
2349
|
parseValue: jr,
|
|
2350
2350
|
serialize: Wr,
|
|
2351
2351
|
parseLiteral(e) {
|
|
2352
|
-
return e.kind === be.STRING ?
|
|
2352
|
+
return e.kind === be.STRING ? bn(e.value) : null;
|
|
2353
2353
|
}
|
|
2354
2354
|
}), R = (e) => "Price" in e && "seller" in e && "product" in e, F = (e) => "skuName" in e, Hr = {
|
|
2355
2355
|
priceCurrency: async (e, n, t) => {
|
|
@@ -2361,7 +2361,7 @@ const Wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2361
2361
|
},
|
|
2362
2362
|
priceValidUntil: (e) => R(e) ? e.PriceValidUntil ?? "" : F(e) ? e.priceValidUntil ?? "" : null,
|
|
2363
2363
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2364
|
-
availability: async (e) => R(e) ? Le(B(e)) : F(e) ? Le(
|
|
2364
|
+
availability: async (e) => R(e) ? Le(B(e)) : F(e) ? Le(Zt(e.availability)) : null,
|
|
2365
2365
|
seller: (e, n, t) => R(e) ? {
|
|
2366
2366
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2367
2367
|
} : F(e) ? {
|
|
@@ -2373,7 +2373,7 @@ const Wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2373
2373
|
e.tax / 100,
|
|
2374
2374
|
e.unitMultiplier
|
|
2375
2375
|
) : null,
|
|
2376
|
-
sellingPrice: (e) => R(e) ?
|
|
2376
|
+
sellingPrice: (e) => R(e) ? Qt(e) : F(e) ? e.sellingPrice / 100 : null,
|
|
2377
2377
|
listPrice: (e) => R(e) ? e.ListPrice ?? 0 : F(e) ? e.listPrice / 100 : null,
|
|
2378
2378
|
listPriceWithTaxes: (e) => R(e) ? M(
|
|
2379
2379
|
e.ListPrice ?? 0,
|
|
@@ -2399,7 +2399,7 @@ const Wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2399
2399
|
imageText: "image",
|
|
2400
2400
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2401
2401
|
imageLabel: "label"
|
|
2402
|
-
}, ie = (e, n) => `${e}-${n}`,
|
|
2402
|
+
}, ie = (e, n) => `${e}-${n}`, Ye = (e, n) => `/${ie(e, n)}/p`, Kr = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2403
2403
|
function we(e) {
|
|
2404
2404
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2405
2405
|
}
|
|
@@ -2451,28 +2451,28 @@ const Qr = (e, n) => {
|
|
|
2451
2451
|
productId: c
|
|
2452
2452
|
},
|
|
2453
2453
|
itemId: l
|
|
2454
|
-
} = e,
|
|
2454
|
+
} = e, g = Qr(s, o), u = r[g], h = we(u).split("/"), f = t.storage.locale;
|
|
2455
2455
|
if (Q(t) && f) {
|
|
2456
2456
|
const v = await De(t, c, f);
|
|
2457
2457
|
if (v) {
|
|
2458
2458
|
const d = new Set(
|
|
2459
|
-
we(s[
|
|
2460
|
-
),
|
|
2459
|
+
we(s[g]).split("/").filter(Boolean)
|
|
2460
|
+
), p = v.categories.filter((y) => d.has(y.id.toString())).sort(
|
|
2461
2461
|
(y, O) => y.fullPath.split("/").length - O.fullPath.split("/").length
|
|
2462
2462
|
);
|
|
2463
|
-
if (
|
|
2463
|
+
if (p.length === h.length)
|
|
2464
2464
|
return {
|
|
2465
2465
|
itemListElement: [
|
|
2466
2466
|
// Category items: both name and slug come from Catalog Dataplane, ensuring
|
|
2467
2467
|
// they are always consistent with each other for the requested locale.
|
|
2468
|
-
...
|
|
2468
|
+
...p.map((y, O) => ({
|
|
2469
2469
|
name: y.name,
|
|
2470
2470
|
item: `/${y.fullPathUriName}/`,
|
|
2471
2471
|
position: O + 1
|
|
2472
2472
|
})),
|
|
2473
2473
|
{
|
|
2474
2474
|
name: i,
|
|
2475
|
-
item:
|
|
2475
|
+
item: Ye(v.linkId, l),
|
|
2476
2476
|
position: h.length + 1
|
|
2477
2477
|
}
|
|
2478
2478
|
],
|
|
@@ -2483,16 +2483,16 @@ const Qr = (e, n) => {
|
|
|
2483
2483
|
return {
|
|
2484
2484
|
itemListElement: [
|
|
2485
2485
|
...h.map((v, d) => {
|
|
2486
|
-
const
|
|
2486
|
+
const p = `/${h.slice(0, d + 1).map(ae).join("/")}/`;
|
|
2487
2487
|
return {
|
|
2488
2488
|
name: v,
|
|
2489
|
-
item:
|
|
2489
|
+
item: p,
|
|
2490
2490
|
position: d + 1
|
|
2491
2491
|
};
|
|
2492
2492
|
}),
|
|
2493
2493
|
{
|
|
2494
2494
|
name: i,
|
|
2495
|
-
item:
|
|
2495
|
+
item: Ye(a, l),
|
|
2496
2496
|
position: h.length + 1
|
|
2497
2497
|
}
|
|
2498
2498
|
],
|
|
@@ -2528,7 +2528,7 @@ const Qr = (e, n) => {
|
|
|
2528
2528
|
seller: n,
|
|
2529
2529
|
product: e
|
|
2530
2530
|
})
|
|
2531
|
-
).sort(
|
|
2531
|
+
).sort(dn),
|
|
2532
2532
|
isVariantOf: (e) => e,
|
|
2533
2533
|
additionalProperty: ({
|
|
2534
2534
|
// Search uses the name variations for specifications
|
|
@@ -2543,8 +2543,8 @@ const Qr = (e, n) => {
|
|
|
2543
2543
|
valueReference: ne.specification
|
|
2544
2544
|
}))
|
|
2545
2545
|
), i = n.map(
|
|
2546
|
-
|
|
2547
|
-
), a = t.map(
|
|
2546
|
+
hn
|
|
2547
|
+
), a = t.map(Or);
|
|
2548
2548
|
return [
|
|
2549
2549
|
...r,
|
|
2550
2550
|
...i,
|
|
@@ -2559,14 +2559,14 @@ const Qr = (e, n) => {
|
|
|
2559
2559
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e,
|
|
2560
2560
|
otherLocales: async (e, n, t) => {
|
|
2561
2561
|
if (!Q(t)) return null;
|
|
2562
|
-
const r =
|
|
2562
|
+
const r = mt(t);
|
|
2563
2563
|
if (r.length === 0) return null;
|
|
2564
|
-
const i = e.isVariantOf.productId, a = e.itemId, o = t.storage.locale, s =
|
|
2564
|
+
const i = e.isVariantOf.productId, a = e.itemId, o = t.storage.locale, s = ht(t), c = await De(t, i, o);
|
|
2565
2565
|
if (!c?.availableLinkIds) return null;
|
|
2566
|
-
const { availableLinkIds: l } = c, { linkText:
|
|
2566
|
+
const { availableLinkIds: l } = c, { linkText: g } = e.isVariantOf;
|
|
2567
2567
|
return r.map((u) => {
|
|
2568
2568
|
if (u === s)
|
|
2569
|
-
return { locale: u, slug: ie(
|
|
2569
|
+
return { locale: u, slug: ie(g, a) };
|
|
2570
2570
|
const h = l[u];
|
|
2571
2571
|
return h ? { locale: u, slug: ie(h, a) } : null;
|
|
2572
2572
|
}).filter((u) => u !== null);
|
|
@@ -2588,7 +2588,7 @@ const Qr = (e, n) => {
|
|
|
2588
2588
|
)
|
|
2589
2589
|
)
|
|
2590
2590
|
}, ti = {
|
|
2591
|
-
propertyID: (e) => e.propertyID ||
|
|
2591
|
+
propertyID: (e) => e.propertyID || fn(e),
|
|
2592
2592
|
name: ({ name: e }) => e,
|
|
2593
2593
|
value: ({ value: e }) => e,
|
|
2594
2594
|
valueReference: ({ valueReference: e }) => e
|
|
@@ -2600,10 +2600,10 @@ const Qr = (e, n) => {
|
|
|
2600
2600
|
}))
|
|
2601
2601
|
), t = Ie(
|
|
2602
2602
|
n,
|
|
2603
|
-
({ offer: r }, { offer: i }) =>
|
|
2603
|
+
({ offer: r }, { offer: i }) => dn(r, i)
|
|
2604
2604
|
);
|
|
2605
2605
|
return t ? t.sku : e[0];
|
|
2606
|
-
},
|
|
2606
|
+
}, wn = (e) => e !== "" && !Number.isNaN(Number(e)), ri = /^vrn:recommendations:[^:]+:[^:]+:[^:]+$/, ii = async (e, { campaignVrn: n, userId: t, products: r }, i) => {
|
|
2607
2607
|
const {
|
|
2608
2608
|
clients: { commerce: a }
|
|
2609
2609
|
} = i, { salesChannel: o } = i.storage.channel, s = n?.trim();
|
|
@@ -2622,16 +2622,16 @@ const Qr = (e, n) => {
|
|
|
2622
2622
|
products: r ?? [],
|
|
2623
2623
|
salesChannel: o ?? void 0,
|
|
2624
2624
|
locale: i.storage.locale
|
|
2625
|
-
}), { campaign:
|
|
2625
|
+
}), { campaign: g, correlationId: u } = l;
|
|
2626
2626
|
return {
|
|
2627
2627
|
products: (l.products ?? []).map((f) => {
|
|
2628
2628
|
const v = ce(f.items);
|
|
2629
2629
|
return v ? N(v, f) : null;
|
|
2630
2630
|
}).filter((f) => !!f),
|
|
2631
2631
|
correlationId: u,
|
|
2632
|
-
campaign:
|
|
2632
|
+
campaign: g
|
|
2633
2633
|
};
|
|
2634
|
-
},
|
|
2634
|
+
}, Je = {
|
|
2635
2635
|
price_desc: "price:desc",
|
|
2636
2636
|
price_asc: "price:asc",
|
|
2637
2637
|
orders_desc: "orders:desc",
|
|
@@ -2664,11 +2664,11 @@ async function si(e, n, t, r) {
|
|
|
2664
2664
|
const i = n.slice(0, n.lastIndexOf("-"));
|
|
2665
2665
|
return (await De(e, t, r))?.linkId === i;
|
|
2666
2666
|
}
|
|
2667
|
-
const
|
|
2667
|
+
const Dn = "Invalid SkuId", Pn = "Slug was set but the fetched sku does not satisfy the slug condition.", ci = (e) => X(e) || e instanceof Error && (e.message === Dn || e.message.startsWith(Pn));
|
|
2668
2668
|
async function li(e, n, t, r) {
|
|
2669
2669
|
const { linkText: i, productId: a } = n.isVariantOf;
|
|
2670
|
-
if (!(!t || !i || t.startsWith(i) || Q(e) && r &&
|
|
2671
|
-
throw new Error(`${
|
|
2670
|
+
if (!(!t || !i || t.startsWith(i) || Q(e) && r && wn(t.split("-").pop() ?? "") && await si(e, t, a, r)))
|
|
2671
|
+
throw new Error(`${Pn} slug: ${t}, linkText: ${i}`);
|
|
2672
2672
|
}
|
|
2673
2673
|
async function di(e, n) {
|
|
2674
2674
|
if (n == null)
|
|
@@ -2688,15 +2688,15 @@ async function di(e, n) {
|
|
|
2688
2688
|
}
|
|
2689
2689
|
const ui = {
|
|
2690
2690
|
product: async (e, { locator: n }, t) => {
|
|
2691
|
-
const r = xe(n), i = Ve(n), a =
|
|
2691
|
+
const r = xe(n), i = Ve(n), a = lr(n), o = cr(n);
|
|
2692
2692
|
r && ve(t, r), i && Oe(t, i);
|
|
2693
2693
|
const {
|
|
2694
2694
|
loaders: { skuLoader: s }
|
|
2695
2695
|
} = t;
|
|
2696
2696
|
try {
|
|
2697
2697
|
const c = a ?? o?.split("-").pop() ?? "";
|
|
2698
|
-
if (!
|
|
2699
|
-
throw new Error(
|
|
2698
|
+
if (!wn(c))
|
|
2699
|
+
throw new Error(Dn);
|
|
2700
2700
|
const l = await s.load(c);
|
|
2701
2701
|
return await li(t, l, o, i), l;
|
|
2702
2702
|
} catch (c) {
|
|
@@ -2722,21 +2722,21 @@ const ui = {
|
|
|
2722
2722
|
selectedFacets: a,
|
|
2723
2723
|
sponsoredCount: o
|
|
2724
2724
|
}, s) => {
|
|
2725
|
-
const c = xe(a), l = Ve(a),
|
|
2725
|
+
const c = xe(a), l = Ve(a), g = sr(a);
|
|
2726
2726
|
c && ve(s, c), l && Oe(s, l);
|
|
2727
2727
|
const u = t ? Number(t) : 0, h = {
|
|
2728
2728
|
page: Math.ceil(u / n) || 0,
|
|
2729
2729
|
count: n,
|
|
2730
2730
|
query: i ?? void 0,
|
|
2731
|
-
sort:
|
|
2731
|
+
sort: Je[r ?? "score_desc"] ?? Je.score_desc,
|
|
2732
2732
|
selectedFacets: a?.flatMap(Me) ?? [],
|
|
2733
2733
|
sponsoredCount: o ?? void 0
|
|
2734
2734
|
};
|
|
2735
|
-
if (
|
|
2735
|
+
if (g) {
|
|
2736
2736
|
const d = (await s.clients.commerce.catalog.products.crossselling({
|
|
2737
|
-
type:
|
|
2738
|
-
productId:
|
|
2739
|
-
})).map((m) => m.productId).slice(0, n),
|
|
2737
|
+
type: pn[g.key],
|
|
2738
|
+
productId: g.value
|
|
2739
|
+
})).map((m) => m.productId).slice(0, n), p = s.clients.search.productsByIdentifier({ field: "id", values: d }).then((m) => ({
|
|
2740
2740
|
products: m,
|
|
2741
2741
|
recordsFiltered: m.length,
|
|
2742
2742
|
pagination: {
|
|
@@ -2759,7 +2759,7 @@ const ui = {
|
|
|
2759
2759
|
fuzzy: "0",
|
|
2760
2760
|
searchId: ""
|
|
2761
2761
|
}));
|
|
2762
|
-
return { searchArgs: h, productSearchPromise:
|
|
2762
|
+
return { searchArgs: h, productSearchPromise: p };
|
|
2763
2763
|
}
|
|
2764
2764
|
const f = s.clients.search.products(h);
|
|
2765
2765
|
return { searchArgs: h, productSearchPromise: f };
|
|
@@ -2834,7 +2834,7 @@ const ui = {
|
|
|
2834
2834
|
metaTagDescription: f.metaTagDescription,
|
|
2835
2835
|
availableLinkIds: null,
|
|
2836
2836
|
entityType: "brand"
|
|
2837
|
-
})), ...c].filter((f) => !!
|
|
2837
|
+
})), ...c].filter((f) => !!un.slug(f, null, r, null));
|
|
2838
2838
|
return {
|
|
2839
2839
|
pageInfo: {
|
|
2840
2840
|
hasNextPage: h.length - a > n,
|
|
@@ -2884,10 +2884,10 @@ const ui = {
|
|
|
2884
2884
|
geoCoordinates: t,
|
|
2885
2885
|
country: r,
|
|
2886
2886
|
salesChannel: i
|
|
2887
|
-
}))?.[0], { id: l, sellers:
|
|
2887
|
+
}))?.[0], { id: l, sellers: g } = c;
|
|
2888
2888
|
return {
|
|
2889
2889
|
id: l,
|
|
2890
|
-
sellers:
|
|
2890
|
+
sellers: g
|
|
2891
2891
|
};
|
|
2892
2892
|
},
|
|
2893
2893
|
profile: async (e, { id: n }, t) => {
|
|
@@ -2921,7 +2921,7 @@ const ui = {
|
|
|
2921
2921
|
let a = null;
|
|
2922
2922
|
try {
|
|
2923
2923
|
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
2924
|
-
a =
|
|
2924
|
+
a = gn(c);
|
|
2925
2925
|
} catch {
|
|
2926
2926
|
}
|
|
2927
2927
|
const s = (await r.masterData.getShopperById({
|
|
@@ -2960,7 +2960,7 @@ const ui = {
|
|
|
2960
2960
|
a = { message: i };
|
|
2961
2961
|
}
|
|
2962
2962
|
const o = a?.message || i;
|
|
2963
|
-
throw X(r) ? new $(`No order found for id ${n}. ${o}.`) :
|
|
2963
|
+
throw X(r) ? new $(`No order found for id ${n}. ${o}.`) : Zn(r) ? new J(
|
|
2964
2964
|
`You are forbidden to interact with order with id ${n}. ${o}.`
|
|
2965
2965
|
) : r;
|
|
2966
2966
|
}
|
|
@@ -2998,8 +2998,8 @@ const ui = {
|
|
|
2998
2998
|
userId: c
|
|
2999
2999
|
});
|
|
3000
3000
|
if (l) {
|
|
3001
|
-
const
|
|
3002
|
-
|
|
3001
|
+
const g = [l.firstName, l.lastName].filter(Boolean).join(" ");
|
|
3002
|
+
g && o.set(c, g);
|
|
3003
3003
|
}
|
|
3004
3004
|
} catch {
|
|
3005
3005
|
}
|
|
@@ -3036,7 +3036,7 @@ const ui = {
|
|
|
3036
3036
|
account: r,
|
|
3037
3037
|
headers: i,
|
|
3038
3038
|
clients: { commerce: a }
|
|
3039
|
-
} = t, s = Y(z(i?.cookie ?? "", r))?.userId ?? "", [c, l,
|
|
3039
|
+
} = t, s = Y(z(i?.cookie ?? "", r))?.userId ?? "", [c, l, g] = await Promise.all([
|
|
3040
3040
|
a.session("").catch(() => null),
|
|
3041
3041
|
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
3042
3042
|
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
@@ -3046,7 +3046,7 @@ const ui = {
|
|
|
3046
3046
|
name: f,
|
|
3047
3047
|
email: h?.storeUserEmail?.value ?? "",
|
|
3048
3048
|
phone: u?.phone ?? "",
|
|
3049
|
-
role:
|
|
3049
|
+
role: g?.Roles?.map((v) => v.Name) ?? [],
|
|
3050
3050
|
orgUnit: h?.unitName?.value ?? ""
|
|
3051
3051
|
};
|
|
3052
3052
|
},
|
|
@@ -3064,13 +3064,22 @@ const ui = {
|
|
|
3064
3064
|
const c = await a.session("").catch(() => null);
|
|
3065
3065
|
if (!c)
|
|
3066
3066
|
return null;
|
|
3067
|
-
const l = c.namespaces.profile ?? null,
|
|
3068
|
-
|
|
3069
|
-
|
|
3067
|
+
const l = c.namespaces.profile ?? null, g = c.namespaces.shopper ?? null, u = c.namespaces.authentication ?? null, h = Xe(c) || o?.customerId?.trim() || "";
|
|
3068
|
+
let f = null;
|
|
3069
|
+
if (h)
|
|
3070
|
+
try {
|
|
3071
|
+
f = await a.masterData.getContractById({ contractId: h });
|
|
3072
|
+
} catch (p) {
|
|
3073
|
+
console.error(
|
|
3074
|
+
`Error while getting contract data for contract ID (${h}).`,
|
|
3075
|
+
p
|
|
3076
|
+
);
|
|
3077
|
+
}
|
|
3078
|
+
const v = `${(g?.firstName?.value ?? "").trim()} ${(g?.lastName?.value ?? "").trim()}`.trim();
|
|
3070
3079
|
return {
|
|
3071
|
-
name:
|
|
3072
|
-
email: l?.email?.value || "",
|
|
3073
|
-
id: l?.id?.value || ""
|
|
3080
|
+
name: Cn(f, l) || v || "",
|
|
3081
|
+
email: l?.email?.value || u?.storeUserEmail?.value || "",
|
|
3082
|
+
id: l?.id?.value || u?.customerId?.value || o?.customerId?.trim() || ""
|
|
3074
3083
|
// createdAt: '',
|
|
3075
3084
|
};
|
|
3076
3085
|
}
|
|
@@ -3105,10 +3114,10 @@ const ui = {
|
|
|
3105
3114
|
throw new J(
|
|
3106
3115
|
"You are not allowed to list contracts for this organization unit"
|
|
3107
3116
|
);
|
|
3108
|
-
const
|
|
3117
|
+
const g = $r(
|
|
3109
3118
|
o?.namespaces.shopper
|
|
3110
|
-
), u =
|
|
3111
|
-
return zr(
|
|
3119
|
+
), u = Xe(o) || c?.customerId?.trim() || "";
|
|
3120
|
+
return zr(g, u);
|
|
3112
3121
|
},
|
|
3113
3122
|
pickupPoints: async (e, { geoCoordinates: n }, t) => {
|
|
3114
3123
|
const {
|
|
@@ -3145,12 +3154,12 @@ const ui = {
|
|
|
3145
3154
|
const { productSearchPromise: a } = e, [o, s] = await Promise.all([
|
|
3146
3155
|
r.suggestedTerms(i),
|
|
3147
3156
|
a
|
|
3148
|
-
]), c = s.products.map((
|
|
3149
|
-
const u = ce(
|
|
3150
|
-
return u && N(u,
|
|
3151
|
-
}).filter((
|
|
3157
|
+
]), c = s.products.map((g) => {
|
|
3158
|
+
const u = ce(g.items);
|
|
3159
|
+
return u && N(u, g);
|
|
3160
|
+
}).filter((g) => !!g), { searches: l } = o;
|
|
3152
3161
|
return {
|
|
3153
|
-
terms: l.map((
|
|
3162
|
+
terms: l.map((g) => ({ value: g.term, count: g.count })),
|
|
3154
3163
|
products: c
|
|
3155
3164
|
};
|
|
3156
3165
|
},
|
|
@@ -3218,7 +3227,7 @@ const ui = {
|
|
|
3218
3227
|
1: "In 1 minute",
|
|
3219
3228
|
other: "Up to # minutes"
|
|
3220
3229
|
}
|
|
3221
|
-
},
|
|
3230
|
+
}, An = (e) => {
|
|
3222
3231
|
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = Si(t);
|
|
3223
3232
|
if (!r || !i)
|
|
3224
3233
|
return "";
|
|
@@ -3227,16 +3236,16 @@ const ui = {
|
|
|
3227
3236
|
}, Ii = {
|
|
3228
3237
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
3229
3238
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
3230
|
-
localizedEstimates: (e) => e?.shippingEstimate ?
|
|
3231
|
-
},
|
|
3232
|
-
function
|
|
3233
|
-
const t = `${
|
|
3239
|
+
localizedEstimates: (e) => e?.shippingEstimate ? An(e.shippingEstimate) : ""
|
|
3240
|
+
}, Ke = "skuvariation";
|
|
3241
|
+
function Qe(e, n) {
|
|
3242
|
+
const t = `${Ke}${n}`.toLowerCase(), r = e.find(
|
|
3234
3243
|
(a) => a.imageLabel === t
|
|
3235
3244
|
);
|
|
3236
3245
|
if (r)
|
|
3237
3246
|
return r;
|
|
3238
3247
|
const i = e.find(
|
|
3239
|
-
(a) => a.imageLabel ===
|
|
3248
|
+
(a) => a.imageLabel === Ke
|
|
3240
3249
|
);
|
|
3241
3250
|
return i || e[0];
|
|
3242
3251
|
}
|
|
@@ -3252,7 +3261,7 @@ function vi(e, n, t) {
|
|
|
3252
3261
|
r[s] = `${t}-${i.itemId}`;
|
|
3253
3262
|
}), r;
|
|
3254
3263
|
}
|
|
3255
|
-
function
|
|
3264
|
+
function Ze(e) {
|
|
3256
3265
|
const n = {};
|
|
3257
3266
|
return e.forEach((t) => {
|
|
3258
3267
|
n[t.name] = t.values[0];
|
|
@@ -3288,16 +3297,16 @@ function wi(e, n, t) {
|
|
|
3288
3297
|
if (!o || i.has(c))
|
|
3289
3298
|
return;
|
|
3290
3299
|
i.add(c);
|
|
3291
|
-
const l =
|
|
3300
|
+
const l = Qe(
|
|
3292
3301
|
a.images,
|
|
3293
3302
|
n
|
|
3294
|
-
),
|
|
3303
|
+
), g = {
|
|
3295
3304
|
src: l.imageUrl,
|
|
3296
3305
|
alt: l.imageLabel ?? "",
|
|
3297
3306
|
label: `${n}: ${o.values[0]}`,
|
|
3298
3307
|
value: o.values[0]
|
|
3299
3308
|
};
|
|
3300
|
-
r[o.name] ? r[o.name].push(
|
|
3309
|
+
r[o.name] ? r[o.name].push(g) : r[o.name] = [g];
|
|
3301
3310
|
return;
|
|
3302
3311
|
}
|
|
3303
3312
|
a.variations.forEach((c) => {
|
|
@@ -3305,12 +3314,12 @@ function wi(e, n, t) {
|
|
|
3305
3314
|
if (i.has(l))
|
|
3306
3315
|
return;
|
|
3307
3316
|
i.add(l);
|
|
3308
|
-
const
|
|
3317
|
+
const g = Qe(
|
|
3309
3318
|
a.images,
|
|
3310
3319
|
c.name
|
|
3311
3320
|
), u = {
|
|
3312
|
-
src:
|
|
3313
|
-
alt:
|
|
3321
|
+
src: g.imageUrl,
|
|
3322
|
+
alt: g.imageText ?? "",
|
|
3314
3323
|
label: `${c.name}: ${c.values[0]}`,
|
|
3315
3324
|
value: c.values[0]
|
|
3316
3325
|
};
|
|
@@ -3319,7 +3328,7 @@ function wi(e, n, t) {
|
|
|
3319
3328
|
}), bi(r);
|
|
3320
3329
|
}
|
|
3321
3330
|
const Di = {
|
|
3322
|
-
activeVariations: (e) =>
|
|
3331
|
+
activeVariations: (e) => Ze(e.variations),
|
|
3323
3332
|
allVariantsByName: (e) => Oi(e.isVariantOf.skuSpecifications),
|
|
3324
3333
|
slugsMap: (e, n) => vi(
|
|
3325
3334
|
e.isVariantOf.items,
|
|
@@ -3327,7 +3336,7 @@ const Di = {
|
|
|
3327
3336
|
e.isVariantOf.linkText
|
|
3328
3337
|
),
|
|
3329
3338
|
availableVariations: (e, n) => {
|
|
3330
|
-
const t = n.dominantVariantName ?? e.variations[0]?.name, i =
|
|
3339
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = Ze(e.variations)[t];
|
|
3331
3340
|
return wi(
|
|
3332
3341
|
e.isVariantOf.items,
|
|
3333
3342
|
t,
|
|
@@ -3344,8 +3353,8 @@ const Di = {
|
|
|
3344
3353
|
}, Ai = {
|
|
3345
3354
|
deliveryOptionsData: (e) => {
|
|
3346
3355
|
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
|
|
3347
|
-
(l,
|
|
3348
|
-
const u =
|
|
3356
|
+
(l, g) => {
|
|
3357
|
+
const u = g?.selectedSla || "", h = g?.selectedDeliveryChannel || g?.deliveryChannel || "", f = g?.deliveryCompany || "", v = g?.deliveryWindow, d = g?.pickupStoreInfo, p = g?.shippingEstimate || "", m = g?.shippingEstimate ? An(g?.shippingEstimate) : "", y = g?.shippingEstimateDate || "", O = g?.addressId || "", w = g?.itemIndex ?? 0, C = t?.[w], A = C?.seller || "", S = `${u}|${h}|${f}|${A}|${p}|${y}|${O}|${v?.startDateUtc}|${v?.endDateUtc}`, D = i?.find(
|
|
3349
3358
|
(T) => T?.addressId === O
|
|
3350
3359
|
), P = `${Pi[h] || ""} ${m} ${D?.neighborhood ? `to ${D?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: k, taxPriceTags: b } = ki(
|
|
3351
3360
|
C?.priceTags ?? []
|
|
@@ -3356,7 +3365,7 @@ const Di = {
|
|
|
3356
3365
|
deliveryChannel: h,
|
|
3357
3366
|
deliveryCompany: f,
|
|
3358
3367
|
deliveryWindow: v,
|
|
3359
|
-
shippingEstimate:
|
|
3368
|
+
shippingEstimate: p,
|
|
3360
3369
|
shippingEstimateDate: y,
|
|
3361
3370
|
seller: A,
|
|
3362
3371
|
friendlyShippingEstimate: m,
|
|
@@ -3418,16 +3427,16 @@ function ki(e) {
|
|
|
3418
3427
|
};
|
|
3419
3428
|
}
|
|
3420
3429
|
const Ui = {
|
|
3421
|
-
StoreCollection:
|
|
3422
|
-
StoreAggregateOffer:
|
|
3430
|
+
StoreCollection: un,
|
|
3431
|
+
StoreAggregateOffer: nr,
|
|
3423
3432
|
StoreProduct: Zr,
|
|
3424
3433
|
StoreSeo: hi,
|
|
3425
|
-
StoreFacet:
|
|
3426
|
-
StoreFacetBoolean:
|
|
3427
|
-
StoreFacetRange:
|
|
3428
|
-
StoreFacetValueBoolean:
|
|
3434
|
+
StoreFacet: dr,
|
|
3435
|
+
StoreFacetBoolean: ur,
|
|
3436
|
+
StoreFacetRange: pr,
|
|
3437
|
+
StoreFacetValueBoolean: gr,
|
|
3429
3438
|
StoreOffer: Hr,
|
|
3430
|
-
StoreAggregateRating:
|
|
3439
|
+
StoreAggregateRating: tr,
|
|
3431
3440
|
StoreReview: pi,
|
|
3432
3441
|
StoreProductGroup: ni,
|
|
3433
3442
|
StoreSearchResult: mi,
|
|
@@ -7367,9 +7376,9 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
7367
7376
|
"./skuVariants.graphql": pa,
|
|
7368
7377
|
"./status.graphql": ga,
|
|
7369
7378
|
"./userOrder.graphql": ma
|
|
7370
|
-
}), fa =
|
|
7371
|
-
Object.values(ha).map((e) =>
|
|
7372
|
-
(e, n) =>
|
|
7379
|
+
}), fa = En(
|
|
7380
|
+
Object.values(ha).map((e) => Rn(e)).reduce(
|
|
7381
|
+
(e, n) => en([e, n], { sort: !0 })
|
|
7373
7382
|
)
|
|
7374
7383
|
), Sa = fa, Na = async (e) => L.context.with(
|
|
7375
7384
|
L.propagation.extract(L.context.active(), e.OTEL),
|
|
@@ -7378,47 +7387,47 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
7378
7387
|
flags: e.flags ?? {},
|
|
7379
7388
|
locale: e.locale,
|
|
7380
7389
|
cookies: /* @__PURE__ */ new Map()
|
|
7381
|
-
}, n.account = e.account, n.OTEL = e.OTEL, n.discoveryConfig = e.discoveryConfig, n.clients =
|
|
7390
|
+
}, n.account = e.account, n.OTEL = e.OTEL, n.discoveryConfig = e.discoveryConfig, n.clients = Vt(e, n), n.loaders = Kt(e, n), n)
|
|
7382
7391
|
);
|
|
7383
7392
|
function ya() {
|
|
7384
7393
|
const e = Ti(), n = {};
|
|
7385
7394
|
for (const [t, r] of Object.entries(e))
|
|
7386
7395
|
n[t] = Object.fromEntries(
|
|
7387
|
-
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i,
|
|
7396
|
+
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, Qn(a, `${t}(${i})`)])
|
|
7388
7397
|
);
|
|
7389
7398
|
return n;
|
|
7390
7399
|
}
|
|
7391
7400
|
function La(e) {
|
|
7392
|
-
const t =
|
|
7393
|
-
|
|
7394
|
-
|
|
7401
|
+
const t = Kn([
|
|
7402
|
+
Jn,
|
|
7403
|
+
Hn
|
|
7395
7404
|
])(ya(), Sa);
|
|
7396
|
-
return e &&
|
|
7405
|
+
return e && Fn(e) ? Tn({
|
|
7397
7406
|
schemas: [t, e]
|
|
7398
7407
|
}) : t;
|
|
7399
7408
|
}
|
|
7400
7409
|
export {
|
|
7401
|
-
|
|
7410
|
+
Hn as AuthDirective,
|
|
7402
7411
|
_ as BadRequestError,
|
|
7403
|
-
|
|
7404
|
-
|
|
7412
|
+
Jn as CacheControlDirective,
|
|
7413
|
+
$n as CommercialAuthorizationStatus,
|
|
7405
7414
|
ee as FastStoreError,
|
|
7406
7415
|
J as ForbiddenError,
|
|
7407
7416
|
Na as GraphqlVtexContextFactory,
|
|
7408
7417
|
La as GraphqlVtexSchema,
|
|
7409
7418
|
$ as NotFoundError,
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7419
|
+
Mn as StoreCollectionType,
|
|
7420
|
+
zn as StoreFacetType,
|
|
7421
|
+
Vn as StoreSort,
|
|
7422
|
+
xn as StoreStatus,
|
|
7414
7423
|
te as UnauthorizedError,
|
|
7415
|
-
|
|
7424
|
+
qn as UserOrderInvoiceType,
|
|
7416
7425
|
Ra as isBadRequestError,
|
|
7417
7426
|
Ea as isFastStoreError,
|
|
7418
|
-
|
|
7427
|
+
Zn as isForbiddenError,
|
|
7419
7428
|
X as isNotFoundError,
|
|
7420
7429
|
Fa as isUnauthorizedError,
|
|
7421
7430
|
_a as stringifyCacheControl,
|
|
7422
7431
|
Sa as typeDefs,
|
|
7423
|
-
|
|
7432
|
+
Kn as withDirectives
|
|
7424
7433
|
};
|