@faststore/api 4.4.0 → 4.5.0-dev.0
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 +153 -41
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +913 -682
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/__generated__/schema.d.ts +50 -0
- package/dist/src/__generated__/schema.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts +4 -0
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/types/Quote.d.ts +26 -0
- package/dist/src/platforms/vtex/clients/commerce/types/Quote.d.ts.map +1 -0
- package/dist/src/platforms/vtex/clients/index.d.ts +3 -0
- package/dist/src/platforms/vtex/clients/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/index.d.ts +26 -0
- package/dist/src/platforms/vtex/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/getOrderEntryOperation.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/index.d.ts +26 -0
- package/dist/src/platforms/vtex/resolvers/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts +26 -0
- package/dist/src/platforms/vtex/resolvers/query.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/__generated__/schema.ts +55 -0
- package/src/platforms/vtex/clients/commerce/index.ts +100 -0
- package/src/platforms/vtex/clients/commerce/types/Quote.ts +27 -0
- package/src/platforms/vtex/resolvers/query.ts +77 -0
- package/src/platforms/vtex/typeDefs/query.graphql +47 -0
- package/src/platforms/vtex/typeDefs/quote.graphql +65 -0
package/dist/es/index.mjs
CHANGED
|
@@ -9,8 +9,8 @@ import ye from "p-limit";
|
|
|
9
9
|
import te from "dataloader";
|
|
10
10
|
import An from "sanitize-html";
|
|
11
11
|
import Ie from "fast-deep-equal";
|
|
12
|
-
import
|
|
13
|
-
var
|
|
12
|
+
import Un from "node:crypto";
|
|
13
|
+
var En = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(En || {}), Tn = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(Tn || {}), _n = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(_n || {}), kn = /* @__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))(kn || {}), Fn = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(Fn || {}), Rn = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(Rn || {});
|
|
14
14
|
const Nn = () => function(n = {}) {
|
|
15
15
|
const t = process.env.FS_DISCOVERY_APP_KEY ?? "", r = process.env.FS_DISCOVERY_APP_TOKEN ?? "";
|
|
16
16
|
if (!t || !r)
|
|
@@ -20,7 +20,7 @@ const Nn = () => function(n = {}) {
|
|
|
20
20
|
"X-VTEX-API-AppKey": t,
|
|
21
21
|
"X-VTEX-API-AppToken": r
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, Bn = async (e) => {
|
|
24
24
|
const {
|
|
25
25
|
clients: { commerce: n }
|
|
26
26
|
} = e;
|
|
@@ -31,44 +31,44 @@ const Nn = () => function(n = {}) {
|
|
|
31
31
|
const r = t.extensions?.status ?? t.status;
|
|
32
32
|
throw r === 401 ? new J("Authentication required") : r === 403 ? new re("You are not allowed to access this resource") : new J("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, Ln = "auth", Mn = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
36
|
transformer: (e) => je(e, {
|
|
37
37
|
[We.OBJECT_FIELD]: (n) => {
|
|
38
|
-
if (Ge(e, n,
|
|
38
|
+
if (Ge(e, n, Ln)?.[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 Bn(o), r?.(i, a, o, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
}, $n = "cacheControl",
|
|
45
|
+
}, $n = "cacheControl", ca = (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
|
-
}, Oe = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, zn = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n,
|
|
52
|
+
}, Oe = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, zn = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, xn = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
54
|
transformer: (e) => je(e, {
|
|
55
55
|
[We.OBJECT_FIELD]: (n) => {
|
|
56
56
|
const t = Ge(e, n, $n)?.[0];
|
|
57
57
|
if (t) {
|
|
58
58
|
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
|
|
59
|
-
n.resolve = (s,
|
|
59
|
+
n.resolve = (s, c, d, g) => (d.cacheControl = {
|
|
60
60
|
sMaxAge: Oe(d.cacheControl?.sMaxAge, r),
|
|
61
61
|
staleWhileRevalidate: Oe(
|
|
62
62
|
d.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
65
|
scope: zn(d.cacheControl?.scope, a)
|
|
66
|
-
}, o?.(s,
|
|
66
|
+
}, o?.(s, c, d, g));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
71
|
+
}, Vn = (e) => (n, t) => {
|
|
72
72
|
const r = qe([
|
|
73
73
|
...(e ?? []).map(({ typeDefs: i }) => i),
|
|
74
74
|
t
|
|
@@ -80,7 +80,7 @@ const Nn = () => function(n = {}) {
|
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
}, oe = "@faststore/api", se = "4.4.
|
|
83
|
+
}, oe = "@faststore/api", se = "4.4.1-dev.0", Ce = {
|
|
84
84
|
name: oe,
|
|
85
85
|
version: se
|
|
86
86
|
}, qn = (e, n) => (t, r, i, a) => {
|
|
@@ -91,7 +91,7 @@ const Nn = () => function(n = {}) {
|
|
|
91
91
|
i.OTEL
|
|
92
92
|
);
|
|
93
93
|
return N.context.with(s, () => {
|
|
94
|
-
const
|
|
94
|
+
const c = o.startSpan(n ?? "Unknown Graphql Resolver", {
|
|
95
95
|
startTime: Date.now(),
|
|
96
96
|
kind: N.SpanKind.INTERNAL,
|
|
97
97
|
attributes: {
|
|
@@ -102,12 +102,12 @@ const Nn = () => function(n = {}) {
|
|
|
102
102
|
"@faststore_environment": process.env.NODE_ENV
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
|
-
if (!
|
|
105
|
+
if (!c) return e(t, r, i, a);
|
|
106
106
|
try {
|
|
107
107
|
const d = e(t, r, i, a);
|
|
108
|
-
return d instanceof Promise ? d.then((g) => (
|
|
108
|
+
return d instanceof Promise ? d.then((g) => (c.end(), g)) : (c.end(), d);
|
|
109
109
|
} catch (d) {
|
|
110
|
-
throw
|
|
110
|
+
throw c.end(), console.error(`Error when executing resolver: ${n}`, d), d;
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
};
|
|
@@ -116,7 +116,7 @@ class X extends Error {
|
|
|
116
116
|
super(t), this.extensions = n, this.name = "FastStoreError";
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
class
|
|
119
|
+
class E extends X {
|
|
120
120
|
constructor(n) {
|
|
121
121
|
super({ status: 400, type: "BadRequestError" }, n);
|
|
122
122
|
}
|
|
@@ -131,12 +131,12 @@ class re extends X {
|
|
|
131
131
|
super({ status: 403, type: "ForbiddenError" }, n);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
class
|
|
134
|
+
class L extends X {
|
|
135
135
|
constructor(n) {
|
|
136
136
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const la = (e) => e?.name === "FastStoreError", da = (e) => e?.extensions?.type === "BadRequestError", ua = (e) => e?.extensions?.type === "UnauthorizedError", jn = (e) => e?.extensions?.type === "ForbiddenError", He = (e) => e?.extensions?.type === "NotFoundError", Wn = `${Ce.name}@${Ce.version}`, S = async (e, n, t) => {
|
|
140
140
|
const r = await Pn(e, {
|
|
141
141
|
...n,
|
|
142
142
|
headers: {
|
|
@@ -151,13 +151,13 @@ const ia = (e) => e?.name === "FastStoreError", aa = (e) => e?.extensions?.type
|
|
|
151
151
|
if (typeof r?.status == "number")
|
|
152
152
|
switch (r.status) {
|
|
153
153
|
case 400:
|
|
154
|
-
throw new
|
|
154
|
+
throw new E(i);
|
|
155
155
|
case 401:
|
|
156
156
|
throw new J(i);
|
|
157
157
|
case 403:
|
|
158
158
|
throw new re(i);
|
|
159
159
|
case 404:
|
|
160
|
-
throw new
|
|
160
|
+
throw new L(i);
|
|
161
161
|
default:
|
|
162
162
|
throw new X(
|
|
163
163
|
{ status: r.status, type: "UnknownError" },
|
|
@@ -174,8 +174,8 @@ const ia = (e) => e?.name === "FastStoreError", aa = (e) => e?.extensions?.type
|
|
|
174
174
|
if (a) {
|
|
175
175
|
const o = a.indexOf("=");
|
|
176
176
|
if (o > 0) {
|
|
177
|
-
const s = a.substring(0, o),
|
|
178
|
-
n.has(s) || r.push(s), n.set(s,
|
|
177
|
+
const s = a.substring(0, o), c = a.substring(o + 1);
|
|
178
|
+
n.has(s) || r.push(s), n.set(s, c);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
@@ -210,7 +210,7 @@ const ia = (e) => e?.name === "FastStoreError", aa = (e) => e?.extensions?.type
|
|
|
210
210
|
...t,
|
|
211
211
|
cookie: r
|
|
212
212
|
} : t;
|
|
213
|
-
},
|
|
213
|
+
}, K = (e, n) => {
|
|
214
214
|
const t = Xe(e);
|
|
215
215
|
return H(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
216
216
|
}, Jn = (e, n, t) => {
|
|
@@ -228,46 +228,105 @@ const j = {
|
|
|
228
228
|
headers: {
|
|
229
229
|
"content-type": "application/json"
|
|
230
230
|
}
|
|
231
|
-
},
|
|
232
|
-
|
|
231
|
+
}, Qn = /^\d{4}-\d{2}-\d{2}$/, Kn = /* @__PURE__ */ new Set([
|
|
232
|
+
"Draft",
|
|
233
|
+
"Requested",
|
|
234
|
+
"InReview",
|
|
235
|
+
"Reviewed",
|
|
236
|
+
"Approved",
|
|
237
|
+
"Declined",
|
|
238
|
+
"Expired",
|
|
239
|
+
"ConvertedToCart",
|
|
240
|
+
"ConvertedToOrder"
|
|
241
|
+
]);
|
|
242
|
+
function Zn({
|
|
243
|
+
page: e,
|
|
244
|
+
perPage: n,
|
|
245
|
+
status: t,
|
|
246
|
+
createdAtFrom: r,
|
|
247
|
+
createdAtTo: i,
|
|
248
|
+
expiresAtFrom: a,
|
|
249
|
+
expiresAtTo: o
|
|
250
|
+
}) {
|
|
251
|
+
if (e !== void 0 && (!Number.isInteger(e) || e < 1))
|
|
252
|
+
throw new Error(
|
|
253
|
+
`listUserQuotes: invalid page "${e}" — must be a positive integer`
|
|
254
|
+
);
|
|
255
|
+
if (n !== void 0 && (!Number.isInteger(n) || n < 1))
|
|
256
|
+
throw new Error(
|
|
257
|
+
`listUserQuotes: invalid perPage "${n}" — must be a positive integer`
|
|
258
|
+
);
|
|
259
|
+
for (const [s, c] of [
|
|
260
|
+
["createdAtFrom", r],
|
|
261
|
+
["createdAtTo", i],
|
|
262
|
+
["expiresAtFrom", a],
|
|
263
|
+
["expiresAtTo", o]
|
|
264
|
+
])
|
|
265
|
+
if (c && !Qn.test(c))
|
|
266
|
+
throw new Error(
|
|
267
|
+
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
268
|
+
);
|
|
269
|
+
if (t && t.length > 0) {
|
|
270
|
+
const s = t.filter((c) => !Kn.has(c));
|
|
271
|
+
if (s.length > 0)
|
|
272
|
+
throw new Error(
|
|
273
|
+
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
function et({
|
|
278
|
+
page: e,
|
|
279
|
+
perPage: n,
|
|
280
|
+
status: t,
|
|
281
|
+
createdAtFrom: r,
|
|
282
|
+
createdAtTo: i,
|
|
283
|
+
expiresAtFrom: a,
|
|
284
|
+
expiresAtTo: o,
|
|
285
|
+
label: s
|
|
286
|
+
}) {
|
|
287
|
+
const c = new URLSearchParams();
|
|
288
|
+
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((d) => c.append("status", d)), 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;
|
|
289
|
+
}
|
|
290
|
+
const nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
291
|
+
const a = `https://${e}.${n}.com.br`, o = Yn(i), s = Je(i), c = Nn(), d = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", g = r && r.map((l) => l + ".").find((l) => d.includes(l)) || "", p = d.replace(g, "");
|
|
233
292
|
return {
|
|
234
293
|
catalog: {
|
|
235
|
-
salesChannel: (
|
|
236
|
-
`${a}/api/catalog_system/pub/saleschannel/${
|
|
294
|
+
salesChannel: (l) => S(
|
|
295
|
+
`${a}/api/catalog_system/pub/saleschannel/${l}`,
|
|
237
296
|
void 0,
|
|
238
297
|
{ storeCookies: o }
|
|
239
298
|
),
|
|
240
299
|
brand: {
|
|
241
|
-
list: () =>
|
|
300
|
+
list: () => S(`${a}/api/catalog_system/pub/brand/list`, void 0, {
|
|
242
301
|
storeCookies: o
|
|
243
302
|
})
|
|
244
303
|
},
|
|
245
304
|
category: {
|
|
246
|
-
tree: (
|
|
247
|
-
`${a}/api/catalog_system/pub/category/tree/${
|
|
305
|
+
tree: (l = 3) => S(
|
|
306
|
+
`${a}/api/catalog_system/pub/category/tree/${l}`,
|
|
248
307
|
void 0,
|
|
249
308
|
{ storeCookies: o }
|
|
250
309
|
)
|
|
251
310
|
},
|
|
252
311
|
portal: {
|
|
253
|
-
pagetype: (
|
|
254
|
-
`${a}/api/catalog_system/pub/portal/pagetype/${
|
|
312
|
+
pagetype: (l) => S(
|
|
313
|
+
`${a}/api/catalog_system/pub/portal/pagetype/${l}`,
|
|
255
314
|
void 0,
|
|
256
315
|
{ storeCookies: o }
|
|
257
316
|
)
|
|
258
317
|
},
|
|
259
318
|
products: {
|
|
260
319
|
crossselling: ({
|
|
261
|
-
type:
|
|
320
|
+
type: l,
|
|
262
321
|
productId: u,
|
|
263
322
|
groupByProduct: m = !0
|
|
264
323
|
}) => {
|
|
265
|
-
const
|
|
324
|
+
const y = new URLSearchParams({
|
|
266
325
|
sc: i.storage.channel.salesChannel,
|
|
267
326
|
groupByProduct: m.toString()
|
|
268
327
|
});
|
|
269
|
-
return
|
|
270
|
-
`${a}/api/catalog_system/pub/products/crossselling/${
|
|
328
|
+
return S(
|
|
329
|
+
`${a}/api/catalog_system/pub/products/crossselling/${l}/${u}?${y}`,
|
|
271
330
|
void 0,
|
|
272
331
|
{ storeCookies: o }
|
|
273
332
|
);
|
|
@@ -275,28 +334,28 @@ const j = {
|
|
|
275
334
|
}
|
|
276
335
|
},
|
|
277
336
|
checkout: {
|
|
278
|
-
simulation: (
|
|
337
|
+
simulation: (l, { salesChannel: u } = i.storage.channel) => {
|
|
279
338
|
const m = new URLSearchParams({
|
|
280
339
|
sc: u
|
|
281
|
-
}),
|
|
340
|
+
}), y = s({
|
|
282
341
|
"content-type": "application/json",
|
|
283
342
|
"X-FORWARDED-HOST": p
|
|
284
343
|
});
|
|
285
|
-
return
|
|
344
|
+
return S(
|
|
286
345
|
`${a}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
287
346
|
{
|
|
288
347
|
...j,
|
|
289
|
-
headers:
|
|
290
|
-
body: JSON.stringify(
|
|
348
|
+
headers: y,
|
|
349
|
+
body: JSON.stringify(l)
|
|
291
350
|
},
|
|
292
351
|
{ storeCookies: o }
|
|
293
352
|
);
|
|
294
353
|
},
|
|
295
354
|
shippingData: ({
|
|
296
|
-
id:
|
|
355
|
+
id: l,
|
|
297
356
|
index: u,
|
|
298
357
|
deliveryMode: m,
|
|
299
|
-
selectedAddresses:
|
|
358
|
+
selectedAddresses: y
|
|
300
359
|
}, f) => {
|
|
301
360
|
const I = f ? {
|
|
302
361
|
startDateUtc: m?.deliveryWindow?.startDate,
|
|
@@ -308,32 +367,32 @@ const j = {
|
|
|
308
367
|
selectedSla: m?.deliveryMethod || null,
|
|
309
368
|
deliveryWindow: I
|
|
310
369
|
})),
|
|
311
|
-
selectedAddresses:
|
|
370
|
+
selectedAddresses: y,
|
|
312
371
|
clearAddressIfPostalCodeNotFound: t
|
|
313
|
-
},
|
|
372
|
+
}, U = s({
|
|
314
373
|
"content-type": "application/json",
|
|
315
374
|
"X-FORWARDED-HOST": p
|
|
316
375
|
});
|
|
317
|
-
return
|
|
318
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
376
|
+
return S(
|
|
377
|
+
`${a}/api/checkout/pub/orderForm/${l}/attachments/shippingData`,
|
|
319
378
|
{
|
|
320
379
|
...j,
|
|
321
|
-
headers:
|
|
380
|
+
headers: U,
|
|
322
381
|
body: JSON.stringify(D)
|
|
323
382
|
},
|
|
324
383
|
{ storeCookies: o }
|
|
325
384
|
);
|
|
326
385
|
},
|
|
327
386
|
marketingData: ({
|
|
328
|
-
id:
|
|
387
|
+
id: l,
|
|
329
388
|
marketingData: u
|
|
330
389
|
}) => {
|
|
331
390
|
const m = s({
|
|
332
391
|
"content-type": "application/json",
|
|
333
392
|
"X-FORWARDED-HOST": p
|
|
334
393
|
});
|
|
335
|
-
return
|
|
336
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
394
|
+
return S(
|
|
395
|
+
`${a}/api/checkout/pub/orderForm/${l}/attachments/marketingData`,
|
|
337
396
|
{
|
|
338
397
|
headers: m,
|
|
339
398
|
body: JSON.stringify(u),
|
|
@@ -343,15 +402,15 @@ const j = {
|
|
|
343
402
|
);
|
|
344
403
|
},
|
|
345
404
|
clientPreferencesData: ({
|
|
346
|
-
id:
|
|
405
|
+
id: l,
|
|
347
406
|
clientPreferencesData: u
|
|
348
407
|
}) => {
|
|
349
408
|
const m = s({
|
|
350
409
|
"content-type": "application/json",
|
|
351
410
|
"X-FORWARDED-HOST": p
|
|
352
411
|
});
|
|
353
|
-
return
|
|
354
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
412
|
+
return S(
|
|
413
|
+
`${a}/api/checkout/pub/orderForm/${l}/attachments/clientPreferencesData`,
|
|
355
414
|
{
|
|
356
415
|
headers: m,
|
|
357
416
|
body: JSON.stringify(u),
|
|
@@ -361,33 +420,33 @@ const j = {
|
|
|
361
420
|
);
|
|
362
421
|
},
|
|
363
422
|
orderForm: ({
|
|
364
|
-
id:
|
|
423
|
+
id: l,
|
|
365
424
|
refreshOutdatedData: u = !0,
|
|
366
425
|
channel: m = i.storage.channel
|
|
367
426
|
}) => {
|
|
368
|
-
const { salesChannel:
|
|
427
|
+
const { salesChannel: y } = m, f = s({
|
|
369
428
|
"content-type": "application/json",
|
|
370
429
|
"X-FORWARDED-HOST": p
|
|
371
|
-
}), I = new URLSearchParams({ sc:
|
|
372
|
-
|
|
373
|
-
const D = `${a}/api/checkout/pub/orderForm${
|
|
374
|
-
return
|
|
430
|
+
}), I = new URLSearchParams({ sc: y });
|
|
431
|
+
l && I.set("refreshOutdatedData", u.toString());
|
|
432
|
+
const D = `${a}/api/checkout/pub/orderForm${l ? `/${l}` : ""}?${I.toString()}`;
|
|
433
|
+
return S(
|
|
375
434
|
D,
|
|
376
435
|
{
|
|
377
436
|
...j,
|
|
378
437
|
headers: f,
|
|
379
|
-
...
|
|
438
|
+
...l ? {} : { body: "{}" }
|
|
380
439
|
},
|
|
381
440
|
{ storeCookies: o }
|
|
382
441
|
);
|
|
383
442
|
},
|
|
384
|
-
clearOrderFormMessages: ({ id:
|
|
443
|
+
clearOrderFormMessages: ({ id: l }) => {
|
|
385
444
|
const u = s({
|
|
386
445
|
"content-type": "application/json",
|
|
387
446
|
"X-FORWARDED-HOST": p
|
|
388
447
|
});
|
|
389
|
-
return
|
|
390
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
448
|
+
return S(
|
|
449
|
+
`${a}/api/checkout/pub/orderForm/${l}/messages/clear`,
|
|
391
450
|
{
|
|
392
451
|
...j,
|
|
393
452
|
headers: u,
|
|
@@ -396,21 +455,21 @@ const j = {
|
|
|
396
455
|
);
|
|
397
456
|
},
|
|
398
457
|
updateOrderFormItems: ({
|
|
399
|
-
id:
|
|
458
|
+
id: l,
|
|
400
459
|
orderItems: u,
|
|
401
460
|
allowOutdatedData: m = "paymentData",
|
|
402
|
-
salesChannel:
|
|
461
|
+
salesChannel: y = i.storage.channel.salesChannel,
|
|
403
462
|
shouldSplitItem: f = !0
|
|
404
463
|
}) => {
|
|
405
464
|
const I = new URLSearchParams({
|
|
406
465
|
allowOutdatedData: m,
|
|
407
|
-
sc:
|
|
466
|
+
sc: y
|
|
408
467
|
}), D = s({
|
|
409
468
|
"content-type": "application/json",
|
|
410
469
|
"X-FORWARDED-HOST": p
|
|
411
470
|
});
|
|
412
|
-
return
|
|
413
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
471
|
+
return S(
|
|
472
|
+
`${a}/api/checkout/pub/orderForm/${l}/items?${I}`,
|
|
414
473
|
{
|
|
415
474
|
headers: D,
|
|
416
475
|
body: JSON.stringify({
|
|
@@ -423,35 +482,35 @@ const j = {
|
|
|
423
482
|
);
|
|
424
483
|
},
|
|
425
484
|
setCustomData: ({
|
|
426
|
-
id:
|
|
485
|
+
id: l,
|
|
427
486
|
appId: u,
|
|
428
487
|
key: m,
|
|
429
|
-
value:
|
|
488
|
+
value: y
|
|
430
489
|
}) => {
|
|
431
490
|
const f = s({
|
|
432
491
|
"content-type": "application/json",
|
|
433
492
|
"X-FORWARDED-HOST": p
|
|
434
493
|
});
|
|
435
|
-
return
|
|
436
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
494
|
+
return S(
|
|
495
|
+
`${a}/api/checkout/pub/orderForm/${l}/customData/${u}/${m}`,
|
|
437
496
|
{
|
|
438
497
|
headers: f,
|
|
439
|
-
body: JSON.stringify({ value:
|
|
498
|
+
body: JSON.stringify({ value: y }),
|
|
440
499
|
method: "PUT"
|
|
441
500
|
}
|
|
442
501
|
);
|
|
443
502
|
},
|
|
444
503
|
region: async ({
|
|
445
|
-
postalCode:
|
|
504
|
+
postalCode: l,
|
|
446
505
|
geoCoordinates: u,
|
|
447
506
|
country: m,
|
|
448
|
-
salesChannel:
|
|
507
|
+
salesChannel: y
|
|
449
508
|
}) => {
|
|
450
509
|
const f = new URLSearchParams({
|
|
451
510
|
country: m,
|
|
452
|
-
sc:
|
|
511
|
+
sc: y ?? ""
|
|
453
512
|
});
|
|
454
|
-
|
|
513
|
+
l ? f.append("postalCode", l) : f.append(
|
|
455
514
|
"geoCoordinates",
|
|
456
515
|
`${u?.longitude};${u?.latitude}`
|
|
457
516
|
);
|
|
@@ -459,7 +518,7 @@ const j = {
|
|
|
459
518
|
"content-type": "application/json",
|
|
460
519
|
"X-FORWARDED-HOST": p
|
|
461
520
|
});
|
|
462
|
-
return
|
|
521
|
+
return S(
|
|
463
522
|
I,
|
|
464
523
|
{
|
|
465
524
|
headers: D
|
|
@@ -468,15 +527,15 @@ const j = {
|
|
|
468
527
|
);
|
|
469
528
|
},
|
|
470
529
|
address: async ({
|
|
471
|
-
postalCode:
|
|
530
|
+
postalCode: l,
|
|
472
531
|
country: u
|
|
473
532
|
}) => {
|
|
474
533
|
const m = s({
|
|
475
534
|
"content-type": "application/json",
|
|
476
535
|
"X-FORWARDED-HOST": p
|
|
477
536
|
});
|
|
478
|
-
return
|
|
479
|
-
`${a}/api/checkout/pub/postal-code/${u}/${
|
|
537
|
+
return S(
|
|
538
|
+
`${a}/api/checkout/pub/postal-code/${u}/${l}`,
|
|
480
539
|
{
|
|
481
540
|
headers: m
|
|
482
541
|
},
|
|
@@ -484,19 +543,19 @@ const j = {
|
|
|
484
543
|
);
|
|
485
544
|
},
|
|
486
545
|
cancelOrder: ({
|
|
487
|
-
orderId:
|
|
546
|
+
orderId: l,
|
|
488
547
|
customerEmail: u,
|
|
489
548
|
reason: m
|
|
490
549
|
}) => {
|
|
491
|
-
const
|
|
550
|
+
const y = s({
|
|
492
551
|
"content-type": "application/json",
|
|
493
552
|
"X-FORWARDED-HOST": p
|
|
494
553
|
});
|
|
495
|
-
return
|
|
496
|
-
`${a}/api/checkout/pub/orders/${
|
|
554
|
+
return S(
|
|
555
|
+
`${a}/api/checkout/pub/orders/${l}/user-cancel-request`,
|
|
497
556
|
{
|
|
498
557
|
method: "POST",
|
|
499
|
-
headers:
|
|
558
|
+
headers: y,
|
|
500
559
|
body: JSON.stringify({
|
|
501
560
|
customerEmail: u,
|
|
502
561
|
reason: m
|
|
@@ -506,9 +565,9 @@ const j = {
|
|
|
506
565
|
);
|
|
507
566
|
},
|
|
508
567
|
pickupPoints: ({
|
|
509
|
-
geoCoordinates:
|
|
568
|
+
geoCoordinates: l
|
|
510
569
|
}) => {
|
|
511
|
-
if (!
|
|
570
|
+
if (!l)
|
|
512
571
|
throw new Error(
|
|
513
572
|
"Missing required parameter for listing pickup points."
|
|
514
573
|
);
|
|
@@ -516,66 +575,66 @@ const j = {
|
|
|
516
575
|
"content-type": "application/json",
|
|
517
576
|
"X-FORWARDED-HOST": p
|
|
518
577
|
});
|
|
519
|
-
return
|
|
578
|
+
return S(
|
|
520
579
|
`${a}/api/logistics-shipping/pickuppoints/_search`,
|
|
521
580
|
{
|
|
522
581
|
method: "POST",
|
|
523
582
|
headers: u,
|
|
524
|
-
body: JSON.stringify({ coordinate:
|
|
583
|
+
body: JSON.stringify({ coordinate: l })
|
|
525
584
|
},
|
|
526
585
|
{ storeCookies: o }
|
|
527
586
|
);
|
|
528
587
|
}
|
|
529
588
|
},
|
|
530
|
-
session: (
|
|
531
|
-
const u = new URLSearchParams(
|
|
589
|
+
session: (l) => {
|
|
590
|
+
const u = new URLSearchParams(l);
|
|
532
591
|
u.set(
|
|
533
592
|
"items",
|
|
534
593
|
"profile.id,profile.email,profile.firstName,profile.lastName,profile.phone,shopper.firstName,shopper.lastName,shopper.organizationManager,store.channel,store.countryCode,store.cultureInfo,store.currencyCode,store.currencySymbol,authentication.customerId,authentication.storeUserId,authentication.storeUserEmail,authentication.unitId,authentication.unitName,checkout.regionId,public.postalCode"
|
|
535
594
|
);
|
|
536
595
|
const m = s({
|
|
537
596
|
"content-type": "application/json"
|
|
538
|
-
}),
|
|
539
|
-
return
|
|
597
|
+
}), y = H(i?.headers?.cookie ?? "")?.vtex_session;
|
|
598
|
+
return S(
|
|
540
599
|
`${a}/api/sessions?${u.toString()}`,
|
|
541
600
|
{
|
|
542
|
-
method:
|
|
601
|
+
method: y ? "PATCH" : "POST",
|
|
543
602
|
headers: m,
|
|
544
603
|
body: "{}"
|
|
545
604
|
},
|
|
546
605
|
{ storeCookies: o }
|
|
547
606
|
);
|
|
548
607
|
},
|
|
549
|
-
subscribeToNewsletter: (
|
|
608
|
+
subscribeToNewsletter: (l) => S(
|
|
550
609
|
`${a}/api/dataentities/NL/documents/`,
|
|
551
610
|
{
|
|
552
611
|
...j,
|
|
553
|
-
body: JSON.stringify({ ...
|
|
612
|
+
body: JSON.stringify({ ...l, isNewsletterOptIn: !0 }),
|
|
554
613
|
method: "PATCH"
|
|
555
614
|
},
|
|
556
615
|
{ storeCookies: o }
|
|
557
616
|
),
|
|
558
617
|
profile: {
|
|
559
|
-
addresses: async (
|
|
618
|
+
addresses: async (l) => {
|
|
560
619
|
const u = s({
|
|
561
620
|
"content-type": "application/json",
|
|
562
621
|
"X-FORWARDED-HOST": p
|
|
563
622
|
});
|
|
564
|
-
return
|
|
565
|
-
`${a}/api/profile-system/pvt/profiles/${
|
|
623
|
+
return S(
|
|
624
|
+
`${a}/api/profile-system/pvt/profiles/${l}/addresses`,
|
|
566
625
|
{ headers: u },
|
|
567
626
|
{ storeCookies: o }
|
|
568
627
|
);
|
|
569
628
|
}
|
|
570
629
|
},
|
|
571
630
|
oms: {
|
|
572
|
-
userOrder: ({ orderId:
|
|
631
|
+
userOrder: ({ orderId: l }) => {
|
|
573
632
|
const u = s({
|
|
574
633
|
"content-type": "application/json",
|
|
575
634
|
"X-FORWARDED-HOST": p
|
|
576
635
|
});
|
|
577
|
-
return
|
|
578
|
-
`${a}/api/oms/user/orders/${
|
|
636
|
+
return S(
|
|
637
|
+
`${a}/api/oms/user/orders/${l}`,
|
|
579
638
|
{
|
|
580
639
|
method: "GET",
|
|
581
640
|
headers: u
|
|
@@ -584,14 +643,14 @@ const j = {
|
|
|
584
643
|
);
|
|
585
644
|
},
|
|
586
645
|
listUserOrders: ({
|
|
587
|
-
page:
|
|
646
|
+
page: l,
|
|
588
647
|
status: u,
|
|
589
648
|
dateInitial: m,
|
|
590
|
-
dateFinal:
|
|
649
|
+
dateFinal: y,
|
|
591
650
|
text: f,
|
|
592
651
|
clientEmail: I,
|
|
593
652
|
perPage: D,
|
|
594
|
-
pendingMyApproval:
|
|
653
|
+
pendingMyApproval: U
|
|
595
654
|
}) => {
|
|
596
655
|
const w = new URLSearchParams();
|
|
597
656
|
if (m) {
|
|
@@ -603,24 +662,24 @@ const j = {
|
|
|
603
662
|
);
|
|
604
663
|
m = new Date(P).toISOString();
|
|
605
664
|
}
|
|
606
|
-
if (
|
|
607
|
-
const P = new Date(
|
|
665
|
+
if (y) {
|
|
666
|
+
const P = new Date(y).setHours(
|
|
608
667
|
23,
|
|
609
668
|
59,
|
|
610
669
|
59,
|
|
611
670
|
999
|
|
612
671
|
);
|
|
613
|
-
|
|
672
|
+
y = new Date(P).toISOString();
|
|
614
673
|
}
|
|
615
|
-
f && w.append("text", f), u && u.length > 0 && w.append("status", u.filter(Boolean).join(",")), m &&
|
|
674
|
+
f && w.append("text", f), u && u.length > 0 && w.append("status", u.filter(Boolean).join(",")), m && y ? w.append(
|
|
616
675
|
"creation_date",
|
|
617
|
-
`creationDate:[${m} TO ${
|
|
618
|
-
) : m ? w.append("creation_date", `creationDate:[${m} TO *]`) :
|
|
676
|
+
`creationDate:[${m} TO ${y}]`
|
|
677
|
+
) : m ? w.append("creation_date", `creationDate:[${m} TO *]`) : y && w.append("creation_date", `creationDate:[* TO ${y}]`), I && w.append("clientEmail", I), l && w.append("page", l.toString()), D && w.append("per_page", D.toString()), U && w.append("my_pending_approvals", String(!0));
|
|
619
678
|
const O = s({
|
|
620
679
|
"content-type": "application/json",
|
|
621
680
|
"X-FORWARDED-HOST": p
|
|
622
681
|
});
|
|
623
|
-
return
|
|
682
|
+
return S(
|
|
624
683
|
`${a}/api/oms/user/orders?${w.toString()}`,
|
|
625
684
|
{
|
|
626
685
|
method: "GET",
|
|
@@ -630,14 +689,14 @@ const j = {
|
|
|
630
689
|
);
|
|
631
690
|
},
|
|
632
691
|
getCommercialAuthorizationsByOrderId: ({
|
|
633
|
-
orderId:
|
|
692
|
+
orderId: l
|
|
634
693
|
}) => {
|
|
635
694
|
const u = s({
|
|
636
695
|
"content-type": "application/json",
|
|
637
696
|
"X-FORWARDED-HOST": p
|
|
638
697
|
});
|
|
639
|
-
return
|
|
640
|
-
`${a}/${e}/commercial-authorizations/order/${
|
|
698
|
+
return S(
|
|
699
|
+
`${a}/${e}/commercial-authorizations/order/${l}`,
|
|
641
700
|
{
|
|
642
701
|
method: "GET",
|
|
643
702
|
headers: u
|
|
@@ -646,27 +705,27 @@ const j = {
|
|
|
646
705
|
);
|
|
647
706
|
},
|
|
648
707
|
processOrderAuthorization: async ({
|
|
649
|
-
orderAuthorizationId:
|
|
708
|
+
orderAuthorizationId: l,
|
|
650
709
|
dimensionId: u,
|
|
651
710
|
ruleId: m,
|
|
652
|
-
approved:
|
|
711
|
+
approved: y
|
|
653
712
|
}) => {
|
|
654
713
|
const f = s({
|
|
655
714
|
"content-type": "application/json",
|
|
656
715
|
"X-FORWARDED-HOST": p
|
|
657
|
-
}),
|
|
716
|
+
}), U = {
|
|
658
717
|
params: {
|
|
659
718
|
ruleId: m,
|
|
660
719
|
dimensionId: u,
|
|
661
|
-
score:
|
|
720
|
+
score: y ? 100 : 0
|
|
662
721
|
}
|
|
663
722
|
};
|
|
664
|
-
return
|
|
665
|
-
`${a}/${e}/commercial-authorizations/${
|
|
723
|
+
return S(
|
|
724
|
+
`${a}/${e}/commercial-authorizations/${l}/callback`,
|
|
666
725
|
{
|
|
667
726
|
method: "POST",
|
|
668
727
|
headers: f,
|
|
669
|
-
body: JSON.stringify(
|
|
728
|
+
body: JSON.stringify(U)
|
|
670
729
|
},
|
|
671
730
|
{ storeCookies: o }
|
|
672
731
|
);
|
|
@@ -674,14 +733,14 @@ const j = {
|
|
|
674
733
|
},
|
|
675
734
|
units: {
|
|
676
735
|
getUnitByUserId: ({
|
|
677
|
-
userId:
|
|
736
|
+
userId: l
|
|
678
737
|
}) => {
|
|
679
738
|
const u = s({
|
|
680
739
|
"content-type": "application/json",
|
|
681
740
|
"X-FORWARDED-HOST": p
|
|
682
741
|
});
|
|
683
|
-
return
|
|
684
|
-
`${a}/api/units/v1/${
|
|
742
|
+
return S(
|
|
743
|
+
`${a}/api/units/v1/${l}/unit`,
|
|
685
744
|
{
|
|
686
745
|
method: "GET",
|
|
687
746
|
headers: u
|
|
@@ -690,14 +749,14 @@ const j = {
|
|
|
690
749
|
);
|
|
691
750
|
},
|
|
692
751
|
getOrgUnitById: ({
|
|
693
|
-
orgUnitId:
|
|
752
|
+
orgUnitId: l
|
|
694
753
|
}) => {
|
|
695
754
|
const u = s({
|
|
696
755
|
"content-type": "application/json",
|
|
697
756
|
"X-FORWARDED-HOST": p
|
|
698
757
|
});
|
|
699
|
-
return
|
|
700
|
-
`${a}/api/units/v1/${
|
|
758
|
+
return S(
|
|
759
|
+
`${a}/api/units/v1/${l}`,
|
|
701
760
|
{
|
|
702
761
|
method: "GET",
|
|
703
762
|
headers: u
|
|
@@ -706,14 +765,14 @@ const j = {
|
|
|
706
765
|
);
|
|
707
766
|
},
|
|
708
767
|
getScopesByOrgUnit: ({
|
|
709
|
-
orgUnitId:
|
|
768
|
+
orgUnitId: l
|
|
710
769
|
}) => {
|
|
711
770
|
const u = s({
|
|
712
771
|
"content-type": "application/json",
|
|
713
772
|
"X-FORWARDED-HOST": p
|
|
714
773
|
});
|
|
715
|
-
return
|
|
716
|
-
`${a}/api/units/v1/${
|
|
774
|
+
return S(
|
|
775
|
+
`${a}/api/units/v1/${l}/scopes`,
|
|
717
776
|
{
|
|
718
777
|
method: "GET",
|
|
719
778
|
headers: u
|
|
@@ -724,14 +783,14 @@ const j = {
|
|
|
724
783
|
},
|
|
725
784
|
licenseManager: {
|
|
726
785
|
getUserById: ({
|
|
727
|
-
userId:
|
|
786
|
+
userId: l
|
|
728
787
|
}) => {
|
|
729
788
|
const u = s({
|
|
730
789
|
"content-type": "application/json",
|
|
731
790
|
"X-FORWARDED-HOST": p
|
|
732
791
|
});
|
|
733
|
-
return
|
|
734
|
-
`${a}/api/license-manager/users/${
|
|
792
|
+
return S(
|
|
793
|
+
`${a}/api/license-manager/users/${l}`,
|
|
735
794
|
{
|
|
736
795
|
method: "GET",
|
|
737
796
|
headers: u
|
|
@@ -740,14 +799,14 @@ const j = {
|
|
|
740
799
|
);
|
|
741
800
|
},
|
|
742
801
|
getUserByEmail: ({
|
|
743
|
-
email:
|
|
802
|
+
email: l
|
|
744
803
|
}) => {
|
|
745
804
|
const u = s({
|
|
746
805
|
"content-type": "application/json",
|
|
747
806
|
"X-FORWARDED-HOST": p
|
|
748
807
|
});
|
|
749
|
-
return
|
|
750
|
-
`${a}/api/license-manager/pvt/users/${
|
|
808
|
+
return S(
|
|
809
|
+
`${a}/api/license-manager/pvt/users/${l}`,
|
|
751
810
|
{
|
|
752
811
|
method: "GET",
|
|
753
812
|
headers: u
|
|
@@ -756,14 +815,14 @@ const j = {
|
|
|
756
815
|
);
|
|
757
816
|
},
|
|
758
817
|
getUserRoles: ({
|
|
759
|
-
userId:
|
|
818
|
+
userId: l
|
|
760
819
|
}) => {
|
|
761
820
|
const u = s({
|
|
762
821
|
"content-type": "application/json",
|
|
763
822
|
"X-FORWARDED-HOST": p
|
|
764
823
|
});
|
|
765
|
-
return
|
|
766
|
-
`${a}/api/license-manager/storefront/users/${
|
|
824
|
+
return S(
|
|
825
|
+
`${a}/api/license-manager/storefront/users/${l}/roles`,
|
|
767
826
|
{
|
|
768
827
|
method: "GET",
|
|
769
828
|
headers: u
|
|
@@ -774,17 +833,17 @@ const j = {
|
|
|
774
833
|
},
|
|
775
834
|
masterData: {
|
|
776
835
|
getContractById: ({
|
|
777
|
-
contractId:
|
|
836
|
+
contractId: l
|
|
778
837
|
}) => {
|
|
779
|
-
if (!
|
|
780
|
-
throw new
|
|
781
|
-
const u =
|
|
838
|
+
if (!l)
|
|
839
|
+
throw new E("Missing contractId to fetch CL fields.");
|
|
840
|
+
const u = c({
|
|
782
841
|
Accept: "application/json",
|
|
783
842
|
"content-type": "application/json",
|
|
784
843
|
"X-FORWARDED-HOST": p
|
|
785
844
|
});
|
|
786
|
-
return
|
|
787
|
-
`${a}/api/dataentities/CL/documents/${
|
|
845
|
+
return S(
|
|
846
|
+
`${a}/api/dataentities/CL/documents/${l}?_fields=_all`,
|
|
788
847
|
{
|
|
789
848
|
method: "GET",
|
|
790
849
|
headers: u
|
|
@@ -793,17 +852,17 @@ const j = {
|
|
|
793
852
|
);
|
|
794
853
|
},
|
|
795
854
|
getShopperById: ({
|
|
796
|
-
userId:
|
|
855
|
+
userId: l
|
|
797
856
|
}) => {
|
|
798
|
-
if (!
|
|
799
|
-
throw new
|
|
800
|
-
const u =
|
|
857
|
+
if (!l)
|
|
858
|
+
throw new E("Missing userId to fetch shopper name.");
|
|
859
|
+
const u = c({
|
|
801
860
|
Accept: "application/json",
|
|
802
861
|
"content-type": "application/json",
|
|
803
862
|
"X-FORWARDED-HOST": p
|
|
804
|
-
}), m =
|
|
805
|
-
return
|
|
806
|
-
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${
|
|
863
|
+
}), m = l.replace(/-/g, "");
|
|
864
|
+
return S(
|
|
865
|
+
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${l})&_fields=_all&_schema=v1`,
|
|
807
866
|
{
|
|
808
867
|
method: "GET",
|
|
809
868
|
headers: u
|
|
@@ -812,16 +871,33 @@ const j = {
|
|
|
812
871
|
);
|
|
813
872
|
}
|
|
814
873
|
},
|
|
874
|
+
quotes: {
|
|
875
|
+
listUserQuotes: (l) => {
|
|
876
|
+
Zn(l);
|
|
877
|
+
const u = et(l), m = s({
|
|
878
|
+
"content-type": "application/json",
|
|
879
|
+
"X-FORWARDED-HOST": p
|
|
880
|
+
});
|
|
881
|
+
return S(
|
|
882
|
+
`${a}/api/quoting/quotes?${u.toString()}`,
|
|
883
|
+
{
|
|
884
|
+
method: "GET",
|
|
885
|
+
headers: m
|
|
886
|
+
},
|
|
887
|
+
{ storeCookies: o }
|
|
888
|
+
);
|
|
889
|
+
}
|
|
890
|
+
},
|
|
815
891
|
vtexid: {
|
|
816
892
|
validate: () => {
|
|
817
|
-
const
|
|
893
|
+
const l = s({
|
|
818
894
|
"content-type": "application/json",
|
|
819
895
|
"X-FORWARDED-HOST": p
|
|
820
|
-
}), u =
|
|
821
|
-
return
|
|
896
|
+
}), u = K(Ye(i) ?? "", e);
|
|
897
|
+
return S(
|
|
822
898
|
`${a}/api/vtexid/credential/validate`,
|
|
823
899
|
{
|
|
824
|
-
headers:
|
|
900
|
+
headers: l,
|
|
825
901
|
body: JSON.stringify({ token: u }),
|
|
826
902
|
method: "POST"
|
|
827
903
|
},
|
|
@@ -831,30 +907,30 @@ const j = {
|
|
|
831
907
|
},
|
|
832
908
|
orderEntry: {
|
|
833
909
|
uploadFile: ({
|
|
834
|
-
fileBuffer:
|
|
910
|
+
fileBuffer: l,
|
|
835
911
|
fileName: u,
|
|
836
912
|
mimeType: m
|
|
837
913
|
}) => {
|
|
838
|
-
const
|
|
914
|
+
const y = s({
|
|
839
915
|
"content-type": "application/json",
|
|
840
916
|
"X-FORWARDED-HOST": p
|
|
841
917
|
}), f = `----FastStoreUploadBoundary${Date.now()}`, I = `\r
|
|
842
|
-
`,
|
|
918
|
+
`, U = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", w = u.replaceAll(/[\r\n"]/g, "_"), O = [
|
|
843
919
|
`--${f}`,
|
|
844
920
|
`Content-Disposition: form-data; name="file"; filename="${w}"`,
|
|
845
|
-
`Content-Type: ${
|
|
921
|
+
`Content-Type: ${U}`,
|
|
846
922
|
"",
|
|
847
923
|
""
|
|
848
924
|
].join(I), P = `${I}--${f}--${I}`, h = Buffer.from(O), b = Buffer.from(P), C = new Uint8Array(
|
|
849
|
-
h.byteLength +
|
|
925
|
+
h.byteLength + l.byteLength + b.byteLength
|
|
850
926
|
);
|
|
851
927
|
let A = 0;
|
|
852
|
-
return C.set(h, A), A += h.byteLength, C.set(
|
|
928
|
+
return C.set(h, A), A += h.byteLength, C.set(l, A), A += l.byteLength, C.set(b, A), S(
|
|
853
929
|
`${a}/api/order-entry/upload?an=${e}`,
|
|
854
930
|
{
|
|
855
931
|
method: "POST",
|
|
856
932
|
headers: {
|
|
857
|
-
...
|
|
933
|
+
...y,
|
|
858
934
|
"content-type": `multipart/form-data; boundary=${f}`
|
|
859
935
|
},
|
|
860
936
|
body: C.buffer
|
|
@@ -863,38 +939,38 @@ const j = {
|
|
|
863
939
|
);
|
|
864
940
|
},
|
|
865
941
|
startOperation: ({
|
|
866
|
-
objectKey:
|
|
942
|
+
objectKey: l,
|
|
867
943
|
orderFormId: u,
|
|
868
944
|
sessionToken: m
|
|
869
945
|
}) => {
|
|
870
|
-
const
|
|
946
|
+
const y = s({
|
|
871
947
|
"content-type": "application/json",
|
|
872
948
|
"X-FORWARDED-HOST": p
|
|
873
949
|
}), f = JSON.stringify({
|
|
874
|
-
objectKey:
|
|
950
|
+
objectKey: l,
|
|
875
951
|
orderFormId: u,
|
|
876
952
|
operation: "CreateCart",
|
|
877
953
|
...m ? { sessionToken: m } : {}
|
|
878
954
|
});
|
|
879
|
-
return
|
|
955
|
+
return S(
|
|
880
956
|
`${a}/api/order-entry/operation?an=${e}`,
|
|
881
957
|
{
|
|
882
958
|
method: "POST",
|
|
883
|
-
headers:
|
|
959
|
+
headers: y,
|
|
884
960
|
body: f
|
|
885
961
|
},
|
|
886
962
|
{}
|
|
887
963
|
);
|
|
888
964
|
},
|
|
889
965
|
getOperation: ({
|
|
890
|
-
operationId:
|
|
966
|
+
operationId: l
|
|
891
967
|
}) => {
|
|
892
968
|
const u = s({
|
|
893
969
|
"content-type": "application/json",
|
|
894
970
|
"X-FORWARDED-HOST": p
|
|
895
971
|
});
|
|
896
|
-
return
|
|
897
|
-
`${a}/api/order-entry/operation/${
|
|
972
|
+
return S(
|
|
973
|
+
`${a}/api/order-entry/operation/${l}?an=${e}`,
|
|
898
974
|
{
|
|
899
975
|
method: "GET",
|
|
900
976
|
headers: u
|
|
@@ -903,29 +979,29 @@ const j = {
|
|
|
903
979
|
);
|
|
904
980
|
},
|
|
905
981
|
createOrderForm: () => {
|
|
906
|
-
const
|
|
982
|
+
const l = s({
|
|
907
983
|
"content-type": "application/json",
|
|
908
984
|
"X-FORWARDED-HOST": p
|
|
909
985
|
});
|
|
910
|
-
return
|
|
986
|
+
return S(
|
|
911
987
|
`${a}/api/checkout/pub/orderForm?sc=${i.storage.channel.salesChannel}`,
|
|
912
988
|
{
|
|
913
989
|
method: "POST",
|
|
914
|
-
headers:
|
|
990
|
+
headers: l,
|
|
915
991
|
body: "{}"
|
|
916
992
|
},
|
|
917
993
|
{}
|
|
918
994
|
);
|
|
919
995
|
},
|
|
920
996
|
getOrderFormItems: ({
|
|
921
|
-
orderFormId:
|
|
997
|
+
orderFormId: l
|
|
922
998
|
}) => {
|
|
923
999
|
const u = s({
|
|
924
1000
|
"content-type": "application/json",
|
|
925
1001
|
"X-FORWARDED-HOST": p
|
|
926
1002
|
});
|
|
927
|
-
return
|
|
928
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
1003
|
+
return S(
|
|
1004
|
+
`${a}/api/checkout/pub/orderForm/${l}`,
|
|
929
1005
|
{
|
|
930
1006
|
method: "GET",
|
|
931
1007
|
headers: u
|
|
@@ -935,23 +1011,23 @@ const j = {
|
|
|
935
1011
|
}
|
|
936
1012
|
}
|
|
937
1013
|
};
|
|
938
|
-
}, ce = "fuzzy", le = "operator", de = "pickupPoint", be = "shipping", De = "delivery-options",
|
|
939
|
-
|
|
940
|
-
|
|
1014
|
+
}, ce = "fuzzy", le = "operator", de = "pickupPoint", be = "shipping", De = "delivery-options", tt = "in-stock", rt = "trade-policy", it = "region-id", at = /* @__PURE__ */ new Set([
|
|
1015
|
+
rt,
|
|
1016
|
+
it,
|
|
941
1017
|
ce,
|
|
942
1018
|
le,
|
|
943
1019
|
de
|
|
944
|
-
]),
|
|
1020
|
+
]), ot = /* @__PURE__ */ new Set([
|
|
945
1021
|
"zip-code",
|
|
946
1022
|
"pickupPoint",
|
|
947
1023
|
"country",
|
|
948
1024
|
"coordinates",
|
|
949
1025
|
"deliveryZonesHash",
|
|
950
1026
|
"pickupPointsHash"
|
|
951
|
-
]),
|
|
1027
|
+
]), st = /* @__PURE__ */ new Set(["productClusterIds"]), we = (e) => encodeURI(decodeURI(e)), ct = (e) => encodeURIComponent(
|
|
952
1028
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
953
|
-
),
|
|
954
|
-
function
|
|
1029
|
+
), lt = /^pickup-in-point-(.+)$/;
|
|
1030
|
+
function Qe(e) {
|
|
955
1031
|
if (!e)
|
|
956
1032
|
return {};
|
|
957
1033
|
try {
|
|
@@ -964,18 +1040,18 @@ function Ke(e) {
|
|
|
964
1040
|
return {};
|
|
965
1041
|
}
|
|
966
1042
|
}
|
|
967
|
-
function
|
|
1043
|
+
function dt(e) {
|
|
968
1044
|
const n = {}, t = {}, r = [];
|
|
969
1045
|
for (const i of e.split(";")) {
|
|
970
1046
|
const a = i.indexOf("=");
|
|
971
1047
|
if (a < 0) continue;
|
|
972
1048
|
const o = i.slice(0, a), s = i.slice(a + 1);
|
|
973
|
-
!o || !s || (
|
|
1049
|
+
!o || !s || (ot.has(o) ? n[o] = s : st.has(o) ? t[o] = s : r.push({ key: o, value: s }));
|
|
974
1050
|
}
|
|
975
1051
|
return { shipping: n, queryParams: t, extraFacets: r };
|
|
976
1052
|
}
|
|
977
|
-
function
|
|
978
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, queryParams: r, extraFacets: i } =
|
|
1053
|
+
function ut(e) {
|
|
1054
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, queryParams: r, extraFacets: i } = dt(n);
|
|
979
1055
|
return {
|
|
980
1056
|
segmentParams: {
|
|
981
1057
|
sc: e.channel,
|
|
@@ -997,7 +1073,7 @@ function st(e) {
|
|
|
997
1073
|
extraFacets: i
|
|
998
1074
|
};
|
|
999
1075
|
}
|
|
1000
|
-
function
|
|
1076
|
+
function Ke(e, n) {
|
|
1001
1077
|
const t = [
|
|
1002
1078
|
["sc", n.sc],
|
|
1003
1079
|
["regionId", n.regionId],
|
|
@@ -1019,9 +1095,9 @@ function Qe(e, n) {
|
|
|
1019
1095
|
i != null && i !== "" && e.append(r, String(i));
|
|
1020
1096
|
}
|
|
1021
1097
|
function Ze(e) {
|
|
1022
|
-
return
|
|
1098
|
+
return lt.exec(e)?.[1];
|
|
1023
1099
|
}
|
|
1024
|
-
function
|
|
1100
|
+
function pt(e) {
|
|
1025
1101
|
const n = e.find((r) => r.key === "shipping"), t = n ? Ze(n.value) : void 0;
|
|
1026
1102
|
if (t !== void 0)
|
|
1027
1103
|
try {
|
|
@@ -1030,8 +1106,8 @@ function ct(e) {
|
|
|
1030
1106
|
return t;
|
|
1031
1107
|
}
|
|
1032
1108
|
}
|
|
1033
|
-
function
|
|
1034
|
-
const t =
|
|
1109
|
+
function gt(e, n) {
|
|
1110
|
+
const t = pt(
|
|
1035
1111
|
n
|
|
1036
1112
|
);
|
|
1037
1113
|
return t === void 0 ? e : {
|
|
@@ -1039,25 +1115,25 @@ function lt(e, n) {
|
|
|
1039
1115
|
pickupPoint: t
|
|
1040
1116
|
};
|
|
1041
1117
|
}
|
|
1042
|
-
function
|
|
1118
|
+
function mt(e) {
|
|
1043
1119
|
return e.map((n) => n.key !== "shipping" || Ze(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1044
1120
|
}
|
|
1045
|
-
function
|
|
1121
|
+
function ht(e, n) {
|
|
1046
1122
|
let t = [...e];
|
|
1047
1123
|
const r = t.some((i) => i.key === "shipping");
|
|
1048
1124
|
for (const i of n)
|
|
1049
1125
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1050
|
-
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")),
|
|
1126
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), mt(t);
|
|
1051
1127
|
}
|
|
1052
|
-
function
|
|
1128
|
+
function ft(e) {
|
|
1053
1129
|
return e.reduce((n, t) => {
|
|
1054
1130
|
let { key: r, value: i } = t;
|
|
1055
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${we(r)}/${
|
|
1131
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${we(r)}/${ct(we(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1056
1132
|
}, "");
|
|
1057
1133
|
}
|
|
1058
|
-
const
|
|
1059
|
-
function
|
|
1060
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1134
|
+
const St = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), yt = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1135
|
+
function It(e, n) {
|
|
1136
|
+
const { segmentParams: t, extraFacets: r } = ut(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
|
|
1061
1137
|
return {
|
|
1062
1138
|
segmentParams: {
|
|
1063
1139
|
...t,
|
|
@@ -1068,21 +1144,21 @@ function ht(e, n) {
|
|
|
1068
1144
|
extraFacets: r
|
|
1069
1145
|
};
|
|
1070
1146
|
}
|
|
1071
|
-
function
|
|
1072
|
-
const t = e.filter(({ key:
|
|
1073
|
-
({ key:
|
|
1147
|
+
function vt(e, n) {
|
|
1148
|
+
const t = e.filter(({ key: c }) => !at.has(c)), r = e.find(
|
|
1149
|
+
({ key: c, value: d }) => c === be && d !== "all-delivery-methods"
|
|
1074
1150
|
) ?? null, i = e.find(
|
|
1075
|
-
({ key:
|
|
1151
|
+
({ key: c, value: d }) => c === De && d !== "all-delivery-options"
|
|
1076
1152
|
) ?? null, a = [...t], o = a.some(
|
|
1077
|
-
({ key:
|
|
1153
|
+
({ key: c }) => c === be
|
|
1078
1154
|
), s = a.some(
|
|
1079
|
-
({ key:
|
|
1155
|
+
({ key: c }) => c === De
|
|
1080
1156
|
);
|
|
1081
|
-
return r !== null && !o && a.push(r), i !== null && !s && a.push(i),
|
|
1157
|
+
return r !== null && !o && a.push(r), i !== null && !s && a.push(i), ht(a, n);
|
|
1082
1158
|
}
|
|
1083
|
-
function
|
|
1159
|
+
function Ot(e, n) {
|
|
1084
1160
|
const t = e.find(({ key: a }) => a === ce) ?? null, r = e.find(({ key: a }) => a === le) ?? null, i = e.find(({ key: a }) => a === de) ?? null;
|
|
1085
|
-
t &&
|
|
1161
|
+
t && St(t) && n.append(ce, t.value), r && yt(r) && n.append(le, r.value), i && n.append(de, i.value);
|
|
1086
1162
|
}
|
|
1087
1163
|
function Pe(e, n, t, r) {
|
|
1088
1164
|
const {
|
|
@@ -1090,37 +1166,37 @@ function Pe(e, n, t, r) {
|
|
|
1090
1166
|
page: a,
|
|
1091
1167
|
count: o,
|
|
1092
1168
|
sort: s,
|
|
1093
|
-
selectedFacets:
|
|
1169
|
+
selectedFacets: c = [],
|
|
1094
1170
|
showInvisibleItems: d,
|
|
1095
1171
|
sponsoredCount: g,
|
|
1096
1172
|
hideUnavailableItems: p,
|
|
1097
|
-
allowRedirect:
|
|
1173
|
+
allowRedirect: l = !1
|
|
1098
1174
|
} = e, u = new URLSearchParams();
|
|
1099
1175
|
if (r.includePagination && a !== void 0 && o !== void 0) {
|
|
1100
1176
|
const f = a * o, I = o === 0 ? f : f + o - 1;
|
|
1101
1177
|
u.append("from", f.toString()), u.append("to", I.toString());
|
|
1102
1178
|
}
|
|
1103
1179
|
i && u.append("query", i), r.includeSort && s && u.append("sort", s);
|
|
1104
|
-
const m =
|
|
1180
|
+
const m = gt(
|
|
1105
1181
|
t.segmentParams,
|
|
1106
|
-
|
|
1182
|
+
c
|
|
1107
1183
|
);
|
|
1108
|
-
if (
|
|
1109
|
-
const f =
|
|
1184
|
+
if (Ke(u, m ?? t.segmentParams), Ot(c, u), d && u.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1185
|
+
const f = c.find(({ key: D }) => D === tt), I = f ? f.value : p?.toString() ?? n.hideUnavailableItems.toString();
|
|
1110
1186
|
u.append("hideUnavailableItems", I);
|
|
1111
1187
|
}
|
|
1112
|
-
n?.simulationBehavior !== void 0 && u.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && u.append("showSponsored", n.showSponsored.toString()), g !== void 0 && u.append("sponsoredCount", g.toString()),
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1188
|
+
n?.simulationBehavior !== void 0 && u.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && u.append("showSponsored", n.showSponsored.toString()), g !== void 0 && u.append("sponsoredCount", g.toString()), l !== void 0 && u.append("allowRedirect", l.toString());
|
|
1189
|
+
const y = ft(
|
|
1190
|
+
vt(c, t.extraFacets)
|
|
1115
1191
|
);
|
|
1116
|
-
return { params: u, path:
|
|
1192
|
+
return { params: u, path: y };
|
|
1117
1193
|
}
|
|
1118
|
-
function
|
|
1194
|
+
function Ct(e, n) {
|
|
1119
1195
|
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: a } = e, o = new URLSearchParams({
|
|
1120
1196
|
field: t ?? "",
|
|
1121
1197
|
value: r ?? ""
|
|
1122
1198
|
});
|
|
1123
|
-
return
|
|
1199
|
+
return Ke(o, n), i && o.append("hideUnavailableItems", "true"), a && o.append("show-invisible-items", "true"), o;
|
|
1124
1200
|
}
|
|
1125
1201
|
function W(e, n) {
|
|
1126
1202
|
return {
|
|
@@ -1133,7 +1209,7 @@ function W(e, n) {
|
|
|
1133
1209
|
};
|
|
1134
1210
|
}
|
|
1135
1211
|
function G(e) {
|
|
1136
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a =
|
|
1212
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a = It(t, r);
|
|
1137
1213
|
switch (n) {
|
|
1138
1214
|
case "product-search":
|
|
1139
1215
|
case "facets": {
|
|
@@ -1155,7 +1231,7 @@ function G(e) {
|
|
|
1155
1231
|
return W(s, o);
|
|
1156
1232
|
}
|
|
1157
1233
|
case "products": {
|
|
1158
|
-
const o =
|
|
1234
|
+
const o = Ct(i, a.segmentParams);
|
|
1159
1235
|
return W("", o);
|
|
1160
1236
|
}
|
|
1161
1237
|
case "search-suggestions": {
|
|
@@ -1177,16 +1253,16 @@ function G(e) {
|
|
|
1177
1253
|
}
|
|
1178
1254
|
}
|
|
1179
1255
|
}
|
|
1180
|
-
const
|
|
1181
|
-
function
|
|
1256
|
+
const bt = 10;
|
|
1257
|
+
function Dt(e) {
|
|
1182
1258
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1183
1259
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1184
1260
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const n =
|
|
1261
|
+
function wt(e) {
|
|
1262
|
+
const n = Qe(e.headers?.cookie);
|
|
1187
1263
|
return e.storage.locale || n.cultureInfo || "";
|
|
1188
1264
|
}
|
|
1189
|
-
const
|
|
1265
|
+
const Pt = ({
|
|
1190
1266
|
account: e,
|
|
1191
1267
|
environment: n,
|
|
1192
1268
|
hideUnavailableItems: t,
|
|
@@ -1194,28 +1270,28 @@ const Ct = ({
|
|
|
1194
1270
|
showSponsored: i,
|
|
1195
1271
|
subDomainPrefix: a
|
|
1196
1272
|
}, o) => {
|
|
1197
|
-
const s = `https://${e}.${n}.com.br`,
|
|
1273
|
+
const s = `https://${e}.${n}.com.br`, c = Je(o), d = Qe(o.headers?.cookie), g = () => ({
|
|
1198
1274
|
salesChannel: o.storage.channel.salesChannel,
|
|
1199
|
-
regionId:
|
|
1200
|
-
locale:
|
|
1275
|
+
regionId: Dt(o),
|
|
1276
|
+
locale: wt(o),
|
|
1201
1277
|
hideUnavailableItems: t,
|
|
1202
1278
|
simulationBehavior: r,
|
|
1203
1279
|
showSponsored: i
|
|
1204
|
-
}), p = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "",
|
|
1280
|
+
}), p = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "", l = a && a.map((h) => h + ".").find((h) => p.includes(h)) || "", u = p.replace(l, ""), m = c({
|
|
1205
1281
|
"content-type": "application/json",
|
|
1206
1282
|
"X-FORWARDED-HOST": u
|
|
1207
|
-
}),
|
|
1283
|
+
}), y = ({ type: h, ...b }) => {
|
|
1208
1284
|
const C = h === "facets" ? "facets" : "product-search", A = G({
|
|
1209
1285
|
endpoint: C,
|
|
1210
1286
|
segment: d,
|
|
1211
1287
|
defaults: g(),
|
|
1212
1288
|
args: b
|
|
1213
1289
|
});
|
|
1214
|
-
return
|
|
1290
|
+
return S(
|
|
1215
1291
|
`${s}/api/intelligent-search/v1/${C}/${A.path}?${A.params.toString()}`,
|
|
1216
1292
|
{ headers: m }
|
|
1217
1293
|
);
|
|
1218
|
-
}, f = (h) =>
|
|
1294
|
+
}, f = (h) => y({ ...h, type: "product_search" }), I = ({
|
|
1219
1295
|
field: h,
|
|
1220
1296
|
value: b,
|
|
1221
1297
|
hideUnavailableItems: C,
|
|
@@ -1232,13 +1308,13 @@ const Ct = ({
|
|
|
1232
1308
|
showInvisibleItems: A
|
|
1233
1309
|
}
|
|
1234
1310
|
});
|
|
1235
|
-
return
|
|
1311
|
+
return S(
|
|
1236
1312
|
`${s}/api/intelligent-search/v1/products?${v.params.toString()}`,
|
|
1237
1313
|
{ headers: m }
|
|
1238
1314
|
);
|
|
1239
1315
|
};
|
|
1240
1316
|
return {
|
|
1241
|
-
facets: (h) =>
|
|
1317
|
+
facets: (h) => y({ ...h, type: "facets" }),
|
|
1242
1318
|
products: f,
|
|
1243
1319
|
fetchProduct: I,
|
|
1244
1320
|
productsByIdentifier: async ({
|
|
@@ -1247,14 +1323,14 @@ const Ct = ({
|
|
|
1247
1323
|
showInvisibleItems: C,
|
|
1248
1324
|
hideUnavailableItems: A
|
|
1249
1325
|
}) => {
|
|
1250
|
-
const v = ye(
|
|
1326
|
+
const v = ye(bt);
|
|
1251
1327
|
return (await Promise.all(
|
|
1252
1328
|
b.map(
|
|
1253
|
-
(
|
|
1329
|
+
(k) => v(async () => {
|
|
1254
1330
|
try {
|
|
1255
1331
|
return await I({
|
|
1256
1332
|
field: h,
|
|
1257
|
-
value:
|
|
1333
|
+
value: k,
|
|
1258
1334
|
hideUnavailableItems: A,
|
|
1259
1335
|
showInvisibleItems: C
|
|
1260
1336
|
});
|
|
@@ -1264,7 +1340,7 @@ const Ct = ({
|
|
|
1264
1340
|
})
|
|
1265
1341
|
)
|
|
1266
1342
|
)).filter(
|
|
1267
|
-
(
|
|
1343
|
+
(k) => k !== null
|
|
1268
1344
|
);
|
|
1269
1345
|
},
|
|
1270
1346
|
suggestedTerms: (h) => {
|
|
@@ -1274,7 +1350,7 @@ const Ct = ({
|
|
|
1274
1350
|
defaults: g(),
|
|
1275
1351
|
args: { query: h.query }
|
|
1276
1352
|
});
|
|
1277
|
-
return
|
|
1353
|
+
return S(
|
|
1278
1354
|
`${s}/api/intelligent-search/v1/search-suggestions?${b.params.toString()}`,
|
|
1279
1355
|
{ headers: m }
|
|
1280
1356
|
);
|
|
@@ -1285,7 +1361,7 @@ const Ct = ({
|
|
|
1285
1361
|
segment: d,
|
|
1286
1362
|
defaults: g()
|
|
1287
1363
|
});
|
|
1288
|
-
return
|
|
1364
|
+
return S(
|
|
1289
1365
|
`${s}/api/intelligent-search/v1/top-searches?${h.params.toString()}`,
|
|
1290
1366
|
{ headers: m }
|
|
1291
1367
|
);
|
|
@@ -1297,33 +1373,33 @@ const Ct = ({
|
|
|
1297
1373
|
defaults: g(),
|
|
1298
1374
|
args: h
|
|
1299
1375
|
});
|
|
1300
|
-
return
|
|
1376
|
+
return S(
|
|
1301
1377
|
`${s}/api/intelligent-search/v1/catalog-count/${b.path}?${b.params.toString()}`,
|
|
1302
1378
|
{ headers: m }
|
|
1303
1379
|
);
|
|
1304
1380
|
}
|
|
1305
1381
|
};
|
|
1306
|
-
},
|
|
1307
|
-
const t =
|
|
1382
|
+
}, At = (e, n) => {
|
|
1383
|
+
const t = Pt(e, n), r = nt(e, n);
|
|
1308
1384
|
return {
|
|
1309
1385
|
search: t,
|
|
1310
1386
|
commerce: r
|
|
1311
1387
|
};
|
|
1312
|
-
},
|
|
1388
|
+
}, Ut = 20, Et = /* @__PURE__ */ new Set([
|
|
1313
1389
|
"brand",
|
|
1314
1390
|
"category",
|
|
1315
1391
|
"department",
|
|
1316
1392
|
"subcategory",
|
|
1317
1393
|
"collection",
|
|
1318
1394
|
"cluster"
|
|
1319
|
-
]), z = (e) => typeof e.pageType == "string" &&
|
|
1320
|
-
const t = ye(
|
|
1395
|
+
]), z = (e) => typeof e.pageType == "string" && Et.has(e.pageType.toLowerCase()), Tt = (e, n) => {
|
|
1396
|
+
const t = ye(Ut), r = async (i) => Promise.all(
|
|
1321
1397
|
i.map(
|
|
1322
1398
|
(a) => t(async () => {
|
|
1323
1399
|
const o = await n.commerce.catalog.portal.pagetype(a);
|
|
1324
1400
|
if (z(o))
|
|
1325
1401
|
return o;
|
|
1326
|
-
throw new
|
|
1402
|
+
throw new L(
|
|
1327
1403
|
`Catalog returned ${o.pageType} for slug: ${a}. This usually happens when there is more than one category with the same name in the same category tree level.`
|
|
1328
1404
|
);
|
|
1329
1405
|
})
|
|
@@ -1333,44 +1409,44 @@ const Ct = ({
|
|
|
1333
1409
|
// DataLoader is being used to cache requests, not to batch them
|
|
1334
1410
|
batch: !1
|
|
1335
1411
|
});
|
|
1336
|
-
},
|
|
1412
|
+
}, _t = (e, n) => {
|
|
1337
1413
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1338
1414
|
return new te(t);
|
|
1339
|
-
},
|
|
1340
|
-
const t = ye(
|
|
1341
|
-
const o = a.reduce((p, { items:
|
|
1415
|
+
}, kt = 1, Ft = (e, n) => {
|
|
1416
|
+
const t = ye(kt), r = async (a) => {
|
|
1417
|
+
const o = a.reduce((p, { items: l }) => [...p, l], []), s = [...o.flat()], c = await n.commerce.checkout.simulation({
|
|
1342
1418
|
country: a[0].country,
|
|
1343
1419
|
postalCode: a[0].postalCode,
|
|
1344
1420
|
items: s
|
|
1345
|
-
}), d =
|
|
1346
|
-
(p,
|
|
1347
|
-
const u =
|
|
1348
|
-
return typeof u == "number" && u < p.length && (p[u] =
|
|
1421
|
+
}), d = c.items.reduce(
|
|
1422
|
+
(p, l) => {
|
|
1423
|
+
const u = l.requestIndex;
|
|
1424
|
+
return typeof u == "number" && u < p.length && (p[u] = l), p;
|
|
1349
1425
|
},
|
|
1350
1426
|
Array(s.length).fill(null)
|
|
1351
1427
|
), g = o.reduce(
|
|
1352
|
-
(p,
|
|
1428
|
+
(p, l) => [...p, l.length + p[p.length - 1]],
|
|
1353
1429
|
[0]
|
|
1354
1430
|
);
|
|
1355
|
-
return o.map((p,
|
|
1356
|
-
...
|
|
1357
|
-
items: d.slice(g[
|
|
1431
|
+
return o.map((p, l) => ({
|
|
1432
|
+
...c,
|
|
1433
|
+
items: d.slice(g[l], g[l + 1]).filter((u) => !!u)
|
|
1358
1434
|
}));
|
|
1359
1435
|
}, i = async (a) => t(r, a);
|
|
1360
1436
|
return new te(i, {
|
|
1361
1437
|
maxBatchSize: 50
|
|
1362
1438
|
});
|
|
1363
|
-
},
|
|
1364
|
-
function
|
|
1439
|
+
}, Rt = (e, n) => An(e, n);
|
|
1440
|
+
function Nt(e) {
|
|
1365
1441
|
return {
|
|
1366
1442
|
...e,
|
|
1367
|
-
description: e.description ?
|
|
1443
|
+
description: e.description ? Rt(e.description) : e.description
|
|
1368
1444
|
};
|
|
1369
1445
|
}
|
|
1370
|
-
const
|
|
1446
|
+
const B = (e, n) => ({
|
|
1371
1447
|
...e,
|
|
1372
|
-
isVariantOf:
|
|
1373
|
-
}),
|
|
1448
|
+
isVariantOf: Nt(n)
|
|
1449
|
+
}), Bt = ({ flags: e }, n) => {
|
|
1374
1450
|
const t = async (r) => {
|
|
1375
1451
|
const i = r.map((g) => g.split("-")[0]), a = r.some(
|
|
1376
1452
|
(g) => g.split("-")[1] === "invisibleItems"
|
|
@@ -1383,43 +1459,43 @@ const L = (e, n) => ({
|
|
|
1383
1459
|
}
|
|
1384
1460
|
})).reduce(
|
|
1385
1461
|
(g, p) => {
|
|
1386
|
-
for (const
|
|
1387
|
-
g[
|
|
1462
|
+
for (const l of p.items)
|
|
1463
|
+
g[l.itemId] = B(l, p);
|
|
1388
1464
|
return g;
|
|
1389
1465
|
},
|
|
1390
1466
|
{}
|
|
1391
|
-
),
|
|
1467
|
+
), c = i.map((g) => s[g]), d = i.filter((g) => !s[g]);
|
|
1392
1468
|
if (d.length > 0)
|
|
1393
|
-
throw new
|
|
1469
|
+
throw new L(
|
|
1394
1470
|
`Search API did not found the following skus: ${d.join(",")}`
|
|
1395
1471
|
);
|
|
1396
|
-
return
|
|
1472
|
+
return c;
|
|
1397
1473
|
};
|
|
1398
1474
|
return new te(t, {
|
|
1399
1475
|
maxBatchSize: 99
|
|
1400
1476
|
// Max allowed batch size of Search API
|
|
1401
1477
|
});
|
|
1402
|
-
},
|
|
1403
|
-
const t =
|
|
1478
|
+
}, Lt = (e, { clients: n }) => {
|
|
1479
|
+
const t = Bt(e, n), r = Ft(e, n), i = Tt(e, n), a = _t(e, n);
|
|
1404
1480
|
return {
|
|
1405
1481
|
skuLoader: t,
|
|
1406
1482
|
simulationLoader: r,
|
|
1407
1483
|
collectionLoader: i,
|
|
1408
1484
|
salesChannelLoader: a
|
|
1409
1485
|
};
|
|
1410
|
-
}, M = (e) => e.AvailableQuantity > 0,
|
|
1486
|
+
}, M = (e) => e.AvailableQuantity > 0, x = (e) => e.spotPrice ?? 0, Mt = (e) => e.Price ?? 0, Ae = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", en = (e, n) => M(e) && !M(n) ? -1 : !M(e) && M(n) ? 1 : x(e) - x(n), $t = (e) => e === "available", $ = (e, n = 0, t = 1) => {
|
|
1411
1487
|
const r = n / t;
|
|
1412
1488
|
return Math.round((e + r) * 100) / 100;
|
|
1413
|
-
},
|
|
1414
|
-
const t = e.filter(M), r = t[t.length - 1], i = r ?
|
|
1489
|
+
}, zt = (e, n = { includeTaxes: !1 }) => {
|
|
1490
|
+
const t = e.filter(M), r = t[t.length - 1], i = r ? x(r) : 0;
|
|
1415
1491
|
return n.includeTaxes ? $(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1416
|
-
},
|
|
1417
|
-
const [t] = e.filter(M), r = t ?
|
|
1492
|
+
}, Ue = (e, n = { includeTaxes: !1 }) => {
|
|
1493
|
+
const [t] = e.filter(M), r = t ? x(t) : 0;
|
|
1418
1494
|
return n.includeTaxes ? $(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1419
|
-
},
|
|
1420
|
-
highPrice: (e) =>
|
|
1421
|
-
lowPrice: (e) =>
|
|
1422
|
-
lowPriceWithTaxes: (e) =>
|
|
1495
|
+
}, xt = {
|
|
1496
|
+
highPrice: (e) => zt(e),
|
|
1497
|
+
lowPrice: (e) => Ue(e),
|
|
1498
|
+
lowPriceWithTaxes: (e) => Ue(e, { includeTaxes: !0 }),
|
|
1423
1499
|
offerCount: (e) => e.length,
|
|
1424
1500
|
priceCurrency: async (e, n, t) => {
|
|
1425
1501
|
const {
|
|
@@ -1429,33 +1505,33 @@ const L = (e, n) => ({
|
|
|
1429
1505
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1430
1506
|
},
|
|
1431
1507
|
offers: (e) => e
|
|
1432
|
-
},
|
|
1508
|
+
}, Vt = {
|
|
1433
1509
|
ratingValue: () => 5,
|
|
1434
1510
|
reviewCount: () => 0
|
|
1435
|
-
},
|
|
1511
|
+
}, Ee = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", qt = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", jt = (e) => {
|
|
1436
1512
|
let n = e.slice(0);
|
|
1437
|
-
for (let t = 0; t <
|
|
1438
|
-
n = n.replace(new RegExp(
|
|
1513
|
+
for (let t = 0; t < Ee.length; t++)
|
|
1514
|
+
n = n.replace(new RegExp(Ee.charAt(t), "g"), qt.charAt(t));
|
|
1439
1515
|
return n;
|
|
1440
|
-
},
|
|
1516
|
+
}, Wt = (e) => e.replace(/[·/_,:]/, "-");
|
|
1441
1517
|
function nn(e) {
|
|
1442
1518
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1443
|
-
return
|
|
1519
|
+
return Wt(jt(t)).toLowerCase();
|
|
1444
1520
|
}
|
|
1445
|
-
const
|
|
1521
|
+
const Q = (e) => e.type === "brand" || z(e) && e.pageType.toLowerCase() === "brand", ue = (e) => z(e) && e.pageType.toLowerCase() === "collection", ae = (e) => Q(e) || ue(e) ? nn(e.name) : z(e) ? new URL(`https://${e.url}`).pathname.slice(1).toLowerCase() : new URL(e.url).pathname.slice(1).toLowerCase(), tn = {
|
|
1446
1522
|
id: ({ id: e }) => e.toString(),
|
|
1447
1523
|
slug: (e) => ae(e),
|
|
1448
|
-
seo: (e) =>
|
|
1524
|
+
seo: (e) => Q(e) || z(e) ? {
|
|
1449
1525
|
title: e.title ?? e.name,
|
|
1450
1526
|
description: e.metaTagDescription
|
|
1451
1527
|
} : {
|
|
1452
1528
|
title: e.Title,
|
|
1453
1529
|
description: e.MetaTagDescription
|
|
1454
1530
|
},
|
|
1455
|
-
type: (e) =>
|
|
1531
|
+
type: (e) => Q(e) ? "Brand" : z(e) ? e.pageType : e.level === 0 ? "Department" : "Category",
|
|
1456
1532
|
meta: (e) => {
|
|
1457
1533
|
const n = ae(e);
|
|
1458
|
-
return
|
|
1534
|
+
return Q(e) ? {
|
|
1459
1535
|
selectedFacets: [{ key: "brand", value: n }]
|
|
1460
1536
|
} : ue(e) ? {
|
|
1461
1537
|
selectedFacets: [{ key: "productclusterids", value: e.id }]
|
|
@@ -1469,20 +1545,20 @@ const K = (e) => e.type === "brand" || z(e) && e.pageType.toLowerCase() === "bra
|
|
|
1469
1545
|
breadcrumbList: async (e, n, t) => {
|
|
1470
1546
|
const {
|
|
1471
1547
|
loaders: { collectionLoader: r }
|
|
1472
|
-
} = t, a = ae(e).split("/").filter((
|
|
1473
|
-
(
|
|
1548
|
+
} = t, a = ae(e).split("/").filter((c) => !!c), o = a.map(
|
|
1549
|
+
(c, d) => a.slice(0, d + 1).join("/")
|
|
1474
1550
|
), s = await Promise.all(
|
|
1475
|
-
o.map(async (
|
|
1476
|
-
const d = await r.load(
|
|
1477
|
-
return { slug:
|
|
1551
|
+
o.map(async (c) => {
|
|
1552
|
+
const d = await r.load(c);
|
|
1553
|
+
return { slug: c, ...d };
|
|
1478
1554
|
})
|
|
1479
1555
|
);
|
|
1480
1556
|
return {
|
|
1481
|
-
itemListElement: s.map((
|
|
1482
|
-
item: ue(
|
|
1483
|
-
`https://${
|
|
1557
|
+
itemListElement: s.map((c, d) => ({
|
|
1558
|
+
item: ue(c) ? `/${c.slug}` : new URL(
|
|
1559
|
+
`https://${c.url}`
|
|
1484
1560
|
).pathname.toLowerCase(),
|
|
1485
|
-
name:
|
|
1561
|
+
name: c.name,
|
|
1486
1562
|
position: d + 1
|
|
1487
1563
|
})),
|
|
1488
1564
|
numberOfItems: s.length
|
|
@@ -1511,58 +1587,58 @@ const K = (e) => e.type === "brand" || z(e) && e.pageType.toLowerCase() === "bra
|
|
|
1511
1587
|
default:
|
|
1512
1588
|
return { key: e, value: n };
|
|
1513
1589
|
}
|
|
1514
|
-
},
|
|
1590
|
+
}, _e = (e) => {
|
|
1515
1591
|
const n = e.split(":").map(Number);
|
|
1516
1592
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1517
|
-
},
|
|
1593
|
+
}, Gt = (e) => typeof rn[e] == "string", Ht = (e) => {
|
|
1518
1594
|
const n = e?.filter(
|
|
1519
|
-
(t) =>
|
|
1595
|
+
(t) => Gt(t.key)
|
|
1520
1596
|
);
|
|
1521
1597
|
if (Array.isArray(n) && n.length > 1)
|
|
1522
|
-
throw new
|
|
1598
|
+
throw new E(
|
|
1523
1599
|
`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(",")}`
|
|
1524
1600
|
);
|
|
1525
1601
|
return n?.[0] ?? null;
|
|
1526
|
-
},
|
|
1602
|
+
}, Xt = (e) => e?.find((n) => n.key === "slug")?.value ?? null, Yt = (e) => e?.find((n) => n.key === "id")?.value ?? null, ke = (e) => e?.find((n) => n.key === "locale")?.value ?? null, Fe = (e) => e?.find((n) => n.key === "channel")?.value ?? null, pe = (e, n) => {
|
|
1527
1603
|
let t = 0;
|
|
1528
1604
|
for (let r = 1; r < e.length; r++)
|
|
1529
1605
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1530
1606
|
return e[t];
|
|
1531
|
-
},
|
|
1607
|
+
}, Jt = {
|
|
1532
1608
|
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1533
|
-
},
|
|
1609
|
+
}, Qt = {
|
|
1534
1610
|
key: ({ key: e }) => e,
|
|
1535
1611
|
label: ({ name: e }) => e,
|
|
1536
1612
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1537
|
-
},
|
|
1613
|
+
}, Kt = {
|
|
1538
1614
|
key: ({ key: e }) => e,
|
|
1539
1615
|
label: ({ name: e }) => e,
|
|
1540
1616
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1541
|
-
const i =
|
|
1617
|
+
const i = _e(
|
|
1542
1618
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1543
|
-
), o = pe(e, (s,
|
|
1619
|
+
), o = pe(e, (s, c) => s.range.from - c.range.from)?.range?.from ?? 0;
|
|
1544
1620
|
return {
|
|
1545
1621
|
selected: i?.[0] ?? o,
|
|
1546
1622
|
absolute: o
|
|
1547
1623
|
};
|
|
1548
1624
|
},
|
|
1549
1625
|
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1550
|
-
const i =
|
|
1626
|
+
const i = _e(
|
|
1551
1627
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1552
|
-
), o = pe(e, (s,
|
|
1628
|
+
), o = pe(e, (s, c) => c.range.to - s.range.to)?.range?.to ?? 0;
|
|
1553
1629
|
return {
|
|
1554
1630
|
selected: i?.[1] ?? o,
|
|
1555
1631
|
absolute: o
|
|
1556
1632
|
};
|
|
1557
1633
|
}
|
|
1558
|
-
},
|
|
1634
|
+
}, Zt = {
|
|
1559
1635
|
value: ({ value: e }) => e,
|
|
1560
1636
|
label: ({ name: e }) => e || "unknown",
|
|
1561
1637
|
selected: ({ selected: e }) => e,
|
|
1562
1638
|
quantity: ({ quantity: e }) => e
|
|
1563
|
-
},
|
|
1639
|
+
}, er = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1564
1640
|
if (!n?.orderId)
|
|
1565
|
-
throw new
|
|
1641
|
+
throw new E("Missing orderId");
|
|
1566
1642
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1567
1643
|
};
|
|
1568
1644
|
function an(e) {
|
|
@@ -1583,39 +1659,39 @@ function an(e) {
|
|
|
1583
1659
|
}
|
|
1584
1660
|
return null;
|
|
1585
1661
|
}
|
|
1586
|
-
function
|
|
1662
|
+
function nr(e) {
|
|
1587
1663
|
if (!e || e.status !== "pending") return !1;
|
|
1588
1664
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1589
1665
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1590
1666
|
}
|
|
1591
|
-
const
|
|
1667
|
+
const tr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1592
1668
|
const r = await t.oms.processOrderAuthorization(n), i = an(r);
|
|
1593
1669
|
return {
|
|
1594
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1670
|
+
isPendingForOtherAuthorizer: !i && nr(r),
|
|
1595
1671
|
ruleForAuthorization: i
|
|
1596
1672
|
};
|
|
1597
|
-
},
|
|
1673
|
+
}, rr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1598
1674
|
if (!n?.objectKey)
|
|
1599
|
-
throw new
|
|
1675
|
+
throw new E("Missing objectKey");
|
|
1600
1676
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
1601
1677
|
return t.orderEntry.startOperation({
|
|
1602
1678
|
objectKey: n.objectKey,
|
|
1603
1679
|
orderFormId: r,
|
|
1604
1680
|
sessionToken: n.sessionToken ?? void 0
|
|
1605
1681
|
});
|
|
1606
|
-
},
|
|
1682
|
+
}, ir = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), ar = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1607
1683
|
const { fileContent: r, fileName: i, mimeType: a } = n;
|
|
1608
1684
|
if (!r || !i || !a)
|
|
1609
|
-
throw new
|
|
1685
|
+
throw new E(
|
|
1610
1686
|
"Missing required fields: fileContent, fileName, mimeType"
|
|
1611
1687
|
);
|
|
1612
1688
|
const o = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
|
|
1613
1689
|
if (Math.floor(o.length * 3 / 4) > s)
|
|
1614
|
-
throw new
|
|
1690
|
+
throw new E("File exceeds maximum allowed size of 5MB");
|
|
1615
1691
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
|
|
1616
1692
|
o
|
|
1617
1693
|
))
|
|
1618
|
-
throw new
|
|
1694
|
+
throw new E("Invalid Base64 fileContent");
|
|
1619
1695
|
const g = Buffer.from(o, "base64");
|
|
1620
1696
|
return await t.orderEntry.uploadFile({
|
|
1621
1697
|
fileBuffer: g,
|
|
@@ -1645,7 +1721,7 @@ const ge = (e, n) => {
|
|
|
1645
1721
|
e.storage.channel = ee.parse(n);
|
|
1646
1722
|
}, me = (e, n) => {
|
|
1647
1723
|
e.storage.locale = n;
|
|
1648
|
-
}, on = (e) =>
|
|
1724
|
+
}, on = (e) => Un.createHash("md5").update(e).digest("hex"), Y = {
|
|
1649
1725
|
attachment: "ATTACHMENT",
|
|
1650
1726
|
specification: "SPECIFICATION",
|
|
1651
1727
|
attribute: "ATTRIBUTE"
|
|
@@ -1657,7 +1733,7 @@ function sn(e) {
|
|
|
1657
1733
|
valueReference: Y.attachment
|
|
1658
1734
|
};
|
|
1659
1735
|
}
|
|
1660
|
-
function
|
|
1736
|
+
function or(e) {
|
|
1661
1737
|
return {
|
|
1662
1738
|
propertyID: e.id,
|
|
1663
1739
|
name: e.name,
|
|
@@ -1673,7 +1749,7 @@ function cn(e) {
|
|
|
1673
1749
|
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
1674
1750
|
);
|
|
1675
1751
|
}
|
|
1676
|
-
const
|
|
1752
|
+
const sr = (e) => {
|
|
1677
1753
|
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
1678
1754
|
addressType: e.addressType || null,
|
|
1679
1755
|
postalCode: n || null,
|
|
@@ -1692,7 +1768,7 @@ const rr = (e) => {
|
|
|
1692
1768
|
r.geoCoordinates = i !== null && a !== null ? [a, i] : [];
|
|
1693
1769
|
}
|
|
1694
1770
|
return [r];
|
|
1695
|
-
},
|
|
1771
|
+
}, cr = (e, n, t) => {
|
|
1696
1772
|
const r = n.postalCode, i = n.geoCoordinates, a = e?.shippingData?.availableAddresses ?? [], o = e?.shippingData?.selectedAddresses ?? [];
|
|
1697
1773
|
if (!t && o.length > 0)
|
|
1698
1774
|
return [o[0]];
|
|
@@ -1707,22 +1783,22 @@ const rr = (e) => {
|
|
|
1707
1783
|
}
|
|
1708
1784
|
return null;
|
|
1709
1785
|
}, ln = (e, n) => {
|
|
1710
|
-
if (!
|
|
1786
|
+
if (!lr(n))
|
|
1711
1787
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1712
|
-
if (!
|
|
1788
|
+
if (!gr(e))
|
|
1713
1789
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1714
1790
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
1715
|
-
if (
|
|
1791
|
+
if (dr(t, n.postalCode) || ur(t, n.geoCoordinates) || pr(t, n.addressType))
|
|
1716
1792
|
return { updateShipping: !0, addressChanged: !0 };
|
|
1717
1793
|
const { logisticsInfo: r } = e.shippingData;
|
|
1718
|
-
return
|
|
1719
|
-
},
|
|
1794
|
+
return mr(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
1795
|
+
}, lr = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, dr = (e, n) => typeof n == "string" && e?.postalCode !== n, ur = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), pr = (e, n) => typeof n == "string" && e?.addressType !== n, gr = (e) => e.items.length !== 0, mr = (e, n) => {
|
|
1720
1796
|
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
|
|
1721
1797
|
return e.some(
|
|
1722
|
-
({ selectedDeliveryChannel: o, selectedSla: s, slas:
|
|
1798
|
+
({ selectedDeliveryChannel: o, selectedSla: s, slas: c }) => {
|
|
1723
1799
|
const d = t && o !== t, g = r && s !== r;
|
|
1724
|
-
return
|
|
1725
|
-
(
|
|
1800
|
+
return c?.some((p) => d && p.deliveryChannel === t || g && p.id === r ? !0 : i && a && p.deliveryChannel === t && p.id === r && (!p?.deliveryWindow || p?.deliveryWindow?.startDateUtc !== i || p?.deliveryWindow?.endDateUtc !== a) && p.availableDeliveryWindows?.some(
|
|
1801
|
+
(l) => l?.startDateUtc === i && l?.endDateUtc === a
|
|
1726
1802
|
));
|
|
1727
1803
|
}
|
|
1728
1804
|
);
|
|
@@ -1743,7 +1819,7 @@ const rr = (e) => {
|
|
|
1743
1819
|
additionalProperty: e.attachments.map(sn)
|
|
1744
1820
|
},
|
|
1745
1821
|
index: n
|
|
1746
|
-
}),
|
|
1822
|
+
}), hr = (e) => ({
|
|
1747
1823
|
quantity: e.quantity,
|
|
1748
1824
|
seller: e.seller.identifier,
|
|
1749
1825
|
id: e.itemOffered.sku,
|
|
@@ -1755,13 +1831,13 @@ const rr = (e) => {
|
|
|
1755
1831
|
}), Re = (e) => e.reduce((n, t) => {
|
|
1756
1832
|
const r = he(t);
|
|
1757
1833
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
1758
|
-
}, /* @__PURE__ */ new Map()),
|
|
1759
|
-
const t = (s,
|
|
1834
|
+
}, /* @__PURE__ */ new Map()), fr = (e, n) => {
|
|
1835
|
+
const t = (s, c) => ({
|
|
1760
1836
|
...s,
|
|
1761
1837
|
itemOffered: {
|
|
1762
1838
|
sku: s.itemOffered.sku
|
|
1763
1839
|
},
|
|
1764
|
-
index:
|
|
1840
|
+
index: c
|
|
1765
1841
|
}), r = n.items.map(ne).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = Ie(r, i);
|
|
1766
1842
|
return a && o;
|
|
1767
1843
|
};
|
|
@@ -1797,7 +1873,7 @@ const Ne = (e) => {
|
|
|
1797
1873
|
};
|
|
1798
1874
|
})
|
|
1799
1875
|
};
|
|
1800
|
-
},
|
|
1876
|
+
}, Be = async (e, n, t) => ({
|
|
1801
1877
|
order: {
|
|
1802
1878
|
orderNumber: e.orderFormId,
|
|
1803
1879
|
acceptedOffer: e.items.map(async (r) => ({
|
|
@@ -1821,7 +1897,7 @@ const Ne = (e) => {
|
|
|
1821
1897
|
return on(
|
|
1822
1898
|
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
1823
1899
|
);
|
|
1824
|
-
},
|
|
1900
|
+
}, Le = async (e, n, t) => {
|
|
1825
1901
|
try {
|
|
1826
1902
|
return await n.checkout.setCustomData({
|
|
1827
1903
|
id: e.orderFormId,
|
|
@@ -1837,12 +1913,12 @@ const Ne = (e) => {
|
|
|
1837
1913
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
1838
1914
|
), r;
|
|
1839
1915
|
}
|
|
1840
|
-
},
|
|
1916
|
+
}, Sr = (e, n) => {
|
|
1841
1917
|
const r = e.customData?.customApps.find(
|
|
1842
1918
|
(a) => a.id === "faststore"
|
|
1843
1919
|
)?.fields?.cartEtag;
|
|
1844
1920
|
return r == null ? !0 : gn(e, n) !== r;
|
|
1845
|
-
},
|
|
1921
|
+
}, yr = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
1846
1922
|
id: e
|
|
1847
1923
|
}), Me = async (e, n, { clients: { commerce: t } }) => {
|
|
1848
1924
|
if (!n)
|
|
@@ -1852,7 +1928,7 @@ const Ne = (e) => {
|
|
|
1852
1928
|
n
|
|
1853
1929
|
);
|
|
1854
1930
|
if (r) {
|
|
1855
|
-
const a =
|
|
1931
|
+
const a = cr(e, n, i), s = a || sr(n);
|
|
1856
1932
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
1857
1933
|
{
|
|
1858
1934
|
id: e.orderFormId,
|
|
@@ -1872,46 +1948,46 @@ const Ne = (e) => {
|
|
|
1872
1948
|
);
|
|
1873
1949
|
}
|
|
1874
1950
|
return e;
|
|
1875
|
-
},
|
|
1951
|
+
}, Ir = (e, n) => {
|
|
1876
1952
|
if (!e)
|
|
1877
1953
|
return "";
|
|
1878
1954
|
const r = H(e)[n];
|
|
1879
1955
|
return r ? r.split("=")[1] : "";
|
|
1880
|
-
},
|
|
1881
|
-
const i =
|
|
1956
|
+
}, vr = async (e, { cart: { order: n }, session: t }, r) => {
|
|
1957
|
+
const i = Ir(
|
|
1882
1958
|
r.headers.cookie,
|
|
1883
1959
|
"checkout.vtex.com"
|
|
1884
1960
|
), {
|
|
1885
1961
|
clients: { commerce: a },
|
|
1886
1962
|
loaders: { skuLoader: o }
|
|
1887
|
-
} = r, s = t?.channel,
|
|
1888
|
-
s && ge(r, s),
|
|
1963
|
+
} = r, s = t?.channel, c = t?.locale;
|
|
1964
|
+
s && ge(r, s), c && me(r, c);
|
|
1889
1965
|
const d = await a.checkout.orderForm({
|
|
1890
1966
|
id: i || void 0,
|
|
1891
1967
|
channel: r.storage.channel
|
|
1892
1968
|
}), g = d.orderFormId;
|
|
1893
|
-
d.messages.length !== 0 && await
|
|
1894
|
-
const p = H(r?.headers?.cookie ?? "")?.vtex_session,
|
|
1895
|
-
if (
|
|
1896
|
-
const v = await
|
|
1969
|
+
d.messages.length !== 0 && await yr(g, r);
|
|
1970
|
+
const p = H(r?.headers?.cookie ?? "")?.vtex_session, l = Z(p), { acceptedOffer: u, shouldSplitItem: m } = n;
|
|
1971
|
+
if (Sr(d, l)) {
|
|
1972
|
+
const v = await Le(
|
|
1897
1973
|
d,
|
|
1898
1974
|
a,
|
|
1899
|
-
|
|
1975
|
+
l
|
|
1900
1976
|
).then(Ne);
|
|
1901
1977
|
if (g)
|
|
1902
|
-
return
|
|
1978
|
+
return Be(v, o, m);
|
|
1903
1979
|
}
|
|
1904
|
-
const f = Re(u), I = Re(d.items.map(ne)), D = Array.from(I.entries()),
|
|
1905
|
-
(v, [T,
|
|
1906
|
-
const
|
|
1907
|
-
if (!
|
|
1908
|
-
return
|
|
1909
|
-
const [
|
|
1910
|
-
if (pn(d.items,
|
|
1911
|
-
return v.itemsToUpdate.push(
|
|
1912
|
-
const ie =
|
|
1980
|
+
const f = Re(u), I = Re(d.items.map(ne)), D = Array.from(I.entries()), U = Array.from(f.entries()), { itemsToAdd: w, itemsToUpdate: O } = U.reduce(
|
|
1981
|
+
(v, [T, k]) => {
|
|
1982
|
+
const V = I.get(T);
|
|
1983
|
+
if (!V)
|
|
1984
|
+
return k.forEach((q) => v.itemsToAdd.push(q)), v;
|
|
1985
|
+
const [_, ...ve] = V;
|
|
1986
|
+
if (pn(d.items, _.itemOffered.sku) || un(d.items, _.itemOffered.sku))
|
|
1987
|
+
return v.itemsToUpdate.push(_), v;
|
|
1988
|
+
const ie = k.reduce((q, In) => q + In.quantity, 0);
|
|
1913
1989
|
return v.itemsToUpdate.push({
|
|
1914
|
-
...
|
|
1990
|
+
..._,
|
|
1915
1991
|
quantity: ie
|
|
1916
1992
|
}), ve.forEach((q) => v.itemsToUpdate.push({ ...q, quantity: 0 })), v;
|
|
1917
1993
|
},
|
|
@@ -1920,7 +1996,7 @@ const Ne = (e) => {
|
|
|
1920
1996
|
itemsToUpdate: []
|
|
1921
1997
|
}
|
|
1922
1998
|
), P = D.filter(([v]) => !f.has(v)).flatMap(([, v]) => v.map((T) => ({ ...T, quantity: 0 }))), h = [...w, ...O, ...P].map(
|
|
1923
|
-
|
|
1999
|
+
hr
|
|
1924
2000
|
), { updateShipping: b } = t ? ln(d, t) : { updateShipping: !1 };
|
|
1925
2001
|
if (h.length === 0 && !b)
|
|
1926
2002
|
return null;
|
|
@@ -1947,20 +2023,20 @@ const Ne = (e) => {
|
|
|
1947
2023
|
});
|
|
1948
2024
|
}
|
|
1949
2025
|
return v;
|
|
1950
|
-
}).then((v) =>
|
|
2026
|
+
}).then((v) => c && v.clientPreferencesData?.locale !== c ? a.checkout.clientPreferencesData({
|
|
1951
2027
|
id: v.orderFormId,
|
|
1952
2028
|
clientPreferencesData: {
|
|
1953
2029
|
...v.clientPreferencesData,
|
|
1954
|
-
locale:
|
|
2030
|
+
locale: c
|
|
1955
2031
|
}
|
|
1956
|
-
}) : v).then((v) =>
|
|
2032
|
+
}) : v).then((v) => Le(v, a, l)).then(Ne);
|
|
1957
2033
|
const A = Ie(
|
|
1958
2034
|
d.messages,
|
|
1959
2035
|
C.messages
|
|
1960
2036
|
);
|
|
1961
|
-
return
|
|
2037
|
+
return fr(n, C) && A ? null : Be(C, o, m);
|
|
1962
2038
|
};
|
|
1963
|
-
async function
|
|
2039
|
+
async function Or(e, n, t) {
|
|
1964
2040
|
try {
|
|
1965
2041
|
const r = await e.commerce.checkout.address({
|
|
1966
2042
|
postalCode: t,
|
|
@@ -1977,41 +2053,41 @@ async function Sr(e, n, t) {
|
|
|
1977
2053
|
), r;
|
|
1978
2054
|
}
|
|
1979
2055
|
}
|
|
1980
|
-
const
|
|
1981
|
-
const o = ee.parse(n.channel ?? ""), s = String(n.postalCode ?? ""),
|
|
2056
|
+
const Cr = async (e, { session: n, search: t }, { clients: r, headers: i, account: a }) => {
|
|
2057
|
+
const o = ee.parse(n.channel ?? ""), s = String(n.postalCode ?? ""), c = n.country ?? "";
|
|
1982
2058
|
let d = n.city ?? null, g = n.geoCoordinates ?? null;
|
|
1983
|
-
if ((!d || !g) && s !== "" &&
|
|
1984
|
-
const
|
|
2059
|
+
if ((!d || !g) && s !== "" && c !== "") {
|
|
2060
|
+
const _ = await Or(
|
|
1985
2061
|
r,
|
|
1986
|
-
|
|
2062
|
+
c,
|
|
1987
2063
|
s
|
|
1988
2064
|
);
|
|
1989
|
-
d =
|
|
2065
|
+
d = _.city, g = _.geoCoordinates;
|
|
1990
2066
|
}
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1993
|
-
const u =
|
|
1994
|
-
|
|
2067
|
+
const l = new URLSearchParams(t);
|
|
2068
|
+
l.has("facets") && l.delete("facets");
|
|
2069
|
+
const u = l.get("sc") ?? o.salesChannel;
|
|
2070
|
+
l.set("sc", u), s && l.set("postalCode", s), c && l.set("country", c), g && l.set(
|
|
1995
2071
|
"geoCoordinates",
|
|
1996
2072
|
`${g.longitude},${g.latitude}`
|
|
1997
2073
|
// long,lat is the format expected
|
|
1998
|
-
),
|
|
1999
|
-
const { marketingData: m } = n,
|
|
2000
|
-
utmCampaign:
|
|
2001
|
-
utmMedium:
|
|
2002
|
-
utmSource:
|
|
2003
|
-
utmiCampaign:
|
|
2004
|
-
utmiPage:
|
|
2005
|
-
utmiPart:
|
|
2006
|
-
}, f = Z(
|
|
2074
|
+
), l.set("locale", n.locale);
|
|
2075
|
+
const { marketingData: m } = n, y = {
|
|
2076
|
+
utmCampaign: l.get("utm_campaign") ?? m?.utmCampaign ?? "",
|
|
2077
|
+
utmMedium: l.get("utm_medium") ?? m?.utmMedium ?? "",
|
|
2078
|
+
utmSource: l.get("utm_source") ?? m?.utmSource ?? "",
|
|
2079
|
+
utmiCampaign: l.get("utmi_cp") ?? m?.utmiCampaign ?? "",
|
|
2080
|
+
utmiPage: l.get("utmi_p") ?? m?.utmiPage ?? "",
|
|
2081
|
+
utmiPart: l.get("utmi_pc") ?? m?.utmiPart ?? ""
|
|
2082
|
+
}, f = Z(K(i?.cookie ?? "", a));
|
|
2007
2083
|
let I = !1;
|
|
2008
2084
|
if (f)
|
|
2009
2085
|
try {
|
|
2010
2086
|
I = (await r.commerce.vtexid.validate())?.authStatus?.toLowerCase() === "success";
|
|
2011
|
-
} catch (
|
|
2012
|
-
console.warn("JWT validation failed:",
|
|
2087
|
+
} catch (_) {
|
|
2088
|
+
console.warn("JWT validation failed:", _), I = !1;
|
|
2013
2089
|
}
|
|
2014
|
-
const D = I ? f?.isRepresentative : !1,
|
|
2090
|
+
const D = I ? f?.isRepresentative : !1, U = I ? f?.customerId : void 0, w = I ? f?.unitId : void 0, O = await r.commerce.session(l.toString()).catch(() => null), P = O?.namespaces.profile ?? null, h = O?.namespaces.shopper ?? null, b = O?.namespaces.store ?? null, C = O?.namespaces.authentication ?? null, A = O?.namespaces.checkout ?? null, v = O?.namespaces.public ?? null;
|
|
2015
2091
|
let T = null;
|
|
2016
2092
|
if (D && P?.id?.value)
|
|
2017
2093
|
try {
|
|
@@ -2024,24 +2100,24 @@ const yr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2024
2100
|
`
|
|
2025
2101
|
);
|
|
2026
2102
|
}
|
|
2027
|
-
let
|
|
2028
|
-
o.seller && (s || g) && (
|
|
2103
|
+
let k;
|
|
2104
|
+
o.seller && (s || g) && (k = (await r.commerce.checkout.region({
|
|
2029
2105
|
postalCode: s,
|
|
2030
2106
|
geoCoordinates: g,
|
|
2031
|
-
country:
|
|
2107
|
+
country: c,
|
|
2032
2108
|
salesChannel: u
|
|
2033
2109
|
}))?.[0]?.sellers.find((ie) => o.seller === ie.id));
|
|
2034
|
-
const
|
|
2110
|
+
const V = {
|
|
2035
2111
|
...n,
|
|
2036
2112
|
currency: {
|
|
2037
2113
|
code: b?.currencyCode?.value ?? n.currency.code,
|
|
2038
2114
|
symbol: b?.currencySymbol?.value ?? n.currency.symbol
|
|
2039
2115
|
},
|
|
2040
|
-
country: b?.countryCode?.value ??
|
|
2116
|
+
country: b?.countryCode?.value ?? c,
|
|
2041
2117
|
channel: ee.stringify({
|
|
2042
2118
|
salesChannel: b?.channel?.value ?? o.salesChannel,
|
|
2043
2119
|
regionId: A?.regionId?.value ?? o.regionId,
|
|
2044
|
-
seller:
|
|
2120
|
+
seller: k?.id,
|
|
2045
2121
|
hasOnlyDefaultSalesChannel: !b?.channel?.value
|
|
2046
2122
|
}),
|
|
2047
2123
|
/**
|
|
@@ -2052,7 +2128,7 @@ const yr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2052
2128
|
*/
|
|
2053
2129
|
b2b: D ? {
|
|
2054
2130
|
isRepresentative: D ?? !1,
|
|
2055
|
-
customerId: C?.customerId?.value ??
|
|
2131
|
+
customerId: C?.customerId?.value ?? U ?? "",
|
|
2056
2132
|
unitName: C?.unitName?.value ?? "",
|
|
2057
2133
|
unitId: C?.unitId?.value ?? w ?? "",
|
|
2058
2134
|
firstName: typeof h?.firstName?.value == "string" ? h.firstName.value : "",
|
|
@@ -2063,7 +2139,7 @@ const yr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2063
2139
|
contractName: T?.corporateName ?? "",
|
|
2064
2140
|
organizationManager: h?.organizationManager?.value ?? !1
|
|
2065
2141
|
} : null,
|
|
2066
|
-
marketingData:
|
|
2142
|
+
marketingData: y,
|
|
2067
2143
|
person: P?.id ? {
|
|
2068
2144
|
id: P.id?.value ?? "",
|
|
2069
2145
|
email: P.email?.value ?? "",
|
|
@@ -2073,21 +2149,21 @@ const yr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2073
2149
|
geoCoordinates: g?.latitude && g?.longitude && g || null,
|
|
2074
2150
|
city: d
|
|
2075
2151
|
};
|
|
2076
|
-
return Ie(n,
|
|
2077
|
-
},
|
|
2078
|
-
validateCart:
|
|
2079
|
-
validateSession:
|
|
2080
|
-
subscribeToNewsletter:
|
|
2081
|
-
cancelOrder:
|
|
2082
|
-
processOrderAuthorization:
|
|
2083
|
-
uploadFileToOrderEntry:
|
|
2084
|
-
startOrderEntryOperation:
|
|
2152
|
+
return Ie(n, V) ? null : V;
|
|
2153
|
+
}, br = {
|
|
2154
|
+
validateCart: vr,
|
|
2155
|
+
validateSession: Cr,
|
|
2156
|
+
subscribeToNewsletter: ir,
|
|
2157
|
+
cancelOrder: er,
|
|
2158
|
+
processOrderAuthorization: tr,
|
|
2159
|
+
uploadFileToOrderEntry: ar,
|
|
2160
|
+
startOrderEntryOperation: rr
|
|
2085
2161
|
};
|
|
2086
2162
|
var fe;
|
|
2087
2163
|
(function(e) {
|
|
2088
2164
|
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";
|
|
2089
2165
|
})(fe || (fe = {}));
|
|
2090
|
-
const
|
|
2166
|
+
const Dr = (e) => typeof e == "string" ? mn(e) : null;
|
|
2091
2167
|
function mn(e) {
|
|
2092
2168
|
try {
|
|
2093
2169
|
return JSON.parse(e);
|
|
@@ -2095,15 +2171,15 @@ function mn(e) {
|
|
|
2095
2171
|
return e;
|
|
2096
2172
|
}
|
|
2097
2173
|
}
|
|
2098
|
-
const
|
|
2174
|
+
const wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Pr = new Cn({
|
|
2099
2175
|
name: "ObjectOrString",
|
|
2100
2176
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2101
|
-
parseValue:
|
|
2102
|
-
serialize:
|
|
2177
|
+
parseValue: Dr,
|
|
2178
|
+
serialize: wr,
|
|
2103
2179
|
parseLiteral(e) {
|
|
2104
2180
|
return e.kind === fe.STRING ? mn(e.value) : null;
|
|
2105
2181
|
}
|
|
2106
|
-
}), R = (e) => "Price" in e && "seller" in e && "product" in e, F = (e) => "skuName" in e,
|
|
2182
|
+
}), R = (e) => "Price" in e && "seller" in e && "product" in e, F = (e) => "skuName" in e, Ar = {
|
|
2107
2183
|
priceCurrency: async (e, n, t) => {
|
|
2108
2184
|
const {
|
|
2109
2185
|
loaders: { salesChannelLoader: r },
|
|
@@ -2113,19 +2189,19 @@ const Or = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2113
2189
|
},
|
|
2114
2190
|
priceValidUntil: (e) => R(e) ? e.PriceValidUntil ?? "" : F(e) ? e.priceValidUntil ?? "" : null,
|
|
2115
2191
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2116
|
-
availability: async (e) => R(e) ? Ae(M(e)) : F(e) ? Ae(
|
|
2192
|
+
availability: async (e) => R(e) ? Ae(M(e)) : F(e) ? Ae($t(e.availability)) : null,
|
|
2117
2193
|
seller: (e, n, t) => R(e) ? {
|
|
2118
2194
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2119
2195
|
} : F(e) ? {
|
|
2120
2196
|
identifier: e.seller
|
|
2121
2197
|
} : null,
|
|
2122
|
-
price: (e) => R(e) ?
|
|
2123
|
-
priceWithTaxes: (e) => R(e) ? $(
|
|
2198
|
+
price: (e) => R(e) ? x(e) : F(e) ? e.sellingPrice / 100 : null,
|
|
2199
|
+
priceWithTaxes: (e) => R(e) ? $(x(e), e?.Tax, e.product.unitMultiplier) : F(e) ? $(
|
|
2124
2200
|
e.sellingPrice / 100,
|
|
2125
2201
|
e.tax / 100,
|
|
2126
2202
|
e.unitMultiplier
|
|
2127
2203
|
) : null,
|
|
2128
|
-
sellingPrice: (e) => R(e) ?
|
|
2204
|
+
sellingPrice: (e) => R(e) ? Mt(e) : F(e) ? e.sellingPrice / 100 : null,
|
|
2129
2205
|
listPrice: (e) => R(e) ? e.ListPrice ?? 0 : F(e) ? e.listPrice / 100 : null,
|
|
2130
2206
|
listPriceWithTaxes: (e) => R(e) ? $(
|
|
2131
2207
|
e.ListPrice ?? 0,
|
|
@@ -2138,7 +2214,7 @@ const Or = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2138
2214
|
} : null,
|
|
2139
2215
|
quantity: (e) => R(e) ? e.AvailableQuantity ?? 0 : F(e) ? e.quantity : null,
|
|
2140
2216
|
isGift: (e) => F(e) ? e.isGift ?? !1 : null
|
|
2141
|
-
},
|
|
2217
|
+
}, Ur = ({ linkText: e }) => `/${e}/p`, Er = ({
|
|
2142
2218
|
offer: e,
|
|
2143
2219
|
seller: n,
|
|
2144
2220
|
product: t
|
|
@@ -2146,18 +2222,18 @@ const Or = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2146
2222
|
...e,
|
|
2147
2223
|
product: t,
|
|
2148
2224
|
seller: n
|
|
2149
|
-
}),
|
|
2225
|
+
}), Tr = {
|
|
2150
2226
|
imageText: "image",
|
|
2151
2227
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2152
2228
|
imageLabel: "label"
|
|
2153
|
-
}, hn = (e, n) => `${e}-${n}`,
|
|
2229
|
+
}, hn = (e, n) => `${e}-${n}`, _r = (e, n) => `/${hn(e, n)}/p`, kr = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2154
2230
|
function fn(e) {
|
|
2155
2231
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2156
2232
|
}
|
|
2157
|
-
const
|
|
2233
|
+
const Fr = (e, n) => {
|
|
2158
2234
|
const t = e.findIndex((r) => fn(r).split("/").at(-1) === n);
|
|
2159
2235
|
return t < 0 ? 0 : t;
|
|
2160
|
-
},
|
|
2236
|
+
}, Rr = {
|
|
2161
2237
|
productID: ({ itemId: e }) => e,
|
|
2162
2238
|
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2163
2239
|
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => hn(e, n),
|
|
@@ -2165,7 +2241,7 @@ const Ur = (e, n) => {
|
|
|
2165
2241
|
seo: ({ isVariantOf: e }) => ({
|
|
2166
2242
|
title: e.productTitle || e.productName,
|
|
2167
2243
|
description: e.metaTagDescription || e.description,
|
|
2168
|
-
canonical:
|
|
2244
|
+
canonical: Ur(e)
|
|
2169
2245
|
}),
|
|
2170
2246
|
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2171
2247
|
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
@@ -2179,11 +2255,11 @@ const Ur = (e, n) => {
|
|
|
2179
2255
|
},
|
|
2180
2256
|
itemId: a
|
|
2181
2257
|
}) => {
|
|
2182
|
-
const o =
|
|
2258
|
+
const o = Fr(i, r), s = e[o], c = fn(s).split("/");
|
|
2183
2259
|
return {
|
|
2184
2260
|
itemListElement: [
|
|
2185
|
-
...
|
|
2186
|
-
const p = `/${
|
|
2261
|
+
...c.map((d, g) => {
|
|
2262
|
+
const p = `/${c.slice(0, g + 1).map(nn).join("/")}/`;
|
|
2187
2263
|
return {
|
|
2188
2264
|
name: d,
|
|
2189
2265
|
item: p,
|
|
@@ -2192,17 +2268,17 @@ const Ur = (e, n) => {
|
|
|
2192
2268
|
}),
|
|
2193
2269
|
{
|
|
2194
2270
|
name: n,
|
|
2195
|
-
item:
|
|
2196
|
-
position:
|
|
2271
|
+
item: _r(t, a),
|
|
2272
|
+
position: c.length + 1
|
|
2197
2273
|
}
|
|
2198
2274
|
],
|
|
2199
|
-
numberOfItems:
|
|
2275
|
+
numberOfItems: c.length
|
|
2200
2276
|
};
|
|
2201
2277
|
},
|
|
2202
2278
|
image: ({ images: e }, n) => {
|
|
2203
|
-
const t = (
|
|
2204
|
-
({ imageUrl: s, imageText:
|
|
2205
|
-
alternateName:
|
|
2279
|
+
const t = (kr(e) ?? [Tr]).map(
|
|
2280
|
+
({ imageUrl: s, imageText: c, imageLabel: d }) => ({
|
|
2281
|
+
alternateName: c ?? "",
|
|
2206
2282
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
2207
2283
|
keywords: d
|
|
2208
2284
|
})
|
|
@@ -2223,7 +2299,7 @@ const Ur = (e, n) => {
|
|
|
2223
2299
|
review: () => [],
|
|
2224
2300
|
aggregateRating: () => ({}),
|
|
2225
2301
|
offers: (e) => e.sellers.map(
|
|
2226
|
-
(n) =>
|
|
2302
|
+
(n) => Er({
|
|
2227
2303
|
offer: n.commertialOffer,
|
|
2228
2304
|
seller: n,
|
|
2229
2305
|
product: e
|
|
@@ -2237,14 +2313,14 @@ const Ur = (e, n) => {
|
|
|
2237
2313
|
attributes: t = []
|
|
2238
2314
|
}) => {
|
|
2239
2315
|
const r = e.flatMap(
|
|
2240
|
-
({ name: o, values: s }) => s.map((
|
|
2316
|
+
({ name: o, values: s }) => s.map((c) => ({
|
|
2241
2317
|
name: o,
|
|
2242
|
-
value:
|
|
2318
|
+
value: c,
|
|
2243
2319
|
valueReference: Y.specification
|
|
2244
2320
|
}))
|
|
2245
2321
|
), i = n.map(
|
|
2246
2322
|
sn
|
|
2247
|
-
), a = t.map(
|
|
2323
|
+
), a = t.map(or);
|
|
2248
2324
|
return [
|
|
2249
2325
|
...r,
|
|
2250
2326
|
...i,
|
|
@@ -2257,13 +2333,13 @@ const Ur = (e, n) => {
|
|
|
2257
2333
|
releaseDate: ({ isVariantOf: { releaseDate: e } }) => e ?? "",
|
|
2258
2334
|
advertisement: ({ isVariantOf: { advertisement: e } }) => e,
|
|
2259
2335
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e
|
|
2260
|
-
},
|
|
2261
|
-
hasVariant: (e) => e.isVariantOf.items.map((n) =>
|
|
2336
|
+
}, Nr = /* @__PURE__ */ new Set(["allSpecifications"]), Br = {
|
|
2337
|
+
hasVariant: (e) => e.isVariantOf.items.map((n) => B(n, e.isVariantOf)),
|
|
2262
2338
|
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
2263
2339
|
name: (e) => e.isVariantOf.productName,
|
|
2264
2340
|
skuVariants: (e) => e,
|
|
2265
2341
|
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
2266
|
-
(n) => !
|
|
2342
|
+
(n) => !Nr.has(n.name)
|
|
2267
2343
|
).flatMap(
|
|
2268
2344
|
({ specifications: n }) => n.flatMap(
|
|
2269
2345
|
({ name: t, values: r }) => r.map((i) => ({
|
|
@@ -2273,18 +2349,18 @@ const Ur = (e, n) => {
|
|
|
2273
2349
|
}))
|
|
2274
2350
|
)
|
|
2275
2351
|
)
|
|
2276
|
-
},
|
|
2352
|
+
}, Lr = {
|
|
2277
2353
|
propertyID: (e) => e.propertyID || cn(e),
|
|
2278
2354
|
name: ({ name: e }) => e,
|
|
2279
2355
|
value: ({ value: e }) => e,
|
|
2280
2356
|
valueReference: ({ valueReference: e }) => e
|
|
2281
|
-
},
|
|
2357
|
+
}, Mr = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
2282
2358
|
if (!n)
|
|
2283
|
-
throw new
|
|
2359
|
+
throw new E("Missing operationId");
|
|
2284
2360
|
return t.orderEntry.getOperation({ operationId: n });
|
|
2285
|
-
},
|
|
2361
|
+
}, $r = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
2286
2362
|
if (!n)
|
|
2287
|
-
throw new
|
|
2363
|
+
throw new E("Missing orderFormId");
|
|
2288
2364
|
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
2289
2365
|
return (r ?? []).map((i) => ({
|
|
2290
2366
|
id: i.id,
|
|
@@ -2308,7 +2384,7 @@ const Ur = (e, n) => {
|
|
|
2308
2384
|
({ offer: r }, { offer: i }) => en(r, i)
|
|
2309
2385
|
);
|
|
2310
2386
|
return t ? t.sku : e[0];
|
|
2311
|
-
},
|
|
2387
|
+
}, zr = (e) => e !== "" && !Number.isNaN(Number(e)), $e = {
|
|
2312
2388
|
price_desc: "price:desc",
|
|
2313
2389
|
price_asc: "price:asc",
|
|
2314
2390
|
orders_desc: "orders:desc",
|
|
@@ -2317,17 +2393,17 @@ const Ur = (e, n) => {
|
|
|
2317
2393
|
release_desc: "release:desc",
|
|
2318
2394
|
discount_desc: "discount:desc",
|
|
2319
2395
|
score_desc: ""
|
|
2320
|
-
}, Sn = "Invalid SkuId",
|
|
2396
|
+
}, Sn = "Invalid SkuId", xr = "Slug was set but the fetched sku does not satisfy the slug condition.", Vr = (e) => He(e) || e instanceof Error && (e.message === Sn || e.message.startsWith(xr)), qr = {
|
|
2321
2397
|
product: async (e, { locator: n }, t) => {
|
|
2322
|
-
const r = Fe(n), i =
|
|
2398
|
+
const r = Fe(n), i = ke(n), a = Yt(n), o = Xt(n);
|
|
2323
2399
|
r && ge(t, r), i && me(t, i);
|
|
2324
2400
|
const {
|
|
2325
2401
|
loaders: { skuLoader: s },
|
|
2326
|
-
clients: { commerce:
|
|
2402
|
+
clients: { commerce: c, search: d }
|
|
2327
2403
|
} = t;
|
|
2328
2404
|
try {
|
|
2329
2405
|
const g = a ?? o?.split("-").pop() ?? "";
|
|
2330
|
-
if (!
|
|
2406
|
+
if (!zr(g))
|
|
2331
2407
|
throw new Error(Sn);
|
|
2332
2408
|
const p = await s.load(g);
|
|
2333
2409
|
if (o && p.isVariantOf.linkText && !o.startsWith(p.isVariantOf.linkText))
|
|
@@ -2336,21 +2412,21 @@ const Ur = (e, n) => {
|
|
|
2336
2412
|
);
|
|
2337
2413
|
return p;
|
|
2338
2414
|
} catch (g) {
|
|
2339
|
-
if (!
|
|
2415
|
+
if (!Vr(g))
|
|
2340
2416
|
throw g;
|
|
2341
2417
|
if (o == null)
|
|
2342
|
-
throw new
|
|
2343
|
-
const p = await
|
|
2418
|
+
throw new E("Missing slug or id");
|
|
2419
|
+
const p = await c.catalog.portal.pagetype(`${o}/p`);
|
|
2344
2420
|
if (p.pageType !== "Product" || !p.id)
|
|
2345
|
-
throw new
|
|
2346
|
-
const
|
|
2421
|
+
throw new L(`No product found for slug ${o}`);
|
|
2422
|
+
const l = await d.fetchProduct({
|
|
2347
2423
|
field: "id",
|
|
2348
2424
|
value: String(p.id)
|
|
2349
2425
|
}).catch(() => null);
|
|
2350
|
-
if (!
|
|
2351
|
-
throw new
|
|
2352
|
-
const u = Se(
|
|
2353
|
-
return
|
|
2426
|
+
if (!l)
|
|
2427
|
+
throw new L(`No product found for id ${p.id}`);
|
|
2428
|
+
const u = Se(l.items);
|
|
2429
|
+
return B(u, l);
|
|
2354
2430
|
}
|
|
2355
2431
|
},
|
|
2356
2432
|
collection: (e, { slug: n }, t) => {
|
|
@@ -2367,9 +2443,9 @@ const Ur = (e, n) => {
|
|
|
2367
2443
|
selectedFacets: a,
|
|
2368
2444
|
sponsoredCount: o
|
|
2369
2445
|
}, s) => {
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2372
|
-
const p = t ? Number(t) : 0,
|
|
2446
|
+
const c = Fe(a), d = ke(a), g = Ht(a);
|
|
2447
|
+
c && ge(s, c), d && me(s, d);
|
|
2448
|
+
const p = t ? Number(t) : 0, l = {
|
|
2373
2449
|
page: Math.ceil(p / n) || 0,
|
|
2374
2450
|
count: n,
|
|
2375
2451
|
query: i ?? void 0,
|
|
@@ -2378,10 +2454,10 @@ const Ur = (e, n) => {
|
|
|
2378
2454
|
sponsoredCount: o ?? void 0
|
|
2379
2455
|
};
|
|
2380
2456
|
if (g) {
|
|
2381
|
-
const
|
|
2457
|
+
const y = (await s.clients.commerce.catalog.products.crossselling({
|
|
2382
2458
|
type: rn[g.key],
|
|
2383
2459
|
productId: g.value
|
|
2384
|
-
})).map((I) => I.productId).slice(0, n), f = s.clients.search.productsByIdentifier({ field: "id", values:
|
|
2460
|
+
})).map((I) => I.productId).slice(0, n), f = s.clients.search.productsByIdentifier({ field: "id", values: y }).then((I) => ({
|
|
2385
2461
|
products: I,
|
|
2386
2462
|
recordsFiltered: I.length,
|
|
2387
2463
|
pagination: {
|
|
@@ -2404,10 +2480,10 @@ const Ur = (e, n) => {
|
|
|
2404
2480
|
fuzzy: "0",
|
|
2405
2481
|
searchId: ""
|
|
2406
2482
|
}));
|
|
2407
|
-
return { searchArgs:
|
|
2483
|
+
return { searchArgs: l, productSearchPromise: f };
|
|
2408
2484
|
}
|
|
2409
|
-
const u = s.clients.search.products(
|
|
2410
|
-
return { searchArgs:
|
|
2485
|
+
const u = s.clients.search.products(l);
|
|
2486
|
+
return { searchArgs: l, productSearchPromise: u };
|
|
2411
2487
|
},
|
|
2412
2488
|
allProducts: async (e, { first: n, after: t }, r) => {
|
|
2413
2489
|
const {
|
|
@@ -2416,8 +2492,8 @@ const Ur = (e, n) => {
|
|
|
2416
2492
|
page: Math.ceil(a / n),
|
|
2417
2493
|
count: n
|
|
2418
2494
|
}), s = o.products.flatMap(
|
|
2419
|
-
(
|
|
2420
|
-
).filter((
|
|
2495
|
+
(c) => c.items.map((d) => B(d, c))
|
|
2496
|
+
).filter((c) => c.sellers.length > 0);
|
|
2421
2497
|
return {
|
|
2422
2498
|
pageInfo: {
|
|
2423
2499
|
hasNextPage: o.pagination.after.length > 0,
|
|
@@ -2427,8 +2503,8 @@ const Ur = (e, n) => {
|
|
|
2427
2503
|
totalCount: o.recordsFiltered
|
|
2428
2504
|
},
|
|
2429
2505
|
// after + index is bigger than after+first itself because of the array flat() above
|
|
2430
|
-
edges: s.map((
|
|
2431
|
-
node:
|
|
2506
|
+
edges: s.map((c, d) => ({
|
|
2507
|
+
node: c,
|
|
2432
2508
|
cursor: (a + d).toString()
|
|
2433
2509
|
}))
|
|
2434
2510
|
};
|
|
@@ -2441,7 +2517,7 @@ const Ur = (e, n) => {
|
|
|
2441
2517
|
field: "id",
|
|
2442
2518
|
values: n
|
|
2443
2519
|
})).flatMap(
|
|
2444
|
-
(a) => a.items.map((o) =>
|
|
2520
|
+
(a) => a.items.map((o) => B(o, a))
|
|
2445
2521
|
).filter(
|
|
2446
2522
|
(a) => n.includes(a.itemId) && a.sellers.length > 0
|
|
2447
2523
|
) : [];
|
|
@@ -2452,17 +2528,17 @@ const Ur = (e, n) => {
|
|
|
2452
2528
|
} = r, a = t ? Number(t) : 0, [o, s] = await Promise.all([
|
|
2453
2529
|
i.catalog.brand.list(),
|
|
2454
2530
|
i.catalog.category.tree()
|
|
2455
|
-
]),
|
|
2456
|
-
|
|
2457
|
-
for (const m of
|
|
2531
|
+
]), c = [], d = (l, u) => {
|
|
2532
|
+
c.push({ ...l, level: u });
|
|
2533
|
+
for (const m of l.children)
|
|
2458
2534
|
d(m, u + 1);
|
|
2459
2535
|
};
|
|
2460
|
-
for (const
|
|
2461
|
-
d(
|
|
2536
|
+
for (const l of s)
|
|
2537
|
+
d(l, 0);
|
|
2462
2538
|
const p = [
|
|
2463
|
-
...o.filter((
|
|
2464
|
-
...
|
|
2465
|
-
].filter((
|
|
2539
|
+
...o.filter((l) => l.isActive).map((l) => ({ ...l, type: "brand" })),
|
|
2540
|
+
...c
|
|
2541
|
+
].filter((l) => !!tn.slug(l, null, r, null));
|
|
2466
2542
|
return {
|
|
2467
2543
|
pageInfo: {
|
|
2468
2544
|
hasNextPage: p.length - a > n,
|
|
@@ -2471,8 +2547,8 @@ const Ur = (e, n) => {
|
|
|
2471
2547
|
endCursor: (Math.min(n, p.length - a) - 1).toString(),
|
|
2472
2548
|
totalCount: p.length
|
|
2473
2549
|
},
|
|
2474
|
-
edges: p.slice(a, a + n).map((
|
|
2475
|
-
node:
|
|
2550
|
+
edges: p.slice(a, a + n).map((l, u) => ({
|
|
2551
|
+
node: l,
|
|
2476
2552
|
cursor: (a + u).toString()
|
|
2477
2553
|
}))
|
|
2478
2554
|
};
|
|
@@ -2481,13 +2557,13 @@ const Ur = (e, n) => {
|
|
|
2481
2557
|
const {
|
|
2482
2558
|
loaders: { simulationLoader: a },
|
|
2483
2559
|
clients: { commerce: o }
|
|
2484
|
-
} = i, [s,
|
|
2560
|
+
} = i, [s, c] = await Promise.all([
|
|
2485
2561
|
a.load({ country: n, items: t, postalCode: r }),
|
|
2486
2562
|
o.checkout.address({ postalCode: r, country: n })
|
|
2487
2563
|
]);
|
|
2488
2564
|
return {
|
|
2489
2565
|
...s,
|
|
2490
|
-
address:
|
|
2566
|
+
address: c
|
|
2491
2567
|
};
|
|
2492
2568
|
},
|
|
2493
2569
|
redirect: async (e, { term: n, selectedFacets: t }, r) => {
|
|
@@ -2507,12 +2583,12 @@ const Ur = (e, n) => {
|
|
|
2507
2583
|
sellers: async (e, { postalCode: n, geoCoordinates: t, country: r, salesChannel: i }, a) => {
|
|
2508
2584
|
const {
|
|
2509
2585
|
clients: { commerce: o }
|
|
2510
|
-
} = a,
|
|
2586
|
+
} = a, c = (await o.checkout.region({
|
|
2511
2587
|
postalCode: n,
|
|
2512
2588
|
geoCoordinates: t,
|
|
2513
2589
|
country: r,
|
|
2514
2590
|
salesChannel: i
|
|
2515
|
-
}))?.[0], { id: d, sellers: g } =
|
|
2591
|
+
}))?.[0], { id: d, sellers: g } = c;
|
|
2516
2592
|
return {
|
|
2517
2593
|
id: d,
|
|
2518
2594
|
sellers: g
|
|
@@ -2524,7 +2600,7 @@ const Ur = (e, n) => {
|
|
|
2524
2600
|
} = t, i = await r.profile.addresses(n);
|
|
2525
2601
|
function a(s) {
|
|
2526
2602
|
return !s || Object.keys(s).length === 0 ? [] : Object.values(s).map(
|
|
2527
|
-
(
|
|
2603
|
+
(c) => JSON.parse(c)
|
|
2528
2604
|
);
|
|
2529
2605
|
}
|
|
2530
2606
|
return { addresses: a(i) };
|
|
@@ -2540,16 +2616,16 @@ const Ur = (e, n) => {
|
|
|
2540
2616
|
userOrder: async (e, { orderId: n }, t) => {
|
|
2541
2617
|
try {
|
|
2542
2618
|
if (!n)
|
|
2543
|
-
throw new
|
|
2619
|
+
throw new E("Missing orderId");
|
|
2544
2620
|
const {
|
|
2545
2621
|
clients: { commerce: r }
|
|
2546
2622
|
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
2547
2623
|
if (!i)
|
|
2548
|
-
throw new
|
|
2624
|
+
throw new L(`No order found for id ${n}`);
|
|
2549
2625
|
let a = null;
|
|
2550
2626
|
try {
|
|
2551
|
-
const
|
|
2552
|
-
a = an(
|
|
2627
|
+
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
2628
|
+
a = an(c);
|
|
2553
2629
|
} catch {
|
|
2554
2630
|
}
|
|
2555
2631
|
const s = (await r.masterData.getShopperById({
|
|
@@ -2588,7 +2664,7 @@ const Ur = (e, n) => {
|
|
|
2588
2664
|
a = { message: i };
|
|
2589
2665
|
}
|
|
2590
2666
|
const o = a?.message || i;
|
|
2591
|
-
throw He(r) ? new
|
|
2667
|
+
throw He(r) ? new L(`No order found for id ${n}. ${o}.`) : jn(r) ? new re(
|
|
2592
2668
|
`You are forbidden to interact with order with id ${n}. ${o}.`
|
|
2593
2669
|
) : r;
|
|
2594
2670
|
}
|
|
@@ -2613,27 +2689,69 @@ const Ur = (e, n) => {
|
|
|
2613
2689
|
paging: i.paging
|
|
2614
2690
|
};
|
|
2615
2691
|
},
|
|
2692
|
+
listUserQuotes: async (e, n, t) => {
|
|
2693
|
+
const {
|
|
2694
|
+
clients: { commerce: r }
|
|
2695
|
+
} = t, i = await r.quotes.listUserQuotes(n), a = [
|
|
2696
|
+
...new Set(i.items.map((c) => c.createdBy).filter(Boolean))
|
|
2697
|
+
], o = /* @__PURE__ */ new Map();
|
|
2698
|
+
return await Promise.all(
|
|
2699
|
+
a.map(async (c) => {
|
|
2700
|
+
try {
|
|
2701
|
+
const [d] = await r.masterData.getShopperById({
|
|
2702
|
+
userId: c
|
|
2703
|
+
});
|
|
2704
|
+
if (d) {
|
|
2705
|
+
const g = [d.firstName, d.lastName].filter(Boolean).join(" ");
|
|
2706
|
+
g && o.set(c, g);
|
|
2707
|
+
}
|
|
2708
|
+
} catch {
|
|
2709
|
+
}
|
|
2710
|
+
})
|
|
2711
|
+
), {
|
|
2712
|
+
list: i.items.map((c) => ({
|
|
2713
|
+
id: c.id,
|
|
2714
|
+
status: c.status,
|
|
2715
|
+
label: c.label ?? null,
|
|
2716
|
+
createdAt: c.createdAt,
|
|
2717
|
+
expiresAt: c.expiresAt,
|
|
2718
|
+
amount: c.amount,
|
|
2719
|
+
createdBy: c.createdBy ? o.get(c.createdBy) ?? c.createdBy : null
|
|
2720
|
+
})),
|
|
2721
|
+
paging: {
|
|
2722
|
+
total: i.totalItems,
|
|
2723
|
+
currentPage: i.pageNumber,
|
|
2724
|
+
perPage: i.pageSize
|
|
2725
|
+
}
|
|
2726
|
+
};
|
|
2727
|
+
},
|
|
2616
2728
|
validateUser: async (e, n, t) => ({
|
|
2617
2729
|
isValid: !0
|
|
2618
2730
|
}),
|
|
2731
|
+
isOrganizationMember: async (e, n, t) => {
|
|
2732
|
+
const {
|
|
2733
|
+
clients: { commerce: r }
|
|
2734
|
+
} = t;
|
|
2735
|
+
return !!(await r.session("").catch(() => null))?.namespaces.authentication?.unitId?.value;
|
|
2736
|
+
},
|
|
2619
2737
|
// only b2b users
|
|
2620
2738
|
userDetails: async (e, n, t) => {
|
|
2621
2739
|
const {
|
|
2622
2740
|
account: r,
|
|
2623
2741
|
headers: i,
|
|
2624
2742
|
clients: { commerce: a }
|
|
2625
|
-
} = t, s = Z(
|
|
2743
|
+
} = t, s = Z(K(i?.cookie ?? "", r))?.userId ?? "", [c, d, g] = await Promise.all([
|
|
2626
2744
|
a.session("").catch(() => null),
|
|
2627
2745
|
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
2628
2746
|
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
2629
|
-
]), p = d?.[0],
|
|
2747
|
+
]), p = d?.[0], l = c?.namespaces.authentication ?? null, u = `${(p?.firstName ?? "").trim()} ${(p?.lastName ?? "").trim()}`.trim();
|
|
2630
2748
|
return {
|
|
2631
|
-
username:
|
|
2749
|
+
username: l?.storeUserEmail?.value ?? "",
|
|
2632
2750
|
name: u,
|
|
2633
|
-
email:
|
|
2751
|
+
email: l?.storeUserEmail?.value ?? "",
|
|
2634
2752
|
phone: p?.phone ?? "",
|
|
2635
2753
|
role: g?.Roles?.map((m) => m.Name) ?? [],
|
|
2636
|
-
orgUnit:
|
|
2754
|
+
orgUnit: l?.unitName?.value ?? ""
|
|
2637
2755
|
};
|
|
2638
2756
|
},
|
|
2639
2757
|
// If isRepresentative, return b2b information.
|
|
@@ -2643,14 +2761,14 @@ const Ur = (e, n) => {
|
|
|
2643
2761
|
account: r,
|
|
2644
2762
|
headers: i,
|
|
2645
2763
|
clients: { commerce: a }
|
|
2646
|
-
} = t, o = Z(
|
|
2764
|
+
} = t, o = Z(K(i?.cookie ?? "", r));
|
|
2647
2765
|
if (!o?.userId)
|
|
2648
2766
|
return null;
|
|
2649
2767
|
if (o?.isRepresentative) {
|
|
2650
|
-
const
|
|
2651
|
-
if (!
|
|
2768
|
+
const c = await a.session("").catch(() => null);
|
|
2769
|
+
if (!c)
|
|
2652
2770
|
return null;
|
|
2653
|
-
const d =
|
|
2771
|
+
const d = c.namespaces.profile ?? null;
|
|
2654
2772
|
return {
|
|
2655
2773
|
name: ((await a.masterData.getContractById({
|
|
2656
2774
|
contractId: d?.id?.value ?? ""
|
|
@@ -2678,9 +2796,9 @@ const Ur = (e, n) => {
|
|
|
2678
2796
|
geoCoordinates: n
|
|
2679
2797
|
});
|
|
2680
2798
|
},
|
|
2681
|
-
orderEntryOperation:
|
|
2682
|
-
orderFormItems:
|
|
2683
|
-
},
|
|
2799
|
+
orderEntryOperation: Mr,
|
|
2800
|
+
orderFormItems: $r
|
|
2801
|
+
}, jr = {
|
|
2684
2802
|
reviewRating: () => ({
|
|
2685
2803
|
ratingValue: 5,
|
|
2686
2804
|
bestRating: 5
|
|
@@ -2688,7 +2806,7 @@ const Ur = (e, n) => {
|
|
|
2688
2806
|
author: () => ({
|
|
2689
2807
|
name: ""
|
|
2690
2808
|
})
|
|
2691
|
-
},
|
|
2809
|
+
}, Wr = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, Gr = {
|
|
2692
2810
|
suggestions: async (e, n, t) => {
|
|
2693
2811
|
const {
|
|
2694
2812
|
clients: { search: r }
|
|
@@ -2704,19 +2822,19 @@ const Ur = (e, n) => {
|
|
|
2704
2822
|
const { productSearchPromise: a } = e, [o, s] = await Promise.all([
|
|
2705
2823
|
r.suggestedTerms(i),
|
|
2706
2824
|
a
|
|
2707
|
-
]),
|
|
2825
|
+
]), c = s.products.map((g) => {
|
|
2708
2826
|
const p = Se(g.items);
|
|
2709
|
-
return p &&
|
|
2827
|
+
return p && B(p, g);
|
|
2710
2828
|
}).filter((g) => !!g), { searches: d } = o;
|
|
2711
2829
|
return {
|
|
2712
2830
|
terms: d.map((g) => ({ value: g.term, count: g.count })),
|
|
2713
|
-
products:
|
|
2831
|
+
products: c
|
|
2714
2832
|
};
|
|
2715
2833
|
},
|
|
2716
2834
|
products: async ({ productSearchPromise: e }) => {
|
|
2717
2835
|
const n = await e, t = n.products.map((r) => {
|
|
2718
2836
|
const i = Se(r.items);
|
|
2719
|
-
return i &&
|
|
2837
|
+
return i && B(i, r);
|
|
2720
2838
|
}).filter((r) => !!r);
|
|
2721
2839
|
return {
|
|
2722
2840
|
pageInfo: {
|
|
@@ -2739,7 +2857,7 @@ const Ur = (e, n) => {
|
|
|
2739
2857
|
t.storage.searchArgs = e;
|
|
2740
2858
|
const { facets: i = [] } = await r.facets(e), a = !e.query, o = e.selectedFacets?.length ? e.selectedFacets[0].key === "category-1" : !1, s = e.selectedFacets?.length ? e.selectedFacets[0].key === "brand" : !1;
|
|
2741
2859
|
return i.filter(
|
|
2742
|
-
(d) => !a || !
|
|
2860
|
+
(d) => !a || !Wr(d, o, s)
|
|
2743
2861
|
);
|
|
2744
2862
|
},
|
|
2745
2863
|
metadata: async ({ productSearchPromise: e }) => {
|
|
@@ -2751,12 +2869,12 @@ const Ur = (e, n) => {
|
|
|
2751
2869
|
};
|
|
2752
2870
|
},
|
|
2753
2871
|
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
2754
|
-
},
|
|
2872
|
+
}, Hr = {
|
|
2755
2873
|
title: ({ title: e }) => e ?? "",
|
|
2756
2874
|
description: ({ description: e }) => e ?? "",
|
|
2757
2875
|
canonical: ({ canonical: e }) => e ?? "",
|
|
2758
2876
|
titleTemplate: () => ""
|
|
2759
|
-
},
|
|
2877
|
+
}, Xr = ["bd", "d", "h", "m"], Yr = (e) => Xr.includes(e), Jr = {
|
|
2760
2878
|
bd: {
|
|
2761
2879
|
0: "Today",
|
|
2762
2880
|
1: "In 1 business day",
|
|
@@ -2778,17 +2896,17 @@ const Ur = (e, n) => {
|
|
|
2778
2896
|
other: "Up to # minutes"
|
|
2779
2897
|
}
|
|
2780
2898
|
}, yn = (e) => {
|
|
2781
|
-
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i =
|
|
2899
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = Yr(t);
|
|
2782
2900
|
if (!r || !i)
|
|
2783
2901
|
return "";
|
|
2784
2902
|
const a = Number(n) < 2 ? Number(n) : "other";
|
|
2785
|
-
return
|
|
2786
|
-
},
|
|
2903
|
+
return Jr[t][a].replace("#", n) ?? "";
|
|
2904
|
+
}, Qr = {
|
|
2787
2905
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
2788
2906
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
2789
2907
|
localizedEstimates: (e) => e?.shippingEstimate ? yn(e.shippingEstimate) : ""
|
|
2790
2908
|
}, ze = "skuvariation";
|
|
2791
|
-
function
|
|
2909
|
+
function xe(e, n) {
|
|
2792
2910
|
const t = `${ze}${n}`.toLowerCase(), r = e.find(
|
|
2793
2911
|
(a) => a.imageLabel === t
|
|
2794
2912
|
);
|
|
@@ -2799,55 +2917,55 @@ function Ve(e, n) {
|
|
|
2799
2917
|
);
|
|
2800
2918
|
return i || e[0];
|
|
2801
2919
|
}
|
|
2802
|
-
function
|
|
2920
|
+
function Kr(e, n, t) {
|
|
2803
2921
|
const r = {};
|
|
2804
2922
|
return e.forEach((i) => {
|
|
2805
2923
|
const a = i.variations;
|
|
2806
2924
|
if (a.length === 0)
|
|
2807
2925
|
return;
|
|
2808
2926
|
const o = `${n}-${a.find(
|
|
2809
|
-
(
|
|
2810
|
-
)?.values[0] ?? ""}`, s = a.reduce((
|
|
2927
|
+
(c) => c.name === n
|
|
2928
|
+
)?.values[0] ?? ""}`, s = a.reduce((c, d) => d.name === n ? c : c + `-${d.name}-${d.values[0]}`, o);
|
|
2811
2929
|
r[s] = `${t}-${i.itemId}`;
|
|
2812
2930
|
}), r;
|
|
2813
2931
|
}
|
|
2814
|
-
function
|
|
2932
|
+
function Ve(e) {
|
|
2815
2933
|
const n = {};
|
|
2816
2934
|
return e.forEach((t) => {
|
|
2817
2935
|
n[t.name] = t.values[0];
|
|
2818
2936
|
}), n;
|
|
2819
2937
|
}
|
|
2820
|
-
function
|
|
2938
|
+
function Zr(e) {
|
|
2821
2939
|
const n = {};
|
|
2822
2940
|
return e?.forEach((t) => {
|
|
2823
2941
|
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
2824
2942
|
}), n;
|
|
2825
2943
|
}
|
|
2826
|
-
function
|
|
2944
|
+
function ei(e, n) {
|
|
2827
2945
|
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
2828
2946
|
}
|
|
2829
|
-
function
|
|
2947
|
+
function ni(e) {
|
|
2830
2948
|
const n = e;
|
|
2831
2949
|
for (const t in e)
|
|
2832
2950
|
e[t].every(
|
|
2833
2951
|
(i) => !Number.isNaN(Number(i.value))
|
|
2834
|
-
) && e[t].sort((i, a) =>
|
|
2952
|
+
) && e[t].sort((i, a) => ei(i.value, a.value));
|
|
2835
2953
|
return n;
|
|
2836
2954
|
}
|
|
2837
|
-
function
|
|
2955
|
+
function ti(e, n, t) {
|
|
2838
2956
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
2839
2957
|
return e.forEach((a) => {
|
|
2840
2958
|
if (a.variations.length === 0)
|
|
2841
2959
|
return;
|
|
2842
2960
|
const o = a.variations.find(
|
|
2843
|
-
(
|
|
2961
|
+
(c) => c.name === n
|
|
2844
2962
|
);
|
|
2845
2963
|
if (!(o?.values[0] === t)) {
|
|
2846
|
-
const
|
|
2847
|
-
if (!o || i.has(
|
|
2964
|
+
const c = `${n}-${o?.values[0]}`;
|
|
2965
|
+
if (!o || i.has(c))
|
|
2848
2966
|
return;
|
|
2849
|
-
i.add(
|
|
2850
|
-
const d =
|
|
2967
|
+
i.add(c);
|
|
2968
|
+
const d = xe(
|
|
2851
2969
|
a.images,
|
|
2852
2970
|
n
|
|
2853
2971
|
), g = {
|
|
@@ -2859,60 +2977,60 @@ function Qr(e, n, t) {
|
|
|
2859
2977
|
r[o.name] ? r[o.name].push(g) : r[o.name] = [g];
|
|
2860
2978
|
return;
|
|
2861
2979
|
}
|
|
2862
|
-
a.variations.forEach((
|
|
2863
|
-
const d = `${
|
|
2980
|
+
a.variations.forEach((c) => {
|
|
2981
|
+
const d = `${c.name}-${c.values[0]}`;
|
|
2864
2982
|
if (i.has(d))
|
|
2865
2983
|
return;
|
|
2866
2984
|
i.add(d);
|
|
2867
|
-
const g =
|
|
2985
|
+
const g = xe(
|
|
2868
2986
|
a.images,
|
|
2869
|
-
|
|
2987
|
+
c.name
|
|
2870
2988
|
), p = {
|
|
2871
2989
|
src: g.imageUrl,
|
|
2872
2990
|
alt: g.imageText ?? "",
|
|
2873
|
-
label: `${
|
|
2874
|
-
value:
|
|
2991
|
+
label: `${c.name}: ${c.values[0]}`,
|
|
2992
|
+
value: c.values[0]
|
|
2875
2993
|
};
|
|
2876
|
-
r[
|
|
2994
|
+
r[c.name] ? r[c.name].push(p) : r[c.name] = [p];
|
|
2877
2995
|
});
|
|
2878
|
-
}),
|
|
2996
|
+
}), ni(r);
|
|
2879
2997
|
}
|
|
2880
|
-
const
|
|
2881
|
-
activeVariations: (e) =>
|
|
2882
|
-
allVariantsByName: (e) =>
|
|
2883
|
-
slugsMap: (e, n) =>
|
|
2998
|
+
const ri = {
|
|
2999
|
+
activeVariations: (e) => Ve(e.variations),
|
|
3000
|
+
allVariantsByName: (e) => Zr(e.isVariantOf.skuSpecifications),
|
|
3001
|
+
slugsMap: (e, n) => Kr(
|
|
2884
3002
|
e.isVariantOf.items,
|
|
2885
3003
|
n.dominantVariantName ?? e.variations[0]?.name,
|
|
2886
3004
|
e.isVariantOf.linkText
|
|
2887
3005
|
),
|
|
2888
3006
|
availableVariations: (e, n) => {
|
|
2889
|
-
const t = n.dominantVariantName ?? e.variations[0]?.name, i =
|
|
2890
|
-
return
|
|
3007
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = Ve(e.variations)[t];
|
|
3008
|
+
return ti(
|
|
2891
3009
|
e.isVariantOf.items,
|
|
2892
3010
|
t,
|
|
2893
3011
|
i
|
|
2894
3012
|
);
|
|
2895
3013
|
},
|
|
2896
|
-
allVariantProducts: (e) => e.isVariantOf.items.map((n) =>
|
|
2897
|
-
},
|
|
3014
|
+
allVariantProducts: (e) => e.isVariantOf.items.map((n) => B(n, e.isVariantOf))
|
|
3015
|
+
}, ii = {
|
|
2898
3016
|
"pickup-in-point": "Pickup",
|
|
2899
3017
|
delivery: "Delivery",
|
|
2900
3018
|
pickup: "Pickup",
|
|
2901
3019
|
"take-away": "Take away",
|
|
2902
3020
|
"": ""
|
|
2903
|
-
},
|
|
3021
|
+
}, ai = {
|
|
2904
3022
|
deliveryOptionsData: (e) => {
|
|
2905
3023
|
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
|
|
2906
3024
|
(d, g) => {
|
|
2907
|
-
const p = g?.selectedSla || "",
|
|
2908
|
-
(
|
|
2909
|
-
), C = `${
|
|
3025
|
+
const p = g?.selectedSla || "", l = g?.selectedDeliveryChannel || g?.deliveryChannel || "", u = g?.deliveryCompany || "", m = g?.deliveryWindow, y = g?.pickupStoreInfo, f = g?.shippingEstimate || "", I = g?.shippingEstimate ? yn(g?.shippingEstimate) : "", D = g?.shippingEstimateDate || "", U = g?.addressId || "", w = g?.itemIndex ?? 0, O = t?.[w], P = O?.seller || "", h = `${p}|${l}|${u}|${P}|${f}|${D}|${U}|${m?.startDateUtc}|${m?.endDateUtc}`, b = i?.find(
|
|
3026
|
+
(k) => k?.addressId === U
|
|
3027
|
+
), C = `${ii[l] || ""} ${I} ${b?.neighborhood ? `to ${b?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: A, taxPriceTags: v } = oi(
|
|
2910
3028
|
O?.priceTags ?? []
|
|
2911
3029
|
), T = (O?.sellingPrice ?? 0) * (O?.quantity ?? 0) + (O?.tax ?? 0) + (A ?? 0);
|
|
2912
3030
|
return d[h] || (d[h] = {
|
|
2913
3031
|
// static fields
|
|
2914
3032
|
selectedSla: p,
|
|
2915
|
-
deliveryChannel:
|
|
3033
|
+
deliveryChannel: l,
|
|
2916
3034
|
deliveryCompany: u,
|
|
2917
3035
|
deliveryWindow: m,
|
|
2918
3036
|
shippingEstimate: f,
|
|
@@ -2921,7 +3039,7 @@ const Zr = {
|
|
|
2921
3039
|
friendlyShippingEstimate: I,
|
|
2922
3040
|
friendlyDeliveryOptionName: C,
|
|
2923
3041
|
address: b,
|
|
2924
|
-
pickupStoreInfo:
|
|
3042
|
+
pickupStoreInfo: y,
|
|
2925
3043
|
// dynamic fields
|
|
2926
3044
|
quantityOfDifferentItems: 0,
|
|
2927
3045
|
total: 0,
|
|
@@ -2941,14 +3059,14 @@ const Zr = {
|
|
|
2941
3059
|
}), d[h].quantityOfDifferentItems = (d[h].quantityOfDifferentItems ?? 0) + 1, d[h].total = (d[h].total ?? 0) + T), d;
|
|
2942
3060
|
},
|
|
2943
3061
|
{}
|
|
2944
|
-
), o = Object.values(a), s = n?.contactInformation?.[0],
|
|
3062
|
+
), o = Object.values(a), s = n?.contactInformation?.[0], c = {
|
|
2945
3063
|
name: `${s?.firstName ?? ""} ${s?.lastName ?? ""}`.trim() || o?.[0]?.address?.receiverName || "",
|
|
2946
3064
|
email: s?.email || "",
|
|
2947
3065
|
phone: s?.phone || ""
|
|
2948
3066
|
};
|
|
2949
3067
|
return {
|
|
2950
3068
|
deliveryOptions: o,
|
|
2951
|
-
contact:
|
|
3069
|
+
contact: c
|
|
2952
3070
|
};
|
|
2953
3071
|
},
|
|
2954
3072
|
customFields: (e) => {
|
|
@@ -2964,7 +3082,7 @@ const Zr = {
|
|
|
2964
3082
|
) || [];
|
|
2965
3083
|
}
|
|
2966
3084
|
};
|
|
2967
|
-
function
|
|
3085
|
+
function oi(e) {
|
|
2968
3086
|
const t = e.filter(
|
|
2969
3087
|
(i) => i?.name?.includes("TAX")
|
|
2970
3088
|
), r = t.reduce(
|
|
@@ -2976,28 +3094,28 @@ function ti(e) {
|
|
|
2976
3094
|
taxPriceTagsTotal: r
|
|
2977
3095
|
};
|
|
2978
3096
|
}
|
|
2979
|
-
const
|
|
3097
|
+
const si = {
|
|
2980
3098
|
StoreCollection: tn,
|
|
2981
|
-
StoreAggregateOffer:
|
|
2982
|
-
StoreProduct:
|
|
2983
|
-
StoreSeo:
|
|
2984
|
-
StoreFacet:
|
|
2985
|
-
StoreFacetBoolean:
|
|
2986
|
-
StoreFacetRange:
|
|
2987
|
-
StoreFacetValueBoolean:
|
|
2988
|
-
StoreOffer:
|
|
2989
|
-
StoreAggregateRating:
|
|
2990
|
-
StoreReview:
|
|
2991
|
-
StoreProductGroup:
|
|
2992
|
-
StoreSearchResult:
|
|
2993
|
-
StorePropertyValue:
|
|
2994
|
-
SkuVariants:
|
|
2995
|
-
ShippingSLA:
|
|
2996
|
-
UserOrderResult:
|
|
2997
|
-
ObjectOrString:
|
|
2998
|
-
Query:
|
|
2999
|
-
Mutation:
|
|
3000
|
-
},
|
|
3099
|
+
StoreAggregateOffer: xt,
|
|
3100
|
+
StoreProduct: Rr,
|
|
3101
|
+
StoreSeo: Hr,
|
|
3102
|
+
StoreFacet: Jt,
|
|
3103
|
+
StoreFacetBoolean: Qt,
|
|
3104
|
+
StoreFacetRange: Kt,
|
|
3105
|
+
StoreFacetValueBoolean: Zt,
|
|
3106
|
+
StoreOffer: Ar,
|
|
3107
|
+
StoreAggregateRating: Vt,
|
|
3108
|
+
StoreReview: jr,
|
|
3109
|
+
StoreProductGroup: Br,
|
|
3110
|
+
StoreSearchResult: Gr,
|
|
3111
|
+
StorePropertyValue: Lr,
|
|
3112
|
+
SkuVariants: ri,
|
|
3113
|
+
ShippingSLA: Qr,
|
|
3114
|
+
UserOrderResult: ai,
|
|
3115
|
+
ObjectOrString: Pr,
|
|
3116
|
+
Query: qr,
|
|
3117
|
+
Mutation: br
|
|
3118
|
+
}, ci = () => si, li = `"""
|
|
3001
3119
|
Address information.
|
|
3002
3120
|
"""
|
|
3003
3121
|
type Address {
|
|
@@ -3042,7 +3160,7 @@ type Address {
|
|
|
3042
3160
|
"""
|
|
3043
3161
|
geoCoordinates: [Float]
|
|
3044
3162
|
}
|
|
3045
|
-
`,
|
|
3163
|
+
`, di = `"""
|
|
3046
3164
|
Advertisement information about a specific product in a campaign
|
|
3047
3165
|
"""
|
|
3048
3166
|
type Advertisement {
|
|
@@ -3067,7 +3185,7 @@ type Advertisement {
|
|
|
3067
3185
|
"""
|
|
3068
3186
|
adResponseId: String!
|
|
3069
3187
|
}
|
|
3070
|
-
`,
|
|
3188
|
+
`, ui = `"""
|
|
3071
3189
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
3072
3190
|
"""
|
|
3073
3191
|
type StoreAggregateOffer {
|
|
@@ -3096,7 +3214,7 @@ type StoreAggregateOffer {
|
|
|
3096
3214
|
"""
|
|
3097
3215
|
offers: [StoreOffer!]!
|
|
3098
3216
|
}
|
|
3099
|
-
`,
|
|
3217
|
+
`, pi = `"""
|
|
3100
3218
|
Average rating, based on multiple ratings or reviews.
|
|
3101
3219
|
"""
|
|
3102
3220
|
type StoreAggregateRating {
|
|
@@ -3109,7 +3227,7 @@ type StoreAggregateRating {
|
|
|
3109
3227
|
"""
|
|
3110
3228
|
reviewCount: Int!
|
|
3111
3229
|
}
|
|
3112
|
-
`,
|
|
3230
|
+
`, gi = `"""
|
|
3113
3231
|
information about the author of a product review or rating.
|
|
3114
3232
|
"""
|
|
3115
3233
|
type StoreAuthor {
|
|
@@ -3118,7 +3236,7 @@ type StoreAuthor {
|
|
|
3118
3236
|
"""
|
|
3119
3237
|
name: String!
|
|
3120
3238
|
}
|
|
3121
|
-
`,
|
|
3239
|
+
`, mi = `"""
|
|
3122
3240
|
Brand of a given product.
|
|
3123
3241
|
"""
|
|
3124
3242
|
type StoreBrand {
|
|
@@ -3127,7 +3245,7 @@ type StoreBrand {
|
|
|
3127
3245
|
"""
|
|
3128
3246
|
name: String!
|
|
3129
3247
|
}
|
|
3130
|
-
`,
|
|
3248
|
+
`, hi = `"""
|
|
3131
3249
|
Item of a list.
|
|
3132
3250
|
"""
|
|
3133
3251
|
type StoreListItem {
|
|
@@ -3158,7 +3276,7 @@ type StoreBreadcrumbList {
|
|
|
3158
3276
|
"""
|
|
3159
3277
|
numberOfItems: Int!
|
|
3160
3278
|
}
|
|
3161
|
-
`,
|
|
3279
|
+
`, fi = `"""
|
|
3162
3280
|
Shopping cart message.
|
|
3163
3281
|
"""
|
|
3164
3282
|
type StoreCartMessage {
|
|
@@ -3195,7 +3313,7 @@ input IStoreCart {
|
|
|
3195
3313
|
"""
|
|
3196
3314
|
order: IStoreOrder!
|
|
3197
3315
|
}
|
|
3198
|
-
`,
|
|
3316
|
+
`, Si = `"""
|
|
3199
3317
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\`, \`Cluster\`, \`SubCategory\` or \`Collection\`.
|
|
3200
3318
|
"""
|
|
3201
3319
|
enum StoreCollectionType {
|
|
@@ -3278,7 +3396,7 @@ type StoreCollection {
|
|
|
3278
3396
|
"""
|
|
3279
3397
|
type: StoreCollectionType!
|
|
3280
3398
|
}
|
|
3281
|
-
`,
|
|
3399
|
+
`, yi = `"""
|
|
3282
3400
|
Delivery Promise badge.
|
|
3283
3401
|
"""
|
|
3284
3402
|
type DeliveryPromiseBadge {
|
|
@@ -3287,7 +3405,7 @@ type DeliveryPromiseBadge {
|
|
|
3287
3405
|
"""
|
|
3288
3406
|
typeName: String
|
|
3289
3407
|
}
|
|
3290
|
-
`,
|
|
3408
|
+
`, Ii = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
3291
3409
|
|
|
3292
3410
|
"""
|
|
3293
3411
|
Search facet range information.
|
|
@@ -3364,7 +3482,7 @@ type StoreFacetValueBoolean {
|
|
|
3364
3482
|
"""
|
|
3365
3483
|
quantity: Int
|
|
3366
3484
|
}
|
|
3367
|
-
`,
|
|
3485
|
+
`, vi = `"""
|
|
3368
3486
|
Image.
|
|
3369
3487
|
"""
|
|
3370
3488
|
type StoreImage {
|
|
@@ -3391,7 +3509,7 @@ input IStoreImage {
|
|
|
3391
3509
|
"""
|
|
3392
3510
|
alternateName: String!
|
|
3393
3511
|
}
|
|
3394
|
-
`,
|
|
3512
|
+
`, Oi = `type Mutation {
|
|
3395
3513
|
"""
|
|
3396
3514
|
Checks for changes between the cart presented in the UI and the cart stored in the ecommerce platform. If changes are detected, it returns the cart stored on the platform. Otherwise, it returns \`null\`.
|
|
3397
3515
|
"""
|
|
@@ -3429,7 +3547,7 @@ input IStoreImage {
|
|
|
3429
3547
|
data: IOrderEntryOperation!
|
|
3430
3548
|
): StoreOrderEntryOperationResult @auth
|
|
3431
3549
|
}
|
|
3432
|
-
`,
|
|
3550
|
+
`, Ci = `"""
|
|
3433
3551
|
Newsletter information.
|
|
3434
3552
|
"""
|
|
3435
3553
|
type PersonNewsletter {
|
|
@@ -3452,8 +3570,8 @@ input IPersonNewsletter {
|
|
|
3452
3570
|
"""
|
|
3453
3571
|
email: String!
|
|
3454
3572
|
}
|
|
3455
|
-
`,
|
|
3456
|
-
`,
|
|
3573
|
+
`, bi = `scalar ObjectOrString
|
|
3574
|
+
`, Di = `"""
|
|
3457
3575
|
Offer information.
|
|
3458
3576
|
"""
|
|
3459
3577
|
type StoreOffer {
|
|
@@ -3536,7 +3654,7 @@ input IStoreOffer {
|
|
|
3536
3654
|
"""
|
|
3537
3655
|
quantity: Int!
|
|
3538
3656
|
}
|
|
3539
|
-
`,
|
|
3657
|
+
`, wi = `"""
|
|
3540
3658
|
Information of a specific order.
|
|
3541
3659
|
"""
|
|
3542
3660
|
type StoreOrder {
|
|
@@ -3571,7 +3689,7 @@ input IStoreOrder {
|
|
|
3571
3689
|
"""
|
|
3572
3690
|
shouldSplitItem: Boolean
|
|
3573
3691
|
}
|
|
3574
|
-
`,
|
|
3692
|
+
`, Pi = `"""
|
|
3575
3693
|
Commercial Authorization response.
|
|
3576
3694
|
"""
|
|
3577
3695
|
type CommercialAuthorizationResponse {
|
|
@@ -3970,7 +4088,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
3970
4088
|
"""
|
|
3971
4089
|
rule: CommercialAuthorizationRule!
|
|
3972
4090
|
}
|
|
3973
|
-
`,
|
|
4091
|
+
`, Ai = `"""
|
|
3974
4092
|
Input for uploading a file to the Order Entry Service.
|
|
3975
4093
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
3976
4094
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -4031,7 +4149,7 @@ type StoreOrderFormCartItem {
|
|
|
4031
4149
|
seller: String!
|
|
4032
4150
|
unitMultiplier: Float
|
|
4033
4151
|
}
|
|
4034
|
-
`,
|
|
4152
|
+
`, Ui = `"""
|
|
4035
4153
|
Organization.
|
|
4036
4154
|
"""
|
|
4037
4155
|
type StoreOrganization {
|
|
@@ -4050,7 +4168,7 @@ input IStoreOrganization {
|
|
|
4050
4168
|
"""
|
|
4051
4169
|
identifier: String!
|
|
4052
4170
|
}
|
|
4053
|
-
`,
|
|
4171
|
+
`, Ei = `"""
|
|
4054
4172
|
Whenever you make a query that allows for pagination, such as \`allProducts\` or \`allCollections\`, you can check \`StorePageInfo\` to learn more about the complete set of items and use it to paginate your queries.
|
|
4055
4173
|
"""
|
|
4056
4174
|
type StorePageInfo {
|
|
@@ -4075,7 +4193,7 @@ type StorePageInfo {
|
|
|
4075
4193
|
"""
|
|
4076
4194
|
totalCount: Int!
|
|
4077
4195
|
}
|
|
4078
|
-
`,
|
|
4196
|
+
`, Ti = `"""
|
|
4079
4197
|
Input type for setting a new password.
|
|
4080
4198
|
"""
|
|
4081
4199
|
input ISetPassword {
|
|
@@ -4118,7 +4236,7 @@ type SetPasswordResponse {
|
|
|
4118
4236
|
"""
|
|
4119
4237
|
message: String
|
|
4120
4238
|
}
|
|
4121
|
-
`,
|
|
4239
|
+
`, _i = `"""
|
|
4122
4240
|
Client profile data.
|
|
4123
4241
|
"""
|
|
4124
4242
|
type StorePerson {
|
|
@@ -4161,7 +4279,7 @@ input IStorePerson {
|
|
|
4161
4279
|
"""
|
|
4162
4280
|
familyName: String!
|
|
4163
4281
|
}
|
|
4164
|
-
`,
|
|
4282
|
+
`, ki = `type PickupPointAddress {
|
|
4165
4283
|
"""
|
|
4166
4284
|
Address city.
|
|
4167
4285
|
"""
|
|
@@ -4240,7 +4358,7 @@ type PickupPoints {
|
|
|
4240
4358
|
"""
|
|
4241
4359
|
pickupPointsHash: String
|
|
4242
4360
|
}
|
|
4243
|
-
`,
|
|
4361
|
+
`, Fi = `"""
|
|
4244
4362
|
Product information. Products are variants within product groups, equivalent to VTEX [SKUs](https://help.vtex.com/en/tutorial/what-is-an-sku--1K75s4RXAQyOuGUYKMM68u#). For example, you may have a **Shirt** product group with associated products such as **Blue shirt size L**, **Green shirt size XL** and so on.
|
|
4245
4363
|
"""
|
|
4246
4364
|
type StoreProduct {
|
|
@@ -4389,7 +4507,7 @@ input IStoreProduct {
|
|
|
4389
4507
|
"""
|
|
4390
4508
|
additionalProperty: [IStorePropertyValue!]
|
|
4391
4509
|
}
|
|
4392
|
-
`,
|
|
4510
|
+
`, Ri = `"""
|
|
4393
4511
|
Product group information. Product groups are catalog entities that may contain variants. They are equivalent to VTEX [Products](https://help.vtex.com/en/tutorial/what-is-a-product--2zrB2gFCHyQokCKKE8kuAw#), whereas each variant is equivalent to a VTEX [SKU](https://help.vtex.com/en/tutorial/what-is-an-sku--1K75s4RXAQyOuGUYKMM68u#). For example, you may have a **Shirt** product group with associated products such as **Blue shirt size L**, **Green shirt size XL** and so on.
|
|
4394
4512
|
"""
|
|
4395
4513
|
type StoreProductGroup {
|
|
@@ -4416,7 +4534,7 @@ type StoreProductGroup {
|
|
|
4416
4534
|
"""
|
|
4417
4535
|
skuVariants: SkuVariants
|
|
4418
4536
|
}
|
|
4419
|
-
`,
|
|
4537
|
+
`, Ni = `type Profile {
|
|
4420
4538
|
"""
|
|
4421
4539
|
Collection of user's address
|
|
4422
4540
|
"""
|
|
@@ -4477,7 +4595,7 @@ type ProfileAddress {
|
|
|
4477
4595
|
"""
|
|
4478
4596
|
geoCoordinate: [Float]
|
|
4479
4597
|
}
|
|
4480
|
-
`,
|
|
4598
|
+
`, Bi = `"""
|
|
4481
4599
|
Properties that can be associated with products and products groups.
|
|
4482
4600
|
"""
|
|
4483
4601
|
type StorePropertyValue {
|
|
@@ -4517,7 +4635,7 @@ input IStorePropertyValue {
|
|
|
4517
4635
|
"""
|
|
4518
4636
|
valueReference: ObjectOrString!
|
|
4519
4637
|
}
|
|
4520
|
-
`,
|
|
4638
|
+
`, Li = `"""
|
|
4521
4639
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
4522
4640
|
"""
|
|
4523
4641
|
type StoreProductEdge {
|
|
@@ -4949,6 +5067,46 @@ type Query {
|
|
|
4949
5067
|
@auth
|
|
4950
5068
|
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
4951
5069
|
|
|
5070
|
+
"""
|
|
5071
|
+
Returns the list of Quotes that the authenticated Buyer can view.
|
|
5072
|
+
"""
|
|
5073
|
+
listUserQuotes(
|
|
5074
|
+
"""
|
|
5075
|
+
Page number (1-based).
|
|
5076
|
+
"""
|
|
5077
|
+
page: Int
|
|
5078
|
+
"""
|
|
5079
|
+
Number of items per page.
|
|
5080
|
+
"""
|
|
5081
|
+
perPage: Int
|
|
5082
|
+
"""
|
|
5083
|
+
Filter by quote status values.
|
|
5084
|
+
"""
|
|
5085
|
+
status: [String]
|
|
5086
|
+
"""
|
|
5087
|
+
Filter quotes created on or after this ISO 8601 date-time.
|
|
5088
|
+
"""
|
|
5089
|
+
createdAtFrom: String
|
|
5090
|
+
"""
|
|
5091
|
+
Filter quotes created on or before this ISO 8601 date-time.
|
|
5092
|
+
"""
|
|
5093
|
+
createdAtTo: String
|
|
5094
|
+
"""
|
|
5095
|
+
Filter quotes expiring on or after this ISO 8601 date-time.
|
|
5096
|
+
"""
|
|
5097
|
+
expiresAtFrom: String
|
|
5098
|
+
"""
|
|
5099
|
+
Filter quotes expiring on or before this ISO 8601 date-time.
|
|
5100
|
+
"""
|
|
5101
|
+
expiresAtTo: String
|
|
5102
|
+
"""
|
|
5103
|
+
Filter quotes by label (partial match).
|
|
5104
|
+
"""
|
|
5105
|
+
label: String
|
|
5106
|
+
): UserQuoteListResult
|
|
5107
|
+
@auth
|
|
5108
|
+
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
5109
|
+
|
|
4952
5110
|
"""
|
|
4953
5111
|
Returns information about the current user details.
|
|
4954
5112
|
"""
|
|
@@ -4970,6 +5128,13 @@ type Query {
|
|
|
4970
5128
|
@auth
|
|
4971
5129
|
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
4972
5130
|
|
|
5131
|
+
"""
|
|
5132
|
+
Returns whether the current authenticated user belongs to a B2B organization unit.
|
|
5133
|
+
"""
|
|
5134
|
+
isOrganizationMember: Boolean!
|
|
5135
|
+
@auth
|
|
5136
|
+
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
5137
|
+
|
|
4973
5138
|
"""
|
|
4974
5139
|
Returns a list of pickup points near to the given geo coordinates.
|
|
4975
5140
|
"""
|
|
@@ -5079,7 +5244,72 @@ type StoreAccountProfile {
|
|
|
5079
5244
|
email: String
|
|
5080
5245
|
id: String
|
|
5081
5246
|
}
|
|
5082
|
-
`,
|
|
5247
|
+
`, Mi = `"""
|
|
5248
|
+
Summary of a quote returned in list results.
|
|
5249
|
+
"""
|
|
5250
|
+
type UserQuoteSummary {
|
|
5251
|
+
"""
|
|
5252
|
+
Unique identifier of the quote.
|
|
5253
|
+
"""
|
|
5254
|
+
id: String!
|
|
5255
|
+
"""
|
|
5256
|
+
Status of the quote.
|
|
5257
|
+
"""
|
|
5258
|
+
status: String!
|
|
5259
|
+
"""
|
|
5260
|
+
Optional label assigned to the quote.
|
|
5261
|
+
"""
|
|
5262
|
+
label: String
|
|
5263
|
+
"""
|
|
5264
|
+
ISO 8601 date-time when the quote was created.
|
|
5265
|
+
"""
|
|
5266
|
+
createdAt: String!
|
|
5267
|
+
"""
|
|
5268
|
+
ISO 8601 date-time when the quote expires.
|
|
5269
|
+
"""
|
|
5270
|
+
expiresAt: String!
|
|
5271
|
+
"""
|
|
5272
|
+
Total amount of the quote.
|
|
5273
|
+
"""
|
|
5274
|
+
amount: Float!
|
|
5275
|
+
"""
|
|
5276
|
+
Name or email of the user who created the quote.
|
|
5277
|
+
"""
|
|
5278
|
+
createdBy: String
|
|
5279
|
+
}
|
|
5280
|
+
|
|
5281
|
+
"""
|
|
5282
|
+
Result returned by the listUserQuotes query.
|
|
5283
|
+
"""
|
|
5284
|
+
type UserQuoteListResult {
|
|
5285
|
+
"""
|
|
5286
|
+
Array of quote summaries for the current page.
|
|
5287
|
+
"""
|
|
5288
|
+
list: [UserQuoteSummary!]!
|
|
5289
|
+
"""
|
|
5290
|
+
Pagination information.
|
|
5291
|
+
"""
|
|
5292
|
+
paging: UserQuoteListPaging!
|
|
5293
|
+
}
|
|
5294
|
+
|
|
5295
|
+
"""
|
|
5296
|
+
Pagination metadata for the quotes list.
|
|
5297
|
+
"""
|
|
5298
|
+
type UserQuoteListPaging {
|
|
5299
|
+
"""
|
|
5300
|
+
Total number of quotes matching the query.
|
|
5301
|
+
"""
|
|
5302
|
+
total: Int!
|
|
5303
|
+
"""
|
|
5304
|
+
Current page number (1-based).
|
|
5305
|
+
"""
|
|
5306
|
+
currentPage: Int!
|
|
5307
|
+
"""
|
|
5308
|
+
Number of items per page.
|
|
5309
|
+
"""
|
|
5310
|
+
perPage: Int!
|
|
5311
|
+
}
|
|
5312
|
+
`, $i = `"""
|
|
5083
5313
|
Information of a given review rating.
|
|
5084
5314
|
"""
|
|
5085
5315
|
type StoreReviewRating {
|
|
@@ -5106,7 +5336,7 @@ type StoreReview {
|
|
|
5106
5336
|
"""
|
|
5107
5337
|
author: StoreAuthor!
|
|
5108
5338
|
}
|
|
5109
|
-
`,
|
|
5339
|
+
`, zi = `"""
|
|
5110
5340
|
Search Engine Optimization (SEO) tags data.
|
|
5111
5341
|
"""
|
|
5112
5342
|
type StoreSeo {
|
|
@@ -5127,7 +5357,7 @@ type StoreSeo {
|
|
|
5127
5357
|
"""
|
|
5128
5358
|
canonical: String!
|
|
5129
5359
|
}
|
|
5130
|
-
`,
|
|
5360
|
+
`, xi = `"""
|
|
5131
5361
|
Currency information.
|
|
5132
5362
|
"""
|
|
5133
5363
|
type StoreCurrency {
|
|
@@ -5402,7 +5632,7 @@ input IStoreSession {
|
|
|
5402
5632
|
"""
|
|
5403
5633
|
refreshAfter: String
|
|
5404
5634
|
}
|
|
5405
|
-
`,
|
|
5635
|
+
`, Vi = `"""
|
|
5406
5636
|
Shipping Simulation item input.
|
|
5407
5637
|
"""
|
|
5408
5638
|
input IShippingItem {
|
|
@@ -5733,7 +5963,7 @@ type MessageFields {
|
|
|
5733
5963
|
"""
|
|
5734
5964
|
skuName: String
|
|
5735
5965
|
}
|
|
5736
|
-
`,
|
|
5966
|
+
`, qi = `type SkuVariants {
|
|
5737
5967
|
"""
|
|
5738
5968
|
SKU property values for the current SKU.
|
|
5739
5969
|
"""
|
|
@@ -5828,7 +6058,7 @@ Example:
|
|
|
5828
6058
|
\`\`\`
|
|
5829
6059
|
"""
|
|
5830
6060
|
scalar FormattedVariants
|
|
5831
|
-
`,
|
|
6061
|
+
`, ji = `"""
|
|
5832
6062
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
5833
6063
|
"""
|
|
5834
6064
|
enum StoreStatus {
|
|
@@ -5836,7 +6066,7 @@ enum StoreStatus {
|
|
|
5836
6066
|
WARNING
|
|
5837
6067
|
ERROR
|
|
5838
6068
|
}
|
|
5839
|
-
`,
|
|
6069
|
+
`, Wi = `scalar JSONObject
|
|
5840
6070
|
|
|
5841
6071
|
type UserOrder {
|
|
5842
6072
|
orderId: String
|
|
@@ -6660,95 +6890,96 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
6660
6890
|
type: String
|
|
6661
6891
|
id: String
|
|
6662
6892
|
}
|
|
6663
|
-
`,
|
|
6664
|
-
"./address.graphql":
|
|
6665
|
-
"./advertisement.graphql":
|
|
6666
|
-
"./aggregateOffer.graphql":
|
|
6667
|
-
"./aggregateRating.graphql":
|
|
6668
|
-
"./author.graphql":
|
|
6669
|
-
"./brand.graphql":
|
|
6670
|
-
"./breadcrumb.graphql":
|
|
6671
|
-
"./cart.graphql":
|
|
6672
|
-
"./collection.graphql":
|
|
6673
|
-
"./deliveryPromisesBadge.graphql":
|
|
6674
|
-
"./facet.graphql":
|
|
6675
|
-
"./image.graphql":
|
|
6676
|
-
"./mutation.graphql":
|
|
6677
|
-
"./newsletter.graphql":
|
|
6678
|
-
"./objectOrString.graphql":
|
|
6679
|
-
"./offer.graphql":
|
|
6680
|
-
"./order.graphql":
|
|
6681
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
6682
|
-
"./orderEntry.graphql":
|
|
6683
|
-
"./organization.graphql":
|
|
6684
|
-
"./pageInfo.graphql":
|
|
6685
|
-
"./password.graphql":
|
|
6686
|
-
"./person.graphql":
|
|
6687
|
-
"./pickupPoints.graphql":
|
|
6688
|
-
"./product.graphql":
|
|
6689
|
-
"./productGroup.graphql":
|
|
6690
|
-
"./profile.graphql":
|
|
6691
|
-
"./propertyValue.graphql":
|
|
6692
|
-
"./query.graphql":
|
|
6693
|
-
"./
|
|
6694
|
-
"./
|
|
6695
|
-
"./
|
|
6696
|
-
"./
|
|
6697
|
-
"./
|
|
6698
|
-
"./
|
|
6699
|
-
"./
|
|
6700
|
-
|
|
6701
|
-
|
|
6893
|
+
`, Gi = /* @__PURE__ */ Object.assign({
|
|
6894
|
+
"./address.graphql": li,
|
|
6895
|
+
"./advertisement.graphql": di,
|
|
6896
|
+
"./aggregateOffer.graphql": ui,
|
|
6897
|
+
"./aggregateRating.graphql": pi,
|
|
6898
|
+
"./author.graphql": gi,
|
|
6899
|
+
"./brand.graphql": mi,
|
|
6900
|
+
"./breadcrumb.graphql": hi,
|
|
6901
|
+
"./cart.graphql": fi,
|
|
6902
|
+
"./collection.graphql": Si,
|
|
6903
|
+
"./deliveryPromisesBadge.graphql": yi,
|
|
6904
|
+
"./facet.graphql": Ii,
|
|
6905
|
+
"./image.graphql": vi,
|
|
6906
|
+
"./mutation.graphql": Oi,
|
|
6907
|
+
"./newsletter.graphql": Ci,
|
|
6908
|
+
"./objectOrString.graphql": bi,
|
|
6909
|
+
"./offer.graphql": Di,
|
|
6910
|
+
"./order.graphql": wi,
|
|
6911
|
+
"./orderCommercialAuthorizaton.graphql": Pi,
|
|
6912
|
+
"./orderEntry.graphql": Ai,
|
|
6913
|
+
"./organization.graphql": Ui,
|
|
6914
|
+
"./pageInfo.graphql": Ei,
|
|
6915
|
+
"./password.graphql": Ti,
|
|
6916
|
+
"./person.graphql": _i,
|
|
6917
|
+
"./pickupPoints.graphql": ki,
|
|
6918
|
+
"./product.graphql": Fi,
|
|
6919
|
+
"./productGroup.graphql": Ri,
|
|
6920
|
+
"./profile.graphql": Ni,
|
|
6921
|
+
"./propertyValue.graphql": Bi,
|
|
6922
|
+
"./query.graphql": Li,
|
|
6923
|
+
"./quote.graphql": Mi,
|
|
6924
|
+
"./review.graphql": $i,
|
|
6925
|
+
"./seo.graphql": zi,
|
|
6926
|
+
"./session.graphql": xi,
|
|
6927
|
+
"./shipping.graphql": Vi,
|
|
6928
|
+
"./skuVariants.graphql": qi,
|
|
6929
|
+
"./status.graphql": ji,
|
|
6930
|
+
"./userOrder.graphql": Wi
|
|
6931
|
+
}), Hi = bn(
|
|
6932
|
+
Object.values(Gi).map((e) => Dn(e)).reduce(
|
|
6702
6933
|
(e, n) => qe([e, n], { sort: !0 })
|
|
6703
6934
|
)
|
|
6704
|
-
),
|
|
6935
|
+
), Xi = Hi, pa = async (e) => N.context.with(
|
|
6705
6936
|
N.propagation.extract(N.context.active(), e.OTEL),
|
|
6706
6937
|
() => (n) => (n.storage = {
|
|
6707
6938
|
channel: ee.parse(e.channel),
|
|
6708
6939
|
flags: e.flags ?? {},
|
|
6709
6940
|
locale: e.locale,
|
|
6710
6941
|
cookies: /* @__PURE__ */ new Map()
|
|
6711
|
-
}, n.clients =
|
|
6942
|
+
}, n.clients = At(e, n), n.loaders = Lt(e, n), n.account = e.account, n.OTEL = e.OTEL, n.discoveryConfig = e.discoveryConfig, n)
|
|
6712
6943
|
);
|
|
6713
|
-
function
|
|
6714
|
-
const e =
|
|
6944
|
+
function Yi() {
|
|
6945
|
+
const e = ci(), n = {};
|
|
6715
6946
|
for (const [t, r] of Object.entries(e))
|
|
6716
6947
|
n[t] = Object.fromEntries(
|
|
6717
6948
|
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, qn(a, `${t}(${i})`)])
|
|
6718
6949
|
);
|
|
6719
6950
|
return n;
|
|
6720
6951
|
}
|
|
6721
|
-
function
|
|
6722
|
-
const t =
|
|
6723
|
-
|
|
6952
|
+
function ga(e) {
|
|
6953
|
+
const t = Vn([
|
|
6954
|
+
xn,
|
|
6724
6955
|
Mn
|
|
6725
|
-
])(
|
|
6956
|
+
])(Yi(), Xi);
|
|
6726
6957
|
return e && wn(e) ? On({
|
|
6727
6958
|
schemas: [t, e]
|
|
6728
6959
|
}) : t;
|
|
6729
6960
|
}
|
|
6730
6961
|
export {
|
|
6731
6962
|
Mn as AuthDirective,
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6963
|
+
E as BadRequestError,
|
|
6964
|
+
xn as CacheControlDirective,
|
|
6965
|
+
En as CommercialAuthorizationStatus,
|
|
6735
6966
|
X as FastStoreError,
|
|
6736
6967
|
re as ForbiddenError,
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6968
|
+
pa as GraphqlVtexContextFactory,
|
|
6969
|
+
ga as GraphqlVtexSchema,
|
|
6970
|
+
L as NotFoundError,
|
|
6740
6971
|
Tn as StoreCollectionType,
|
|
6741
|
-
|
|
6742
|
-
|
|
6972
|
+
_n as StoreFacetType,
|
|
6973
|
+
kn as StoreSort,
|
|
6743
6974
|
Fn as StoreStatus,
|
|
6744
6975
|
J as UnauthorizedError,
|
|
6745
6976
|
Rn as UserOrderInvoiceType,
|
|
6746
|
-
|
|
6747
|
-
|
|
6977
|
+
da as isBadRequestError,
|
|
6978
|
+
la as isFastStoreError,
|
|
6748
6979
|
jn as isForbiddenError,
|
|
6749
6980
|
He as isNotFoundError,
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6981
|
+
ua as isUnauthorizedError,
|
|
6982
|
+
ca as stringifyCacheControl,
|
|
6983
|
+
Xi as typeDefs,
|
|
6984
|
+
Vn as withDirectives
|
|
6754
6985
|
};
|