@faststore/api 4.3.0-dev.4 → 4.3.0-dev.5
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 +40 -40
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +1008 -985
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/index.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts.map +1 -1
- package/dist/src/platforms/vtex/utils/cookies.d.ts +0 -1
- package/dist/src/platforms/vtex/utils/cookies.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/platforms/vtex/clients/commerce/index.ts +73 -35
- package/src/platforms/vtex/utils/cookies.ts +0 -19
package/dist/es/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
1
|
+
import { mergeTypeDefs as zn } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as he, mergeSchemas as fe } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as Vn, MapperKind as xn, getDirective as qn } from "@graphql-tools/utils";
|
|
4
4
|
import { OTELAPI as M } from "@faststore/diagnostics";
|
|
5
|
-
import { GraphQLScalarType as
|
|
5
|
+
import { GraphQLScalarType as Se, print as ye, parse as Ie, isSchema as ve } from "graphql";
|
|
6
6
|
import { parse as tn } from "cookie";
|
|
7
|
-
import
|
|
7
|
+
import Oe from "isomorphic-unfetch";
|
|
8
8
|
import rn from "dataloader";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import jn from "p-limit";
|
|
10
|
+
import Ce from "sanitize-html";
|
|
11
11
|
import Cn from "fast-deep-equal";
|
|
12
|
-
import
|
|
13
|
-
var
|
|
12
|
+
import be from "node:crypto";
|
|
13
|
+
var De = /* @__PURE__ */ ((n) => (n.Accepted = "accepted", n.Denied = "denied", n.Pending = "pending", n))(De || {}), we = /* @__PURE__ */ ((n) => (n.Brand = "Brand", n.Category = "Category", n.Cluster = "Cluster", n.Collection = "Collection", n.Department = "Department", n.SubCategory = "SubCategory", n))(we || {}), Ae = /* @__PURE__ */ ((n) => (n.Boolean = "BOOLEAN", n.Range = "RANGE", n))(Ae || {}), Pe = /* @__PURE__ */ ((n) => (n.DiscountDesc = "discount_desc", n.NameAsc = "name_asc", n.NameDesc = "name_desc", n.OrdersDesc = "orders_desc", n.PriceAsc = "price_asc", n.PriceDesc = "price_desc", n.ReleaseDesc = "release_desc", n.ScoreDesc = "score_desc", n))(Pe || {}), Ee = /* @__PURE__ */ ((n) => (n.Error = "ERROR", n.Info = "INFO", n.Warning = "WARNING", n))(Ee || {}), Te = /* @__PURE__ */ ((n) => (n.Input = "Input", n.Output = "Output", n))(Te || {});
|
|
14
14
|
const _e = () => function(e = {}) {
|
|
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 _e = () => function(e = {}) {
|
|
|
20
20
|
"X-VTEX-API-AppKey": t,
|
|
21
21
|
"X-VTEX-API-AppToken": r
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, Ue = async (n) => {
|
|
24
24
|
const {
|
|
25
25
|
clients: { commerce: e }
|
|
26
26
|
} = n;
|
|
@@ -31,67 +31,67 @@ const _e = () => function(e = {}) {
|
|
|
31
31
|
const r = t.extensions?.status ?? t.status;
|
|
32
32
|
throw r === 401 ? new J("Authentication required") : r === 403 ? new an("You are not allowed to access this resource") : new J("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, ke = "auth", Fe = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (n) =>
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
36
|
+
transformer: (n) => Vn(n, {
|
|
37
|
+
[xn.OBJECT_FIELD]: (e) => {
|
|
38
|
+
if (qn(n, e, ke)?.[0]) {
|
|
39
39
|
const r = e.resolve;
|
|
40
|
-
e.resolve = async (i, a,
|
|
40
|
+
e.resolve = async (i, a, c, s) => (await Ue(c), r?.(i, a, c, s));
|
|
41
41
|
}
|
|
42
42
|
return e;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
}, Ne = "cacheControl",
|
|
45
|
+
}, Ne = "cacheControl", Ui = (n, e) => {
|
|
46
46
|
const {
|
|
47
47
|
scope: t = "private",
|
|
48
48
|
sMaxAge: r = 0,
|
|
49
49
|
staleWhileRevalidate: i = 0
|
|
50
50
|
} = n;
|
|
51
51
|
return `${e ? "private" : t}, s-maxage=${r}, stale-while-revalidate=${i}`;
|
|
52
|
-
},
|
|
52
|
+
}, bn = (n, e) => typeof n == "number" && typeof e == "number" ? n > e ? e : n : typeof n == "number" ? n : e, Re = (n, e) => typeof n == "string" && typeof e == "string" ? n === "public" && e === "public" ? "public" : "private" : n || e, Le = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (n) =>
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (n) => Vn(n, {
|
|
55
|
+
[xn.OBJECT_FIELD]: (e) => {
|
|
56
|
+
const t = qn(n, e, Ne)?.[0];
|
|
57
57
|
if (t) {
|
|
58
|
-
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t,
|
|
59
|
-
e.resolve = (s,
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
62
|
-
|
|
58
|
+
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, c = e.resolve;
|
|
59
|
+
e.resolve = (s, l, d, g) => (d.cacheControl = {
|
|
60
|
+
sMaxAge: bn(d.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: bn(
|
|
62
|
+
d.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
66
|
-
},
|
|
65
|
+
scope: Re(d.cacheControl?.scope, a)
|
|
66
|
+
}, c?.(s, l, d, g));
|
|
67
67
|
}
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
71
|
+
}, Me = (n) => (e, t) => {
|
|
72
|
+
const r = zn([
|
|
73
73
|
...(n ?? []).map(({ typeDefs: i }) => i),
|
|
74
74
|
t
|
|
75
75
|
]);
|
|
76
76
|
return (n ?? []).reduce(
|
|
77
77
|
(i, { transformer: a }) => a?.(i) ?? i,
|
|
78
|
-
|
|
78
|
+
he({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: e
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
}, cn = "@faststore/api", ln = "4.3.0-dev.
|
|
83
|
+
}, cn = "@faststore/api", ln = "4.3.0-dev.4", Dn = {
|
|
84
84
|
name: cn,
|
|
85
85
|
version: ln
|
|
86
|
-
},
|
|
86
|
+
}, Be = (n, e) => (t, r, i, a) => {
|
|
87
87
|
if ((i?.OTEL?.enabled ?? !1) === !1)
|
|
88
88
|
return n(t, r, i, a);
|
|
89
|
-
const
|
|
89
|
+
const c = M.trace.getTracer(cn, ln), s = M.propagation.extract(
|
|
90
90
|
M.context.active(),
|
|
91
91
|
i.OTEL
|
|
92
92
|
);
|
|
93
93
|
return M.context.with(s, () => {
|
|
94
|
-
const
|
|
94
|
+
const l = c.startSpan(e ?? "Unknown Graphql Resolver", {
|
|
95
95
|
startTime: Date.now(),
|
|
96
96
|
kind: M.SpanKind.INTERNAL,
|
|
97
97
|
attributes: {
|
|
@@ -102,12 +102,12 @@ const _e = () => function(e = {}) {
|
|
|
102
102
|
"@faststore_environment": process.env.NODE_ENV
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
|
-
if (!
|
|
105
|
+
if (!l) return n(t, r, i, a);
|
|
106
106
|
try {
|
|
107
|
-
const
|
|
108
|
-
return
|
|
109
|
-
} catch (
|
|
110
|
-
throw
|
|
107
|
+
const d = n(t, r, i, a);
|
|
108
|
+
return d instanceof Promise ? d.then((g) => (l.end(), g)) : (l.end(), d);
|
|
109
|
+
} catch (d) {
|
|
110
|
+
throw l.end(), console.error(`Error when executing resolver: ${e}`, d), d;
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
};
|
|
@@ -136,12 +136,12 @@ class z extends X {
|
|
|
136
136
|
super({ status: 404, type: "NotFoundError" }, e);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const
|
|
140
|
-
const r = await
|
|
139
|
+
const ki = (n) => n?.name === "FastStoreError", Fi = (n) => n?.extensions?.type === "BadRequestError", Ni = (n) => n?.extensions?.type === "UnauthorizedError", $e = (n) => n?.extensions?.type === "ForbiddenError", ze = (n) => n?.extensions?.type === "NotFoundError", Ve = `${Dn.name}@${Dn.version}`, f = async (n, e, t) => {
|
|
140
|
+
const r = await Oe(n, {
|
|
141
141
|
...e,
|
|
142
142
|
headers: {
|
|
143
143
|
...e?.headers ?? {},
|
|
144
|
-
"User-Agent":
|
|
144
|
+
"User-Agent": Ve
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
if (r.ok)
|
|
@@ -165,22 +165,22 @@ const Ni = (n) => n?.name === "FastStoreError", Fi = (n) => n?.extensions?.type
|
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
throw new Error(i);
|
|
168
|
-
},
|
|
168
|
+
}, Wn = (n) => {
|
|
169
169
|
if (!n)
|
|
170
170
|
return n;
|
|
171
171
|
const e = /* @__PURE__ */ new Map(), t = n.split(";"), r = [];
|
|
172
172
|
return t.forEach((i) => {
|
|
173
173
|
const a = i.trim();
|
|
174
174
|
if (a) {
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
const s = a.substring(0,
|
|
178
|
-
e.has(s) || r.push(s), e.set(s,
|
|
175
|
+
const c = a.indexOf("=");
|
|
176
|
+
if (c > 0) {
|
|
177
|
+
const s = a.substring(0, c), l = a.substring(c + 1);
|
|
178
|
+
e.has(s) || r.push(s), e.set(s, l);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
}), r.map((i) => `${i}=${e.get(i)}`).join("; ");
|
|
182
|
-
},
|
|
183
|
-
const t = e.match(
|
|
182
|
+
}, xe = /^([^=]+)=([^;]*)/, qe = (n, e) => {
|
|
183
|
+
const t = e.match(xe);
|
|
184
184
|
if (t) {
|
|
185
185
|
const r = t[1], i = t[2];
|
|
186
186
|
n.storage.cookies.set(r, {
|
|
@@ -188,44 +188,32 @@ const Ni = (n) => n?.name === "FastStoreError", Fi = (n) => n?.extensions?.type
|
|
|
188
188
|
setCookie: e
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
},
|
|
191
|
+
}, je = (n, e) => {
|
|
192
192
|
e.getSetCookie().forEach(
|
|
193
|
-
(t) =>
|
|
193
|
+
(t) => qe(n, t)
|
|
194
194
|
);
|
|
195
|
-
},
|
|
195
|
+
}, We = (n) => (e) => je(n, e), Gn = (n) => {
|
|
196
196
|
if (!n.headers?.cookie)
|
|
197
197
|
return null;
|
|
198
|
-
const e =
|
|
198
|
+
const e = Wn(n.headers.cookie), t = Array.from(n.storage.cookies.entries());
|
|
199
199
|
return t.length === 0 ? e : t.reduce(
|
|
200
|
-
(r, [i, { value: a }]) =>
|
|
200
|
+
(r, [i, { value: a }]) => Ge(
|
|
201
201
|
r,
|
|
202
202
|
i,
|
|
203
203
|
a
|
|
204
204
|
),
|
|
205
205
|
e
|
|
206
206
|
);
|
|
207
|
-
},
|
|
208
|
-
const r =
|
|
207
|
+
}, Hn = (n) => function(t) {
|
|
208
|
+
const r = Gn(n);
|
|
209
209
|
return r ? {
|
|
210
210
|
...t,
|
|
211
211
|
cookie: r
|
|
212
212
|
} : t;
|
|
213
213
|
}, Q = (n, e) => {
|
|
214
|
-
const t =
|
|
214
|
+
const t = Wn(n);
|
|
215
215
|
return tn(t)[`VtexIdclientAutCookie_${e}`] || "";
|
|
216
|
-
}, Ge = (n) => {
|
|
217
|
-
const e = bn(n);
|
|
218
|
-
return function(r, i) {
|
|
219
|
-
const a = e({
|
|
220
|
-
"content-type": "application/json",
|
|
221
|
-
"X-FORWARDED-HOST": r
|
|
222
|
-
}), o = Q(
|
|
223
|
-
n?.headers?.cookie ?? "",
|
|
224
|
-
i
|
|
225
|
-
);
|
|
226
|
-
return a.VtexIdclientAutCookie = o, a;
|
|
227
|
-
};
|
|
228
|
-
}, He = (n, e, t) => {
|
|
216
|
+
}, Ge = (n, e, t) => {
|
|
229
217
|
const r = new RegExp(`(${e})=([^;]*)`), i = n.match(r);
|
|
230
218
|
return i ? n.replace(
|
|
231
219
|
i[0],
|
|
@@ -240,166 +228,166 @@ const H = {
|
|
|
240
228
|
headers: {
|
|
241
229
|
"content-type": "application/json"
|
|
242
230
|
}
|
|
243
|
-
},
|
|
244
|
-
const a = `https://${n}.${e}.com.br`,
|
|
231
|
+
}, He = ({ account: n, environment: e, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
232
|
+
const a = `https://${n}.${e}.com.br`, c = We(i), s = Hn(i), l = _e(), d = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", g = r && r.map((o) => o + ".").find((o) => d.includes(o)) || "", u = d.replace(g, "");
|
|
245
233
|
return {
|
|
246
234
|
catalog: {
|
|
247
|
-
salesChannel: (
|
|
248
|
-
`${a}/api/catalog_system/pub/saleschannel/${
|
|
235
|
+
salesChannel: (o) => f(
|
|
236
|
+
`${a}/api/catalog_system/pub/saleschannel/${o}`,
|
|
249
237
|
void 0,
|
|
250
|
-
{ storeCookies:
|
|
238
|
+
{ storeCookies: c }
|
|
251
239
|
),
|
|
252
240
|
brand: {
|
|
253
|
-
list: () =>
|
|
254
|
-
storeCookies:
|
|
241
|
+
list: () => f(`${a}/api/catalog_system/pub/brand/list`, void 0, {
|
|
242
|
+
storeCookies: c
|
|
255
243
|
})
|
|
256
244
|
},
|
|
257
245
|
category: {
|
|
258
|
-
tree: (
|
|
259
|
-
`${a}/api/catalog_system/pub/category/tree/${
|
|
246
|
+
tree: (o = 3) => f(
|
|
247
|
+
`${a}/api/catalog_system/pub/category/tree/${o}`,
|
|
260
248
|
void 0,
|
|
261
|
-
{ storeCookies:
|
|
249
|
+
{ storeCookies: c }
|
|
262
250
|
)
|
|
263
251
|
},
|
|
264
252
|
portal: {
|
|
265
|
-
pagetype: (
|
|
266
|
-
`${a}/api/catalog_system/pub/portal/pagetype/${
|
|
253
|
+
pagetype: (o) => f(
|
|
254
|
+
`${a}/api/catalog_system/pub/portal/pagetype/${o}`,
|
|
267
255
|
void 0,
|
|
268
|
-
{ storeCookies:
|
|
256
|
+
{ storeCookies: c }
|
|
269
257
|
)
|
|
270
258
|
},
|
|
271
259
|
products: {
|
|
272
260
|
crossselling: ({
|
|
273
|
-
type:
|
|
261
|
+
type: o,
|
|
274
262
|
productId: p,
|
|
275
|
-
groupByProduct:
|
|
263
|
+
groupByProduct: m = !0
|
|
276
264
|
}) => {
|
|
277
265
|
const S = new URLSearchParams({
|
|
278
266
|
sc: i.storage.channel.salesChannel,
|
|
279
|
-
groupByProduct:
|
|
267
|
+
groupByProduct: m.toString()
|
|
280
268
|
});
|
|
281
|
-
return
|
|
282
|
-
`${a}/api/catalog_system/pub/products/crossselling/${
|
|
269
|
+
return f(
|
|
270
|
+
`${a}/api/catalog_system/pub/products/crossselling/${o}/${p}?${S}`,
|
|
283
271
|
void 0,
|
|
284
|
-
{ storeCookies:
|
|
272
|
+
{ storeCookies: c }
|
|
285
273
|
);
|
|
286
274
|
}
|
|
287
275
|
}
|
|
288
276
|
},
|
|
289
277
|
checkout: {
|
|
290
|
-
simulation: (
|
|
291
|
-
const
|
|
278
|
+
simulation: (o, { salesChannel: p } = i.storage.channel) => {
|
|
279
|
+
const m = new URLSearchParams({
|
|
292
280
|
sc: p
|
|
293
281
|
}), S = s({
|
|
294
282
|
"content-type": "application/json",
|
|
295
|
-
"X-FORWARDED-HOST":
|
|
283
|
+
"X-FORWARDED-HOST": u
|
|
296
284
|
});
|
|
297
|
-
return
|
|
298
|
-
`${a}/api/checkout/pub/orderForms/simulation?${
|
|
285
|
+
return f(
|
|
286
|
+
`${a}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
299
287
|
{
|
|
300
288
|
...H,
|
|
301
289
|
headers: S,
|
|
302
|
-
body: JSON.stringify(
|
|
290
|
+
body: JSON.stringify(o)
|
|
303
291
|
},
|
|
304
|
-
{ storeCookies:
|
|
292
|
+
{ storeCookies: c }
|
|
305
293
|
);
|
|
306
294
|
},
|
|
307
295
|
shippingData: ({
|
|
308
|
-
id:
|
|
296
|
+
id: o,
|
|
309
297
|
index: p,
|
|
310
|
-
deliveryMode:
|
|
298
|
+
deliveryMode: m,
|
|
311
299
|
selectedAddresses: S
|
|
312
|
-
},
|
|
313
|
-
const
|
|
314
|
-
startDateUtc:
|
|
315
|
-
endDateUtc:
|
|
316
|
-
} : null,
|
|
317
|
-
logisticsInfo: Array.from({ length: p }, (
|
|
318
|
-
itemIndex:
|
|
319
|
-
selectedDeliveryChannel:
|
|
320
|
-
selectedSla:
|
|
321
|
-
deliveryWindow:
|
|
300
|
+
}, I) => {
|
|
301
|
+
const O = I ? {
|
|
302
|
+
startDateUtc: m?.deliveryWindow?.startDate,
|
|
303
|
+
endDateUtc: m?.deliveryWindow?.endDate
|
|
304
|
+
} : null, w = {
|
|
305
|
+
logisticsInfo: Array.from({ length: p }, (P, b) => ({
|
|
306
|
+
itemIndex: b,
|
|
307
|
+
selectedDeliveryChannel: m?.deliveryChannel || null,
|
|
308
|
+
selectedSla: m?.deliveryMethod || null,
|
|
309
|
+
deliveryWindow: O
|
|
322
310
|
})),
|
|
323
311
|
selectedAddresses: S,
|
|
324
312
|
clearAddressIfPostalCodeNotFound: t
|
|
325
|
-
},
|
|
313
|
+
}, _ = s({
|
|
326
314
|
"content-type": "application/json",
|
|
327
|
-
"X-FORWARDED-HOST":
|
|
315
|
+
"X-FORWARDED-HOST": u
|
|
328
316
|
});
|
|
329
|
-
return
|
|
330
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
317
|
+
return f(
|
|
318
|
+
`${a}/api/checkout/pub/orderForm/${o}/attachments/shippingData`,
|
|
331
319
|
{
|
|
332
320
|
...H,
|
|
333
|
-
headers:
|
|
334
|
-
body: JSON.stringify(
|
|
321
|
+
headers: _,
|
|
322
|
+
body: JSON.stringify(w)
|
|
335
323
|
},
|
|
336
|
-
{ storeCookies:
|
|
324
|
+
{ storeCookies: c }
|
|
337
325
|
);
|
|
338
326
|
},
|
|
339
327
|
marketingData: ({
|
|
340
|
-
id:
|
|
328
|
+
id: o,
|
|
341
329
|
marketingData: p
|
|
342
330
|
}) => {
|
|
343
|
-
const
|
|
331
|
+
const m = s({
|
|
344
332
|
"content-type": "application/json",
|
|
345
|
-
"X-FORWARDED-HOST":
|
|
333
|
+
"X-FORWARDED-HOST": u
|
|
346
334
|
});
|
|
347
|
-
return
|
|
348
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
335
|
+
return f(
|
|
336
|
+
`${a}/api/checkout/pub/orderForm/${o}/attachments/marketingData`,
|
|
349
337
|
{
|
|
350
|
-
headers:
|
|
338
|
+
headers: m,
|
|
351
339
|
body: JSON.stringify(p),
|
|
352
340
|
method: "POST"
|
|
353
341
|
},
|
|
354
|
-
{ storeCookies:
|
|
342
|
+
{ storeCookies: c }
|
|
355
343
|
);
|
|
356
344
|
},
|
|
357
345
|
clientPreferencesData: ({
|
|
358
|
-
id:
|
|
346
|
+
id: o,
|
|
359
347
|
clientPreferencesData: p
|
|
360
348
|
}) => {
|
|
361
|
-
const
|
|
349
|
+
const m = s({
|
|
362
350
|
"content-type": "application/json",
|
|
363
|
-
"X-FORWARDED-HOST":
|
|
351
|
+
"X-FORWARDED-HOST": u
|
|
364
352
|
});
|
|
365
|
-
return
|
|
366
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
353
|
+
return f(
|
|
354
|
+
`${a}/api/checkout/pub/orderForm/${o}/attachments/clientPreferencesData`,
|
|
367
355
|
{
|
|
368
|
-
headers:
|
|
356
|
+
headers: m,
|
|
369
357
|
body: JSON.stringify(p),
|
|
370
358
|
method: "POST"
|
|
371
359
|
},
|
|
372
|
-
{ storeCookies:
|
|
360
|
+
{ storeCookies: c }
|
|
373
361
|
);
|
|
374
362
|
},
|
|
375
363
|
orderForm: ({
|
|
376
|
-
id:
|
|
364
|
+
id: o,
|
|
377
365
|
refreshOutdatedData: p = !0,
|
|
378
|
-
channel:
|
|
366
|
+
channel: m = i.storage.channel
|
|
379
367
|
}) => {
|
|
380
|
-
const { salesChannel: S } =
|
|
368
|
+
const { salesChannel: S } = m, I = s({
|
|
381
369
|
"content-type": "application/json",
|
|
382
|
-
"X-FORWARDED-HOST":
|
|
383
|
-
}),
|
|
384
|
-
|
|
385
|
-
const
|
|
386
|
-
return
|
|
387
|
-
|
|
370
|
+
"X-FORWARDED-HOST": u
|
|
371
|
+
}), O = new URLSearchParams({ sc: S });
|
|
372
|
+
o && O.set("refreshOutdatedData", p.toString());
|
|
373
|
+
const w = `${a}/api/checkout/pub/orderForm${o ? `/${o}` : ""}?${O.toString()}`;
|
|
374
|
+
return f(
|
|
375
|
+
w,
|
|
388
376
|
{
|
|
389
377
|
...H,
|
|
390
|
-
headers:
|
|
391
|
-
...
|
|
378
|
+
headers: I,
|
|
379
|
+
...o ? {} : { body: "{}" }
|
|
392
380
|
},
|
|
393
|
-
{ storeCookies:
|
|
381
|
+
{ storeCookies: c }
|
|
394
382
|
);
|
|
395
383
|
},
|
|
396
|
-
clearOrderFormMessages: ({ id:
|
|
384
|
+
clearOrderFormMessages: ({ id: o }) => {
|
|
397
385
|
const p = s({
|
|
398
386
|
"content-type": "application/json",
|
|
399
|
-
"X-FORWARDED-HOST":
|
|
387
|
+
"X-FORWARDED-HOST": u
|
|
400
388
|
});
|
|
401
|
-
return
|
|
402
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
389
|
+
return f(
|
|
390
|
+
`${a}/api/checkout/pub/orderForm/${o}/messages/clear`,
|
|
403
391
|
{
|
|
404
392
|
...H,
|
|
405
393
|
headers: p,
|
|
@@ -408,277 +396,292 @@ const H = {
|
|
|
408
396
|
);
|
|
409
397
|
},
|
|
410
398
|
updateOrderFormItems: ({
|
|
411
|
-
id:
|
|
399
|
+
id: o,
|
|
412
400
|
orderItems: p,
|
|
413
|
-
allowOutdatedData:
|
|
401
|
+
allowOutdatedData: m = "paymentData",
|
|
414
402
|
salesChannel: S = i.storage.channel.salesChannel,
|
|
415
|
-
shouldSplitItem:
|
|
403
|
+
shouldSplitItem: I = !0
|
|
416
404
|
}) => {
|
|
417
|
-
const
|
|
418
|
-
allowOutdatedData:
|
|
405
|
+
const O = new URLSearchParams({
|
|
406
|
+
allowOutdatedData: m,
|
|
419
407
|
sc: S
|
|
420
|
-
}),
|
|
408
|
+
}), w = s({
|
|
421
409
|
"content-type": "application/json",
|
|
422
|
-
"X-FORWARDED-HOST":
|
|
410
|
+
"X-FORWARDED-HOST": u
|
|
423
411
|
});
|
|
424
|
-
return
|
|
425
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
412
|
+
return f(
|
|
413
|
+
`${a}/api/checkout/pub/orderForm/${o}/items?${O}`,
|
|
426
414
|
{
|
|
427
|
-
headers:
|
|
415
|
+
headers: w,
|
|
428
416
|
body: JSON.stringify({
|
|
429
417
|
orderItems: p,
|
|
430
|
-
noSplitItem: !
|
|
418
|
+
noSplitItem: !I
|
|
431
419
|
}),
|
|
432
420
|
method: "PATCH"
|
|
433
421
|
},
|
|
434
|
-
{ storeCookies:
|
|
422
|
+
{ storeCookies: c }
|
|
435
423
|
);
|
|
436
424
|
},
|
|
437
425
|
setCustomData: ({
|
|
438
|
-
id:
|
|
426
|
+
id: o,
|
|
439
427
|
appId: p,
|
|
440
|
-
key:
|
|
428
|
+
key: m,
|
|
441
429
|
value: S
|
|
442
430
|
}) => {
|
|
443
|
-
const
|
|
431
|
+
const I = s({
|
|
444
432
|
"content-type": "application/json",
|
|
445
|
-
"X-FORWARDED-HOST":
|
|
433
|
+
"X-FORWARDED-HOST": u
|
|
446
434
|
});
|
|
447
|
-
return
|
|
448
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
435
|
+
return f(
|
|
436
|
+
`${a}/api/checkout/pub/orderForm/${o}/customData/${p}/${m}`,
|
|
449
437
|
{
|
|
450
|
-
headers:
|
|
438
|
+
headers: I,
|
|
451
439
|
body: JSON.stringify({ value: S }),
|
|
452
440
|
method: "PUT"
|
|
453
441
|
}
|
|
454
442
|
);
|
|
455
443
|
},
|
|
456
444
|
region: async ({
|
|
457
|
-
postalCode:
|
|
445
|
+
postalCode: o,
|
|
458
446
|
geoCoordinates: p,
|
|
459
|
-
country:
|
|
447
|
+
country: m,
|
|
460
448
|
salesChannel: S
|
|
461
449
|
}) => {
|
|
462
|
-
const
|
|
463
|
-
country:
|
|
450
|
+
const I = new URLSearchParams({
|
|
451
|
+
country: m,
|
|
464
452
|
sc: S ?? ""
|
|
465
453
|
});
|
|
466
|
-
|
|
454
|
+
o ? I.append("postalCode", o) : I.append(
|
|
467
455
|
"geoCoordinates",
|
|
468
456
|
`${p?.longitude};${p?.latitude}`
|
|
469
457
|
);
|
|
470
|
-
const
|
|
458
|
+
const O = `${a}/api/checkout/pub/regions/?${I.toString()}`, w = s({
|
|
471
459
|
"content-type": "application/json",
|
|
472
|
-
"X-FORWARDED-HOST":
|
|
460
|
+
"X-FORWARDED-HOST": u
|
|
473
461
|
});
|
|
474
|
-
return
|
|
475
|
-
|
|
462
|
+
return f(
|
|
463
|
+
O,
|
|
476
464
|
{
|
|
477
|
-
headers:
|
|
465
|
+
headers: w
|
|
478
466
|
},
|
|
479
|
-
{ storeCookies:
|
|
467
|
+
{ storeCookies: c }
|
|
480
468
|
);
|
|
481
469
|
},
|
|
482
470
|
address: async ({
|
|
483
|
-
postalCode:
|
|
471
|
+
postalCode: o,
|
|
484
472
|
country: p
|
|
485
473
|
}) => {
|
|
486
|
-
const
|
|
474
|
+
const m = s({
|
|
487
475
|
"content-type": "application/json",
|
|
488
|
-
"X-FORWARDED-HOST":
|
|
476
|
+
"X-FORWARDED-HOST": u
|
|
489
477
|
});
|
|
490
|
-
return
|
|
491
|
-
`${a}/api/checkout/pub/postal-code/${p}/${
|
|
478
|
+
return f(
|
|
479
|
+
`${a}/api/checkout/pub/postal-code/${p}/${o}`,
|
|
492
480
|
{
|
|
493
|
-
headers:
|
|
481
|
+
headers: m
|
|
494
482
|
},
|
|
495
|
-
{ storeCookies:
|
|
483
|
+
{ storeCookies: c }
|
|
496
484
|
);
|
|
497
485
|
},
|
|
498
486
|
cancelOrder: ({
|
|
499
|
-
orderId:
|
|
487
|
+
orderId: o,
|
|
500
488
|
customerEmail: p,
|
|
501
|
-
reason:
|
|
489
|
+
reason: m
|
|
502
490
|
}) => {
|
|
503
491
|
const S = s({
|
|
504
492
|
"content-type": "application/json",
|
|
505
|
-
"X-FORWARDED-HOST":
|
|
493
|
+
"X-FORWARDED-HOST": u
|
|
506
494
|
});
|
|
507
|
-
return
|
|
508
|
-
`${a}/api/checkout/pub/orders/${
|
|
495
|
+
return f(
|
|
496
|
+
`${a}/api/checkout/pub/orders/${o}/user-cancel-request`,
|
|
509
497
|
{
|
|
510
498
|
method: "POST",
|
|
511
499
|
headers: S,
|
|
512
500
|
body: JSON.stringify({
|
|
513
501
|
customerEmail: p,
|
|
514
|
-
reason:
|
|
502
|
+
reason: m
|
|
515
503
|
})
|
|
516
504
|
},
|
|
517
505
|
{}
|
|
518
506
|
);
|
|
519
507
|
},
|
|
520
508
|
pickupPoints: ({
|
|
521
|
-
geoCoordinates:
|
|
509
|
+
geoCoordinates: o
|
|
522
510
|
}) => {
|
|
523
|
-
if (!
|
|
511
|
+
if (!o)
|
|
524
512
|
throw new Error(
|
|
525
513
|
"Missing required parameter for listing pickup points."
|
|
526
514
|
);
|
|
527
515
|
const p = s({
|
|
528
516
|
"content-type": "application/json",
|
|
529
|
-
"X-FORWARDED-HOST":
|
|
517
|
+
"X-FORWARDED-HOST": u
|
|
530
518
|
});
|
|
531
|
-
return
|
|
519
|
+
return f(
|
|
532
520
|
`${a}/api/logistics-shipping/pickuppoints/_search`,
|
|
533
521
|
{
|
|
534
522
|
method: "POST",
|
|
535
523
|
headers: p,
|
|
536
|
-
body: JSON.stringify({ coordinate:
|
|
524
|
+
body: JSON.stringify({ coordinate: o })
|
|
537
525
|
},
|
|
538
|
-
{ storeCookies:
|
|
526
|
+
{ storeCookies: c }
|
|
539
527
|
);
|
|
540
528
|
}
|
|
541
529
|
},
|
|
542
|
-
session: (
|
|
543
|
-
const p = new URLSearchParams(
|
|
530
|
+
session: (o) => {
|
|
531
|
+
const p = new URLSearchParams(o);
|
|
544
532
|
p.set(
|
|
545
533
|
"items",
|
|
546
534
|
"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"
|
|
547
535
|
);
|
|
548
|
-
const
|
|
536
|
+
const m = s({
|
|
549
537
|
"content-type": "application/json"
|
|
550
538
|
}), S = tn(i?.headers?.cookie ?? "")?.vtex_session;
|
|
551
|
-
return
|
|
539
|
+
return f(
|
|
552
540
|
`${a}/api/sessions?${p.toString()}`,
|
|
553
541
|
{
|
|
554
542
|
method: S ? "PATCH" : "POST",
|
|
555
|
-
headers:
|
|
543
|
+
headers: m,
|
|
556
544
|
body: "{}"
|
|
557
545
|
},
|
|
558
|
-
{ storeCookies:
|
|
546
|
+
{ storeCookies: c }
|
|
559
547
|
);
|
|
560
548
|
},
|
|
561
|
-
subscribeToNewsletter: (
|
|
549
|
+
subscribeToNewsletter: (o) => f(
|
|
562
550
|
`${a}/api/dataentities/NL/documents/`,
|
|
563
551
|
{
|
|
564
552
|
...H,
|
|
565
|
-
body: JSON.stringify({ ...
|
|
553
|
+
body: JSON.stringify({ ...o, isNewsletterOptIn: !0 }),
|
|
566
554
|
method: "PATCH"
|
|
567
555
|
},
|
|
568
|
-
{ storeCookies:
|
|
556
|
+
{ storeCookies: c }
|
|
569
557
|
),
|
|
570
558
|
profile: {
|
|
571
|
-
addresses: async (
|
|
572
|
-
const p =
|
|
573
|
-
|
|
574
|
-
|
|
559
|
+
addresses: async (o) => {
|
|
560
|
+
const p = s({
|
|
561
|
+
"content-type": "application/json",
|
|
562
|
+
"X-FORWARDED-HOST": u
|
|
563
|
+
});
|
|
564
|
+
return f(
|
|
565
|
+
`${a}/api/profile-system/pvt/profiles/${o}/addresses`,
|
|
575
566
|
{ headers: p },
|
|
576
|
-
{ storeCookies:
|
|
567
|
+
{ storeCookies: c }
|
|
577
568
|
);
|
|
578
569
|
}
|
|
579
570
|
},
|
|
580
571
|
oms: {
|
|
581
|
-
userOrder: ({ orderId:
|
|
582
|
-
const p =
|
|
583
|
-
|
|
584
|
-
|
|
572
|
+
userOrder: ({ orderId: o }) => {
|
|
573
|
+
const p = s({
|
|
574
|
+
"content-type": "application/json",
|
|
575
|
+
"X-FORWARDED-HOST": u
|
|
576
|
+
});
|
|
577
|
+
return f(
|
|
578
|
+
`${a}/api/oms/user/orders/${o}`,
|
|
585
579
|
{
|
|
586
580
|
method: "GET",
|
|
587
581
|
headers: p
|
|
588
582
|
},
|
|
589
|
-
{ storeCookies:
|
|
583
|
+
{ storeCookies: c }
|
|
590
584
|
);
|
|
591
585
|
},
|
|
592
586
|
listUserOrders: ({
|
|
593
|
-
page:
|
|
587
|
+
page: o,
|
|
594
588
|
status: p,
|
|
595
|
-
dateInitial:
|
|
589
|
+
dateInitial: m,
|
|
596
590
|
dateFinal: S,
|
|
597
|
-
text:
|
|
598
|
-
clientEmail:
|
|
599
|
-
perPage:
|
|
600
|
-
pendingMyApproval:
|
|
591
|
+
text: I,
|
|
592
|
+
clientEmail: O,
|
|
593
|
+
perPage: w,
|
|
594
|
+
pendingMyApproval: _
|
|
601
595
|
}) => {
|
|
602
|
-
const
|
|
603
|
-
if (
|
|
604
|
-
const
|
|
596
|
+
const P = new URLSearchParams();
|
|
597
|
+
if (m) {
|
|
598
|
+
const E = new Date(m).setHours(
|
|
605
599
|
0,
|
|
606
600
|
0,
|
|
607
601
|
0,
|
|
608
602
|
0
|
|
609
603
|
);
|
|
610
|
-
|
|
604
|
+
m = new Date(E).toISOString();
|
|
611
605
|
}
|
|
612
606
|
if (S) {
|
|
613
|
-
const
|
|
607
|
+
const E = new Date(S).setHours(
|
|
614
608
|
23,
|
|
615
609
|
59,
|
|
616
610
|
59,
|
|
617
611
|
999
|
|
618
612
|
);
|
|
619
|
-
S = new Date(
|
|
613
|
+
S = new Date(E).toISOString();
|
|
620
614
|
}
|
|
621
|
-
|
|
615
|
+
I && P.append("text", I), p && p.length > 0 && P.append("status", p.filter(Boolean).join(",")), m && S ? P.append(
|
|
622
616
|
"creation_date",
|
|
623
|
-
`creationDate:[${
|
|
624
|
-
) :
|
|
625
|
-
const
|
|
617
|
+
`creationDate:[${m} TO ${S}]`
|
|
618
|
+
) : m ? P.append("creation_date", `creationDate:[${m} TO *]`) : S && P.append("creation_date", `creationDate:[* TO ${S}]`), O && P.append("clientEmail", O), o && P.append("page", o.toString()), w && P.append("per_page", w.toString()), _ && P.append("my_pending_approvals", String(!0));
|
|
619
|
+
const b = s({
|
|
626
620
|
"content-type": "application/json",
|
|
627
|
-
"X-FORWARDED-HOST":
|
|
621
|
+
"X-FORWARDED-HOST": u
|
|
628
622
|
});
|
|
629
|
-
return
|
|
630
|
-
`${a}/api/oms/user/orders?${
|
|
623
|
+
return f(
|
|
624
|
+
`${a}/api/oms/user/orders?${P.toString()}`,
|
|
631
625
|
{
|
|
632
626
|
method: "GET",
|
|
633
|
-
headers:
|
|
627
|
+
headers: b
|
|
634
628
|
},
|
|
635
|
-
{ storeCookies:
|
|
629
|
+
{ storeCookies: c }
|
|
636
630
|
);
|
|
637
631
|
},
|
|
638
632
|
getCommercialAuthorizationsByOrderId: ({
|
|
639
|
-
orderId:
|
|
633
|
+
orderId: o
|
|
640
634
|
}) => {
|
|
641
|
-
const p =
|
|
642
|
-
|
|
643
|
-
|
|
635
|
+
const p = s({
|
|
636
|
+
"content-type": "application/json",
|
|
637
|
+
"X-FORWARDED-HOST": u
|
|
638
|
+
});
|
|
639
|
+
return f(
|
|
640
|
+
`${a}/${n}/commercial-authorizations/order/${o}`,
|
|
644
641
|
{
|
|
645
642
|
method: "GET",
|
|
646
643
|
headers: p
|
|
647
644
|
},
|
|
648
|
-
{ storeCookies:
|
|
645
|
+
{ storeCookies: c }
|
|
649
646
|
);
|
|
650
647
|
},
|
|
651
648
|
processOrderAuthorization: async ({
|
|
652
|
-
orderAuthorizationId:
|
|
649
|
+
orderAuthorizationId: o,
|
|
653
650
|
dimensionId: p,
|
|
654
|
-
ruleId:
|
|
651
|
+
ruleId: m,
|
|
655
652
|
approved: S
|
|
656
653
|
}) => {
|
|
657
|
-
const
|
|
654
|
+
const I = s({
|
|
655
|
+
"content-type": "application/json",
|
|
656
|
+
"X-FORWARDED-HOST": u
|
|
657
|
+
}), _ = {
|
|
658
658
|
params: {
|
|
659
|
-
ruleId:
|
|
659
|
+
ruleId: m,
|
|
660
660
|
dimensionId: p,
|
|
661
661
|
score: S ? 100 : 0
|
|
662
662
|
}
|
|
663
663
|
};
|
|
664
|
-
return
|
|
665
|
-
`${a}/${n}/commercial-authorizations/${
|
|
664
|
+
return f(
|
|
665
|
+
`${a}/${n}/commercial-authorizations/${o}/callback`,
|
|
666
666
|
{
|
|
667
667
|
method: "POST",
|
|
668
|
-
headers:
|
|
669
|
-
body: JSON.stringify(
|
|
668
|
+
headers: I,
|
|
669
|
+
body: JSON.stringify(_)
|
|
670
670
|
},
|
|
671
|
-
{ storeCookies:
|
|
671
|
+
{ storeCookies: c }
|
|
672
672
|
);
|
|
673
673
|
}
|
|
674
674
|
},
|
|
675
675
|
units: {
|
|
676
676
|
getUnitByUserId: ({
|
|
677
|
-
userId:
|
|
677
|
+
userId: o
|
|
678
678
|
}) => {
|
|
679
|
-
const p =
|
|
680
|
-
|
|
681
|
-
|
|
679
|
+
const p = s({
|
|
680
|
+
"content-type": "application/json",
|
|
681
|
+
"X-FORWARDED-HOST": u
|
|
682
|
+
});
|
|
683
|
+
return f(
|
|
684
|
+
`${a}/api/units/v1/${o}/unit`,
|
|
682
685
|
{
|
|
683
686
|
method: "GET",
|
|
684
687
|
headers: p
|
|
@@ -687,11 +690,14 @@ const H = {
|
|
|
687
690
|
);
|
|
688
691
|
},
|
|
689
692
|
getOrgUnitById: ({
|
|
690
|
-
orgUnitId:
|
|
693
|
+
orgUnitId: o
|
|
691
694
|
}) => {
|
|
692
|
-
const p =
|
|
693
|
-
|
|
694
|
-
|
|
695
|
+
const p = s({
|
|
696
|
+
"content-type": "application/json",
|
|
697
|
+
"X-FORWARDED-HOST": u
|
|
698
|
+
});
|
|
699
|
+
return f(
|
|
700
|
+
`${a}/api/units/v1/${o}`,
|
|
695
701
|
{
|
|
696
702
|
method: "GET",
|
|
697
703
|
headers: p
|
|
@@ -700,11 +706,14 @@ const H = {
|
|
|
700
706
|
);
|
|
701
707
|
},
|
|
702
708
|
getScopesByOrgUnit: ({
|
|
703
|
-
orgUnitId:
|
|
709
|
+
orgUnitId: o
|
|
704
710
|
}) => {
|
|
705
|
-
const p =
|
|
706
|
-
|
|
707
|
-
|
|
711
|
+
const p = s({
|
|
712
|
+
"content-type": "application/json",
|
|
713
|
+
"X-FORWARDED-HOST": u
|
|
714
|
+
});
|
|
715
|
+
return f(
|
|
716
|
+
`${a}/api/units/v1/${o}/scopes`,
|
|
708
717
|
{
|
|
709
718
|
method: "GET",
|
|
710
719
|
headers: p
|
|
@@ -715,11 +724,14 @@ const H = {
|
|
|
715
724
|
},
|
|
716
725
|
licenseManager: {
|
|
717
726
|
getUserById: ({
|
|
718
|
-
userId:
|
|
727
|
+
userId: o
|
|
719
728
|
}) => {
|
|
720
|
-
const p =
|
|
721
|
-
|
|
722
|
-
|
|
729
|
+
const p = s({
|
|
730
|
+
"content-type": "application/json",
|
|
731
|
+
"X-FORWARDED-HOST": u
|
|
732
|
+
});
|
|
733
|
+
return f(
|
|
734
|
+
`${a}/api/license-manager/users/${o}`,
|
|
723
735
|
{
|
|
724
736
|
method: "GET",
|
|
725
737
|
headers: p
|
|
@@ -728,11 +740,14 @@ const H = {
|
|
|
728
740
|
);
|
|
729
741
|
},
|
|
730
742
|
getUserByEmail: ({
|
|
731
|
-
email:
|
|
743
|
+
email: o
|
|
732
744
|
}) => {
|
|
733
|
-
const p =
|
|
734
|
-
|
|
735
|
-
|
|
745
|
+
const p = s({
|
|
746
|
+
"content-type": "application/json",
|
|
747
|
+
"X-FORWARDED-HOST": u
|
|
748
|
+
});
|
|
749
|
+
return f(
|
|
750
|
+
`${a}/api/license-manager/pvt/users/${o}`,
|
|
736
751
|
{
|
|
737
752
|
method: "GET",
|
|
738
753
|
headers: p
|
|
@@ -741,11 +756,14 @@ const H = {
|
|
|
741
756
|
);
|
|
742
757
|
},
|
|
743
758
|
getUserRoles: ({
|
|
744
|
-
userId:
|
|
759
|
+
userId: o
|
|
745
760
|
}) => {
|
|
746
|
-
const p =
|
|
747
|
-
|
|
748
|
-
|
|
761
|
+
const p = s({
|
|
762
|
+
"content-type": "application/json",
|
|
763
|
+
"X-FORWARDED-HOST": u
|
|
764
|
+
});
|
|
765
|
+
return f(
|
|
766
|
+
`${a}/api/license-manager/storefront/users/${o}/roles`,
|
|
749
767
|
{
|
|
750
768
|
method: "GET",
|
|
751
769
|
headers: p
|
|
@@ -756,17 +774,17 @@ const H = {
|
|
|
756
774
|
},
|
|
757
775
|
masterData: {
|
|
758
776
|
getContractById: ({
|
|
759
|
-
contractId:
|
|
777
|
+
contractId: o
|
|
760
778
|
}) => {
|
|
761
|
-
if (!
|
|
779
|
+
if (!o)
|
|
762
780
|
throw new k("Missing contractId to fetch CL fields.");
|
|
763
|
-
const p =
|
|
781
|
+
const p = l({
|
|
764
782
|
Accept: "application/json",
|
|
765
783
|
"content-type": "application/json",
|
|
766
|
-
"X-FORWARDED-HOST":
|
|
784
|
+
"X-FORWARDED-HOST": u
|
|
767
785
|
});
|
|
768
|
-
return
|
|
769
|
-
`${a}/api/dataentities/CL/documents/${
|
|
786
|
+
return f(
|
|
787
|
+
`${a}/api/dataentities/CL/documents/${o}?_fields=_all`,
|
|
770
788
|
{
|
|
771
789
|
method: "GET",
|
|
772
790
|
headers: p
|
|
@@ -775,17 +793,17 @@ const H = {
|
|
|
775
793
|
);
|
|
776
794
|
},
|
|
777
795
|
getShopperById: ({
|
|
778
|
-
userId:
|
|
796
|
+
userId: o
|
|
779
797
|
}) => {
|
|
780
|
-
if (!
|
|
798
|
+
if (!o)
|
|
781
799
|
throw new k("Missing userId to fetch shopper name.");
|
|
782
|
-
const p =
|
|
800
|
+
const p = l({
|
|
783
801
|
Accept: "application/json",
|
|
784
802
|
"content-type": "application/json",
|
|
785
|
-
"X-FORWARDED-HOST":
|
|
786
|
-
}),
|
|
787
|
-
return
|
|
788
|
-
`${a}/api/dataentities/shopper/search?_where=(userId=${
|
|
803
|
+
"X-FORWARDED-HOST": u
|
|
804
|
+
}), m = o.replace(/-/g, "");
|
|
805
|
+
return f(
|
|
806
|
+
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${o})&_fields=_all&_schema=v1`,
|
|
789
807
|
{
|
|
790
808
|
method: "GET",
|
|
791
809
|
headers: p
|
|
@@ -796,80 +814,87 @@ const H = {
|
|
|
796
814
|
},
|
|
797
815
|
vtexid: {
|
|
798
816
|
validate: () => {
|
|
799
|
-
const
|
|
800
|
-
|
|
817
|
+
const o = s({
|
|
818
|
+
"content-type": "application/json",
|
|
819
|
+
"X-FORWARDED-HOST": u
|
|
820
|
+
}), p = Q(Gn(i) ?? "", n);
|
|
821
|
+
return f(
|
|
801
822
|
`${a}/api/vtexid/credential/validate`,
|
|
802
823
|
{
|
|
803
|
-
headers:
|
|
804
|
-
body: JSON.stringify({
|
|
805
|
-
token: l.VtexIdclientAutCookie
|
|
806
|
-
}),
|
|
824
|
+
headers: o,
|
|
825
|
+
body: JSON.stringify({ token: p }),
|
|
807
826
|
method: "POST"
|
|
808
827
|
},
|
|
809
|
-
{ storeCookies:
|
|
828
|
+
{ storeCookies: c }
|
|
810
829
|
);
|
|
811
830
|
}
|
|
812
831
|
},
|
|
813
832
|
orderEntry: {
|
|
814
833
|
uploadFile: ({
|
|
815
|
-
fileBuffer:
|
|
834
|
+
fileBuffer: o,
|
|
816
835
|
fileName: p,
|
|
817
|
-
mimeType:
|
|
836
|
+
mimeType: m
|
|
818
837
|
}) => {
|
|
819
|
-
const S =
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
838
|
+
const S = s({
|
|
839
|
+
"content-type": "application/json",
|
|
840
|
+
"X-FORWARDED-HOST": u
|
|
841
|
+
}), I = `----FastStoreUploadBoundary${Date.now()}`, O = `\r
|
|
842
|
+
`, _ = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", P = p.replaceAll(/[\r\n"]/g, "_"), b = [
|
|
843
|
+
`--${I}`,
|
|
844
|
+
`Content-Disposition: form-data; name="file"; filename="${P}"`,
|
|
845
|
+
`Content-Type: ${_}`,
|
|
824
846
|
"",
|
|
825
847
|
""
|
|
826
|
-
].join(
|
|
827
|
-
|
|
848
|
+
].join(O), E = `${O}--${I}--${O}`, h = Buffer.from(b), v = Buffer.from(E), C = new Uint8Array(
|
|
849
|
+
h.byteLength + o.byteLength + v.byteLength
|
|
828
850
|
);
|
|
829
|
-
let
|
|
830
|
-
return
|
|
851
|
+
let D = 0;
|
|
852
|
+
return C.set(h, D), D += h.byteLength, C.set(o, D), D += o.byteLength, C.set(v, D), f(
|
|
831
853
|
`${a}/api/order-entry/upload?an=${n}`,
|
|
832
854
|
{
|
|
833
855
|
method: "POST",
|
|
834
856
|
headers: {
|
|
835
857
|
...S,
|
|
836
|
-
"content-type": `multipart/form-data; boundary=${
|
|
858
|
+
"content-type": `multipart/form-data; boundary=${I}`
|
|
837
859
|
},
|
|
838
|
-
body:
|
|
860
|
+
body: C.buffer
|
|
839
861
|
},
|
|
840
862
|
{}
|
|
841
863
|
);
|
|
842
864
|
},
|
|
843
865
|
startOperation: ({
|
|
844
|
-
objectKey:
|
|
866
|
+
objectKey: o,
|
|
845
867
|
orderFormId: p,
|
|
846
|
-
sessionToken:
|
|
868
|
+
sessionToken: m
|
|
847
869
|
}) => {
|
|
848
|
-
const S =
|
|
849
|
-
|
|
870
|
+
const S = s({
|
|
871
|
+
"content-type": "application/json",
|
|
872
|
+
"X-FORWARDED-HOST": u
|
|
873
|
+
}), I = JSON.stringify({
|
|
874
|
+
objectKey: o,
|
|
850
875
|
orderFormId: p,
|
|
851
876
|
operation: "CreateCart",
|
|
852
|
-
...
|
|
877
|
+
...m ? { sessionToken: m } : {}
|
|
853
878
|
});
|
|
854
|
-
return
|
|
879
|
+
return f(
|
|
855
880
|
`${a}/api/order-entry/operation?an=${n}`,
|
|
856
881
|
{
|
|
857
882
|
method: "POST",
|
|
858
|
-
headers:
|
|
859
|
-
|
|
860
|
-
"Content-Type": "application/json"
|
|
861
|
-
},
|
|
862
|
-
body: v
|
|
883
|
+
headers: S,
|
|
884
|
+
body: I
|
|
863
885
|
},
|
|
864
886
|
{}
|
|
865
887
|
);
|
|
866
888
|
},
|
|
867
889
|
getOperation: ({
|
|
868
|
-
operationId:
|
|
890
|
+
operationId: o
|
|
869
891
|
}) => {
|
|
870
|
-
const p =
|
|
871
|
-
|
|
872
|
-
|
|
892
|
+
const p = s({
|
|
893
|
+
"content-type": "application/json",
|
|
894
|
+
"X-FORWARDED-HOST": u
|
|
895
|
+
});
|
|
896
|
+
return f(
|
|
897
|
+
`${a}/api/order-entry/operation/${o}?an=${n}`,
|
|
873
898
|
{
|
|
874
899
|
method: "GET",
|
|
875
900
|
headers: p
|
|
@@ -878,168 +903,166 @@ const H = {
|
|
|
878
903
|
);
|
|
879
904
|
},
|
|
880
905
|
createOrderForm: () => {
|
|
881
|
-
const
|
|
882
|
-
|
|
906
|
+
const o = s({
|
|
907
|
+
"content-type": "application/json",
|
|
908
|
+
"X-FORWARDED-HOST": u
|
|
909
|
+
});
|
|
910
|
+
return f(
|
|
883
911
|
`${a}/api/checkout/pub/orderForm?sc=${i.storage.channel.salesChannel}`,
|
|
884
912
|
{
|
|
885
913
|
method: "POST",
|
|
886
|
-
headers:
|
|
887
|
-
...l,
|
|
888
|
-
"Content-Type": "application/json",
|
|
889
|
-
"X-FORWARDED-HOST": d
|
|
890
|
-
},
|
|
914
|
+
headers: o,
|
|
891
915
|
body: "{}"
|
|
892
916
|
},
|
|
893
917
|
{}
|
|
894
918
|
);
|
|
895
919
|
},
|
|
896
920
|
getOrderFormItems: ({
|
|
897
|
-
orderFormId:
|
|
921
|
+
orderFormId: o
|
|
898
922
|
}) => {
|
|
899
|
-
const p =
|
|
900
|
-
|
|
901
|
-
|
|
923
|
+
const p = s({
|
|
924
|
+
"content-type": "application/json",
|
|
925
|
+
"X-FORWARDED-HOST": u
|
|
926
|
+
});
|
|
927
|
+
return f(
|
|
928
|
+
`${a}/api/checkout/pub/orderForm/${o}`,
|
|
902
929
|
{
|
|
903
930
|
method: "GET",
|
|
904
|
-
headers:
|
|
905
|
-
...p,
|
|
906
|
-
"Content-Type": "application/json",
|
|
907
|
-
"X-FORWARDED-HOST": d
|
|
908
|
-
}
|
|
931
|
+
headers: p
|
|
909
932
|
},
|
|
910
933
|
{}
|
|
911
934
|
);
|
|
912
935
|
}
|
|
913
936
|
}
|
|
914
937
|
};
|
|
915
|
-
}, dn = "trade-policy", un = "region-id", pn = "fuzzy", gn = "operator", mn = "pickupPoint",
|
|
938
|
+
}, dn = "trade-policy", un = "region-id", pn = "fuzzy", gn = "operator", mn = "pickupPoint", Xn = "shipping", Yn = "delivery-options", Jn = "in-stock", Xe = /* @__PURE__ */ new Set([
|
|
916
939
|
dn,
|
|
917
940
|
un,
|
|
918
941
|
pn,
|
|
919
942
|
gn,
|
|
920
943
|
mn,
|
|
921
|
-
Hn,
|
|
922
944
|
Xn,
|
|
923
|
-
Yn
|
|
924
|
-
|
|
945
|
+
Yn,
|
|
946
|
+
Jn
|
|
947
|
+
]), Ye = (n) => n.key === "fuzzy" && (n.value === "0" || n.value === "1" || n.value === "auto"), Je = (n) => n.key === "operator" && (n.value === "and" || n.value === "or"), Ke = ({
|
|
925
948
|
account: n,
|
|
926
949
|
environment: e,
|
|
927
950
|
hideUnavailableItems: t,
|
|
928
951
|
simulationBehavior: r,
|
|
929
952
|
showSponsored: i,
|
|
930
953
|
subDomainPrefix: a
|
|
931
|
-
},
|
|
932
|
-
const s = `https://${n}.${e}.com.br/api/io`,
|
|
954
|
+
}, c) => {
|
|
955
|
+
const s = `https://${n}.${e}.com.br/api/io`, l = Hn(c), d = new Headers(c.headers).get("x-forwarded-host") ?? c.headers?.host ?? "", g = a && a.map((h) => h + ".").find((h) => d.includes(h)) || "", u = d.replace(g, ""), o = l({
|
|
933
956
|
"content-type": "application/json",
|
|
934
|
-
"X-FORWARDED-HOST":
|
|
935
|
-
}),
|
|
936
|
-
const { salesChannel: h } =
|
|
957
|
+
"X-FORWARDED-HOST": u
|
|
958
|
+
}), p = () => {
|
|
959
|
+
const { salesChannel: h } = c.storage.channel;
|
|
937
960
|
return h ? {
|
|
938
961
|
key: dn,
|
|
939
962
|
value: h
|
|
940
963
|
} : null;
|
|
941
|
-
},
|
|
942
|
-
const { regionId: h, seller:
|
|
964
|
+
}, m = () => {
|
|
965
|
+
const { regionId: h, seller: v } = c.storage.channel, D = (v ? Buffer.from(`SW#${v}`).toString("base64") : null) ?? h;
|
|
943
966
|
return D ? {
|
|
944
967
|
key: un,
|
|
945
968
|
value: D
|
|
946
969
|
} : null;
|
|
947
|
-
},
|
|
948
|
-
const
|
|
949
|
-
({ key:
|
|
950
|
-
),
|
|
951
|
-
({ key:
|
|
970
|
+
}, S = (h) => {
|
|
971
|
+
const v = h.filter(
|
|
972
|
+
({ key: T }) => !Xe.has(T)
|
|
973
|
+
), C = h.find(
|
|
974
|
+
({ key: T, value: F }) => T === Xn && F !== "all-delivery-methods"
|
|
952
975
|
) ?? null, D = h.find(
|
|
953
|
-
({ key:
|
|
954
|
-
) ?? null, y = h.find(({ key:
|
|
955
|
-
return
|
|
956
|
-
},
|
|
957
|
-
const
|
|
958
|
-
|
|
959
|
-
},
|
|
976
|
+
({ key: T, value: F }) => T === Yn && F !== "all-delivery-options"
|
|
977
|
+
) ?? null, y = h.find(({ key: T }) => T === dn) ?? p(), A = h.find(({ key: T }) => T === un) ?? m();
|
|
978
|
+
return C !== null && v.push(C), D !== null && v.push(D), y !== null && v.push(y), A !== null && v.push(A), v;
|
|
979
|
+
}, I = (h, v) => {
|
|
980
|
+
const C = h.find(({ key: A }) => A === pn) ?? null, D = h.find(({ key: A }) => A === gn) ?? null, y = h.find(({ key: A }) => A === mn) ?? null;
|
|
981
|
+
C && Ye(C) && v.append(pn, C.value), D && Je(D) && v.append(gn, D.value), y && v.append(mn, y.value);
|
|
982
|
+
}, O = ({
|
|
960
983
|
query: h = "",
|
|
961
|
-
page:
|
|
962
|
-
count:
|
|
984
|
+
page: v,
|
|
985
|
+
count: C,
|
|
963
986
|
sort: D = "",
|
|
964
987
|
selectedFacets: y = [],
|
|
965
988
|
type: A,
|
|
966
|
-
showInvisibleItems:
|
|
967
|
-
sponsoredCount:
|
|
989
|
+
showInvisibleItems: T,
|
|
990
|
+
sponsoredCount: F,
|
|
968
991
|
hideUnavailableItems: U,
|
|
969
992
|
allowRedirect: G = !1
|
|
970
993
|
}) => {
|
|
971
|
-
const
|
|
972
|
-
page: (
|
|
973
|
-
count:
|
|
994
|
+
const N = new URLSearchParams({
|
|
995
|
+
page: (v + 1).toString(),
|
|
996
|
+
count: C !== 0 ? C.toString() : "1",
|
|
974
997
|
query: h,
|
|
975
998
|
sort: D,
|
|
976
|
-
locale:
|
|
999
|
+
locale: c.storage.locale
|
|
977
1000
|
});
|
|
978
|
-
if (
|
|
1001
|
+
if (I(y, N), T && N.append("show-invisible-items", "true"), t !== void 0) {
|
|
979
1002
|
const x = y.find(
|
|
980
|
-
({ key:
|
|
1003
|
+
({ key: me }) => me === Jn
|
|
981
1004
|
), on = x ? x.value : U?.toString() ?? t.toString();
|
|
982
|
-
|
|
1005
|
+
N.append("hideUnavailableItems", on);
|
|
983
1006
|
}
|
|
984
|
-
r !== void 0 &&
|
|
985
|
-
const $ =
|
|
986
|
-
return
|
|
987
|
-
`${s}/_v/api/intelligent-search/${A}/${$}?${
|
|
988
|
-
{ headers:
|
|
1007
|
+
r !== void 0 && N.append("simulationBehavior", r.toString()), i !== void 0 && N.append("showSponsored", i.toString()), F !== void 0 && N.append("sponsoredCount", F.toString()), G !== void 0 && N.append("allowRedirect", G.toString());
|
|
1008
|
+
const $ = S(y).map(({ key: x, value: on }) => `${x}/${on}`).join("/");
|
|
1009
|
+
return f(
|
|
1010
|
+
`${s}/_v/api/intelligent-search/${A}/${$}?${N.toString()}`,
|
|
1011
|
+
{ headers: o }
|
|
989
1012
|
);
|
|
990
1013
|
};
|
|
991
1014
|
return {
|
|
992
|
-
facets: (h) =>
|
|
993
|
-
products: (h) =>
|
|
1015
|
+
facets: (h) => O({ ...h, type: "facets" }),
|
|
1016
|
+
products: (h) => O({ ...h, type: "product_search" }),
|
|
994
1017
|
suggestedTerms: (h) => {
|
|
995
|
-
const
|
|
1018
|
+
const v = new URLSearchParams({
|
|
996
1019
|
query: h.query?.toString() ?? "",
|
|
997
|
-
locale:
|
|
1020
|
+
locale: c.storage.locale
|
|
998
1021
|
});
|
|
999
|
-
return
|
|
1000
|
-
`${s}/_v/api/intelligent-search/search_suggestions?${
|
|
1001
|
-
{ headers:
|
|
1022
|
+
return f(
|
|
1023
|
+
`${s}/_v/api/intelligent-search/search_suggestions?${v.toString()}`,
|
|
1024
|
+
{ headers: o }
|
|
1002
1025
|
);
|
|
1003
1026
|
},
|
|
1004
1027
|
topSearches: () => {
|
|
1005
1028
|
const h = new URLSearchParams({
|
|
1006
|
-
locale:
|
|
1029
|
+
locale: c.storage.locale
|
|
1007
1030
|
});
|
|
1008
|
-
return
|
|
1031
|
+
return f(
|
|
1009
1032
|
`${s}/_v/api/intelligent-search/top_searches?${h.toString()}`,
|
|
1010
|
-
{ headers:
|
|
1033
|
+
{ headers: o }
|
|
1011
1034
|
);
|
|
1012
1035
|
},
|
|
1013
1036
|
productCount: (h) => {
|
|
1014
|
-
const
|
|
1015
|
-
return h?.query &&
|
|
1016
|
-
`${s}/_v/api/intelligent-search/catalog_count?${
|
|
1017
|
-
{ headers:
|
|
1037
|
+
const v = new URLSearchParams();
|
|
1038
|
+
return h?.query && v.append("query", h.query.toString()), f(
|
|
1039
|
+
`${s}/_v/api/intelligent-search/catalog_count?${v.toString()}`,
|
|
1040
|
+
{ headers: o }
|
|
1018
1041
|
);
|
|
1019
1042
|
}
|
|
1020
1043
|
};
|
|
1021
|
-
},
|
|
1022
|
-
const t =
|
|
1044
|
+
}, Qe = (n, e) => {
|
|
1045
|
+
const t = Ke(n, e), r = He(n, e);
|
|
1023
1046
|
return {
|
|
1024
1047
|
search: t,
|
|
1025
1048
|
commerce: r
|
|
1026
1049
|
};
|
|
1027
|
-
},
|
|
1050
|
+
}, Ze = 20, nt = /* @__PURE__ */ new Set([
|
|
1028
1051
|
"brand",
|
|
1029
1052
|
"category",
|
|
1030
1053
|
"department",
|
|
1031
1054
|
"subcategory",
|
|
1032
1055
|
"collection",
|
|
1033
1056
|
"cluster"
|
|
1034
|
-
]), j = (n) => typeof n.pageType == "string" &&
|
|
1035
|
-
const t =
|
|
1057
|
+
]), j = (n) => typeof n.pageType == "string" && nt.has(n.pageType.toLowerCase()), et = (n, e) => {
|
|
1058
|
+
const t = jn(Ze), r = async (i) => Promise.all(
|
|
1036
1059
|
i.map(
|
|
1037
1060
|
(a) => t(async () => {
|
|
1038
|
-
const
|
|
1039
|
-
if (j(
|
|
1040
|
-
return
|
|
1061
|
+
const c = await e.commerce.catalog.portal.pagetype(a);
|
|
1062
|
+
if (j(c))
|
|
1063
|
+
return c;
|
|
1041
1064
|
throw new z(
|
|
1042
|
-
`Catalog returned ${
|
|
1065
|
+
`Catalog returned ${c.pageType} for slug: ${a}. This usually happens when there is more than one category with the same name in the same category tree level.`
|
|
1043
1066
|
);
|
|
1044
1067
|
})
|
|
1045
1068
|
)
|
|
@@ -1048,48 +1071,48 @@ const H = {
|
|
|
1048
1071
|
// DataLoader is being used to cache requests, not to batch them
|
|
1049
1072
|
batch: !1
|
|
1050
1073
|
});
|
|
1051
|
-
},
|
|
1074
|
+
}, tt = (n, e) => {
|
|
1052
1075
|
const t = async (r) => Promise.all(r.map((i) => e.commerce.catalog.salesChannel(i)));
|
|
1053
1076
|
return new rn(t);
|
|
1054
|
-
},
|
|
1055
|
-
const t =
|
|
1056
|
-
const
|
|
1077
|
+
}, rt = 1, it = (n, e) => {
|
|
1078
|
+
const t = jn(rt), r = async (a) => {
|
|
1079
|
+
const c = a.reduce((u, { items: o }) => [...u, o], []), s = [...c.flat()], l = await e.commerce.checkout.simulation({
|
|
1057
1080
|
country: a[0].country,
|
|
1058
1081
|
postalCode: a[0].postalCode,
|
|
1059
1082
|
items: s
|
|
1060
|
-
}),
|
|
1061
|
-
(
|
|
1062
|
-
const
|
|
1063
|
-
return typeof
|
|
1083
|
+
}), d = l.items.reduce(
|
|
1084
|
+
(u, o) => {
|
|
1085
|
+
const p = o.requestIndex;
|
|
1086
|
+
return typeof p == "number" && p < u.length && (u[p] = o), u;
|
|
1064
1087
|
},
|
|
1065
1088
|
Array(s.length).fill(null)
|
|
1066
|
-
), g =
|
|
1067
|
-
(
|
|
1089
|
+
), g = c.reduce(
|
|
1090
|
+
(u, o) => [...u, o.length + u[u.length - 1]],
|
|
1068
1091
|
[0]
|
|
1069
1092
|
);
|
|
1070
|
-
return
|
|
1071
|
-
...
|
|
1072
|
-
items:
|
|
1093
|
+
return c.map((u, o) => ({
|
|
1094
|
+
...l,
|
|
1095
|
+
items: d.slice(g[o], g[o + 1]).filter((p) => !!p)
|
|
1073
1096
|
}));
|
|
1074
1097
|
}, i = async (a) => t(r, a);
|
|
1075
1098
|
return new rn(i, {
|
|
1076
1099
|
maxBatchSize: 50
|
|
1077
1100
|
});
|
|
1078
|
-
},
|
|
1079
|
-
function
|
|
1101
|
+
}, at = (n, e) => Ce(n, e);
|
|
1102
|
+
function ot(n) {
|
|
1080
1103
|
return {
|
|
1081
1104
|
...n,
|
|
1082
|
-
description: n.description ?
|
|
1105
|
+
description: n.description ? at(n.description) : n.description
|
|
1083
1106
|
};
|
|
1084
1107
|
}
|
|
1085
1108
|
const B = (n, e) => ({
|
|
1086
1109
|
...n,
|
|
1087
|
-
isVariantOf:
|
|
1088
|
-
}),
|
|
1110
|
+
isVariantOf: ot(e)
|
|
1111
|
+
}), st = ({ flags: n }, e) => {
|
|
1089
1112
|
const t = async (r) => {
|
|
1090
1113
|
const i = r.map((g) => g.split("-")[0]), a = r.some(
|
|
1091
1114
|
(g) => g.split("-")[1] === "invisibleItems"
|
|
1092
|
-
), { products:
|
|
1115
|
+
), { products: c } = await e.search.products({
|
|
1093
1116
|
query: `sku:${i.join(";")}`,
|
|
1094
1117
|
page: 0,
|
|
1095
1118
|
count: i.length,
|
|
@@ -1097,45 +1120,45 @@ const B = (n, e) => ({
|
|
|
1097
1120
|
...n?.enableUnavailableItemsOnCart && {
|
|
1098
1121
|
hideUnavailableItems: !1
|
|
1099
1122
|
}
|
|
1100
|
-
}), s =
|
|
1101
|
-
(g,
|
|
1102
|
-
for (const
|
|
1103
|
-
g[
|
|
1123
|
+
}), s = c.reduce(
|
|
1124
|
+
(g, u) => {
|
|
1125
|
+
for (const o of u.items)
|
|
1126
|
+
g[o.itemId] = B(o, u);
|
|
1104
1127
|
return g;
|
|
1105
1128
|
},
|
|
1106
1129
|
{}
|
|
1107
|
-
),
|
|
1108
|
-
if (
|
|
1130
|
+
), l = i.map((g) => s[g]), d = i.filter((g) => !s[g]);
|
|
1131
|
+
if (d.length > 0)
|
|
1109
1132
|
throw new z(
|
|
1110
|
-
`Search API did not found the following skus: ${
|
|
1133
|
+
`Search API did not found the following skus: ${d.join(",")}`
|
|
1111
1134
|
);
|
|
1112
|
-
return
|
|
1135
|
+
return l;
|
|
1113
1136
|
};
|
|
1114
1137
|
return new rn(t, {
|
|
1115
1138
|
maxBatchSize: 99
|
|
1116
1139
|
// Max allowed batch size of Search API
|
|
1117
1140
|
});
|
|
1118
|
-
},
|
|
1119
|
-
const t =
|
|
1141
|
+
}, ct = (n, { clients: e }) => {
|
|
1142
|
+
const t = st(n, e), r = it(n, e), i = et(n, e), a = tt(n, e);
|
|
1120
1143
|
return {
|
|
1121
1144
|
skuLoader: t,
|
|
1122
1145
|
simulationLoader: r,
|
|
1123
1146
|
collectionLoader: i,
|
|
1124
1147
|
salesChannelLoader: a
|
|
1125
1148
|
};
|
|
1126
|
-
}, V = (n) => n.AvailableQuantity > 0, W = (n) => n.spotPrice ?? 0,
|
|
1149
|
+
}, V = (n) => n.AvailableQuantity > 0, W = (n) => n.spotPrice ?? 0, lt = (n) => n.Price ?? 0, wn = (n) => n ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", Kn = (n, e) => V(n) && !V(e) ? -1 : !V(n) && V(e) ? 1 : W(n) - W(e), dt = (n) => n === "available", q = (n, e = 0, t = 1) => {
|
|
1127
1150
|
const r = e / t;
|
|
1128
1151
|
return Math.round((n + r) * 100) / 100;
|
|
1129
|
-
},
|
|
1152
|
+
}, ut = (n, e = { includeTaxes: !1 }) => {
|
|
1130
1153
|
const t = n.filter(V), r = t[t.length - 1], i = r ? W(r) : 0;
|
|
1131
1154
|
return e.includeTaxes ? q(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1132
|
-
},
|
|
1155
|
+
}, An = (n, e = { includeTaxes: !1 }) => {
|
|
1133
1156
|
const [t] = n.filter(V), r = t ? W(t) : 0;
|
|
1134
1157
|
return e.includeTaxes ? q(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1135
|
-
},
|
|
1136
|
-
highPrice: (n) =>
|
|
1137
|
-
lowPrice: (n) =>
|
|
1138
|
-
lowPriceWithTaxes: (n) =>
|
|
1158
|
+
}, pt = {
|
|
1159
|
+
highPrice: (n) => ut(n),
|
|
1160
|
+
lowPrice: (n) => An(n),
|
|
1161
|
+
lowPriceWithTaxes: (n) => An(n, { includeTaxes: !0 }),
|
|
1139
1162
|
offerCount: (n) => n.length,
|
|
1140
1163
|
priceCurrency: async (n, e, t) => {
|
|
1141
1164
|
const {
|
|
@@ -1145,20 +1168,20 @@ const B = (n, e) => ({
|
|
|
1145
1168
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1146
1169
|
},
|
|
1147
1170
|
offers: (n) => n
|
|
1148
|
-
},
|
|
1171
|
+
}, gt = {
|
|
1149
1172
|
ratingValue: () => 5,
|
|
1150
1173
|
reviewCount: () => 0
|
|
1151
|
-
},
|
|
1174
|
+
}, Pn = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", mt = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", ht = (n) => {
|
|
1152
1175
|
let e = n.slice(0);
|
|
1153
|
-
for (let t = 0; t <
|
|
1154
|
-
e = e.replace(new RegExp(
|
|
1176
|
+
for (let t = 0; t < Pn.length; t++)
|
|
1177
|
+
e = e.replace(new RegExp(Pn.charAt(t), "g"), mt.charAt(t));
|
|
1155
1178
|
return e;
|
|
1156
|
-
},
|
|
1157
|
-
function
|
|
1179
|
+
}, ft = (n) => n.replace(/[·/_,:]/, "-");
|
|
1180
|
+
function Qn(n) {
|
|
1158
1181
|
const t = n.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1159
|
-
return
|
|
1182
|
+
return ft(ht(t)).toLowerCase();
|
|
1160
1183
|
}
|
|
1161
|
-
const K = (n) => n.type === "brand" || j(n) && n.pageType.toLowerCase() === "brand", hn = (n) => j(n) && n.pageType.toLowerCase() === "collection", sn = (n) => K(n) || hn(n) ?
|
|
1184
|
+
const K = (n) => n.type === "brand" || j(n) && n.pageType.toLowerCase() === "brand", hn = (n) => j(n) && n.pageType.toLowerCase() === "collection", sn = (n) => K(n) || hn(n) ? Qn(n.name) : j(n) ? new URL(`https://${n.url}`).pathname.slice(1).toLowerCase() : new URL(n.url).pathname.slice(1).toLowerCase(), Zn = {
|
|
1162
1185
|
id: ({ id: n }) => n.toString(),
|
|
1163
1186
|
slug: (n) => sn(n),
|
|
1164
1187
|
seo: (n) => K(n) || j(n) ? {
|
|
@@ -1185,33 +1208,33 @@ const K = (n) => n.type === "brand" || j(n) && n.pageType.toLowerCase() === "bra
|
|
|
1185
1208
|
breadcrumbList: async (n, e, t) => {
|
|
1186
1209
|
const {
|
|
1187
1210
|
loaders: { collectionLoader: r }
|
|
1188
|
-
} = t, a = sn(n).split("/").filter((
|
|
1189
|
-
(
|
|
1211
|
+
} = t, a = sn(n).split("/").filter((l) => !!l), c = a.map(
|
|
1212
|
+
(l, d) => a.slice(0, d + 1).join("/")
|
|
1190
1213
|
), s = await Promise.all(
|
|
1191
|
-
|
|
1192
|
-
const
|
|
1193
|
-
return { slug:
|
|
1214
|
+
c.map(async (l) => {
|
|
1215
|
+
const d = await r.load(l);
|
|
1216
|
+
return { slug: l, ...d };
|
|
1194
1217
|
})
|
|
1195
1218
|
);
|
|
1196
1219
|
return {
|
|
1197
|
-
itemListElement: s.map((
|
|
1198
|
-
item: hn(
|
|
1199
|
-
`https://${
|
|
1220
|
+
itemListElement: s.map((l, d) => ({
|
|
1221
|
+
item: hn(l) ? `/${l.slug}` : new URL(
|
|
1222
|
+
`https://${l.url}`
|
|
1200
1223
|
).pathname.toLowerCase(),
|
|
1201
|
-
name:
|
|
1202
|
-
position:
|
|
1224
|
+
name: l.name,
|
|
1225
|
+
position: d + 1
|
|
1203
1226
|
})),
|
|
1204
1227
|
numberOfItems: s.length
|
|
1205
1228
|
};
|
|
1206
1229
|
}
|
|
1207
|
-
},
|
|
1230
|
+
}, ne = {
|
|
1208
1231
|
buy: "whoboughtalsobought",
|
|
1209
1232
|
view: "whosawalsosaw",
|
|
1210
1233
|
similars: "similars",
|
|
1211
1234
|
viewAndBought: "whosawalsobought",
|
|
1212
1235
|
accessories: "accessories",
|
|
1213
1236
|
suggestions: "suggestions"
|
|
1214
|
-
},
|
|
1237
|
+
}, En = ({ key: n, value: e }) => {
|
|
1215
1238
|
switch (n) {
|
|
1216
1239
|
case "price":
|
|
1217
1240
|
return { key: n, value: e.replace("-to-", ":") };
|
|
@@ -1230,45 +1253,45 @@ const K = (n) => n.type === "brand" || j(n) && n.pageType.toLowerCase() === "bra
|
|
|
1230
1253
|
}, Tn = (n) => {
|
|
1231
1254
|
const e = n.split(":").map(Number);
|
|
1232
1255
|
return e.length !== 2 || Number.isNaN(e[0]) || Number.isNaN(e[1]) ? null : e;
|
|
1233
|
-
},
|
|
1256
|
+
}, St = (n) => typeof ne[n] == "string", yt = (n) => {
|
|
1234
1257
|
const e = n?.filter(
|
|
1235
|
-
(t) =>
|
|
1258
|
+
(t) => St(t.key)
|
|
1236
1259
|
);
|
|
1237
1260
|
if (Array.isArray(e) && e.length > 1)
|
|
1238
1261
|
throw new k(
|
|
1239
1262
|
`You passed ${e.length} cross selling facets but only one is allowed. Please leave one of the following facet: ${e.map((t) => t.key).join(",")}`
|
|
1240
1263
|
);
|
|
1241
1264
|
return e?.[0] ?? null;
|
|
1242
|
-
},
|
|
1265
|
+
}, It = (n) => n?.find((e) => e.key === "slug")?.value ?? null, vt = (n) => n?.find((e) => e.key === "id")?.value ?? null, _n = (n) => n?.find((e) => e.key === "locale")?.value ?? null, Un = (n) => n?.find((e) => e.key === "channel")?.value ?? null, fn = (n, e) => {
|
|
1243
1266
|
let t = 0;
|
|
1244
1267
|
for (let r = 1; r < n.length; r++)
|
|
1245
1268
|
e(n[t], n[r]) > 0 && (t = r);
|
|
1246
1269
|
return n[t];
|
|
1247
|
-
},
|
|
1270
|
+
}, Ot = {
|
|
1248
1271
|
__resolveType: ({ type: n, values: e }) => n !== "TEXT" && n !== "DELIVERY" ? "StoreFacetRange" : !e || e.length === 0 ? "StoreFacetBoolean" : e.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1249
|
-
},
|
|
1272
|
+
}, Ct = {
|
|
1250
1273
|
key: ({ key: n }) => n,
|
|
1251
1274
|
label: ({ name: n }) => n,
|
|
1252
1275
|
values: ({ values: n }) => n.sort((e, t) => e.name.localeCompare(t.name))
|
|
1253
|
-
},
|
|
1276
|
+
}, bt = {
|
|
1254
1277
|
key: ({ key: n }) => n,
|
|
1255
1278
|
label: ({ name: n }) => n,
|
|
1256
1279
|
min: ({ values: n, key: e }, t, { storage: { searchArgs: r } }) => {
|
|
1257
1280
|
const i = Tn(
|
|
1258
1281
|
r?.selectedFacets?.find((s) => s.key === e)?.value ?? ""
|
|
1259
|
-
),
|
|
1282
|
+
), c = fn(n, (s, l) => s.range.from - l.range.from)?.range?.from ?? 0;
|
|
1260
1283
|
return {
|
|
1261
|
-
selected: i?.[0] ??
|
|
1262
|
-
absolute:
|
|
1284
|
+
selected: i?.[0] ?? c,
|
|
1285
|
+
absolute: c
|
|
1263
1286
|
};
|
|
1264
1287
|
},
|
|
1265
1288
|
max: ({ values: n, key: e }, t, { storage: { searchArgs: r } }) => {
|
|
1266
1289
|
const i = Tn(
|
|
1267
1290
|
r?.selectedFacets?.find((s) => s.key === e)?.value ?? ""
|
|
1268
|
-
),
|
|
1291
|
+
), c = fn(n, (s, l) => l.range.to - s.range.to)?.range?.to ?? 0;
|
|
1269
1292
|
return {
|
|
1270
|
-
selected: i?.[1] ??
|
|
1271
|
-
absolute:
|
|
1293
|
+
selected: i?.[1] ?? c,
|
|
1294
|
+
absolute: c
|
|
1272
1295
|
};
|
|
1273
1296
|
}
|
|
1274
1297
|
}, Dt = {
|
|
@@ -1276,12 +1299,12 @@ const K = (n) => n.type === "brand" || j(n) && n.pageType.toLowerCase() === "bra
|
|
|
1276
1299
|
label: ({ name: n }) => n || "unknown",
|
|
1277
1300
|
selected: ({ selected: n }) => n,
|
|
1278
1301
|
quantity: ({ quantity: n }) => n
|
|
1279
|
-
},
|
|
1302
|
+
}, wt = async (n, { data: e }, { clients: { commerce: t } }) => {
|
|
1280
1303
|
if (!e?.orderId)
|
|
1281
1304
|
throw new k("Missing orderId");
|
|
1282
1305
|
return { data: (await t.checkout.cancelOrder(e))?.data };
|
|
1283
1306
|
};
|
|
1284
|
-
function
|
|
1307
|
+
function ee(n) {
|
|
1285
1308
|
if (!n || n.status !== "pending")
|
|
1286
1309
|
return null;
|
|
1287
1310
|
for (const e of n.dimensionStatus) {
|
|
@@ -1299,18 +1322,18 @@ function ne(n) {
|
|
|
1299
1322
|
}
|
|
1300
1323
|
return null;
|
|
1301
1324
|
}
|
|
1302
|
-
function
|
|
1325
|
+
function At(n) {
|
|
1303
1326
|
if (!n || n.status !== "pending") return !1;
|
|
1304
1327
|
const e = n.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1305
1328
|
return e.length === 0 ? !1 : e.every((t) => !t.isUserNextAuthorizer);
|
|
1306
1329
|
}
|
|
1307
|
-
const
|
|
1308
|
-
const r = await t.oms.processOrderAuthorization(e), i =
|
|
1330
|
+
const Pt = async (n, { data: e }, { clients: { commerce: t } }) => {
|
|
1331
|
+
const r = await t.oms.processOrderAuthorization(e), i = ee(r);
|
|
1309
1332
|
return {
|
|
1310
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1333
|
+
isPendingForOtherAuthorizer: !i && At(r),
|
|
1311
1334
|
ruleForAuthorization: i
|
|
1312
1335
|
};
|
|
1313
|
-
},
|
|
1336
|
+
}, Et = async (n, { data: e }, { clients: { commerce: t } }) => {
|
|
1314
1337
|
if (!e?.objectKey)
|
|
1315
1338
|
throw new k("Missing objectKey");
|
|
1316
1339
|
const r = e.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
@@ -1319,20 +1342,20 @@ const Et = async (n, { data: e }, { clients: { commerce: t } }) => {
|
|
|
1319
1342
|
orderFormId: r,
|
|
1320
1343
|
sessionToken: e.sessionToken ?? void 0
|
|
1321
1344
|
});
|
|
1322
|
-
}, Tt = async (n, { data: e }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(e))?.Id }),
|
|
1345
|
+
}, Tt = async (n, { data: e }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(e))?.Id }), _t = async (n, { data: e }, { clients: { commerce: t } }) => {
|
|
1323
1346
|
const { fileContent: r, fileName: i, mimeType: a } = e;
|
|
1324
1347
|
if (!r || !i || !a)
|
|
1325
1348
|
throw new k(
|
|
1326
1349
|
"Missing required fields: fileContent, fileName, mimeType"
|
|
1327
1350
|
);
|
|
1328
|
-
const
|
|
1329
|
-
if (Math.floor(
|
|
1351
|
+
const c = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
|
|
1352
|
+
if (Math.floor(c.length * 3 / 4) > s)
|
|
1330
1353
|
throw new k("File exceeds maximum allowed size of 5MB");
|
|
1331
1354
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
|
|
1332
|
-
|
|
1355
|
+
c
|
|
1333
1356
|
))
|
|
1334
1357
|
throw new k("Invalid Base64 fileContent");
|
|
1335
|
-
const g = Buffer.from(
|
|
1358
|
+
const g = Buffer.from(c, "base64");
|
|
1336
1359
|
return await t.orderEntry.uploadFile({
|
|
1337
1360
|
fileBuffer: g,
|
|
1338
1361
|
fileName: i,
|
|
@@ -1361,19 +1384,19 @@ const Sn = (n, e) => {
|
|
|
1361
1384
|
n.storage.channel = nn.parse(e);
|
|
1362
1385
|
}, yn = (n, e) => {
|
|
1363
1386
|
n.storage.locale = e;
|
|
1364
|
-
},
|
|
1387
|
+
}, te = (n) => be.createHash("md5").update(n).digest("hex"), Y = {
|
|
1365
1388
|
attachment: "ATTACHMENT",
|
|
1366
1389
|
specification: "SPECIFICATION",
|
|
1367
1390
|
attribute: "ATTRIBUTE"
|
|
1368
1391
|
};
|
|
1369
|
-
function
|
|
1392
|
+
function re(n) {
|
|
1370
1393
|
return {
|
|
1371
1394
|
name: n.name,
|
|
1372
1395
|
value: n.content,
|
|
1373
1396
|
valueReference: Y.attachment
|
|
1374
1397
|
};
|
|
1375
1398
|
}
|
|
1376
|
-
function
|
|
1399
|
+
function Ut(n) {
|
|
1377
1400
|
return {
|
|
1378
1401
|
propertyID: n.id,
|
|
1379
1402
|
name: n.name,
|
|
@@ -1384,12 +1407,12 @@ function kt(n) {
|
|
|
1384
1407
|
}
|
|
1385
1408
|
};
|
|
1386
1409
|
}
|
|
1387
|
-
function
|
|
1388
|
-
return
|
|
1410
|
+
function ie(n) {
|
|
1411
|
+
return te(
|
|
1389
1412
|
`${n.name}:${JSON.stringify(n.value)}:${n.valueReference}`
|
|
1390
1413
|
);
|
|
1391
1414
|
}
|
|
1392
|
-
const
|
|
1415
|
+
const kt = (n) => {
|
|
1393
1416
|
const e = n.postalCode, t = n.geoCoordinates, r = {
|
|
1394
1417
|
addressType: n.addressType || null,
|
|
1395
1418
|
postalCode: e || null,
|
|
@@ -1409,9 +1432,9 @@ const Nt = (n) => {
|
|
|
1409
1432
|
}
|
|
1410
1433
|
return [r];
|
|
1411
1434
|
}, Ft = (n, e, t) => {
|
|
1412
|
-
const r = e.postalCode, i = e.geoCoordinates, a = n?.shippingData?.availableAddresses ?? [],
|
|
1413
|
-
if (!t &&
|
|
1414
|
-
return [
|
|
1435
|
+
const r = e.postalCode, i = e.geoCoordinates, a = n?.shippingData?.availableAddresses ?? [], c = n?.shippingData?.selectedAddresses ?? [];
|
|
1436
|
+
if (!t && c.length > 0)
|
|
1437
|
+
return [c[0]];
|
|
1415
1438
|
if (t && a.length > 0)
|
|
1416
1439
|
for (const s of a) {
|
|
1417
1440
|
if (r && i && (s.postalCode === r || s.geoCoordinates[0] === i.longitude && s.geoCoordinates[1] === i.latitude))
|
|
@@ -1422,31 +1445,31 @@ const Nt = (n) => {
|
|
|
1422
1445
|
return [s];
|
|
1423
1446
|
}
|
|
1424
1447
|
return null;
|
|
1425
|
-
},
|
|
1426
|
-
if (!
|
|
1448
|
+
}, ae = (n, e) => {
|
|
1449
|
+
if (!Nt(e))
|
|
1427
1450
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1428
|
-
if (
|
|
1451
|
+
if (!Bt(n))
|
|
1429
1452
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1430
1453
|
const [t] = n?.shippingData?.selectedAddresses ?? [];
|
|
1431
|
-
if (
|
|
1454
|
+
if (Rt(t, e.postalCode) || Lt(t, e.geoCoordinates) || Mt(t, e.addressType))
|
|
1432
1455
|
return { updateShipping: !0, addressChanged: !0 };
|
|
1433
1456
|
const { logisticsInfo: r } = n.shippingData;
|
|
1434
|
-
return
|
|
1435
|
-
},
|
|
1457
|
+
return $t(r, e) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
1458
|
+
}, Nt = (n) => !!n.postalCode || n.geoCoordinates?.latitude && n.geoCoordinates?.longitude, Rt = (n, e) => typeof e == "string" && n?.postalCode !== e, Lt = (n, e) => typeof e?.latitude == "number" && typeof e?.longitude == "number" && (n?.geoCoordinates[0] !== e?.longitude || n?.geoCoordinates[1] !== e?.latitude), Mt = (n, e) => typeof e == "string" && n?.addressType !== e, Bt = (n) => n.items.length !== 0, $t = (n, e) => {
|
|
1436
1459
|
const t = e?.deliveryMode?.deliveryChannel, r = e?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = e?.deliveryMode?.deliveryWindow || {};
|
|
1437
1460
|
return n.some(
|
|
1438
|
-
({ selectedDeliveryChannel:
|
|
1439
|
-
const
|
|
1440
|
-
return
|
|
1441
|
-
(
|
|
1461
|
+
({ selectedDeliveryChannel: c, selectedSla: s, slas: l }) => {
|
|
1462
|
+
const d = t && c !== t, g = r && s !== r;
|
|
1463
|
+
return l?.some((u) => d && u.deliveryChannel === t || g && u.id === r ? !0 : i && a && u.deliveryChannel === t && u.id === r && (!u?.deliveryWindow || u?.deliveryWindow?.startDateUtc !== i || u?.deliveryWindow?.endDateUtc !== a) && u.availableDeliveryWindows?.some(
|
|
1464
|
+
(o) => o?.startDateUtc === i && o?.endDateUtc === a
|
|
1442
1465
|
));
|
|
1443
1466
|
}
|
|
1444
1467
|
);
|
|
1445
|
-
},
|
|
1468
|
+
}, oe = (n) => n.valueReference === Y.attachment, In = (n) => [
|
|
1446
1469
|
n.itemOffered.sku,
|
|
1447
1470
|
n.seller.identifier,
|
|
1448
1471
|
n.price < 0.01 ? "Gift" : void 0,
|
|
1449
|
-
n.itemOffered.additionalProperty?.filter(
|
|
1472
|
+
n.itemOffered.additionalProperty?.filter(oe).map(ie).join("-")
|
|
1450
1473
|
].filter(Boolean).join("::"), en = (n, e) => ({
|
|
1451
1474
|
listPrice: n.listPrice / 100,
|
|
1452
1475
|
price: n.sellingPrice / 100,
|
|
@@ -1456,37 +1479,37 @@ const Nt = (n) => {
|
|
|
1456
1479
|
sku: n.id,
|
|
1457
1480
|
image: [],
|
|
1458
1481
|
name: n.name,
|
|
1459
|
-
additionalProperty: n.attachments.map(
|
|
1482
|
+
additionalProperty: n.attachments.map(re)
|
|
1460
1483
|
},
|
|
1461
1484
|
index: e
|
|
1462
|
-
}),
|
|
1485
|
+
}), zt = (n) => ({
|
|
1463
1486
|
quantity: n.quantity,
|
|
1464
1487
|
seller: n.seller.identifier,
|
|
1465
1488
|
id: n.itemOffered.sku,
|
|
1466
1489
|
index: n.index,
|
|
1467
|
-
attachments: (n.itemOffered.additionalProperty?.filter(
|
|
1490
|
+
attachments: (n.itemOffered.additionalProperty?.filter(oe) ?? []).map((e) => ({
|
|
1468
1491
|
name: e.name,
|
|
1469
1492
|
content: e.value
|
|
1470
1493
|
}))
|
|
1471
|
-
}),
|
|
1494
|
+
}), kn = (n) => n.reduce((e, t) => {
|
|
1472
1495
|
const r = In(t);
|
|
1473
1496
|
return e.has(r) || e.set(r, []), e.get(r)?.push(t), e;
|
|
1474
|
-
}, /* @__PURE__ */ new Map()),
|
|
1475
|
-
const t = (s,
|
|
1497
|
+
}, /* @__PURE__ */ new Map()), Vt = (n, e) => {
|
|
1498
|
+
const t = (s, l) => ({
|
|
1476
1499
|
...s,
|
|
1477
1500
|
itemOffered: {
|
|
1478
1501
|
sku: s.itemOffered.sku
|
|
1479
1502
|
},
|
|
1480
|
-
index:
|
|
1481
|
-
}), r = e.items.map(en).map(t), i = n.acceptedOffer.map(t), a = n.orderNumber === e.orderFormId,
|
|
1482
|
-
return a &&
|
|
1503
|
+
index: l
|
|
1504
|
+
}), r = e.items.map(en).map(t), i = n.acceptedOffer.map(t), a = n.orderNumber === e.orderFormId, c = Cn(r, i);
|
|
1505
|
+
return a && c;
|
|
1483
1506
|
};
|
|
1484
|
-
function
|
|
1507
|
+
function se(n, e) {
|
|
1485
1508
|
return n?.some(
|
|
1486
1509
|
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 && n[t.parentItemIndex]?.id === e
|
|
1487
1510
|
);
|
|
1488
1511
|
}
|
|
1489
|
-
function
|
|
1512
|
+
function ce(n, e) {
|
|
1490
1513
|
return n?.some(
|
|
1491
1514
|
(t) => t.id === e && t.parentItemIndex !== null
|
|
1492
1515
|
);
|
|
@@ -1494,7 +1517,7 @@ function se(n, e) {
|
|
|
1494
1517
|
const Fn = (n) => {
|
|
1495
1518
|
const e = n.items.reduce(
|
|
1496
1519
|
(t, r, i) => {
|
|
1497
|
-
const a =
|
|
1520
|
+
const a = ce(n.items, r.id) || se(n.items, r.id) ? `${In(en(r))}::${i}` : In(en(r));
|
|
1498
1521
|
return t[a] || (t[a] = []), t[a].push(r), t;
|
|
1499
1522
|
},
|
|
1500
1523
|
{}
|
|
@@ -1502,8 +1525,8 @@ const Fn = (n) => {
|
|
|
1502
1525
|
return {
|
|
1503
1526
|
...n,
|
|
1504
1527
|
items: Object.values(e).map((t) => {
|
|
1505
|
-
const [r] = t, i = t.reduce((
|
|
1506
|
-
(
|
|
1528
|
+
const [r] = t, i = t.reduce((c, s) => c + s.quantity, 0), a = t.reduce(
|
|
1529
|
+
(c, s) => c + (s?.priceDefinition?.total ?? (s?.quantity ?? 0) * (s?.sellingPrice ?? 0)),
|
|
1507
1530
|
0
|
|
1508
1531
|
);
|
|
1509
1532
|
return {
|
|
@@ -1513,7 +1536,7 @@ const Fn = (n) => {
|
|
|
1513
1536
|
};
|
|
1514
1537
|
})
|
|
1515
1538
|
};
|
|
1516
|
-
},
|
|
1539
|
+
}, Nn = async (n, e, t) => ({
|
|
1517
1540
|
order: {
|
|
1518
1541
|
orderNumber: n.orderFormId,
|
|
1519
1542
|
acceptedOffer: n.items.map(async (r) => ({
|
|
@@ -1526,7 +1549,7 @@ const Fn = (n) => {
|
|
|
1526
1549
|
text: r,
|
|
1527
1550
|
status: i.toUpperCase()
|
|
1528
1551
|
}))
|
|
1529
|
-
}),
|
|
1552
|
+
}), le = ({ items: n }, e) => {
|
|
1530
1553
|
const t = n.map((r) => ({
|
|
1531
1554
|
id: r.id,
|
|
1532
1555
|
quantity: r.quantity,
|
|
@@ -1534,16 +1557,16 @@ const Fn = (n) => {
|
|
|
1534
1557
|
attachments: r.attachments
|
|
1535
1558
|
// customizations
|
|
1536
1559
|
}));
|
|
1537
|
-
return
|
|
1560
|
+
return te(
|
|
1538
1561
|
JSON.stringify({ sessionId: e?.id ?? "", items: t })
|
|
1539
1562
|
);
|
|
1540
|
-
},
|
|
1563
|
+
}, Rn = async (n, e, t) => {
|
|
1541
1564
|
try {
|
|
1542
1565
|
return await e.checkout.setCustomData({
|
|
1543
1566
|
id: n.orderFormId,
|
|
1544
1567
|
appId: "faststore",
|
|
1545
1568
|
key: "cartEtag",
|
|
1546
|
-
value:
|
|
1569
|
+
value: le(n, t)
|
|
1547
1570
|
});
|
|
1548
1571
|
} catch (r) {
|
|
1549
1572
|
throw console.error(
|
|
@@ -1553,22 +1576,22 @@ const Fn = (n) => {
|
|
|
1553
1576
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
1554
1577
|
), r;
|
|
1555
1578
|
}
|
|
1556
|
-
},
|
|
1579
|
+
}, xt = (n, e) => {
|
|
1557
1580
|
const r = n.customData?.customApps.find(
|
|
1558
1581
|
(a) => a.id === "faststore"
|
|
1559
1582
|
)?.fields?.cartEtag;
|
|
1560
|
-
return r == null ? !0 :
|
|
1561
|
-
},
|
|
1583
|
+
return r == null ? !0 : le(n, e) !== r;
|
|
1584
|
+
}, qt = async (n, { clients: { commerce: e } }) => e.checkout.clearOrderFormMessages({
|
|
1562
1585
|
id: n
|
|
1563
|
-
}),
|
|
1586
|
+
}), Ln = async (n, e, { clients: { commerce: t } }) => {
|
|
1564
1587
|
if (!e)
|
|
1565
1588
|
return n;
|
|
1566
|
-
const { updateShipping: r, addressChanged: i } =
|
|
1589
|
+
const { updateShipping: r, addressChanged: i } = ae(
|
|
1567
1590
|
n,
|
|
1568
1591
|
e
|
|
1569
1592
|
);
|
|
1570
1593
|
if (r) {
|
|
1571
|
-
const a = Ft(n, e, i), s = a ||
|
|
1594
|
+
const a = Ft(n, e, i), s = a || kt(e);
|
|
1572
1595
|
return !!e.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
1573
1596
|
{
|
|
1574
1597
|
id: n.orderFormId,
|
|
@@ -1588,95 +1611,95 @@ const Fn = (n) => {
|
|
|
1588
1611
|
);
|
|
1589
1612
|
}
|
|
1590
1613
|
return n;
|
|
1591
|
-
},
|
|
1614
|
+
}, jt = (n, e) => {
|
|
1592
1615
|
if (!n)
|
|
1593
1616
|
return "";
|
|
1594
1617
|
const r = tn(n)[e];
|
|
1595
1618
|
return r ? r.split("=")[1] : "";
|
|
1596
|
-
},
|
|
1597
|
-
const i =
|
|
1619
|
+
}, Wt = async (n, { cart: { order: e }, session: t }, r) => {
|
|
1620
|
+
const i = jt(
|
|
1598
1621
|
r.headers.cookie,
|
|
1599
1622
|
"checkout.vtex.com"
|
|
1600
1623
|
), {
|
|
1601
1624
|
clients: { commerce: a },
|
|
1602
|
-
loaders: { skuLoader:
|
|
1603
|
-
} = r, s = t?.channel,
|
|
1604
|
-
s && Sn(r, s),
|
|
1605
|
-
const
|
|
1625
|
+
loaders: { skuLoader: c }
|
|
1626
|
+
} = r, s = t?.channel, l = t?.locale;
|
|
1627
|
+
s && Sn(r, s), l && yn(r, l);
|
|
1628
|
+
const d = await a.checkout.orderForm({
|
|
1606
1629
|
id: i || void 0,
|
|
1607
1630
|
channel: r.storage.channel
|
|
1608
|
-
}), g =
|
|
1609
|
-
|
|
1610
|
-
const
|
|
1611
|
-
if (
|
|
1612
|
-
const y = await
|
|
1613
|
-
|
|
1631
|
+
}), g = d.orderFormId;
|
|
1632
|
+
d.messages.length !== 0 && await qt(g, r);
|
|
1633
|
+
const u = tn(r?.headers?.cookie ?? "")?.vtex_session, o = Z(u), { acceptedOffer: p, shouldSplitItem: m } = e;
|
|
1634
|
+
if (xt(d, o)) {
|
|
1635
|
+
const y = await Rn(
|
|
1636
|
+
d,
|
|
1614
1637
|
a,
|
|
1615
|
-
|
|
1638
|
+
o
|
|
1616
1639
|
).then(Fn);
|
|
1617
1640
|
if (g)
|
|
1618
|
-
return
|
|
1641
|
+
return Nn(y, c, m);
|
|
1619
1642
|
}
|
|
1620
|
-
const
|
|
1621
|
-
(y, [A,
|
|
1622
|
-
const
|
|
1623
|
-
if (!
|
|
1624
|
-
return
|
|
1625
|
-
const [U, ...G] =
|
|
1626
|
-
if (
|
|
1643
|
+
const I = kn(p), O = kn(d.items.map(en)), w = Array.from(O.entries()), _ = Array.from(I.entries()), { itemsToAdd: P, itemsToUpdate: b } = _.reduce(
|
|
1644
|
+
(y, [A, T]) => {
|
|
1645
|
+
const F = O.get(A);
|
|
1646
|
+
if (!F)
|
|
1647
|
+
return T.forEach(($) => y.itemsToAdd.push($)), y;
|
|
1648
|
+
const [U, ...G] = F;
|
|
1649
|
+
if (ce(d.items, U.itemOffered.sku) || se(d.items, U.itemOffered.sku))
|
|
1627
1650
|
return y.itemsToUpdate.push(U), y;
|
|
1628
|
-
const
|
|
1651
|
+
const N = T.reduce(($, x) => $ + x.quantity, 0);
|
|
1629
1652
|
return y.itemsToUpdate.push({
|
|
1630
1653
|
...U,
|
|
1631
|
-
quantity:
|
|
1654
|
+
quantity: N
|
|
1632
1655
|
}), G.forEach(($) => y.itemsToUpdate.push({ ...$, quantity: 0 })), y;
|
|
1633
1656
|
},
|
|
1634
1657
|
{
|
|
1635
1658
|
itemsToAdd: [],
|
|
1636
1659
|
itemsToUpdate: []
|
|
1637
1660
|
}
|
|
1638
|
-
), E = w.filter(([y]) => !
|
|
1639
|
-
|
|
1640
|
-
), { updateShipping:
|
|
1641
|
-
if (h.length === 0 && !
|
|
1661
|
+
), E = w.filter(([y]) => !I.has(y)).flatMap(([, y]) => y.map((A) => ({ ...A, quantity: 0 }))), h = [...P, ...b, ...E].map(
|
|
1662
|
+
zt
|
|
1663
|
+
), { updateShipping: v } = t ? ae(d, t) : { updateShipping: !1 };
|
|
1664
|
+
if (h.length === 0 && !v)
|
|
1642
1665
|
return null;
|
|
1643
|
-
let
|
|
1644
|
-
h.length > 0 ?
|
|
1645
|
-
id:
|
|
1666
|
+
let C;
|
|
1667
|
+
h.length > 0 ? C = await a.checkout.updateOrderFormItems({
|
|
1668
|
+
id: d.orderFormId,
|
|
1646
1669
|
orderItems: h,
|
|
1647
|
-
shouldSplitItem:
|
|
1670
|
+
shouldSplitItem: m
|
|
1648
1671
|
}).then(
|
|
1649
|
-
(y) =>
|
|
1650
|
-
) :
|
|
1651
|
-
|
|
1672
|
+
(y) => Ln(y, t, r)
|
|
1673
|
+
) : C = await Ln(
|
|
1674
|
+
d,
|
|
1652
1675
|
t,
|
|
1653
1676
|
r
|
|
1654
|
-
),
|
|
1677
|
+
), C = await Promise.resolve(C).then((y) => {
|
|
1655
1678
|
if (t?.marketingData) {
|
|
1656
1679
|
const A = {
|
|
1657
1680
|
...y.marketingData,
|
|
1658
1681
|
...t.marketingData
|
|
1659
1682
|
};
|
|
1660
1683
|
return a.checkout.marketingData({
|
|
1661
|
-
id:
|
|
1684
|
+
id: d.orderFormId,
|
|
1662
1685
|
marketingData: A
|
|
1663
1686
|
});
|
|
1664
1687
|
}
|
|
1665
1688
|
return y;
|
|
1666
|
-
}).then((y) =>
|
|
1689
|
+
}).then((y) => l && y.clientPreferencesData?.locale !== l ? a.checkout.clientPreferencesData({
|
|
1667
1690
|
id: y.orderFormId,
|
|
1668
1691
|
clientPreferencesData: {
|
|
1669
1692
|
...y.clientPreferencesData,
|
|
1670
|
-
locale:
|
|
1693
|
+
locale: l
|
|
1671
1694
|
}
|
|
1672
|
-
}) : y).then((y) =>
|
|
1695
|
+
}) : y).then((y) => Rn(y, a, o)).then(Fn);
|
|
1673
1696
|
const D = Cn(
|
|
1674
|
-
|
|
1675
|
-
|
|
1697
|
+
d.messages,
|
|
1698
|
+
C.messages
|
|
1676
1699
|
);
|
|
1677
|
-
return
|
|
1700
|
+
return Vt(e, C) && D ? null : Nn(C, c, m);
|
|
1678
1701
|
};
|
|
1679
|
-
async function
|
|
1702
|
+
async function Gt(n, e, t) {
|
|
1680
1703
|
try {
|
|
1681
1704
|
const r = await n.commerce.checkout.address({
|
|
1682
1705
|
postalCode: t,
|
|
@@ -1693,41 +1716,41 @@ async function Ht(n, e, t) {
|
|
|
1693
1716
|
), r;
|
|
1694
1717
|
}
|
|
1695
1718
|
}
|
|
1696
|
-
const
|
|
1697
|
-
const
|
|
1698
|
-
let
|
|
1699
|
-
if ((!
|
|
1700
|
-
const U = await
|
|
1719
|
+
const Ht = async (n, { session: e, search: t }, { clients: r, headers: i, account: a }) => {
|
|
1720
|
+
const c = nn.parse(e.channel ?? ""), s = String(e.postalCode ?? ""), l = e.country ?? "";
|
|
1721
|
+
let d = e.city ?? null, g = e.geoCoordinates ?? null;
|
|
1722
|
+
if ((!d || !g) && s !== "" && l !== "") {
|
|
1723
|
+
const U = await Gt(
|
|
1701
1724
|
r,
|
|
1702
|
-
|
|
1725
|
+
l,
|
|
1703
1726
|
s
|
|
1704
1727
|
);
|
|
1705
|
-
|
|
1728
|
+
d = U.city, g = U.geoCoordinates;
|
|
1706
1729
|
}
|
|
1707
|
-
const
|
|
1708
|
-
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1730
|
+
const o = new URLSearchParams(t);
|
|
1731
|
+
o.has("facets") && o.delete("facets");
|
|
1732
|
+
const p = o.get("sc") ?? c.salesChannel;
|
|
1733
|
+
o.set("sc", p), s && o.set("postalCode", s), l && o.set("country", l), g && o.set(
|
|
1711
1734
|
"geoCoordinates",
|
|
1712
1735
|
`${g.longitude},${g.latitude}`
|
|
1713
1736
|
// long,lat is the format expected
|
|
1714
|
-
),
|
|
1715
|
-
const { marketingData:
|
|
1716
|
-
utmCampaign:
|
|
1717
|
-
utmMedium:
|
|
1718
|
-
utmSource:
|
|
1719
|
-
utmiCampaign:
|
|
1720
|
-
utmiPage:
|
|
1721
|
-
utmiPart:
|
|
1722
|
-
},
|
|
1723
|
-
let
|
|
1724
|
-
if (
|
|
1737
|
+
), o.set("locale", e.locale);
|
|
1738
|
+
const { marketingData: m } = e, S = {
|
|
1739
|
+
utmCampaign: o.get("utm_campaign") ?? m?.utmCampaign ?? "",
|
|
1740
|
+
utmMedium: o.get("utm_medium") ?? m?.utmMedium ?? "",
|
|
1741
|
+
utmSource: o.get("utm_source") ?? m?.utmSource ?? "",
|
|
1742
|
+
utmiCampaign: o.get("utmi_cp") ?? m?.utmiCampaign ?? "",
|
|
1743
|
+
utmiPage: o.get("utmi_p") ?? m?.utmiPage ?? "",
|
|
1744
|
+
utmiPart: o.get("utmi_pc") ?? m?.utmiPart ?? ""
|
|
1745
|
+
}, I = Z(Q(i?.cookie ?? "", a));
|
|
1746
|
+
let O = !1;
|
|
1747
|
+
if (I)
|
|
1725
1748
|
try {
|
|
1726
|
-
|
|
1749
|
+
O = (await r.commerce.vtexid.validate())?.authStatus?.toLowerCase() === "success";
|
|
1727
1750
|
} catch (U) {
|
|
1728
|
-
console.warn("JWT validation failed:", U),
|
|
1751
|
+
console.warn("JWT validation failed:", U), O = !1;
|
|
1729
1752
|
}
|
|
1730
|
-
const w =
|
|
1753
|
+
const w = O ? I?.isRepresentative : !1, _ = O ? I?.customerId : void 0, P = O ? I?.unitId : void 0, b = await r.commerce.session(o.toString()).catch(() => null), E = b?.namespaces.profile ?? null, h = b?.namespaces.shopper ?? null, v = b?.namespaces.store ?? null, C = b?.namespaces.authentication ?? null, D = b?.namespaces.checkout ?? null, y = b?.namespaces.public ?? null;
|
|
1731
1754
|
let A = null;
|
|
1732
1755
|
if (w && E?.id?.value)
|
|
1733
1756
|
try {
|
|
@@ -1740,25 +1763,25 @@ const Xt = async (n, { session: e, search: t }, { clients: r, headers: i, accoun
|
|
|
1740
1763
|
`
|
|
1741
1764
|
);
|
|
1742
1765
|
}
|
|
1743
|
-
let
|
|
1744
|
-
|
|
1766
|
+
let T;
|
|
1767
|
+
c.seller && (s || g) && (T = (await r.commerce.checkout.region({
|
|
1745
1768
|
postalCode: s,
|
|
1746
1769
|
geoCoordinates: g,
|
|
1747
|
-
country:
|
|
1748
|
-
salesChannel:
|
|
1749
|
-
}))?.[0]?.sellers.find((
|
|
1750
|
-
const
|
|
1770
|
+
country: l,
|
|
1771
|
+
salesChannel: p
|
|
1772
|
+
}))?.[0]?.sellers.find((N) => c.seller === N.id));
|
|
1773
|
+
const F = {
|
|
1751
1774
|
...e,
|
|
1752
1775
|
currency: {
|
|
1753
|
-
code:
|
|
1754
|
-
symbol:
|
|
1776
|
+
code: v?.currencyCode?.value ?? e.currency.code,
|
|
1777
|
+
symbol: v?.currencySymbol?.value ?? e.currency.symbol
|
|
1755
1778
|
},
|
|
1756
|
-
country:
|
|
1779
|
+
country: v?.countryCode?.value ?? l,
|
|
1757
1780
|
channel: nn.stringify({
|
|
1758
|
-
salesChannel:
|
|
1759
|
-
regionId: D?.regionId?.value ??
|
|
1760
|
-
seller:
|
|
1761
|
-
hasOnlyDefaultSalesChannel: !
|
|
1781
|
+
salesChannel: v?.channel?.value ?? c.salesChannel,
|
|
1782
|
+
regionId: D?.regionId?.value ?? c.regionId,
|
|
1783
|
+
seller: T?.id,
|
|
1784
|
+
hasOnlyDefaultSalesChannel: !v?.channel?.value
|
|
1762
1785
|
}),
|
|
1763
1786
|
/**
|
|
1764
1787
|
* B2B data structure in Session:
|
|
@@ -1768,18 +1791,18 @@ const Xt = async (n, { session: e, search: t }, { clients: r, headers: i, accoun
|
|
|
1768
1791
|
*/
|
|
1769
1792
|
b2b: w ? {
|
|
1770
1793
|
isRepresentative: w ?? !1,
|
|
1771
|
-
customerId:
|
|
1772
|
-
unitName:
|
|
1773
|
-
unitId:
|
|
1794
|
+
customerId: C?.customerId?.value ?? _ ?? "",
|
|
1795
|
+
unitName: C?.unitName?.value ?? "",
|
|
1796
|
+
unitId: C?.unitId?.value ?? P ?? "",
|
|
1774
1797
|
firstName: typeof h?.firstName?.value == "string" ? h.firstName.value : "",
|
|
1775
1798
|
lastName: typeof h?.lastName?.value == "string" ? h.lastName.value : "",
|
|
1776
1799
|
userName: `${typeof h?.firstName?.value == "string" ? h.firstName.value : ""} ${typeof h?.lastName?.value == "string" ? h.lastName.value : ""}`.trim(),
|
|
1777
|
-
userEmail:
|
|
1800
|
+
userEmail: C?.storeUserEmail.value ?? "",
|
|
1778
1801
|
savedPostalCode: y?.postalCode?.value ?? "",
|
|
1779
1802
|
contractName: A?.corporateName ?? "",
|
|
1780
1803
|
organizationManager: h?.organizationManager?.value ?? !1
|
|
1781
1804
|
} : null,
|
|
1782
|
-
marketingData:
|
|
1805
|
+
marketingData: S,
|
|
1783
1806
|
person: E?.id ? {
|
|
1784
1807
|
id: E.id?.value ?? "",
|
|
1785
1808
|
email: E.email?.value ?? "",
|
|
@@ -1787,39 +1810,39 @@ const Xt = async (n, { session: e, search: t }, { clients: r, headers: i, accoun
|
|
|
1787
1810
|
familyName: E.lastName?.value ?? ""
|
|
1788
1811
|
} : null,
|
|
1789
1812
|
geoCoordinates: g?.latitude && g?.longitude && g || null,
|
|
1790
|
-
city:
|
|
1813
|
+
city: d
|
|
1791
1814
|
};
|
|
1792
|
-
return Cn(e,
|
|
1793
|
-
},
|
|
1794
|
-
validateCart:
|
|
1795
|
-
validateSession:
|
|
1815
|
+
return Cn(e, F) ? null : F;
|
|
1816
|
+
}, Xt = {
|
|
1817
|
+
validateCart: Wt,
|
|
1818
|
+
validateSession: Ht,
|
|
1796
1819
|
subscribeToNewsletter: Tt,
|
|
1797
|
-
cancelOrder:
|
|
1798
|
-
processOrderAuthorization:
|
|
1799
|
-
uploadFileToOrderEntry:
|
|
1800
|
-
startOrderEntryOperation:
|
|
1820
|
+
cancelOrder: wt,
|
|
1821
|
+
processOrderAuthorization: Pt,
|
|
1822
|
+
uploadFileToOrderEntry: _t,
|
|
1823
|
+
startOrderEntryOperation: Et
|
|
1801
1824
|
};
|
|
1802
1825
|
var vn;
|
|
1803
1826
|
(function(n) {
|
|
1804
1827
|
n.NAME = "Name", n.DOCUMENT = "Document", n.OPERATION_DEFINITION = "OperationDefinition", n.VARIABLE_DEFINITION = "VariableDefinition", n.SELECTION_SET = "SelectionSet", n.FIELD = "Field", n.ARGUMENT = "Argument", n.FRAGMENT_SPREAD = "FragmentSpread", n.INLINE_FRAGMENT = "InlineFragment", n.FRAGMENT_DEFINITION = "FragmentDefinition", n.VARIABLE = "Variable", n.INT = "IntValue", n.FLOAT = "FloatValue", n.STRING = "StringValue", n.BOOLEAN = "BooleanValue", n.NULL = "NullValue", n.ENUM = "EnumValue", n.LIST = "ListValue", n.OBJECT = "ObjectValue", n.OBJECT_FIELD = "ObjectField", n.DIRECTIVE = "Directive", n.NAMED_TYPE = "NamedType", n.LIST_TYPE = "ListType", n.NON_NULL_TYPE = "NonNullType", n.SCHEMA_DEFINITION = "SchemaDefinition", n.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", n.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", n.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", n.FIELD_DEFINITION = "FieldDefinition", n.INPUT_VALUE_DEFINITION = "InputValueDefinition", n.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", n.UNION_TYPE_DEFINITION = "UnionTypeDefinition", n.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", n.ENUM_VALUE_DEFINITION = "EnumValueDefinition", n.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", n.DIRECTIVE_DEFINITION = "DirectiveDefinition", n.SCHEMA_EXTENSION = "SchemaExtension", n.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", n.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", n.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", n.UNION_TYPE_EXTENSION = "UnionTypeExtension", n.ENUM_TYPE_EXTENSION = "EnumTypeExtension", n.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension";
|
|
1805
1828
|
})(vn || (vn = {}));
|
|
1806
|
-
const
|
|
1807
|
-
function
|
|
1829
|
+
const Yt = (n) => typeof n == "string" ? de(n) : null;
|
|
1830
|
+
function de(n) {
|
|
1808
1831
|
try {
|
|
1809
1832
|
return JSON.parse(n);
|
|
1810
1833
|
} catch {
|
|
1811
1834
|
return n;
|
|
1812
1835
|
}
|
|
1813
1836
|
}
|
|
1814
|
-
const
|
|
1837
|
+
const Jt = (n) => typeof n == "object" ? JSON.stringify(n) : typeof n == "string" ? n : null, Kt = new Se({
|
|
1815
1838
|
name: "ObjectOrString",
|
|
1816
1839
|
description: "A string or the string representation of an object (a stringified object).",
|
|
1817
|
-
parseValue:
|
|
1818
|
-
serialize:
|
|
1840
|
+
parseValue: Yt,
|
|
1841
|
+
serialize: Jt,
|
|
1819
1842
|
parseLiteral(n) {
|
|
1820
|
-
return n.kind === vn.STRING ?
|
|
1843
|
+
return n.kind === vn.STRING ? de(n.value) : null;
|
|
1821
1844
|
}
|
|
1822
|
-
}), L = (n) => "Price" in n && "seller" in n && "product" in n, R = (n) => "skuName" in n,
|
|
1845
|
+
}), L = (n) => "Price" in n && "seller" in n && "product" in n, R = (n) => "skuName" in n, Qt = {
|
|
1823
1846
|
priceCurrency: async (n, e, t) => {
|
|
1824
1847
|
const {
|
|
1825
1848
|
loaders: { salesChannelLoader: r },
|
|
@@ -1829,7 +1852,7 @@ const Kt = (n) => typeof n == "object" ? JSON.stringify(n) : typeof n == "string
|
|
|
1829
1852
|
},
|
|
1830
1853
|
priceValidUntil: (n) => L(n) ? n.PriceValidUntil ?? "" : R(n) ? n.priceValidUntil ?? "" : null,
|
|
1831
1854
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
1832
|
-
availability: async (n) => L(n) ?
|
|
1855
|
+
availability: async (n) => L(n) ? wn(V(n)) : R(n) ? wn(dt(n.availability)) : null,
|
|
1833
1856
|
seller: (n, e, t) => L(n) ? {
|
|
1834
1857
|
identifier: t.storage.channel?.seller || n.seller.sellerId || ""
|
|
1835
1858
|
} : R(n) ? {
|
|
@@ -1841,7 +1864,7 @@ const Kt = (n) => typeof n == "object" ? JSON.stringify(n) : typeof n == "string
|
|
|
1841
1864
|
n.tax / 100,
|
|
1842
1865
|
n.unitMultiplier
|
|
1843
1866
|
) : null,
|
|
1844
|
-
sellingPrice: (n) => L(n) ?
|
|
1867
|
+
sellingPrice: (n) => L(n) ? lt(n) : R(n) ? n.sellingPrice / 100 : null,
|
|
1845
1868
|
listPrice: (n) => L(n) ? n.ListPrice ?? 0 : R(n) ? n.listPrice / 100 : null,
|
|
1846
1869
|
listPriceWithTaxes: (n) => L(n) ? q(
|
|
1847
1870
|
n.ListPrice ?? 0,
|
|
@@ -1854,7 +1877,7 @@ const Kt = (n) => typeof n == "object" ? JSON.stringify(n) : typeof n == "string
|
|
|
1854
1877
|
} : null,
|
|
1855
1878
|
quantity: (n) => L(n) ? n.AvailableQuantity ?? 0 : R(n) ? n.quantity : null,
|
|
1856
1879
|
isGift: (n) => R(n) ? n.isGift ?? !1 : null
|
|
1857
|
-
},
|
|
1880
|
+
}, Zt = ({ linkText: n }) => `/${n}/p`, nr = ({
|
|
1858
1881
|
offer: n,
|
|
1859
1882
|
seller: e,
|
|
1860
1883
|
product: t
|
|
@@ -1862,26 +1885,26 @@ const Kt = (n) => typeof n == "object" ? JSON.stringify(n) : typeof n == "string
|
|
|
1862
1885
|
...n,
|
|
1863
1886
|
product: t,
|
|
1864
1887
|
seller: e
|
|
1865
|
-
}),
|
|
1888
|
+
}), er = {
|
|
1866
1889
|
imageText: "image",
|
|
1867
1890
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
1868
1891
|
imageLabel: "label"
|
|
1869
|
-
},
|
|
1870
|
-
function
|
|
1892
|
+
}, ue = (n, e) => `${n}-${e}`, tr = (n, e) => `/${ue(n, e)}/p`, rr = (n) => Array.isArray(n) && n.length > 0 ? n : null;
|
|
1893
|
+
function pe(n) {
|
|
1871
1894
|
return n.replace(/^\/+|\/+$/g, "");
|
|
1872
1895
|
}
|
|
1873
|
-
const
|
|
1874
|
-
const t = n.findIndex((r) =>
|
|
1896
|
+
const ir = (n, e) => {
|
|
1897
|
+
const t = n.findIndex((r) => pe(r).split("/").at(-1) === e);
|
|
1875
1898
|
return t < 0 ? 0 : t;
|
|
1876
|
-
},
|
|
1899
|
+
}, ar = {
|
|
1877
1900
|
productID: ({ itemId: n }) => n,
|
|
1878
1901
|
name: ({ isVariantOf: n, name: e }) => e ?? n.productName,
|
|
1879
|
-
slug: ({ isVariantOf: { linkText: n }, itemId: e }) =>
|
|
1902
|
+
slug: ({ isVariantOf: { linkText: n }, itemId: e }) => ue(n, e),
|
|
1880
1903
|
description: ({ isVariantOf: { description: n } }) => n,
|
|
1881
1904
|
seo: ({ isVariantOf: n }) => ({
|
|
1882
1905
|
title: n.productTitle || n.productName,
|
|
1883
1906
|
description: n.metaTagDescription || n.description,
|
|
1884
|
-
canonical:
|
|
1907
|
+
canonical: Zt(n)
|
|
1885
1908
|
}),
|
|
1886
1909
|
brand: ({ isVariantOf: { brand: n } }) => ({ name: n }),
|
|
1887
1910
|
unitMultiplier: ({ unitMultiplier: n }) => n,
|
|
@@ -1895,32 +1918,32 @@ const ar = (n, e) => {
|
|
|
1895
1918
|
},
|
|
1896
1919
|
itemId: a
|
|
1897
1920
|
}) => {
|
|
1898
|
-
const
|
|
1921
|
+
const c = ir(i, r), s = n[c], l = pe(s).split("/");
|
|
1899
1922
|
return {
|
|
1900
1923
|
itemListElement: [
|
|
1901
|
-
...
|
|
1902
|
-
const
|
|
1924
|
+
...l.map((d, g) => {
|
|
1925
|
+
const u = `/${l.slice(0, g + 1).map(Qn).join("/")}/`;
|
|
1903
1926
|
return {
|
|
1904
|
-
name:
|
|
1905
|
-
item:
|
|
1927
|
+
name: d,
|
|
1928
|
+
item: u,
|
|
1906
1929
|
position: g + 1
|
|
1907
1930
|
};
|
|
1908
1931
|
}),
|
|
1909
1932
|
{
|
|
1910
1933
|
name: e,
|
|
1911
|
-
item:
|
|
1912
|
-
position:
|
|
1934
|
+
item: tr(t, a),
|
|
1935
|
+
position: l.length + 1
|
|
1913
1936
|
}
|
|
1914
1937
|
],
|
|
1915
|
-
numberOfItems:
|
|
1938
|
+
numberOfItems: l.length
|
|
1916
1939
|
};
|
|
1917
1940
|
},
|
|
1918
1941
|
image: ({ images: n }, e) => {
|
|
1919
|
-
const t = (
|
|
1920
|
-
({ imageUrl: s, imageText:
|
|
1921
|
-
alternateName:
|
|
1942
|
+
const t = (rr(n) ?? [er]).map(
|
|
1943
|
+
({ imageUrl: s, imageText: l, imageLabel: d }) => ({
|
|
1944
|
+
alternateName: l ?? "",
|
|
1922
1945
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
1923
|
-
keywords:
|
|
1946
|
+
keywords: d
|
|
1924
1947
|
})
|
|
1925
1948
|
);
|
|
1926
1949
|
if (typeof e != "object")
|
|
@@ -1928,10 +1951,10 @@ const ar = (n, e) => {
|
|
|
1928
1951
|
let { context: r, limit: i } = e;
|
|
1929
1952
|
const a = r !== "generic";
|
|
1930
1953
|
i = i || -1, i = i <= -1 ? void 0 : i;
|
|
1931
|
-
let
|
|
1954
|
+
let c = a ? t.filter(
|
|
1932
1955
|
({ keywords: s }) => s === r
|
|
1933
1956
|
) : t;
|
|
1934
|
-
return
|
|
1957
|
+
return c = c.length === 0 ? t : c, c.slice(0, i);
|
|
1935
1958
|
},
|
|
1936
1959
|
sku: ({ itemId: n }) => n,
|
|
1937
1960
|
gtin: ({ ean: n, referenceId: e }) => n || (e[0]?.Value ?? ""),
|
|
@@ -1939,12 +1962,12 @@ const ar = (n, e) => {
|
|
|
1939
1962
|
review: () => [],
|
|
1940
1963
|
aggregateRating: () => ({}),
|
|
1941
1964
|
offers: (n) => n.sellers.map(
|
|
1942
|
-
(e) =>
|
|
1965
|
+
(e) => nr({
|
|
1943
1966
|
offer: e.commertialOffer,
|
|
1944
1967
|
seller: e,
|
|
1945
1968
|
product: n
|
|
1946
1969
|
})
|
|
1947
|
-
).sort(
|
|
1970
|
+
).sort(Kn),
|
|
1948
1971
|
isVariantOf: (n) => n,
|
|
1949
1972
|
additionalProperty: ({
|
|
1950
1973
|
// Search uses the name variations for specifications
|
|
@@ -1953,14 +1976,14 @@ const ar = (n, e) => {
|
|
|
1953
1976
|
attributes: t = []
|
|
1954
1977
|
}) => {
|
|
1955
1978
|
const r = n.flatMap(
|
|
1956
|
-
({ name:
|
|
1957
|
-
name:
|
|
1958
|
-
value:
|
|
1979
|
+
({ name: c, values: s }) => s.map((l) => ({
|
|
1980
|
+
name: c,
|
|
1981
|
+
value: l,
|
|
1959
1982
|
valueReference: Y.specification
|
|
1960
1983
|
}))
|
|
1961
1984
|
), i = e.map(
|
|
1962
|
-
|
|
1963
|
-
), a = t.map(
|
|
1985
|
+
re
|
|
1986
|
+
), a = t.map(Ut);
|
|
1964
1987
|
return [
|
|
1965
1988
|
...r,
|
|
1966
1989
|
...i,
|
|
@@ -1973,13 +1996,13 @@ const ar = (n, e) => {
|
|
|
1973
1996
|
releaseDate: ({ isVariantOf: { releaseDate: n } }) => n ?? "",
|
|
1974
1997
|
advertisement: ({ isVariantOf: { advertisement: n } }) => n,
|
|
1975
1998
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: n } }) => n
|
|
1976
|
-
},
|
|
1999
|
+
}, or = /* @__PURE__ */ new Set(["allSpecifications"]), sr = {
|
|
1977
2000
|
hasVariant: (n) => n.isVariantOf.items.map((e) => B(e, n.isVariantOf)),
|
|
1978
2001
|
productGroupID: ({ isVariantOf: n }) => n.productId,
|
|
1979
2002
|
name: (n) => n.isVariantOf.productName,
|
|
1980
2003
|
skuVariants: (n) => n,
|
|
1981
2004
|
additionalProperty: ({ isVariantOf: { specificationGroups: n } }) => n.filter(
|
|
1982
|
-
(e) => !
|
|
2005
|
+
(e) => !or.has(e.name)
|
|
1983
2006
|
).flatMap(
|
|
1984
2007
|
({ specifications: e }) => e.flatMap(
|
|
1985
2008
|
({ name: t, values: r }) => r.map((i) => ({
|
|
@@ -1989,16 +2012,16 @@ const ar = (n, e) => {
|
|
|
1989
2012
|
}))
|
|
1990
2013
|
)
|
|
1991
2014
|
)
|
|
1992
|
-
},
|
|
1993
|
-
propertyID: (n) => n.propertyID ||
|
|
2015
|
+
}, cr = {
|
|
2016
|
+
propertyID: (n) => n.propertyID || ie(n),
|
|
1994
2017
|
name: ({ name: n }) => n,
|
|
1995
2018
|
value: ({ value: n }) => n,
|
|
1996
2019
|
valueReference: ({ valueReference: n }) => n
|
|
1997
|
-
},
|
|
2020
|
+
}, lr = async (n, { operationId: e }, { clients: { commerce: t } }) => {
|
|
1998
2021
|
if (!e)
|
|
1999
2022
|
throw new k("Missing operationId");
|
|
2000
2023
|
return t.orderEntry.getOperation({ operationId: e });
|
|
2001
|
-
},
|
|
2024
|
+
}, dr = async (n, { orderFormId: e }, { clients: { commerce: t } }) => {
|
|
2002
2025
|
if (!e)
|
|
2003
2026
|
throw new k("Missing orderFormId");
|
|
2004
2027
|
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: e });
|
|
@@ -2021,10 +2044,10 @@ const ar = (n, e) => {
|
|
|
2021
2044
|
}))
|
|
2022
2045
|
), t = fn(
|
|
2023
2046
|
e,
|
|
2024
|
-
({ offer: r }, { offer: i }) =>
|
|
2047
|
+
({ offer: r }, { offer: i }) => Kn(r, i)
|
|
2025
2048
|
);
|
|
2026
2049
|
return t ? t.sku : n[0];
|
|
2027
|
-
},
|
|
2050
|
+
}, ur = (n) => n !== "" && !Number.isNaN(Number(n)), pr = {
|
|
2028
2051
|
price_desc: "price:desc",
|
|
2029
2052
|
price_asc: "price:asc",
|
|
2030
2053
|
orders_desc: "orders:desc",
|
|
@@ -2033,43 +2056,43 @@ const ar = (n, e) => {
|
|
|
2033
2056
|
release_desc: "release:desc",
|
|
2034
2057
|
discount_desc: "discount:desc",
|
|
2035
2058
|
score_desc: ""
|
|
2036
|
-
},
|
|
2059
|
+
}, gr = {
|
|
2037
2060
|
product: async (n, { locator: e }, t) => {
|
|
2038
|
-
const r =
|
|
2061
|
+
const r = Un(e), i = _n(e), a = vt(e), c = It(e);
|
|
2039
2062
|
r && Sn(t, r), i && yn(t, i);
|
|
2040
2063
|
const {
|
|
2041
2064
|
loaders: { skuLoader: s },
|
|
2042
|
-
clients: { commerce:
|
|
2065
|
+
clients: { commerce: l, search: d }
|
|
2043
2066
|
} = t;
|
|
2044
2067
|
try {
|
|
2045
|
-
const g = a ??
|
|
2046
|
-
if (!
|
|
2068
|
+
const g = a ?? c?.split("-").pop() ?? "";
|
|
2069
|
+
if (!ur(g))
|
|
2047
2070
|
throw new Error("Invalid SkuId");
|
|
2048
|
-
const
|
|
2049
|
-
if (
|
|
2071
|
+
const u = await s.load(g);
|
|
2072
|
+
if (c && u.isVariantOf.linkText && !c.startsWith(u.isVariantOf.linkText))
|
|
2050
2073
|
throw new Error(
|
|
2051
|
-
`Slug was set but the fetched sku does not satisfy the slug condition. slug: ${
|
|
2074
|
+
`Slug was set but the fetched sku does not satisfy the slug condition. slug: ${c}, linkText: ${u.isVariantOf.linkText}`
|
|
2052
2075
|
);
|
|
2053
|
-
return
|
|
2076
|
+
return u;
|
|
2054
2077
|
} catch {
|
|
2055
|
-
if (
|
|
2078
|
+
if (c == null)
|
|
2056
2079
|
throw new k("Missing slug or id");
|
|
2057
|
-
const
|
|
2058
|
-
if (
|
|
2059
|
-
throw new z(`No product found for slug ${
|
|
2080
|
+
const u = await l.catalog.portal.pagetype(`${c}/p`);
|
|
2081
|
+
if (u.pageType !== "Product" || !u.id)
|
|
2082
|
+
throw new z(`No product found for slug ${c}`);
|
|
2060
2083
|
const {
|
|
2061
|
-
products: [
|
|
2062
|
-
} = await
|
|
2084
|
+
products: [o]
|
|
2085
|
+
} = await d.products({
|
|
2063
2086
|
page: 0,
|
|
2064
2087
|
count: 1,
|
|
2065
|
-
query: `product:${
|
|
2088
|
+
query: `product:${u.id}`,
|
|
2066
2089
|
// Manually disabling this flag to prevent regionalization issues
|
|
2067
2090
|
hideUnavailableItems: !1
|
|
2068
2091
|
});
|
|
2069
|
-
if (!
|
|
2070
|
-
throw new z(`No product found for id ${
|
|
2071
|
-
const
|
|
2072
|
-
return B(
|
|
2092
|
+
if (!o)
|
|
2093
|
+
throw new z(`No product found for id ${u.id}`);
|
|
2094
|
+
const p = On(o.items);
|
|
2095
|
+
return B(p, o);
|
|
2073
2096
|
}
|
|
2074
2097
|
},
|
|
2075
2098
|
collection: (n, { slug: e }, t) => {
|
|
@@ -2084,48 +2107,48 @@ const ar = (n, e) => {
|
|
|
2084
2107
|
sort: r,
|
|
2085
2108
|
term: i,
|
|
2086
2109
|
selectedFacets: a,
|
|
2087
|
-
sponsoredCount:
|
|
2110
|
+
sponsoredCount: c
|
|
2088
2111
|
}, s) => {
|
|
2089
|
-
const
|
|
2090
|
-
|
|
2091
|
-
let
|
|
2092
|
-
g && (
|
|
2112
|
+
const l = Un(a), d = _n(a), g = yt(a);
|
|
2113
|
+
l && Sn(s, l), d && yn(s, d);
|
|
2114
|
+
let u = i;
|
|
2115
|
+
g && (u = `product:${(await s.clients.commerce.catalog.products.crossselling(
|
|
2093
2116
|
{
|
|
2094
|
-
type:
|
|
2117
|
+
type: ne[g.key],
|
|
2095
2118
|
productId: g.value
|
|
2096
2119
|
}
|
|
2097
|
-
)).map((
|
|
2098
|
-
const
|
|
2099
|
-
page: Math.ceil(
|
|
2120
|
+
)).map((I) => I.productId).slice(0, e).join(";")}`);
|
|
2121
|
+
const o = t ? Number(t) : 0, p = {
|
|
2122
|
+
page: Math.ceil(o / e) || 0,
|
|
2100
2123
|
count: e,
|
|
2101
|
-
query:
|
|
2102
|
-
sort:
|
|
2103
|
-
selectedFacets: a?.flatMap(
|
|
2104
|
-
sponsoredCount:
|
|
2105
|
-
},
|
|
2106
|
-
return { searchArgs:
|
|
2124
|
+
query: u ?? void 0,
|
|
2125
|
+
sort: pr[r ?? "score_desc"],
|
|
2126
|
+
selectedFacets: a?.flatMap(En) ?? [],
|
|
2127
|
+
sponsoredCount: c ?? void 0
|
|
2128
|
+
}, m = s.clients.search.products(p);
|
|
2129
|
+
return { searchArgs: p, productSearchPromise: m };
|
|
2107
2130
|
},
|
|
2108
2131
|
allProducts: async (n, { first: e, after: t }, r) => {
|
|
2109
2132
|
const {
|
|
2110
2133
|
clients: { search: i }
|
|
2111
|
-
} = r, a = t ? Number(t) : 0,
|
|
2134
|
+
} = r, a = t ? Number(t) : 0, c = await i.products({
|
|
2112
2135
|
page: Math.ceil(a / e),
|
|
2113
2136
|
count: e
|
|
2114
|
-
}), s =
|
|
2115
|
-
(
|
|
2116
|
-
).filter((
|
|
2137
|
+
}), s = c.products.flatMap(
|
|
2138
|
+
(l) => l.items.map((d) => B(d, l))
|
|
2139
|
+
).filter((l) => l.sellers.length > 0);
|
|
2117
2140
|
return {
|
|
2118
2141
|
pageInfo: {
|
|
2119
|
-
hasNextPage:
|
|
2120
|
-
hasPreviousPage:
|
|
2142
|
+
hasNextPage: c.pagination.after.length > 0,
|
|
2143
|
+
hasPreviousPage: c.pagination.before.length > 0,
|
|
2121
2144
|
startCursor: "0",
|
|
2122
|
-
endCursor:
|
|
2123
|
-
totalCount:
|
|
2145
|
+
endCursor: c.recordsFiltered.toString(),
|
|
2146
|
+
totalCount: c.recordsFiltered
|
|
2124
2147
|
},
|
|
2125
2148
|
// after + index is bigger than after+first itself because of the array flat() above
|
|
2126
|
-
edges: s.map((
|
|
2127
|
-
node:
|
|
2128
|
-
cursor: (a +
|
|
2149
|
+
edges: s.map((l, d) => ({
|
|
2150
|
+
node: l,
|
|
2151
|
+
cursor: (a + d).toString()
|
|
2129
2152
|
}))
|
|
2130
2153
|
};
|
|
2131
2154
|
},
|
|
@@ -2141,53 +2164,53 @@ const ar = (n, e) => {
|
|
|
2141
2164
|
count: e.length,
|
|
2142
2165
|
query: i
|
|
2143
2166
|
})).products.flatMap(
|
|
2144
|
-
(
|
|
2167
|
+
(c) => c.items.map((s) => B(s, c))
|
|
2145
2168
|
).filter(
|
|
2146
|
-
(
|
|
2169
|
+
(c) => e.includes(c.itemId) && c.sellers.length > 0
|
|
2147
2170
|
);
|
|
2148
2171
|
},
|
|
2149
2172
|
allCollections: async (n, { first: e, after: t }, r) => {
|
|
2150
2173
|
const {
|
|
2151
2174
|
clients: { commerce: i }
|
|
2152
|
-
} = r, a = t ? Number(t) : 0, [
|
|
2175
|
+
} = r, a = t ? Number(t) : 0, [c, s] = await Promise.all([
|
|
2153
2176
|
i.catalog.brand.list(),
|
|
2154
2177
|
i.catalog.category.tree()
|
|
2155
|
-
]),
|
|
2156
|
-
|
|
2157
|
-
for (const
|
|
2158
|
-
|
|
2178
|
+
]), l = [], d = (o, p) => {
|
|
2179
|
+
l.push({ ...o, level: p });
|
|
2180
|
+
for (const m of o.children)
|
|
2181
|
+
d(m, p + 1);
|
|
2159
2182
|
};
|
|
2160
|
-
for (const
|
|
2161
|
-
|
|
2162
|
-
const
|
|
2163
|
-
...
|
|
2164
|
-
...
|
|
2165
|
-
].filter((
|
|
2183
|
+
for (const o of s)
|
|
2184
|
+
d(o, 0);
|
|
2185
|
+
const u = [
|
|
2186
|
+
...c.filter((o) => o.isActive).map((o) => ({ ...o, type: "brand" })),
|
|
2187
|
+
...l
|
|
2188
|
+
].filter((o) => !!Zn.slug(o, null, r, null));
|
|
2166
2189
|
return {
|
|
2167
2190
|
pageInfo: {
|
|
2168
|
-
hasNextPage:
|
|
2191
|
+
hasNextPage: u.length - a > e,
|
|
2169
2192
|
hasPreviousPage: a > 0,
|
|
2170
2193
|
startCursor: "0",
|
|
2171
|
-
endCursor: (Math.min(e,
|
|
2172
|
-
totalCount:
|
|
2194
|
+
endCursor: (Math.min(e, u.length - a) - 1).toString(),
|
|
2195
|
+
totalCount: u.length
|
|
2173
2196
|
},
|
|
2174
|
-
edges:
|
|
2175
|
-
node:
|
|
2176
|
-
cursor: (a +
|
|
2197
|
+
edges: u.slice(a, a + e).map((o, p) => ({
|
|
2198
|
+
node: o,
|
|
2199
|
+
cursor: (a + p).toString()
|
|
2177
2200
|
}))
|
|
2178
2201
|
};
|
|
2179
2202
|
},
|
|
2180
2203
|
shipping: async (n, { country: e, items: t, postalCode: r }, i) => {
|
|
2181
2204
|
const {
|
|
2182
2205
|
loaders: { simulationLoader: a },
|
|
2183
|
-
clients: { commerce:
|
|
2184
|
-
} = i, [s,
|
|
2206
|
+
clients: { commerce: c }
|
|
2207
|
+
} = i, [s, l] = await Promise.all([
|
|
2185
2208
|
a.load({ country: e, items: t, postalCode: r }),
|
|
2186
|
-
|
|
2209
|
+
c.checkout.address({ postalCode: r, country: e })
|
|
2187
2210
|
]);
|
|
2188
2211
|
return {
|
|
2189
2212
|
...s,
|
|
2190
|
-
address:
|
|
2213
|
+
address: l
|
|
2191
2214
|
};
|
|
2192
2215
|
},
|
|
2193
2216
|
redirect: async (n, { term: e, selectedFacets: t }, r) => {
|
|
@@ -2197,7 +2220,7 @@ const ar = (n, e) => {
|
|
|
2197
2220
|
page: 1,
|
|
2198
2221
|
count: 1,
|
|
2199
2222
|
query: e ?? void 0,
|
|
2200
|
-
selectedFacets: t?.flatMap(
|
|
2223
|
+
selectedFacets: t?.flatMap(En) ?? [],
|
|
2201
2224
|
allowRedirect: !0
|
|
2202
2225
|
});
|
|
2203
2226
|
return {
|
|
@@ -2206,15 +2229,15 @@ const ar = (n, e) => {
|
|
|
2206
2229
|
},
|
|
2207
2230
|
sellers: async (n, { postalCode: e, geoCoordinates: t, country: r, salesChannel: i }, a) => {
|
|
2208
2231
|
const {
|
|
2209
|
-
clients: { commerce:
|
|
2210
|
-
} = a,
|
|
2232
|
+
clients: { commerce: c }
|
|
2233
|
+
} = a, l = (await c.checkout.region({
|
|
2211
2234
|
postalCode: e,
|
|
2212
2235
|
geoCoordinates: t,
|
|
2213
2236
|
country: r,
|
|
2214
2237
|
salesChannel: i
|
|
2215
|
-
}))?.[0], { id:
|
|
2238
|
+
}))?.[0], { id: d, sellers: g } = l;
|
|
2216
2239
|
return {
|
|
2217
|
-
id:
|
|
2240
|
+
id: d,
|
|
2218
2241
|
sellers: g
|
|
2219
2242
|
};
|
|
2220
2243
|
},
|
|
@@ -2224,7 +2247,7 @@ const ar = (n, e) => {
|
|
|
2224
2247
|
} = t, i = await r.profile.addresses(e);
|
|
2225
2248
|
function a(s) {
|
|
2226
2249
|
return !s || Object.keys(s).length === 0 ? [] : Object.values(s).map(
|
|
2227
|
-
(
|
|
2250
|
+
(l) => JSON.parse(l)
|
|
2228
2251
|
);
|
|
2229
2252
|
}
|
|
2230
2253
|
return { addresses: a(i) };
|
|
@@ -2248,8 +2271,8 @@ const ar = (n, e) => {
|
|
|
2248
2271
|
throw new z(`No order found for id ${e}`);
|
|
2249
2272
|
let a = null;
|
|
2250
2273
|
try {
|
|
2251
|
-
const
|
|
2252
|
-
a =
|
|
2274
|
+
const l = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: e });
|
|
2275
|
+
a = ee(l);
|
|
2253
2276
|
} catch {
|
|
2254
2277
|
}
|
|
2255
2278
|
const s = (await r.masterData.getShopperById({
|
|
@@ -2287,9 +2310,9 @@ const ar = (n, e) => {
|
|
|
2287
2310
|
} catch {
|
|
2288
2311
|
a = { message: i };
|
|
2289
2312
|
}
|
|
2290
|
-
const
|
|
2291
|
-
throw
|
|
2292
|
-
`You are forbidden to interact with order with id ${e}. ${
|
|
2313
|
+
const c = a?.message || i;
|
|
2314
|
+
throw ze(r) ? new z(`No order found for id ${e}. ${c}.`) : $e(r) ? new an(
|
|
2315
|
+
`You are forbidden to interact with order with id ${e}. ${c}.`
|
|
2293
2316
|
) : r;
|
|
2294
2317
|
}
|
|
2295
2318
|
},
|
|
@@ -2322,18 +2345,18 @@ const ar = (n, e) => {
|
|
|
2322
2345
|
account: r,
|
|
2323
2346
|
headers: i,
|
|
2324
2347
|
clients: { commerce: a }
|
|
2325
|
-
} = t, s = Z(Q(i?.cookie ?? "", r))?.userId ?? "", [
|
|
2348
|
+
} = t, s = Z(Q(i?.cookie ?? "", r))?.userId ?? "", [l, d, g] = await Promise.all([
|
|
2326
2349
|
a.session("").catch(() => null),
|
|
2327
2350
|
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
2328
2351
|
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
2329
|
-
]),
|
|
2352
|
+
]), u = d?.[0], o = l?.namespaces.authentication ?? null, p = `${(u?.firstName ?? "").trim()} ${(u?.lastName ?? "").trim()}`.trim();
|
|
2330
2353
|
return {
|
|
2331
|
-
username:
|
|
2332
|
-
name:
|
|
2333
|
-
email:
|
|
2334
|
-
phone:
|
|
2335
|
-
role: g?.Roles?.map((
|
|
2336
|
-
orgUnit:
|
|
2354
|
+
username: o?.storeUserEmail?.value ?? "",
|
|
2355
|
+
name: p,
|
|
2356
|
+
email: o?.storeUserEmail?.value ?? "",
|
|
2357
|
+
phone: u?.phone ?? "",
|
|
2358
|
+
role: g?.Roles?.map((m) => m.Name) ?? [],
|
|
2359
|
+
orgUnit: o?.unitName?.value ?? ""
|
|
2337
2360
|
};
|
|
2338
2361
|
},
|
|
2339
2362
|
// If isRepresentative, return b2b information.
|
|
@@ -2343,25 +2366,25 @@ const ar = (n, e) => {
|
|
|
2343
2366
|
account: r,
|
|
2344
2367
|
headers: i,
|
|
2345
2368
|
clients: { commerce: a }
|
|
2346
|
-
} = t,
|
|
2347
|
-
if (!
|
|
2369
|
+
} = t, c = Z(Q(i?.cookie ?? "", r));
|
|
2370
|
+
if (!c?.userId)
|
|
2348
2371
|
return null;
|
|
2349
|
-
if (
|
|
2350
|
-
const
|
|
2351
|
-
if (!
|
|
2372
|
+
if (c?.isRepresentative) {
|
|
2373
|
+
const l = await a.session("").catch(() => null);
|
|
2374
|
+
if (!l)
|
|
2352
2375
|
return null;
|
|
2353
|
-
const
|
|
2376
|
+
const d = l.namespaces.profile ?? null;
|
|
2354
2377
|
return {
|
|
2355
2378
|
name: ((await a.masterData.getContractById({
|
|
2356
|
-
contractId:
|
|
2357
|
-
}))?.corporateName ?? `${(
|
|
2358
|
-
email:
|
|
2359
|
-
id:
|
|
2379
|
+
contractId: d?.id?.value ?? ""
|
|
2380
|
+
}))?.corporateName ?? `${(d?.firstName?.value ?? "").trim()} ${(d?.lastName?.value ?? "").trim()}`.trim()) || "",
|
|
2381
|
+
email: d?.email?.value || "",
|
|
2382
|
+
id: d?.id?.value || ""
|
|
2360
2383
|
// createdAt: '',
|
|
2361
2384
|
};
|
|
2362
2385
|
}
|
|
2363
2386
|
const s = await a.licenseManager.getUserById({
|
|
2364
|
-
userId:
|
|
2387
|
+
userId: c?.userId
|
|
2365
2388
|
}).catch(() => null);
|
|
2366
2389
|
return {
|
|
2367
2390
|
name: s?.name || "",
|
|
@@ -2378,9 +2401,9 @@ const ar = (n, e) => {
|
|
|
2378
2401
|
geoCoordinates: e
|
|
2379
2402
|
});
|
|
2380
2403
|
},
|
|
2381
|
-
orderEntryOperation:
|
|
2382
|
-
orderFormItems:
|
|
2383
|
-
},
|
|
2404
|
+
orderEntryOperation: lr,
|
|
2405
|
+
orderFormItems: dr
|
|
2406
|
+
}, mr = {
|
|
2384
2407
|
reviewRating: () => ({
|
|
2385
2408
|
ratingValue: 5,
|
|
2386
2409
|
bestRating: 5
|
|
@@ -2388,29 +2411,29 @@ const ar = (n, e) => {
|
|
|
2388
2411
|
author: () => ({
|
|
2389
2412
|
name: ""
|
|
2390
2413
|
})
|
|
2391
|
-
},
|
|
2414
|
+
}, hr = (n, e, t) => e ? n.key === "category-1" : t ? n.key === "brand" : !1, fr = {
|
|
2392
2415
|
suggestions: async (n, e, t) => {
|
|
2393
2416
|
const {
|
|
2394
2417
|
clients: { search: r }
|
|
2395
2418
|
} = t, { searchArgs: i } = n;
|
|
2396
2419
|
if (!i.query)
|
|
2397
2420
|
return {
|
|
2398
|
-
terms: (await r.topSearches()).searches.map((
|
|
2399
|
-
value:
|
|
2400
|
-
count:
|
|
2421
|
+
terms: (await r.topSearches()).searches.map((u) => ({
|
|
2422
|
+
value: u.term,
|
|
2423
|
+
count: u.count
|
|
2401
2424
|
})),
|
|
2402
2425
|
products: []
|
|
2403
2426
|
};
|
|
2404
|
-
const { productSearchPromise: a } = n, [
|
|
2427
|
+
const { productSearchPromise: a } = n, [c, s] = await Promise.all([
|
|
2405
2428
|
r.suggestedTerms(i),
|
|
2406
2429
|
a
|
|
2407
|
-
]),
|
|
2408
|
-
const
|
|
2409
|
-
return
|
|
2410
|
-
}).filter((g) => !!g), { searches:
|
|
2430
|
+
]), l = s.products.map((g) => {
|
|
2431
|
+
const u = On(g.items);
|
|
2432
|
+
return u && B(u, g);
|
|
2433
|
+
}).filter((g) => !!g), { searches: d } = c;
|
|
2411
2434
|
return {
|
|
2412
|
-
terms:
|
|
2413
|
-
products:
|
|
2435
|
+
terms: d.map((g) => ({ value: g.term, count: g.count })),
|
|
2436
|
+
products: l
|
|
2414
2437
|
};
|
|
2415
2438
|
},
|
|
2416
2439
|
products: async ({ productSearchPromise: n }) => {
|
|
@@ -2437,9 +2460,9 @@ const ar = (n, e) => {
|
|
|
2437
2460
|
clients: { search: r }
|
|
2438
2461
|
} = t;
|
|
2439
2462
|
t.storage.searchArgs = n;
|
|
2440
|
-
const { facets: i = [] } = await r.facets(n), a = !n.query,
|
|
2463
|
+
const { facets: i = [] } = await r.facets(n), a = !n.query, c = n.selectedFacets?.length ? n.selectedFacets[0].key === "category-1" : !1, s = n.selectedFacets?.length ? n.selectedFacets[0].key === "brand" : !1;
|
|
2441
2464
|
return i.filter(
|
|
2442
|
-
(
|
|
2465
|
+
(d) => !a || !hr(d, c, s)
|
|
2443
2466
|
);
|
|
2444
2467
|
},
|
|
2445
2468
|
metadata: async ({ productSearchPromise: n }) => {
|
|
@@ -2451,12 +2474,12 @@ const ar = (n, e) => {
|
|
|
2451
2474
|
};
|
|
2452
2475
|
},
|
|
2453
2476
|
searchId: async ({ productSearchPromise: n }) => (await n).searchId
|
|
2454
|
-
},
|
|
2477
|
+
}, Sr = {
|
|
2455
2478
|
title: ({ title: n }) => n ?? "",
|
|
2456
2479
|
description: ({ description: n }) => n ?? "",
|
|
2457
2480
|
canonical: ({ canonical: n }) => n ?? "",
|
|
2458
2481
|
titleTemplate: () => ""
|
|
2459
|
-
},
|
|
2482
|
+
}, yr = ["bd", "d", "h", "m"], Ir = (n) => yr.includes(n), vr = {
|
|
2460
2483
|
bd: {
|
|
2461
2484
|
0: "Today",
|
|
2462
2485
|
1: "In 1 business day",
|
|
@@ -2477,47 +2500,47 @@ const ar = (n, e) => {
|
|
|
2477
2500
|
1: "In 1 minute",
|
|
2478
2501
|
other: "Up to # minutes"
|
|
2479
2502
|
}
|
|
2480
|
-
},
|
|
2481
|
-
const [e, t] = [n.split(/\D+/)[0], n.split(/[0-9]+/)[1]], r = e !== "" && !Number.isNaN(Number(e)), i =
|
|
2503
|
+
}, ge = (n) => {
|
|
2504
|
+
const [e, t] = [n.split(/\D+/)[0], n.split(/[0-9]+/)[1]], r = e !== "" && !Number.isNaN(Number(e)), i = Ir(t);
|
|
2482
2505
|
if (!r || !i)
|
|
2483
2506
|
return "";
|
|
2484
2507
|
const a = Number(e) < 2 ? Number(e) : "other";
|
|
2485
|
-
return
|
|
2486
|
-
},
|
|
2508
|
+
return vr[t][a].replace("#", e) ?? "";
|
|
2509
|
+
}, Or = {
|
|
2487
2510
|
carrier: (n) => n?.friendlyName ?? n?.name ?? "",
|
|
2488
2511
|
price: (n) => n?.price ? n.price / 100 : n?.price,
|
|
2489
|
-
localizedEstimates: (n) => n?.shippingEstimate ?
|
|
2490
|
-
},
|
|
2491
|
-
function
|
|
2492
|
-
const t = `${
|
|
2512
|
+
localizedEstimates: (n) => n?.shippingEstimate ? ge(n.shippingEstimate) : ""
|
|
2513
|
+
}, Mn = "skuvariation";
|
|
2514
|
+
function Bn(n, e) {
|
|
2515
|
+
const t = `${Mn}${e}`.toLowerCase(), r = n.find(
|
|
2493
2516
|
(a) => a.imageLabel === t
|
|
2494
2517
|
);
|
|
2495
2518
|
if (r)
|
|
2496
2519
|
return r;
|
|
2497
2520
|
const i = n.find(
|
|
2498
|
-
(a) => a.imageLabel ===
|
|
2521
|
+
(a) => a.imageLabel === Mn
|
|
2499
2522
|
);
|
|
2500
2523
|
return i || n[0];
|
|
2501
2524
|
}
|
|
2502
|
-
function
|
|
2525
|
+
function Cr(n, e, t) {
|
|
2503
2526
|
const r = {};
|
|
2504
2527
|
return n.forEach((i) => {
|
|
2505
2528
|
const a = i.variations;
|
|
2506
2529
|
if (a.length === 0)
|
|
2507
2530
|
return;
|
|
2508
|
-
const
|
|
2509
|
-
(
|
|
2510
|
-
)?.values[0] ?? ""}`, s = a.reduce((
|
|
2531
|
+
const c = `${e}-${a.find(
|
|
2532
|
+
(l) => l.name === e
|
|
2533
|
+
)?.values[0] ?? ""}`, s = a.reduce((l, d) => d.name === e ? l : l + `-${d.name}-${d.values[0]}`, c);
|
|
2511
2534
|
r[s] = `${t}-${i.itemId}`;
|
|
2512
2535
|
}), r;
|
|
2513
2536
|
}
|
|
2514
|
-
function
|
|
2537
|
+
function $n(n) {
|
|
2515
2538
|
const e = {};
|
|
2516
2539
|
return n.forEach((t) => {
|
|
2517
2540
|
e[t.name] = t.values[0];
|
|
2518
2541
|
}), e;
|
|
2519
2542
|
}
|
|
2520
|
-
function
|
|
2543
|
+
function br(n) {
|
|
2521
2544
|
const e = {};
|
|
2522
2545
|
return n?.forEach((t) => {
|
|
2523
2546
|
e[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
@@ -2526,7 +2549,7 @@ function wr(n) {
|
|
|
2526
2549
|
function Dr(n, e) {
|
|
2527
2550
|
return Number.isNaN(Number(n) - Number(e)) ? n < e ? -1 : n > e ? 1 : 0 : Number(n) - Number(e);
|
|
2528
2551
|
}
|
|
2529
|
-
function
|
|
2552
|
+
function wr(n) {
|
|
2530
2553
|
const e = n;
|
|
2531
2554
|
for (const t in n)
|
|
2532
2555
|
n[t].every(
|
|
@@ -2534,67 +2557,67 @@ function Ar(n) {
|
|
|
2534
2557
|
) && n[t].sort((i, a) => Dr(i.value, a.value));
|
|
2535
2558
|
return e;
|
|
2536
2559
|
}
|
|
2537
|
-
function
|
|
2560
|
+
function Ar(n, e, t) {
|
|
2538
2561
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
2539
2562
|
return n.forEach((a) => {
|
|
2540
2563
|
if (a.variations.length === 0)
|
|
2541
2564
|
return;
|
|
2542
|
-
const
|
|
2543
|
-
(
|
|
2565
|
+
const c = a.variations.find(
|
|
2566
|
+
(l) => l.name === e
|
|
2544
2567
|
);
|
|
2545
|
-
if (!(
|
|
2546
|
-
const
|
|
2547
|
-
if (!
|
|
2568
|
+
if (!(c?.values[0] === t)) {
|
|
2569
|
+
const l = `${e}-${c?.values[0]}`;
|
|
2570
|
+
if (!c || i.has(l))
|
|
2548
2571
|
return;
|
|
2549
|
-
i.add(
|
|
2550
|
-
const
|
|
2572
|
+
i.add(l);
|
|
2573
|
+
const d = Bn(
|
|
2551
2574
|
a.images,
|
|
2552
2575
|
e
|
|
2553
2576
|
), g = {
|
|
2554
|
-
src:
|
|
2555
|
-
alt:
|
|
2556
|
-
label: `${e}: ${
|
|
2557
|
-
value:
|
|
2577
|
+
src: d.imageUrl,
|
|
2578
|
+
alt: d.imageLabel ?? "",
|
|
2579
|
+
label: `${e}: ${c.values[0]}`,
|
|
2580
|
+
value: c.values[0]
|
|
2558
2581
|
};
|
|
2559
|
-
r[
|
|
2582
|
+
r[c.name] ? r[c.name].push(g) : r[c.name] = [g];
|
|
2560
2583
|
return;
|
|
2561
2584
|
}
|
|
2562
|
-
a.variations.forEach((
|
|
2563
|
-
const
|
|
2564
|
-
if (i.has(
|
|
2585
|
+
a.variations.forEach((l) => {
|
|
2586
|
+
const d = `${l.name}-${l.values[0]}`;
|
|
2587
|
+
if (i.has(d))
|
|
2565
2588
|
return;
|
|
2566
|
-
i.add(
|
|
2567
|
-
const g =
|
|
2589
|
+
i.add(d);
|
|
2590
|
+
const g = Bn(
|
|
2568
2591
|
a.images,
|
|
2569
|
-
|
|
2570
|
-
),
|
|
2592
|
+
l.name
|
|
2593
|
+
), u = {
|
|
2571
2594
|
src: g.imageUrl,
|
|
2572
2595
|
alt: g.imageText ?? "",
|
|
2573
|
-
label: `${
|
|
2574
|
-
value:
|
|
2596
|
+
label: `${l.name}: ${l.values[0]}`,
|
|
2597
|
+
value: l.values[0]
|
|
2575
2598
|
};
|
|
2576
|
-
r[
|
|
2599
|
+
r[l.name] ? r[l.name].push(u) : r[l.name] = [u];
|
|
2577
2600
|
});
|
|
2578
|
-
}),
|
|
2601
|
+
}), wr(r);
|
|
2579
2602
|
}
|
|
2580
|
-
const
|
|
2581
|
-
activeVariations: (n) =>
|
|
2582
|
-
allVariantsByName: (n) =>
|
|
2583
|
-
slugsMap: (n, e) =>
|
|
2603
|
+
const Pr = {
|
|
2604
|
+
activeVariations: (n) => $n(n.variations),
|
|
2605
|
+
allVariantsByName: (n) => br(n.isVariantOf.skuSpecifications),
|
|
2606
|
+
slugsMap: (n, e) => Cr(
|
|
2584
2607
|
n.isVariantOf.items,
|
|
2585
2608
|
e.dominantVariantName ?? n.variations[0]?.name,
|
|
2586
2609
|
n.isVariantOf.linkText
|
|
2587
2610
|
),
|
|
2588
2611
|
availableVariations: (n, e) => {
|
|
2589
|
-
const t = e.dominantVariantName ?? n.variations[0]?.name, i =
|
|
2590
|
-
return
|
|
2612
|
+
const t = e.dominantVariantName ?? n.variations[0]?.name, i = $n(n.variations)[t];
|
|
2613
|
+
return Ar(
|
|
2591
2614
|
n.isVariantOf.items,
|
|
2592
2615
|
t,
|
|
2593
2616
|
i
|
|
2594
2617
|
);
|
|
2595
2618
|
},
|
|
2596
2619
|
allVariantProducts: (n) => n.isVariantOf.items.map((e) => B(e, n.isVariantOf))
|
|
2597
|
-
},
|
|
2620
|
+
}, Er = {
|
|
2598
2621
|
"pickup-in-point": "Pickup",
|
|
2599
2622
|
delivery: "Delivery",
|
|
2600
2623
|
pickup: "Pickup",
|
|
@@ -2603,52 +2626,52 @@ const Er = {
|
|
|
2603
2626
|
}, Tr = {
|
|
2604
2627
|
deliveryOptionsData: (n) => {
|
|
2605
2628
|
const { shippingData: e, items: t } = n, r = e?.logisticsInfo || [], i = e?.selectedAddresses || e?.availableAddresses || [e?.address], a = r.reduce(
|
|
2606
|
-
(
|
|
2607
|
-
const
|
|
2608
|
-
(
|
|
2609
|
-
),
|
|
2610
|
-
|
|
2611
|
-
), A = (
|
|
2612
|
-
return
|
|
2629
|
+
(d, g) => {
|
|
2630
|
+
const u = g?.selectedSla || "", o = g?.selectedDeliveryChannel || g?.deliveryChannel || "", p = g?.deliveryCompany || "", m = g?.deliveryWindow, S = g?.pickupStoreInfo, I = g?.shippingEstimate || "", O = g?.shippingEstimate ? ge(g?.shippingEstimate) : "", w = g?.shippingEstimateDate || "", _ = g?.addressId || "", P = g?.itemIndex ?? 0, b = t?.[P], E = b?.seller || "", h = `${u}|${o}|${p}|${E}|${I}|${w}|${_}|${m?.startDateUtc}|${m?.endDateUtc}`, v = i?.find(
|
|
2631
|
+
(T) => T?.addressId === _
|
|
2632
|
+
), C = `${Er[o] || ""} ${O} ${v?.neighborhood ? `to ${v?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: D, taxPriceTags: y } = _r(
|
|
2633
|
+
b?.priceTags ?? []
|
|
2634
|
+
), A = (b?.sellingPrice ?? 0) * (b?.quantity ?? 0) + (b?.tax ?? 0) + (D ?? 0);
|
|
2635
|
+
return d[h] || (d[h] = {
|
|
2613
2636
|
// static fields
|
|
2614
|
-
selectedSla:
|
|
2615
|
-
deliveryChannel:
|
|
2616
|
-
deliveryCompany:
|
|
2617
|
-
deliveryWindow:
|
|
2618
|
-
shippingEstimate:
|
|
2637
|
+
selectedSla: u,
|
|
2638
|
+
deliveryChannel: o,
|
|
2639
|
+
deliveryCompany: p,
|
|
2640
|
+
deliveryWindow: m,
|
|
2641
|
+
shippingEstimate: I,
|
|
2619
2642
|
shippingEstimateDate: w,
|
|
2620
2643
|
seller: E,
|
|
2621
|
-
friendlyShippingEstimate:
|
|
2622
|
-
friendlyDeliveryOptionName:
|
|
2623
|
-
address:
|
|
2624
|
-
pickupStoreInfo:
|
|
2644
|
+
friendlyShippingEstimate: O,
|
|
2645
|
+
friendlyDeliveryOptionName: C,
|
|
2646
|
+
address: v,
|
|
2647
|
+
pickupStoreInfo: S,
|
|
2625
2648
|
// dynamic fields
|
|
2626
2649
|
quantityOfDifferentItems: 0,
|
|
2627
2650
|
total: 0,
|
|
2628
2651
|
items: []
|
|
2629
|
-
}),
|
|
2630
|
-
id:
|
|
2631
|
-
uniqueId:
|
|
2632
|
-
name:
|
|
2633
|
-
quantity:
|
|
2634
|
-
price:
|
|
2635
|
-
sellingPrice:
|
|
2636
|
-
imageUrl:
|
|
2652
|
+
}), d[h] && (d[h].items?.push({
|
|
2653
|
+
id: b?.id || "",
|
|
2654
|
+
uniqueId: b?.uniqueId || "",
|
|
2655
|
+
name: b?.name || "",
|
|
2656
|
+
quantity: b?.quantity || 0,
|
|
2657
|
+
price: b?.price || 0,
|
|
2658
|
+
sellingPrice: b?.sellingPrice || 0,
|
|
2659
|
+
imageUrl: b?.imageUrl || "",
|
|
2637
2660
|
taxPriceTags: y ?? [],
|
|
2638
2661
|
taxPriceTagsTotal: D ?? 0,
|
|
2639
|
-
tax:
|
|
2662
|
+
tax: b?.tax || 0,
|
|
2640
2663
|
total: A
|
|
2641
|
-
}),
|
|
2664
|
+
}), d[h].quantityOfDifferentItems = (d[h].quantityOfDifferentItems ?? 0) + 1, d[h].total = (d[h].total ?? 0) + A), d;
|
|
2642
2665
|
},
|
|
2643
2666
|
{}
|
|
2644
|
-
),
|
|
2645
|
-
name: `${s?.firstName ?? ""} ${s?.lastName ?? ""}`.trim() ||
|
|
2667
|
+
), c = Object.values(a), s = e?.contactInformation?.[0], l = {
|
|
2668
|
+
name: `${s?.firstName ?? ""} ${s?.lastName ?? ""}`.trim() || c?.[0]?.address?.receiverName || "",
|
|
2646
2669
|
email: s?.email || "",
|
|
2647
2670
|
phone: s?.phone || ""
|
|
2648
2671
|
};
|
|
2649
2672
|
return {
|
|
2650
|
-
deliveryOptions:
|
|
2651
|
-
contact:
|
|
2673
|
+
deliveryOptions: c,
|
|
2674
|
+
contact: l
|
|
2652
2675
|
};
|
|
2653
2676
|
},
|
|
2654
2677
|
customFields: (n) => {
|
|
@@ -2656,15 +2679,15 @@ const Er = {
|
|
|
2656
2679
|
return Object.values(
|
|
2657
2680
|
e.reduce(
|
|
2658
2681
|
(t, r) => {
|
|
2659
|
-
const i = r?.linkedEntity?.type || "", a = r?.linkedEntity?.id || "",
|
|
2660
|
-
return t[
|
|
2682
|
+
const i = r?.linkedEntity?.type || "", a = r?.linkedEntity?.id || "", c = `${i}|${a || ""}`;
|
|
2683
|
+
return t[c] || (t[c] = { type: i, id: a, fields: [] }), t[c].fields.push(...r?.fields || []), t;
|
|
2661
2684
|
},
|
|
2662
2685
|
{}
|
|
2663
2686
|
)
|
|
2664
2687
|
) || [];
|
|
2665
2688
|
}
|
|
2666
2689
|
};
|
|
2667
|
-
function
|
|
2690
|
+
function _r(n) {
|
|
2668
2691
|
const t = n.filter(
|
|
2669
2692
|
(i) => i?.name?.includes("TAX")
|
|
2670
2693
|
), r = t.reduce(
|
|
@@ -2676,28 +2699,28 @@ function Ur(n) {
|
|
|
2676
2699
|
taxPriceTagsTotal: r
|
|
2677
2700
|
};
|
|
2678
2701
|
}
|
|
2679
|
-
const
|
|
2680
|
-
StoreCollection:
|
|
2681
|
-
StoreAggregateOffer:
|
|
2682
|
-
StoreProduct:
|
|
2683
|
-
StoreSeo:
|
|
2684
|
-
StoreFacet:
|
|
2685
|
-
StoreFacetBoolean:
|
|
2686
|
-
StoreFacetRange:
|
|
2702
|
+
const Ur = {
|
|
2703
|
+
StoreCollection: Zn,
|
|
2704
|
+
StoreAggregateOffer: pt,
|
|
2705
|
+
StoreProduct: ar,
|
|
2706
|
+
StoreSeo: Sr,
|
|
2707
|
+
StoreFacet: Ot,
|
|
2708
|
+
StoreFacetBoolean: Ct,
|
|
2709
|
+
StoreFacetRange: bt,
|
|
2687
2710
|
StoreFacetValueBoolean: Dt,
|
|
2688
|
-
StoreOffer:
|
|
2689
|
-
StoreAggregateRating:
|
|
2690
|
-
StoreReview:
|
|
2691
|
-
StoreProductGroup:
|
|
2692
|
-
StoreSearchResult:
|
|
2693
|
-
StorePropertyValue:
|
|
2694
|
-
SkuVariants:
|
|
2695
|
-
ShippingSLA:
|
|
2711
|
+
StoreOffer: Qt,
|
|
2712
|
+
StoreAggregateRating: gt,
|
|
2713
|
+
StoreReview: mr,
|
|
2714
|
+
StoreProductGroup: sr,
|
|
2715
|
+
StoreSearchResult: fr,
|
|
2716
|
+
StorePropertyValue: cr,
|
|
2717
|
+
SkuVariants: Pr,
|
|
2718
|
+
ShippingSLA: Or,
|
|
2696
2719
|
UserOrderResult: Tr,
|
|
2697
|
-
ObjectOrString:
|
|
2698
|
-
Query:
|
|
2699
|
-
Mutation:
|
|
2700
|
-
},
|
|
2720
|
+
ObjectOrString: Kt,
|
|
2721
|
+
Query: gr,
|
|
2722
|
+
Mutation: Xt
|
|
2723
|
+
}, kr = () => Ur, Fr = `"""
|
|
2701
2724
|
Address information.
|
|
2702
2725
|
"""
|
|
2703
2726
|
type Address {
|
|
@@ -2742,7 +2765,7 @@ type Address {
|
|
|
2742
2765
|
"""
|
|
2743
2766
|
geoCoordinates: [Float]
|
|
2744
2767
|
}
|
|
2745
|
-
`,
|
|
2768
|
+
`, Nr = `"""
|
|
2746
2769
|
Advertisement information about a specific product in a campaign
|
|
2747
2770
|
"""
|
|
2748
2771
|
type Advertisement {
|
|
@@ -2767,7 +2790,7 @@ type Advertisement {
|
|
|
2767
2790
|
"""
|
|
2768
2791
|
adResponseId: String!
|
|
2769
2792
|
}
|
|
2770
|
-
`,
|
|
2793
|
+
`, Rr = `"""
|
|
2771
2794
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
2772
2795
|
"""
|
|
2773
2796
|
type StoreAggregateOffer {
|
|
@@ -2796,7 +2819,7 @@ type StoreAggregateOffer {
|
|
|
2796
2819
|
"""
|
|
2797
2820
|
offers: [StoreOffer!]!
|
|
2798
2821
|
}
|
|
2799
|
-
`,
|
|
2822
|
+
`, Lr = `"""
|
|
2800
2823
|
Average rating, based on multiple ratings or reviews.
|
|
2801
2824
|
"""
|
|
2802
2825
|
type StoreAggregateRating {
|
|
@@ -2809,7 +2832,7 @@ type StoreAggregateRating {
|
|
|
2809
2832
|
"""
|
|
2810
2833
|
reviewCount: Int!
|
|
2811
2834
|
}
|
|
2812
|
-
`,
|
|
2835
|
+
`, Mr = `"""
|
|
2813
2836
|
information about the author of a product review or rating.
|
|
2814
2837
|
"""
|
|
2815
2838
|
type StoreAuthor {
|
|
@@ -2818,7 +2841,7 @@ type StoreAuthor {
|
|
|
2818
2841
|
"""
|
|
2819
2842
|
name: String!
|
|
2820
2843
|
}
|
|
2821
|
-
`,
|
|
2844
|
+
`, Br = `"""
|
|
2822
2845
|
Brand of a given product.
|
|
2823
2846
|
"""
|
|
2824
2847
|
type StoreBrand {
|
|
@@ -2827,7 +2850,7 @@ type StoreBrand {
|
|
|
2827
2850
|
"""
|
|
2828
2851
|
name: String!
|
|
2829
2852
|
}
|
|
2830
|
-
`,
|
|
2853
|
+
`, $r = `"""
|
|
2831
2854
|
Item of a list.
|
|
2832
2855
|
"""
|
|
2833
2856
|
type StoreListItem {
|
|
@@ -2858,7 +2881,7 @@ type StoreBreadcrumbList {
|
|
|
2858
2881
|
"""
|
|
2859
2882
|
numberOfItems: Int!
|
|
2860
2883
|
}
|
|
2861
|
-
`,
|
|
2884
|
+
`, zr = `"""
|
|
2862
2885
|
Shopping cart message.
|
|
2863
2886
|
"""
|
|
2864
2887
|
type StoreCartMessage {
|
|
@@ -2895,7 +2918,7 @@ input IStoreCart {
|
|
|
2895
2918
|
"""
|
|
2896
2919
|
order: IStoreOrder!
|
|
2897
2920
|
}
|
|
2898
|
-
`,
|
|
2921
|
+
`, Vr = `"""
|
|
2899
2922
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\`, \`Cluster\`, \`SubCategory\` or \`Collection\`.
|
|
2900
2923
|
"""
|
|
2901
2924
|
enum StoreCollectionType {
|
|
@@ -2978,7 +3001,7 @@ type StoreCollection {
|
|
|
2978
3001
|
"""
|
|
2979
3002
|
type: StoreCollectionType!
|
|
2980
3003
|
}
|
|
2981
|
-
`,
|
|
3004
|
+
`, xr = `"""
|
|
2982
3005
|
Delivery Promise badge.
|
|
2983
3006
|
"""
|
|
2984
3007
|
type DeliveryPromiseBadge {
|
|
@@ -2987,7 +3010,7 @@ type DeliveryPromiseBadge {
|
|
|
2987
3010
|
"""
|
|
2988
3011
|
typeName: String
|
|
2989
3012
|
}
|
|
2990
|
-
`,
|
|
3013
|
+
`, qr = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
2991
3014
|
|
|
2992
3015
|
"""
|
|
2993
3016
|
Search facet range information.
|
|
@@ -3064,7 +3087,7 @@ type StoreFacetValueBoolean {
|
|
|
3064
3087
|
"""
|
|
3065
3088
|
quantity: Int
|
|
3066
3089
|
}
|
|
3067
|
-
`,
|
|
3090
|
+
`, jr = `"""
|
|
3068
3091
|
Image.
|
|
3069
3092
|
"""
|
|
3070
3093
|
type StoreImage {
|
|
@@ -3091,7 +3114,7 @@ input IStoreImage {
|
|
|
3091
3114
|
"""
|
|
3092
3115
|
alternateName: String!
|
|
3093
3116
|
}
|
|
3094
|
-
`,
|
|
3117
|
+
`, Wr = `type Mutation {
|
|
3095
3118
|
"""
|
|
3096
3119
|
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\`.
|
|
3097
3120
|
"""
|
|
@@ -3129,7 +3152,7 @@ input IStoreImage {
|
|
|
3129
3152
|
data: IOrderEntryOperation!
|
|
3130
3153
|
): StoreOrderEntryOperationResult @auth
|
|
3131
3154
|
}
|
|
3132
|
-
`,
|
|
3155
|
+
`, Gr = `"""
|
|
3133
3156
|
Newsletter information.
|
|
3134
3157
|
"""
|
|
3135
3158
|
type PersonNewsletter {
|
|
@@ -3152,8 +3175,8 @@ input IPersonNewsletter {
|
|
|
3152
3175
|
"""
|
|
3153
3176
|
email: String!
|
|
3154
3177
|
}
|
|
3155
|
-
`,
|
|
3156
|
-
`,
|
|
3178
|
+
`, Hr = `scalar ObjectOrString
|
|
3179
|
+
`, Xr = `"""
|
|
3157
3180
|
Offer information.
|
|
3158
3181
|
"""
|
|
3159
3182
|
type StoreOffer {
|
|
@@ -3236,7 +3259,7 @@ input IStoreOffer {
|
|
|
3236
3259
|
"""
|
|
3237
3260
|
quantity: Int!
|
|
3238
3261
|
}
|
|
3239
|
-
`,
|
|
3262
|
+
`, Yr = `"""
|
|
3240
3263
|
Information of a specific order.
|
|
3241
3264
|
"""
|
|
3242
3265
|
type StoreOrder {
|
|
@@ -3271,7 +3294,7 @@ input IStoreOrder {
|
|
|
3271
3294
|
"""
|
|
3272
3295
|
shouldSplitItem: Boolean
|
|
3273
3296
|
}
|
|
3274
|
-
`,
|
|
3297
|
+
`, Jr = `"""
|
|
3275
3298
|
Commercial Authorization response.
|
|
3276
3299
|
"""
|
|
3277
3300
|
type CommercialAuthorizationResponse {
|
|
@@ -3670,7 +3693,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
3670
3693
|
"""
|
|
3671
3694
|
rule: CommercialAuthorizationRule!
|
|
3672
3695
|
}
|
|
3673
|
-
`,
|
|
3696
|
+
`, Kr = `"""
|
|
3674
3697
|
Input for uploading a file to the Order Entry Service.
|
|
3675
3698
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
3676
3699
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -3731,7 +3754,7 @@ type StoreOrderFormCartItem {
|
|
|
3731
3754
|
seller: String!
|
|
3732
3755
|
unitMultiplier: Float
|
|
3733
3756
|
}
|
|
3734
|
-
`,
|
|
3757
|
+
`, Qr = `"""
|
|
3735
3758
|
Organization.
|
|
3736
3759
|
"""
|
|
3737
3760
|
type StoreOrganization {
|
|
@@ -3750,7 +3773,7 @@ input IStoreOrganization {
|
|
|
3750
3773
|
"""
|
|
3751
3774
|
identifier: String!
|
|
3752
3775
|
}
|
|
3753
|
-
`,
|
|
3776
|
+
`, Zr = `"""
|
|
3754
3777
|
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.
|
|
3755
3778
|
"""
|
|
3756
3779
|
type StorePageInfo {
|
|
@@ -3775,7 +3798,7 @@ type StorePageInfo {
|
|
|
3775
3798
|
"""
|
|
3776
3799
|
totalCount: Int!
|
|
3777
3800
|
}
|
|
3778
|
-
`,
|
|
3801
|
+
`, ni = `"""
|
|
3779
3802
|
Input type for setting a new password.
|
|
3780
3803
|
"""
|
|
3781
3804
|
input ISetPassword {
|
|
@@ -3818,7 +3841,7 @@ type SetPasswordResponse {
|
|
|
3818
3841
|
"""
|
|
3819
3842
|
message: String
|
|
3820
3843
|
}
|
|
3821
|
-
`,
|
|
3844
|
+
`, ei = `"""
|
|
3822
3845
|
Client profile data.
|
|
3823
3846
|
"""
|
|
3824
3847
|
type StorePerson {
|
|
@@ -3861,7 +3884,7 @@ input IStorePerson {
|
|
|
3861
3884
|
"""
|
|
3862
3885
|
familyName: String!
|
|
3863
3886
|
}
|
|
3864
|
-
`,
|
|
3887
|
+
`, ti = `type PickupPointAddress {
|
|
3865
3888
|
"""
|
|
3866
3889
|
Address city.
|
|
3867
3890
|
"""
|
|
@@ -3940,7 +3963,7 @@ type PickupPoints {
|
|
|
3940
3963
|
"""
|
|
3941
3964
|
pickupPointsHash: String
|
|
3942
3965
|
}
|
|
3943
|
-
`,
|
|
3966
|
+
`, ri = `"""
|
|
3944
3967
|
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.
|
|
3945
3968
|
"""
|
|
3946
3969
|
type StoreProduct {
|
|
@@ -4089,7 +4112,7 @@ input IStoreProduct {
|
|
|
4089
4112
|
"""
|
|
4090
4113
|
additionalProperty: [IStorePropertyValue!]
|
|
4091
4114
|
}
|
|
4092
|
-
`,
|
|
4115
|
+
`, ii = `"""
|
|
4093
4116
|
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.
|
|
4094
4117
|
"""
|
|
4095
4118
|
type StoreProductGroup {
|
|
@@ -4116,7 +4139,7 @@ type StoreProductGroup {
|
|
|
4116
4139
|
"""
|
|
4117
4140
|
skuVariants: SkuVariants
|
|
4118
4141
|
}
|
|
4119
|
-
`,
|
|
4142
|
+
`, ai = `type Profile {
|
|
4120
4143
|
"""
|
|
4121
4144
|
Collection of user's address
|
|
4122
4145
|
"""
|
|
@@ -4177,7 +4200,7 @@ type ProfileAddress {
|
|
|
4177
4200
|
"""
|
|
4178
4201
|
geoCoordinate: [Float]
|
|
4179
4202
|
}
|
|
4180
|
-
`,
|
|
4203
|
+
`, oi = `"""
|
|
4181
4204
|
Properties that can be associated with products and products groups.
|
|
4182
4205
|
"""
|
|
4183
4206
|
type StorePropertyValue {
|
|
@@ -4217,7 +4240,7 @@ input IStorePropertyValue {
|
|
|
4217
4240
|
"""
|
|
4218
4241
|
valueReference: ObjectOrString!
|
|
4219
4242
|
}
|
|
4220
|
-
`,
|
|
4243
|
+
`, si = `"""
|
|
4221
4244
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
4222
4245
|
"""
|
|
4223
4246
|
type StoreProductEdge {
|
|
@@ -4779,7 +4802,7 @@ type StoreAccountProfile {
|
|
|
4779
4802
|
email: String
|
|
4780
4803
|
id: String
|
|
4781
4804
|
}
|
|
4782
|
-
`,
|
|
4805
|
+
`, ci = `"""
|
|
4783
4806
|
Information of a given review rating.
|
|
4784
4807
|
"""
|
|
4785
4808
|
type StoreReviewRating {
|
|
@@ -4806,7 +4829,7 @@ type StoreReview {
|
|
|
4806
4829
|
"""
|
|
4807
4830
|
author: StoreAuthor!
|
|
4808
4831
|
}
|
|
4809
|
-
`,
|
|
4832
|
+
`, li = `"""
|
|
4810
4833
|
Search Engine Optimization (SEO) tags data.
|
|
4811
4834
|
"""
|
|
4812
4835
|
type StoreSeo {
|
|
@@ -4827,7 +4850,7 @@ type StoreSeo {
|
|
|
4827
4850
|
"""
|
|
4828
4851
|
canonical: String!
|
|
4829
4852
|
}
|
|
4830
|
-
`,
|
|
4853
|
+
`, di = `"""
|
|
4831
4854
|
Currency information.
|
|
4832
4855
|
"""
|
|
4833
4856
|
type StoreCurrency {
|
|
@@ -5102,7 +5125,7 @@ input IStoreSession {
|
|
|
5102
5125
|
"""
|
|
5103
5126
|
refreshAfter: String
|
|
5104
5127
|
}
|
|
5105
|
-
`,
|
|
5128
|
+
`, ui = `"""
|
|
5106
5129
|
Shipping Simulation item input.
|
|
5107
5130
|
"""
|
|
5108
5131
|
input IShippingItem {
|
|
@@ -5433,7 +5456,7 @@ type MessageFields {
|
|
|
5433
5456
|
"""
|
|
5434
5457
|
skuName: String
|
|
5435
5458
|
}
|
|
5436
|
-
`,
|
|
5459
|
+
`, pi = `type SkuVariants {
|
|
5437
5460
|
"""
|
|
5438
5461
|
SKU property values for the current SKU.
|
|
5439
5462
|
"""
|
|
@@ -5528,7 +5551,7 @@ Example:
|
|
|
5528
5551
|
\`\`\`
|
|
5529
5552
|
"""
|
|
5530
5553
|
scalar FormattedVariants
|
|
5531
|
-
`,
|
|
5554
|
+
`, gi = `"""
|
|
5532
5555
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
5533
5556
|
"""
|
|
5534
5557
|
enum StoreStatus {
|
|
@@ -5536,7 +5559,7 @@ enum StoreStatus {
|
|
|
5536
5559
|
WARNING
|
|
5537
5560
|
ERROR
|
|
5538
5561
|
}
|
|
5539
|
-
`,
|
|
5562
|
+
`, mi = `scalar JSONObject
|
|
5540
5563
|
|
|
5541
5564
|
type UserOrder {
|
|
5542
5565
|
orderId: String
|
|
@@ -6360,95 +6383,95 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
6360
6383
|
type: String
|
|
6361
6384
|
id: String
|
|
6362
6385
|
}
|
|
6363
|
-
`,
|
|
6386
|
+
`, hi = /* @__PURE__ */ Object.assign({
|
|
6364
6387
|
"./address.graphql": Fr,
|
|
6365
|
-
"./advertisement.graphql":
|
|
6366
|
-
"./aggregateOffer.graphql":
|
|
6367
|
-
"./aggregateRating.graphql":
|
|
6368
|
-
"./author.graphql":
|
|
6369
|
-
"./brand.graphql":
|
|
6370
|
-
"./breadcrumb.graphql":
|
|
6371
|
-
"./cart.graphql":
|
|
6372
|
-
"./collection.graphql":
|
|
6373
|
-
"./deliveryPromisesBadge.graphql":
|
|
6374
|
-
"./facet.graphql":
|
|
6375
|
-
"./image.graphql":
|
|
6376
|
-
"./mutation.graphql":
|
|
6377
|
-
"./newsletter.graphql":
|
|
6378
|
-
"./objectOrString.graphql":
|
|
6379
|
-
"./offer.graphql":
|
|
6380
|
-
"./order.graphql":
|
|
6381
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
6382
|
-
"./orderEntry.graphql":
|
|
6383
|
-
"./organization.graphql":
|
|
6384
|
-
"./pageInfo.graphql":
|
|
6385
|
-
"./password.graphql":
|
|
6386
|
-
"./person.graphql":
|
|
6387
|
-
"./pickupPoints.graphql":
|
|
6388
|
-
"./product.graphql":
|
|
6389
|
-
"./productGroup.graphql":
|
|
6390
|
-
"./profile.graphql":
|
|
6391
|
-
"./propertyValue.graphql":
|
|
6392
|
-
"./query.graphql":
|
|
6393
|
-
"./review.graphql":
|
|
6394
|
-
"./seo.graphql":
|
|
6395
|
-
"./session.graphql":
|
|
6396
|
-
"./shipping.graphql":
|
|
6397
|
-
"./skuVariants.graphql":
|
|
6398
|
-
"./status.graphql":
|
|
6399
|
-
"./userOrder.graphql":
|
|
6400
|
-
}),
|
|
6401
|
-
Object.values(
|
|
6402
|
-
(n, e) =>
|
|
6388
|
+
"./advertisement.graphql": Nr,
|
|
6389
|
+
"./aggregateOffer.graphql": Rr,
|
|
6390
|
+
"./aggregateRating.graphql": Lr,
|
|
6391
|
+
"./author.graphql": Mr,
|
|
6392
|
+
"./brand.graphql": Br,
|
|
6393
|
+
"./breadcrumb.graphql": $r,
|
|
6394
|
+
"./cart.graphql": zr,
|
|
6395
|
+
"./collection.graphql": Vr,
|
|
6396
|
+
"./deliveryPromisesBadge.graphql": xr,
|
|
6397
|
+
"./facet.graphql": qr,
|
|
6398
|
+
"./image.graphql": jr,
|
|
6399
|
+
"./mutation.graphql": Wr,
|
|
6400
|
+
"./newsletter.graphql": Gr,
|
|
6401
|
+
"./objectOrString.graphql": Hr,
|
|
6402
|
+
"./offer.graphql": Xr,
|
|
6403
|
+
"./order.graphql": Yr,
|
|
6404
|
+
"./orderCommercialAuthorizaton.graphql": Jr,
|
|
6405
|
+
"./orderEntry.graphql": Kr,
|
|
6406
|
+
"./organization.graphql": Qr,
|
|
6407
|
+
"./pageInfo.graphql": Zr,
|
|
6408
|
+
"./password.graphql": ni,
|
|
6409
|
+
"./person.graphql": ei,
|
|
6410
|
+
"./pickupPoints.graphql": ti,
|
|
6411
|
+
"./product.graphql": ri,
|
|
6412
|
+
"./productGroup.graphql": ii,
|
|
6413
|
+
"./profile.graphql": ai,
|
|
6414
|
+
"./propertyValue.graphql": oi,
|
|
6415
|
+
"./query.graphql": si,
|
|
6416
|
+
"./review.graphql": ci,
|
|
6417
|
+
"./seo.graphql": li,
|
|
6418
|
+
"./session.graphql": di,
|
|
6419
|
+
"./shipping.graphql": ui,
|
|
6420
|
+
"./skuVariants.graphql": pi,
|
|
6421
|
+
"./status.graphql": gi,
|
|
6422
|
+
"./userOrder.graphql": mi
|
|
6423
|
+
}), fi = ye(
|
|
6424
|
+
Object.values(hi).map((n) => Ie(n)).reduce(
|
|
6425
|
+
(n, e) => zn([n, e], { sort: !0 })
|
|
6403
6426
|
)
|
|
6404
|
-
),
|
|
6427
|
+
), Si = fi, Ri = async (n) => M.context.with(
|
|
6405
6428
|
M.propagation.extract(M.context.active(), n.OTEL),
|
|
6406
6429
|
() => (e) => (e.storage = {
|
|
6407
6430
|
channel: nn.parse(n.channel),
|
|
6408
6431
|
flags: n.flags ?? {},
|
|
6409
6432
|
locale: n.locale,
|
|
6410
6433
|
cookies: /* @__PURE__ */ new Map()
|
|
6411
|
-
}, e.clients =
|
|
6434
|
+
}, e.clients = Qe(n, e), e.loaders = ct(n, e), e.account = n.account, e.OTEL = n.OTEL, e.discoveryConfig = n.discoveryConfig, e)
|
|
6412
6435
|
);
|
|
6413
|
-
function
|
|
6414
|
-
const n =
|
|
6436
|
+
function yi() {
|
|
6437
|
+
const n = kr(), e = {};
|
|
6415
6438
|
for (const [t, r] of Object.entries(n))
|
|
6416
6439
|
e[t] = Object.fromEntries(
|
|
6417
|
-
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i,
|
|
6440
|
+
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, Be(a, `${t}(${i})`)])
|
|
6418
6441
|
);
|
|
6419
6442
|
return e;
|
|
6420
6443
|
}
|
|
6421
|
-
function
|
|
6422
|
-
const t =
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
])(
|
|
6426
|
-
return n &&
|
|
6444
|
+
function Li(n) {
|
|
6445
|
+
const t = Me([
|
|
6446
|
+
Le,
|
|
6447
|
+
Fe
|
|
6448
|
+
])(yi(), Si);
|
|
6449
|
+
return n && ve(n) ? fe({
|
|
6427
6450
|
schemas: [t, n]
|
|
6428
6451
|
}) : t;
|
|
6429
6452
|
}
|
|
6430
6453
|
export {
|
|
6431
|
-
|
|
6454
|
+
Fe as AuthDirective,
|
|
6432
6455
|
k as BadRequestError,
|
|
6433
|
-
|
|
6434
|
-
|
|
6456
|
+
Le as CacheControlDirective,
|
|
6457
|
+
De as CommercialAuthorizationStatus,
|
|
6435
6458
|
X as FastStoreError,
|
|
6436
6459
|
an as ForbiddenError,
|
|
6437
|
-
|
|
6438
|
-
|
|
6460
|
+
Ri as GraphqlVtexContextFactory,
|
|
6461
|
+
Li as GraphqlVtexSchema,
|
|
6439
6462
|
z as NotFoundError,
|
|
6440
6463
|
we as StoreCollectionType,
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6464
|
+
Ae as StoreFacetType,
|
|
6465
|
+
Pe as StoreSort,
|
|
6466
|
+
Ee as StoreStatus,
|
|
6444
6467
|
J as UnauthorizedError,
|
|
6445
|
-
|
|
6468
|
+
Te as UserOrderInvoiceType,
|
|
6446
6469
|
Fi as isBadRequestError,
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6470
|
+
ki as isFastStoreError,
|
|
6471
|
+
$e as isForbiddenError,
|
|
6472
|
+
ze as isNotFoundError,
|
|
6473
|
+
Ni as isUnauthorizedError,
|
|
6474
|
+
Ui as stringifyCacheControl,
|
|
6475
|
+
Si as typeDefs,
|
|
6476
|
+
Me as withDirectives
|
|
6454
6477
|
};
|