@faststore/api 4.7.0 → 4.7.1-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +58 -47
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +988 -977
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/__generated__/schema.d.ts +12 -1
- package/dist/src/__generated__/schema.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/collection.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/__generated__/schema.ts +12 -1
- package/src/platforms/vtex/resolvers/collection.ts +81 -68
- package/src/platforms/vtex/typeDefs/collection.graphql +12 -1
package/dist/es/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
4
|
-
import { GraphQLScalarType as
|
|
5
|
-
import { logger as
|
|
6
|
-
import
|
|
1
|
+
import { mergeTypeDefs as rn } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as Bn, mergeSchemas as $n } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as an, MapperKind as on, getDirective as sn } from "@graphql-tools/utils";
|
|
4
|
+
import { GraphQLScalarType as Mn, print as zn, parse as Vn, isSchema as xn } from "graphql";
|
|
5
|
+
import { logger as qn, OTELAPI as z } from "@faststore/diagnostics";
|
|
6
|
+
import jn from "isomorphic-unfetch";
|
|
7
7
|
import { parse as Q } from "cookie";
|
|
8
|
-
import
|
|
8
|
+
import De from "p-limit";
|
|
9
9
|
import ue from "dataloader";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const
|
|
10
|
+
import Wn from "sanitize-html";
|
|
11
|
+
import Ae from "fast-deep-equal";
|
|
12
|
+
import Hn from "node:crypto";
|
|
13
|
+
var Gn = /* @__PURE__ */ ((e) => (e.Personal = "personal", e.Shared = "shared", e))(Gn || {}), Xn = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(Xn || {}), Yn = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(Yn || {}), Jn = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(Jn || {}), Kn = /* @__PURE__ */ ((e) => (e.DiscountDesc = "discount_desc", e.NameAsc = "name_asc", e.NameDesc = "name_desc", e.OrdersDesc = "orders_desc", e.PriceAsc = "price_asc", e.PriceDesc = "price_desc", e.ReleaseDesc = "release_desc", e.ScoreDesc = "score_desc", e))(Kn || {}), Qn = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(Qn || {}), Zn = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(Zn || {});
|
|
14
|
+
const et = () => function(n = {}) {
|
|
15
15
|
const t = process.env.FS_DISCOVERY_APP_KEY ?? "", r = process.env.FS_DISCOVERY_APP_TOKEN ?? "";
|
|
16
16
|
if (!t || !r)
|
|
17
17
|
throw new J("No authentication AppKey and AppToken passed.");
|
|
@@ -20,100 +20,100 @@ const Qn = () => function(n = {}) {
|
|
|
20
20
|
"X-VTEX-API-AppKey": t,
|
|
21
21
|
"X-VTEX-API-AppToken": r
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, nt = async (e) => {
|
|
24
24
|
const {
|
|
25
25
|
clients: { commerce: n }
|
|
26
26
|
} = e;
|
|
27
27
|
try {
|
|
28
28
|
if ((await n.vtexid.validate())?.authStatus?.toLowerCase() !== "success")
|
|
29
|
-
throw new
|
|
29
|
+
throw new ie("Authentication required");
|
|
30
30
|
} catch (t) {
|
|
31
31
|
const r = t.extensions?.status ?? t.status;
|
|
32
|
-
throw r === 401 ? new
|
|
32
|
+
throw r === 401 ? new ie("Authentication required") : r === 403 ? new J("You are not allowed to access this resource") : new ie("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, tt = "auth", rt = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (e) =>
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
36
|
+
transformer: (e) => an(e, {
|
|
37
|
+
[on.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (sn(e, n, tt)?.[0]) {
|
|
39
39
|
const r = n.resolve;
|
|
40
|
-
n.resolve = async (i, a, o, s) => (await
|
|
40
|
+
n.resolve = async (i, a, o, s) => (await nt(o), r?.(i, a, o, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, it = "cacheControl", to = (e, n) => {
|
|
46
46
|
const {
|
|
47
47
|
scope: t = "private",
|
|
48
48
|
sMaxAge: r = 0,
|
|
49
49
|
staleWhileRevalidate: i = 0
|
|
50
50
|
} = e;
|
|
51
51
|
return `${n ? "private" : t}, s-maxage=${r}, stale-while-revalidate=${i}`;
|
|
52
|
-
},
|
|
52
|
+
}, ke = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, at = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, ot = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (e) =>
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (e) => an(e, {
|
|
55
|
+
[on.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = sn(e, n, it)?.[0];
|
|
57
57
|
if (t) {
|
|
58
58
|
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
|
|
59
|
-
n.resolve = (s, c,
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
62
|
-
|
|
59
|
+
n.resolve = (s, c, u, d) => (u.cacheControl = {
|
|
60
|
+
sMaxAge: ke(u.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: ke(
|
|
62
|
+
u.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
66
|
-
}, o?.(s, c,
|
|
65
|
+
scope: at(u.cacheControl?.scope, a)
|
|
66
|
+
}, o?.(s, c, u, d));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
71
|
+
}, st = (e) => (n, t) => {
|
|
72
|
+
const r = rn([
|
|
73
73
|
...(e ?? []).map(({ typeDefs: i }) => i),
|
|
74
74
|
t
|
|
75
75
|
]);
|
|
76
76
|
return (e ?? []).reduce(
|
|
77
77
|
(i, { transformer: a }) => a?.(i) ?? i,
|
|
78
|
-
|
|
78
|
+
Bn({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
},
|
|
84
|
-
name:
|
|
85
|
-
version:
|
|
86
|
-
},
|
|
83
|
+
}, cn = "@faststore/api", ln = "4.7.1-dev.0", Ee = {
|
|
84
|
+
name: cn,
|
|
85
|
+
version: ln
|
|
86
|
+
}, ct = qn("@faststore/api"), lt = (e, n = "Unknown Graphql Resolver") => (t, r, i, a) => {
|
|
87
87
|
if (!i?.OTEL_ENABLED)
|
|
88
88
|
return e(t, r, i, a);
|
|
89
|
-
const o =
|
|
90
|
-
kind:
|
|
89
|
+
const o = z.trace.getTracer("Graphql").startSpan(n, {
|
|
90
|
+
kind: z.SpanKind.INTERNAL,
|
|
91
91
|
attributes: {
|
|
92
92
|
timestamp: Date.now(),
|
|
93
|
-
"@faststore_version":
|
|
94
|
-
"@faststore_package_name":
|
|
93
|
+
"@faststore_version": ln,
|
|
94
|
+
"@faststore_package_name": cn,
|
|
95
95
|
"@faststore_account_name": i.account,
|
|
96
96
|
"@faststore_environment": process.env.NODE_ENV,
|
|
97
97
|
"@faststore_resolver_parent_type": a?.parentType?.name,
|
|
98
98
|
"@faststore_resolver_field_name": a?.fieldName
|
|
99
99
|
}
|
|
100
|
-
}), s =
|
|
100
|
+
}), s = z.trace.setSpan(z.context.active(), o);
|
|
101
101
|
try {
|
|
102
|
-
const c =
|
|
102
|
+
const c = z.context.with(
|
|
103
103
|
s,
|
|
104
104
|
() => e(t, r, i, a)
|
|
105
105
|
);
|
|
106
106
|
return c instanceof Promise ? c.then(
|
|
107
|
-
(
|
|
108
|
-
(
|
|
107
|
+
(u) => (o.end(), u),
|
|
108
|
+
(u) => Te(u, o, n)
|
|
109
109
|
) : (o.end(), c);
|
|
110
110
|
} catch (c) {
|
|
111
111
|
return Te(c, o, n);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
function Te(e, n, t) {
|
|
115
|
-
throw n.setStatus({ code:
|
|
116
|
-
%o`, e),
|
|
115
|
+
throw n.setStatus({ code: z.SpanStatusCode.ERROR }), n.recordException(e), n.end(), console.error(`Error at resolver: ${t}:
|
|
116
|
+
%o`, e), ct("error", `Error at resolver: %s
|
|
117
117
|
%o`, t, e), e;
|
|
118
118
|
}
|
|
119
119
|
class Z extends Error {
|
|
@@ -121,12 +121,12 @@ class Z extends Error {
|
|
|
121
121
|
super(t), this.extensions = n, this.name = "FastStoreError";
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
class
|
|
124
|
+
class E extends Z {
|
|
125
125
|
constructor(n) {
|
|
126
126
|
super({ status: 400, type: "BadRequestError" }, n);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
class
|
|
129
|
+
class ie extends Z {
|
|
130
130
|
constructor(n) {
|
|
131
131
|
super({ status: 401, type: "UnauthorizedError" }, n);
|
|
132
132
|
}
|
|
@@ -141,12 +141,12 @@ class $ extends Z {
|
|
|
141
141
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
const r = await
|
|
144
|
+
const ro = (e) => e?.name === "FastStoreError", io = (e) => e?.extensions?.type === "BadRequestError", ao = (e) => e?.extensions?.type === "UnauthorizedError", dt = (e) => e?.extensions?.type === "ForbiddenError", Y = (e) => e?.extensions?.type === "NotFoundError", ut = `${Ee.name}@${Ee.version}`, y = async (e, n, t) => {
|
|
145
|
+
const r = await jn(e, {
|
|
146
146
|
...n,
|
|
147
147
|
headers: {
|
|
148
148
|
...n?.headers ?? {},
|
|
149
|
-
"User-Agent":
|
|
149
|
+
"User-Agent": ut
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
if (r.ok)
|
|
@@ -156,9 +156,9 @@ const no = (e) => e?.name === "FastStoreError", to = (e) => e?.extensions?.type
|
|
|
156
156
|
if (typeof r?.status == "number")
|
|
157
157
|
switch (r.status) {
|
|
158
158
|
case 400:
|
|
159
|
-
throw new
|
|
159
|
+
throw new E(i);
|
|
160
160
|
case 401:
|
|
161
|
-
throw new
|
|
161
|
+
throw new ie(i);
|
|
162
162
|
case 403:
|
|
163
163
|
throw new J(i);
|
|
164
164
|
case 404:
|
|
@@ -170,7 +170,7 @@ const no = (e) => e?.name === "FastStoreError", to = (e) => e?.extensions?.type
|
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
throw new Error(i);
|
|
173
|
-
},
|
|
173
|
+
}, pt = ({ account: e, environment: n }) => {
|
|
174
174
|
const t = `https://${e}.${n}.com.br`;
|
|
175
175
|
return {
|
|
176
176
|
getLocalizedProduct: (r, i) => y(`${t}/api/catalog-dataplane/product/${r}`, {
|
|
@@ -181,7 +181,7 @@ const no = (e) => e?.name === "FastStoreError", to = (e) => e?.extensions?.type
|
|
|
181
181
|
}
|
|
182
182
|
})
|
|
183
183
|
};
|
|
184
|
-
},
|
|
184
|
+
}, dn = (e) => {
|
|
185
185
|
if (!e)
|
|
186
186
|
return e;
|
|
187
187
|
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
@@ -195,8 +195,8 @@ const no = (e) => e?.name === "FastStoreError", to = (e) => e?.extensions?.type
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
198
|
-
},
|
|
199
|
-
const t = n.match(
|
|
198
|
+
}, gt = /^([^=]+)=([^;]*)/, mt = (e, n) => {
|
|
199
|
+
const t = n.match(gt);
|
|
200
200
|
if (t) {
|
|
201
201
|
const r = t[1], i = t[2];
|
|
202
202
|
e.storage.cookies.set(r, {
|
|
@@ -204,39 +204,39 @@ const no = (e) => e?.name === "FastStoreError", to = (e) => e?.extensions?.type
|
|
|
204
204
|
setCookie: n
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
},
|
|
207
|
+
}, ht = (e, n) => {
|
|
208
208
|
n.getSetCookie().forEach(
|
|
209
|
-
(t) =>
|
|
209
|
+
(t) => mt(e, t)
|
|
210
210
|
);
|
|
211
|
-
},
|
|
211
|
+
}, ft = (e) => (n) => ht(e, n), me = (e) => {
|
|
212
212
|
if (!e.headers?.cookie)
|
|
213
213
|
return null;
|
|
214
|
-
const n =
|
|
214
|
+
const n = dn(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
215
215
|
return t.length === 0 ? n : t.reduce(
|
|
216
|
-
(r, [i, { value: a }]) =>
|
|
216
|
+
(r, [i, { value: a }]) => St(
|
|
217
217
|
r,
|
|
218
218
|
i,
|
|
219
219
|
a
|
|
220
220
|
),
|
|
221
221
|
n
|
|
222
222
|
);
|
|
223
|
-
},
|
|
224
|
-
const r =
|
|
223
|
+
}, un = (e) => function(t) {
|
|
224
|
+
const r = me(e);
|
|
225
225
|
return r ? {
|
|
226
226
|
...t,
|
|
227
227
|
cookie: r
|
|
228
228
|
} : t;
|
|
229
229
|
}, L = (e, n) => {
|
|
230
|
-
const t =
|
|
230
|
+
const t = dn(e);
|
|
231
231
|
return Q(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
232
|
-
},
|
|
232
|
+
}, St = (e, n, t) => {
|
|
233
233
|
const r = new RegExp(`(${n})=([^;]*)`), i = e.match(r);
|
|
234
234
|
return i ? e.replace(
|
|
235
235
|
i[0],
|
|
236
236
|
`${i[1]}=${t}`
|
|
237
237
|
) : `${e};${n}=${t}`;
|
|
238
238
|
};
|
|
239
|
-
function
|
|
239
|
+
function V(e) {
|
|
240
240
|
if (!e)
|
|
241
241
|
return null;
|
|
242
242
|
try {
|
|
@@ -245,12 +245,12 @@ function z(e) {
|
|
|
245
245
|
return null;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
const
|
|
248
|
+
const yt = "storefront/faststore.recommendation-shelf@v4", H = {
|
|
249
249
|
method: "POST",
|
|
250
250
|
headers: {
|
|
251
251
|
"content-type": "application/json"
|
|
252
252
|
}
|
|
253
|
-
},
|
|
253
|
+
}, It = (e) => e.split("/").map(encodeURIComponent).join("/"), pe = (e) => e ? { headers: { "Accept-Language": e } } : void 0, vt = /^\d{4}-\d{2}-\d{2}$/, Ot = /* @__PURE__ */ new Set([
|
|
254
254
|
"Draft",
|
|
255
255
|
"Requested",
|
|
256
256
|
"InReview",
|
|
@@ -261,7 +261,7 @@ const ft = "storefront/faststore.recommendation-shelf@v4", W = {
|
|
|
261
261
|
"ConvertedToCart",
|
|
262
262
|
"ConvertedToOrder"
|
|
263
263
|
]);
|
|
264
|
-
function
|
|
264
|
+
function bt({
|
|
265
265
|
page: e,
|
|
266
266
|
perPage: n,
|
|
267
267
|
status: t,
|
|
@@ -284,19 +284,19 @@ function vt({
|
|
|
284
284
|
["expiresAtFrom", a],
|
|
285
285
|
["expiresAtTo", o]
|
|
286
286
|
])
|
|
287
|
-
if (c && !
|
|
287
|
+
if (c && !vt.test(c))
|
|
288
288
|
throw new Error(
|
|
289
289
|
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
290
290
|
);
|
|
291
291
|
if (t && t.length > 0) {
|
|
292
|
-
const s = t.filter((c) => !
|
|
292
|
+
const s = t.filter((c) => !Ot.has(c));
|
|
293
293
|
if (s.length > 0)
|
|
294
294
|
throw new Error(
|
|
295
295
|
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
296
296
|
);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function Ct({
|
|
300
300
|
page: e,
|
|
301
301
|
perPage: n,
|
|
302
302
|
status: t,
|
|
@@ -307,19 +307,19 @@ function Ot({
|
|
|
307
307
|
label: s
|
|
308
308
|
}) {
|
|
309
309
|
const c = new URLSearchParams();
|
|
310
|
-
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((
|
|
310
|
+
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((u) => c.append("status", u)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i), a && c.append("expiresAtFrom", a), o && c.append("expiresAtTo", o), s?.trim() && c.append("label", s.trim()), c;
|
|
311
311
|
}
|
|
312
|
-
const
|
|
313
|
-
const a = `https://${e}.${n}.com.br`, o =
|
|
312
|
+
const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
313
|
+
const a = `https://${e}.${n}.com.br`, o = ft(i), s = un(i), c = et(), u = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", d = r && r.map((l) => l + ".").find((l) => u.includes(l)) || "", g = u.replace(d, ""), f = `${a}/api/recommend-bff/v2`, h = s({
|
|
314
314
|
accept: "application/json",
|
|
315
315
|
"content-type": "application/json",
|
|
316
|
-
"x-vtex-rec-origin": `${e}/${
|
|
317
|
-
}),
|
|
318
|
-
const
|
|
316
|
+
"x-vtex-rec-origin": `${e}/${yt}`
|
|
317
|
+
}), b = (l = {}) => {
|
|
318
|
+
const p = L(me(i) ?? "", e);
|
|
319
319
|
return s({
|
|
320
320
|
...l,
|
|
321
|
-
"X-FORWARDED-HOST":
|
|
322
|
-
...
|
|
321
|
+
"X-FORWARDED-HOST": g,
|
|
322
|
+
...p ? { [`VtexIdclientAutCookie_${e}`]: p } : {}
|
|
323
323
|
});
|
|
324
324
|
};
|
|
325
325
|
return {
|
|
@@ -352,33 +352,33 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
352
352
|
// The by-linkid endpoints resolve a slug to a single catalog entity
|
|
353
353
|
// (or 404 when there is no match). We surface a 404 as `null` so the
|
|
354
354
|
// loader can cascade category → brand → collection.
|
|
355
|
-
category: async (l,
|
|
355
|
+
category: async (l, p) => {
|
|
356
356
|
try {
|
|
357
357
|
return await y(
|
|
358
|
-
`${a}/api/catalog_system/pub/category/by-linkid/${
|
|
359
|
-
pe(
|
|
358
|
+
`${a}/api/catalog_system/pub/category/by-linkid/${It(l)}`,
|
|
359
|
+
pe(p)
|
|
360
360
|
);
|
|
361
361
|
} catch (m) {
|
|
362
362
|
if (Y(m)) return null;
|
|
363
363
|
throw m;
|
|
364
364
|
}
|
|
365
365
|
},
|
|
366
|
-
brand: async (l,
|
|
366
|
+
brand: async (l, p) => {
|
|
367
367
|
try {
|
|
368
368
|
return await y(
|
|
369
369
|
`${a}/api/catalog_system/pub/brand/by-linkid/${encodeURIComponent(l)}`,
|
|
370
|
-
pe(
|
|
370
|
+
pe(p)
|
|
371
371
|
);
|
|
372
372
|
} catch (m) {
|
|
373
373
|
if (Y(m)) return null;
|
|
374
374
|
throw m;
|
|
375
375
|
}
|
|
376
376
|
},
|
|
377
|
-
collection: async (l,
|
|
377
|
+
collection: async (l, p) => {
|
|
378
378
|
try {
|
|
379
379
|
return await y(
|
|
380
380
|
`${a}/api/catalog_system/pub/collection/by-linkid/${encodeURIComponent(l)}`,
|
|
381
|
-
pe(
|
|
381
|
+
pe(p)
|
|
382
382
|
);
|
|
383
383
|
} catch (m) {
|
|
384
384
|
if (Y(m)) return null;
|
|
@@ -389,7 +389,7 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
389
389
|
products: {
|
|
390
390
|
crossselling: ({
|
|
391
391
|
type: l,
|
|
392
|
-
productId:
|
|
392
|
+
productId: p,
|
|
393
393
|
groupByProduct: m = !0
|
|
394
394
|
}) => {
|
|
395
395
|
const S = new URLSearchParams({
|
|
@@ -397,7 +397,7 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
397
397
|
groupByProduct: m.toString()
|
|
398
398
|
});
|
|
399
399
|
return y(
|
|
400
|
-
`${a}/api/catalog_system/pub/products/crossselling/${l}/${
|
|
400
|
+
`${a}/api/catalog_system/pub/products/crossselling/${l}/${p}?${S}`,
|
|
401
401
|
void 0,
|
|
402
402
|
{ storeCookies: o }
|
|
403
403
|
);
|
|
@@ -405,17 +405,17 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
405
405
|
}
|
|
406
406
|
},
|
|
407
407
|
checkout: {
|
|
408
|
-
simulation: (l, { salesChannel:
|
|
408
|
+
simulation: (l, { salesChannel: p } = i.storage.channel) => {
|
|
409
409
|
const m = new URLSearchParams({
|
|
410
|
-
sc:
|
|
410
|
+
sc: p
|
|
411
411
|
}), S = s({
|
|
412
412
|
"content-type": "application/json",
|
|
413
|
-
"X-FORWARDED-HOST":
|
|
413
|
+
"X-FORWARDED-HOST": g
|
|
414
414
|
});
|
|
415
415
|
return y(
|
|
416
416
|
`${a}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
417
417
|
{
|
|
418
|
-
...
|
|
418
|
+
...H,
|
|
419
419
|
headers: S,
|
|
420
420
|
body: JSON.stringify(l)
|
|
421
421
|
},
|
|
@@ -424,15 +424,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
424
424
|
},
|
|
425
425
|
shippingData: ({
|
|
426
426
|
id: l,
|
|
427
|
-
index:
|
|
427
|
+
index: p,
|
|
428
428
|
deliveryMode: m,
|
|
429
429
|
selectedAddresses: S
|
|
430
|
-
},
|
|
431
|
-
const w =
|
|
430
|
+
}, v) => {
|
|
431
|
+
const w = v ? {
|
|
432
432
|
startDateUtc: m?.deliveryWindow?.startDate,
|
|
433
433
|
endDateUtc: m?.deliveryWindow?.endDate
|
|
434
434
|
} : null, C = {
|
|
435
|
-
logisticsInfo: Array.from({ length:
|
|
435
|
+
logisticsInfo: Array.from({ length: p }, (I, D) => ({
|
|
436
436
|
itemIndex: D,
|
|
437
437
|
selectedDeliveryChannel: m?.deliveryChannel || null,
|
|
438
438
|
selectedSla: m?.deliveryMethod || null,
|
|
@@ -442,12 +442,12 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
442
442
|
clearAddressIfPostalCodeNotFound: t
|
|
443
443
|
}, k = s({
|
|
444
444
|
"content-type": "application/json",
|
|
445
|
-
"X-FORWARDED-HOST":
|
|
445
|
+
"X-FORWARDED-HOST": g
|
|
446
446
|
});
|
|
447
447
|
return y(
|
|
448
448
|
`${a}/api/checkout/pub/orderForm/${l}/attachments/shippingData`,
|
|
449
449
|
{
|
|
450
|
-
...
|
|
450
|
+
...H,
|
|
451
451
|
headers: k,
|
|
452
452
|
body: JSON.stringify(C)
|
|
453
453
|
},
|
|
@@ -456,17 +456,17 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
456
456
|
},
|
|
457
457
|
marketingData: ({
|
|
458
458
|
id: l,
|
|
459
|
-
marketingData:
|
|
459
|
+
marketingData: p
|
|
460
460
|
}) => {
|
|
461
461
|
const m = s({
|
|
462
462
|
"content-type": "application/json",
|
|
463
|
-
"X-FORWARDED-HOST":
|
|
463
|
+
"X-FORWARDED-HOST": g
|
|
464
464
|
});
|
|
465
465
|
return y(
|
|
466
466
|
`${a}/api/checkout/pub/orderForm/${l}/attachments/marketingData`,
|
|
467
467
|
{
|
|
468
468
|
headers: m,
|
|
469
|
-
body: JSON.stringify(
|
|
469
|
+
body: JSON.stringify(p),
|
|
470
470
|
method: "POST"
|
|
471
471
|
},
|
|
472
472
|
{ storeCookies: o }
|
|
@@ -474,17 +474,17 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
474
474
|
},
|
|
475
475
|
clientPreferencesData: ({
|
|
476
476
|
id: l,
|
|
477
|
-
clientPreferencesData:
|
|
477
|
+
clientPreferencesData: p
|
|
478
478
|
}) => {
|
|
479
479
|
const m = s({
|
|
480
480
|
"content-type": "application/json",
|
|
481
|
-
"X-FORWARDED-HOST":
|
|
481
|
+
"X-FORWARDED-HOST": g
|
|
482
482
|
});
|
|
483
483
|
return y(
|
|
484
484
|
`${a}/api/checkout/pub/orderForm/${l}/attachments/clientPreferencesData`,
|
|
485
485
|
{
|
|
486
486
|
headers: m,
|
|
487
|
-
body: JSON.stringify(
|
|
487
|
+
body: JSON.stringify(p),
|
|
488
488
|
method: "POST"
|
|
489
489
|
},
|
|
490
490
|
{ storeCookies: o }
|
|
@@ -492,20 +492,20 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
492
492
|
},
|
|
493
493
|
orderForm: ({
|
|
494
494
|
id: l,
|
|
495
|
-
refreshOutdatedData:
|
|
495
|
+
refreshOutdatedData: p = !0,
|
|
496
496
|
channel: m = i.storage.channel,
|
|
497
497
|
preserveSalesChannel: S = !1
|
|
498
498
|
}) => {
|
|
499
|
-
const { salesChannel:
|
|
499
|
+
const { salesChannel: v } = m, w = s({
|
|
500
500
|
"content-type": "application/json",
|
|
501
|
-
"X-FORWARDED-HOST":
|
|
501
|
+
"X-FORWARDED-HOST": g
|
|
502
502
|
}), C = new URLSearchParams();
|
|
503
|
-
(!S || !l) && C.set("sc",
|
|
503
|
+
(!S || !l) && C.set("sc", v), l && C.set("refreshOutdatedData", p.toString());
|
|
504
504
|
const k = l ? `/${l}` : "", I = `${a}/api/checkout/pub/orderForm${k}?${C}`;
|
|
505
505
|
return y(
|
|
506
506
|
I,
|
|
507
507
|
{
|
|
508
|
-
...
|
|
508
|
+
...H,
|
|
509
509
|
headers: w,
|
|
510
510
|
...l ? {} : { body: "{}" }
|
|
511
511
|
},
|
|
@@ -513,40 +513,40 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
513
513
|
);
|
|
514
514
|
},
|
|
515
515
|
clearOrderFormMessages: ({ id: l }) => {
|
|
516
|
-
const
|
|
516
|
+
const p = s({
|
|
517
517
|
"content-type": "application/json",
|
|
518
|
-
"X-FORWARDED-HOST":
|
|
518
|
+
"X-FORWARDED-HOST": g
|
|
519
519
|
});
|
|
520
520
|
return y(
|
|
521
521
|
`${a}/api/checkout/pub/orderForm/${l}/messages/clear`,
|
|
522
522
|
{
|
|
523
|
-
...
|
|
524
|
-
headers:
|
|
523
|
+
...H,
|
|
524
|
+
headers: p,
|
|
525
525
|
body: "{}"
|
|
526
526
|
}
|
|
527
527
|
);
|
|
528
528
|
},
|
|
529
529
|
updateOrderFormItems: ({
|
|
530
530
|
id: l,
|
|
531
|
-
orderItems:
|
|
531
|
+
orderItems: p,
|
|
532
532
|
allowOutdatedData: m = "paymentData",
|
|
533
533
|
salesChannel: S = i.storage.channel.salesChannel,
|
|
534
|
-
shouldSplitItem:
|
|
534
|
+
shouldSplitItem: v = !0
|
|
535
535
|
}) => {
|
|
536
536
|
const w = new URLSearchParams({
|
|
537
537
|
allowOutdatedData: m,
|
|
538
538
|
sc: S
|
|
539
539
|
}), C = s({
|
|
540
540
|
"content-type": "application/json",
|
|
541
|
-
"X-FORWARDED-HOST":
|
|
541
|
+
"X-FORWARDED-HOST": g
|
|
542
542
|
});
|
|
543
543
|
return y(
|
|
544
544
|
`${a}/api/checkout/pub/orderForm/${l}/items?${w}`,
|
|
545
545
|
{
|
|
546
546
|
headers: C,
|
|
547
547
|
body: JSON.stringify({
|
|
548
|
-
orderItems:
|
|
549
|
-
noSplitItem: !
|
|
548
|
+
orderItems: p,
|
|
549
|
+
noSplitItem: !v
|
|
550
550
|
}),
|
|
551
551
|
method: "PATCH"
|
|
552
552
|
},
|
|
@@ -555,18 +555,18 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
555
555
|
},
|
|
556
556
|
setCustomData: ({
|
|
557
557
|
id: l,
|
|
558
|
-
appId:
|
|
558
|
+
appId: p,
|
|
559
559
|
key: m,
|
|
560
560
|
value: S
|
|
561
561
|
}) => {
|
|
562
|
-
const
|
|
562
|
+
const v = s({
|
|
563
563
|
"content-type": "application/json",
|
|
564
|
-
"X-FORWARDED-HOST":
|
|
564
|
+
"X-FORWARDED-HOST": g
|
|
565
565
|
});
|
|
566
566
|
return y(
|
|
567
|
-
`${a}/api/checkout/pub/orderForm/${l}/customData/${
|
|
567
|
+
`${a}/api/checkout/pub/orderForm/${l}/customData/${p}/${m}`,
|
|
568
568
|
{
|
|
569
|
-
headers:
|
|
569
|
+
headers: v,
|
|
570
570
|
body: JSON.stringify({ value: S }),
|
|
571
571
|
method: "PUT"
|
|
572
572
|
}
|
|
@@ -574,21 +574,21 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
574
574
|
},
|
|
575
575
|
region: async ({
|
|
576
576
|
postalCode: l,
|
|
577
|
-
geoCoordinates:
|
|
577
|
+
geoCoordinates: p,
|
|
578
578
|
country: m,
|
|
579
579
|
salesChannel: S
|
|
580
580
|
}) => {
|
|
581
|
-
const
|
|
581
|
+
const v = new URLSearchParams({
|
|
582
582
|
country: m,
|
|
583
583
|
sc: S ?? ""
|
|
584
584
|
});
|
|
585
|
-
l ?
|
|
585
|
+
l ? v.append("postalCode", l) : v.append(
|
|
586
586
|
"geoCoordinates",
|
|
587
|
-
`${
|
|
587
|
+
`${p?.longitude};${p?.latitude}`
|
|
588
588
|
);
|
|
589
|
-
const w = `${a}/api/checkout/pub/regions/?${
|
|
589
|
+
const w = `${a}/api/checkout/pub/regions/?${v.toString()}`, C = s({
|
|
590
590
|
"content-type": "application/json",
|
|
591
|
-
"X-FORWARDED-HOST":
|
|
591
|
+
"X-FORWARDED-HOST": g
|
|
592
592
|
});
|
|
593
593
|
return y(
|
|
594
594
|
w,
|
|
@@ -600,14 +600,14 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
600
600
|
},
|
|
601
601
|
address: async ({
|
|
602
602
|
postalCode: l,
|
|
603
|
-
country:
|
|
603
|
+
country: p
|
|
604
604
|
}) => {
|
|
605
605
|
const m = s({
|
|
606
606
|
"content-type": "application/json",
|
|
607
|
-
"X-FORWARDED-HOST":
|
|
607
|
+
"X-FORWARDED-HOST": g
|
|
608
608
|
});
|
|
609
609
|
return y(
|
|
610
|
-
`${a}/api/checkout/pub/postal-code/${
|
|
610
|
+
`${a}/api/checkout/pub/postal-code/${p}/${l}`,
|
|
611
611
|
{
|
|
612
612
|
headers: m
|
|
613
613
|
},
|
|
@@ -616,12 +616,12 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
616
616
|
},
|
|
617
617
|
cancelOrder: ({
|
|
618
618
|
orderId: l,
|
|
619
|
-
customerEmail:
|
|
619
|
+
customerEmail: p,
|
|
620
620
|
reason: m
|
|
621
621
|
}) => {
|
|
622
622
|
const S = s({
|
|
623
623
|
"content-type": "application/json",
|
|
624
|
-
"X-FORWARDED-HOST":
|
|
624
|
+
"X-FORWARDED-HOST": g
|
|
625
625
|
});
|
|
626
626
|
return y(
|
|
627
627
|
`${a}/api/checkout/pub/orders/${l}/user-cancel-request`,
|
|
@@ -629,7 +629,7 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
629
629
|
method: "POST",
|
|
630
630
|
headers: S,
|
|
631
631
|
body: JSON.stringify({
|
|
632
|
-
customerEmail:
|
|
632
|
+
customerEmail: p,
|
|
633
633
|
reason: m
|
|
634
634
|
})
|
|
635
635
|
},
|
|
@@ -643,15 +643,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
643
643
|
throw new Error(
|
|
644
644
|
"Missing required parameter for listing pickup points."
|
|
645
645
|
);
|
|
646
|
-
const
|
|
646
|
+
const p = s({
|
|
647
647
|
"content-type": "application/json",
|
|
648
|
-
"X-FORWARDED-HOST":
|
|
648
|
+
"X-FORWARDED-HOST": g
|
|
649
649
|
});
|
|
650
650
|
return y(
|
|
651
651
|
`${a}/api/logistics-shipping/pickuppoints/_search`,
|
|
652
652
|
{
|
|
653
653
|
method: "POST",
|
|
654
|
-
headers:
|
|
654
|
+
headers: p,
|
|
655
655
|
body: JSON.stringify({ coordinate: l })
|
|
656
656
|
},
|
|
657
657
|
{ storeCookies: o }
|
|
@@ -659,8 +659,8 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
659
659
|
}
|
|
660
660
|
},
|
|
661
661
|
session: (l) => {
|
|
662
|
-
const
|
|
663
|
-
|
|
662
|
+
const p = new URLSearchParams(l);
|
|
663
|
+
p.set(
|
|
664
664
|
"items",
|
|
665
665
|
"profile.id,profile.email,profile.firstName,profile.lastName,profile.phone,shopper.firstName,shopper.lastName,shopper.organizationManager,shopper.availableContracts,shopper.activeContractId,store.channel,store.countryCode,store.cultureInfo,store.currencyCode,store.currencySymbol,authentication.customerId,authentication.storeUserId,authentication.storeUserEmail,authentication.unitId,authentication.unitName,checkout.regionId,public.postalCode"
|
|
666
666
|
);
|
|
@@ -668,7 +668,7 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
668
668
|
"content-type": "application/json"
|
|
669
669
|
}), S = Q(i?.headers?.cookie ?? "")?.vtex_session;
|
|
670
670
|
return y(
|
|
671
|
-
`${a}/api/sessions?${
|
|
671
|
+
`${a}/api/sessions?${p.toString()}`,
|
|
672
672
|
{
|
|
673
673
|
method: S ? "PATCH" : "POST",
|
|
674
674
|
headers: m,
|
|
@@ -680,7 +680,7 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
680
680
|
subscribeToNewsletter: (l) => y(
|
|
681
681
|
`${a}/api/dataentities/NL/documents/`,
|
|
682
682
|
{
|
|
683
|
-
...
|
|
683
|
+
...H,
|
|
684
684
|
body: JSON.stringify({ ...l, isNewsletterOptIn: !0 }),
|
|
685
685
|
method: "PATCH"
|
|
686
686
|
},
|
|
@@ -688,38 +688,38 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
688
688
|
),
|
|
689
689
|
profile: {
|
|
690
690
|
addresses: async (l) => {
|
|
691
|
-
const
|
|
691
|
+
const p = s({
|
|
692
692
|
"content-type": "application/json",
|
|
693
|
-
"X-FORWARDED-HOST":
|
|
693
|
+
"X-FORWARDED-HOST": g
|
|
694
694
|
});
|
|
695
695
|
return y(
|
|
696
696
|
`${a}/api/profile-system/pvt/profiles/${l}/addresses`,
|
|
697
|
-
{ headers:
|
|
697
|
+
{ headers: p },
|
|
698
698
|
{ storeCookies: o }
|
|
699
699
|
);
|
|
700
700
|
}
|
|
701
701
|
},
|
|
702
702
|
oms: {
|
|
703
703
|
userOrder: ({ orderId: l }) => {
|
|
704
|
-
const
|
|
704
|
+
const p = s({
|
|
705
705
|
"content-type": "application/json",
|
|
706
|
-
"X-FORWARDED-HOST":
|
|
706
|
+
"X-FORWARDED-HOST": g
|
|
707
707
|
});
|
|
708
708
|
return y(
|
|
709
709
|
`${a}/api/oms/user/orders/${l}`,
|
|
710
710
|
{
|
|
711
711
|
method: "GET",
|
|
712
|
-
headers:
|
|
712
|
+
headers: p
|
|
713
713
|
},
|
|
714
714
|
{ storeCookies: o }
|
|
715
715
|
);
|
|
716
716
|
},
|
|
717
717
|
listUserOrders: ({
|
|
718
718
|
page: l,
|
|
719
|
-
status:
|
|
719
|
+
status: p,
|
|
720
720
|
dateInitial: m,
|
|
721
721
|
dateFinal: S,
|
|
722
|
-
text:
|
|
722
|
+
text: v,
|
|
723
723
|
clientEmail: w,
|
|
724
724
|
perPage: C,
|
|
725
725
|
pendingMyApproval: k
|
|
@@ -743,13 +743,13 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
743
743
|
);
|
|
744
744
|
S = new Date(A).toISOString();
|
|
745
745
|
}
|
|
746
|
-
|
|
746
|
+
v && I.append("text", v), p && p.length > 0 && I.append("status", p.filter(Boolean).join(",")), m && S ? I.append(
|
|
747
747
|
"creation_date",
|
|
748
748
|
`creationDate:[${m} TO ${S}]`
|
|
749
749
|
) : m ? I.append("creation_date", `creationDate:[${m} TO *]`) : S && I.append("creation_date", `creationDate:[* TO ${S}]`), w && I.append("clientEmail", w), l && I.append("page", l.toString()), C && I.append("per_page", C.toString()), k && I.append("my_pending_approvals", String(!0));
|
|
750
750
|
const D = s({
|
|
751
751
|
"content-type": "application/json",
|
|
752
|
-
"X-FORWARDED-HOST":
|
|
752
|
+
"X-FORWARDED-HOST": g
|
|
753
753
|
});
|
|
754
754
|
return y(
|
|
755
755
|
`${a}/api/oms/user/orders?${I.toString()}`,
|
|
@@ -763,32 +763,32 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
763
763
|
getCommercialAuthorizationsByOrderId: ({
|
|
764
764
|
orderId: l
|
|
765
765
|
}) => {
|
|
766
|
-
const
|
|
766
|
+
const p = s({
|
|
767
767
|
"content-type": "application/json",
|
|
768
|
-
"X-FORWARDED-HOST":
|
|
768
|
+
"X-FORWARDED-HOST": g
|
|
769
769
|
});
|
|
770
770
|
return y(
|
|
771
771
|
`${a}/${e}/commercial-authorizations/order/${l}`,
|
|
772
772
|
{
|
|
773
773
|
method: "GET",
|
|
774
|
-
headers:
|
|
774
|
+
headers: p
|
|
775
775
|
},
|
|
776
776
|
{ storeCookies: o }
|
|
777
777
|
);
|
|
778
778
|
},
|
|
779
779
|
processOrderAuthorization: async ({
|
|
780
780
|
orderAuthorizationId: l,
|
|
781
|
-
dimensionId:
|
|
781
|
+
dimensionId: p,
|
|
782
782
|
ruleId: m,
|
|
783
783
|
approved: S
|
|
784
784
|
}) => {
|
|
785
|
-
const
|
|
785
|
+
const v = s({
|
|
786
786
|
"content-type": "application/json",
|
|
787
|
-
"X-FORWARDED-HOST":
|
|
787
|
+
"X-FORWARDED-HOST": g
|
|
788
788
|
}), k = {
|
|
789
789
|
params: {
|
|
790
790
|
ruleId: m,
|
|
791
|
-
dimensionId:
|
|
791
|
+
dimensionId: p,
|
|
792
792
|
score: S ? 100 : 0
|
|
793
793
|
}
|
|
794
794
|
};
|
|
@@ -796,7 +796,7 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
796
796
|
`${a}/${e}/commercial-authorizations/${l}/callback`,
|
|
797
797
|
{
|
|
798
798
|
method: "POST",
|
|
799
|
-
headers:
|
|
799
|
+
headers: v,
|
|
800
800
|
body: JSON.stringify(k)
|
|
801
801
|
},
|
|
802
802
|
{ storeCookies: o }
|
|
@@ -807,7 +807,7 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
807
807
|
listCreditCards: () => {
|
|
808
808
|
const l = s({
|
|
809
809
|
"content-type": "application/json",
|
|
810
|
-
"X-FORWARDED-HOST":
|
|
810
|
+
"X-FORWARDED-HOST": g
|
|
811
811
|
});
|
|
812
812
|
return y(
|
|
813
813
|
`${a}/api/saved-cards/credit-card?an=${e}`,
|
|
@@ -823,15 +823,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
823
823
|
getUnitByUserId: ({
|
|
824
824
|
userId: l
|
|
825
825
|
}) => {
|
|
826
|
-
const
|
|
826
|
+
const p = s({
|
|
827
827
|
"content-type": "application/json",
|
|
828
|
-
"X-FORWARDED-HOST":
|
|
828
|
+
"X-FORWARDED-HOST": g
|
|
829
829
|
});
|
|
830
830
|
return y(
|
|
831
831
|
`${a}/api/units/v1/${l}/unit`,
|
|
832
832
|
{
|
|
833
833
|
method: "GET",
|
|
834
|
-
headers:
|
|
834
|
+
headers: p
|
|
835
835
|
},
|
|
836
836
|
{}
|
|
837
837
|
);
|
|
@@ -839,15 +839,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
839
839
|
getOrgUnitById: ({
|
|
840
840
|
orgUnitId: l
|
|
841
841
|
}) => {
|
|
842
|
-
const
|
|
842
|
+
const p = s({
|
|
843
843
|
"content-type": "application/json",
|
|
844
|
-
"X-FORWARDED-HOST":
|
|
844
|
+
"X-FORWARDED-HOST": g
|
|
845
845
|
});
|
|
846
846
|
return y(
|
|
847
847
|
`${a}/api/units/v1/${l}`,
|
|
848
848
|
{
|
|
849
849
|
method: "GET",
|
|
850
|
-
headers:
|
|
850
|
+
headers: p
|
|
851
851
|
},
|
|
852
852
|
{}
|
|
853
853
|
);
|
|
@@ -855,15 +855,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
855
855
|
getScopesByOrgUnit: ({
|
|
856
856
|
orgUnitId: l
|
|
857
857
|
}) => {
|
|
858
|
-
const
|
|
858
|
+
const p = s({
|
|
859
859
|
"content-type": "application/json",
|
|
860
|
-
"X-FORWARDED-HOST":
|
|
860
|
+
"X-FORWARDED-HOST": g
|
|
861
861
|
});
|
|
862
862
|
return y(
|
|
863
863
|
`${a}/api/units/v1/${l}/scopes`,
|
|
864
864
|
{
|
|
865
865
|
method: "GET",
|
|
866
|
-
headers:
|
|
866
|
+
headers: p
|
|
867
867
|
},
|
|
868
868
|
{}
|
|
869
869
|
);
|
|
@@ -873,15 +873,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
873
873
|
getUserById: ({
|
|
874
874
|
userId: l
|
|
875
875
|
}) => {
|
|
876
|
-
const
|
|
876
|
+
const p = s({
|
|
877
877
|
"content-type": "application/json",
|
|
878
|
-
"X-FORWARDED-HOST":
|
|
878
|
+
"X-FORWARDED-HOST": g
|
|
879
879
|
});
|
|
880
880
|
return y(
|
|
881
881
|
`${a}/api/license-manager/users/${l}`,
|
|
882
882
|
{
|
|
883
883
|
method: "GET",
|
|
884
|
-
headers:
|
|
884
|
+
headers: p
|
|
885
885
|
},
|
|
886
886
|
{}
|
|
887
887
|
);
|
|
@@ -889,15 +889,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
889
889
|
getUserByEmail: ({
|
|
890
890
|
email: l
|
|
891
891
|
}) => {
|
|
892
|
-
const
|
|
892
|
+
const p = s({
|
|
893
893
|
"content-type": "application/json",
|
|
894
|
-
"X-FORWARDED-HOST":
|
|
894
|
+
"X-FORWARDED-HOST": g
|
|
895
895
|
});
|
|
896
896
|
return y(
|
|
897
897
|
`${a}/api/license-manager/pvt/users/${l}`,
|
|
898
898
|
{
|
|
899
899
|
method: "GET",
|
|
900
|
-
headers:
|
|
900
|
+
headers: p
|
|
901
901
|
},
|
|
902
902
|
{}
|
|
903
903
|
);
|
|
@@ -905,15 +905,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
905
905
|
getUserRoles: ({
|
|
906
906
|
userId: l
|
|
907
907
|
}) => {
|
|
908
|
-
const
|
|
908
|
+
const p = s({
|
|
909
909
|
"content-type": "application/json",
|
|
910
|
-
"X-FORWARDED-HOST":
|
|
910
|
+
"X-FORWARDED-HOST": g
|
|
911
911
|
});
|
|
912
912
|
return y(
|
|
913
913
|
`${a}/api/license-manager/storefront/users/${l}/roles`,
|
|
914
914
|
{
|
|
915
915
|
method: "GET",
|
|
916
|
-
headers:
|
|
916
|
+
headers: p
|
|
917
917
|
},
|
|
918
918
|
{}
|
|
919
919
|
);
|
|
@@ -926,14 +926,14 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
926
926
|
*/
|
|
927
927
|
isResourceGranted: ({
|
|
928
928
|
userId: l,
|
|
929
|
-
resourceKey:
|
|
929
|
+
resourceKey: p
|
|
930
930
|
}) => {
|
|
931
931
|
const m = s({
|
|
932
932
|
"content-type": "application/json",
|
|
933
|
-
"X-FORWARDED-HOST":
|
|
933
|
+
"X-FORWARDED-HOST": g
|
|
934
934
|
});
|
|
935
935
|
return y(
|
|
936
|
-
`${a}/api/license-manager/storefront/bff/users/${l}/resources/${
|
|
936
|
+
`${a}/api/license-manager/storefront/bff/users/${l}/resources/${p}/granted?an=${e}`,
|
|
937
937
|
{
|
|
938
938
|
method: "GET",
|
|
939
939
|
headers: m
|
|
@@ -947,8 +947,8 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
947
947
|
contractId: l
|
|
948
948
|
}) => {
|
|
949
949
|
if (!l)
|
|
950
|
-
throw new
|
|
951
|
-
const
|
|
950
|
+
throw new E("Missing contractId to fetch CL fields.");
|
|
951
|
+
const p = b({
|
|
952
952
|
Accept: "application/json",
|
|
953
953
|
"content-type": "application/json"
|
|
954
954
|
});
|
|
@@ -956,7 +956,7 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
956
956
|
`${a}/api/dataentities/CL/documents/${l}?_fields=_all`,
|
|
957
957
|
{
|
|
958
958
|
method: "GET",
|
|
959
|
-
headers:
|
|
959
|
+
headers: p
|
|
960
960
|
},
|
|
961
961
|
{}
|
|
962
962
|
);
|
|
@@ -965,17 +965,17 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
965
965
|
userId: l
|
|
966
966
|
}) => {
|
|
967
967
|
if (!l)
|
|
968
|
-
throw new
|
|
969
|
-
const
|
|
968
|
+
throw new E("Missing userId to fetch shopper name.");
|
|
969
|
+
const p = c({
|
|
970
970
|
Accept: "application/json",
|
|
971
971
|
"content-type": "application/json",
|
|
972
|
-
"X-FORWARDED-HOST":
|
|
972
|
+
"X-FORWARDED-HOST": g
|
|
973
973
|
}), m = l.replace(/-/g, "");
|
|
974
974
|
return y(
|
|
975
975
|
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${l})&_fields=_all&_schema=v1`,
|
|
976
976
|
{
|
|
977
977
|
method: "GET",
|
|
978
|
-
headers:
|
|
978
|
+
headers: p
|
|
979
979
|
},
|
|
980
980
|
{}
|
|
981
981
|
);
|
|
@@ -983,13 +983,13 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
983
983
|
},
|
|
984
984
|
quotes: {
|
|
985
985
|
listUserQuotes: (l) => {
|
|
986
|
-
|
|
987
|
-
const
|
|
986
|
+
bt(l);
|
|
987
|
+
const p = Ct(l), m = s({
|
|
988
988
|
"content-type": "application/json",
|
|
989
|
-
"X-FORWARDED-HOST":
|
|
989
|
+
"X-FORWARDED-HOST": g
|
|
990
990
|
});
|
|
991
991
|
return y(
|
|
992
|
-
`${a}/api/quoting/quotes?${
|
|
992
|
+
`${a}/api/quoting/quotes?${p.toString()}`,
|
|
993
993
|
{
|
|
994
994
|
method: "GET",
|
|
995
995
|
headers: m
|
|
@@ -1002,13 +1002,13 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1002
1002
|
validate: () => {
|
|
1003
1003
|
const l = s({
|
|
1004
1004
|
"content-type": "application/json",
|
|
1005
|
-
"X-FORWARDED-HOST":
|
|
1006
|
-
}),
|
|
1005
|
+
"X-FORWARDED-HOST": g
|
|
1006
|
+
}), p = L(me(i) ?? "", e);
|
|
1007
1007
|
return y(
|
|
1008
1008
|
`${a}/api/vtexid/credential/validate`,
|
|
1009
1009
|
{
|
|
1010
1010
|
headers: l,
|
|
1011
|
-
body: JSON.stringify({ token:
|
|
1011
|
+
body: JSON.stringify({ token: p }),
|
|
1012
1012
|
method: "POST"
|
|
1013
1013
|
},
|
|
1014
1014
|
{ storeCookies: o }
|
|
@@ -1018,30 +1018,30 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1018
1018
|
orderEntry: {
|
|
1019
1019
|
uploadFile: ({
|
|
1020
1020
|
fileBuffer: l,
|
|
1021
|
-
fileName:
|
|
1021
|
+
fileName: p,
|
|
1022
1022
|
mimeType: m
|
|
1023
1023
|
}) => {
|
|
1024
1024
|
const S = s({
|
|
1025
1025
|
"content-type": "application/json",
|
|
1026
|
-
"X-FORWARDED-HOST":
|
|
1027
|
-
}),
|
|
1028
|
-
`, k = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", I =
|
|
1029
|
-
`--${
|
|
1026
|
+
"X-FORWARDED-HOST": g
|
|
1027
|
+
}), v = `----FastStoreUploadBoundary${Date.now()}`, w = `\r
|
|
1028
|
+
`, k = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", I = p.replaceAll(/[\r\n"]/g, "_"), D = [
|
|
1029
|
+
`--${v}`,
|
|
1030
1030
|
`Content-Disposition: form-data; name="file"; filename="${I}"`,
|
|
1031
1031
|
`Content-Type: ${k}`,
|
|
1032
1032
|
"",
|
|
1033
1033
|
""
|
|
1034
|
-
].join(w), A = `${w}--${
|
|
1034
|
+
].join(w), A = `${w}--${v}--${w}`, _ = Buffer.from(D), P = Buffer.from(A), R = new Uint8Array(
|
|
1035
1035
|
_.byteLength + l.byteLength + P.byteLength
|
|
1036
1036
|
);
|
|
1037
|
-
let
|
|
1038
|
-
return R.set(_,
|
|
1037
|
+
let O = 0;
|
|
1038
|
+
return R.set(_, O), O += _.byteLength, R.set(l, O), O += l.byteLength, R.set(P, O), y(
|
|
1039
1039
|
`${a}/api/order-entry/upload?an=${e}`,
|
|
1040
1040
|
{
|
|
1041
1041
|
method: "POST",
|
|
1042
1042
|
headers: {
|
|
1043
1043
|
...S,
|
|
1044
|
-
"content-type": `multipart/form-data; boundary=${
|
|
1044
|
+
"content-type": `multipart/form-data; boundary=${v}`
|
|
1045
1045
|
},
|
|
1046
1046
|
body: R.buffer
|
|
1047
1047
|
},
|
|
@@ -1050,15 +1050,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1050
1050
|
},
|
|
1051
1051
|
startOperation: ({
|
|
1052
1052
|
objectKey: l,
|
|
1053
|
-
orderFormId:
|
|
1053
|
+
orderFormId: p,
|
|
1054
1054
|
sessionToken: m
|
|
1055
1055
|
}) => {
|
|
1056
1056
|
const S = s({
|
|
1057
1057
|
"content-type": "application/json",
|
|
1058
|
-
"X-FORWARDED-HOST":
|
|
1059
|
-
}),
|
|
1058
|
+
"X-FORWARDED-HOST": g
|
|
1059
|
+
}), v = JSON.stringify({
|
|
1060
1060
|
objectKey: l,
|
|
1061
|
-
orderFormId:
|
|
1061
|
+
orderFormId: p,
|
|
1062
1062
|
operation: "CreateCart",
|
|
1063
1063
|
...m ? { sessionToken: m } : {}
|
|
1064
1064
|
});
|
|
@@ -1067,7 +1067,7 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1067
1067
|
{
|
|
1068
1068
|
method: "POST",
|
|
1069
1069
|
headers: S,
|
|
1070
|
-
body:
|
|
1070
|
+
body: v
|
|
1071
1071
|
},
|
|
1072
1072
|
{}
|
|
1073
1073
|
);
|
|
@@ -1075,15 +1075,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1075
1075
|
getOperation: ({
|
|
1076
1076
|
operationId: l
|
|
1077
1077
|
}) => {
|
|
1078
|
-
const
|
|
1078
|
+
const p = s({
|
|
1079
1079
|
"content-type": "application/json",
|
|
1080
|
-
"X-FORWARDED-HOST":
|
|
1080
|
+
"X-FORWARDED-HOST": g
|
|
1081
1081
|
});
|
|
1082
1082
|
return y(
|
|
1083
1083
|
`${a}/api/order-entry/operation/${l}?an=${e}`,
|
|
1084
1084
|
{
|
|
1085
1085
|
method: "GET",
|
|
1086
|
-
headers:
|
|
1086
|
+
headers: p
|
|
1087
1087
|
},
|
|
1088
1088
|
{}
|
|
1089
1089
|
);
|
|
@@ -1091,7 +1091,7 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1091
1091
|
createOrderForm: () => {
|
|
1092
1092
|
const l = s({
|
|
1093
1093
|
"content-type": "application/json",
|
|
1094
|
-
"X-FORWARDED-HOST":
|
|
1094
|
+
"X-FORWARDED-HOST": g
|
|
1095
1095
|
});
|
|
1096
1096
|
return y(
|
|
1097
1097
|
`${a}/api/checkout/pub/orderForm?sc=${i.storage.channel.salesChannel}`,
|
|
@@ -1106,15 +1106,15 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1106
1106
|
getOrderFormItems: ({
|
|
1107
1107
|
orderFormId: l
|
|
1108
1108
|
}) => {
|
|
1109
|
-
const
|
|
1109
|
+
const p = s({
|
|
1110
1110
|
"content-type": "application/json",
|
|
1111
|
-
"X-FORWARDED-HOST":
|
|
1111
|
+
"X-FORWARDED-HOST": g
|
|
1112
1112
|
});
|
|
1113
1113
|
return y(
|
|
1114
1114
|
`${a}/api/checkout/pub/orderForm/${l}`,
|
|
1115
1115
|
{
|
|
1116
1116
|
method: "GET",
|
|
1117
|
-
headers:
|
|
1117
|
+
headers: p
|
|
1118
1118
|
},
|
|
1119
1119
|
{}
|
|
1120
1120
|
);
|
|
@@ -1127,13 +1127,13 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1127
1127
|
recommendation: {
|
|
1128
1128
|
recommendations: ({
|
|
1129
1129
|
campaignVrn: l,
|
|
1130
|
-
userId:
|
|
1130
|
+
userId: p,
|
|
1131
1131
|
products: m = [],
|
|
1132
1132
|
salesChannel: S,
|
|
1133
|
-
locale:
|
|
1133
|
+
locale: v
|
|
1134
1134
|
}) => {
|
|
1135
1135
|
const w = new URLSearchParams({ an: e, campaignVrn: l });
|
|
1136
|
-
return
|
|
1136
|
+
return p && w.append("userId", p), m.length > 0 && w.append("products", m.join(",")), S && w.append("salesChannel", S), v && w.append("locale", v), y(
|
|
1137
1137
|
`${f}/recommendations?${w.toString()}`,
|
|
1138
1138
|
{ headers: h },
|
|
1139
1139
|
{ storeCookies: o }
|
|
@@ -1149,23 +1149,23 @@ const bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1149
1149
|
}
|
|
1150
1150
|
}
|
|
1151
1151
|
};
|
|
1152
|
-
}, K = (e) => e.discoveryConfig?.localization ?? {},
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
me,
|
|
1152
|
+
}, K = (e) => e.discoveryConfig?.localization ?? {}, q = (e) => K(e).enabled === !0, Dt = (e) => Object.keys(K(e).locales ?? {}), At = (e) => K(e).defaultLocale, pn = (e) => q(e) && e.storage.locale || void 0, he = "fuzzy", fe = "operator", Se = "pickupPoint", Ue = "shipping", Re = "delivery-options", Pt = "in-stock", _t = "trade-policy", kt = "region-id", Et = /* @__PURE__ */ new Set([
|
|
1153
|
+
_t,
|
|
1154
|
+
kt,
|
|
1156
1155
|
he,
|
|
1157
|
-
fe
|
|
1158
|
-
|
|
1156
|
+
fe,
|
|
1157
|
+
Se
|
|
1158
|
+
]), Tt = /* @__PURE__ */ new Set([
|
|
1159
1159
|
"zip-code",
|
|
1160
1160
|
"pickupPoint",
|
|
1161
1161
|
"country",
|
|
1162
1162
|
"coordinates",
|
|
1163
1163
|
"deliveryZonesHash",
|
|
1164
1164
|
"pickupPointsHash"
|
|
1165
|
-
]),
|
|
1165
|
+
]), Fe = (e) => encodeURI(decodeURI(e)), Ut = (e) => encodeURIComponent(
|
|
1166
1166
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
1167
|
-
),
|
|
1168
|
-
function
|
|
1167
|
+
), Rt = /^pickup-in-point-(.+)$/;
|
|
1168
|
+
function gn(e) {
|
|
1169
1169
|
if (!e)
|
|
1170
1170
|
return {};
|
|
1171
1171
|
try {
|
|
@@ -1178,18 +1178,18 @@ function un(e) {
|
|
|
1178
1178
|
return {};
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
|
-
function
|
|
1181
|
+
function Ft(e) {
|
|
1182
1182
|
const n = {}, t = [];
|
|
1183
1183
|
for (const r of e.split(";")) {
|
|
1184
1184
|
const i = r.indexOf("=");
|
|
1185
1185
|
if (i < 0) continue;
|
|
1186
1186
|
const a = r.slice(0, i), o = r.slice(i + 1);
|
|
1187
|
-
!a || !o || (
|
|
1187
|
+
!a || !o || (Tt.has(a) ? n[a] = o : t.push({ key: a, value: o }));
|
|
1188
1188
|
}
|
|
1189
1189
|
return { shipping: n, extraFacets: t };
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1192
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } =
|
|
1191
|
+
function Nt(e) {
|
|
1192
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } = Ft(n);
|
|
1193
1193
|
return {
|
|
1194
1194
|
segmentParams: {
|
|
1195
1195
|
sc: e.channel,
|
|
@@ -1210,7 +1210,7 @@ function Rt(e) {
|
|
|
1210
1210
|
extraFacets: r
|
|
1211
1211
|
};
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1213
|
+
function mn(e, n) {
|
|
1214
1214
|
const t = [
|
|
1215
1215
|
["sc", n.sc],
|
|
1216
1216
|
["regionId", n.regionId],
|
|
@@ -1230,11 +1230,11 @@ function pn(e, n) {
|
|
|
1230
1230
|
for (const [r, i] of t)
|
|
1231
1231
|
i != null && i !== "" && e.append(r, String(i));
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1234
|
-
return
|
|
1233
|
+
function hn(e) {
|
|
1234
|
+
return Rt.exec(e)?.[1];
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1237
|
-
const n = e.find((r) => r.key === "shipping"), t = n ?
|
|
1236
|
+
function Lt(e) {
|
|
1237
|
+
const n = e.find((r) => r.key === "shipping"), t = n ? hn(n.value) : void 0;
|
|
1238
1238
|
if (t !== void 0)
|
|
1239
1239
|
try {
|
|
1240
1240
|
return decodeURIComponent(t);
|
|
@@ -1242,8 +1242,8 @@ function Ft(e) {
|
|
|
1242
1242
|
return t;
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
|
-
function
|
|
1246
|
-
const t =
|
|
1245
|
+
function Bt(e, n) {
|
|
1246
|
+
const t = Lt(
|
|
1247
1247
|
n
|
|
1248
1248
|
);
|
|
1249
1249
|
return t === void 0 ? e : {
|
|
@@ -1251,25 +1251,25 @@ function Nt(e, n) {
|
|
|
1251
1251
|
pickupPoint: t
|
|
1252
1252
|
};
|
|
1253
1253
|
}
|
|
1254
|
-
function
|
|
1255
|
-
return e.map((n) => n.key !== "shipping" ||
|
|
1254
|
+
function $t(e) {
|
|
1255
|
+
return e.map((n) => n.key !== "shipping" || hn(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1256
1256
|
}
|
|
1257
|
-
function
|
|
1257
|
+
function Mt(e, n) {
|
|
1258
1258
|
let t = [...e];
|
|
1259
1259
|
const r = t.some((i) => i.key === "shipping");
|
|
1260
1260
|
for (const i of n)
|
|
1261
1261
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1262
|
-
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")),
|
|
1262
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), $t(t);
|
|
1263
1263
|
}
|
|
1264
|
-
function
|
|
1264
|
+
function zt(e) {
|
|
1265
1265
|
return e.reduce((n, t) => {
|
|
1266
1266
|
let { key: r, value: i } = t;
|
|
1267
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${
|
|
1267
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Fe(r)}/${Ut(Fe(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1268
1268
|
}, "");
|
|
1269
1269
|
}
|
|
1270
|
-
const
|
|
1271
|
-
function
|
|
1272
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1270
|
+
const Vt = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), xt = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1271
|
+
function qt(e, n) {
|
|
1272
|
+
const { segmentParams: t, extraFacets: r } = Nt(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
|
|
1273
1273
|
return {
|
|
1274
1274
|
segmentParams: {
|
|
1275
1275
|
...t,
|
|
@@ -1280,61 +1280,61 @@ function Vt(e, n) {
|
|
|
1280
1280
|
extraFacets: r
|
|
1281
1281
|
};
|
|
1282
1282
|
}
|
|
1283
|
-
function
|
|
1284
|
-
const t = e.filter(({ key: c }) => !
|
|
1285
|
-
({ key: c, value:
|
|
1283
|
+
function jt(e, n) {
|
|
1284
|
+
const t = e.filter(({ key: c }) => !Et.has(c)), r = e.find(
|
|
1285
|
+
({ key: c, value: u }) => c === Ue && u !== "all-delivery-methods"
|
|
1286
1286
|
) ?? null, i = e.find(
|
|
1287
|
-
({ key: c, value:
|
|
1287
|
+
({ key: c, value: u }) => c === Re && u !== "all-delivery-options"
|
|
1288
1288
|
) ?? null, a = [...t], o = a.some(
|
|
1289
|
-
({ key: c }) => c === Ee
|
|
1290
|
-
), s = a.some(
|
|
1291
1289
|
({ key: c }) => c === Ue
|
|
1290
|
+
), s = a.some(
|
|
1291
|
+
({ key: c }) => c === Re
|
|
1292
1292
|
);
|
|
1293
|
-
return r !== null && !o && a.push(r), i !== null && !s && a.push(i),
|
|
1293
|
+
return r !== null && !o && a.push(r), i !== null && !s && a.push(i), Mt(a, n);
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1296
|
-
const t = e.find(({ key: a }) => a ===
|
|
1297
|
-
t &&
|
|
1295
|
+
function Wt(e, n) {
|
|
1296
|
+
const t = e.find(({ key: a }) => a === he) ?? null, r = e.find(({ key: a }) => a === fe) ?? null, i = e.find(({ key: a }) => a === Se) ?? null;
|
|
1297
|
+
t && Vt(t) && n.append(he, t.value), r && xt(r) && n.append(fe, r.value), i && n.append(Se, i.value);
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
1299
|
+
function Ne(e, n, t, r) {
|
|
1300
1300
|
const {
|
|
1301
1301
|
query: i = "",
|
|
1302
1302
|
page: a,
|
|
1303
1303
|
count: o,
|
|
1304
1304
|
sort: s,
|
|
1305
1305
|
selectedFacets: c = [],
|
|
1306
|
-
showInvisibleItems:
|
|
1307
|
-
sponsoredCount:
|
|
1308
|
-
hideUnavailableItems:
|
|
1306
|
+
showInvisibleItems: u,
|
|
1307
|
+
sponsoredCount: d,
|
|
1308
|
+
hideUnavailableItems: g,
|
|
1309
1309
|
allowRedirect: f = !1
|
|
1310
1310
|
} = e, h = new URLSearchParams();
|
|
1311
1311
|
if (r.includePagination && a !== void 0 && o !== void 0) {
|
|
1312
|
-
const
|
|
1313
|
-
h.append("from",
|
|
1312
|
+
const p = a * o, m = o === 0 ? p : p + o - 1;
|
|
1313
|
+
h.append("from", p.toString()), h.append("to", m.toString());
|
|
1314
1314
|
}
|
|
1315
1315
|
i && h.append("query", i), r.includeSort && s && h.append("sort", s);
|
|
1316
|
-
const
|
|
1316
|
+
const b = Bt(
|
|
1317
1317
|
t.segmentParams,
|
|
1318
1318
|
c
|
|
1319
1319
|
);
|
|
1320
|
-
if (
|
|
1321
|
-
const
|
|
1320
|
+
if (mn(h, b ?? t.segmentParams), Wt(c, h), u && h.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1321
|
+
const p = c.find(({ key: S }) => S === Pt), m = p ? p.value : g?.toString() ?? n.hideUnavailableItems.toString();
|
|
1322
1322
|
h.append("hideUnavailableItems", m);
|
|
1323
1323
|
}
|
|
1324
|
-
n?.simulationBehavior !== void 0 && h.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && h.append("showSponsored", n.showSponsored.toString()),
|
|
1325
|
-
const l =
|
|
1326
|
-
|
|
1324
|
+
n?.simulationBehavior !== void 0 && h.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && h.append("showSponsored", n.showSponsored.toString()), d !== void 0 && h.append("sponsoredCount", d.toString()), f !== void 0 && h.append("allowRedirect", f.toString());
|
|
1325
|
+
const l = zt(
|
|
1326
|
+
jt(c, t.extraFacets)
|
|
1327
1327
|
);
|
|
1328
1328
|
return { params: h, path: l };
|
|
1329
1329
|
}
|
|
1330
|
-
function
|
|
1330
|
+
function Ht(e, n) {
|
|
1331
1331
|
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: a } = e, o = new URLSearchParams({
|
|
1332
1332
|
field: t ?? "",
|
|
1333
1333
|
value: r ?? ""
|
|
1334
1334
|
});
|
|
1335
|
-
return
|
|
1335
|
+
return mn(o, n), i && o.append("hideUnavailableItems", "true"), a && o.append("show-invisible-items", "true"), o;
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function G(e, n) {
|
|
1338
1338
|
return {
|
|
1339
1339
|
path: e,
|
|
1340
1340
|
params: n,
|
|
@@ -1344,44 +1344,44 @@ function H(e, n) {
|
|
|
1344
1344
|
}
|
|
1345
1345
|
};
|
|
1346
1346
|
}
|
|
1347
|
-
function
|
|
1348
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a =
|
|
1347
|
+
function X(e) {
|
|
1348
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a = qt(t, r);
|
|
1349
1349
|
switch (n) {
|
|
1350
1350
|
case "product-search":
|
|
1351
1351
|
case "facets": {
|
|
1352
|
-
const { params: o, path: s } =
|
|
1352
|
+
const { params: o, path: s } = Ne(
|
|
1353
1353
|
i,
|
|
1354
1354
|
r,
|
|
1355
1355
|
a,
|
|
1356
1356
|
{ includePagination: !0, includeSort: !0 }
|
|
1357
1357
|
);
|
|
1358
|
-
return
|
|
1358
|
+
return G(s, o);
|
|
1359
1359
|
}
|
|
1360
1360
|
case "catalog-count": {
|
|
1361
|
-
const { params: o, path: s } =
|
|
1361
|
+
const { params: o, path: s } = Ne(
|
|
1362
1362
|
i,
|
|
1363
1363
|
r,
|
|
1364
1364
|
a,
|
|
1365
1365
|
{ includePagination: !1, includeSort: !1 }
|
|
1366
1366
|
);
|
|
1367
|
-
return
|
|
1367
|
+
return G(s, o);
|
|
1368
1368
|
}
|
|
1369
1369
|
case "products": {
|
|
1370
|
-
const o =
|
|
1371
|
-
return
|
|
1370
|
+
const o = Ht(i, a.segmentParams);
|
|
1371
|
+
return G("", o);
|
|
1372
1372
|
}
|
|
1373
1373
|
case "search-suggestions": {
|
|
1374
1374
|
const o = new URLSearchParams({
|
|
1375
1375
|
query: i.query?.toString() ?? "",
|
|
1376
1376
|
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1377
1377
|
});
|
|
1378
|
-
return
|
|
1378
|
+
return G("", o);
|
|
1379
1379
|
}
|
|
1380
1380
|
case "top-searches": {
|
|
1381
1381
|
const o = new URLSearchParams({
|
|
1382
1382
|
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1383
1383
|
});
|
|
1384
|
-
return
|
|
1384
|
+
return G("", o);
|
|
1385
1385
|
}
|
|
1386
1386
|
default: {
|
|
1387
1387
|
const o = n;
|
|
@@ -1389,16 +1389,16 @@ function G(e) {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
|
-
const
|
|
1393
|
-
function
|
|
1392
|
+
const Gt = 10;
|
|
1393
|
+
function Xt(e) {
|
|
1394
1394
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1395
1395
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1396
1396
|
}
|
|
1397
|
-
function
|
|
1398
|
-
const t =
|
|
1399
|
-
return
|
|
1397
|
+
function Yt(e) {
|
|
1398
|
+
const t = gn(e.headers?.cookie).cultureInfo || "";
|
|
1399
|
+
return q(e) ? e.storage.locale || t : t || e.storage.locale || "";
|
|
1400
1400
|
}
|
|
1401
|
-
const
|
|
1401
|
+
const Jt = ({
|
|
1402
1402
|
account: e,
|
|
1403
1403
|
environment: n,
|
|
1404
1404
|
hideUnavailableItems: t,
|
|
@@ -1406,37 +1406,37 @@ const Xt = ({
|
|
|
1406
1406
|
showSponsored: i,
|
|
1407
1407
|
subDomainPrefix: a
|
|
1408
1408
|
}, o) => {
|
|
1409
|
-
const s = `https://${e}.${n}.com.br`, c =
|
|
1409
|
+
const s = `https://${e}.${n}.com.br`, c = un(o), u = gn(o.headers?.cookie), d = () => ({
|
|
1410
1410
|
salesChannel: o.storage.channel.salesChannel,
|
|
1411
|
-
regionId:
|
|
1412
|
-
locale:
|
|
1411
|
+
regionId: Xt(o),
|
|
1412
|
+
locale: Yt(o),
|
|
1413
1413
|
hideUnavailableItems: t,
|
|
1414
1414
|
simulationBehavior: r,
|
|
1415
1415
|
showSponsored: i
|
|
1416
|
-
}),
|
|
1416
|
+
}), g = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "", f = a && a.map((I) => I + ".").find((I) => g.includes(I)) || "", h = g.replace(f, ""), b = c({
|
|
1417
1417
|
"content-type": "application/json",
|
|
1418
1418
|
"X-FORWARDED-HOST": h
|
|
1419
1419
|
}), l = ({ type: I, ...D }) => {
|
|
1420
|
-
const A = I === "facets" ? "facets" : "product-search", _ =
|
|
1420
|
+
const A = I === "facets" ? "facets" : "product-search", _ = X({
|
|
1421
1421
|
endpoint: A,
|
|
1422
|
-
segment:
|
|
1423
|
-
defaults:
|
|
1422
|
+
segment: u,
|
|
1423
|
+
defaults: d(),
|
|
1424
1424
|
args: D
|
|
1425
1425
|
});
|
|
1426
1426
|
return y(
|
|
1427
1427
|
`${s}/api/intelligent-search/v1/${A}/${_.path}?${_.params.toString()}`,
|
|
1428
|
-
{ headers:
|
|
1428
|
+
{ headers: b }
|
|
1429
1429
|
);
|
|
1430
|
-
},
|
|
1430
|
+
}, p = (I) => l({ ...I, type: "product_search" }), m = ({
|
|
1431
1431
|
field: I,
|
|
1432
1432
|
value: D,
|
|
1433
1433
|
hideUnavailableItems: A,
|
|
1434
1434
|
showInvisibleItems: _
|
|
1435
1435
|
}) => {
|
|
1436
|
-
const P =
|
|
1436
|
+
const P = X({
|
|
1437
1437
|
endpoint: "products",
|
|
1438
|
-
segment:
|
|
1439
|
-
defaults:
|
|
1438
|
+
segment: u,
|
|
1439
|
+
defaults: d(),
|
|
1440
1440
|
args: {
|
|
1441
1441
|
field: I,
|
|
1442
1442
|
value: D,
|
|
@@ -1446,12 +1446,12 @@ const Xt = ({
|
|
|
1446
1446
|
});
|
|
1447
1447
|
return y(
|
|
1448
1448
|
`${s}/api/intelligent-search/v1/products?${P.params.toString()}`,
|
|
1449
|
-
{ headers:
|
|
1449
|
+
{ headers: b }
|
|
1450
1450
|
);
|
|
1451
1451
|
};
|
|
1452
1452
|
return {
|
|
1453
1453
|
facets: (I) => l({ ...I, type: "facets" }),
|
|
1454
|
-
products:
|
|
1454
|
+
products: p,
|
|
1455
1455
|
fetchProduct: m,
|
|
1456
1456
|
productsByIdentifier: async ({
|
|
1457
1457
|
field: I,
|
|
@@ -1459,14 +1459,14 @@ const Xt = ({
|
|
|
1459
1459
|
showInvisibleItems: A,
|
|
1460
1460
|
hideUnavailableItems: _
|
|
1461
1461
|
}) => {
|
|
1462
|
-
const P =
|
|
1462
|
+
const P = De(Gt);
|
|
1463
1463
|
return (await Promise.all(
|
|
1464
1464
|
D.map(
|
|
1465
|
-
(
|
|
1465
|
+
(O) => P(async () => {
|
|
1466
1466
|
try {
|
|
1467
1467
|
return await m({
|
|
1468
1468
|
field: I,
|
|
1469
|
-
value:
|
|
1469
|
+
value: O,
|
|
1470
1470
|
hideUnavailableItems: _,
|
|
1471
1471
|
showInvisibleItems: A
|
|
1472
1472
|
});
|
|
@@ -1476,54 +1476,54 @@ const Xt = ({
|
|
|
1476
1476
|
})
|
|
1477
1477
|
)
|
|
1478
1478
|
)).filter(
|
|
1479
|
-
(
|
|
1479
|
+
(O) => O !== null
|
|
1480
1480
|
);
|
|
1481
1481
|
},
|
|
1482
1482
|
suggestedTerms: (I) => {
|
|
1483
|
-
const D =
|
|
1483
|
+
const D = X({
|
|
1484
1484
|
endpoint: "search-suggestions",
|
|
1485
|
-
segment:
|
|
1486
|
-
defaults:
|
|
1485
|
+
segment: u,
|
|
1486
|
+
defaults: d(),
|
|
1487
1487
|
args: { query: I.query }
|
|
1488
1488
|
});
|
|
1489
1489
|
return y(
|
|
1490
1490
|
`${s}/api/intelligent-search/v1/search-suggestions?${D.params.toString()}`,
|
|
1491
|
-
{ headers:
|
|
1491
|
+
{ headers: b }
|
|
1492
1492
|
);
|
|
1493
1493
|
},
|
|
1494
1494
|
topSearches: () => {
|
|
1495
|
-
const I =
|
|
1495
|
+
const I = X({
|
|
1496
1496
|
endpoint: "top-searches",
|
|
1497
|
-
segment:
|
|
1498
|
-
defaults:
|
|
1497
|
+
segment: u,
|
|
1498
|
+
defaults: d()
|
|
1499
1499
|
});
|
|
1500
1500
|
return y(
|
|
1501
1501
|
`${s}/api/intelligent-search/v1/top-searches?${I.params.toString()}`,
|
|
1502
|
-
{ headers:
|
|
1502
|
+
{ headers: b }
|
|
1503
1503
|
);
|
|
1504
1504
|
},
|
|
1505
1505
|
productCount: (I) => {
|
|
1506
|
-
const D =
|
|
1506
|
+
const D = X({
|
|
1507
1507
|
endpoint: "catalog-count",
|
|
1508
|
-
segment:
|
|
1509
|
-
defaults:
|
|
1508
|
+
segment: u,
|
|
1509
|
+
defaults: d(),
|
|
1510
1510
|
args: I
|
|
1511
1511
|
});
|
|
1512
1512
|
return y(
|
|
1513
1513
|
`${s}/api/intelligent-search/v1/catalog-count/${D.path}?${D.params.toString()}`,
|
|
1514
|
-
{ headers:
|
|
1514
|
+
{ headers: b }
|
|
1515
1515
|
);
|
|
1516
1516
|
}
|
|
1517
1517
|
};
|
|
1518
|
-
},
|
|
1519
|
-
const t =
|
|
1518
|
+
}, Kt = (e, n) => {
|
|
1519
|
+
const t = Jt(e, n), r = wt(e, n), i = pt(e);
|
|
1520
1520
|
return {
|
|
1521
1521
|
search: t,
|
|
1522
1522
|
commerce: r,
|
|
1523
1523
|
catalog: i
|
|
1524
1524
|
};
|
|
1525
|
-
},
|
|
1526
|
-
const t =
|
|
1525
|
+
}, Qt = 20, Zt = (e) => e.entityType === "category", ye = (e) => e.entityType === "brand", Le = (e) => e.entityType === "collection", er = (e, n) => {
|
|
1526
|
+
const t = De(Qt), r = async (i) => Promise.all(
|
|
1527
1527
|
i.map(
|
|
1528
1528
|
(a) => t(async () => {
|
|
1529
1529
|
const o = a.slug.toLowerCase(), s = a.locale, c = await n.commerce.catalog.byLinkId.category(
|
|
@@ -1536,18 +1536,18 @@ const Xt = ({
|
|
|
1536
1536
|
entityType: "category",
|
|
1537
1537
|
slug: o
|
|
1538
1538
|
};
|
|
1539
|
-
const
|
|
1539
|
+
const u = await n.commerce.catalog.byLinkId.brand(
|
|
1540
1540
|
o,
|
|
1541
1541
|
s
|
|
1542
1542
|
);
|
|
1543
|
-
if (
|
|
1544
|
-
return { ...
|
|
1545
|
-
const
|
|
1543
|
+
if (u)
|
|
1544
|
+
return { ...u, entityType: "brand" };
|
|
1545
|
+
const d = await n.commerce.catalog.byLinkId.collection(
|
|
1546
1546
|
o,
|
|
1547
1547
|
s
|
|
1548
1548
|
);
|
|
1549
|
-
if (
|
|
1550
|
-
return { ...
|
|
1549
|
+
if (d)
|
|
1550
|
+
return { ...d, entityType: "collection" };
|
|
1551
1551
|
throw new $(
|
|
1552
1552
|
`No catalog entity found for slug: ${a.slug}. Cascade exhausted (category → brand → collection).`
|
|
1553
1553
|
);
|
|
@@ -1561,47 +1561,47 @@ const Xt = ({
|
|
|
1561
1561
|
// entry while same-slug / different-locale loads stay isolated.
|
|
1562
1562
|
cacheKeyFn: ({ slug: i, locale: a }) => `${i.toLowerCase()}::${a ?? ""}`
|
|
1563
1563
|
});
|
|
1564
|
-
},
|
|
1564
|
+
}, nr = (e, n) => {
|
|
1565
1565
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1566
1566
|
return new ue(t);
|
|
1567
|
-
},
|
|
1568
|
-
const t =
|
|
1569
|
-
const o = a.reduce((
|
|
1567
|
+
}, tr = 1, rr = (e, n) => {
|
|
1568
|
+
const t = De(tr), r = async (a) => {
|
|
1569
|
+
const o = a.reduce((g, { items: f }) => [...g, f], []), s = [...o.flat()], c = await n.commerce.checkout.simulation({
|
|
1570
1570
|
country: a[0].country,
|
|
1571
1571
|
postalCode: a[0].postalCode,
|
|
1572
1572
|
items: s
|
|
1573
|
-
}),
|
|
1574
|
-
(
|
|
1573
|
+
}), u = c.items.reduce(
|
|
1574
|
+
(g, f) => {
|
|
1575
1575
|
const h = f.requestIndex;
|
|
1576
|
-
return typeof h == "number" && h <
|
|
1576
|
+
return typeof h == "number" && h < g.length && (g[h] = f), g;
|
|
1577
1577
|
},
|
|
1578
1578
|
Array(s.length).fill(null)
|
|
1579
|
-
),
|
|
1580
|
-
(
|
|
1579
|
+
), d = o.reduce(
|
|
1580
|
+
(g, f) => [...g, f.length + g[g.length - 1]],
|
|
1581
1581
|
[0]
|
|
1582
1582
|
);
|
|
1583
|
-
return o.map((
|
|
1583
|
+
return o.map((g, f) => ({
|
|
1584
1584
|
...c,
|
|
1585
|
-
items:
|
|
1585
|
+
items: u.slice(d[f], d[f + 1]).filter((h) => !!h)
|
|
1586
1586
|
}));
|
|
1587
1587
|
}, i = async (a) => t(r, a);
|
|
1588
1588
|
return new ue(i, {
|
|
1589
1589
|
maxBatchSize: 50
|
|
1590
1590
|
});
|
|
1591
|
-
},
|
|
1592
|
-
function
|
|
1591
|
+
}, ir = (e, n) => Wn(e, n);
|
|
1592
|
+
function ar(e) {
|
|
1593
1593
|
return {
|
|
1594
1594
|
...e,
|
|
1595
|
-
description: e.description ?
|
|
1595
|
+
description: e.description ? ir(e.description) : e.description
|
|
1596
1596
|
};
|
|
1597
1597
|
}
|
|
1598
1598
|
const F = (e, n) => ({
|
|
1599
1599
|
...e,
|
|
1600
|
-
isVariantOf:
|
|
1601
|
-
}),
|
|
1600
|
+
isVariantOf: ar(n)
|
|
1601
|
+
}), or = ({ flags: e }, n) => {
|
|
1602
1602
|
const t = async (r) => {
|
|
1603
|
-
const i = r.map((
|
|
1604
|
-
(
|
|
1603
|
+
const i = r.map((d) => d.split("-")[0]), a = r.some(
|
|
1604
|
+
(d) => d.split("-")[1] === "invisibleItems"
|
|
1605
1605
|
), s = (await n.search.productsByIdentifier({
|
|
1606
1606
|
field: "sku",
|
|
1607
1607
|
values: i,
|
|
@@ -1610,16 +1610,16 @@ const F = (e, n) => ({
|
|
|
1610
1610
|
hideUnavailableItems: !1
|
|
1611
1611
|
}
|
|
1612
1612
|
})).reduce(
|
|
1613
|
-
(
|
|
1614
|
-
for (const f of
|
|
1615
|
-
|
|
1616
|
-
return
|
|
1613
|
+
(d, g) => {
|
|
1614
|
+
for (const f of g.items)
|
|
1615
|
+
d[f.itemId] = F(f, g);
|
|
1616
|
+
return d;
|
|
1617
1617
|
},
|
|
1618
1618
|
{}
|
|
1619
|
-
), c = i.map((
|
|
1620
|
-
if (
|
|
1619
|
+
), c = i.map((d) => s[d]), u = i.filter((d) => !s[d]);
|
|
1620
|
+
if (u.length > 0)
|
|
1621
1621
|
throw new $(
|
|
1622
|
-
`Search API did not found the following skus: ${
|
|
1622
|
+
`Search API did not found the following skus: ${u.join(",")}`
|
|
1623
1623
|
);
|
|
1624
1624
|
return c;
|
|
1625
1625
|
};
|
|
@@ -1627,27 +1627,27 @@ const F = (e, n) => ({
|
|
|
1627
1627
|
maxBatchSize: 99
|
|
1628
1628
|
// Max allowed batch size of Search API
|
|
1629
1629
|
});
|
|
1630
|
-
},
|
|
1631
|
-
const { clients: t } = n, r =
|
|
1630
|
+
}, sr = (e, n) => {
|
|
1631
|
+
const { clients: t } = n, r = or(e, t), i = rr(e, t), a = er(e, t), o = nr(e, t);
|
|
1632
1632
|
return {
|
|
1633
1633
|
skuLoader: r,
|
|
1634
1634
|
simulationLoader: i,
|
|
1635
1635
|
collectionLoader: a,
|
|
1636
1636
|
salesChannelLoader: o
|
|
1637
1637
|
};
|
|
1638
|
-
}, B = (e) => e.AvailableQuantity > 0,
|
|
1638
|
+
}, B = (e) => e.AvailableQuantity > 0, j = (e) => e.spotPrice ?? 0, cr = (e) => e.Price ?? 0, Be = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", fn = (e, n) => B(e) && !B(n) ? -1 : !B(e) && B(n) ? 1 : j(e) - j(n), lr = (e) => e === "available", x = (e, n = 0, t = 1) => {
|
|
1639
1639
|
const r = n / t;
|
|
1640
1640
|
return Math.round((e + r) * 100) / 100;
|
|
1641
|
-
},
|
|
1642
|
-
const t = e.filter(B), r = t[t.length - 1], i = r ?
|
|
1643
|
-
return n.includeTaxes ?
|
|
1644
|
-
},
|
|
1645
|
-
const [t] = e.filter(B), r = t ?
|
|
1646
|
-
return n.includeTaxes ?
|
|
1647
|
-
},
|
|
1648
|
-
highPrice: (e) =>
|
|
1649
|
-
lowPrice: (e) =>
|
|
1650
|
-
lowPriceWithTaxes: (e) =>
|
|
1641
|
+
}, dr = (e, n = { includeTaxes: !1 }) => {
|
|
1642
|
+
const t = e.filter(B), r = t[t.length - 1], i = r ? j(r) : 0;
|
|
1643
|
+
return n.includeTaxes ? x(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1644
|
+
}, $e = (e, n = { includeTaxes: !1 }) => {
|
|
1645
|
+
const [t] = e.filter(B), r = t ? j(t) : 0;
|
|
1646
|
+
return n.includeTaxes ? x(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1647
|
+
}, ur = {
|
|
1648
|
+
highPrice: (e) => dr(e),
|
|
1649
|
+
lowPrice: (e) => $e(e),
|
|
1650
|
+
lowPriceWithTaxes: (e) => $e(e, { includeTaxes: !0 }),
|
|
1651
1651
|
offerCount: (e) => e.length,
|
|
1652
1652
|
priceCurrency: async (e, n, t) => {
|
|
1653
1653
|
const {
|
|
@@ -1657,22 +1657,34 @@ const F = (e, n) => ({
|
|
|
1657
1657
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1658
1658
|
},
|
|
1659
1659
|
offers: (e) => e
|
|
1660
|
-
},
|
|
1660
|
+
}, pr = {
|
|
1661
1661
|
ratingValue: () => 5,
|
|
1662
1662
|
reviewCount: () => 0
|
|
1663
|
-
},
|
|
1663
|
+
}, Me = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", gr = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", mr = (e) => {
|
|
1664
1664
|
let n = e.slice(0);
|
|
1665
|
-
for (let t = 0; t <
|
|
1666
|
-
n = n.replace(new RegExp(
|
|
1665
|
+
for (let t = 0; t < Me.length; t++)
|
|
1666
|
+
n = n.replace(new RegExp(Me.charAt(t), "g"), gr.charAt(t));
|
|
1667
1667
|
return n;
|
|
1668
|
-
},
|
|
1668
|
+
}, hr = (e) => e.replace(/[·/_,:]/, "-");
|
|
1669
1669
|
function se(e) {
|
|
1670
1670
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1671
|
-
return
|
|
1671
|
+
return hr(mr(t)).toLowerCase();
|
|
1672
1672
|
}
|
|
1673
|
-
const
|
|
1673
|
+
const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
1674
|
+
const t = n.split("/").filter(Boolean), {
|
|
1675
|
+
loaders: { collectionLoader: r }
|
|
1676
|
+
} = e;
|
|
1677
|
+
return Promise.all(
|
|
1678
|
+
t.map(
|
|
1679
|
+
(i, a) => r.load({
|
|
1680
|
+
slug: t.slice(0, a + 1).join("/"),
|
|
1681
|
+
locale: pn(e)
|
|
1682
|
+
})
|
|
1683
|
+
)
|
|
1684
|
+
);
|
|
1685
|
+
}, M = (e) => Zt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? se(e.name), Sn = {
|
|
1674
1686
|
id: ({ id: e }) => e.toString(),
|
|
1675
|
-
slug: (e) =>
|
|
1687
|
+
slug: (e) => M(e),
|
|
1676
1688
|
seo: (e) => ({
|
|
1677
1689
|
title: e.title ?? e.name,
|
|
1678
1690
|
// pagetype.metaTagDescription and catalog `description` share the same
|
|
@@ -1680,46 +1692,30 @@ const X = (e) => Kt(e) ? e.slug : Se(e) ? e.linkId : e.linkId ?? se(e.name), hn
|
|
|
1680
1692
|
// for forward-compat; fall back to description for by-linkid parity.
|
|
1681
1693
|
description: e.metaTagDescription ?? e.description
|
|
1682
1694
|
}),
|
|
1683
|
-
type: (e) =>
|
|
1695
|
+
type: (e) => ye(e) ? "Brand" : Le(e) ? "Collection" : e.fatherCategoryId === null ? "Department" : "Category",
|
|
1684
1696
|
meta: async (e, n, t) => {
|
|
1685
|
-
const r =
|
|
1686
|
-
if (
|
|
1697
|
+
const r = M(e);
|
|
1698
|
+
if (ye(e))
|
|
1687
1699
|
return { selectedFacets: [{ key: "brand", value: r }] };
|
|
1688
|
-
if (
|
|
1700
|
+
if (Le(e))
|
|
1689
1701
|
return { selectedFacets: [{ key: "productclusterids", value: e.id }] };
|
|
1690
|
-
const { defaultLocale: i } = K(t)
|
|
1691
|
-
(d, u) => a.slice(0, u + 1).join("/")
|
|
1692
|
-
), {
|
|
1693
|
-
loaders: { collectionLoader: s }
|
|
1694
|
-
} = t;
|
|
1702
|
+
const { defaultLocale: i } = K(t);
|
|
1695
1703
|
return {
|
|
1696
|
-
selectedFacets: (await
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
)
|
|
1700
|
-
)).map((d, u) => ({
|
|
1701
|
-
key: `category-${u + 1}`,
|
|
1702
|
-
value: i && d.availableLinkIds?.[i] || d.linkId
|
|
1704
|
+
selectedFacets: (await re(t, r)).map((o, s) => ({
|
|
1705
|
+
key: `category-${s + 1}`,
|
|
1706
|
+
value: i && o.availableLinkIds?.[i] || o.linkId
|
|
1703
1707
|
}))
|
|
1704
1708
|
};
|
|
1705
1709
|
},
|
|
1706
1710
|
breadcrumbList: async (e, n, t) => {
|
|
1707
|
-
const
|
|
1708
|
-
loaders: { collectionLoader: r }
|
|
1709
|
-
} = t, a = X(e).split("/").filter(Boolean), o = a.map(
|
|
1710
|
-
(c, d) => a.slice(0, d + 1).join("/")
|
|
1711
|
-
), s = await Promise.all(
|
|
1712
|
-
o.map(
|
|
1713
|
-
(c) => r.load({ slug: c, locale: ie(t) })
|
|
1714
|
-
)
|
|
1715
|
-
);
|
|
1711
|
+
const r = await re(t, M(e));
|
|
1716
1712
|
return {
|
|
1717
|
-
itemListElement:
|
|
1718
|
-
item: `/${
|
|
1719
|
-
name:
|
|
1720
|
-
position:
|
|
1713
|
+
itemListElement: r.map((i, a) => ({
|
|
1714
|
+
item: `/${M(i)}`,
|
|
1715
|
+
name: i.name,
|
|
1716
|
+
position: a + 1
|
|
1721
1717
|
})),
|
|
1722
|
-
numberOfItems:
|
|
1718
|
+
numberOfItems: r.length
|
|
1723
1719
|
};
|
|
1724
1720
|
},
|
|
1725
1721
|
otherLocales: async (e, n, t) => {
|
|
@@ -1727,43 +1723,47 @@ const X = (e) => Kt(e) ? e.slug : Se(e) ? e.linkId : e.linkId ?? se(e.name), hn
|
|
|
1727
1723
|
if (!r.enabled) return null;
|
|
1728
1724
|
const i = Object.keys(r.locales ?? {});
|
|
1729
1725
|
if (i.length === 0) return null;
|
|
1730
|
-
const a =
|
|
1731
|
-
if (
|
|
1732
|
-
|
|
1733
|
-
loaders: { collectionLoader: c }
|
|
1734
|
-
} = t, d = s.map(
|
|
1735
|
-
(p, f) => s.slice(0, f + 1).join("/")
|
|
1736
|
-
);
|
|
1737
|
-
let u;
|
|
1726
|
+
const a = M(e);
|
|
1727
|
+
if (a.split("/").filter(Boolean).length === 0) return null;
|
|
1728
|
+
let o;
|
|
1738
1729
|
try {
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
)
|
|
1743
|
-
);
|
|
1744
|
-
} catch (p) {
|
|
1745
|
-
return console.warn("[otherLocales] failed to load collection entities:", p), null;
|
|
1730
|
+
o = await re(t, a);
|
|
1731
|
+
} catch (s) {
|
|
1732
|
+
return console.warn("[otherLocales] failed to load collection entities:", s), null;
|
|
1746
1733
|
}
|
|
1747
|
-
return i.map((
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
if (!v) return null;
|
|
1754
|
-
f.push(v);
|
|
1734
|
+
return i.map((s) => {
|
|
1735
|
+
const c = [];
|
|
1736
|
+
for (const u of o) {
|
|
1737
|
+
const d = u.availableLinkIds?.[s];
|
|
1738
|
+
if (!d) return null;
|
|
1739
|
+
c.push(d);
|
|
1755
1740
|
}
|
|
1756
|
-
return
|
|
1757
|
-
|
|
1741
|
+
return c.length > 0 ? {
|
|
1742
|
+
locale: s,
|
|
1743
|
+
slug: ge(c.join("/"))
|
|
1744
|
+
} : null;
|
|
1745
|
+
}).filter((s) => s !== null);
|
|
1746
|
+
},
|
|
1747
|
+
canonicalSlug: async (e, n, t) => {
|
|
1748
|
+
const r = M(e);
|
|
1749
|
+
if (r.split("/").filter(Boolean).length === 0) return null;
|
|
1750
|
+
let i;
|
|
1751
|
+
try {
|
|
1752
|
+
i = await re(t, r);
|
|
1753
|
+
} catch (o) {
|
|
1754
|
+
return console.warn("[canonicalSlug] failed to load collection entities:", o), null;
|
|
1755
|
+
}
|
|
1756
|
+
const a = i.map((o) => o.linkId);
|
|
1757
|
+
return a.every((o) => !!o) ? ge(a.join("/")) : ge(r);
|
|
1758
1758
|
}
|
|
1759
|
-
},
|
|
1759
|
+
}, yn = {
|
|
1760
1760
|
buy: "whoboughtalsobought",
|
|
1761
1761
|
view: "whosawalsosaw",
|
|
1762
1762
|
similars: "similars",
|
|
1763
1763
|
viewAndBought: "whosawalsobought",
|
|
1764
1764
|
accessories: "accessories",
|
|
1765
1765
|
suggestions: "suggestions"
|
|
1766
|
-
},
|
|
1766
|
+
}, ze = ({ key: e, value: n }) => {
|
|
1767
1767
|
switch (e) {
|
|
1768
1768
|
case "price":
|
|
1769
1769
|
return { key: e, value: n.replace("-to-", ":") };
|
|
@@ -1779,61 +1779,61 @@ const X = (e) => Kt(e) ? e.slug : Se(e) ? e.linkId : e.linkId ?? se(e.name), hn
|
|
|
1779
1779
|
default:
|
|
1780
1780
|
return { key: e, value: n };
|
|
1781
1781
|
}
|
|
1782
|
-
},
|
|
1782
|
+
}, Ve = (e) => {
|
|
1783
1783
|
const n = e.split(":").map(Number);
|
|
1784
1784
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1785
|
-
},
|
|
1785
|
+
}, fr = (e) => typeof yn[e] == "string", Sr = (e) => {
|
|
1786
1786
|
const n = e?.filter(
|
|
1787
|
-
(t) =>
|
|
1787
|
+
(t) => fr(t.key)
|
|
1788
1788
|
);
|
|
1789
1789
|
if (Array.isArray(n) && n.length > 1)
|
|
1790
|
-
throw new
|
|
1790
|
+
throw new E(
|
|
1791
1791
|
`You passed ${n.length} cross selling facets but only one is allowed. Please leave one of the following facet: ${n.map((t) => t.key).join(",")}`
|
|
1792
1792
|
);
|
|
1793
1793
|
return n?.[0] ?? null;
|
|
1794
|
-
},
|
|
1794
|
+
}, yr = (e) => e?.find((n) => n.key === "slug")?.value ?? null, Ir = (e) => e?.find((n) => n.key === "id")?.value ?? null, xe = (e) => e?.find((n) => n.key === "locale")?.value ?? null, qe = (e) => e?.find((n) => n.key === "channel")?.value ?? null, Ie = (e, n) => {
|
|
1795
1795
|
let t = 0;
|
|
1796
1796
|
for (let r = 1; r < e.length; r++)
|
|
1797
1797
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1798
1798
|
return e[t];
|
|
1799
|
-
},
|
|
1799
|
+
}, vr = {
|
|
1800
1800
|
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1801
|
-
},
|
|
1801
|
+
}, Or = {
|
|
1802
1802
|
key: ({ key: e }) => e,
|
|
1803
1803
|
label: ({ name: e }) => e,
|
|
1804
1804
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1805
|
-
},
|
|
1805
|
+
}, br = {
|
|
1806
1806
|
key: ({ key: e }) => e,
|
|
1807
1807
|
label: ({ name: e }) => e,
|
|
1808
1808
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1809
|
-
const i =
|
|
1809
|
+
const i = Ve(
|
|
1810
1810
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1811
|
-
), o =
|
|
1811
|
+
), o = Ie(e, (s, c) => s.range.from - c.range.from)?.range?.from ?? 0;
|
|
1812
1812
|
return {
|
|
1813
1813
|
selected: i?.[0] ?? o,
|
|
1814
1814
|
absolute: o
|
|
1815
1815
|
};
|
|
1816
1816
|
},
|
|
1817
1817
|
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1818
|
-
const i =
|
|
1818
|
+
const i = Ve(
|
|
1819
1819
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1820
|
-
), o =
|
|
1820
|
+
), o = Ie(e, (s, c) => c.range.to - s.range.to)?.range?.to ?? 0;
|
|
1821
1821
|
return {
|
|
1822
1822
|
selected: i?.[1] ?? o,
|
|
1823
1823
|
absolute: o
|
|
1824
1824
|
};
|
|
1825
1825
|
}
|
|
1826
|
-
},
|
|
1826
|
+
}, Cr = {
|
|
1827
1827
|
value: ({ value: e }) => e,
|
|
1828
1828
|
label: ({ name: e }) => e || "unknown",
|
|
1829
1829
|
selected: ({ selected: e }) => e,
|
|
1830
1830
|
quantity: ({ quantity: e }) => e
|
|
1831
|
-
},
|
|
1831
|
+
}, wr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1832
1832
|
if (!n?.orderId)
|
|
1833
|
-
throw new
|
|
1833
|
+
throw new E("Missing orderId");
|
|
1834
1834
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1835
1835
|
};
|
|
1836
|
-
function
|
|
1836
|
+
function In(e) {
|
|
1837
1837
|
if (!e || e.status !== "pending")
|
|
1838
1838
|
return null;
|
|
1839
1839
|
for (const n of e.dimensionStatus) {
|
|
@@ -1851,48 +1851,48 @@ function Sn(e) {
|
|
|
1851
1851
|
}
|
|
1852
1852
|
return null;
|
|
1853
1853
|
}
|
|
1854
|
-
function
|
|
1854
|
+
function Dr(e) {
|
|
1855
1855
|
if (!e || e.status !== "pending") return !1;
|
|
1856
1856
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1857
1857
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1858
1858
|
}
|
|
1859
|
-
const
|
|
1860
|
-
const r = await t.oms.processOrderAuthorization(n), i =
|
|
1859
|
+
const Ar = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1860
|
+
const r = await t.oms.processOrderAuthorization(n), i = In(r);
|
|
1861
1861
|
return {
|
|
1862
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1862
|
+
isPendingForOtherAuthorizer: !i && Dr(r),
|
|
1863
1863
|
ruleForAuthorization: i
|
|
1864
1864
|
};
|
|
1865
|
-
},
|
|
1865
|
+
}, Pr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1866
1866
|
if (!n?.objectKey)
|
|
1867
|
-
throw new
|
|
1867
|
+
throw new E("Missing objectKey");
|
|
1868
1868
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
1869
1869
|
return t.orderEntry.startOperation({
|
|
1870
1870
|
objectKey: n.objectKey,
|
|
1871
1871
|
orderFormId: r,
|
|
1872
1872
|
sessionToken: n.sessionToken ?? void 0
|
|
1873
1873
|
});
|
|
1874
|
-
},
|
|
1874
|
+
}, _r = async (e, n, t) => {
|
|
1875
1875
|
if (!(await t.clients.commerce.recommendation.startRecommendationSession())?.recommendationsUserId)
|
|
1876
1876
|
throw new Error(
|
|
1877
1877
|
"Failed to start recommendation session: no session data returned"
|
|
1878
1878
|
);
|
|
1879
1879
|
return !0;
|
|
1880
|
-
},
|
|
1880
|
+
}, kr = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), Er = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1881
1881
|
const { fileContent: r, fileName: i, mimeType: a } = n;
|
|
1882
1882
|
if (!r || !i || !a)
|
|
1883
|
-
throw new
|
|
1883
|
+
throw new E(
|
|
1884
1884
|
"Missing required fields: fileContent, fileName, mimeType"
|
|
1885
1885
|
);
|
|
1886
1886
|
const o = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
|
|
1887
1887
|
if (Math.floor(o.length * 3 / 4) > s)
|
|
1888
|
-
throw new
|
|
1888
|
+
throw new E("File exceeds maximum allowed size of 5MB");
|
|
1889
1889
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
|
|
1890
1890
|
o
|
|
1891
1891
|
))
|
|
1892
|
-
throw new
|
|
1893
|
-
const
|
|
1892
|
+
throw new E("Invalid Base64 fileContent");
|
|
1893
|
+
const d = Buffer.from(o, "base64");
|
|
1894
1894
|
return await t.orderEntry.uploadFile({
|
|
1895
|
-
fileBuffer:
|
|
1895
|
+
fileBuffer: d,
|
|
1896
1896
|
fileName: i,
|
|
1897
1897
|
mimeType: a
|
|
1898
1898
|
});
|
|
@@ -1915,7 +1915,7 @@ class ee {
|
|
|
1915
1915
|
return JSON.stringify(n);
|
|
1916
1916
|
}
|
|
1917
1917
|
}
|
|
1918
|
-
function
|
|
1918
|
+
function Tr(e, n) {
|
|
1919
1919
|
return n == null || n === "" || String(n) === String(e.salesChannel ?? "") ? null : ee.stringify({
|
|
1920
1920
|
...e,
|
|
1921
1921
|
salesChannel: String(n),
|
|
@@ -1924,21 +1924,21 @@ function kr(e, n) {
|
|
|
1924
1924
|
}
|
|
1925
1925
|
const ce = (e, n) => {
|
|
1926
1926
|
e.storage.channel = ee.parse(n);
|
|
1927
|
-
},
|
|
1927
|
+
}, ve = (e, n) => {
|
|
1928
1928
|
e.storage.locale = n;
|
|
1929
|
-
},
|
|
1929
|
+
}, vn = (e) => Hn.createHash("md5").update(e).digest("hex"), ne = {
|
|
1930
1930
|
attachment: "ATTACHMENT",
|
|
1931
1931
|
specification: "SPECIFICATION",
|
|
1932
1932
|
attribute: "ATTRIBUTE"
|
|
1933
1933
|
};
|
|
1934
|
-
function
|
|
1934
|
+
function On(e) {
|
|
1935
1935
|
return {
|
|
1936
1936
|
name: e.name,
|
|
1937
1937
|
value: e.content,
|
|
1938
1938
|
valueReference: ne.attachment
|
|
1939
1939
|
};
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function Ur(e) {
|
|
1942
1942
|
return {
|
|
1943
1943
|
propertyID: e.id,
|
|
1944
1944
|
name: e.name,
|
|
@@ -1949,12 +1949,12 @@ function Tr(e) {
|
|
|
1949
1949
|
}
|
|
1950
1950
|
};
|
|
1951
1951
|
}
|
|
1952
|
-
function
|
|
1953
|
-
return
|
|
1952
|
+
function bn(e) {
|
|
1953
|
+
return vn(
|
|
1954
1954
|
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
1955
1955
|
);
|
|
1956
1956
|
}
|
|
1957
|
-
const
|
|
1957
|
+
const Rr = (e) => {
|
|
1958
1958
|
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
1959
1959
|
addressType: e.addressType || null,
|
|
1960
1960
|
postalCode: n || null,
|
|
@@ -1973,7 +1973,7 @@ const Er = (e) => {
|
|
|
1973
1973
|
r.geoCoordinates = i !== null && a !== null ? [a, i] : [];
|
|
1974
1974
|
}
|
|
1975
1975
|
return [r];
|
|
1976
|
-
},
|
|
1976
|
+
}, Fr = (e, n, t) => {
|
|
1977
1977
|
const r = n.postalCode, i = n.geoCoordinates, a = e?.shippingData?.availableAddresses ?? [], o = e?.shippingData?.selectedAddresses ?? [];
|
|
1978
1978
|
if (!t && o.length > 0)
|
|
1979
1979
|
return [o[0]];
|
|
@@ -1987,31 +1987,31 @@ const Er = (e) => {
|
|
|
1987
1987
|
return [s];
|
|
1988
1988
|
}
|
|
1989
1989
|
return null;
|
|
1990
|
-
},
|
|
1991
|
-
if (!
|
|
1990
|
+
}, Cn = (e, n) => {
|
|
1991
|
+
if (!Nr(n))
|
|
1992
1992
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1993
|
-
if (!
|
|
1993
|
+
if (!Mr(e))
|
|
1994
1994
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1995
1995
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
1996
|
-
if (
|
|
1996
|
+
if (Lr(t, n.postalCode) || Br(t, n.geoCoordinates) || $r(t, n.addressType))
|
|
1997
1997
|
return { updateShipping: !0, addressChanged: !0 };
|
|
1998
1998
|
const { logisticsInfo: r } = e.shippingData;
|
|
1999
|
-
return
|
|
2000
|
-
},
|
|
1999
|
+
return zr(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
2000
|
+
}, Nr = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, Lr = (e, n) => typeof n == "string" && e?.postalCode !== n, Br = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), $r = (e, n) => typeof n == "string" && e?.addressType !== n, Mr = (e) => e.items.length !== 0, zr = (e, n) => {
|
|
2001
2001
|
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
|
|
2002
2002
|
return e.some(
|
|
2003
2003
|
({ selectedDeliveryChannel: o, selectedSla: s, slas: c }) => {
|
|
2004
|
-
const
|
|
2005
|
-
return c?.some((
|
|
2004
|
+
const u = t && o !== t, d = r && s !== r;
|
|
2005
|
+
return c?.some((g) => u && g.deliveryChannel === t || d && g.id === r ? !0 : i && a && g.deliveryChannel === t && g.id === r && (!g?.deliveryWindow || g?.deliveryWindow?.startDateUtc !== i || g?.deliveryWindow?.endDateUtc !== a) && g.availableDeliveryWindows?.some(
|
|
2006
2006
|
(f) => f?.startDateUtc === i && f?.endDateUtc === a
|
|
2007
2007
|
));
|
|
2008
2008
|
}
|
|
2009
2009
|
);
|
|
2010
|
-
},
|
|
2010
|
+
}, wn = (e) => e.valueReference === ne.attachment, Oe = (e) => [
|
|
2011
2011
|
e.itemOffered.sku,
|
|
2012
2012
|
e.seller.identifier,
|
|
2013
2013
|
e.price < 0.01 ? "Gift" : void 0,
|
|
2014
|
-
e.itemOffered.additionalProperty?.filter(
|
|
2014
|
+
e.itemOffered.additionalProperty?.filter(wn).map(bn).join("-")
|
|
2015
2015
|
].filter(Boolean).join("::"), le = (e, n) => ({
|
|
2016
2016
|
listPrice: e.listPrice / 100,
|
|
2017
2017
|
price: e.sellingPrice / 100,
|
|
@@ -2021,46 +2021,46 @@ const Er = (e) => {
|
|
|
2021
2021
|
sku: e.id,
|
|
2022
2022
|
image: [],
|
|
2023
2023
|
name: e.name,
|
|
2024
|
-
additionalProperty: e.attachments.map(
|
|
2024
|
+
additionalProperty: e.attachments.map(On)
|
|
2025
2025
|
},
|
|
2026
2026
|
index: n
|
|
2027
|
-
}),
|
|
2027
|
+
}), Vr = (e) => ({
|
|
2028
2028
|
quantity: e.quantity,
|
|
2029
2029
|
seller: e.seller.identifier,
|
|
2030
2030
|
id: e.itemOffered.sku,
|
|
2031
2031
|
index: e.index,
|
|
2032
|
-
attachments: (e.itemOffered.additionalProperty?.filter(
|
|
2032
|
+
attachments: (e.itemOffered.additionalProperty?.filter(wn) ?? []).map((n) => ({
|
|
2033
2033
|
name: n.name,
|
|
2034
2034
|
content: n.value
|
|
2035
2035
|
})),
|
|
2036
2036
|
...e.priceToken ? { priceToken: e.priceToken } : {}
|
|
2037
|
-
}),
|
|
2038
|
-
const r =
|
|
2037
|
+
}), je = (e) => e.reduce((n, t) => {
|
|
2038
|
+
const r = Oe(t);
|
|
2039
2039
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
2040
|
-
}, /* @__PURE__ */ new Map()),
|
|
2041
|
-
const t = ({ priceToken: s, ...c },
|
|
2040
|
+
}, /* @__PURE__ */ new Map()), xr = (e, n) => {
|
|
2041
|
+
const t = ({ priceToken: s, ...c }, u) => ({
|
|
2042
2042
|
...c,
|
|
2043
2043
|
itemOffered: {
|
|
2044
2044
|
sku: c.itemOffered.sku
|
|
2045
2045
|
},
|
|
2046
|
-
index:
|
|
2047
|
-
}), r = n.items.map(le).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o =
|
|
2046
|
+
index: u
|
|
2047
|
+
}), r = n.items.map(le).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = Ae(r, i);
|
|
2048
2048
|
return a && o;
|
|
2049
2049
|
};
|
|
2050
|
-
function
|
|
2050
|
+
function Dn(e, n) {
|
|
2051
2051
|
return e?.some(
|
|
2052
2052
|
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 && e[t.parentItemIndex]?.id === n
|
|
2053
2053
|
);
|
|
2054
2054
|
}
|
|
2055
|
-
function
|
|
2055
|
+
function An(e, n) {
|
|
2056
2056
|
return e?.some(
|
|
2057
2057
|
(t) => t.id === n && t.parentItemIndex !== null
|
|
2058
2058
|
);
|
|
2059
2059
|
}
|
|
2060
|
-
const
|
|
2060
|
+
const We = (e) => {
|
|
2061
2061
|
const n = e.items.reduce(
|
|
2062
2062
|
(t, r, i) => {
|
|
2063
|
-
const a =
|
|
2063
|
+
const a = An(e.items, r.id) || Dn(e.items, r.id) ? `${Oe(le(r))}::${i}` : Oe(le(r));
|
|
2064
2064
|
return t[a] || (t[a] = []), t[a].push(r), t;
|
|
2065
2065
|
},
|
|
2066
2066
|
{}
|
|
@@ -2079,7 +2079,7 @@ const je = (e) => {
|
|
|
2079
2079
|
};
|
|
2080
2080
|
})
|
|
2081
2081
|
};
|
|
2082
|
-
},
|
|
2082
|
+
}, be = async (e, n, t, r) => ({
|
|
2083
2083
|
order: {
|
|
2084
2084
|
orderNumber: e.orderFormId,
|
|
2085
2085
|
acceptedOffer: e.items.map(async (i) => ({
|
|
@@ -2093,7 +2093,7 @@ const je = (e) => {
|
|
|
2093
2093
|
text: i,
|
|
2094
2094
|
status: a.toUpperCase()
|
|
2095
2095
|
}))
|
|
2096
|
-
}),
|
|
2096
|
+
}), Pn = ({ items: e }, n) => {
|
|
2097
2097
|
const t = e.map((r) => ({
|
|
2098
2098
|
id: r.id,
|
|
2099
2099
|
quantity: r.quantity,
|
|
@@ -2101,16 +2101,16 @@ const je = (e) => {
|
|
|
2101
2101
|
attachments: r.attachments
|
|
2102
2102
|
// customizations
|
|
2103
2103
|
}));
|
|
2104
|
-
return
|
|
2104
|
+
return vn(
|
|
2105
2105
|
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
2106
2106
|
);
|
|
2107
|
-
},
|
|
2107
|
+
}, He = async (e, n, t) => {
|
|
2108
2108
|
try {
|
|
2109
2109
|
return await n.checkout.setCustomData({
|
|
2110
2110
|
id: e.orderFormId,
|
|
2111
2111
|
appId: "faststore",
|
|
2112
2112
|
key: "cartEtag",
|
|
2113
|
-
value:
|
|
2113
|
+
value: Pn(e, t)
|
|
2114
2114
|
});
|
|
2115
2115
|
} catch (r) {
|
|
2116
2116
|
throw console.error(
|
|
@@ -2120,22 +2120,22 @@ const je = (e) => {
|
|
|
2120
2120
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
2121
2121
|
), r;
|
|
2122
2122
|
}
|
|
2123
|
-
},
|
|
2123
|
+
}, qr = (e, n) => {
|
|
2124
2124
|
const r = e.customData?.customApps.find(
|
|
2125
2125
|
(a) => a.id === "faststore"
|
|
2126
2126
|
)?.fields?.cartEtag;
|
|
2127
|
-
return r == null ? !0 :
|
|
2128
|
-
},
|
|
2127
|
+
return r == null ? !0 : Pn(e, n) !== r;
|
|
2128
|
+
}, jr = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
2129
2129
|
id: e
|
|
2130
|
-
}),
|
|
2130
|
+
}), Ge = async (e, n, { clients: { commerce: t } }) => {
|
|
2131
2131
|
if (!n)
|
|
2132
2132
|
return e;
|
|
2133
|
-
const { updateShipping: r, addressChanged: i } =
|
|
2133
|
+
const { updateShipping: r, addressChanged: i } = Cn(
|
|
2134
2134
|
e,
|
|
2135
2135
|
n
|
|
2136
2136
|
);
|
|
2137
2137
|
if (r) {
|
|
2138
|
-
const a =
|
|
2138
|
+
const a = Fr(e, n, i), s = a || Rr(n);
|
|
2139
2139
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
2140
2140
|
{
|
|
2141
2141
|
id: e.orderFormId,
|
|
@@ -2155,128 +2155,128 @@ const je = (e) => {
|
|
|
2155
2155
|
);
|
|
2156
2156
|
}
|
|
2157
2157
|
return e;
|
|
2158
|
-
},
|
|
2158
|
+
}, Wr = (e, n) => {
|
|
2159
2159
|
if (!e)
|
|
2160
2160
|
return "";
|
|
2161
2161
|
const r = Q(e)[n];
|
|
2162
2162
|
return r ? r.split("=")[1] : "";
|
|
2163
|
-
},
|
|
2164
|
-
const t =
|
|
2163
|
+
}, Xe = (e, n) => {
|
|
2164
|
+
const t = Tr(
|
|
2165
2165
|
e.storage.channel,
|
|
2166
2166
|
n.salesChannel
|
|
2167
2167
|
);
|
|
2168
2168
|
return t ? (ce(e, t), n.salesChannel ? String(n.salesChannel) : null) : null;
|
|
2169
|
-
},
|
|
2170
|
-
const i =
|
|
2169
|
+
}, Ye = (e, n, t, r) => r ? be(e, n, t, r) : null, Hr = async (e, { cart: { order: n }, session: t }, r) => {
|
|
2170
|
+
const i = Wr(
|
|
2171
2171
|
r.headers.cookie,
|
|
2172
2172
|
"checkout.vtex.com"
|
|
2173
2173
|
), {
|
|
2174
2174
|
clients: { commerce: a },
|
|
2175
2175
|
loaders: { skuLoader: o }
|
|
2176
2176
|
} = r, s = t?.channel, c = t?.locale;
|
|
2177
|
-
s && ce(r, s), c &&
|
|
2178
|
-
const
|
|
2179
|
-
id:
|
|
2177
|
+
s && ce(r, s), c && ve(r, c);
|
|
2178
|
+
const u = i || void 0, d = await a.checkout.orderForm({
|
|
2179
|
+
id: u,
|
|
2180
2180
|
channel: r.storage.channel,
|
|
2181
|
-
preserveSalesChannel: !!
|
|
2182
|
-
}),
|
|
2183
|
-
|
|
2184
|
-
const f = Q(r?.headers?.cookie ?? "")?.vtex_session, h =
|
|
2185
|
-
if (
|
|
2186
|
-
const
|
|
2181
|
+
preserveSalesChannel: !!u
|
|
2182
|
+
}), g = d.orderFormId;
|
|
2183
|
+
d.messages.length !== 0 && await jr(g, r);
|
|
2184
|
+
const f = Q(r?.headers?.cookie ?? "")?.vtex_session, h = V(f), { acceptedOffer: b, shouldSplitItem: l } = n;
|
|
2185
|
+
if (qr(d, h)) {
|
|
2186
|
+
const O = Xe(
|
|
2187
2187
|
r,
|
|
2188
|
-
|
|
2189
|
-
), N = await
|
|
2190
|
-
|
|
2188
|
+
d
|
|
2189
|
+
), N = await He(
|
|
2190
|
+
d,
|
|
2191
2191
|
a,
|
|
2192
2192
|
h
|
|
2193
|
-
).then(
|
|
2194
|
-
if (
|
|
2195
|
-
return
|
|
2193
|
+
).then(We);
|
|
2194
|
+
if (g)
|
|
2195
|
+
return be(
|
|
2196
2196
|
N,
|
|
2197
2197
|
o,
|
|
2198
2198
|
l,
|
|
2199
|
-
|
|
2199
|
+
O
|
|
2200
2200
|
);
|
|
2201
2201
|
}
|
|
2202
|
-
const m =
|
|
2202
|
+
const m = Xe(
|
|
2203
2203
|
r,
|
|
2204
|
-
|
|
2205
|
-
), S =
|
|
2206
|
-
(
|
|
2207
|
-
const
|
|
2208
|
-
if (!
|
|
2209
|
-
return
|
|
2210
|
-
const [te, ...
|
|
2211
|
-
if (
|
|
2212
|
-
return
|
|
2213
|
-
const
|
|
2214
|
-
return
|
|
2204
|
+
d
|
|
2205
|
+
), S = je(b), v = je(d.items.map(le)), w = Array.from(v.entries()), C = Array.from(S.entries()), { itemsToAdd: k, itemsToUpdate: I } = C.reduce(
|
|
2206
|
+
(O, [N, Pe]) => {
|
|
2207
|
+
const _e = v.get(N);
|
|
2208
|
+
if (!_e)
|
|
2209
|
+
return Pe.forEach((W) => O.itemsToAdd.push(W)), O;
|
|
2210
|
+
const [te, ...Fn] = _e;
|
|
2211
|
+
if (An(d.items, te.itemOffered.sku) || Dn(d.items, te.itemOffered.sku))
|
|
2212
|
+
return O.itemsToUpdate.push(te), O;
|
|
2213
|
+
const Nn = Pe.reduce((W, Ln) => W + Ln.quantity, 0);
|
|
2214
|
+
return O.itemsToUpdate.push({
|
|
2215
2215
|
...te,
|
|
2216
|
-
quantity:
|
|
2217
|
-
}),
|
|
2216
|
+
quantity: Nn
|
|
2217
|
+
}), Fn.forEach((W) => O.itemsToUpdate.push({ ...W, quantity: 0 })), O;
|
|
2218
2218
|
},
|
|
2219
2219
|
{
|
|
2220
2220
|
itemsToAdd: [],
|
|
2221
2221
|
itemsToUpdate: []
|
|
2222
2222
|
}
|
|
2223
|
-
), D = w.filter(([
|
|
2224
|
-
|
|
2225
|
-
), { updateShipping: _ } = t ?
|
|
2223
|
+
), D = w.filter(([O]) => !S.has(O)).flatMap(([, O]) => O.map((N) => ({ ...N, quantity: 0 }))), A = [...k, ...I, ...D].map(
|
|
2224
|
+
Vr
|
|
2225
|
+
), { updateShipping: _ } = t ? Cn(d, t) : { updateShipping: !1 };
|
|
2226
2226
|
if (A.length === 0 && !_)
|
|
2227
|
-
return
|
|
2228
|
-
|
|
2227
|
+
return Ye(
|
|
2228
|
+
d,
|
|
2229
2229
|
o,
|
|
2230
2230
|
l,
|
|
2231
2231
|
m
|
|
2232
2232
|
);
|
|
2233
2233
|
let P;
|
|
2234
2234
|
A.length > 0 ? P = await a.checkout.updateOrderFormItems({
|
|
2235
|
-
id:
|
|
2235
|
+
id: d.orderFormId,
|
|
2236
2236
|
orderItems: A,
|
|
2237
2237
|
shouldSplitItem: l
|
|
2238
2238
|
}).then(
|
|
2239
|
-
(
|
|
2240
|
-
) : P = await
|
|
2241
|
-
|
|
2239
|
+
(O) => Ge(O, t, r)
|
|
2240
|
+
) : P = await Ge(
|
|
2241
|
+
d,
|
|
2242
2242
|
t,
|
|
2243
2243
|
r
|
|
2244
|
-
), P = await Promise.resolve(P).then((
|
|
2244
|
+
), P = await Promise.resolve(P).then((O) => {
|
|
2245
2245
|
if (t?.marketingData) {
|
|
2246
2246
|
const N = {
|
|
2247
|
-
...
|
|
2247
|
+
...O.marketingData,
|
|
2248
2248
|
...t.marketingData
|
|
2249
2249
|
};
|
|
2250
2250
|
return a.checkout.marketingData({
|
|
2251
|
-
id:
|
|
2251
|
+
id: d.orderFormId,
|
|
2252
2252
|
marketingData: N
|
|
2253
2253
|
});
|
|
2254
2254
|
}
|
|
2255
|
-
return
|
|
2256
|
-
}).then((
|
|
2257
|
-
id:
|
|
2255
|
+
return O;
|
|
2256
|
+
}).then((O) => c && O.clientPreferencesData?.locale !== c ? a.checkout.clientPreferencesData({
|
|
2257
|
+
id: O.orderFormId,
|
|
2258
2258
|
clientPreferencesData: {
|
|
2259
|
-
...
|
|
2259
|
+
...O.clientPreferencesData,
|
|
2260
2260
|
locale: c
|
|
2261
2261
|
}
|
|
2262
|
-
}) :
|
|
2263
|
-
const R =
|
|
2264
|
-
|
|
2262
|
+
}) : O).then((O) => He(O, a, h)).then(We);
|
|
2263
|
+
const R = Ae(
|
|
2264
|
+
d.messages,
|
|
2265
2265
|
P.messages
|
|
2266
2266
|
);
|
|
2267
|
-
return
|
|
2267
|
+
return xr(n, P) && R ? Ye(
|
|
2268
2268
|
P,
|
|
2269
2269
|
o,
|
|
2270
2270
|
l,
|
|
2271
2271
|
m
|
|
2272
|
-
) :
|
|
2272
|
+
) : be(
|
|
2273
2273
|
P,
|
|
2274
2274
|
o,
|
|
2275
2275
|
l,
|
|
2276
2276
|
m
|
|
2277
2277
|
);
|
|
2278
2278
|
};
|
|
2279
|
-
function
|
|
2279
|
+
function Gr(e, n, t, r) {
|
|
2280
2280
|
const i = e.hasOnlyDefaultSalesChannel === !1, a = n ?? void 0, o = t ?? e.regionId;
|
|
2281
2281
|
return ee.stringify({
|
|
2282
2282
|
salesChannel: i ? e.salesChannel || a : a ?? e.salesChannel,
|
|
@@ -2285,29 +2285,29 @@ function Wr(e, n, t, r) {
|
|
|
2285
2285
|
hasOnlyDefaultSalesChannel: i ? !1 : !a
|
|
2286
2286
|
});
|
|
2287
2287
|
}
|
|
2288
|
-
const
|
|
2288
|
+
const Xr = (e) => {
|
|
2289
2289
|
const n = (e?.corporateName ?? "").trim();
|
|
2290
2290
|
return n || (e?.firstName ?? "").trim();
|
|
2291
|
-
},
|
|
2291
|
+
}, Yr = (e) => {
|
|
2292
2292
|
if (!e || typeof e != "object")
|
|
2293
2293
|
return !1;
|
|
2294
2294
|
const n = e;
|
|
2295
2295
|
return typeof n.customerId == "string" && n.customerId.trim() !== "" && typeof n.contractName == "string" && typeof n.isActive == "boolean" && typeof n.isCurrent == "boolean";
|
|
2296
|
-
},
|
|
2296
|
+
}, Jr = (e) => {
|
|
2297
2297
|
const n = e?.availableContracts?.value;
|
|
2298
|
-
return Array.isArray(n) ? n.filter(
|
|
2299
|
-
},
|
|
2298
|
+
return Array.isArray(n) ? n.filter(Yr) : [];
|
|
2299
|
+
}, Kr = (e) => e?.customerId ? !!((e.contractName ?? "").trim() && e.isActive) : !1, Je = (e) => e?.namespaces?.shopper?.activeContractId?.value?.trim() ?? e?.namespaces?.authentication?.customerId?.value?.trim() ?? e?.namespaces?.profile?.id?.value?.trim() ?? "", Qr = (e, n = "") => {
|
|
2300
2300
|
const t = n.trim();
|
|
2301
|
-
return e.filter(
|
|
2301
|
+
return e.filter(Kr).map((r) => ({
|
|
2302
2302
|
id: r.customerId,
|
|
2303
2303
|
corporateName: r.contractName.trim(),
|
|
2304
2304
|
isActive: t ? r.customerId === t : r.isCurrent
|
|
2305
2305
|
}));
|
|
2306
|
-
},
|
|
2307
|
-
const t =
|
|
2306
|
+
}, _n = (e, n) => {
|
|
2307
|
+
const t = Xr(e);
|
|
2308
2308
|
return t || (n?.firstName?.value ?? "").trim();
|
|
2309
2309
|
};
|
|
2310
|
-
async function
|
|
2310
|
+
async function Zr(e, n, t) {
|
|
2311
2311
|
try {
|
|
2312
2312
|
const r = await e.commerce.checkout.address({
|
|
2313
2313
|
postalCode: t,
|
|
@@ -2324,7 +2324,7 @@ async function Kr(e, n, t) {
|
|
|
2324
2324
|
), r;
|
|
2325
2325
|
}
|
|
2326
2326
|
}
|
|
2327
|
-
function
|
|
2327
|
+
function ei(e, n, t, r, i, a) {
|
|
2328
2328
|
const o = new URLSearchParams(e);
|
|
2329
2329
|
return o.has("facets") && o.delete("facets"), o.set("sc", o.get("sc") ?? n.salesChannel), t && o.set("postalCode", t), r && o.set("country", r), i && o.set(
|
|
2330
2330
|
"geoCoordinates",
|
|
@@ -2332,7 +2332,7 @@ function Qr(e, n, t, r, i, a) {
|
|
|
2332
2332
|
// long,lat is the format expected
|
|
2333
2333
|
), o.set("locale", a), o;
|
|
2334
2334
|
}
|
|
2335
|
-
function
|
|
2335
|
+
function ni(e, n) {
|
|
2336
2336
|
return {
|
|
2337
2337
|
utmCampaign: e.get("utm_campaign") ?? n?.utmCampaign ?? "",
|
|
2338
2338
|
utmMedium: e.get("utm_medium") ?? n?.utmMedium ?? "",
|
|
@@ -2342,8 +2342,8 @@ function Zr(e, n) {
|
|
|
2342
2342
|
utmiPart: e.get("utmi_pc") ?? n?.utmiPart ?? ""
|
|
2343
2343
|
};
|
|
2344
2344
|
}
|
|
2345
|
-
async function
|
|
2346
|
-
const r =
|
|
2345
|
+
async function ti(e, n, t) {
|
|
2346
|
+
const r = V(L(n ?? "", t));
|
|
2347
2347
|
let i = !1;
|
|
2348
2348
|
if (r)
|
|
2349
2349
|
try {
|
|
@@ -2357,7 +2357,7 @@ async function ei(e, n, t) {
|
|
|
2357
2357
|
unitId: i ? r?.unitId : void 0
|
|
2358
2358
|
};
|
|
2359
2359
|
}
|
|
2360
|
-
async function
|
|
2360
|
+
async function ri(e, n, t, r, i, a) {
|
|
2361
2361
|
return !n.seller || !(t || r) ? void 0 : (await e.commerce.checkout.region({
|
|
2362
2362
|
postalCode: t,
|
|
2363
2363
|
geoCoordinates: r,
|
|
@@ -2365,13 +2365,13 @@ async function ni(e, n, t, r, i, a) {
|
|
|
2365
2365
|
salesChannel: a
|
|
2366
2366
|
}))?.[0]?.sellers.find((c) => n.seller === c.id)?.id;
|
|
2367
2367
|
}
|
|
2368
|
-
function
|
|
2368
|
+
function Ke(e) {
|
|
2369
2369
|
return typeof e?.value == "string" ? e.value : "";
|
|
2370
2370
|
}
|
|
2371
|
-
function
|
|
2371
|
+
function ii(e) {
|
|
2372
2372
|
if (!e.isRepresentative)
|
|
2373
2373
|
return null;
|
|
2374
|
-
const n =
|
|
2374
|
+
const n = Ke(e.shopper?.firstName), t = Ke(e.shopper?.lastName);
|
|
2375
2375
|
return {
|
|
2376
2376
|
isRepresentative: !0,
|
|
2377
2377
|
customerId: e.authentication?.customerId?.value ?? e.customerId ?? "",
|
|
@@ -2382,11 +2382,11 @@ function ti(e) {
|
|
|
2382
2382
|
userName: `${n} ${t}`.trim(),
|
|
2383
2383
|
userEmail: e.authentication?.storeUserEmail?.value ?? "",
|
|
2384
2384
|
savedPostalCode: e.publicData?.postalCode?.value ?? "",
|
|
2385
|
-
contractName:
|
|
2385
|
+
contractName: _n(e.contract, e.profile),
|
|
2386
2386
|
organizationManager: e.shopper?.organizationManager?.value ?? !1
|
|
2387
2387
|
};
|
|
2388
2388
|
}
|
|
2389
|
-
function
|
|
2389
|
+
function ai(e) {
|
|
2390
2390
|
return e?.id ? {
|
|
2391
2391
|
id: e.id?.value ?? "",
|
|
2392
2392
|
email: e.email?.value ?? "",
|
|
@@ -2394,31 +2394,31 @@ function ri(e) {
|
|
|
2394
2394
|
familyName: e.lastName?.value ?? ""
|
|
2395
2395
|
} : null;
|
|
2396
2396
|
}
|
|
2397
|
-
const
|
|
2397
|
+
const oi = async (e, { session: n, search: t }, { clients: r, headers: i, account: a }) => {
|
|
2398
2398
|
const o = ee.parse(n.channel ?? ""), s = String(n.postalCode ?? ""), c = n.country ?? "";
|
|
2399
|
-
let
|
|
2400
|
-
if ((!
|
|
2401
|
-
const P = await
|
|
2399
|
+
let u = n.city ?? null, d = n.geoCoordinates ?? null;
|
|
2400
|
+
if ((!u || !d) && s !== "" && c !== "") {
|
|
2401
|
+
const P = await Zr(
|
|
2402
2402
|
r,
|
|
2403
2403
|
c,
|
|
2404
2404
|
s
|
|
2405
2405
|
);
|
|
2406
|
-
|
|
2406
|
+
u = P.city, d = P.geoCoordinates;
|
|
2407
2407
|
}
|
|
2408
|
-
const f =
|
|
2408
|
+
const f = ei(
|
|
2409
2409
|
t,
|
|
2410
2410
|
o,
|
|
2411
2411
|
s,
|
|
2412
2412
|
c,
|
|
2413
|
-
|
|
2413
|
+
d,
|
|
2414
2414
|
n.locale
|
|
2415
|
-
), h =
|
|
2415
|
+
), h = ni(f, n.marketingData), { isRepresentative: b, customerId: l, unitId: p } = await ti(
|
|
2416
2416
|
r,
|
|
2417
2417
|
i?.cookie,
|
|
2418
2418
|
a
|
|
2419
|
-
), m = await r.commerce.session(f.toString()).catch(() => null), S = m?.namespaces.profile ?? null,
|
|
2419
|
+
), m = await r.commerce.session(f.toString()).catch(() => null), S = m?.namespaces.profile ?? null, v = m?.namespaces.shopper ?? null, w = m?.namespaces.store ?? null, C = m?.namespaces.authentication ?? null, k = m?.namespaces.checkout ?? null, I = m?.namespaces.public ?? null;
|
|
2420
2420
|
let D = null;
|
|
2421
|
-
if (
|
|
2421
|
+
if (b && S?.id?.value)
|
|
2422
2422
|
try {
|
|
2423
2423
|
D = await r.commerce.masterData.getContractById({
|
|
2424
2424
|
contractId: S.id.value
|
|
@@ -2429,11 +2429,11 @@ const ii = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2429
2429
|
`
|
|
2430
2430
|
);
|
|
2431
2431
|
}
|
|
2432
|
-
const A = await
|
|
2432
|
+
const A = await ri(
|
|
2433
2433
|
r,
|
|
2434
2434
|
o,
|
|
2435
2435
|
s,
|
|
2436
|
-
|
|
2436
|
+
d,
|
|
2437
2437
|
c,
|
|
2438
2438
|
f.get("sc") ?? o.salesChannel
|
|
2439
2439
|
), _ = {
|
|
@@ -2443,7 +2443,7 @@ const ii = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2443
2443
|
symbol: w?.currencySymbol?.value ?? n.currency.symbol
|
|
2444
2444
|
},
|
|
2445
2445
|
country: w?.countryCode?.value ?? c,
|
|
2446
|
-
channel:
|
|
2446
|
+
channel: Gr(
|
|
2447
2447
|
o,
|
|
2448
2448
|
w?.channel?.value,
|
|
2449
2449
|
k?.regionId?.value,
|
|
@@ -2455,53 +2455,53 @@ const ii = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2455
2455
|
* - Unit data: `authentication` namespace
|
|
2456
2456
|
* - Contract data: `profile` namespace (those info will be available inside Faststore's Session `person` object)
|
|
2457
2457
|
*/
|
|
2458
|
-
b2b:
|
|
2459
|
-
isRepresentative:
|
|
2458
|
+
b2b: ii({
|
|
2459
|
+
isRepresentative: b,
|
|
2460
2460
|
authentication: C,
|
|
2461
|
-
shopper:
|
|
2461
|
+
shopper: v,
|
|
2462
2462
|
publicData: I,
|
|
2463
2463
|
profile: S,
|
|
2464
2464
|
contract: D,
|
|
2465
2465
|
customerId: l,
|
|
2466
|
-
unitId:
|
|
2466
|
+
unitId: p
|
|
2467
2467
|
}),
|
|
2468
2468
|
marketingData: h,
|
|
2469
|
-
person:
|
|
2470
|
-
geoCoordinates:
|
|
2471
|
-
city:
|
|
2469
|
+
person: ai(S),
|
|
2470
|
+
geoCoordinates: d?.latitude && d?.longitude && d || null,
|
|
2471
|
+
city: u
|
|
2472
2472
|
};
|
|
2473
|
-
return
|
|
2474
|
-
},
|
|
2475
|
-
validateCart:
|
|
2476
|
-
validateSession:
|
|
2477
|
-
subscribeToNewsletter:
|
|
2478
|
-
cancelOrder:
|
|
2479
|
-
processOrderAuthorization:
|
|
2480
|
-
uploadFileToOrderEntry:
|
|
2481
|
-
startOrderEntryOperation:
|
|
2482
|
-
startRecommendationSession:
|
|
2473
|
+
return Ae(n, _) ? null : _;
|
|
2474
|
+
}, si = {
|
|
2475
|
+
validateCart: Hr,
|
|
2476
|
+
validateSession: oi,
|
|
2477
|
+
subscribeToNewsletter: kr,
|
|
2478
|
+
cancelOrder: wr,
|
|
2479
|
+
processOrderAuthorization: Ar,
|
|
2480
|
+
uploadFileToOrderEntry: Er,
|
|
2481
|
+
startOrderEntryOperation: Pr,
|
|
2482
|
+
startRecommendationSession: _r
|
|
2483
2483
|
};
|
|
2484
|
-
var
|
|
2484
|
+
var Ce;
|
|
2485
2485
|
(function(e) {
|
|
2486
2486
|
e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension";
|
|
2487
|
-
})(
|
|
2488
|
-
const
|
|
2489
|
-
function
|
|
2487
|
+
})(Ce || (Ce = {}));
|
|
2488
|
+
const ci = (e) => typeof e == "string" ? kn(e) : null;
|
|
2489
|
+
function kn(e) {
|
|
2490
2490
|
try {
|
|
2491
2491
|
return JSON.parse(e);
|
|
2492
2492
|
} catch {
|
|
2493
2493
|
return e;
|
|
2494
2494
|
}
|
|
2495
2495
|
}
|
|
2496
|
-
const
|
|
2496
|
+
const li = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, di = new Mn({
|
|
2497
2497
|
name: "ObjectOrString",
|
|
2498
2498
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2499
|
-
parseValue:
|
|
2500
|
-
serialize:
|
|
2499
|
+
parseValue: ci,
|
|
2500
|
+
serialize: li,
|
|
2501
2501
|
parseLiteral(e) {
|
|
2502
|
-
return e.kind ===
|
|
2502
|
+
return e.kind === Ce.STRING ? kn(e.value) : null;
|
|
2503
2503
|
}
|
|
2504
|
-
}),
|
|
2504
|
+
}), T = (e) => "Price" in e && "seller" in e && "product" in e, U = (e) => "skuName" in e, ui = {
|
|
2505
2505
|
priceCurrency: async (e, n, t) => {
|
|
2506
2506
|
const {
|
|
2507
2507
|
loaders: { salesChannelLoader: r },
|
|
@@ -2509,35 +2509,35 @@ const si = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2509
2509
|
} = t;
|
|
2510
2510
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
2511
2511
|
},
|
|
2512
|
-
priceValidUntil: (e) =>
|
|
2512
|
+
priceValidUntil: (e) => T(e) ? e.PriceValidUntil ?? "" : U(e) ? e.priceValidUntil ?? "" : null,
|
|
2513
2513
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2514
|
-
availability: async (e) =>
|
|
2515
|
-
seller: (e, n, t) =>
|
|
2514
|
+
availability: async (e) => T(e) ? Be(B(e)) : U(e) ? Be(lr(e.availability)) : null,
|
|
2515
|
+
seller: (e, n, t) => T(e) ? {
|
|
2516
2516
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2517
2517
|
} : U(e) ? {
|
|
2518
2518
|
identifier: e.seller
|
|
2519
2519
|
} : null,
|
|
2520
|
-
price: (e) =>
|
|
2521
|
-
priceWithTaxes: (e) =>
|
|
2520
|
+
price: (e) => T(e) ? j(e) : U(e) ? e.sellingPrice / 100 : null,
|
|
2521
|
+
priceWithTaxes: (e) => T(e) ? x(j(e), e?.Tax, e.product.unitMultiplier) : U(e) ? x(
|
|
2522
2522
|
e.sellingPrice / 100,
|
|
2523
2523
|
e.tax / 100,
|
|
2524
2524
|
e.unitMultiplier
|
|
2525
2525
|
) : null,
|
|
2526
|
-
sellingPrice: (e) =>
|
|
2527
|
-
listPrice: (e) =>
|
|
2528
|
-
listPriceWithTaxes: (e) =>
|
|
2526
|
+
sellingPrice: (e) => T(e) ? cr(e) : U(e) ? e.sellingPrice / 100 : null,
|
|
2527
|
+
listPrice: (e) => T(e) ? e.ListPrice ?? 0 : U(e) ? e.listPrice / 100 : null,
|
|
2528
|
+
listPriceWithTaxes: (e) => T(e) ? x(
|
|
2529
2529
|
e.ListPrice ?? 0,
|
|
2530
2530
|
e?.Tax,
|
|
2531
2531
|
e.product.unitMultiplier
|
|
2532
|
-
) : U(e) ?
|
|
2533
|
-
itemOffered: (e) =>
|
|
2532
|
+
) : U(e) ? x(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
|
|
2533
|
+
itemOffered: (e) => T(e) ? e.product : U(e) ? {
|
|
2534
2534
|
...e.product,
|
|
2535
2535
|
attachmentsValues: e.attachments
|
|
2536
2536
|
} : null,
|
|
2537
|
-
quantity: (e) =>
|
|
2537
|
+
quantity: (e) => T(e) ? e.AvailableQuantity ?? 0 : U(e) ? e.quantity : null,
|
|
2538
2538
|
isGift: (e) => U(e) ? e.isGift ?? !1 : null,
|
|
2539
|
-
priceToken: (e) =>
|
|
2540
|
-
},
|
|
2539
|
+
priceToken: (e) => T(e) ? e.PriceToken ?? null : null
|
|
2540
|
+
}, pi = ({ linkText: e }) => `/${e}/p`, gi = ({
|
|
2541
2541
|
offer: e,
|
|
2542
2542
|
seller: n,
|
|
2543
2543
|
product: t
|
|
@@ -2545,27 +2545,27 @@ const si = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2545
2545
|
...e,
|
|
2546
2546
|
product: t,
|
|
2547
2547
|
seller: n
|
|
2548
|
-
}),
|
|
2549
|
-
if (!
|
|
2548
|
+
}), mi = 1e11, hi = (e) => /^\d+$/.test(e), fi = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/, Si = (e) => {
|
|
2549
|
+
if (!hi(e))
|
|
2550
2550
|
return new Date(
|
|
2551
|
-
|
|
2551
|
+
fi.test(e) ? `${e}Z` : e
|
|
2552
2552
|
);
|
|
2553
2553
|
const n = Number(e);
|
|
2554
|
-
return new Date(n >=
|
|
2555
|
-
},
|
|
2554
|
+
return new Date(n >= mi ? n : n * 1e3);
|
|
2555
|
+
}, yi = (e) => {
|
|
2556
2556
|
if (e == null)
|
|
2557
2557
|
return "";
|
|
2558
2558
|
const n = String(e).trim();
|
|
2559
2559
|
if (n === "")
|
|
2560
2560
|
return "";
|
|
2561
|
-
const t =
|
|
2561
|
+
const t = Si(n);
|
|
2562
2562
|
return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
|
|
2563
|
-
},
|
|
2563
|
+
}, Ii = {
|
|
2564
2564
|
imageText: "image",
|
|
2565
2565
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2566
2566
|
imageLabel: "label"
|
|
2567
|
-
}, ae = (e, n) => `${e}-${n}`,
|
|
2568
|
-
function
|
|
2567
|
+
}, ae = (e, n) => `${e}-${n}`, Qe = (e, n) => `/${ae(e, n)}/p`, vi = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2568
|
+
function we(e) {
|
|
2569
2569
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2570
2570
|
}
|
|
2571
2571
|
async function oe(e, n, t) {
|
|
@@ -2593,10 +2593,10 @@ async function oe(e, n, t) {
|
|
|
2593
2593
|
})();
|
|
2594
2594
|
return i.set(r, o), o;
|
|
2595
2595
|
}
|
|
2596
|
-
const
|
|
2597
|
-
const t = e.findIndex((r) =>
|
|
2596
|
+
const Oi = (e, n) => {
|
|
2597
|
+
const t = e.findIndex((r) => we(r).split("/").at(-1) === n);
|
|
2598
2598
|
return t < 0 ? 0 : t;
|
|
2599
|
-
},
|
|
2599
|
+
}, bi = {
|
|
2600
2600
|
productID: ({ itemId: e }) => e,
|
|
2601
2601
|
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2602
2602
|
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => ae(e, n),
|
|
@@ -2604,7 +2604,7 @@ const Ii = (e, n) => {
|
|
|
2604
2604
|
seo: ({ isVariantOf: e }) => ({
|
|
2605
2605
|
title: e.productTitle || e.productName,
|
|
2606
2606
|
description: e.metaTagDescription || e.description,
|
|
2607
|
-
canonical:
|
|
2607
|
+
canonical: pi(e)
|
|
2608
2608
|
}),
|
|
2609
2609
|
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2610
2610
|
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
@@ -2618,29 +2618,29 @@ const Ii = (e, n) => {
|
|
|
2618
2618
|
categoriesIds: s,
|
|
2619
2619
|
productId: c
|
|
2620
2620
|
},
|
|
2621
|
-
itemId:
|
|
2622
|
-
} = e,
|
|
2623
|
-
if (
|
|
2624
|
-
const
|
|
2625
|
-
if (
|
|
2621
|
+
itemId: u
|
|
2622
|
+
} = e, d = Oi(s, o), g = r[d], f = we(g).split("/"), h = t.storage.locale;
|
|
2623
|
+
if (q(t) && h) {
|
|
2624
|
+
const b = await oe(t, c, h);
|
|
2625
|
+
if (b) {
|
|
2626
2626
|
const l = new Set(
|
|
2627
|
-
|
|
2628
|
-
),
|
|
2629
|
-
(S,
|
|
2627
|
+
we(s[d]).split("/").filter(Boolean)
|
|
2628
|
+
), p = b.categories.filter((S) => l.has(S.id.toString())).sort(
|
|
2629
|
+
(S, v) => S.fullPath.split("/").length - v.fullPath.split("/").length
|
|
2630
2630
|
);
|
|
2631
|
-
if (
|
|
2631
|
+
if (p.length === f.length)
|
|
2632
2632
|
return {
|
|
2633
2633
|
itemListElement: [
|
|
2634
2634
|
// Category items: both name and slug come from Catalog Dataplane, ensuring
|
|
2635
2635
|
// they are always consistent with each other for the requested locale.
|
|
2636
|
-
...
|
|
2636
|
+
...p.map((S, v) => ({
|
|
2637
2637
|
name: S.name,
|
|
2638
2638
|
item: `/${S.fullPathUriName}/`,
|
|
2639
|
-
position:
|
|
2639
|
+
position: v + 1
|
|
2640
2640
|
})),
|
|
2641
2641
|
{
|
|
2642
2642
|
name: i,
|
|
2643
|
-
item:
|
|
2643
|
+
item: Qe(b.linkId, u),
|
|
2644
2644
|
position: f.length + 1
|
|
2645
2645
|
}
|
|
2646
2646
|
],
|
|
@@ -2650,17 +2650,17 @@ const Ii = (e, n) => {
|
|
|
2650
2650
|
}
|
|
2651
2651
|
return {
|
|
2652
2652
|
itemListElement: [
|
|
2653
|
-
...f.map((
|
|
2654
|
-
const
|
|
2653
|
+
...f.map((b, l) => {
|
|
2654
|
+
const p = `/${f.slice(0, l + 1).map(se).join("/")}/`;
|
|
2655
2655
|
return {
|
|
2656
|
-
name:
|
|
2657
|
-
item:
|
|
2656
|
+
name: b,
|
|
2657
|
+
item: p,
|
|
2658
2658
|
position: l + 1
|
|
2659
2659
|
};
|
|
2660
2660
|
}),
|
|
2661
2661
|
{
|
|
2662
2662
|
name: i,
|
|
2663
|
-
item:
|
|
2663
|
+
item: Qe(a, u),
|
|
2664
2664
|
position: f.length + 1
|
|
2665
2665
|
}
|
|
2666
2666
|
],
|
|
@@ -2668,11 +2668,11 @@ const Ii = (e, n) => {
|
|
|
2668
2668
|
};
|
|
2669
2669
|
},
|
|
2670
2670
|
image: ({ images: e }, n) => {
|
|
2671
|
-
const t = (
|
|
2672
|
-
({ imageUrl: s, imageText: c, imageLabel:
|
|
2671
|
+
const t = (vi(e) ?? [Ii]).map(
|
|
2672
|
+
({ imageUrl: s, imageText: c, imageLabel: u }) => ({
|
|
2673
2673
|
alternateName: c ?? "",
|
|
2674
2674
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
2675
|
-
keywords:
|
|
2675
|
+
keywords: u
|
|
2676
2676
|
})
|
|
2677
2677
|
);
|
|
2678
2678
|
if (typeof n != "object")
|
|
@@ -2691,12 +2691,12 @@ const Ii = (e, n) => {
|
|
|
2691
2691
|
review: () => [],
|
|
2692
2692
|
aggregateRating: () => ({}),
|
|
2693
2693
|
offers: (e) => e.sellers.map(
|
|
2694
|
-
(n) =>
|
|
2694
|
+
(n) => gi({
|
|
2695
2695
|
offer: n.commertialOffer,
|
|
2696
2696
|
seller: n,
|
|
2697
2697
|
product: e
|
|
2698
2698
|
})
|
|
2699
|
-
).sort(
|
|
2699
|
+
).sort(fn),
|
|
2700
2700
|
isVariantOf: (e) => e,
|
|
2701
2701
|
additionalProperty: ({
|
|
2702
2702
|
// Search uses the name variations for specifications
|
|
@@ -2711,8 +2711,8 @@ const Ii = (e, n) => {
|
|
|
2711
2711
|
valueReference: ne.specification
|
|
2712
2712
|
}))
|
|
2713
2713
|
), i = n.map(
|
|
2714
|
-
|
|
2715
|
-
), a = t.map(
|
|
2714
|
+
On
|
|
2715
|
+
), a = t.map(Ur);
|
|
2716
2716
|
return [
|
|
2717
2717
|
...r,
|
|
2718
2718
|
...i,
|
|
@@ -2722,24 +2722,24 @@ const Ii = (e, n) => {
|
|
|
2722
2722
|
hasSpecifications: ({ isVariantOf: e }) => !!e.skuSpecifications?.length,
|
|
2723
2723
|
skuSpecifications: ({ isVariantOf: { skuSpecifications: e } }) => e ?? [],
|
|
2724
2724
|
specificationGroups: ({ isVariantOf: { specificationGroups: e } }) => e,
|
|
2725
|
-
releaseDate: ({ isVariantOf: { releaseDate: e } }) =>
|
|
2725
|
+
releaseDate: ({ isVariantOf: { releaseDate: e } }) => yi(e),
|
|
2726
2726
|
advertisement: ({ isVariantOf: { advertisement: e } }) => e,
|
|
2727
2727
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e,
|
|
2728
2728
|
otherLocales: async (e, n, t) => {
|
|
2729
|
-
if (!
|
|
2730
|
-
const r =
|
|
2729
|
+
if (!q(t)) return null;
|
|
2730
|
+
const r = Dt(t);
|
|
2731
2731
|
if (r.length === 0) return null;
|
|
2732
2732
|
const i = e.isVariantOf.productId, a = e.itemId, o = t.storage.locale, s = await oe(t, i, o);
|
|
2733
2733
|
if (!s?.availableLinkIds) return null;
|
|
2734
2734
|
const { availableLinkIds: c } = s;
|
|
2735
|
-
return r.map((
|
|
2736
|
-
const
|
|
2737
|
-
return
|
|
2738
|
-
}).filter((
|
|
2735
|
+
return r.map((u) => {
|
|
2736
|
+
const d = c[u];
|
|
2737
|
+
return d ? { locale: u, slug: ae(d, a) } : null;
|
|
2738
|
+
}).filter((u) => u !== null);
|
|
2739
2739
|
},
|
|
2740
2740
|
defaultLocaleSlug: async (e, n, t) => {
|
|
2741
|
-
if (!
|
|
2742
|
-
const r =
|
|
2741
|
+
if (!q(t)) return null;
|
|
2742
|
+
const r = At(t);
|
|
2743
2743
|
if (!r) return null;
|
|
2744
2744
|
const { productId: i, linkText: a } = e.isVariantOf, o = e.itemId, c = (await oe(
|
|
2745
2745
|
t,
|
|
@@ -2748,13 +2748,13 @@ const Ii = (e, n) => {
|
|
|
2748
2748
|
))?.availableLinkIds?.[r] ?? a;
|
|
2749
2749
|
return ae(c, o);
|
|
2750
2750
|
}
|
|
2751
|
-
},
|
|
2751
|
+
}, Ci = /* @__PURE__ */ new Set(["allSpecifications"]), wi = {
|
|
2752
2752
|
hasVariant: (e) => e.isVariantOf.items.map((n) => F(n, e.isVariantOf)),
|
|
2753
2753
|
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
2754
2754
|
name: (e) => e.isVariantOf.productName,
|
|
2755
2755
|
skuVariants: (e) => e,
|
|
2756
2756
|
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
2757
|
-
(n) => !
|
|
2757
|
+
(n) => !Ci.has(n.name)
|
|
2758
2758
|
).flatMap(
|
|
2759
2759
|
({ specifications: n }) => n.flatMap(
|
|
2760
2760
|
({ name: t, values: r }) => r.map((i) => ({
|
|
@@ -2764,8 +2764,8 @@ const Ii = (e, n) => {
|
|
|
2764
2764
|
}))
|
|
2765
2765
|
)
|
|
2766
2766
|
)
|
|
2767
|
-
},
|
|
2768
|
-
propertyID: (e) => e.propertyID ||
|
|
2767
|
+
}, Di = {
|
|
2768
|
+
propertyID: (e) => e.propertyID || bn(e),
|
|
2769
2769
|
name: ({ name: e }) => e,
|
|
2770
2770
|
value: ({ value: e }) => e,
|
|
2771
2771
|
valueReference: ({ valueReference: e }) => e
|
|
@@ -2775,40 +2775,40 @@ const Ii = (e, n) => {
|
|
|
2775
2775
|
offer: i.commertialOffer,
|
|
2776
2776
|
sku: r
|
|
2777
2777
|
}))
|
|
2778
|
-
), t =
|
|
2778
|
+
), t = Ie(
|
|
2779
2779
|
n,
|
|
2780
|
-
({ offer: r }, { offer: i }) =>
|
|
2780
|
+
({ offer: r }, { offer: i }) => fn(r, i)
|
|
2781
2781
|
);
|
|
2782
2782
|
return t ? t.sku : e[0];
|
|
2783
|
-
},
|
|
2783
|
+
}, En = (e) => e !== "" && !Number.isNaN(Number(e)), Ai = /^vrn:recommendations:[^:]+:[^:]+:[^:]+$/, Pi = async (e, { campaignVrn: n, userId: t, products: r }, i) => {
|
|
2784
2784
|
const {
|
|
2785
2785
|
clients: { commerce: a }
|
|
2786
2786
|
} = i, { salesChannel: o } = i.storage.channel, s = n?.trim();
|
|
2787
|
-
if (!s || !
|
|
2788
|
-
throw new
|
|
2787
|
+
if (!s || !Ai.test(s))
|
|
2788
|
+
throw new E(`Invalid campaignVrn: "${n}"`);
|
|
2789
2789
|
const c = t?.trim();
|
|
2790
2790
|
if (t != null && !c)
|
|
2791
|
-
throw new
|
|
2791
|
+
throw new E("Invalid userId: must be a non-empty string");
|
|
2792
2792
|
if (r != null && (!Array.isArray(r) || r.some((h) => !h?.trim())))
|
|
2793
|
-
throw new
|
|
2793
|
+
throw new E(
|
|
2794
2794
|
"Invalid products: must be an array of non-empty strings"
|
|
2795
2795
|
);
|
|
2796
|
-
const
|
|
2796
|
+
const u = await a.recommendation.recommendations({
|
|
2797
2797
|
campaignVrn: s,
|
|
2798
2798
|
userId: c || void 0,
|
|
2799
2799
|
products: r ?? [],
|
|
2800
2800
|
salesChannel: o ?? void 0,
|
|
2801
2801
|
locale: i.storage.locale
|
|
2802
|
-
}), { campaign:
|
|
2802
|
+
}), { campaign: d, correlationId: g } = u;
|
|
2803
2803
|
return {
|
|
2804
|
-
products: (
|
|
2805
|
-
const
|
|
2806
|
-
return
|
|
2804
|
+
products: (u.products ?? []).map((h) => {
|
|
2805
|
+
const b = de(h.items);
|
|
2806
|
+
return b ? F(b, h) : null;
|
|
2807
2807
|
}).filter((h) => !!h),
|
|
2808
|
-
correlationId:
|
|
2809
|
-
campaign:
|
|
2808
|
+
correlationId: g,
|
|
2809
|
+
campaign: d
|
|
2810
2810
|
};
|
|
2811
|
-
},
|
|
2811
|
+
}, Ze = {
|
|
2812
2812
|
price_desc: "price:desc",
|
|
2813
2813
|
price_asc: "price:asc",
|
|
2814
2814
|
orders_desc: "orders:desc",
|
|
@@ -2817,13 +2817,13 @@ const Ii = (e, n) => {
|
|
|
2817
2817
|
release_desc: "release:desc",
|
|
2818
2818
|
discount_desc: "discount:desc",
|
|
2819
2819
|
score_desc: ""
|
|
2820
|
-
},
|
|
2820
|
+
}, _i = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
2821
2821
|
if (!n)
|
|
2822
|
-
throw new
|
|
2822
|
+
throw new E("Missing operationId");
|
|
2823
2823
|
return t.orderEntry.getOperation({ operationId: n });
|
|
2824
|
-
},
|
|
2824
|
+
}, ki = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
2825
2825
|
if (!n)
|
|
2826
|
-
throw new
|
|
2826
|
+
throw new E("Missing orderFormId");
|
|
2827
2827
|
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
2828
2828
|
return (r ?? []).map((i) => ({
|
|
2829
2829
|
id: i.id,
|
|
@@ -2837,19 +2837,19 @@ const Ii = (e, n) => {
|
|
|
2837
2837
|
unitMultiplier: i.unitMultiplier ?? 1
|
|
2838
2838
|
}));
|
|
2839
2839
|
};
|
|
2840
|
-
async function
|
|
2840
|
+
async function Ei(e, n, t, r) {
|
|
2841
2841
|
const i = n.slice(0, n.lastIndexOf("-"));
|
|
2842
2842
|
return (await oe(e, t, r))?.linkId === i;
|
|
2843
2843
|
}
|
|
2844
|
-
const
|
|
2845
|
-
async function
|
|
2844
|
+
const Tn = "Invalid SkuId", Un = "Slug was set but the fetched sku does not satisfy the slug condition.", Ti = "UseAdHocCard", Ui = (e) => Y(e) || e instanceof Error && (e.message === Tn || e.message.startsWith(Un));
|
|
2845
|
+
async function Ri(e, n, t, r) {
|
|
2846
2846
|
const { linkText: i, productId: a } = n.isVariantOf;
|
|
2847
|
-
if (!(!t || !i || t.startsWith(i) ||
|
|
2848
|
-
throw new Error(`${
|
|
2847
|
+
if (!(!t || !i || t.startsWith(i) || q(e) && r && En(t.split("-").pop() ?? "") && await Ei(e, t, a, r)))
|
|
2848
|
+
throw new Error(`${Un} slug: ${t}, linkText: ${i}`);
|
|
2849
2849
|
}
|
|
2850
|
-
async function
|
|
2850
|
+
async function Fi(e, n) {
|
|
2851
2851
|
if (n == null)
|
|
2852
|
-
throw new
|
|
2852
|
+
throw new E("Missing slug or id");
|
|
2853
2853
|
const {
|
|
2854
2854
|
clients: { commerce: t, search: r }
|
|
2855
2855
|
} = e, i = await t.catalog.portal.pagetype(`${n}/p`);
|
|
@@ -2863,23 +2863,23 @@ async function Ui(e, n) {
|
|
|
2863
2863
|
throw new $(`No product found for id ${i.id}`);
|
|
2864
2864
|
return F(de(a.items), a);
|
|
2865
2865
|
}
|
|
2866
|
-
const
|
|
2866
|
+
const Ni = {
|
|
2867
2867
|
product: async (e, { locator: n }, t) => {
|
|
2868
|
-
const r =
|
|
2869
|
-
r && ce(t, r), i &&
|
|
2868
|
+
const r = qe(n), i = xe(n), a = Ir(n), o = yr(n);
|
|
2869
|
+
r && ce(t, r), i && ve(t, i);
|
|
2870
2870
|
const {
|
|
2871
2871
|
loaders: { skuLoader: s }
|
|
2872
2872
|
} = t;
|
|
2873
2873
|
try {
|
|
2874
2874
|
const c = a ?? o?.split("-").pop() ?? "";
|
|
2875
|
-
if (!
|
|
2876
|
-
throw new Error(
|
|
2877
|
-
const
|
|
2878
|
-
return await
|
|
2875
|
+
if (!En(c))
|
|
2876
|
+
throw new Error(Tn);
|
|
2877
|
+
const u = await s.load(c);
|
|
2878
|
+
return await Ri(t, u, o, i), u;
|
|
2879
2879
|
} catch (c) {
|
|
2880
|
-
if (!
|
|
2880
|
+
if (!Ui(c))
|
|
2881
2881
|
throw c;
|
|
2882
|
-
return
|
|
2882
|
+
return Fi(t, o);
|
|
2883
2883
|
}
|
|
2884
2884
|
},
|
|
2885
2885
|
collection: (e, { slug: n }, t) => {
|
|
@@ -2888,7 +2888,7 @@ const Ri = {
|
|
|
2888
2888
|
} = t;
|
|
2889
2889
|
return r.load({
|
|
2890
2890
|
slug: n,
|
|
2891
|
-
locale:
|
|
2891
|
+
locale: pn(t)
|
|
2892
2892
|
});
|
|
2893
2893
|
},
|
|
2894
2894
|
search: async (e, {
|
|
@@ -2899,21 +2899,21 @@ const Ri = {
|
|
|
2899
2899
|
selectedFacets: a,
|
|
2900
2900
|
sponsoredCount: o
|
|
2901
2901
|
}, s) => {
|
|
2902
|
-
const c =
|
|
2903
|
-
c && ce(s, c),
|
|
2904
|
-
const
|
|
2905
|
-
page: Math.ceil(
|
|
2902
|
+
const c = qe(a), u = xe(a), d = Sr(a);
|
|
2903
|
+
c && ce(s, c), u && ve(s, u);
|
|
2904
|
+
const g = t ? Number(t) : 0, f = {
|
|
2905
|
+
page: Math.ceil(g / n) || 0,
|
|
2906
2906
|
count: n,
|
|
2907
2907
|
query: i ?? void 0,
|
|
2908
|
-
sort:
|
|
2909
|
-
selectedFacets: a?.flatMap(
|
|
2908
|
+
sort: Ze[r ?? "score_desc"] ?? Ze.score_desc,
|
|
2909
|
+
selectedFacets: a?.flatMap(ze) ?? [],
|
|
2910
2910
|
sponsoredCount: o ?? void 0
|
|
2911
2911
|
};
|
|
2912
|
-
if (
|
|
2912
|
+
if (d) {
|
|
2913
2913
|
const l = (await s.clients.commerce.catalog.products.crossselling({
|
|
2914
|
-
type:
|
|
2915
|
-
productId:
|
|
2916
|
-
})).map((m) => m.productId).slice(0, n),
|
|
2914
|
+
type: yn[d.key],
|
|
2915
|
+
productId: d.value
|
|
2916
|
+
})).map((m) => m.productId).slice(0, n), p = s.clients.search.productsByIdentifier({ field: "id", values: l }).then((m) => ({
|
|
2917
2917
|
products: m,
|
|
2918
2918
|
recordsFiltered: m.length,
|
|
2919
2919
|
pagination: {
|
|
@@ -2936,7 +2936,7 @@ const Ri = {
|
|
|
2936
2936
|
fuzzy: "0",
|
|
2937
2937
|
searchId: ""
|
|
2938
2938
|
}));
|
|
2939
|
-
return { searchArgs: f, productSearchPromise:
|
|
2939
|
+
return { searchArgs: f, productSearchPromise: p };
|
|
2940
2940
|
}
|
|
2941
2941
|
const h = s.clients.search.products(f);
|
|
2942
2942
|
return { searchArgs: f, productSearchPromise: h };
|
|
@@ -2948,7 +2948,7 @@ const Ri = {
|
|
|
2948
2948
|
page: Math.ceil(a / n),
|
|
2949
2949
|
count: n
|
|
2950
2950
|
}), s = o.products.flatMap(
|
|
2951
|
-
(c) => c.items.map((
|
|
2951
|
+
(c) => c.items.map((u) => F(u, c))
|
|
2952
2952
|
).filter((c) => c.sellers.length > 0);
|
|
2953
2953
|
return {
|
|
2954
2954
|
pageInfo: {
|
|
@@ -2959,9 +2959,9 @@ const Ri = {
|
|
|
2959
2959
|
totalCount: o.recordsFiltered
|
|
2960
2960
|
},
|
|
2961
2961
|
// after + index is bigger than after+first itself because of the array flat() above
|
|
2962
|
-
edges: s.map((c,
|
|
2962
|
+
edges: s.map((c, u) => ({
|
|
2963
2963
|
node: c,
|
|
2964
|
-
cursor: (a +
|
|
2964
|
+
cursor: (a + u).toString()
|
|
2965
2965
|
}))
|
|
2966
2966
|
};
|
|
2967
2967
|
},
|
|
@@ -2984,11 +2984,11 @@ const Ri = {
|
|
|
2984
2984
|
} = r, a = t ? Number(t) : 0, [o, s] = await Promise.all([
|
|
2985
2985
|
i.catalog.brand.list(),
|
|
2986
2986
|
i.catalog.category.tree()
|
|
2987
|
-
]), c = [],
|
|
2987
|
+
]), c = [], u = (h, b) => {
|
|
2988
2988
|
c.push({
|
|
2989
2989
|
id: h.id,
|
|
2990
2990
|
name: h.name,
|
|
2991
|
-
fatherCategoryId:
|
|
2991
|
+
fatherCategoryId: b,
|
|
2992
2992
|
linkId: se(h.name),
|
|
2993
2993
|
title: h.Title,
|
|
2994
2994
|
description: null,
|
|
@@ -2998,10 +2998,10 @@ const Ri = {
|
|
|
2998
2998
|
slug: new URL(h.url).pathname.slice(1).toLowerCase()
|
|
2999
2999
|
});
|
|
3000
3000
|
for (const l of h.children)
|
|
3001
|
-
|
|
3001
|
+
u(l, h.id);
|
|
3002
3002
|
};
|
|
3003
3003
|
for (const h of s)
|
|
3004
|
-
|
|
3004
|
+
u(h, null);
|
|
3005
3005
|
const f = [...o.filter((h) => h.isActive).map((h) => ({
|
|
3006
3006
|
id: h.id,
|
|
3007
3007
|
name: h.name,
|
|
@@ -3011,7 +3011,7 @@ const Ri = {
|
|
|
3011
3011
|
metaTagDescription: h.metaTagDescription,
|
|
3012
3012
|
availableLinkIds: null,
|
|
3013
3013
|
entityType: "brand"
|
|
3014
|
-
})), ...c].filter((h) => !!
|
|
3014
|
+
})), ...c].filter((h) => !!Sn.slug(h, null, r, null));
|
|
3015
3015
|
return {
|
|
3016
3016
|
pageInfo: {
|
|
3017
3017
|
hasNextPage: f.length - a > n,
|
|
@@ -3020,9 +3020,9 @@ const Ri = {
|
|
|
3020
3020
|
endCursor: (Math.min(n, f.length - a) - 1).toString(),
|
|
3021
3021
|
totalCount: f.length
|
|
3022
3022
|
},
|
|
3023
|
-
edges: f.slice(a, a + n).map((h,
|
|
3023
|
+
edges: f.slice(a, a + n).map((h, b) => ({
|
|
3024
3024
|
node: h,
|
|
3025
|
-
cursor: (a +
|
|
3025
|
+
cursor: (a + b).toString()
|
|
3026
3026
|
}))
|
|
3027
3027
|
};
|
|
3028
3028
|
},
|
|
@@ -3046,7 +3046,7 @@ const Ri = {
|
|
|
3046
3046
|
page: 1,
|
|
3047
3047
|
count: 1,
|
|
3048
3048
|
query: n ?? void 0,
|
|
3049
|
-
selectedFacets: t?.flatMap(
|
|
3049
|
+
selectedFacets: t?.flatMap(ze) ?? [],
|
|
3050
3050
|
allowRedirect: !0
|
|
3051
3051
|
});
|
|
3052
3052
|
return {
|
|
@@ -3061,10 +3061,10 @@ const Ri = {
|
|
|
3061
3061
|
geoCoordinates: t,
|
|
3062
3062
|
country: r,
|
|
3063
3063
|
salesChannel: i
|
|
3064
|
-
}))?.[0], { id:
|
|
3064
|
+
}))?.[0], { id: u, sellers: d } = c;
|
|
3065
3065
|
return {
|
|
3066
|
-
id:
|
|
3067
|
-
sellers:
|
|
3066
|
+
id: u,
|
|
3067
|
+
sellers: d
|
|
3068
3068
|
};
|
|
3069
3069
|
},
|
|
3070
3070
|
profile: async (e, { id: n }, t) => {
|
|
@@ -3089,7 +3089,7 @@ const Ri = {
|
|
|
3089
3089
|
userOrder: async (e, { orderId: n }, t) => {
|
|
3090
3090
|
try {
|
|
3091
3091
|
if (!n)
|
|
3092
|
-
throw new
|
|
3092
|
+
throw new E("Missing orderId");
|
|
3093
3093
|
const {
|
|
3094
3094
|
clients: { commerce: r }
|
|
3095
3095
|
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
@@ -3098,7 +3098,7 @@ const Ri = {
|
|
|
3098
3098
|
let a = null;
|
|
3099
3099
|
try {
|
|
3100
3100
|
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
3101
|
-
a =
|
|
3101
|
+
a = In(c);
|
|
3102
3102
|
} catch {
|
|
3103
3103
|
}
|
|
3104
3104
|
const s = (await r.masterData.getShopperById({
|
|
@@ -3137,7 +3137,7 @@ const Ri = {
|
|
|
3137
3137
|
a = { message: i };
|
|
3138
3138
|
}
|
|
3139
3139
|
const o = a?.message || i;
|
|
3140
|
-
throw Y(r) ? new $(`No order found for id ${n}. ${o}.`) :
|
|
3140
|
+
throw Y(r) ? new $(`No order found for id ${n}. ${o}.`) : dt(r) ? new J(
|
|
3141
3141
|
`You are forbidden to interact with order with id ${n}. ${o}.`
|
|
3142
3142
|
) : r;
|
|
3143
3143
|
}
|
|
@@ -3185,10 +3185,10 @@ const Ri = {
|
|
|
3185
3185
|
account: r,
|
|
3186
3186
|
headers: i,
|
|
3187
3187
|
clients: { commerce: a }
|
|
3188
|
-
} = t, s =
|
|
3188
|
+
} = t, s = V(L(i?.cookie ?? "", r))?.userId ?? "";
|
|
3189
3189
|
if (!s)
|
|
3190
3190
|
return !0;
|
|
3191
|
-
const c = await a.licenseManager.isResourceGranted({ userId: s, resourceKey:
|
|
3191
|
+
const c = await a.licenseManager.isResourceGranted({ userId: s, resourceKey: Ti }).catch(() => null);
|
|
3192
3192
|
return typeof c == "boolean" ? c : !0;
|
|
3193
3193
|
},
|
|
3194
3194
|
listUserQuotes: async (e, n, t) => {
|
|
@@ -3200,12 +3200,12 @@ const Ri = {
|
|
|
3200
3200
|
return await Promise.all(
|
|
3201
3201
|
a.map(async (c) => {
|
|
3202
3202
|
try {
|
|
3203
|
-
const [
|
|
3203
|
+
const [u] = await r.masterData.getShopperById({
|
|
3204
3204
|
userId: c
|
|
3205
3205
|
});
|
|
3206
|
-
if (
|
|
3207
|
-
const
|
|
3208
|
-
|
|
3206
|
+
if (u) {
|
|
3207
|
+
const d = [u.firstName, u.lastName].filter(Boolean).join(" ");
|
|
3208
|
+
d && o.set(c, d);
|
|
3209
3209
|
}
|
|
3210
3210
|
} catch {
|
|
3211
3211
|
}
|
|
@@ -3242,17 +3242,17 @@ const Ri = {
|
|
|
3242
3242
|
account: r,
|
|
3243
3243
|
headers: i,
|
|
3244
3244
|
clients: { commerce: a }
|
|
3245
|
-
} = t, s =
|
|
3245
|
+
} = t, s = V(L(i?.cookie ?? "", r))?.userId ?? "", [c, u, d] = await Promise.all([
|
|
3246
3246
|
a.session("").catch(() => null),
|
|
3247
3247
|
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
3248
3248
|
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
3249
|
-
]),
|
|
3249
|
+
]), g = u?.[0], f = c?.namespaces.authentication ?? null, h = `${(g?.firstName ?? "").trim()} ${(g?.lastName ?? "").trim()}`.trim();
|
|
3250
3250
|
return {
|
|
3251
3251
|
username: f?.storeUserEmail?.value ?? "",
|
|
3252
3252
|
name: h,
|
|
3253
3253
|
email: f?.storeUserEmail?.value ?? "",
|
|
3254
|
-
phone:
|
|
3255
|
-
role:
|
|
3254
|
+
phone: g?.phone ?? "",
|
|
3255
|
+
role: d?.Roles?.map((b) => b.Name) ?? [],
|
|
3256
3256
|
orgUnit: f?.unitName?.value ?? ""
|
|
3257
3257
|
};
|
|
3258
3258
|
},
|
|
@@ -3263,29 +3263,29 @@ const Ri = {
|
|
|
3263
3263
|
account: r,
|
|
3264
3264
|
headers: i,
|
|
3265
3265
|
clients: { commerce: a }
|
|
3266
|
-
} = t, o =
|
|
3266
|
+
} = t, o = V(L(i?.cookie ?? "", r));
|
|
3267
3267
|
if (!o?.userId)
|
|
3268
3268
|
return null;
|
|
3269
3269
|
if (o?.isRepresentative) {
|
|
3270
3270
|
const c = await a.session("").catch(() => null);
|
|
3271
3271
|
if (!c)
|
|
3272
3272
|
return null;
|
|
3273
|
-
const
|
|
3273
|
+
const u = c.namespaces.profile ?? null, d = c.namespaces.shopper ?? null, g = c.namespaces.authentication ?? null, f = Je(c) || o?.customerId?.trim() || "";
|
|
3274
3274
|
let h = null;
|
|
3275
3275
|
if (f)
|
|
3276
3276
|
try {
|
|
3277
3277
|
h = await a.masterData.getContractById({ contractId: f });
|
|
3278
|
-
} catch (
|
|
3278
|
+
} catch (p) {
|
|
3279
3279
|
console.error(
|
|
3280
3280
|
`Error while getting contract data for contract ID (${f}).`,
|
|
3281
|
-
|
|
3281
|
+
p
|
|
3282
3282
|
);
|
|
3283
3283
|
}
|
|
3284
|
-
const
|
|
3284
|
+
const b = `${(d?.firstName?.value ?? "").trim()} ${(d?.lastName?.value ?? "").trim()}`.trim();
|
|
3285
3285
|
return {
|
|
3286
|
-
name:
|
|
3287
|
-
email:
|
|
3288
|
-
id:
|
|
3286
|
+
name: _n(h, u) || b || "",
|
|
3287
|
+
email: u?.email?.value || g?.storeUserEmail?.value || "",
|
|
3288
|
+
id: u?.id?.value || g?.customerId?.value || o?.customerId?.trim() || ""
|
|
3289
3289
|
// createdAt: '',
|
|
3290
3290
|
};
|
|
3291
3291
|
}
|
|
@@ -3303,7 +3303,7 @@ const Ri = {
|
|
|
3303
3303
|
// Contract list from VTEX session `shopper.availableContracts`.
|
|
3304
3304
|
availableContracts: async (e, { orgUnitId: n }, t) => {
|
|
3305
3305
|
if (!n)
|
|
3306
|
-
throw new
|
|
3306
|
+
throw new E("Missing orgUnitId");
|
|
3307
3307
|
const {
|
|
3308
3308
|
account: r,
|
|
3309
3309
|
headers: i,
|
|
@@ -3311,19 +3311,19 @@ const Ri = {
|
|
|
3311
3311
|
} = t, o = await a.session("").catch(() => null), s = L(i?.cookie ?? "", r);
|
|
3312
3312
|
let c = null;
|
|
3313
3313
|
try {
|
|
3314
|
-
c = s ?
|
|
3314
|
+
c = s ? V(s) : null;
|
|
3315
3315
|
} catch {
|
|
3316
3316
|
c = null;
|
|
3317
3317
|
}
|
|
3318
|
-
const
|
|
3319
|
-
if (!
|
|
3318
|
+
const u = o?.namespaces.authentication?.unitId?.value?.trim() ?? c?.unitId?.trim() ?? "";
|
|
3319
|
+
if (!u || u !== n)
|
|
3320
3320
|
throw new J(
|
|
3321
3321
|
"You are not allowed to list contracts for this organization unit"
|
|
3322
3322
|
);
|
|
3323
|
-
const
|
|
3323
|
+
const d = Jr(
|
|
3324
3324
|
o?.namespaces.shopper
|
|
3325
|
-
),
|
|
3326
|
-
return
|
|
3325
|
+
), g = Je(o) || c?.customerId?.trim() || "";
|
|
3326
|
+
return Qr(d, g);
|
|
3327
3327
|
},
|
|
3328
3328
|
pickupPoints: async (e, { geoCoordinates: n }, t) => {
|
|
3329
3329
|
const {
|
|
@@ -3333,10 +3333,10 @@ const Ri = {
|
|
|
3333
3333
|
geoCoordinates: n
|
|
3334
3334
|
});
|
|
3335
3335
|
},
|
|
3336
|
-
orderEntryOperation:
|
|
3337
|
-
orderFormItems:
|
|
3338
|
-
recommendations:
|
|
3339
|
-
},
|
|
3336
|
+
orderEntryOperation: _i,
|
|
3337
|
+
orderFormItems: ki,
|
|
3338
|
+
recommendations: Pi
|
|
3339
|
+
}, Li = {
|
|
3340
3340
|
reviewRating: () => ({
|
|
3341
3341
|
ratingValue: 5,
|
|
3342
3342
|
bestRating: 5
|
|
@@ -3344,28 +3344,28 @@ const Ri = {
|
|
|
3344
3344
|
author: () => ({
|
|
3345
3345
|
name: ""
|
|
3346
3346
|
})
|
|
3347
|
-
},
|
|
3347
|
+
}, Bi = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, $i = {
|
|
3348
3348
|
suggestions: async (e, n, t) => {
|
|
3349
3349
|
const {
|
|
3350
3350
|
clients: { search: r }
|
|
3351
3351
|
} = t, { searchArgs: i } = e;
|
|
3352
3352
|
if (!i.query)
|
|
3353
3353
|
return {
|
|
3354
|
-
terms: (await r.topSearches()).searches.map((
|
|
3355
|
-
value:
|
|
3356
|
-
count:
|
|
3354
|
+
terms: (await r.topSearches()).searches.map((g) => ({
|
|
3355
|
+
value: g.term,
|
|
3356
|
+
count: g.count
|
|
3357
3357
|
})),
|
|
3358
3358
|
products: []
|
|
3359
3359
|
};
|
|
3360
3360
|
const { productSearchPromise: a } = e, [o, s] = await Promise.all([
|
|
3361
3361
|
r.suggestedTerms(i),
|
|
3362
3362
|
a
|
|
3363
|
-
]), c = s.products.map((
|
|
3364
|
-
const
|
|
3365
|
-
return
|
|
3366
|
-
}).filter((
|
|
3363
|
+
]), c = s.products.map((d) => {
|
|
3364
|
+
const g = de(d.items);
|
|
3365
|
+
return g && F(g, d);
|
|
3366
|
+
}).filter((d) => !!d), { searches: u } = o;
|
|
3367
3367
|
return {
|
|
3368
|
-
terms:
|
|
3368
|
+
terms: u.map((d) => ({ value: d.term, count: d.count })),
|
|
3369
3369
|
products: c
|
|
3370
3370
|
};
|
|
3371
3371
|
},
|
|
@@ -3395,7 +3395,7 @@ const Ri = {
|
|
|
3395
3395
|
t.storage.searchArgs = e;
|
|
3396
3396
|
const { facets: i = [] } = await r.facets(e), a = !e.query, o = e.selectedFacets?.length ? e.selectedFacets[0].key === "category-1" : !1, s = e.selectedFacets?.length ? e.selectedFacets[0].key === "brand" : !1;
|
|
3397
3397
|
return i.filter(
|
|
3398
|
-
(
|
|
3398
|
+
(u) => !a || !Bi(u, o, s)
|
|
3399
3399
|
);
|
|
3400
3400
|
},
|
|
3401
3401
|
metadata: async ({ productSearchPromise: e }) => {
|
|
@@ -3407,12 +3407,12 @@ const Ri = {
|
|
|
3407
3407
|
};
|
|
3408
3408
|
},
|
|
3409
3409
|
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
3410
|
-
},
|
|
3410
|
+
}, Mi = {
|
|
3411
3411
|
title: ({ title: e }) => e ?? "",
|
|
3412
3412
|
description: ({ description: e }) => e ?? "",
|
|
3413
3413
|
canonical: ({ canonical: e }) => e ?? "",
|
|
3414
3414
|
titleTemplate: () => ""
|
|
3415
|
-
},
|
|
3415
|
+
}, zi = ["bd", "d", "h", "m"], Vi = (e) => zi.includes(e), xi = {
|
|
3416
3416
|
bd: {
|
|
3417
3417
|
0: "Today",
|
|
3418
3418
|
1: "In 1 business day",
|
|
@@ -3433,29 +3433,29 @@ const Ri = {
|
|
|
3433
3433
|
1: "In 1 minute",
|
|
3434
3434
|
other: "Up to # minutes"
|
|
3435
3435
|
}
|
|
3436
|
-
},
|
|
3437
|
-
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i =
|
|
3436
|
+
}, Rn = (e) => {
|
|
3437
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = Vi(t);
|
|
3438
3438
|
if (!r || !i)
|
|
3439
3439
|
return "";
|
|
3440
3440
|
const a = Number(n) < 2 ? Number(n) : "other";
|
|
3441
|
-
return
|
|
3442
|
-
},
|
|
3441
|
+
return xi[t][a].replace("#", n) ?? "";
|
|
3442
|
+
}, qi = {
|
|
3443
3443
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
3444
3444
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
3445
|
-
localizedEstimates: (e) => e?.shippingEstimate ?
|
|
3446
|
-
},
|
|
3447
|
-
function
|
|
3448
|
-
const t = `${
|
|
3445
|
+
localizedEstimates: (e) => e?.shippingEstimate ? Rn(e.shippingEstimate) : ""
|
|
3446
|
+
}, en = "skuvariation";
|
|
3447
|
+
function nn(e, n) {
|
|
3448
|
+
const t = `${en}${n}`.toLowerCase(), r = e.find(
|
|
3449
3449
|
(a) => a.imageLabel === t
|
|
3450
3450
|
);
|
|
3451
3451
|
if (r)
|
|
3452
3452
|
return r;
|
|
3453
3453
|
const i = e.find(
|
|
3454
|
-
(a) => a.imageLabel ===
|
|
3454
|
+
(a) => a.imageLabel === en
|
|
3455
3455
|
);
|
|
3456
3456
|
return i || e[0];
|
|
3457
3457
|
}
|
|
3458
|
-
function
|
|
3458
|
+
function ji(e, n, t) {
|
|
3459
3459
|
const r = {};
|
|
3460
3460
|
return e.forEach((i) => {
|
|
3461
3461
|
const a = i.variations;
|
|
@@ -3463,34 +3463,34 @@ function xi(e, n, t) {
|
|
|
3463
3463
|
return;
|
|
3464
3464
|
const o = `${n}-${a.find(
|
|
3465
3465
|
(c) => c.name === n
|
|
3466
|
-
)?.values[0] ?? ""}`, s = a.reduce((c,
|
|
3466
|
+
)?.values[0] ?? ""}`, s = a.reduce((c, u) => u.name === n ? c : c + `-${u.name}-${u.values[0]}`, o);
|
|
3467
3467
|
r[s] = `${t}-${i.itemId}`;
|
|
3468
3468
|
}), r;
|
|
3469
3469
|
}
|
|
3470
|
-
function
|
|
3470
|
+
function tn(e) {
|
|
3471
3471
|
const n = {};
|
|
3472
3472
|
return e.forEach((t) => {
|
|
3473
3473
|
n[t.name] = t.values[0];
|
|
3474
3474
|
}), n;
|
|
3475
3475
|
}
|
|
3476
|
-
function
|
|
3476
|
+
function Wi(e) {
|
|
3477
3477
|
const n = {};
|
|
3478
3478
|
return e?.forEach((t) => {
|
|
3479
3479
|
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
3480
3480
|
}), n;
|
|
3481
3481
|
}
|
|
3482
|
-
function
|
|
3482
|
+
function Hi(e, n) {
|
|
3483
3483
|
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
3484
3484
|
}
|
|
3485
|
-
function
|
|
3485
|
+
function Gi(e) {
|
|
3486
3486
|
const n = e;
|
|
3487
3487
|
for (const t in e)
|
|
3488
3488
|
e[t].every(
|
|
3489
3489
|
(i) => !Number.isNaN(Number(i.value))
|
|
3490
|
-
) && e[t].sort((i, a) =>
|
|
3490
|
+
) && e[t].sort((i, a) => Hi(i.value, a.value));
|
|
3491
3491
|
return n;
|
|
3492
3492
|
}
|
|
3493
|
-
function
|
|
3493
|
+
function Xi(e, n, t) {
|
|
3494
3494
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
3495
3495
|
return e.forEach((a) => {
|
|
3496
3496
|
if (a.variations.length === 0)
|
|
@@ -3503,75 +3503,75 @@ function Hi(e, n, t) {
|
|
|
3503
3503
|
if (!o || i.has(c))
|
|
3504
3504
|
return;
|
|
3505
3505
|
i.add(c);
|
|
3506
|
-
const
|
|
3506
|
+
const u = nn(
|
|
3507
3507
|
a.images,
|
|
3508
3508
|
n
|
|
3509
|
-
),
|
|
3510
|
-
src:
|
|
3511
|
-
alt:
|
|
3509
|
+
), d = {
|
|
3510
|
+
src: u.imageUrl,
|
|
3511
|
+
alt: u.imageLabel ?? "",
|
|
3512
3512
|
label: `${n}: ${o.values[0]}`,
|
|
3513
3513
|
value: o.values[0]
|
|
3514
3514
|
};
|
|
3515
|
-
r[o.name] ? r[o.name].push(
|
|
3515
|
+
r[o.name] ? r[o.name].push(d) : r[o.name] = [d];
|
|
3516
3516
|
return;
|
|
3517
3517
|
}
|
|
3518
3518
|
a.variations.forEach((c) => {
|
|
3519
|
-
const
|
|
3520
|
-
if (i.has(
|
|
3519
|
+
const u = `${c.name}-${c.values[0]}`;
|
|
3520
|
+
if (i.has(u))
|
|
3521
3521
|
return;
|
|
3522
|
-
i.add(
|
|
3523
|
-
const
|
|
3522
|
+
i.add(u);
|
|
3523
|
+
const d = nn(
|
|
3524
3524
|
a.images,
|
|
3525
3525
|
c.name
|
|
3526
|
-
),
|
|
3527
|
-
src:
|
|
3528
|
-
alt:
|
|
3526
|
+
), g = {
|
|
3527
|
+
src: d.imageUrl,
|
|
3528
|
+
alt: d.imageText ?? "",
|
|
3529
3529
|
label: `${c.name}: ${c.values[0]}`,
|
|
3530
3530
|
value: c.values[0]
|
|
3531
3531
|
};
|
|
3532
|
-
r[c.name] ? r[c.name].push(
|
|
3532
|
+
r[c.name] ? r[c.name].push(g) : r[c.name] = [g];
|
|
3533
3533
|
});
|
|
3534
|
-
}),
|
|
3534
|
+
}), Gi(r);
|
|
3535
3535
|
}
|
|
3536
|
-
const
|
|
3537
|
-
activeVariations: (e) =>
|
|
3538
|
-
allVariantsByName: (e) =>
|
|
3539
|
-
slugsMap: (e, n) =>
|
|
3536
|
+
const Yi = {
|
|
3537
|
+
activeVariations: (e) => tn(e.variations),
|
|
3538
|
+
allVariantsByName: (e) => Wi(e.isVariantOf.skuSpecifications),
|
|
3539
|
+
slugsMap: (e, n) => ji(
|
|
3540
3540
|
e.isVariantOf.items,
|
|
3541
3541
|
n.dominantVariantName ?? e.variations[0]?.name,
|
|
3542
3542
|
e.isVariantOf.linkText
|
|
3543
3543
|
),
|
|
3544
3544
|
availableVariations: (e, n) => {
|
|
3545
|
-
const t = n.dominantVariantName ?? e.variations[0]?.name, i =
|
|
3546
|
-
return
|
|
3545
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = tn(e.variations)[t];
|
|
3546
|
+
return Xi(
|
|
3547
3547
|
e.isVariantOf.items,
|
|
3548
3548
|
t,
|
|
3549
3549
|
i
|
|
3550
3550
|
);
|
|
3551
3551
|
},
|
|
3552
3552
|
allVariantProducts: (e) => e.isVariantOf.items.map((n) => F(n, e.isVariantOf))
|
|
3553
|
-
},
|
|
3553
|
+
}, Ji = {
|
|
3554
3554
|
"pickup-in-point": "Pickup",
|
|
3555
3555
|
delivery: "Delivery",
|
|
3556
3556
|
pickup: "Pickup",
|
|
3557
3557
|
"take-away": "Take away",
|
|
3558
3558
|
"": ""
|
|
3559
|
-
},
|
|
3559
|
+
}, Ki = {
|
|
3560
3560
|
deliveryOptionsData: (e) => {
|
|
3561
3561
|
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
|
|
3562
|
-
(
|
|
3563
|
-
const
|
|
3564
|
-
(
|
|
3565
|
-
), A = `${
|
|
3562
|
+
(u, d) => {
|
|
3563
|
+
const g = d?.selectedSla || "", f = d?.selectedDeliveryChannel || d?.deliveryChannel || "", h = d?.deliveryCompany || "", b = d?.deliveryWindow, l = d?.pickupStoreInfo, p = d?.shippingEstimate || "", m = d?.shippingEstimate ? Rn(d?.shippingEstimate) : "", S = d?.shippingEstimateDate || "", v = d?.addressId || "", w = d?.itemIndex ?? 0, C = t?.[w], k = C?.seller || "", I = `${g}|${f}|${h}|${k}|${p}|${S}|${v}|${b?.startDateUtc}|${b?.endDateUtc}`, D = i?.find(
|
|
3564
|
+
(O) => O?.addressId === v
|
|
3565
|
+
), A = `${Ji[f] || ""} ${m} ${D?.neighborhood ? `to ${D?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: _, taxPriceTags: P } = Qi(
|
|
3566
3566
|
C?.priceTags ?? []
|
|
3567
3567
|
), R = (C?.sellingPrice ?? 0) * (C?.quantity ?? 0) + (C?.tax ?? 0) + (_ ?? 0);
|
|
3568
|
-
return
|
|
3568
|
+
return u[I] || (u[I] = {
|
|
3569
3569
|
// static fields
|
|
3570
|
-
selectedSla:
|
|
3570
|
+
selectedSla: g,
|
|
3571
3571
|
deliveryChannel: f,
|
|
3572
3572
|
deliveryCompany: h,
|
|
3573
|
-
deliveryWindow:
|
|
3574
|
-
shippingEstimate:
|
|
3573
|
+
deliveryWindow: b,
|
|
3574
|
+
shippingEstimate: p,
|
|
3575
3575
|
shippingEstimateDate: S,
|
|
3576
3576
|
seller: k,
|
|
3577
3577
|
friendlyShippingEstimate: m,
|
|
@@ -3582,7 +3582,7 @@ const Gi = {
|
|
|
3582
3582
|
quantityOfDifferentItems: 0,
|
|
3583
3583
|
total: 0,
|
|
3584
3584
|
items: []
|
|
3585
|
-
}),
|
|
3585
|
+
}), u[I] && (u[I].items?.push({
|
|
3586
3586
|
id: C?.id || "",
|
|
3587
3587
|
uniqueId: C?.uniqueId || "",
|
|
3588
3588
|
name: C?.name || "",
|
|
@@ -3594,7 +3594,7 @@ const Gi = {
|
|
|
3594
3594
|
taxPriceTagsTotal: _ ?? 0,
|
|
3595
3595
|
tax: C?.tax || 0,
|
|
3596
3596
|
total: R
|
|
3597
|
-
}),
|
|
3597
|
+
}), u[I].quantityOfDifferentItems = (u[I].quantityOfDifferentItems ?? 0) + 1, u[I].total = (u[I].total ?? 0) + R), u;
|
|
3598
3598
|
},
|
|
3599
3599
|
{}
|
|
3600
3600
|
), o = Object.values(a), s = n?.contactInformation?.[0], c = {
|
|
@@ -3620,7 +3620,7 @@ const Gi = {
|
|
|
3620
3620
|
) || [];
|
|
3621
3621
|
}
|
|
3622
3622
|
};
|
|
3623
|
-
function
|
|
3623
|
+
function Qi(e) {
|
|
3624
3624
|
const t = e.filter(
|
|
3625
3625
|
(i) => i?.name?.includes("TAX")
|
|
3626
3626
|
), r = t.reduce(
|
|
@@ -3632,28 +3632,28 @@ function Ji(e) {
|
|
|
3632
3632
|
taxPriceTagsTotal: r
|
|
3633
3633
|
};
|
|
3634
3634
|
}
|
|
3635
|
-
const
|
|
3636
|
-
StoreCollection:
|
|
3637
|
-
StoreAggregateOffer:
|
|
3638
|
-
StoreProduct:
|
|
3639
|
-
StoreSeo:
|
|
3640
|
-
StoreFacet:
|
|
3641
|
-
StoreFacetBoolean:
|
|
3642
|
-
StoreFacetRange:
|
|
3643
|
-
StoreFacetValueBoolean:
|
|
3644
|
-
StoreOffer:
|
|
3645
|
-
StoreAggregateRating:
|
|
3646
|
-
StoreReview:
|
|
3647
|
-
StoreProductGroup:
|
|
3648
|
-
StoreSearchResult:
|
|
3649
|
-
StorePropertyValue:
|
|
3650
|
-
SkuVariants:
|
|
3651
|
-
ShippingSLA:
|
|
3652
|
-
UserOrderResult:
|
|
3653
|
-
ObjectOrString:
|
|
3654
|
-
Query:
|
|
3655
|
-
Mutation:
|
|
3656
|
-
},
|
|
3635
|
+
const Zi = {
|
|
3636
|
+
StoreCollection: Sn,
|
|
3637
|
+
StoreAggregateOffer: ur,
|
|
3638
|
+
StoreProduct: bi,
|
|
3639
|
+
StoreSeo: Mi,
|
|
3640
|
+
StoreFacet: vr,
|
|
3641
|
+
StoreFacetBoolean: Or,
|
|
3642
|
+
StoreFacetRange: br,
|
|
3643
|
+
StoreFacetValueBoolean: Cr,
|
|
3644
|
+
StoreOffer: ui,
|
|
3645
|
+
StoreAggregateRating: pr,
|
|
3646
|
+
StoreReview: Li,
|
|
3647
|
+
StoreProductGroup: wi,
|
|
3648
|
+
StoreSearchResult: $i,
|
|
3649
|
+
StorePropertyValue: Di,
|
|
3650
|
+
SkuVariants: Yi,
|
|
3651
|
+
ShippingSLA: qi,
|
|
3652
|
+
UserOrderResult: Ki,
|
|
3653
|
+
ObjectOrString: di,
|
|
3654
|
+
Query: Ni,
|
|
3655
|
+
Mutation: si
|
|
3656
|
+
}, ea = () => Zi, na = `"""
|
|
3657
3657
|
Address information.
|
|
3658
3658
|
"""
|
|
3659
3659
|
type Address {
|
|
@@ -3698,7 +3698,7 @@ type Address {
|
|
|
3698
3698
|
"""
|
|
3699
3699
|
geoCoordinates: [Float]
|
|
3700
3700
|
}
|
|
3701
|
-
`,
|
|
3701
|
+
`, ta = `"""
|
|
3702
3702
|
Advertisement information about a specific product in a campaign
|
|
3703
3703
|
"""
|
|
3704
3704
|
type Advertisement {
|
|
@@ -3723,7 +3723,7 @@ type Advertisement {
|
|
|
3723
3723
|
"""
|
|
3724
3724
|
adResponseId: String!
|
|
3725
3725
|
}
|
|
3726
|
-
`,
|
|
3726
|
+
`, ra = `"""
|
|
3727
3727
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
3728
3728
|
"""
|
|
3729
3729
|
type StoreAggregateOffer {
|
|
@@ -3752,7 +3752,7 @@ type StoreAggregateOffer {
|
|
|
3752
3752
|
"""
|
|
3753
3753
|
offers: [StoreOffer!]!
|
|
3754
3754
|
}
|
|
3755
|
-
`,
|
|
3755
|
+
`, ia = `"""
|
|
3756
3756
|
Average rating, based on multiple ratings or reviews.
|
|
3757
3757
|
"""
|
|
3758
3758
|
type StoreAggregateRating {
|
|
@@ -3765,7 +3765,7 @@ type StoreAggregateRating {
|
|
|
3765
3765
|
"""
|
|
3766
3766
|
reviewCount: Int!
|
|
3767
3767
|
}
|
|
3768
|
-
`,
|
|
3768
|
+
`, aa = `"""
|
|
3769
3769
|
information about the author of a product review or rating.
|
|
3770
3770
|
"""
|
|
3771
3771
|
type StoreAuthor {
|
|
@@ -3774,7 +3774,7 @@ type StoreAuthor {
|
|
|
3774
3774
|
"""
|
|
3775
3775
|
name: String!
|
|
3776
3776
|
}
|
|
3777
|
-
`,
|
|
3777
|
+
`, oa = `"""
|
|
3778
3778
|
Brand of a given product.
|
|
3779
3779
|
"""
|
|
3780
3780
|
type StoreBrand {
|
|
@@ -3783,7 +3783,7 @@ type StoreBrand {
|
|
|
3783
3783
|
"""
|
|
3784
3784
|
name: String!
|
|
3785
3785
|
}
|
|
3786
|
-
`,
|
|
3786
|
+
`, sa = `"""
|
|
3787
3787
|
Item of a list.
|
|
3788
3788
|
"""
|
|
3789
3789
|
type StoreListItem {
|
|
@@ -3814,7 +3814,7 @@ type StoreBreadcrumbList {
|
|
|
3814
3814
|
"""
|
|
3815
3815
|
numberOfItems: Int!
|
|
3816
3816
|
}
|
|
3817
|
-
`,
|
|
3817
|
+
`, ca = `"""
|
|
3818
3818
|
Shopping cart message.
|
|
3819
3819
|
"""
|
|
3820
3820
|
type StoreCartMessage {
|
|
@@ -3851,7 +3851,7 @@ input IStoreCart {
|
|
|
3851
3851
|
"""
|
|
3852
3852
|
order: IStoreOrder!
|
|
3853
3853
|
}
|
|
3854
|
-
`,
|
|
3854
|
+
`, la = `"""
|
|
3855
3855
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\` or \`Collection\`.
|
|
3856
3856
|
|
|
3857
3857
|
\`SubCategory\` and \`Cluster\` are still declared for backward compatibility but are
|
|
@@ -3948,9 +3948,20 @@ type StoreCollection {
|
|
|
3948
3948
|
type: StoreCollectionType!
|
|
3949
3949
|
"""
|
|
3950
3950
|
Localized versions of this collection for all available locales.
|
|
3951
|
-
Only
|
|
3951
|
+
Only announces slugs the catalog has registered for each locale, so it is safe
|
|
3952
|
+
to build hreflang annotations from. Only populated when localization is
|
|
3953
|
+
enabled.
|
|
3952
3954
|
"""
|
|
3953
3955
|
otherLocales: [StoreCollectionLocale!]
|
|
3956
|
+
"""
|
|
3957
|
+
Slug the catalog resolves for the requested locale, lowercased.
|
|
3958
|
+
Meant for the page's canonical URL: \`slug\` echoes the path the shopper
|
|
3959
|
+
visited, and by-linkid matches case-insensitively, so without this every
|
|
3960
|
+
casing variant would claim to be canonical. Unlike \`otherLocales\`, it may fall
|
|
3961
|
+
back to a slug registered for another locale, so it must never be used to
|
|
3962
|
+
build hreflang annotations.
|
|
3963
|
+
"""
|
|
3964
|
+
canonicalSlug: String
|
|
3954
3965
|
}
|
|
3955
3966
|
|
|
3956
3967
|
"""
|
|
@@ -3966,7 +3977,7 @@ type StoreCollectionLocale {
|
|
|
3966
3977
|
"""
|
|
3967
3978
|
slug: String!
|
|
3968
3979
|
}
|
|
3969
|
-
`,
|
|
3980
|
+
`, da = `"""
|
|
3970
3981
|
Delivery Promise badge.
|
|
3971
3982
|
"""
|
|
3972
3983
|
type DeliveryPromiseBadge {
|
|
@@ -3975,7 +3986,7 @@ type DeliveryPromiseBadge {
|
|
|
3975
3986
|
"""
|
|
3976
3987
|
typeName: String
|
|
3977
3988
|
}
|
|
3978
|
-
`,
|
|
3989
|
+
`, ua = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
3979
3990
|
|
|
3980
3991
|
"""
|
|
3981
3992
|
Search facet range information.
|
|
@@ -4052,7 +4063,7 @@ type StoreFacetValueBoolean {
|
|
|
4052
4063
|
"""
|
|
4053
4064
|
quantity: Int
|
|
4054
4065
|
}
|
|
4055
|
-
`,
|
|
4066
|
+
`, pa = `"""
|
|
4056
4067
|
Image.
|
|
4057
4068
|
"""
|
|
4058
4069
|
type StoreImage {
|
|
@@ -4079,7 +4090,7 @@ input IStoreImage {
|
|
|
4079
4090
|
"""
|
|
4080
4091
|
alternateName: String!
|
|
4081
4092
|
}
|
|
4082
|
-
`,
|
|
4093
|
+
`, ga = `type Mutation {
|
|
4083
4094
|
"""
|
|
4084
4095
|
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\`.
|
|
4085
4096
|
"""
|
|
@@ -4121,7 +4132,7 @@ input IStoreImage {
|
|
|
4121
4132
|
"""
|
|
4122
4133
|
startRecommendationSession: Boolean!
|
|
4123
4134
|
}
|
|
4124
|
-
`,
|
|
4135
|
+
`, ma = `"""
|
|
4125
4136
|
Newsletter information.
|
|
4126
4137
|
"""
|
|
4127
4138
|
type PersonNewsletter {
|
|
@@ -4144,8 +4155,8 @@ input IPersonNewsletter {
|
|
|
4144
4155
|
"""
|
|
4145
4156
|
email: String!
|
|
4146
4157
|
}
|
|
4147
|
-
`,
|
|
4148
|
-
`,
|
|
4158
|
+
`, ha = `scalar ObjectOrString
|
|
4159
|
+
`, fa = `"""
|
|
4149
4160
|
Offer information.
|
|
4150
4161
|
"""
|
|
4151
4162
|
type StoreOffer {
|
|
@@ -4238,7 +4249,7 @@ input IStoreOffer {
|
|
|
4238
4249
|
"""
|
|
4239
4250
|
priceToken: String
|
|
4240
4251
|
}
|
|
4241
|
-
`,
|
|
4252
|
+
`, Sa = `"""
|
|
4242
4253
|
Information of a specific order.
|
|
4243
4254
|
"""
|
|
4244
4255
|
type StoreOrder {
|
|
@@ -4279,7 +4290,7 @@ input IStoreOrder {
|
|
|
4279
4290
|
"""
|
|
4280
4291
|
shouldSplitItem: Boolean
|
|
4281
4292
|
}
|
|
4282
|
-
`,
|
|
4293
|
+
`, ya = `"""
|
|
4283
4294
|
Commercial Authorization response.
|
|
4284
4295
|
"""
|
|
4285
4296
|
type CommercialAuthorizationResponse {
|
|
@@ -4678,7 +4689,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
4678
4689
|
"""
|
|
4679
4690
|
rule: CommercialAuthorizationRule!
|
|
4680
4691
|
}
|
|
4681
|
-
`,
|
|
4692
|
+
`, Ia = `"""
|
|
4682
4693
|
Input for uploading a file to the Order Entry Service.
|
|
4683
4694
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
4684
4695
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -4739,7 +4750,7 @@ type StoreOrderFormCartItem {
|
|
|
4739
4750
|
seller: String!
|
|
4740
4751
|
unitMultiplier: Float
|
|
4741
4752
|
}
|
|
4742
|
-
`,
|
|
4753
|
+
`, va = `"""
|
|
4743
4754
|
Organization.
|
|
4744
4755
|
"""
|
|
4745
4756
|
type StoreOrganization {
|
|
@@ -4776,7 +4787,7 @@ type StoreContract {
|
|
|
4776
4787
|
"""
|
|
4777
4788
|
isActive: Boolean!
|
|
4778
4789
|
}
|
|
4779
|
-
`,
|
|
4790
|
+
`, Oa = `"""
|
|
4780
4791
|
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.
|
|
4781
4792
|
"""
|
|
4782
4793
|
type StorePageInfo {
|
|
@@ -4801,7 +4812,7 @@ type StorePageInfo {
|
|
|
4801
4812
|
"""
|
|
4802
4813
|
totalCount: Int!
|
|
4803
4814
|
}
|
|
4804
|
-
`,
|
|
4815
|
+
`, ba = `"""
|
|
4805
4816
|
Input type for setting a new password.
|
|
4806
4817
|
"""
|
|
4807
4818
|
input ISetPassword {
|
|
@@ -4844,7 +4855,7 @@ type SetPasswordResponse {
|
|
|
4844
4855
|
"""
|
|
4845
4856
|
message: String
|
|
4846
4857
|
}
|
|
4847
|
-
`,
|
|
4858
|
+
`, Ca = `"""
|
|
4848
4859
|
Client profile data.
|
|
4849
4860
|
"""
|
|
4850
4861
|
type StorePerson {
|
|
@@ -4887,7 +4898,7 @@ input IStorePerson {
|
|
|
4887
4898
|
"""
|
|
4888
4899
|
familyName: String!
|
|
4889
4900
|
}
|
|
4890
|
-
`,
|
|
4901
|
+
`, wa = `type PickupPointAddress {
|
|
4891
4902
|
"""
|
|
4892
4903
|
Address city.
|
|
4893
4904
|
"""
|
|
@@ -4966,7 +4977,7 @@ type PickupPoints {
|
|
|
4966
4977
|
"""
|
|
4967
4978
|
pickupPointsHash: String
|
|
4968
4979
|
}
|
|
4969
|
-
`,
|
|
4980
|
+
`, Da = `"""
|
|
4970
4981
|
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.
|
|
4971
4982
|
"""
|
|
4972
4983
|
type StoreProduct {
|
|
@@ -5142,7 +5153,7 @@ input IStoreProduct {
|
|
|
5142
5153
|
"""
|
|
5143
5154
|
additionalProperty: [IStorePropertyValue!]
|
|
5144
5155
|
}
|
|
5145
|
-
`,
|
|
5156
|
+
`, Aa = `"""
|
|
5146
5157
|
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.
|
|
5147
5158
|
"""
|
|
5148
5159
|
type StoreProductGroup {
|
|
@@ -5169,7 +5180,7 @@ type StoreProductGroup {
|
|
|
5169
5180
|
"""
|
|
5170
5181
|
skuVariants: SkuVariants
|
|
5171
5182
|
}
|
|
5172
|
-
`,
|
|
5183
|
+
`, Pa = `type Profile {
|
|
5173
5184
|
"""
|
|
5174
5185
|
Collection of user's address
|
|
5175
5186
|
"""
|
|
@@ -5230,7 +5241,7 @@ type ProfileAddress {
|
|
|
5230
5241
|
"""
|
|
5231
5242
|
geoCoordinate: [Float]
|
|
5232
5243
|
}
|
|
5233
|
-
`,
|
|
5244
|
+
`, _a = `"""
|
|
5234
5245
|
Properties that can be associated with products and products groups.
|
|
5235
5246
|
"""
|
|
5236
5247
|
type StorePropertyValue {
|
|
@@ -5270,7 +5281,7 @@ input IStorePropertyValue {
|
|
|
5270
5281
|
"""
|
|
5271
5282
|
valueReference: ObjectOrString!
|
|
5272
5283
|
}
|
|
5273
|
-
`,
|
|
5284
|
+
`, ka = `"""
|
|
5274
5285
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
5275
5286
|
"""
|
|
5276
5287
|
type StoreProductEdge {
|
|
@@ -5919,7 +5930,7 @@ type StoreAccountProfile {
|
|
|
5919
5930
|
email: String
|
|
5920
5931
|
id: String
|
|
5921
5932
|
}
|
|
5922
|
-
`,
|
|
5933
|
+
`, Ea = `"""
|
|
5923
5934
|
Summary of a quote returned in list results.
|
|
5924
5935
|
"""
|
|
5925
5936
|
type UserQuoteSummary {
|
|
@@ -5984,7 +5995,7 @@ type UserQuoteListPaging {
|
|
|
5984
5995
|
"""
|
|
5985
5996
|
perPage: Int!
|
|
5986
5997
|
}
|
|
5987
|
-
`,
|
|
5998
|
+
`, Ta = `type RecommendationResponse {
|
|
5988
5999
|
products: [StoreProduct!]!
|
|
5989
6000
|
correlationId: String!
|
|
5990
6001
|
campaign: RecommendationCampaign!
|
|
@@ -5995,7 +6006,7 @@ type RecommendationCampaign {
|
|
|
5995
6006
|
title: String
|
|
5996
6007
|
type: String!
|
|
5997
6008
|
}
|
|
5998
|
-
`,
|
|
6009
|
+
`, Ua = `"""
|
|
5999
6010
|
Information of a given review rating.
|
|
6000
6011
|
"""
|
|
6001
6012
|
type StoreReviewRating {
|
|
@@ -6022,7 +6033,7 @@ type StoreReview {
|
|
|
6022
6033
|
"""
|
|
6023
6034
|
author: StoreAuthor!
|
|
6024
6035
|
}
|
|
6025
|
-
`,
|
|
6036
|
+
`, Ra = `"""
|
|
6026
6037
|
Whether a saved card is personally owned by the buyer or shared by their
|
|
6027
6038
|
Organization/Contract. Resolved server-side by the Saved-cards service from
|
|
6028
6039
|
the buyer's \`useAdHocCard\` role — never inferred client-side.
|
|
@@ -6086,7 +6097,7 @@ type SavedCardListResult {
|
|
|
6086
6097
|
"""
|
|
6087
6098
|
list: [SavedCard!]
|
|
6088
6099
|
}
|
|
6089
|
-
`,
|
|
6100
|
+
`, Fa = `"""
|
|
6090
6101
|
Search Engine Optimization (SEO) tags data.
|
|
6091
6102
|
"""
|
|
6092
6103
|
type StoreSeo {
|
|
@@ -6107,7 +6118,7 @@ type StoreSeo {
|
|
|
6107
6118
|
"""
|
|
6108
6119
|
canonical: String!
|
|
6109
6120
|
}
|
|
6110
|
-
`,
|
|
6121
|
+
`, Na = `"""
|
|
6111
6122
|
Currency information.
|
|
6112
6123
|
"""
|
|
6113
6124
|
type StoreCurrency {
|
|
@@ -6382,7 +6393,7 @@ input IStoreSession {
|
|
|
6382
6393
|
"""
|
|
6383
6394
|
refreshAfter: String
|
|
6384
6395
|
}
|
|
6385
|
-
`,
|
|
6396
|
+
`, La = `"""
|
|
6386
6397
|
Shipping Simulation item input.
|
|
6387
6398
|
"""
|
|
6388
6399
|
input IShippingItem {
|
|
@@ -6713,7 +6724,7 @@ type MessageFields {
|
|
|
6713
6724
|
"""
|
|
6714
6725
|
skuName: String
|
|
6715
6726
|
}
|
|
6716
|
-
`,
|
|
6727
|
+
`, Ba = `type SkuVariants {
|
|
6717
6728
|
"""
|
|
6718
6729
|
SKU property values for the current SKU.
|
|
6719
6730
|
"""
|
|
@@ -6808,7 +6819,7 @@ Example:
|
|
|
6808
6819
|
\`\`\`
|
|
6809
6820
|
"""
|
|
6810
6821
|
scalar FormattedVariants
|
|
6811
|
-
`,
|
|
6822
|
+
`, $a = `"""
|
|
6812
6823
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
6813
6824
|
"""
|
|
6814
6825
|
enum StoreStatus {
|
|
@@ -6816,7 +6827,7 @@ enum StoreStatus {
|
|
|
6816
6827
|
WARNING
|
|
6817
6828
|
ERROR
|
|
6818
6829
|
}
|
|
6819
|
-
`,
|
|
6830
|
+
`, Ma = `scalar JSONObject
|
|
6820
6831
|
|
|
6821
6832
|
type UserOrder {
|
|
6822
6833
|
orderId: String
|
|
@@ -7640,96 +7651,96 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
7640
7651
|
type: String
|
|
7641
7652
|
id: String
|
|
7642
7653
|
}
|
|
7643
|
-
`,
|
|
7644
|
-
"./address.graphql":
|
|
7645
|
-
"./advertisement.graphql":
|
|
7646
|
-
"./aggregateOffer.graphql":
|
|
7647
|
-
"./aggregateRating.graphql":
|
|
7648
|
-
"./author.graphql":
|
|
7649
|
-
"./brand.graphql":
|
|
7650
|
-
"./breadcrumb.graphql":
|
|
7651
|
-
"./cart.graphql":
|
|
7652
|
-
"./collection.graphql":
|
|
7653
|
-
"./deliveryPromisesBadge.graphql":
|
|
7654
|
-
"./facet.graphql":
|
|
7655
|
-
"./image.graphql":
|
|
7656
|
-
"./mutation.graphql":
|
|
7657
|
-
"./newsletter.graphql":
|
|
7658
|
-
"./objectOrString.graphql":
|
|
7659
|
-
"./offer.graphql":
|
|
7660
|
-
"./order.graphql":
|
|
7661
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
7662
|
-
"./orderEntry.graphql":
|
|
7663
|
-
"./organization.graphql":
|
|
7664
|
-
"./pageInfo.graphql":
|
|
7665
|
-
"./password.graphql":
|
|
7666
|
-
"./person.graphql":
|
|
7667
|
-
"./pickupPoints.graphql":
|
|
7668
|
-
"./product.graphql":
|
|
7669
|
-
"./productGroup.graphql":
|
|
7670
|
-
"./profile.graphql":
|
|
7671
|
-
"./propertyValue.graphql":
|
|
7672
|
-
"./query.graphql":
|
|
7673
|
-
"./quote.graphql":
|
|
7674
|
-
"./recommendation.graphql":
|
|
7675
|
-
"./review.graphql":
|
|
7676
|
-
"./savedCard.graphql":
|
|
7677
|
-
"./seo.graphql":
|
|
7678
|
-
"./session.graphql":
|
|
7679
|
-
"./shipping.graphql":
|
|
7680
|
-
"./skuVariants.graphql":
|
|
7681
|
-
"./status.graphql":
|
|
7682
|
-
"./userOrder.graphql":
|
|
7683
|
-
}),
|
|
7684
|
-
Object.values(
|
|
7685
|
-
(e, n) =>
|
|
7654
|
+
`, za = /* @__PURE__ */ Object.assign({
|
|
7655
|
+
"./address.graphql": na,
|
|
7656
|
+
"./advertisement.graphql": ta,
|
|
7657
|
+
"./aggregateOffer.graphql": ra,
|
|
7658
|
+
"./aggregateRating.graphql": ia,
|
|
7659
|
+
"./author.graphql": aa,
|
|
7660
|
+
"./brand.graphql": oa,
|
|
7661
|
+
"./breadcrumb.graphql": sa,
|
|
7662
|
+
"./cart.graphql": ca,
|
|
7663
|
+
"./collection.graphql": la,
|
|
7664
|
+
"./deliveryPromisesBadge.graphql": da,
|
|
7665
|
+
"./facet.graphql": ua,
|
|
7666
|
+
"./image.graphql": pa,
|
|
7667
|
+
"./mutation.graphql": ga,
|
|
7668
|
+
"./newsletter.graphql": ma,
|
|
7669
|
+
"./objectOrString.graphql": ha,
|
|
7670
|
+
"./offer.graphql": fa,
|
|
7671
|
+
"./order.graphql": Sa,
|
|
7672
|
+
"./orderCommercialAuthorizaton.graphql": ya,
|
|
7673
|
+
"./orderEntry.graphql": Ia,
|
|
7674
|
+
"./organization.graphql": va,
|
|
7675
|
+
"./pageInfo.graphql": Oa,
|
|
7676
|
+
"./password.graphql": ba,
|
|
7677
|
+
"./person.graphql": Ca,
|
|
7678
|
+
"./pickupPoints.graphql": wa,
|
|
7679
|
+
"./product.graphql": Da,
|
|
7680
|
+
"./productGroup.graphql": Aa,
|
|
7681
|
+
"./profile.graphql": Pa,
|
|
7682
|
+
"./propertyValue.graphql": _a,
|
|
7683
|
+
"./query.graphql": ka,
|
|
7684
|
+
"./quote.graphql": Ea,
|
|
7685
|
+
"./recommendation.graphql": Ta,
|
|
7686
|
+
"./review.graphql": Ua,
|
|
7687
|
+
"./savedCard.graphql": Ra,
|
|
7688
|
+
"./seo.graphql": Fa,
|
|
7689
|
+
"./session.graphql": Na,
|
|
7690
|
+
"./shipping.graphql": La,
|
|
7691
|
+
"./skuVariants.graphql": Ba,
|
|
7692
|
+
"./status.graphql": $a,
|
|
7693
|
+
"./userOrder.graphql": Ma
|
|
7694
|
+
}), Va = zn(
|
|
7695
|
+
Object.values(za).map((e) => Vn(e)).reduce(
|
|
7696
|
+
(e, n) => rn([e, n], { sort: !0 })
|
|
7686
7697
|
)
|
|
7687
|
-
),
|
|
7698
|
+
), xa = Va, oo = async (e) => (n) => (n.storage = {
|
|
7688
7699
|
channel: ee.parse(e.channel),
|
|
7689
7700
|
flags: e.flags ?? {},
|
|
7690
7701
|
locale: e.locale,
|
|
7691
7702
|
cookies: /* @__PURE__ */ new Map()
|
|
7692
|
-
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients =
|
|
7693
|
-
function
|
|
7694
|
-
const e =
|
|
7703
|
+
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients = Kt(e, n), n.loaders = sr(e, n), n);
|
|
7704
|
+
function qa() {
|
|
7705
|
+
const e = ea(), n = {};
|
|
7695
7706
|
for (const [t, r] of Object.entries(e))
|
|
7696
7707
|
n[t] = Object.fromEntries(
|
|
7697
|
-
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i,
|
|
7708
|
+
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, lt(a, `${t}(${i})`)])
|
|
7698
7709
|
);
|
|
7699
7710
|
return n;
|
|
7700
7711
|
}
|
|
7701
|
-
function
|
|
7702
|
-
const t =
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
])(
|
|
7706
|
-
return e &&
|
|
7712
|
+
function so(e) {
|
|
7713
|
+
const t = st([
|
|
7714
|
+
ot,
|
|
7715
|
+
rt
|
|
7716
|
+
])(qa(), xa);
|
|
7717
|
+
return e && xn(e) ? $n({
|
|
7707
7718
|
schemas: [t, e]
|
|
7708
7719
|
}) : t;
|
|
7709
7720
|
}
|
|
7710
7721
|
export {
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7722
|
+
rt as AuthDirective,
|
|
7723
|
+
E as BadRequestError,
|
|
7724
|
+
ot as CacheControlDirective,
|
|
7725
|
+
Gn as CardOrigin,
|
|
7726
|
+
Xn as CommercialAuthorizationStatus,
|
|
7716
7727
|
Z as FastStoreError,
|
|
7717
7728
|
J as ForbiddenError,
|
|
7718
|
-
|
|
7719
|
-
|
|
7729
|
+
oo as GraphqlVtexContextFactory,
|
|
7730
|
+
so as GraphqlVtexSchema,
|
|
7720
7731
|
$ as NotFoundError,
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7732
|
+
Yn as StoreCollectionType,
|
|
7733
|
+
Jn as StoreFacetType,
|
|
7734
|
+
Kn as StoreSort,
|
|
7735
|
+
Qn as StoreStatus,
|
|
7736
|
+
ie as UnauthorizedError,
|
|
7737
|
+
Zn as UserOrderInvoiceType,
|
|
7738
|
+
io as isBadRequestError,
|
|
7739
|
+
ro as isFastStoreError,
|
|
7740
|
+
dt as isForbiddenError,
|
|
7730
7741
|
Y as isNotFoundError,
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7742
|
+
ao as isUnauthorizedError,
|
|
7743
|
+
to as stringifyCacheControl,
|
|
7744
|
+
xa as typeDefs,
|
|
7745
|
+
st as withDirectives
|
|
7735
7746
|
};
|