@faststore/api 4.6.1-dev.0 → 4.7.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +128 -45
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +1010 -851
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/__generated__/schema.d.ts +55 -0
- package/dist/src/__generated__/schema.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts +14 -1
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/index.d.ts +7 -0
- package/dist/src/platforms/vtex/clients/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/index.d.ts +14 -0
- package/dist/src/platforms/vtex/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/getOrderEntryOperation.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/index.d.ts +14 -0
- package/dist/src/platforms/vtex/resolvers/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts +14 -0
- package/dist/src/platforms/vtex/resolvers/query.d.ts.map +1 -1
- package/dist/src/platforms/vtex/utils/cookies.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/__generated__/schema.ts +58 -0
- package/src/platforms/vtex/clients/commerce/index.ts +42 -0
- package/src/platforms/vtex/resolvers/query.ts +54 -0
- package/src/platforms/vtex/typeDefs/query.graphql +19 -0
- package/src/platforms/vtex/typeDefs/savedCard.graphql +64 -0
- package/src/platforms/vtex/utils/cookies.ts +8 -1
package/dist/es/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { mergeTypeDefs as tn } from "@graphql-tools/merge";
|
|
2
2
|
import { makeExecutableSchema as Nn, mergeSchemas as Ln } from "@graphql-tools/schema";
|
|
3
|
-
import { mapSchema as rn, MapperKind as
|
|
3
|
+
import { mapSchema as rn, MapperKind as an, getDirective as on } from "@graphql-tools/utils";
|
|
4
4
|
import { GraphQLScalarType as Bn, print as $n, parse as Mn, isSchema as zn } from "graphql";
|
|
5
|
-
import { logger as Vn, OTELAPI as
|
|
5
|
+
import { logger as Vn, OTELAPI as M } from "@faststore/diagnostics";
|
|
6
6
|
import xn from "isomorphic-unfetch";
|
|
7
7
|
import { parse as Q } from "cookie";
|
|
8
8
|
import we from "p-limit";
|
|
@@ -10,8 +10,8 @@ import de from "dataloader";
|
|
|
10
10
|
import qn from "sanitize-html";
|
|
11
11
|
import De from "fast-deep-equal";
|
|
12
12
|
import jn from "node:crypto";
|
|
13
|
-
var Wn = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(
|
|
14
|
-
const
|
|
13
|
+
var Wn = /* @__PURE__ */ ((e) => (e.Personal = "personal", e.Shared = "shared", e))(Wn || {}), Gn = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(Gn || {}), Hn = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(Hn || {}), Xn = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(Xn || {}), Yn = /* @__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))(Yn || {}), Jn = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(Jn || {}), Kn = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(Kn || {});
|
|
14
|
+
const Qn = () => 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 Y("No authentication AppKey and AppToken passed.");
|
|
@@ -20,7 +20,7 @@ const Kn = () => function(n = {}) {
|
|
|
20
20
|
"X-VTEX-API-AppKey": t,
|
|
21
21
|
"X-VTEX-API-AppToken": r
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, Zn = async (e) => {
|
|
24
24
|
const {
|
|
25
25
|
clients: { commerce: n }
|
|
26
26
|
} = e;
|
|
@@ -31,88 +31,88 @@ const Kn = () => function(n = {}) {
|
|
|
31
31
|
const r = t.extensions?.status ?? t.status;
|
|
32
32
|
throw r === 401 ? new re("Authentication required") : r === 403 ? new Y("You are not allowed to access this resource") : new re("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, et = "auth", nt = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
36
|
transformer: (e) => rn(e, {
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
37
|
+
[an.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (on(e, n, et)?.[0]) {
|
|
39
39
|
const r = n.resolve;
|
|
40
|
-
n.resolve = async (i,
|
|
40
|
+
n.resolve = async (i, a, o, s) => (await Zn(o), r?.(i, a, o, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, tt = "cacheControl", Ya = (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
|
+
}, _e = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, rt = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, it = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
54
|
transformer: (e) => rn(e, {
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
55
|
+
[an.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = on(e, n, tt)?.[0];
|
|
57
57
|
if (t) {
|
|
58
|
-
const { sMaxAge: r, staleWhileRevalidate: i, scope:
|
|
58
|
+
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
|
|
59
59
|
n.resolve = (s, c, d, u) => (d.cacheControl = {
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
60
|
+
sMaxAge: _e(d.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: _e(
|
|
62
62
|
d.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
66
|
-
},
|
|
65
|
+
scope: rt(d.cacheControl?.scope, a)
|
|
66
|
+
}, o?.(s, c, d, u));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
71
|
+
}, at = (e) => (n, t) => {
|
|
72
72
|
const r = tn([
|
|
73
73
|
...(e ?? []).map(({ typeDefs: i }) => i),
|
|
74
74
|
t
|
|
75
75
|
]);
|
|
76
76
|
return (e ?? []).reduce(
|
|
77
|
-
(i, { transformer:
|
|
77
|
+
(i, { transformer: a }) => a?.(i) ?? i,
|
|
78
78
|
Nn({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
}, sn = "@faststore/api", cn = "4.6.0",
|
|
83
|
+
}, sn = "@faststore/api", cn = "4.6.1-dev.0", ke = {
|
|
84
84
|
name: sn,
|
|
85
85
|
version: cn
|
|
86
|
-
}, ot = Vn("@faststore/api"),
|
|
86
|
+
}, ot = Vn("@faststore/api"), st = (e, n = "Unknown Graphql Resolver") => (t, r, i, a) => {
|
|
87
87
|
if (!i?.OTEL_ENABLED)
|
|
88
|
-
return e(t, r, i,
|
|
89
|
-
const
|
|
90
|
-
kind:
|
|
88
|
+
return e(t, r, i, a);
|
|
89
|
+
const o = M.trace.getTracer("Graphql").startSpan(n, {
|
|
90
|
+
kind: M.SpanKind.INTERNAL,
|
|
91
91
|
attributes: {
|
|
92
92
|
timestamp: Date.now(),
|
|
93
93
|
"@faststore_version": cn,
|
|
94
94
|
"@faststore_package_name": sn,
|
|
95
95
|
"@faststore_account_name": i.account,
|
|
96
96
|
"@faststore_environment": process.env.NODE_ENV,
|
|
97
|
-
"@faststore_resolver_parent_type":
|
|
98
|
-
"@faststore_resolver_field_name":
|
|
97
|
+
"@faststore_resolver_parent_type": a?.parentType?.name,
|
|
98
|
+
"@faststore_resolver_field_name": a?.fieldName
|
|
99
99
|
}
|
|
100
|
-
}), s =
|
|
100
|
+
}), s = M.trace.setSpan(M.context.active(), o);
|
|
101
101
|
try {
|
|
102
|
-
const c =
|
|
102
|
+
const c = M.context.with(
|
|
103
103
|
s,
|
|
104
|
-
() => e(t, r, i,
|
|
104
|
+
() => e(t, r, i, a)
|
|
105
105
|
);
|
|
106
106
|
return c instanceof Promise ? c.then(
|
|
107
|
-
(d) => (
|
|
108
|
-
(d) =>
|
|
109
|
-
) : (
|
|
107
|
+
(d) => (o.end(), d),
|
|
108
|
+
(d) => Ee(d, o, n)
|
|
109
|
+
) : (o.end(), c);
|
|
110
110
|
} catch (c) {
|
|
111
|
-
return
|
|
111
|
+
return Ee(c, o, n);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
function
|
|
115
|
-
throw n.setStatus({ code:
|
|
114
|
+
function Ee(e, n, t) {
|
|
115
|
+
throw n.setStatus({ code: M.SpanStatusCode.ERROR }), n.recordException(e), n.end(), console.error(`Error at resolver: ${t}:
|
|
116
116
|
%o`, e), ot("error", `Error at resolver: %s
|
|
117
117
|
%o`, t, e), e;
|
|
118
118
|
}
|
|
@@ -121,7 +121,7 @@ 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
|
}
|
|
@@ -136,17 +136,17 @@ class Y extends Z {
|
|
|
136
136
|
super({ status: 403, type: "ForbiddenError" }, n);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
class
|
|
139
|
+
class $ extends Z {
|
|
140
140
|
constructor(n) {
|
|
141
141
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
144
|
+
const Ja = (e) => e?.name === "FastStoreError", Ka = (e) => e?.extensions?.type === "BadRequestError", Qa = (e) => e?.extensions?.type === "UnauthorizedError", ct = (e) => e?.extensions?.type === "ForbiddenError", X = (e) => e?.extensions?.type === "NotFoundError", lt = `${ke.name}@${ke.version}`, y = async (e, n, t) => {
|
|
145
145
|
const r = await xn(e, {
|
|
146
146
|
...n,
|
|
147
147
|
headers: {
|
|
148
148
|
...n?.headers ?? {},
|
|
149
|
-
"User-Agent":
|
|
149
|
+
"User-Agent": lt
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
if (r.ok)
|
|
@@ -156,13 +156,13 @@ const Xo = (e) => e?.name === "FastStoreError", Yo = (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
161
|
throw new re(i);
|
|
162
162
|
case 403:
|
|
163
163
|
throw new Y(i);
|
|
164
164
|
case 404:
|
|
165
|
-
throw new
|
|
165
|
+
throw new $(i);
|
|
166
166
|
default:
|
|
167
167
|
throw new Z(
|
|
168
168
|
{ status: r.status, type: "UnknownError" },
|
|
@@ -170,7 +170,7 @@ const Xo = (e) => e?.name === "FastStoreError", Yo = (e) => e?.extensions?.type
|
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
throw new Error(i);
|
|
173
|
-
},
|
|
173
|
+
}, dt = ({ 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}`, {
|
|
@@ -186,17 +186,17 @@ const Xo = (e) => e?.name === "FastStoreError", Yo = (e) => e?.extensions?.type
|
|
|
186
186
|
return e;
|
|
187
187
|
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
188
188
|
return t.forEach((i) => {
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
const
|
|
192
|
-
if (
|
|
193
|
-
const s =
|
|
189
|
+
const a = i.trim();
|
|
190
|
+
if (a) {
|
|
191
|
+
const o = a.indexOf("=");
|
|
192
|
+
if (o > 0) {
|
|
193
|
+
const s = a.substring(0, o), c = a.substring(o + 1);
|
|
194
194
|
n.has(s) || r.push(s), n.set(s, c);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
198
|
-
},
|
|
199
|
-
const t = n.match(
|
|
198
|
+
}, ut = /^([^=]+)=([^;]*)/, pt = (e, n) => {
|
|
199
|
+
const t = n.match(ut);
|
|
200
200
|
if (t) {
|
|
201
201
|
const r = t[1], i = t[2];
|
|
202
202
|
e.storage.cookies.set(r, {
|
|
@@ -204,19 +204,19 @@ const Xo = (e) => e?.name === "FastStoreError", Yo = (e) => e?.extensions?.type
|
|
|
204
204
|
setCookie: n
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
},
|
|
207
|
+
}, gt = (e, n) => {
|
|
208
208
|
n.getSetCookie().forEach(
|
|
209
|
-
(t) =>
|
|
209
|
+
(t) => pt(e, t)
|
|
210
210
|
);
|
|
211
|
-
},
|
|
211
|
+
}, mt = (e) => (n) => gt(e, n), pe = (e) => {
|
|
212
212
|
if (!e.headers?.cookie)
|
|
213
213
|
return null;
|
|
214
214
|
const n = ln(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
215
215
|
return t.length === 0 ? n : t.reduce(
|
|
216
|
-
(r, [i, { value:
|
|
216
|
+
(r, [i, { value: a }]) => ht(
|
|
217
217
|
r,
|
|
218
218
|
i,
|
|
219
|
-
|
|
219
|
+
a
|
|
220
220
|
),
|
|
221
221
|
n
|
|
222
222
|
);
|
|
@@ -226,25 +226,31 @@ const Xo = (e) => e?.name === "FastStoreError", Yo = (e) => e?.extensions?.type
|
|
|
226
226
|
...t,
|
|
227
227
|
cookie: r
|
|
228
228
|
} : t;
|
|
229
|
-
},
|
|
229
|
+
}, L = (e, n) => {
|
|
230
230
|
const t = ln(e);
|
|
231
231
|
return Q(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
232
|
-
},
|
|
232
|
+
}, ht = (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
|
|
240
|
-
|
|
239
|
+
function z(e) {
|
|
240
|
+
if (!e)
|
|
241
|
+
return null;
|
|
242
|
+
try {
|
|
243
|
+
return JSON.parse(Buffer.from(e.split(".")[1], "base64").toString());
|
|
244
|
+
} catch {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
241
247
|
}
|
|
242
|
-
const
|
|
248
|
+
const ft = "storefront/faststore.recommendation-shelf@v4", j = {
|
|
243
249
|
method: "POST",
|
|
244
250
|
headers: {
|
|
245
251
|
"content-type": "application/json"
|
|
246
252
|
}
|
|
247
|
-
},
|
|
253
|
+
}, St = (e) => e.split("/").map(encodeURIComponent).join("/"), ue = (e) => e ? { headers: { "Accept-Language": e } } : void 0, yt = /^\d{4}-\d{2}-\d{2}$/, It = /* @__PURE__ */ new Set([
|
|
248
254
|
"Draft",
|
|
249
255
|
"Requested",
|
|
250
256
|
"InReview",
|
|
@@ -255,14 +261,14 @@ const ht = "storefront/faststore.recommendation-shelf@v4", q = {
|
|
|
255
261
|
"ConvertedToCart",
|
|
256
262
|
"ConvertedToOrder"
|
|
257
263
|
]);
|
|
258
|
-
function
|
|
264
|
+
function vt({
|
|
259
265
|
page: e,
|
|
260
266
|
perPage: n,
|
|
261
267
|
status: t,
|
|
262
268
|
createdAtFrom: r,
|
|
263
269
|
createdAtTo: i,
|
|
264
|
-
expiresAtFrom:
|
|
265
|
-
expiresAtTo:
|
|
270
|
+
expiresAtFrom: a,
|
|
271
|
+
expiresAtTo: o
|
|
266
272
|
}) {
|
|
267
273
|
if (e !== void 0 && (!Number.isInteger(e) || e < 1))
|
|
268
274
|
throw new Error(
|
|
@@ -275,41 +281,41 @@ function It({
|
|
|
275
281
|
for (const [s, c] of [
|
|
276
282
|
["createdAtFrom", r],
|
|
277
283
|
["createdAtTo", i],
|
|
278
|
-
["expiresAtFrom",
|
|
279
|
-
["expiresAtTo",
|
|
284
|
+
["expiresAtFrom", a],
|
|
285
|
+
["expiresAtTo", o]
|
|
280
286
|
])
|
|
281
|
-
if (c && !
|
|
287
|
+
if (c && !yt.test(c))
|
|
282
288
|
throw new Error(
|
|
283
289
|
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
284
290
|
);
|
|
285
291
|
if (t && t.length > 0) {
|
|
286
|
-
const s = t.filter((c) => !
|
|
292
|
+
const s = t.filter((c) => !It.has(c));
|
|
287
293
|
if (s.length > 0)
|
|
288
294
|
throw new Error(
|
|
289
295
|
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
290
296
|
);
|
|
291
297
|
}
|
|
292
298
|
}
|
|
293
|
-
function
|
|
299
|
+
function Ot({
|
|
294
300
|
page: e,
|
|
295
301
|
perPage: n,
|
|
296
302
|
status: t,
|
|
297
303
|
createdAtFrom: r,
|
|
298
304
|
createdAtTo: i,
|
|
299
|
-
expiresAtFrom:
|
|
300
|
-
expiresAtTo:
|
|
305
|
+
expiresAtFrom: a,
|
|
306
|
+
expiresAtTo: o,
|
|
301
307
|
label: s
|
|
302
308
|
}) {
|
|
303
309
|
const c = new URLSearchParams();
|
|
304
|
-
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((d) => c.append("status", d)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i),
|
|
310
|
+
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((d) => c.append("status", d)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i), a && c.append("expiresAtFrom", a), o && c.append("expiresAtTo", o), s?.trim() && c.append("label", s.trim()), c;
|
|
305
311
|
}
|
|
306
|
-
const
|
|
307
|
-
const
|
|
312
|
+
const Ct = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
313
|
+
const a = `https://${e}.${n}.com.br`, o = mt(i), s = dn(i), c = Qn(), d = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", u = r && r.map((l) => l + ".").find((l) => d.includes(l)) || "", p = d.replace(u, ""), f = `${a}/api/recommend-bff/v2`, h = s({
|
|
308
314
|
accept: "application/json",
|
|
309
315
|
"content-type": "application/json",
|
|
310
|
-
"x-vtex-rec-origin": `${e}/${
|
|
316
|
+
"x-vtex-rec-origin": `${e}/${ft}`
|
|
311
317
|
}), v = (l = {}) => {
|
|
312
|
-
const g =
|
|
318
|
+
const g = L(pe(i) ?? "", e);
|
|
313
319
|
return s({
|
|
314
320
|
...l,
|
|
315
321
|
"X-FORWARDED-HOST": p,
|
|
@@ -319,27 +325,27 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
319
325
|
return {
|
|
320
326
|
catalog: {
|
|
321
327
|
salesChannel: (l) => y(
|
|
322
|
-
`${
|
|
328
|
+
`${a}/api/catalog_system/pub/saleschannel/${l}`,
|
|
323
329
|
void 0,
|
|
324
|
-
{ storeCookies:
|
|
330
|
+
{ storeCookies: o }
|
|
325
331
|
),
|
|
326
332
|
brand: {
|
|
327
|
-
list: () => y(`${
|
|
328
|
-
storeCookies:
|
|
333
|
+
list: () => y(`${a}/api/catalog_system/pub/brand/list`, void 0, {
|
|
334
|
+
storeCookies: o
|
|
329
335
|
})
|
|
330
336
|
},
|
|
331
337
|
category: {
|
|
332
338
|
tree: (l = 3) => y(
|
|
333
|
-
`${
|
|
339
|
+
`${a}/api/catalog_system/pub/category/tree/${l}`,
|
|
334
340
|
void 0,
|
|
335
|
-
{ storeCookies:
|
|
341
|
+
{ storeCookies: o }
|
|
336
342
|
)
|
|
337
343
|
},
|
|
338
344
|
portal: {
|
|
339
345
|
pagetype: (l) => y(
|
|
340
|
-
`${
|
|
346
|
+
`${a}/api/catalog_system/pub/portal/pagetype/${l}`,
|
|
341
347
|
void 0,
|
|
342
|
-
{ storeCookies:
|
|
348
|
+
{ storeCookies: o }
|
|
343
349
|
)
|
|
344
350
|
},
|
|
345
351
|
byLinkId: {
|
|
@@ -349,33 +355,33 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
349
355
|
category: async (l, g) => {
|
|
350
356
|
try {
|
|
351
357
|
return await y(
|
|
352
|
-
`${
|
|
358
|
+
`${a}/api/catalog_system/pub/category/by-linkid/${St(l)}`,
|
|
353
359
|
ue(g)
|
|
354
360
|
);
|
|
355
361
|
} catch (m) {
|
|
356
|
-
if (
|
|
362
|
+
if (X(m)) return null;
|
|
357
363
|
throw m;
|
|
358
364
|
}
|
|
359
365
|
},
|
|
360
366
|
brand: async (l, g) => {
|
|
361
367
|
try {
|
|
362
368
|
return await y(
|
|
363
|
-
`${
|
|
369
|
+
`${a}/api/catalog_system/pub/brand/by-linkid/${encodeURIComponent(l)}`,
|
|
364
370
|
ue(g)
|
|
365
371
|
);
|
|
366
372
|
} catch (m) {
|
|
367
|
-
if (
|
|
373
|
+
if (X(m)) return null;
|
|
368
374
|
throw m;
|
|
369
375
|
}
|
|
370
376
|
},
|
|
371
377
|
collection: async (l, g) => {
|
|
372
378
|
try {
|
|
373
379
|
return await y(
|
|
374
|
-
`${
|
|
380
|
+
`${a}/api/catalog_system/pub/collection/by-linkid/${encodeURIComponent(l)}`,
|
|
375
381
|
ue(g)
|
|
376
382
|
);
|
|
377
383
|
} catch (m) {
|
|
378
|
-
if (
|
|
384
|
+
if (X(m)) return null;
|
|
379
385
|
throw m;
|
|
380
386
|
}
|
|
381
387
|
}
|
|
@@ -391,9 +397,9 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
391
397
|
groupByProduct: m.toString()
|
|
392
398
|
});
|
|
393
399
|
return y(
|
|
394
|
-
`${
|
|
400
|
+
`${a}/api/catalog_system/pub/products/crossselling/${l}/${g}?${S}`,
|
|
395
401
|
void 0,
|
|
396
|
-
{ storeCookies:
|
|
402
|
+
{ storeCookies: o }
|
|
397
403
|
);
|
|
398
404
|
}
|
|
399
405
|
}
|
|
@@ -407,13 +413,13 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
407
413
|
"X-FORWARDED-HOST": p
|
|
408
414
|
});
|
|
409
415
|
return y(
|
|
410
|
-
`${
|
|
416
|
+
`${a}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
411
417
|
{
|
|
412
|
-
...
|
|
418
|
+
...j,
|
|
413
419
|
headers: S,
|
|
414
420
|
body: JSON.stringify(l)
|
|
415
421
|
},
|
|
416
|
-
{ storeCookies:
|
|
422
|
+
{ storeCookies: o }
|
|
417
423
|
);
|
|
418
424
|
},
|
|
419
425
|
shippingData: ({
|
|
@@ -434,18 +440,18 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
434
440
|
})),
|
|
435
441
|
selectedAddresses: S,
|
|
436
442
|
clearAddressIfPostalCodeNotFound: t
|
|
437
|
-
},
|
|
443
|
+
}, k = s({
|
|
438
444
|
"content-type": "application/json",
|
|
439
445
|
"X-FORWARDED-HOST": p
|
|
440
446
|
});
|
|
441
447
|
return y(
|
|
442
|
-
`${
|
|
448
|
+
`${a}/api/checkout/pub/orderForm/${l}/attachments/shippingData`,
|
|
443
449
|
{
|
|
444
|
-
...
|
|
445
|
-
headers:
|
|
450
|
+
...j,
|
|
451
|
+
headers: k,
|
|
446
452
|
body: JSON.stringify(b)
|
|
447
453
|
},
|
|
448
|
-
{ storeCookies:
|
|
454
|
+
{ storeCookies: o }
|
|
449
455
|
);
|
|
450
456
|
},
|
|
451
457
|
marketingData: ({
|
|
@@ -457,13 +463,13 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
457
463
|
"X-FORWARDED-HOST": p
|
|
458
464
|
});
|
|
459
465
|
return y(
|
|
460
|
-
`${
|
|
466
|
+
`${a}/api/checkout/pub/orderForm/${l}/attachments/marketingData`,
|
|
461
467
|
{
|
|
462
468
|
headers: m,
|
|
463
469
|
body: JSON.stringify(g),
|
|
464
470
|
method: "POST"
|
|
465
471
|
},
|
|
466
|
-
{ storeCookies:
|
|
472
|
+
{ storeCookies: o }
|
|
467
473
|
);
|
|
468
474
|
},
|
|
469
475
|
clientPreferencesData: ({
|
|
@@ -475,13 +481,13 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
475
481
|
"X-FORWARDED-HOST": p
|
|
476
482
|
});
|
|
477
483
|
return y(
|
|
478
|
-
`${
|
|
484
|
+
`${a}/api/checkout/pub/orderForm/${l}/attachments/clientPreferencesData`,
|
|
479
485
|
{
|
|
480
486
|
headers: m,
|
|
481
487
|
body: JSON.stringify(g),
|
|
482
488
|
method: "POST"
|
|
483
489
|
},
|
|
484
|
-
{ storeCookies:
|
|
490
|
+
{ storeCookies: o }
|
|
485
491
|
);
|
|
486
492
|
},
|
|
487
493
|
orderForm: ({
|
|
@@ -495,15 +501,15 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
495
501
|
"X-FORWARDED-HOST": p
|
|
496
502
|
}), b = new URLSearchParams();
|
|
497
503
|
(!S || !l) && b.set("sc", O), l && b.set("refreshOutdatedData", g.toString());
|
|
498
|
-
const
|
|
504
|
+
const k = l ? `/${l}` : "", I = `${a}/api/checkout/pub/orderForm${k}?${b}`;
|
|
499
505
|
return y(
|
|
500
506
|
I,
|
|
501
507
|
{
|
|
502
|
-
...
|
|
508
|
+
...j,
|
|
503
509
|
headers: w,
|
|
504
510
|
...l ? {} : { body: "{}" }
|
|
505
511
|
},
|
|
506
|
-
{ storeCookies:
|
|
512
|
+
{ storeCookies: o }
|
|
507
513
|
);
|
|
508
514
|
},
|
|
509
515
|
clearOrderFormMessages: ({ id: l }) => {
|
|
@@ -512,9 +518,9 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
512
518
|
"X-FORWARDED-HOST": p
|
|
513
519
|
});
|
|
514
520
|
return y(
|
|
515
|
-
`${
|
|
521
|
+
`${a}/api/checkout/pub/orderForm/${l}/messages/clear`,
|
|
516
522
|
{
|
|
517
|
-
...
|
|
523
|
+
...j,
|
|
518
524
|
headers: g,
|
|
519
525
|
body: "{}"
|
|
520
526
|
}
|
|
@@ -535,7 +541,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
535
541
|
"X-FORWARDED-HOST": p
|
|
536
542
|
});
|
|
537
543
|
return y(
|
|
538
|
-
`${
|
|
544
|
+
`${a}/api/checkout/pub/orderForm/${l}/items?${w}`,
|
|
539
545
|
{
|
|
540
546
|
headers: b,
|
|
541
547
|
body: JSON.stringify({
|
|
@@ -544,7 +550,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
544
550
|
}),
|
|
545
551
|
method: "PATCH"
|
|
546
552
|
},
|
|
547
|
-
{ storeCookies:
|
|
553
|
+
{ storeCookies: o }
|
|
548
554
|
);
|
|
549
555
|
},
|
|
550
556
|
setCustomData: ({
|
|
@@ -558,7 +564,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
558
564
|
"X-FORWARDED-HOST": p
|
|
559
565
|
});
|
|
560
566
|
return y(
|
|
561
|
-
`${
|
|
567
|
+
`${a}/api/checkout/pub/orderForm/${l}/customData/${g}/${m}`,
|
|
562
568
|
{
|
|
563
569
|
headers: O,
|
|
564
570
|
body: JSON.stringify({ value: S }),
|
|
@@ -580,7 +586,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
580
586
|
"geoCoordinates",
|
|
581
587
|
`${g?.longitude};${g?.latitude}`
|
|
582
588
|
);
|
|
583
|
-
const w = `${
|
|
589
|
+
const w = `${a}/api/checkout/pub/regions/?${O.toString()}`, b = s({
|
|
584
590
|
"content-type": "application/json",
|
|
585
591
|
"X-FORWARDED-HOST": p
|
|
586
592
|
});
|
|
@@ -589,7 +595,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
589
595
|
{
|
|
590
596
|
headers: b
|
|
591
597
|
},
|
|
592
|
-
{ storeCookies:
|
|
598
|
+
{ storeCookies: o }
|
|
593
599
|
);
|
|
594
600
|
},
|
|
595
601
|
address: async ({
|
|
@@ -601,11 +607,11 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
601
607
|
"X-FORWARDED-HOST": p
|
|
602
608
|
});
|
|
603
609
|
return y(
|
|
604
|
-
`${
|
|
610
|
+
`${a}/api/checkout/pub/postal-code/${g}/${l}`,
|
|
605
611
|
{
|
|
606
612
|
headers: m
|
|
607
613
|
},
|
|
608
|
-
{ storeCookies:
|
|
614
|
+
{ storeCookies: o }
|
|
609
615
|
);
|
|
610
616
|
},
|
|
611
617
|
cancelOrder: ({
|
|
@@ -618,7 +624,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
618
624
|
"X-FORWARDED-HOST": p
|
|
619
625
|
});
|
|
620
626
|
return y(
|
|
621
|
-
`${
|
|
627
|
+
`${a}/api/checkout/pub/orders/${l}/user-cancel-request`,
|
|
622
628
|
{
|
|
623
629
|
method: "POST",
|
|
624
630
|
headers: S,
|
|
@@ -642,13 +648,13 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
642
648
|
"X-FORWARDED-HOST": p
|
|
643
649
|
});
|
|
644
650
|
return y(
|
|
645
|
-
`${
|
|
651
|
+
`${a}/api/logistics-shipping/pickuppoints/_search`,
|
|
646
652
|
{
|
|
647
653
|
method: "POST",
|
|
648
654
|
headers: g,
|
|
649
655
|
body: JSON.stringify({ coordinate: l })
|
|
650
656
|
},
|
|
651
|
-
{ storeCookies:
|
|
657
|
+
{ storeCookies: o }
|
|
652
658
|
);
|
|
653
659
|
}
|
|
654
660
|
},
|
|
@@ -662,23 +668,23 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
662
668
|
"content-type": "application/json"
|
|
663
669
|
}), S = Q(i?.headers?.cookie ?? "")?.vtex_session;
|
|
664
670
|
return y(
|
|
665
|
-
`${
|
|
671
|
+
`${a}/api/sessions?${g.toString()}`,
|
|
666
672
|
{
|
|
667
673
|
method: S ? "PATCH" : "POST",
|
|
668
674
|
headers: m,
|
|
669
675
|
body: "{}"
|
|
670
676
|
},
|
|
671
|
-
{ storeCookies:
|
|
677
|
+
{ storeCookies: o }
|
|
672
678
|
);
|
|
673
679
|
},
|
|
674
680
|
subscribeToNewsletter: (l) => y(
|
|
675
|
-
`${
|
|
681
|
+
`${a}/api/dataentities/NL/documents/`,
|
|
676
682
|
{
|
|
677
|
-
...
|
|
683
|
+
...j,
|
|
678
684
|
body: JSON.stringify({ ...l, isNewsletterOptIn: !0 }),
|
|
679
685
|
method: "PATCH"
|
|
680
686
|
},
|
|
681
|
-
{ storeCookies:
|
|
687
|
+
{ storeCookies: o }
|
|
682
688
|
),
|
|
683
689
|
profile: {
|
|
684
690
|
addresses: async (l) => {
|
|
@@ -687,9 +693,9 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
687
693
|
"X-FORWARDED-HOST": p
|
|
688
694
|
});
|
|
689
695
|
return y(
|
|
690
|
-
`${
|
|
696
|
+
`${a}/api/profile-system/pvt/profiles/${l}/addresses`,
|
|
691
697
|
{ headers: g },
|
|
692
|
-
{ storeCookies:
|
|
698
|
+
{ storeCookies: o }
|
|
693
699
|
);
|
|
694
700
|
}
|
|
695
701
|
},
|
|
@@ -700,12 +706,12 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
700
706
|
"X-FORWARDED-HOST": p
|
|
701
707
|
});
|
|
702
708
|
return y(
|
|
703
|
-
`${
|
|
709
|
+
`${a}/api/oms/user/orders/${l}`,
|
|
704
710
|
{
|
|
705
711
|
method: "GET",
|
|
706
712
|
headers: g
|
|
707
713
|
},
|
|
708
|
-
{ storeCookies:
|
|
714
|
+
{ storeCookies: o }
|
|
709
715
|
);
|
|
710
716
|
},
|
|
711
717
|
listUserOrders: ({
|
|
@@ -716,42 +722,42 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
716
722
|
text: O,
|
|
717
723
|
clientEmail: w,
|
|
718
724
|
perPage: b,
|
|
719
|
-
pendingMyApproval:
|
|
725
|
+
pendingMyApproval: k
|
|
720
726
|
}) => {
|
|
721
727
|
const I = new URLSearchParams();
|
|
722
728
|
if (m) {
|
|
723
|
-
const
|
|
729
|
+
const A = new Date(m).setHours(
|
|
724
730
|
0,
|
|
725
731
|
0,
|
|
726
732
|
0,
|
|
727
733
|
0
|
|
728
734
|
);
|
|
729
|
-
m = new Date(
|
|
735
|
+
m = new Date(A).toISOString();
|
|
730
736
|
}
|
|
731
737
|
if (S) {
|
|
732
|
-
const
|
|
738
|
+
const A = new Date(S).setHours(
|
|
733
739
|
23,
|
|
734
740
|
59,
|
|
735
741
|
59,
|
|
736
742
|
999
|
|
737
743
|
);
|
|
738
|
-
S = new Date(
|
|
744
|
+
S = new Date(A).toISOString();
|
|
739
745
|
}
|
|
740
746
|
O && I.append("text", O), g && g.length > 0 && I.append("status", g.filter(Boolean).join(",")), m && S ? I.append(
|
|
741
747
|
"creation_date",
|
|
742
748
|
`creationDate:[${m} TO ${S}]`
|
|
743
|
-
) : 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()), b && I.append("per_page", b.toString()),
|
|
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()), b && I.append("per_page", b.toString()), k && I.append("my_pending_approvals", String(!0));
|
|
744
750
|
const D = s({
|
|
745
751
|
"content-type": "application/json",
|
|
746
752
|
"X-FORWARDED-HOST": p
|
|
747
753
|
});
|
|
748
754
|
return y(
|
|
749
|
-
`${
|
|
755
|
+
`${a}/api/oms/user/orders?${I.toString()}`,
|
|
750
756
|
{
|
|
751
757
|
method: "GET",
|
|
752
758
|
headers: D
|
|
753
759
|
},
|
|
754
|
-
{ storeCookies:
|
|
760
|
+
{ storeCookies: o }
|
|
755
761
|
);
|
|
756
762
|
},
|
|
757
763
|
getCommercialAuthorizationsByOrderId: ({
|
|
@@ -762,12 +768,12 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
762
768
|
"X-FORWARDED-HOST": p
|
|
763
769
|
});
|
|
764
770
|
return y(
|
|
765
|
-
`${
|
|
771
|
+
`${a}/${e}/commercial-authorizations/order/${l}`,
|
|
766
772
|
{
|
|
767
773
|
method: "GET",
|
|
768
774
|
headers: g
|
|
769
775
|
},
|
|
770
|
-
{ storeCookies:
|
|
776
|
+
{ storeCookies: o }
|
|
771
777
|
);
|
|
772
778
|
},
|
|
773
779
|
processOrderAuthorization: async ({
|
|
@@ -779,7 +785,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
779
785
|
const O = s({
|
|
780
786
|
"content-type": "application/json",
|
|
781
787
|
"X-FORWARDED-HOST": p
|
|
782
|
-
}),
|
|
788
|
+
}), k = {
|
|
783
789
|
params: {
|
|
784
790
|
ruleId: m,
|
|
785
791
|
dimensionId: g,
|
|
@@ -787,13 +793,29 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
787
793
|
}
|
|
788
794
|
};
|
|
789
795
|
return y(
|
|
790
|
-
`${
|
|
796
|
+
`${a}/${e}/commercial-authorizations/${l}/callback`,
|
|
791
797
|
{
|
|
792
798
|
method: "POST",
|
|
793
799
|
headers: O,
|
|
794
|
-
body: JSON.stringify(
|
|
800
|
+
body: JSON.stringify(k)
|
|
801
|
+
},
|
|
802
|
+
{ storeCookies: o }
|
|
803
|
+
);
|
|
804
|
+
}
|
|
805
|
+
},
|
|
806
|
+
savedCards: {
|
|
807
|
+
listCreditCards: () => {
|
|
808
|
+
const l = s({
|
|
809
|
+
"content-type": "application/json",
|
|
810
|
+
"X-FORWARDED-HOST": p
|
|
811
|
+
});
|
|
812
|
+
return y(
|
|
813
|
+
`${a}/api/saved-cards/credit-card?an=${e}`,
|
|
814
|
+
{
|
|
815
|
+
method: "GET",
|
|
816
|
+
headers: l
|
|
795
817
|
},
|
|
796
|
-
{ storeCookies:
|
|
818
|
+
{ storeCookies: o }
|
|
797
819
|
);
|
|
798
820
|
}
|
|
799
821
|
},
|
|
@@ -806,7 +828,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
806
828
|
"X-FORWARDED-HOST": p
|
|
807
829
|
});
|
|
808
830
|
return y(
|
|
809
|
-
`${
|
|
831
|
+
`${a}/api/units/v1/${l}/unit`,
|
|
810
832
|
{
|
|
811
833
|
method: "GET",
|
|
812
834
|
headers: g
|
|
@@ -822,7 +844,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
822
844
|
"X-FORWARDED-HOST": p
|
|
823
845
|
});
|
|
824
846
|
return y(
|
|
825
|
-
`${
|
|
847
|
+
`${a}/api/units/v1/${l}`,
|
|
826
848
|
{
|
|
827
849
|
method: "GET",
|
|
828
850
|
headers: g
|
|
@@ -838,7 +860,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
838
860
|
"X-FORWARDED-HOST": p
|
|
839
861
|
});
|
|
840
862
|
return y(
|
|
841
|
-
`${
|
|
863
|
+
`${a}/api/units/v1/${l}/scopes`,
|
|
842
864
|
{
|
|
843
865
|
method: "GET",
|
|
844
866
|
headers: g
|
|
@@ -856,7 +878,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
856
878
|
"X-FORWARDED-HOST": p
|
|
857
879
|
});
|
|
858
880
|
return y(
|
|
859
|
-
`${
|
|
881
|
+
`${a}/api/license-manager/users/${l}`,
|
|
860
882
|
{
|
|
861
883
|
method: "GET",
|
|
862
884
|
headers: g
|
|
@@ -872,7 +894,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
872
894
|
"X-FORWARDED-HOST": p
|
|
873
895
|
});
|
|
874
896
|
return y(
|
|
875
|
-
`${
|
|
897
|
+
`${a}/api/license-manager/pvt/users/${l}`,
|
|
876
898
|
{
|
|
877
899
|
method: "GET",
|
|
878
900
|
headers: g
|
|
@@ -888,13 +910,36 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
888
910
|
"X-FORWARDED-HOST": p
|
|
889
911
|
});
|
|
890
912
|
return y(
|
|
891
|
-
`${
|
|
913
|
+
`${a}/api/license-manager/storefront/users/${l}/roles`,
|
|
892
914
|
{
|
|
893
915
|
method: "GET",
|
|
894
916
|
headers: g
|
|
895
917
|
},
|
|
896
918
|
{}
|
|
897
919
|
);
|
|
920
|
+
},
|
|
921
|
+
/**
|
|
922
|
+
* Whether a License Manager resource key is granted to the user. The
|
|
923
|
+
* endpoint resolves the user's roles into the resource key server-side,
|
|
924
|
+
* so callers never have to match role names (which are account-
|
|
925
|
+
* configurable). Responds with a bare boolean.
|
|
926
|
+
*/
|
|
927
|
+
isResourceGranted: ({
|
|
928
|
+
userId: l,
|
|
929
|
+
resourceKey: g
|
|
930
|
+
}) => {
|
|
931
|
+
const m = s({
|
|
932
|
+
"content-type": "application/json",
|
|
933
|
+
"X-FORWARDED-HOST": p
|
|
934
|
+
});
|
|
935
|
+
return y(
|
|
936
|
+
`${a}/api/license-manager/storefront/bff/users/${l}/resources/${g}/granted?an=${e}`,
|
|
937
|
+
{
|
|
938
|
+
method: "GET",
|
|
939
|
+
headers: m
|
|
940
|
+
},
|
|
941
|
+
{}
|
|
942
|
+
);
|
|
898
943
|
}
|
|
899
944
|
},
|
|
900
945
|
masterData: {
|
|
@@ -902,13 +947,13 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
902
947
|
contractId: l
|
|
903
948
|
}) => {
|
|
904
949
|
if (!l)
|
|
905
|
-
throw new
|
|
950
|
+
throw new E("Missing contractId to fetch CL fields.");
|
|
906
951
|
const g = v({
|
|
907
952
|
Accept: "application/json",
|
|
908
953
|
"content-type": "application/json"
|
|
909
954
|
});
|
|
910
955
|
return y(
|
|
911
|
-
`${
|
|
956
|
+
`${a}/api/dataentities/CL/documents/${l}?_fields=_all`,
|
|
912
957
|
{
|
|
913
958
|
method: "GET",
|
|
914
959
|
headers: g
|
|
@@ -920,14 +965,14 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
920
965
|
userId: l
|
|
921
966
|
}) => {
|
|
922
967
|
if (!l)
|
|
923
|
-
throw new
|
|
968
|
+
throw new E("Missing userId to fetch shopper name.");
|
|
924
969
|
const g = c({
|
|
925
970
|
Accept: "application/json",
|
|
926
971
|
"content-type": "application/json",
|
|
927
972
|
"X-FORWARDED-HOST": p
|
|
928
973
|
}), m = l.replace(/-/g, "");
|
|
929
974
|
return y(
|
|
930
|
-
`${
|
|
975
|
+
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${l})&_fields=_all&_schema=v1`,
|
|
931
976
|
{
|
|
932
977
|
method: "GET",
|
|
933
978
|
headers: g
|
|
@@ -938,18 +983,18 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
938
983
|
},
|
|
939
984
|
quotes: {
|
|
940
985
|
listUserQuotes: (l) => {
|
|
941
|
-
|
|
942
|
-
const g =
|
|
986
|
+
vt(l);
|
|
987
|
+
const g = Ot(l), m = s({
|
|
943
988
|
"content-type": "application/json",
|
|
944
989
|
"X-FORWARDED-HOST": p
|
|
945
990
|
});
|
|
946
991
|
return y(
|
|
947
|
-
`${
|
|
992
|
+
`${a}/api/quoting/quotes?${g.toString()}`,
|
|
948
993
|
{
|
|
949
994
|
method: "GET",
|
|
950
995
|
headers: m
|
|
951
996
|
},
|
|
952
|
-
{ storeCookies:
|
|
997
|
+
{ storeCookies: o }
|
|
953
998
|
);
|
|
954
999
|
}
|
|
955
1000
|
},
|
|
@@ -958,15 +1003,15 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
958
1003
|
const l = s({
|
|
959
1004
|
"content-type": "application/json",
|
|
960
1005
|
"X-FORWARDED-HOST": p
|
|
961
|
-
}), g =
|
|
1006
|
+
}), g = L(pe(i) ?? "", e);
|
|
962
1007
|
return y(
|
|
963
|
-
`${
|
|
1008
|
+
`${a}/api/vtexid/credential/validate`,
|
|
964
1009
|
{
|
|
965
1010
|
headers: l,
|
|
966
1011
|
body: JSON.stringify({ token: g }),
|
|
967
1012
|
method: "POST"
|
|
968
1013
|
},
|
|
969
|
-
{ storeCookies:
|
|
1014
|
+
{ storeCookies: o }
|
|
970
1015
|
);
|
|
971
1016
|
}
|
|
972
1017
|
},
|
|
@@ -980,18 +1025,18 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
980
1025
|
"content-type": "application/json",
|
|
981
1026
|
"X-FORWARDED-HOST": p
|
|
982
1027
|
}), O = `----FastStoreUploadBoundary${Date.now()}`, w = `\r
|
|
983
|
-
`,
|
|
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 = g.replaceAll(/[\r\n"]/g, "_"), D = [
|
|
984
1029
|
`--${O}`,
|
|
985
1030
|
`Content-Disposition: form-data; name="file"; filename="${I}"`,
|
|
986
|
-
`Content-Type: ${
|
|
1031
|
+
`Content-Type: ${k}`,
|
|
987
1032
|
"",
|
|
988
1033
|
""
|
|
989
|
-
].join(w),
|
|
990
|
-
|
|
1034
|
+
].join(w), A = `${w}--${O}--${w}`, _ = Buffer.from(D), P = Buffer.from(A), R = new Uint8Array(
|
|
1035
|
+
_.byteLength + l.byteLength + P.byteLength
|
|
991
1036
|
);
|
|
992
1037
|
let C = 0;
|
|
993
|
-
return R.set(
|
|
994
|
-
`${
|
|
1038
|
+
return R.set(_, C), C += _.byteLength, R.set(l, C), C += l.byteLength, R.set(P, C), y(
|
|
1039
|
+
`${a}/api/order-entry/upload?an=${e}`,
|
|
995
1040
|
{
|
|
996
1041
|
method: "POST",
|
|
997
1042
|
headers: {
|
|
@@ -1018,7 +1063,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1018
1063
|
...m ? { sessionToken: m } : {}
|
|
1019
1064
|
});
|
|
1020
1065
|
return y(
|
|
1021
|
-
`${
|
|
1066
|
+
`${a}/api/order-entry/operation?an=${e}`,
|
|
1022
1067
|
{
|
|
1023
1068
|
method: "POST",
|
|
1024
1069
|
headers: S,
|
|
@@ -1035,7 +1080,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1035
1080
|
"X-FORWARDED-HOST": p
|
|
1036
1081
|
});
|
|
1037
1082
|
return y(
|
|
1038
|
-
`${
|
|
1083
|
+
`${a}/api/order-entry/operation/${l}?an=${e}`,
|
|
1039
1084
|
{
|
|
1040
1085
|
method: "GET",
|
|
1041
1086
|
headers: g
|
|
@@ -1049,7 +1094,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1049
1094
|
"X-FORWARDED-HOST": p
|
|
1050
1095
|
});
|
|
1051
1096
|
return y(
|
|
1052
|
-
`${
|
|
1097
|
+
`${a}/api/checkout/pub/orderForm?sc=${i.storage.channel.salesChannel}`,
|
|
1053
1098
|
{
|
|
1054
1099
|
method: "POST",
|
|
1055
1100
|
headers: l,
|
|
@@ -1066,7 +1111,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1066
1111
|
"X-FORWARDED-HOST": p
|
|
1067
1112
|
});
|
|
1068
1113
|
return y(
|
|
1069
|
-
`${
|
|
1114
|
+
`${a}/api/checkout/pub/orderForm/${l}`,
|
|
1070
1115
|
{
|
|
1071
1116
|
method: "GET",
|
|
1072
1117
|
headers: g
|
|
@@ -1091,7 +1136,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1091
1136
|
return g && w.append("userId", g), m.length > 0 && w.append("products", m.join(",")), S && w.append("salesChannel", S), O && w.append("locale", O), y(
|
|
1092
1137
|
`${f}/recommendations?${w.toString()}`,
|
|
1093
1138
|
{ headers: h },
|
|
1094
|
-
{ storeCookies:
|
|
1139
|
+
{ storeCookies: o }
|
|
1095
1140
|
);
|
|
1096
1141
|
},
|
|
1097
1142
|
startRecommendationSession: () => {
|
|
@@ -1099,13 +1144,13 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1099
1144
|
return y(
|
|
1100
1145
|
`${f}/users/start-session?${l.toString()}`,
|
|
1101
1146
|
{ method: "POST", headers: h },
|
|
1102
|
-
{ storeCookies:
|
|
1147
|
+
{ storeCookies: o }
|
|
1103
1148
|
);
|
|
1104
1149
|
}
|
|
1105
1150
|
}
|
|
1106
1151
|
};
|
|
1107
|
-
}, J = (e) => e.discoveryConfig?.localization ?? {}, K = (e) => J(e).enabled === !0,
|
|
1108
|
-
|
|
1152
|
+
}, J = (e) => e.discoveryConfig?.localization ?? {}, K = (e) => J(e).enabled === !0, bt = (e) => Object.keys(J(e).locales ?? {}), wt = (e) => J(e).defaultLocale, ie = (e) => K(e) && e.storage.locale || void 0, ge = "fuzzy", me = "operator", he = "pickupPoint", Te = "shipping", Ue = "delivery-options", Dt = "in-stock", At = "trade-policy", Pt = "region-id", _t = /* @__PURE__ */ new Set([
|
|
1153
|
+
At,
|
|
1109
1154
|
Pt,
|
|
1110
1155
|
ge,
|
|
1111
1156
|
me,
|
|
@@ -1117,7 +1162,7 @@ const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1117
1162
|
"coordinates",
|
|
1118
1163
|
"deliveryZonesHash",
|
|
1119
1164
|
"pickupPointsHash"
|
|
1120
|
-
]), Re = (e) => encodeURI(decodeURI(e)),
|
|
1165
|
+
]), Re = (e) => encodeURI(decodeURI(e)), Et = (e) => encodeURIComponent(
|
|
1121
1166
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
1122
1167
|
), Tt = /^pickup-in-point-(.+)$/;
|
|
1123
1168
|
function un(e) {
|
|
@@ -1133,18 +1178,18 @@ function un(e) {
|
|
|
1133
1178
|
return {};
|
|
1134
1179
|
}
|
|
1135
1180
|
}
|
|
1136
|
-
function
|
|
1181
|
+
function Ut(e) {
|
|
1137
1182
|
const n = {}, t = [];
|
|
1138
1183
|
for (const r of e.split(";")) {
|
|
1139
1184
|
const i = r.indexOf("=");
|
|
1140
1185
|
if (i < 0) continue;
|
|
1141
|
-
const
|
|
1142
|
-
!
|
|
1186
|
+
const a = r.slice(0, i), o = r.slice(i + 1);
|
|
1187
|
+
!a || !o || (kt.has(a) ? n[a] = o : t.push({ key: a, value: o }));
|
|
1143
1188
|
}
|
|
1144
1189
|
return { shipping: n, extraFacets: t };
|
|
1145
1190
|
}
|
|
1146
|
-
function
|
|
1147
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } =
|
|
1191
|
+
function Rt(e) {
|
|
1192
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } = Ut(n);
|
|
1148
1193
|
return {
|
|
1149
1194
|
segmentParams: {
|
|
1150
1195
|
sc: e.channel,
|
|
@@ -1188,7 +1233,7 @@ function pn(e, n) {
|
|
|
1188
1233
|
function gn(e) {
|
|
1189
1234
|
return Tt.exec(e)?.[1];
|
|
1190
1235
|
}
|
|
1191
|
-
function
|
|
1236
|
+
function Ft(e) {
|
|
1192
1237
|
const n = e.find((r) => r.key === "shipping"), t = n ? gn(n.value) : void 0;
|
|
1193
1238
|
if (t !== void 0)
|
|
1194
1239
|
try {
|
|
@@ -1197,8 +1242,8 @@ function Rt(e) {
|
|
|
1197
1242
|
return t;
|
|
1198
1243
|
}
|
|
1199
1244
|
}
|
|
1200
|
-
function
|
|
1201
|
-
const t =
|
|
1245
|
+
function Nt(e, n) {
|
|
1246
|
+
const t = Ft(
|
|
1202
1247
|
n
|
|
1203
1248
|
);
|
|
1204
1249
|
return t === void 0 ? e : {
|
|
@@ -1206,56 +1251,56 @@ function Ft(e, n) {
|
|
|
1206
1251
|
pickupPoint: t
|
|
1207
1252
|
};
|
|
1208
1253
|
}
|
|
1209
|
-
function
|
|
1254
|
+
function Lt(e) {
|
|
1210
1255
|
return e.map((n) => n.key !== "shipping" || gn(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1211
1256
|
}
|
|
1212
|
-
function
|
|
1257
|
+
function Bt(e, n) {
|
|
1213
1258
|
let t = [...e];
|
|
1214
1259
|
const r = t.some((i) => i.key === "shipping");
|
|
1215
1260
|
for (const i of n)
|
|
1216
1261
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1217
|
-
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")), Lt(t);
|
|
1218
1263
|
}
|
|
1219
|
-
function
|
|
1264
|
+
function $t(e) {
|
|
1220
1265
|
return e.reduce((n, t) => {
|
|
1221
1266
|
let { key: r, value: i } = t;
|
|
1222
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Re(r)}/${
|
|
1267
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Re(r)}/${Et(Re(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1223
1268
|
}, "");
|
|
1224
1269
|
}
|
|
1225
|
-
const
|
|
1226
|
-
function
|
|
1227
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1270
|
+
const Mt = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), zt = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1271
|
+
function Vt(e, n) {
|
|
1272
|
+
const { segmentParams: t, extraFacets: r } = Rt(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
|
|
1228
1273
|
return {
|
|
1229
1274
|
segmentParams: {
|
|
1230
1275
|
...t,
|
|
1231
1276
|
...i ? { sc: i } : {},
|
|
1232
|
-
...
|
|
1233
|
-
locale:
|
|
1277
|
+
...a ? { regionId: a } : {},
|
|
1278
|
+
locale: o
|
|
1234
1279
|
},
|
|
1235
1280
|
extraFacets: r
|
|
1236
1281
|
};
|
|
1237
1282
|
}
|
|
1238
|
-
function
|
|
1239
|
-
const t = e.filter(({ key: c }) => !
|
|
1240
|
-
({ key: c, value: d }) => c ===
|
|
1283
|
+
function xt(e, n) {
|
|
1284
|
+
const t = e.filter(({ key: c }) => !_t.has(c)), r = e.find(
|
|
1285
|
+
({ key: c, value: d }) => c === Te && d !== "all-delivery-methods"
|
|
1241
1286
|
) ?? null, i = e.find(
|
|
1242
|
-
({ key: c, value: d }) => c ===
|
|
1243
|
-
) ?? null,
|
|
1244
|
-
({ key: c }) => c ===
|
|
1245
|
-
), s =
|
|
1246
|
-
({ key: c }) => c ===
|
|
1287
|
+
({ key: c, value: d }) => c === Ue && d !== "all-delivery-options"
|
|
1288
|
+
) ?? null, a = [...t], o = a.some(
|
|
1289
|
+
({ key: c }) => c === Te
|
|
1290
|
+
), s = a.some(
|
|
1291
|
+
({ key: c }) => c === Ue
|
|
1247
1292
|
);
|
|
1248
|
-
return r !== null && !
|
|
1293
|
+
return r !== null && !o && a.push(r), i !== null && !s && a.push(i), Bt(a, n);
|
|
1249
1294
|
}
|
|
1250
|
-
function
|
|
1251
|
-
const t = e.find(({ key:
|
|
1252
|
-
t &&
|
|
1295
|
+
function qt(e, n) {
|
|
1296
|
+
const t = e.find(({ key: a }) => a === ge) ?? null, r = e.find(({ key: a }) => a === me) ?? null, i = e.find(({ key: a }) => a === he) ?? null;
|
|
1297
|
+
t && Mt(t) && n.append(ge, t.value), r && zt(r) && n.append(me, r.value), i && n.append(he, i.value);
|
|
1253
1298
|
}
|
|
1254
1299
|
function Fe(e, n, t, r) {
|
|
1255
1300
|
const {
|
|
1256
1301
|
query: i = "",
|
|
1257
|
-
page:
|
|
1258
|
-
count:
|
|
1302
|
+
page: a,
|
|
1303
|
+
count: o,
|
|
1259
1304
|
sort: s,
|
|
1260
1305
|
selectedFacets: c = [],
|
|
1261
1306
|
showInvisibleItems: d,
|
|
@@ -1263,33 +1308,33 @@ function Fe(e, n, t, r) {
|
|
|
1263
1308
|
hideUnavailableItems: p,
|
|
1264
1309
|
allowRedirect: f = !1
|
|
1265
1310
|
} = e, h = new URLSearchParams();
|
|
1266
|
-
if (r.includePagination &&
|
|
1267
|
-
const g =
|
|
1311
|
+
if (r.includePagination && a !== void 0 && o !== void 0) {
|
|
1312
|
+
const g = a * o, m = o === 0 ? g : g + o - 1;
|
|
1268
1313
|
h.append("from", g.toString()), h.append("to", m.toString());
|
|
1269
1314
|
}
|
|
1270
1315
|
i && h.append("query", i), r.includeSort && s && h.append("sort", s);
|
|
1271
|
-
const v =
|
|
1316
|
+
const v = Nt(
|
|
1272
1317
|
t.segmentParams,
|
|
1273
1318
|
c
|
|
1274
1319
|
);
|
|
1275
|
-
if (pn(h, v ?? t.segmentParams),
|
|
1276
|
-
const g = c.find(({ key: S }) => S ===
|
|
1320
|
+
if (pn(h, v ?? t.segmentParams), qt(c, h), d && h.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1321
|
+
const g = c.find(({ key: S }) => S === Dt), m = g ? g.value : p?.toString() ?? n.hideUnavailableItems.toString();
|
|
1277
1322
|
h.append("hideUnavailableItems", m);
|
|
1278
1323
|
}
|
|
1279
1324
|
n?.simulationBehavior !== void 0 && h.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && h.append("showSponsored", n.showSponsored.toString()), u !== void 0 && h.append("sponsoredCount", u.toString()), f !== void 0 && h.append("allowRedirect", f.toString());
|
|
1280
|
-
const l =
|
|
1281
|
-
|
|
1325
|
+
const l = $t(
|
|
1326
|
+
xt(c, t.extraFacets)
|
|
1282
1327
|
);
|
|
1283
1328
|
return { params: h, path: l };
|
|
1284
1329
|
}
|
|
1285
|
-
function
|
|
1286
|
-
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems:
|
|
1330
|
+
function jt(e, n) {
|
|
1331
|
+
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: a } = e, o = new URLSearchParams({
|
|
1287
1332
|
field: t ?? "",
|
|
1288
1333
|
value: r ?? ""
|
|
1289
1334
|
});
|
|
1290
|
-
return pn(
|
|
1335
|
+
return pn(o, n), i && o.append("hideUnavailableItems", "true"), a && o.append("show-invisible-items", "true"), o;
|
|
1291
1336
|
}
|
|
1292
|
-
function
|
|
1337
|
+
function W(e, n) {
|
|
1293
1338
|
return {
|
|
1294
1339
|
path: e,
|
|
1295
1340
|
params: n,
|
|
@@ -1299,108 +1344,108 @@ function j(e, n) {
|
|
|
1299
1344
|
}
|
|
1300
1345
|
};
|
|
1301
1346
|
}
|
|
1302
|
-
function
|
|
1303
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e,
|
|
1347
|
+
function G(e) {
|
|
1348
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a = Vt(t, r);
|
|
1304
1349
|
switch (n) {
|
|
1305
1350
|
case "product-search":
|
|
1306
1351
|
case "facets": {
|
|
1307
|
-
const { params:
|
|
1352
|
+
const { params: o, path: s } = Fe(
|
|
1308
1353
|
i,
|
|
1309
1354
|
r,
|
|
1310
|
-
|
|
1355
|
+
a,
|
|
1311
1356
|
{ includePagination: !0, includeSort: !0 }
|
|
1312
1357
|
);
|
|
1313
|
-
return
|
|
1358
|
+
return W(s, o);
|
|
1314
1359
|
}
|
|
1315
1360
|
case "catalog-count": {
|
|
1316
|
-
const { params:
|
|
1361
|
+
const { params: o, path: s } = Fe(
|
|
1317
1362
|
i,
|
|
1318
1363
|
r,
|
|
1319
|
-
|
|
1364
|
+
a,
|
|
1320
1365
|
{ includePagination: !1, includeSort: !1 }
|
|
1321
1366
|
);
|
|
1322
|
-
return
|
|
1367
|
+
return W(s, o);
|
|
1323
1368
|
}
|
|
1324
1369
|
case "products": {
|
|
1325
|
-
const
|
|
1326
|
-
return
|
|
1370
|
+
const o = jt(i, a.segmentParams);
|
|
1371
|
+
return W("", o);
|
|
1327
1372
|
}
|
|
1328
1373
|
case "search-suggestions": {
|
|
1329
|
-
const
|
|
1374
|
+
const o = new URLSearchParams({
|
|
1330
1375
|
query: i.query?.toString() ?? "",
|
|
1331
|
-
locale: r?.locale ??
|
|
1376
|
+
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1332
1377
|
});
|
|
1333
|
-
return
|
|
1378
|
+
return W("", o);
|
|
1334
1379
|
}
|
|
1335
1380
|
case "top-searches": {
|
|
1336
|
-
const
|
|
1337
|
-
locale: r?.locale ??
|
|
1381
|
+
const o = new URLSearchParams({
|
|
1382
|
+
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1338
1383
|
});
|
|
1339
|
-
return
|
|
1384
|
+
return W("", o);
|
|
1340
1385
|
}
|
|
1341
1386
|
default: {
|
|
1342
|
-
const
|
|
1343
|
-
throw new Error(`Unknown intelligent-search endpoint: ${
|
|
1387
|
+
const o = n;
|
|
1388
|
+
throw new Error(`Unknown intelligent-search endpoint: ${o}`);
|
|
1344
1389
|
}
|
|
1345
1390
|
}
|
|
1346
1391
|
}
|
|
1347
|
-
const
|
|
1348
|
-
function
|
|
1392
|
+
const Wt = 10;
|
|
1393
|
+
function Gt(e) {
|
|
1349
1394
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1350
1395
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1351
1396
|
}
|
|
1352
|
-
function
|
|
1397
|
+
function Ht(e) {
|
|
1353
1398
|
const t = un(e.headers?.cookie).cultureInfo || "";
|
|
1354
1399
|
return K(e) ? e.storage.locale || t : t || e.storage.locale || "";
|
|
1355
1400
|
}
|
|
1356
|
-
const
|
|
1401
|
+
const Xt = ({
|
|
1357
1402
|
account: e,
|
|
1358
1403
|
environment: n,
|
|
1359
1404
|
hideUnavailableItems: t,
|
|
1360
1405
|
simulationBehavior: r,
|
|
1361
1406
|
showSponsored: i,
|
|
1362
|
-
subDomainPrefix:
|
|
1363
|
-
},
|
|
1364
|
-
const s = `https://${e}.${n}.com.br`, c = dn(
|
|
1365
|
-
salesChannel:
|
|
1366
|
-
regionId:
|
|
1367
|
-
locale:
|
|
1407
|
+
subDomainPrefix: a
|
|
1408
|
+
}, o) => {
|
|
1409
|
+
const s = `https://${e}.${n}.com.br`, c = dn(o), d = un(o.headers?.cookie), u = () => ({
|
|
1410
|
+
salesChannel: o.storage.channel.salesChannel,
|
|
1411
|
+
regionId: Gt(o),
|
|
1412
|
+
locale: Ht(o),
|
|
1368
1413
|
hideUnavailableItems: t,
|
|
1369
1414
|
simulationBehavior: r,
|
|
1370
1415
|
showSponsored: i
|
|
1371
|
-
}), p = new Headers(
|
|
1416
|
+
}), p = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "", f = a && a.map((I) => I + ".").find((I) => p.includes(I)) || "", h = p.replace(f, ""), v = c({
|
|
1372
1417
|
"content-type": "application/json",
|
|
1373
1418
|
"X-FORWARDED-HOST": h
|
|
1374
1419
|
}), l = ({ type: I, ...D }) => {
|
|
1375
|
-
const
|
|
1376
|
-
endpoint:
|
|
1420
|
+
const A = I === "facets" ? "facets" : "product-search", _ = G({
|
|
1421
|
+
endpoint: A,
|
|
1377
1422
|
segment: d,
|
|
1378
1423
|
defaults: u(),
|
|
1379
1424
|
args: D
|
|
1380
1425
|
});
|
|
1381
1426
|
return y(
|
|
1382
|
-
`${s}/api/intelligent-search/v1/${
|
|
1427
|
+
`${s}/api/intelligent-search/v1/${A}/${_.path}?${_.params.toString()}`,
|
|
1383
1428
|
{ headers: v }
|
|
1384
1429
|
);
|
|
1385
1430
|
}, g = (I) => l({ ...I, type: "product_search" }), m = ({
|
|
1386
1431
|
field: I,
|
|
1387
1432
|
value: D,
|
|
1388
|
-
hideUnavailableItems:
|
|
1389
|
-
showInvisibleItems:
|
|
1433
|
+
hideUnavailableItems: A,
|
|
1434
|
+
showInvisibleItems: _
|
|
1390
1435
|
}) => {
|
|
1391
|
-
const
|
|
1436
|
+
const P = G({
|
|
1392
1437
|
endpoint: "products",
|
|
1393
1438
|
segment: d,
|
|
1394
1439
|
defaults: u(),
|
|
1395
1440
|
args: {
|
|
1396
1441
|
field: I,
|
|
1397
1442
|
value: D,
|
|
1398
|
-
hideUnavailableItems:
|
|
1399
|
-
showInvisibleItems:
|
|
1443
|
+
hideUnavailableItems: A,
|
|
1444
|
+
showInvisibleItems: _
|
|
1400
1445
|
}
|
|
1401
1446
|
});
|
|
1402
1447
|
return y(
|
|
1403
|
-
`${s}/api/intelligent-search/v1/products?${
|
|
1448
|
+
`${s}/api/intelligent-search/v1/products?${P.params.toString()}`,
|
|
1404
1449
|
{ headers: v }
|
|
1405
1450
|
);
|
|
1406
1451
|
};
|
|
@@ -1411,19 +1456,19 @@ const Ht = ({
|
|
|
1411
1456
|
productsByIdentifier: async ({
|
|
1412
1457
|
field: I,
|
|
1413
1458
|
values: D,
|
|
1414
|
-
showInvisibleItems:
|
|
1415
|
-
hideUnavailableItems:
|
|
1459
|
+
showInvisibleItems: A,
|
|
1460
|
+
hideUnavailableItems: _
|
|
1416
1461
|
}) => {
|
|
1417
|
-
const
|
|
1462
|
+
const P = we(Wt);
|
|
1418
1463
|
return (await Promise.all(
|
|
1419
1464
|
D.map(
|
|
1420
|
-
(C) =>
|
|
1465
|
+
(C) => P(async () => {
|
|
1421
1466
|
try {
|
|
1422
1467
|
return await m({
|
|
1423
1468
|
field: I,
|
|
1424
1469
|
value: C,
|
|
1425
|
-
hideUnavailableItems:
|
|
1426
|
-
showInvisibleItems:
|
|
1470
|
+
hideUnavailableItems: _,
|
|
1471
|
+
showInvisibleItems: A
|
|
1427
1472
|
});
|
|
1428
1473
|
} catch {
|
|
1429
1474
|
return null;
|
|
@@ -1435,7 +1480,7 @@ const Ht = ({
|
|
|
1435
1480
|
);
|
|
1436
1481
|
},
|
|
1437
1482
|
suggestedTerms: (I) => {
|
|
1438
|
-
const D =
|
|
1483
|
+
const D = G({
|
|
1439
1484
|
endpoint: "search-suggestions",
|
|
1440
1485
|
segment: d,
|
|
1441
1486
|
defaults: u(),
|
|
@@ -1447,7 +1492,7 @@ const Ht = ({
|
|
|
1447
1492
|
);
|
|
1448
1493
|
},
|
|
1449
1494
|
topSearches: () => {
|
|
1450
|
-
const I =
|
|
1495
|
+
const I = G({
|
|
1451
1496
|
endpoint: "top-searches",
|
|
1452
1497
|
segment: d,
|
|
1453
1498
|
defaults: u()
|
|
@@ -1458,7 +1503,7 @@ const Ht = ({
|
|
|
1458
1503
|
);
|
|
1459
1504
|
},
|
|
1460
1505
|
productCount: (I) => {
|
|
1461
|
-
const D =
|
|
1506
|
+
const D = G({
|
|
1462
1507
|
endpoint: "catalog-count",
|
|
1463
1508
|
segment: d,
|
|
1464
1509
|
defaults: u(),
|
|
@@ -1470,41 +1515,41 @@ const Ht = ({
|
|
|
1470
1515
|
);
|
|
1471
1516
|
}
|
|
1472
1517
|
};
|
|
1473
|
-
},
|
|
1474
|
-
const t =
|
|
1518
|
+
}, Yt = (e, n) => {
|
|
1519
|
+
const t = Xt(e, n), r = Ct(e, n), i = dt(e);
|
|
1475
1520
|
return {
|
|
1476
1521
|
search: t,
|
|
1477
1522
|
commerce: r,
|
|
1478
1523
|
catalog: i
|
|
1479
1524
|
};
|
|
1480
|
-
},
|
|
1481
|
-
const t = we(
|
|
1525
|
+
}, Jt = 20, Kt = (e) => e.entityType === "category", fe = (e) => e.entityType === "brand", Ne = (e) => e.entityType === "collection", Qt = (e, n) => {
|
|
1526
|
+
const t = we(Jt), r = async (i) => Promise.all(
|
|
1482
1527
|
i.map(
|
|
1483
|
-
(
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1528
|
+
(a) => t(async () => {
|
|
1529
|
+
const o = a.slug.toLowerCase(), s = a.locale, c = await n.commerce.catalog.byLinkId.category(
|
|
1530
|
+
o,
|
|
1486
1531
|
s
|
|
1487
1532
|
);
|
|
1488
1533
|
if (c)
|
|
1489
1534
|
return {
|
|
1490
1535
|
...c,
|
|
1491
1536
|
entityType: "category",
|
|
1492
|
-
slug:
|
|
1537
|
+
slug: o
|
|
1493
1538
|
};
|
|
1494
1539
|
const d = await n.commerce.catalog.byLinkId.brand(
|
|
1495
|
-
|
|
1540
|
+
o,
|
|
1496
1541
|
s
|
|
1497
1542
|
);
|
|
1498
1543
|
if (d)
|
|
1499
1544
|
return { ...d, entityType: "brand" };
|
|
1500
1545
|
const u = await n.commerce.catalog.byLinkId.collection(
|
|
1501
|
-
|
|
1546
|
+
o,
|
|
1502
1547
|
s
|
|
1503
1548
|
);
|
|
1504
1549
|
if (u)
|
|
1505
1550
|
return { ...u, entityType: "collection" };
|
|
1506
|
-
throw new
|
|
1507
|
-
`No catalog entity found for slug: ${
|
|
1551
|
+
throw new $(
|
|
1552
|
+
`No catalog entity found for slug: ${a.slug}. Cascade exhausted (category → brand → collection).`
|
|
1508
1553
|
);
|
|
1509
1554
|
})
|
|
1510
1555
|
)
|
|
@@ -1514,16 +1559,16 @@ const Ht = ({
|
|
|
1514
1559
|
batch: !1,
|
|
1515
1560
|
// Dedup by lowercased slug + captured locale so casing variants share an
|
|
1516
1561
|
// entry while same-slug / different-locale loads stay isolated.
|
|
1517
|
-
cacheKeyFn: ({ slug: i, locale:
|
|
1562
|
+
cacheKeyFn: ({ slug: i, locale: a }) => `${i.toLowerCase()}::${a ?? ""}`
|
|
1518
1563
|
});
|
|
1519
|
-
},
|
|
1564
|
+
}, Zt = (e, n) => {
|
|
1520
1565
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1521
1566
|
return new de(t);
|
|
1522
|
-
},
|
|
1523
|
-
const t = we(
|
|
1524
|
-
const
|
|
1525
|
-
country:
|
|
1526
|
-
postalCode:
|
|
1567
|
+
}, er = 1, nr = (e, n) => {
|
|
1568
|
+
const t = we(er), r = async (a) => {
|
|
1569
|
+
const o = a.reduce((p, { items: f }) => [...p, f], []), s = [...o.flat()], c = await n.commerce.checkout.simulation({
|
|
1570
|
+
country: a[0].country,
|
|
1571
|
+
postalCode: a[0].postalCode,
|
|
1527
1572
|
items: s
|
|
1528
1573
|
}), d = c.items.reduce(
|
|
1529
1574
|
(p, f) => {
|
|
@@ -1531,36 +1576,36 @@ const Ht = ({
|
|
|
1531
1576
|
return typeof h == "number" && h < p.length && (p[h] = f), p;
|
|
1532
1577
|
},
|
|
1533
1578
|
Array(s.length).fill(null)
|
|
1534
|
-
), u =
|
|
1579
|
+
), u = o.reduce(
|
|
1535
1580
|
(p, f) => [...p, f.length + p[p.length - 1]],
|
|
1536
1581
|
[0]
|
|
1537
1582
|
);
|
|
1538
|
-
return
|
|
1583
|
+
return o.map((p, f) => ({
|
|
1539
1584
|
...c,
|
|
1540
1585
|
items: d.slice(u[f], u[f + 1]).filter((h) => !!h)
|
|
1541
1586
|
}));
|
|
1542
|
-
}, i = async (
|
|
1587
|
+
}, i = async (a) => t(r, a);
|
|
1543
1588
|
return new de(i, {
|
|
1544
1589
|
maxBatchSize: 50
|
|
1545
1590
|
});
|
|
1546
|
-
},
|
|
1547
|
-
function
|
|
1591
|
+
}, tr = (e, n) => qn(e, n);
|
|
1592
|
+
function rr(e) {
|
|
1548
1593
|
return {
|
|
1549
1594
|
...e,
|
|
1550
|
-
description: e.description ?
|
|
1595
|
+
description: e.description ? tr(e.description) : e.description
|
|
1551
1596
|
};
|
|
1552
1597
|
}
|
|
1553
1598
|
const F = (e, n) => ({
|
|
1554
1599
|
...e,
|
|
1555
|
-
isVariantOf:
|
|
1556
|
-
}),
|
|
1600
|
+
isVariantOf: rr(n)
|
|
1601
|
+
}), ir = ({ flags: e }, n) => {
|
|
1557
1602
|
const t = async (r) => {
|
|
1558
|
-
const i = r.map((u) => u.split("-")[0]),
|
|
1603
|
+
const i = r.map((u) => u.split("-")[0]), a = r.some(
|
|
1559
1604
|
(u) => u.split("-")[1] === "invisibleItems"
|
|
1560
1605
|
), s = (await n.search.productsByIdentifier({
|
|
1561
1606
|
field: "sku",
|
|
1562
1607
|
values: i,
|
|
1563
|
-
showInvisibleItems:
|
|
1608
|
+
showInvisibleItems: a,
|
|
1564
1609
|
...e?.enableUnavailableItemsOnCart && {
|
|
1565
1610
|
hideUnavailableItems: !1
|
|
1566
1611
|
}
|
|
@@ -1573,7 +1618,7 @@ const F = (e, n) => ({
|
|
|
1573
1618
|
{}
|
|
1574
1619
|
), c = i.map((u) => s[u]), d = i.filter((u) => !s[u]);
|
|
1575
1620
|
if (d.length > 0)
|
|
1576
|
-
throw new
|
|
1621
|
+
throw new $(
|
|
1577
1622
|
`Search API did not found the following skus: ${d.join(",")}`
|
|
1578
1623
|
);
|
|
1579
1624
|
return c;
|
|
@@ -1582,25 +1627,25 @@ const F = (e, n) => ({
|
|
|
1582
1627
|
maxBatchSize: 99
|
|
1583
1628
|
// Max allowed batch size of Search API
|
|
1584
1629
|
});
|
|
1585
|
-
},
|
|
1586
|
-
const { clients: t } = n, r =
|
|
1630
|
+
}, ar = (e, n) => {
|
|
1631
|
+
const { clients: t } = n, r = ir(e, t), i = nr(e, t), a = Qt(e, t), o = Zt(e, t);
|
|
1587
1632
|
return {
|
|
1588
1633
|
skuLoader: r,
|
|
1589
1634
|
simulationLoader: i,
|
|
1590
|
-
collectionLoader:
|
|
1591
|
-
salesChannelLoader:
|
|
1635
|
+
collectionLoader: a,
|
|
1636
|
+
salesChannelLoader: o
|
|
1592
1637
|
};
|
|
1593
|
-
},
|
|
1638
|
+
}, B = (e) => e.AvailableQuantity > 0, x = (e) => e.spotPrice ?? 0, or = (e) => e.Price ?? 0, Le = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", mn = (e, n) => B(e) && !B(n) ? -1 : !B(e) && B(n) ? 1 : x(e) - x(n), sr = (e) => e === "available", V = (e, n = 0, t = 1) => {
|
|
1594
1639
|
const r = n / t;
|
|
1595
1640
|
return Math.round((e + r) * 100) / 100;
|
|
1596
|
-
},
|
|
1597
|
-
const t = e.filter(
|
|
1598
|
-
return n.includeTaxes ?
|
|
1641
|
+
}, cr = (e, n = { includeTaxes: !1 }) => {
|
|
1642
|
+
const t = e.filter(B), r = t[t.length - 1], i = r ? x(r) : 0;
|
|
1643
|
+
return n.includeTaxes ? V(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1599
1644
|
}, Be = (e, n = { includeTaxes: !1 }) => {
|
|
1600
|
-
const [t] = e.filter(
|
|
1601
|
-
return n.includeTaxes ?
|
|
1602
|
-
},
|
|
1603
|
-
highPrice: (e) =>
|
|
1645
|
+
const [t] = e.filter(B), r = t ? x(t) : 0;
|
|
1646
|
+
return n.includeTaxes ? V(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1647
|
+
}, lr = {
|
|
1648
|
+
highPrice: (e) => cr(e),
|
|
1604
1649
|
lowPrice: (e) => Be(e),
|
|
1605
1650
|
lowPriceWithTaxes: (e) => Be(e, { includeTaxes: !0 }),
|
|
1606
1651
|
offerCount: (e) => e.length,
|
|
@@ -1612,22 +1657,22 @@ const F = (e, n) => ({
|
|
|
1612
1657
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1613
1658
|
},
|
|
1614
1659
|
offers: (e) => e
|
|
1615
|
-
},
|
|
1660
|
+
}, dr = {
|
|
1616
1661
|
ratingValue: () => 5,
|
|
1617
1662
|
reviewCount: () => 0
|
|
1618
|
-
}, $e = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a",
|
|
1663
|
+
}, $e = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", ur = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", pr = (e) => {
|
|
1619
1664
|
let n = e.slice(0);
|
|
1620
1665
|
for (let t = 0; t < $e.length; t++)
|
|
1621
|
-
n = n.replace(new RegExp($e.charAt(t), "g"),
|
|
1666
|
+
n = n.replace(new RegExp($e.charAt(t), "g"), ur.charAt(t));
|
|
1622
1667
|
return n;
|
|
1623
|
-
},
|
|
1624
|
-
function
|
|
1668
|
+
}, gr = (e) => e.replace(/[·/_,:]/, "-");
|
|
1669
|
+
function oe(e) {
|
|
1625
1670
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1626
|
-
return pr(
|
|
1671
|
+
return gr(pr(t)).toLowerCase();
|
|
1627
1672
|
}
|
|
1628
|
-
const
|
|
1673
|
+
const H = (e) => Kt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? oe(e.name), hn = {
|
|
1629
1674
|
id: ({ id: e }) => e.toString(),
|
|
1630
|
-
slug: (e) =>
|
|
1675
|
+
slug: (e) => H(e),
|
|
1631
1676
|
seo: (e) => ({
|
|
1632
1677
|
title: e.title ?? e.name,
|
|
1633
1678
|
// pagetype.metaTagDescription and catalog `description` share the same
|
|
@@ -1637,19 +1682,19 @@ const G = (e) => Jt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? ae(e.name), hn
|
|
|
1637
1682
|
}),
|
|
1638
1683
|
type: (e) => fe(e) ? "Brand" : Ne(e) ? "Collection" : e.fatherCategoryId === null ? "Department" : "Category",
|
|
1639
1684
|
meta: async (e, n, t) => {
|
|
1640
|
-
const r =
|
|
1685
|
+
const r = H(e);
|
|
1641
1686
|
if (fe(e))
|
|
1642
1687
|
return { selectedFacets: [{ key: "brand", value: r }] };
|
|
1643
1688
|
if (Ne(e))
|
|
1644
1689
|
return { selectedFacets: [{ key: "productclusterids", value: e.id }] };
|
|
1645
|
-
const { defaultLocale: i } = J(t),
|
|
1646
|
-
(d, u) =>
|
|
1690
|
+
const { defaultLocale: i } = J(t), a = r.split("/").filter(Boolean), o = a.map(
|
|
1691
|
+
(d, u) => a.slice(0, u + 1).join("/")
|
|
1647
1692
|
), {
|
|
1648
1693
|
loaders: { collectionLoader: s }
|
|
1649
1694
|
} = t;
|
|
1650
1695
|
return {
|
|
1651
1696
|
selectedFacets: (await Promise.all(
|
|
1652
|
-
|
|
1697
|
+
o.map(
|
|
1653
1698
|
(d) => s.load({ slug: d, locale: ie(t) })
|
|
1654
1699
|
)
|
|
1655
1700
|
)).map((d, u) => ({
|
|
@@ -1661,16 +1706,16 @@ const G = (e) => Jt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? ae(e.name), hn
|
|
|
1661
1706
|
breadcrumbList: async (e, n, t) => {
|
|
1662
1707
|
const {
|
|
1663
1708
|
loaders: { collectionLoader: r }
|
|
1664
|
-
} = t,
|
|
1665
|
-
(c, d) =>
|
|
1709
|
+
} = t, a = H(e).split("/").filter(Boolean), o = a.map(
|
|
1710
|
+
(c, d) => a.slice(0, d + 1).join("/")
|
|
1666
1711
|
), s = await Promise.all(
|
|
1667
|
-
|
|
1712
|
+
o.map(
|
|
1668
1713
|
(c) => r.load({ slug: c, locale: ie(t) })
|
|
1669
1714
|
)
|
|
1670
1715
|
);
|
|
1671
1716
|
return {
|
|
1672
1717
|
itemListElement: s.map((c, d) => ({
|
|
1673
|
-
item: `/${
|
|
1718
|
+
item: `/${H(c)}`,
|
|
1674
1719
|
name: c.name,
|
|
1675
1720
|
position: d + 1
|
|
1676
1721
|
})),
|
|
@@ -1682,7 +1727,7 @@ const G = (e) => Jt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? ae(e.name), hn
|
|
|
1682
1727
|
if (!r.enabled) return null;
|
|
1683
1728
|
const i = Object.keys(r.locales ?? {});
|
|
1684
1729
|
if (i.length === 0) return null;
|
|
1685
|
-
const
|
|
1730
|
+
const a = t.storage.locale, o = H(e), s = o.split("/").filter(Boolean);
|
|
1686
1731
|
if (s.length === 0) return null;
|
|
1687
1732
|
const {
|
|
1688
1733
|
loaders: { collectionLoader: c }
|
|
@@ -1700,8 +1745,8 @@ const G = (e) => Jt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? ae(e.name), hn
|
|
|
1700
1745
|
return console.warn("[otherLocales] failed to load collection entities:", p), null;
|
|
1701
1746
|
}
|
|
1702
1747
|
return i.map((p) => {
|
|
1703
|
-
if (p ===
|
|
1704
|
-
return { locale: p, slug:
|
|
1748
|
+
if (p === a)
|
|
1749
|
+
return { locale: p, slug: o };
|
|
1705
1750
|
const f = [];
|
|
1706
1751
|
for (const h of u) {
|
|
1707
1752
|
const v = h.availableLinkIds?.[p];
|
|
@@ -1737,55 +1782,55 @@ const G = (e) => Jt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? ae(e.name), hn
|
|
|
1737
1782
|
}, ze = (e) => {
|
|
1738
1783
|
const n = e.split(":").map(Number);
|
|
1739
1784
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1740
|
-
},
|
|
1785
|
+
}, mr = (e) => typeof fn[e] == "string", hr = (e) => {
|
|
1741
1786
|
const n = e?.filter(
|
|
1742
|
-
(t) =>
|
|
1787
|
+
(t) => mr(t.key)
|
|
1743
1788
|
);
|
|
1744
1789
|
if (Array.isArray(n) && n.length > 1)
|
|
1745
|
-
throw new
|
|
1790
|
+
throw new E(
|
|
1746
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(",")}`
|
|
1747
1792
|
);
|
|
1748
1793
|
return n?.[0] ?? null;
|
|
1749
|
-
},
|
|
1794
|
+
}, fr = (e) => e?.find((n) => n.key === "slug")?.value ?? null, Sr = (e) => e?.find((n) => n.key === "id")?.value ?? null, Ve = (e) => e?.find((n) => n.key === "locale")?.value ?? null, xe = (e) => e?.find((n) => n.key === "channel")?.value ?? null, Se = (e, n) => {
|
|
1750
1795
|
let t = 0;
|
|
1751
1796
|
for (let r = 1; r < e.length; r++)
|
|
1752
1797
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1753
1798
|
return e[t];
|
|
1754
|
-
}, Sr = {
|
|
1755
|
-
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1756
1799
|
}, yr = {
|
|
1800
|
+
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1801
|
+
}, Ir = {
|
|
1757
1802
|
key: ({ key: e }) => e,
|
|
1758
1803
|
label: ({ name: e }) => e,
|
|
1759
1804
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1760
|
-
},
|
|
1805
|
+
}, vr = {
|
|
1761
1806
|
key: ({ key: e }) => e,
|
|
1762
1807
|
label: ({ name: e }) => e,
|
|
1763
1808
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1764
1809
|
const i = ze(
|
|
1765
1810
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1766
|
-
),
|
|
1811
|
+
), o = Se(e, (s, c) => s.range.from - c.range.from)?.range?.from ?? 0;
|
|
1767
1812
|
return {
|
|
1768
|
-
selected: i?.[0] ??
|
|
1769
|
-
absolute:
|
|
1813
|
+
selected: i?.[0] ?? o,
|
|
1814
|
+
absolute: o
|
|
1770
1815
|
};
|
|
1771
1816
|
},
|
|
1772
1817
|
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1773
1818
|
const i = ze(
|
|
1774
1819
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1775
|
-
),
|
|
1820
|
+
), o = Se(e, (s, c) => c.range.to - s.range.to)?.range?.to ?? 0;
|
|
1776
1821
|
return {
|
|
1777
|
-
selected: i?.[1] ??
|
|
1778
|
-
absolute:
|
|
1822
|
+
selected: i?.[1] ?? o,
|
|
1823
|
+
absolute: o
|
|
1779
1824
|
};
|
|
1780
1825
|
}
|
|
1781
|
-
},
|
|
1826
|
+
}, Or = {
|
|
1782
1827
|
value: ({ value: e }) => e,
|
|
1783
1828
|
label: ({ name: e }) => e || "unknown",
|
|
1784
1829
|
selected: ({ selected: e }) => e,
|
|
1785
1830
|
quantity: ({ quantity: e }) => e
|
|
1786
|
-
},
|
|
1831
|
+
}, Cr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1787
1832
|
if (!n?.orderId)
|
|
1788
|
-
throw new
|
|
1833
|
+
throw new E("Missing orderId");
|
|
1789
1834
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1790
1835
|
};
|
|
1791
1836
|
function Sn(e) {
|
|
@@ -1806,50 +1851,50 @@ function Sn(e) {
|
|
|
1806
1851
|
}
|
|
1807
1852
|
return null;
|
|
1808
1853
|
}
|
|
1809
|
-
function
|
|
1854
|
+
function br(e) {
|
|
1810
1855
|
if (!e || e.status !== "pending") return !1;
|
|
1811
1856
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1812
1857
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1813
1858
|
}
|
|
1814
|
-
const
|
|
1859
|
+
const wr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1815
1860
|
const r = await t.oms.processOrderAuthorization(n), i = Sn(r);
|
|
1816
1861
|
return {
|
|
1817
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1862
|
+
isPendingForOtherAuthorizer: !i && br(r),
|
|
1818
1863
|
ruleForAuthorization: i
|
|
1819
1864
|
};
|
|
1820
|
-
},
|
|
1865
|
+
}, Dr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1821
1866
|
if (!n?.objectKey)
|
|
1822
|
-
throw new
|
|
1867
|
+
throw new E("Missing objectKey");
|
|
1823
1868
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
1824
1869
|
return t.orderEntry.startOperation({
|
|
1825
1870
|
objectKey: n.objectKey,
|
|
1826
1871
|
orderFormId: r,
|
|
1827
1872
|
sessionToken: n.sessionToken ?? void 0
|
|
1828
1873
|
});
|
|
1829
|
-
},
|
|
1874
|
+
}, Ar = async (e, n, t) => {
|
|
1830
1875
|
if (!(await t.clients.commerce.recommendation.startRecommendationSession())?.recommendationsUserId)
|
|
1831
1876
|
throw new Error(
|
|
1832
1877
|
"Failed to start recommendation session: no session data returned"
|
|
1833
1878
|
);
|
|
1834
1879
|
return !0;
|
|
1835
|
-
}, Pr = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }),
|
|
1836
|
-
const { fileContent: r, fileName: i, mimeType:
|
|
1837
|
-
if (!r || !i || !
|
|
1838
|
-
throw new
|
|
1880
|
+
}, Pr = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), _r = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1881
|
+
const { fileContent: r, fileName: i, mimeType: a } = n;
|
|
1882
|
+
if (!r || !i || !a)
|
|
1883
|
+
throw new E(
|
|
1839
1884
|
"Missing required fields: fileContent, fileName, mimeType"
|
|
1840
1885
|
);
|
|
1841
|
-
const
|
|
1842
|
-
if (Math.floor(
|
|
1843
|
-
throw new
|
|
1886
|
+
const o = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
|
|
1887
|
+
if (Math.floor(o.length * 3 / 4) > s)
|
|
1888
|
+
throw new E("File exceeds maximum allowed size of 5MB");
|
|
1844
1889
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
|
|
1845
|
-
|
|
1890
|
+
o
|
|
1846
1891
|
))
|
|
1847
|
-
throw new
|
|
1848
|
-
const u = Buffer.from(
|
|
1892
|
+
throw new E("Invalid Base64 fileContent");
|
|
1893
|
+
const u = Buffer.from(o, "base64");
|
|
1849
1894
|
return await t.orderEntry.uploadFile({
|
|
1850
1895
|
fileBuffer: u,
|
|
1851
1896
|
fileName: i,
|
|
1852
|
-
mimeType:
|
|
1897
|
+
mimeType: a
|
|
1853
1898
|
});
|
|
1854
1899
|
};
|
|
1855
1900
|
class ee {
|
|
@@ -1893,7 +1938,7 @@ function In(e) {
|
|
|
1893
1938
|
valueReference: ne.attachment
|
|
1894
1939
|
};
|
|
1895
1940
|
}
|
|
1896
|
-
function
|
|
1941
|
+
function Er(e) {
|
|
1897
1942
|
return {
|
|
1898
1943
|
propertyID: e.id,
|
|
1899
1944
|
name: e.name,
|
|
@@ -1924,16 +1969,16 @@ const Tr = (e) => {
|
|
|
1924
1969
|
geoCoordinates: []
|
|
1925
1970
|
};
|
|
1926
1971
|
if (t) {
|
|
1927
|
-
const i = typeof t == "object" && "latitude" in t ? t.latitude : null,
|
|
1928
|
-
r.geoCoordinates = i !== null &&
|
|
1972
|
+
const i = typeof t == "object" && "latitude" in t ? t.latitude : null, a = typeof t == "object" && "longitude" in t ? t.longitude : null;
|
|
1973
|
+
r.geoCoordinates = i !== null && a !== null ? [a, i] : [];
|
|
1929
1974
|
}
|
|
1930
1975
|
return [r];
|
|
1931
|
-
},
|
|
1932
|
-
const r = n.postalCode, i = n.geoCoordinates,
|
|
1933
|
-
if (!t &&
|
|
1934
|
-
return [
|
|
1935
|
-
if (t &&
|
|
1936
|
-
for (const s of
|
|
1976
|
+
}, Ur = (e, n, t) => {
|
|
1977
|
+
const r = n.postalCode, i = n.geoCoordinates, a = e?.shippingData?.availableAddresses ?? [], o = e?.shippingData?.selectedAddresses ?? [];
|
|
1978
|
+
if (!t && o.length > 0)
|
|
1979
|
+
return [o[0]];
|
|
1980
|
+
if (t && a.length > 0)
|
|
1981
|
+
for (const s of a) {
|
|
1937
1982
|
if (r && i && (s.postalCode === r || s.geoCoordinates[0] === i.longitude && s.geoCoordinates[1] === i.latitude))
|
|
1938
1983
|
return [s];
|
|
1939
1984
|
if (r && !i && s.postalCode === r)
|
|
@@ -1943,22 +1988,22 @@ const Tr = (e) => {
|
|
|
1943
1988
|
}
|
|
1944
1989
|
return null;
|
|
1945
1990
|
}, On = (e, n) => {
|
|
1946
|
-
if (!
|
|
1991
|
+
if (!Rr(n))
|
|
1947
1992
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1948
|
-
if (!
|
|
1993
|
+
if (!Br(e))
|
|
1949
1994
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1950
1995
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
1951
|
-
if (
|
|
1996
|
+
if (Fr(t, n.postalCode) || Nr(t, n.geoCoordinates) || Lr(t, n.addressType))
|
|
1952
1997
|
return { updateShipping: !0, addressChanged: !0 };
|
|
1953
1998
|
const { logisticsInfo: r } = e.shippingData;
|
|
1954
|
-
return
|
|
1955
|
-
},
|
|
1956
|
-
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate:
|
|
1999
|
+
return $r(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
2000
|
+
}, Rr = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, Fr = (e, n) => typeof n == "string" && e?.postalCode !== n, Nr = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), Lr = (e, n) => typeof n == "string" && e?.addressType !== n, Br = (e) => e.items.length !== 0, $r = (e, n) => {
|
|
2001
|
+
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
|
|
1957
2002
|
return e.some(
|
|
1958
|
-
({ selectedDeliveryChannel:
|
|
1959
|
-
const d = t &&
|
|
1960
|
-
return c?.some((p) => d && p.deliveryChannel === t || u && p.id === r ? !0 : i &&
|
|
1961
|
-
(f) => f?.startDateUtc === i && f?.endDateUtc ===
|
|
2003
|
+
({ selectedDeliveryChannel: o, selectedSla: s, slas: c }) => {
|
|
2004
|
+
const d = t && o !== t, u = r && s !== r;
|
|
2005
|
+
return c?.some((p) => d && p.deliveryChannel === t || u && p.id === r ? !0 : i && a && p.deliveryChannel === t && p.id === r && (!p?.deliveryWindow || p?.deliveryWindow?.startDateUtc !== i || p?.deliveryWindow?.endDateUtc !== a) && p.availableDeliveryWindows?.some(
|
|
2006
|
+
(f) => f?.startDateUtc === i && f?.endDateUtc === a
|
|
1962
2007
|
));
|
|
1963
2008
|
}
|
|
1964
2009
|
);
|
|
@@ -1979,7 +2024,7 @@ const Tr = (e) => {
|
|
|
1979
2024
|
additionalProperty: e.attachments.map(In)
|
|
1980
2025
|
},
|
|
1981
2026
|
index: n
|
|
1982
|
-
}),
|
|
2027
|
+
}), Mr = (e) => ({
|
|
1983
2028
|
quantity: e.quantity,
|
|
1984
2029
|
seller: e.seller.identifier,
|
|
1985
2030
|
id: e.itemOffered.sku,
|
|
@@ -1992,15 +2037,15 @@ const Tr = (e) => {
|
|
|
1992
2037
|
}), qe = (e) => e.reduce((n, t) => {
|
|
1993
2038
|
const r = Ie(t);
|
|
1994
2039
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
1995
|
-
}, /* @__PURE__ */ new Map()),
|
|
2040
|
+
}, /* @__PURE__ */ new Map()), zr = (e, n) => {
|
|
1996
2041
|
const t = ({ priceToken: s, ...c }, d) => ({
|
|
1997
2042
|
...c,
|
|
1998
2043
|
itemOffered: {
|
|
1999
2044
|
sku: c.itemOffered.sku
|
|
2000
2045
|
},
|
|
2001
2046
|
index: d
|
|
2002
|
-
}), r = n.items.map(ce).map(t), i = e.acceptedOffer.map(t),
|
|
2003
|
-
return
|
|
2047
|
+
}), r = n.items.map(ce).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = De(r, i);
|
|
2048
|
+
return a && o;
|
|
2004
2049
|
};
|
|
2005
2050
|
function bn(e, n) {
|
|
2006
2051
|
return e?.some(
|
|
@@ -2015,22 +2060,22 @@ function wn(e, n) {
|
|
|
2015
2060
|
const je = (e) => {
|
|
2016
2061
|
const n = e.items.reduce(
|
|
2017
2062
|
(t, r, i) => {
|
|
2018
|
-
const
|
|
2019
|
-
return t[
|
|
2063
|
+
const a = wn(e.items, r.id) || bn(e.items, r.id) ? `${Ie(ce(r))}::${i}` : Ie(ce(r));
|
|
2064
|
+
return t[a] || (t[a] = []), t[a].push(r), t;
|
|
2020
2065
|
},
|
|
2021
2066
|
{}
|
|
2022
2067
|
);
|
|
2023
2068
|
return {
|
|
2024
2069
|
...e,
|
|
2025
2070
|
items: Object.values(n).map((t) => {
|
|
2026
|
-
const [r] = t, i = t.reduce((
|
|
2027
|
-
(
|
|
2071
|
+
const [r] = t, i = t.reduce((o, s) => o + s.quantity, 0), a = t.reduce(
|
|
2072
|
+
(o, s) => o + (s?.priceDefinition?.total ?? (s?.quantity ?? 0) * (s?.sellingPrice ?? 0)),
|
|
2028
2073
|
0
|
|
2029
2074
|
);
|
|
2030
2075
|
return {
|
|
2031
2076
|
...r,
|
|
2032
2077
|
quantity: i,
|
|
2033
|
-
sellingPrice:
|
|
2078
|
+
sellingPrice: a / i
|
|
2034
2079
|
};
|
|
2035
2080
|
})
|
|
2036
2081
|
};
|
|
@@ -2044,9 +2089,9 @@ const je = (e) => {
|
|
|
2044
2089
|
shouldSplitItem: t,
|
|
2045
2090
|
...r ? { salesChannel: r } : {}
|
|
2046
2091
|
},
|
|
2047
|
-
messages: e.messages.map(({ text: i, status:
|
|
2092
|
+
messages: e.messages.map(({ text: i, status: a }) => ({
|
|
2048
2093
|
text: i,
|
|
2049
|
-
status:
|
|
2094
|
+
status: a.toUpperCase()
|
|
2050
2095
|
}))
|
|
2051
2096
|
}), Dn = ({ items: e }, n) => {
|
|
2052
2097
|
const t = e.map((r) => ({
|
|
@@ -2075,12 +2120,12 @@ const je = (e) => {
|
|
|
2075
2120
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
2076
2121
|
), r;
|
|
2077
2122
|
}
|
|
2078
|
-
},
|
|
2123
|
+
}, Vr = (e, n) => {
|
|
2079
2124
|
const r = e.customData?.customApps.find(
|
|
2080
|
-
(
|
|
2125
|
+
(a) => a.id === "faststore"
|
|
2081
2126
|
)?.fields?.cartEtag;
|
|
2082
2127
|
return r == null ? !0 : Dn(e, n) !== r;
|
|
2083
|
-
},
|
|
2128
|
+
}, xr = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
2084
2129
|
id: e
|
|
2085
2130
|
}), Ge = async (e, n, { clients: { commerce: t } }) => {
|
|
2086
2131
|
if (!n)
|
|
@@ -2090,7 +2135,7 @@ const je = (e) => {
|
|
|
2090
2135
|
n
|
|
2091
2136
|
);
|
|
2092
2137
|
if (r) {
|
|
2093
|
-
const
|
|
2138
|
+
const a = Ur(e, n, i), s = a || Tr(n);
|
|
2094
2139
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
2095
2140
|
{
|
|
2096
2141
|
id: e.orderFormId,
|
|
@@ -2110,7 +2155,7 @@ const je = (e) => {
|
|
|
2110
2155
|
);
|
|
2111
2156
|
}
|
|
2112
2157
|
return e;
|
|
2113
|
-
},
|
|
2158
|
+
}, qr = (e, n) => {
|
|
2114
2159
|
if (!e)
|
|
2115
2160
|
return "";
|
|
2116
2161
|
const r = Q(e)[n];
|
|
@@ -2121,35 +2166,35 @@ const je = (e) => {
|
|
|
2121
2166
|
n.salesChannel
|
|
2122
2167
|
);
|
|
2123
2168
|
return t ? (se(e, t), n.salesChannel ? String(n.salesChannel) : null) : null;
|
|
2124
|
-
}, Xe = (e, n, t, r) => r ? ve(e, n, t, r) : null,
|
|
2125
|
-
const i =
|
|
2169
|
+
}, Xe = (e, n, t, r) => r ? ve(e, n, t, r) : null, jr = async (e, { cart: { order: n }, session: t }, r) => {
|
|
2170
|
+
const i = qr(
|
|
2126
2171
|
r.headers.cookie,
|
|
2127
2172
|
"checkout.vtex.com"
|
|
2128
2173
|
), {
|
|
2129
|
-
clients: { commerce:
|
|
2130
|
-
loaders: { skuLoader:
|
|
2174
|
+
clients: { commerce: a },
|
|
2175
|
+
loaders: { skuLoader: o }
|
|
2131
2176
|
} = r, s = t?.channel, c = t?.locale;
|
|
2132
2177
|
s && se(r, s), c && ye(r, c);
|
|
2133
|
-
const d = i || void 0, u = await
|
|
2178
|
+
const d = i || void 0, u = await a.checkout.orderForm({
|
|
2134
2179
|
id: d,
|
|
2135
2180
|
channel: r.storage.channel,
|
|
2136
2181
|
preserveSalesChannel: !!d
|
|
2137
2182
|
}), p = u.orderFormId;
|
|
2138
|
-
u.messages.length !== 0 && await
|
|
2139
|
-
const f = Q(r?.headers?.cookie ?? "")?.vtex_session, h =
|
|
2140
|
-
if (
|
|
2183
|
+
u.messages.length !== 0 && await xr(p, r);
|
|
2184
|
+
const f = Q(r?.headers?.cookie ?? "")?.vtex_session, h = z(f), { acceptedOffer: v, shouldSplitItem: l } = n;
|
|
2185
|
+
if (Vr(u, h)) {
|
|
2141
2186
|
const C = He(
|
|
2142
2187
|
r,
|
|
2143
2188
|
u
|
|
2144
2189
|
), N = await We(
|
|
2145
2190
|
u,
|
|
2146
|
-
|
|
2191
|
+
a,
|
|
2147
2192
|
h
|
|
2148
2193
|
).then(je);
|
|
2149
2194
|
if (p)
|
|
2150
2195
|
return ve(
|
|
2151
2196
|
N,
|
|
2152
|
-
|
|
2197
|
+
o,
|
|
2153
2198
|
l,
|
|
2154
2199
|
C
|
|
2155
2200
|
);
|
|
@@ -2157,112 +2202,112 @@ const je = (e) => {
|
|
|
2157
2202
|
const m = He(
|
|
2158
2203
|
r,
|
|
2159
2204
|
u
|
|
2160
|
-
), S = qe(v), O = qe(u.items.map(ce)), w = Array.from(O.entries()), b = Array.from(S.entries()), { itemsToAdd:
|
|
2161
|
-
(C, [N,
|
|
2162
|
-
const
|
|
2163
|
-
if (!
|
|
2164
|
-
return
|
|
2165
|
-
const [te, ...
|
|
2205
|
+
), S = qe(v), O = qe(u.items.map(ce)), w = Array.from(O.entries()), b = Array.from(S.entries()), { itemsToAdd: k, itemsToUpdate: I } = b.reduce(
|
|
2206
|
+
(C, [N, Ae]) => {
|
|
2207
|
+
const Pe = O.get(N);
|
|
2208
|
+
if (!Pe)
|
|
2209
|
+
return Ae.forEach((q) => C.itemsToAdd.push(q)), C;
|
|
2210
|
+
const [te, ...Un] = Pe;
|
|
2166
2211
|
if (wn(u.items, te.itemOffered.sku) || bn(u.items, te.itemOffered.sku))
|
|
2167
2212
|
return C.itemsToUpdate.push(te), C;
|
|
2168
|
-
const Rn =
|
|
2213
|
+
const Rn = Ae.reduce((q, Fn) => q + Fn.quantity, 0);
|
|
2169
2214
|
return C.itemsToUpdate.push({
|
|
2170
2215
|
...te,
|
|
2171
2216
|
quantity: Rn
|
|
2172
|
-
}),
|
|
2217
|
+
}), Un.forEach((q) => C.itemsToUpdate.push({ ...q, quantity: 0 })), C;
|
|
2173
2218
|
},
|
|
2174
2219
|
{
|
|
2175
2220
|
itemsToAdd: [],
|
|
2176
2221
|
itemsToUpdate: []
|
|
2177
2222
|
}
|
|
2178
|
-
), D = w.filter(([C]) => !S.has(C)).flatMap(([, C]) => C.map((N) => ({ ...N, quantity: 0 }))),
|
|
2179
|
-
|
|
2180
|
-
), { updateShipping:
|
|
2181
|
-
if (
|
|
2223
|
+
), D = w.filter(([C]) => !S.has(C)).flatMap(([, C]) => C.map((N) => ({ ...N, quantity: 0 }))), A = [...k, ...I, ...D].map(
|
|
2224
|
+
Mr
|
|
2225
|
+
), { updateShipping: _ } = t ? On(u, t) : { updateShipping: !1 };
|
|
2226
|
+
if (A.length === 0 && !_)
|
|
2182
2227
|
return Xe(
|
|
2183
2228
|
u,
|
|
2184
|
-
|
|
2229
|
+
o,
|
|
2185
2230
|
l,
|
|
2186
2231
|
m
|
|
2187
2232
|
);
|
|
2188
|
-
let
|
|
2189
|
-
|
|
2233
|
+
let P;
|
|
2234
|
+
A.length > 0 ? P = await a.checkout.updateOrderFormItems({
|
|
2190
2235
|
id: u.orderFormId,
|
|
2191
|
-
orderItems:
|
|
2236
|
+
orderItems: A,
|
|
2192
2237
|
shouldSplitItem: l
|
|
2193
2238
|
}).then(
|
|
2194
2239
|
(C) => Ge(C, t, r)
|
|
2195
|
-
) :
|
|
2240
|
+
) : P = await Ge(
|
|
2196
2241
|
u,
|
|
2197
2242
|
t,
|
|
2198
2243
|
r
|
|
2199
|
-
),
|
|
2244
|
+
), P = await Promise.resolve(P).then((C) => {
|
|
2200
2245
|
if (t?.marketingData) {
|
|
2201
2246
|
const N = {
|
|
2202
2247
|
...C.marketingData,
|
|
2203
2248
|
...t.marketingData
|
|
2204
2249
|
};
|
|
2205
|
-
return
|
|
2250
|
+
return a.checkout.marketingData({
|
|
2206
2251
|
id: u.orderFormId,
|
|
2207
2252
|
marketingData: N
|
|
2208
2253
|
});
|
|
2209
2254
|
}
|
|
2210
2255
|
return C;
|
|
2211
|
-
}).then((C) => c && C.clientPreferencesData?.locale !== c ?
|
|
2256
|
+
}).then((C) => c && C.clientPreferencesData?.locale !== c ? a.checkout.clientPreferencesData({
|
|
2212
2257
|
id: C.orderFormId,
|
|
2213
2258
|
clientPreferencesData: {
|
|
2214
2259
|
...C.clientPreferencesData,
|
|
2215
2260
|
locale: c
|
|
2216
2261
|
}
|
|
2217
|
-
}) : C).then((C) => We(C,
|
|
2262
|
+
}) : C).then((C) => We(C, a, h)).then(je);
|
|
2218
2263
|
const R = De(
|
|
2219
2264
|
u.messages,
|
|
2220
|
-
|
|
2265
|
+
P.messages
|
|
2221
2266
|
);
|
|
2222
|
-
return
|
|
2223
|
-
|
|
2224
|
-
|
|
2267
|
+
return zr(n, P) && R ? Xe(
|
|
2268
|
+
P,
|
|
2269
|
+
o,
|
|
2225
2270
|
l,
|
|
2226
2271
|
m
|
|
2227
2272
|
) : ve(
|
|
2228
|
-
|
|
2229
|
-
|
|
2273
|
+
P,
|
|
2274
|
+
o,
|
|
2230
2275
|
l,
|
|
2231
2276
|
m
|
|
2232
2277
|
);
|
|
2233
2278
|
};
|
|
2234
|
-
function
|
|
2235
|
-
const i = e.hasOnlyDefaultSalesChannel === !1,
|
|
2279
|
+
function Wr(e, n, t, r) {
|
|
2280
|
+
const i = e.hasOnlyDefaultSalesChannel === !1, a = n ?? void 0, o = t ?? e.regionId;
|
|
2236
2281
|
return ee.stringify({
|
|
2237
|
-
salesChannel: i ? e.salesChannel ||
|
|
2238
|
-
regionId:
|
|
2282
|
+
salesChannel: i ? e.salesChannel || a : a ?? e.salesChannel,
|
|
2283
|
+
regionId: o ?? void 0,
|
|
2239
2284
|
seller: r,
|
|
2240
|
-
hasOnlyDefaultSalesChannel: i ? !1 : !
|
|
2285
|
+
hasOnlyDefaultSalesChannel: i ? !1 : !a
|
|
2241
2286
|
});
|
|
2242
2287
|
}
|
|
2243
|
-
const
|
|
2288
|
+
const Gr = (e) => {
|
|
2244
2289
|
const n = (e?.corporateName ?? "").trim();
|
|
2245
2290
|
return n || (e?.firstName ?? "").trim();
|
|
2246
|
-
},
|
|
2291
|
+
}, Hr = (e) => {
|
|
2247
2292
|
if (!e || typeof e != "object")
|
|
2248
2293
|
return !1;
|
|
2249
2294
|
const n = e;
|
|
2250
2295
|
return typeof n.customerId == "string" && n.customerId.trim() !== "" && typeof n.contractName == "string" && typeof n.isActive == "boolean" && typeof n.isCurrent == "boolean";
|
|
2251
|
-
},
|
|
2296
|
+
}, Xr = (e) => {
|
|
2252
2297
|
const n = e?.availableContracts?.value;
|
|
2253
|
-
return Array.isArray(n) ? n.filter(
|
|
2254
|
-
},
|
|
2298
|
+
return Array.isArray(n) ? n.filter(Hr) : [];
|
|
2299
|
+
}, Yr = (e) => e?.customerId ? !!((e.contractName ?? "").trim() && e.isActive) : !1, Ye = (e) => e?.namespaces?.shopper?.activeContractId?.value?.trim() ?? e?.namespaces?.authentication?.customerId?.value?.trim() ?? e?.namespaces?.profile?.id?.value?.trim() ?? "", Jr = (e, n = "") => {
|
|
2255
2300
|
const t = n.trim();
|
|
2256
|
-
return e.filter(
|
|
2301
|
+
return e.filter(Yr).map((r) => ({
|
|
2257
2302
|
id: r.customerId,
|
|
2258
2303
|
corporateName: r.contractName.trim(),
|
|
2259
2304
|
isActive: t ? r.customerId === t : r.isCurrent
|
|
2260
2305
|
}));
|
|
2261
|
-
},
|
|
2262
|
-
const t =
|
|
2306
|
+
}, An = (e, n) => {
|
|
2307
|
+
const t = Gr(e);
|
|
2263
2308
|
return t || (n?.firstName?.value ?? "").trim();
|
|
2264
2309
|
};
|
|
2265
|
-
async function
|
|
2310
|
+
async function Kr(e, n, t) {
|
|
2266
2311
|
try {
|
|
2267
2312
|
const r = await e.commerce.checkout.address({
|
|
2268
2313
|
postalCode: t,
|
|
@@ -2279,15 +2324,15 @@ async function Jr(e, n, t) {
|
|
|
2279
2324
|
), r;
|
|
2280
2325
|
}
|
|
2281
2326
|
}
|
|
2282
|
-
function
|
|
2283
|
-
const
|
|
2284
|
-
return
|
|
2327
|
+
function Qr(e, n, t, r, i, a) {
|
|
2328
|
+
const o = new URLSearchParams(e);
|
|
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(
|
|
2285
2330
|
"geoCoordinates",
|
|
2286
2331
|
`${i.longitude},${i.latitude}`
|
|
2287
2332
|
// long,lat is the format expected
|
|
2288
|
-
),
|
|
2333
|
+
), o.set("locale", a), o;
|
|
2289
2334
|
}
|
|
2290
|
-
function
|
|
2335
|
+
function Zr(e, n) {
|
|
2291
2336
|
return {
|
|
2292
2337
|
utmCampaign: e.get("utm_campaign") ?? n?.utmCampaign ?? "",
|
|
2293
2338
|
utmMedium: e.get("utm_medium") ?? n?.utmMedium ?? "",
|
|
@@ -2297,14 +2342,14 @@ function Qr(e, n) {
|
|
|
2297
2342
|
utmiPart: e.get("utmi_pc") ?? n?.utmiPart ?? ""
|
|
2298
2343
|
};
|
|
2299
2344
|
}
|
|
2300
|
-
async function
|
|
2301
|
-
const r =
|
|
2345
|
+
async function ei(e, n, t) {
|
|
2346
|
+
const r = z(L(n ?? "", t));
|
|
2302
2347
|
let i = !1;
|
|
2303
2348
|
if (r)
|
|
2304
2349
|
try {
|
|
2305
2350
|
i = (await e.commerce.vtexid.validate())?.authStatus?.toLowerCase() === "success";
|
|
2306
|
-
} catch (
|
|
2307
|
-
console.warn("JWT validation failed:",
|
|
2351
|
+
} catch (a) {
|
|
2352
|
+
console.warn("JWT validation failed:", a), i = !1;
|
|
2308
2353
|
}
|
|
2309
2354
|
return {
|
|
2310
2355
|
isRepresentative: i ? !!r?.isRepresentative : !1,
|
|
@@ -2312,18 +2357,18 @@ async function Zr(e, n, t) {
|
|
|
2312
2357
|
unitId: i ? r?.unitId : void 0
|
|
2313
2358
|
};
|
|
2314
2359
|
}
|
|
2315
|
-
async function
|
|
2360
|
+
async function ni(e, n, t, r, i, a) {
|
|
2316
2361
|
return !n.seller || !(t || r) ? void 0 : (await e.commerce.checkout.region({
|
|
2317
2362
|
postalCode: t,
|
|
2318
2363
|
geoCoordinates: r,
|
|
2319
2364
|
country: i,
|
|
2320
|
-
salesChannel:
|
|
2365
|
+
salesChannel: a
|
|
2321
2366
|
}))?.[0]?.sellers.find((c) => n.seller === c.id)?.id;
|
|
2322
2367
|
}
|
|
2323
2368
|
function Je(e) {
|
|
2324
2369
|
return typeof e?.value == "string" ? e.value : "";
|
|
2325
2370
|
}
|
|
2326
|
-
function
|
|
2371
|
+
function ti(e) {
|
|
2327
2372
|
if (!e.isRepresentative)
|
|
2328
2373
|
return null;
|
|
2329
2374
|
const n = Je(e.shopper?.firstName), t = Je(e.shopper?.lastName);
|
|
@@ -2337,11 +2382,11 @@ function ni(e) {
|
|
|
2337
2382
|
userName: `${n} ${t}`.trim(),
|
|
2338
2383
|
userEmail: e.authentication?.storeUserEmail?.value ?? "",
|
|
2339
2384
|
savedPostalCode: e.publicData?.postalCode?.value ?? "",
|
|
2340
|
-
contractName:
|
|
2385
|
+
contractName: An(e.contract, e.profile),
|
|
2341
2386
|
organizationManager: e.shopper?.organizationManager?.value ?? !1
|
|
2342
2387
|
};
|
|
2343
2388
|
}
|
|
2344
|
-
function
|
|
2389
|
+
function ri(e) {
|
|
2345
2390
|
return e?.id ? {
|
|
2346
2391
|
id: e.id?.value ?? "",
|
|
2347
2392
|
email: e.email?.value ?? "",
|
|
@@ -2349,29 +2394,29 @@ function ti(e) {
|
|
|
2349
2394
|
familyName: e.lastName?.value ?? ""
|
|
2350
2395
|
} : null;
|
|
2351
2396
|
}
|
|
2352
|
-
const
|
|
2353
|
-
const
|
|
2397
|
+
const ii = async (e, { session: n, search: t }, { clients: r, headers: i, account: a }) => {
|
|
2398
|
+
const o = ee.parse(n.channel ?? ""), s = String(n.postalCode ?? ""), c = n.country ?? "";
|
|
2354
2399
|
let d = n.city ?? null, u = n.geoCoordinates ?? null;
|
|
2355
2400
|
if ((!d || !u) && s !== "" && c !== "") {
|
|
2356
|
-
const
|
|
2401
|
+
const P = await Kr(
|
|
2357
2402
|
r,
|
|
2358
2403
|
c,
|
|
2359
2404
|
s
|
|
2360
2405
|
);
|
|
2361
|
-
d =
|
|
2406
|
+
d = P.city, u = P.geoCoordinates;
|
|
2362
2407
|
}
|
|
2363
|
-
const f =
|
|
2408
|
+
const f = Qr(
|
|
2364
2409
|
t,
|
|
2365
|
-
|
|
2410
|
+
o,
|
|
2366
2411
|
s,
|
|
2367
2412
|
c,
|
|
2368
2413
|
u,
|
|
2369
2414
|
n.locale
|
|
2370
|
-
), h =
|
|
2415
|
+
), h = Zr(f, n.marketingData), { isRepresentative: v, customerId: l, unitId: g } = await ei(
|
|
2371
2416
|
r,
|
|
2372
2417
|
i?.cookie,
|
|
2373
|
-
|
|
2374
|
-
), m = await r.commerce.session(f.toString()).catch(() => null), S = m?.namespaces.profile ?? null, O = m?.namespaces.shopper ?? null, w = m?.namespaces.store ?? null, b = m?.namespaces.authentication ?? null,
|
|
2418
|
+
a
|
|
2419
|
+
), m = await r.commerce.session(f.toString()).catch(() => null), S = m?.namespaces.profile ?? null, O = m?.namespaces.shopper ?? null, w = m?.namespaces.store ?? null, b = m?.namespaces.authentication ?? null, k = m?.namespaces.checkout ?? null, I = m?.namespaces.public ?? null;
|
|
2375
2420
|
let D = null;
|
|
2376
2421
|
if (v && S?.id?.value)
|
|
2377
2422
|
try {
|
|
@@ -2384,25 +2429,25 @@ const ri = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2384
2429
|
`
|
|
2385
2430
|
);
|
|
2386
2431
|
}
|
|
2387
|
-
const
|
|
2432
|
+
const A = await ni(
|
|
2388
2433
|
r,
|
|
2389
|
-
|
|
2434
|
+
o,
|
|
2390
2435
|
s,
|
|
2391
2436
|
u,
|
|
2392
2437
|
c,
|
|
2393
|
-
f.get("sc") ??
|
|
2394
|
-
),
|
|
2438
|
+
f.get("sc") ?? o.salesChannel
|
|
2439
|
+
), _ = {
|
|
2395
2440
|
...n,
|
|
2396
2441
|
currency: {
|
|
2397
2442
|
code: w?.currencyCode?.value ?? n.currency.code,
|
|
2398
2443
|
symbol: w?.currencySymbol?.value ?? n.currency.symbol
|
|
2399
2444
|
},
|
|
2400
2445
|
country: w?.countryCode?.value ?? c,
|
|
2401
|
-
channel:
|
|
2402
|
-
|
|
2446
|
+
channel: Wr(
|
|
2447
|
+
o,
|
|
2403
2448
|
w?.channel?.value,
|
|
2404
|
-
|
|
2405
|
-
|
|
2449
|
+
k?.regionId?.value,
|
|
2450
|
+
A
|
|
2406
2451
|
),
|
|
2407
2452
|
/**
|
|
2408
2453
|
* B2B data structure in Session:
|
|
@@ -2410,7 +2455,7 @@ const ri = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2410
2455
|
* - Unit data: `authentication` namespace
|
|
2411
2456
|
* - Contract data: `profile` namespace (those info will be available inside Faststore's Session `person` object)
|
|
2412
2457
|
*/
|
|
2413
|
-
b2b:
|
|
2458
|
+
b2b: ti({
|
|
2414
2459
|
isRepresentative: v,
|
|
2415
2460
|
authentication: b,
|
|
2416
2461
|
shopper: O,
|
|
@@ -2421,42 +2466,42 @@ const ri = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2421
2466
|
unitId: g
|
|
2422
2467
|
}),
|
|
2423
2468
|
marketingData: h,
|
|
2424
|
-
person:
|
|
2469
|
+
person: ri(S),
|
|
2425
2470
|
geoCoordinates: u?.latitude && u?.longitude && u || null,
|
|
2426
2471
|
city: d
|
|
2427
2472
|
};
|
|
2428
|
-
return De(n,
|
|
2429
|
-
},
|
|
2430
|
-
validateCart:
|
|
2431
|
-
validateSession:
|
|
2473
|
+
return De(n, _) ? null : _;
|
|
2474
|
+
}, ai = {
|
|
2475
|
+
validateCart: jr,
|
|
2476
|
+
validateSession: ii,
|
|
2432
2477
|
subscribeToNewsletter: Pr,
|
|
2433
|
-
cancelOrder:
|
|
2434
|
-
processOrderAuthorization:
|
|
2435
|
-
uploadFileToOrderEntry:
|
|
2436
|
-
startOrderEntryOperation:
|
|
2437
|
-
startRecommendationSession:
|
|
2478
|
+
cancelOrder: Cr,
|
|
2479
|
+
processOrderAuthorization: wr,
|
|
2480
|
+
uploadFileToOrderEntry: _r,
|
|
2481
|
+
startOrderEntryOperation: Dr,
|
|
2482
|
+
startRecommendationSession: Ar
|
|
2438
2483
|
};
|
|
2439
2484
|
var Oe;
|
|
2440
2485
|
(function(e) {
|
|
2441
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";
|
|
2442
2487
|
})(Oe || (Oe = {}));
|
|
2443
|
-
const oi = (e) => typeof e == "string" ?
|
|
2444
|
-
function
|
|
2488
|
+
const oi = (e) => typeof e == "string" ? Pn(e) : null;
|
|
2489
|
+
function Pn(e) {
|
|
2445
2490
|
try {
|
|
2446
2491
|
return JSON.parse(e);
|
|
2447
2492
|
} catch {
|
|
2448
2493
|
return e;
|
|
2449
2494
|
}
|
|
2450
2495
|
}
|
|
2451
|
-
const
|
|
2496
|
+
const si = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, ci = new Bn({
|
|
2452
2497
|
name: "ObjectOrString",
|
|
2453
2498
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2454
2499
|
parseValue: oi,
|
|
2455
|
-
serialize:
|
|
2500
|
+
serialize: si,
|
|
2456
2501
|
parseLiteral(e) {
|
|
2457
|
-
return e.kind === Oe.STRING ?
|
|
2502
|
+
return e.kind === Oe.STRING ? Pn(e.value) : null;
|
|
2458
2503
|
}
|
|
2459
|
-
}),
|
|
2504
|
+
}), T = (e) => "Price" in e && "seller" in e && "product" in e, U = (e) => "skuName" in e, li = {
|
|
2460
2505
|
priceCurrency: async (e, n, t) => {
|
|
2461
2506
|
const {
|
|
2462
2507
|
loaders: { salesChannelLoader: r },
|
|
@@ -2464,35 +2509,35 @@ const ai = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2464
2509
|
} = t;
|
|
2465
2510
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
2466
2511
|
},
|
|
2467
|
-
priceValidUntil: (e) =>
|
|
2512
|
+
priceValidUntil: (e) => T(e) ? e.PriceValidUntil ?? "" : U(e) ? e.priceValidUntil ?? "" : null,
|
|
2468
2513
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2469
|
-
availability: async (e) =>
|
|
2470
|
-
seller: (e, n, t) =>
|
|
2514
|
+
availability: async (e) => T(e) ? Le(B(e)) : U(e) ? Le(sr(e.availability)) : null,
|
|
2515
|
+
seller: (e, n, t) => T(e) ? {
|
|
2471
2516
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2472
|
-
} :
|
|
2517
|
+
} : U(e) ? {
|
|
2473
2518
|
identifier: e.seller
|
|
2474
2519
|
} : null,
|
|
2475
|
-
price: (e) =>
|
|
2476
|
-
priceWithTaxes: (e) =>
|
|
2520
|
+
price: (e) => T(e) ? x(e) : U(e) ? e.sellingPrice / 100 : null,
|
|
2521
|
+
priceWithTaxes: (e) => T(e) ? V(x(e), e?.Tax, e.product.unitMultiplier) : U(e) ? V(
|
|
2477
2522
|
e.sellingPrice / 100,
|
|
2478
2523
|
e.tax / 100,
|
|
2479
2524
|
e.unitMultiplier
|
|
2480
2525
|
) : null,
|
|
2481
|
-
sellingPrice: (e) =>
|
|
2482
|
-
listPrice: (e) =>
|
|
2483
|
-
listPriceWithTaxes: (e) =>
|
|
2526
|
+
sellingPrice: (e) => T(e) ? or(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) ? V(
|
|
2484
2529
|
e.ListPrice ?? 0,
|
|
2485
2530
|
e?.Tax,
|
|
2486
2531
|
e.product.unitMultiplier
|
|
2487
|
-
) :
|
|
2488
|
-
itemOffered: (e) =>
|
|
2532
|
+
) : U(e) ? V(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
|
|
2533
|
+
itemOffered: (e) => T(e) ? e.product : U(e) ? {
|
|
2489
2534
|
...e.product,
|
|
2490
2535
|
attachmentsValues: e.attachments
|
|
2491
2536
|
} : null,
|
|
2492
|
-
quantity: (e) =>
|
|
2493
|
-
isGift: (e) =>
|
|
2494
|
-
priceToken: (e) =>
|
|
2495
|
-
},
|
|
2537
|
+
quantity: (e) => T(e) ? e.AvailableQuantity ?? 0 : U(e) ? e.quantity : null,
|
|
2538
|
+
isGift: (e) => U(e) ? e.isGift ?? !1 : null,
|
|
2539
|
+
priceToken: (e) => T(e) ? e.PriceToken ?? null : null
|
|
2540
|
+
}, di = ({ linkText: e }) => `/${e}/p`, ui = ({
|
|
2496
2541
|
offer: e,
|
|
2497
2542
|
seller: n,
|
|
2498
2543
|
product: t
|
|
@@ -2500,20 +2545,20 @@ const ai = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2500
2545
|
...e,
|
|
2501
2546
|
product: t,
|
|
2502
2547
|
seller: n
|
|
2503
|
-
}),
|
|
2548
|
+
}), pi = {
|
|
2504
2549
|
imageText: "image",
|
|
2505
2550
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2506
2551
|
imageLabel: "label"
|
|
2507
|
-
},
|
|
2552
|
+
}, ae = (e, n) => `${e}-${n}`, Ke = (e, n) => `/${ae(e, n)}/p`, gi = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2508
2553
|
function Ce(e) {
|
|
2509
2554
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2510
2555
|
}
|
|
2511
2556
|
async function be(e, n, t) {
|
|
2512
2557
|
const r = `${n}:${t}`;
|
|
2513
2558
|
e.storage.productTranslationsCache ??= /* @__PURE__ */ new Map();
|
|
2514
|
-
const i = e.storage.productTranslationsCache,
|
|
2515
|
-
if (
|
|
2516
|
-
const
|
|
2559
|
+
const i = e.storage.productTranslationsCache, a = i.get(r);
|
|
2560
|
+
if (a) return a;
|
|
2561
|
+
const o = (async () => {
|
|
2517
2562
|
try {
|
|
2518
2563
|
const s = await e.clients.catalog.getLocalizedProduct(
|
|
2519
2564
|
n,
|
|
@@ -2528,20 +2573,20 @@ async function be(e, n, t) {
|
|
|
2528
2573
|
return null;
|
|
2529
2574
|
}
|
|
2530
2575
|
})();
|
|
2531
|
-
return i.set(r,
|
|
2576
|
+
return i.set(r, o), o;
|
|
2532
2577
|
}
|
|
2533
|
-
const
|
|
2578
|
+
const mi = (e, n) => {
|
|
2534
2579
|
const t = e.findIndex((r) => Ce(r).split("/").at(-1) === n);
|
|
2535
2580
|
return t < 0 ? 0 : t;
|
|
2536
|
-
},
|
|
2581
|
+
}, hi = {
|
|
2537
2582
|
productID: ({ itemId: e }) => e,
|
|
2538
2583
|
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2539
|
-
slug: ({ isVariantOf: { linkText: e }, itemId: n }) =>
|
|
2584
|
+
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => ae(e, n),
|
|
2540
2585
|
description: ({ isVariantOf: { description: e } }) => e,
|
|
2541
2586
|
seo: ({ isVariantOf: e }) => ({
|
|
2542
2587
|
title: e.productTitle || e.productName,
|
|
2543
2588
|
description: e.metaTagDescription || e.description,
|
|
2544
|
-
canonical:
|
|
2589
|
+
canonical: di(e)
|
|
2545
2590
|
}),
|
|
2546
2591
|
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2547
2592
|
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
@@ -2550,13 +2595,13 @@ const gi = (e, n) => {
|
|
|
2550
2595
|
isVariantOf: {
|
|
2551
2596
|
categories: r,
|
|
2552
2597
|
productName: i,
|
|
2553
|
-
linkText:
|
|
2554
|
-
categoryId:
|
|
2598
|
+
linkText: a,
|
|
2599
|
+
categoryId: o,
|
|
2555
2600
|
categoriesIds: s,
|
|
2556
2601
|
productId: c
|
|
2557
2602
|
},
|
|
2558
2603
|
itemId: d
|
|
2559
|
-
} = e, u =
|
|
2604
|
+
} = e, u = mi(s, o), p = r[u], f = Ce(p).split("/"), h = t.storage.locale;
|
|
2560
2605
|
if (K(t) && h) {
|
|
2561
2606
|
const v = await be(t, c, h);
|
|
2562
2607
|
if (v) {
|
|
@@ -2588,7 +2633,7 @@ const gi = (e, n) => {
|
|
|
2588
2633
|
return {
|
|
2589
2634
|
itemListElement: [
|
|
2590
2635
|
...f.map((v, l) => {
|
|
2591
|
-
const g = `/${f.slice(0, l + 1).map(
|
|
2636
|
+
const g = `/${f.slice(0, l + 1).map(oe).join("/")}/`;
|
|
2592
2637
|
return {
|
|
2593
2638
|
name: v,
|
|
2594
2639
|
item: g,
|
|
@@ -2597,7 +2642,7 @@ const gi = (e, n) => {
|
|
|
2597
2642
|
}),
|
|
2598
2643
|
{
|
|
2599
2644
|
name: i,
|
|
2600
|
-
item: Ke(
|
|
2645
|
+
item: Ke(a, d),
|
|
2601
2646
|
position: f.length + 1
|
|
2602
2647
|
}
|
|
2603
2648
|
],
|
|
@@ -2605,7 +2650,7 @@ const gi = (e, n) => {
|
|
|
2605
2650
|
};
|
|
2606
2651
|
},
|
|
2607
2652
|
image: ({ images: e }, n) => {
|
|
2608
|
-
const t = (
|
|
2653
|
+
const t = (gi(e) ?? [pi]).map(
|
|
2609
2654
|
({ imageUrl: s, imageText: c, imageLabel: d }) => ({
|
|
2610
2655
|
alternateName: c ?? "",
|
|
2611
2656
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
@@ -2615,12 +2660,12 @@ const gi = (e, n) => {
|
|
|
2615
2660
|
if (typeof n != "object")
|
|
2616
2661
|
return t;
|
|
2617
2662
|
let { context: r, limit: i } = n;
|
|
2618
|
-
const
|
|
2663
|
+
const a = r !== "generic";
|
|
2619
2664
|
i = i || -1, i = i <= -1 ? void 0 : i;
|
|
2620
|
-
let
|
|
2665
|
+
let o = a ? t.filter(
|
|
2621
2666
|
({ keywords: s }) => s === r
|
|
2622
2667
|
) : t;
|
|
2623
|
-
return
|
|
2668
|
+
return o = o.length === 0 ? t : o, o.slice(0, i);
|
|
2624
2669
|
},
|
|
2625
2670
|
sku: ({ itemId: e }) => e,
|
|
2626
2671
|
gtin: ({ ean: e, referenceId: n }) => e || (n[0]?.Value ?? ""),
|
|
@@ -2628,7 +2673,7 @@ const gi = (e, n) => {
|
|
|
2628
2673
|
review: () => [],
|
|
2629
2674
|
aggregateRating: () => ({}),
|
|
2630
2675
|
offers: (e) => e.sellers.map(
|
|
2631
|
-
(n) =>
|
|
2676
|
+
(n) => ui({
|
|
2632
2677
|
offer: n.commertialOffer,
|
|
2633
2678
|
seller: n,
|
|
2634
2679
|
product: e
|
|
@@ -2642,18 +2687,18 @@ const gi = (e, n) => {
|
|
|
2642
2687
|
attributes: t = []
|
|
2643
2688
|
}) => {
|
|
2644
2689
|
const r = e.flatMap(
|
|
2645
|
-
({ name:
|
|
2646
|
-
name:
|
|
2690
|
+
({ name: o, values: s }) => s.map((c) => ({
|
|
2691
|
+
name: o,
|
|
2647
2692
|
value: c,
|
|
2648
2693
|
valueReference: ne.specification
|
|
2649
2694
|
}))
|
|
2650
2695
|
), i = n.map(
|
|
2651
2696
|
In
|
|
2652
|
-
),
|
|
2697
|
+
), a = t.map(Er);
|
|
2653
2698
|
return [
|
|
2654
2699
|
...r,
|
|
2655
2700
|
...i,
|
|
2656
|
-
...
|
|
2701
|
+
...a
|
|
2657
2702
|
];
|
|
2658
2703
|
},
|
|
2659
2704
|
hasSpecifications: ({ isVariantOf: e }) => !!e.skuSpecifications?.length,
|
|
@@ -2664,25 +2709,25 @@ const gi = (e, n) => {
|
|
|
2664
2709
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e,
|
|
2665
2710
|
otherLocales: async (e, n, t) => {
|
|
2666
2711
|
if (!K(t)) return null;
|
|
2667
|
-
const r =
|
|
2712
|
+
const r = bt(t);
|
|
2668
2713
|
if (r.length === 0) return null;
|
|
2669
|
-
const i = e.isVariantOf.productId,
|
|
2714
|
+
const i = e.isVariantOf.productId, a = e.itemId, o = t.storage.locale, s = wt(t), c = await be(t, i, o);
|
|
2670
2715
|
if (!c?.availableLinkIds) return null;
|
|
2671
2716
|
const { availableLinkIds: d } = c, { linkText: u } = e.isVariantOf;
|
|
2672
2717
|
return r.map((p) => {
|
|
2673
2718
|
if (p === s)
|
|
2674
|
-
return { locale: p, slug:
|
|
2719
|
+
return { locale: p, slug: ae(u, a) };
|
|
2675
2720
|
const f = d[p];
|
|
2676
|
-
return f ? { locale: p, slug:
|
|
2721
|
+
return f ? { locale: p, slug: ae(f, a) } : null;
|
|
2677
2722
|
}).filter((p) => p !== null);
|
|
2678
2723
|
}
|
|
2679
|
-
},
|
|
2724
|
+
}, fi = /* @__PURE__ */ new Set(["allSpecifications"]), Si = {
|
|
2680
2725
|
hasVariant: (e) => e.isVariantOf.items.map((n) => F(n, e.isVariantOf)),
|
|
2681
2726
|
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
2682
2727
|
name: (e) => e.isVariantOf.productName,
|
|
2683
2728
|
skuVariants: (e) => e,
|
|
2684
2729
|
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
2685
|
-
(n) => !
|
|
2730
|
+
(n) => !fi.has(n.name)
|
|
2686
2731
|
).flatMap(
|
|
2687
2732
|
({ specifications: n }) => n.flatMap(
|
|
2688
2733
|
({ name: t, values: r }) => r.map((i) => ({
|
|
@@ -2692,7 +2737,7 @@ const gi = (e, n) => {
|
|
|
2692
2737
|
}))
|
|
2693
2738
|
)
|
|
2694
2739
|
)
|
|
2695
|
-
},
|
|
2740
|
+
}, yi = {
|
|
2696
2741
|
propertyID: (e) => e.propertyID || vn(e),
|
|
2697
2742
|
name: ({ name: e }) => e,
|
|
2698
2743
|
value: ({ value: e }) => e,
|
|
@@ -2708,24 +2753,24 @@ const gi = (e, n) => {
|
|
|
2708
2753
|
({ offer: r }, { offer: i }) => mn(r, i)
|
|
2709
2754
|
);
|
|
2710
2755
|
return t ? t.sku : e[0];
|
|
2711
|
-
},
|
|
2756
|
+
}, _n = (e) => e !== "" && !Number.isNaN(Number(e)), Ii = /^vrn:recommendations:[^:]+:[^:]+:[^:]+$/, vi = async (e, { campaignVrn: n, userId: t, products: r }, i) => {
|
|
2712
2757
|
const {
|
|
2713
|
-
clients: { commerce:
|
|
2714
|
-
} = i, { salesChannel:
|
|
2715
|
-
if (!s || !
|
|
2716
|
-
throw new
|
|
2758
|
+
clients: { commerce: a }
|
|
2759
|
+
} = i, { salesChannel: o } = i.storage.channel, s = n?.trim();
|
|
2760
|
+
if (!s || !Ii.test(s))
|
|
2761
|
+
throw new E(`Invalid campaignVrn: "${n}"`);
|
|
2717
2762
|
const c = t?.trim();
|
|
2718
2763
|
if (t != null && !c)
|
|
2719
|
-
throw new
|
|
2764
|
+
throw new E("Invalid userId: must be a non-empty string");
|
|
2720
2765
|
if (r != null && (!Array.isArray(r) || r.some((h) => !h?.trim())))
|
|
2721
|
-
throw new
|
|
2766
|
+
throw new E(
|
|
2722
2767
|
"Invalid products: must be an array of non-empty strings"
|
|
2723
2768
|
);
|
|
2724
|
-
const d = await
|
|
2769
|
+
const d = await a.recommendation.recommendations({
|
|
2725
2770
|
campaignVrn: s,
|
|
2726
2771
|
userId: c || void 0,
|
|
2727
2772
|
products: r ?? [],
|
|
2728
|
-
salesChannel:
|
|
2773
|
+
salesChannel: o ?? void 0,
|
|
2729
2774
|
locale: i.storage.locale
|
|
2730
2775
|
}), { campaign: u, correlationId: p } = d;
|
|
2731
2776
|
return {
|
|
@@ -2745,13 +2790,13 @@ const gi = (e, n) => {
|
|
|
2745
2790
|
release_desc: "release:desc",
|
|
2746
2791
|
discount_desc: "discount:desc",
|
|
2747
2792
|
score_desc: ""
|
|
2748
|
-
},
|
|
2793
|
+
}, Oi = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
2749
2794
|
if (!n)
|
|
2750
|
-
throw new
|
|
2795
|
+
throw new E("Missing operationId");
|
|
2751
2796
|
return t.orderEntry.getOperation({ operationId: n });
|
|
2752
|
-
},
|
|
2797
|
+
}, Ci = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
2753
2798
|
if (!n)
|
|
2754
|
-
throw new
|
|
2799
|
+
throw new E("Missing orderFormId");
|
|
2755
2800
|
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
2756
2801
|
return (r ?? []).map((i) => ({
|
|
2757
2802
|
id: i.id,
|
|
@@ -2765,49 +2810,49 @@ const gi = (e, n) => {
|
|
|
2765
2810
|
unitMultiplier: i.unitMultiplier ?? 1
|
|
2766
2811
|
}));
|
|
2767
2812
|
};
|
|
2768
|
-
async function
|
|
2813
|
+
async function bi(e, n, t, r) {
|
|
2769
2814
|
const i = n.slice(0, n.lastIndexOf("-"));
|
|
2770
2815
|
return (await be(e, t, r))?.linkId === i;
|
|
2771
2816
|
}
|
|
2772
|
-
const
|
|
2773
|
-
async function
|
|
2774
|
-
const { linkText: i, productId:
|
|
2775
|
-
if (!(!t || !i || t.startsWith(i) || K(e) && r &&
|
|
2776
|
-
throw new Error(`${
|
|
2817
|
+
const kn = "Invalid SkuId", En = "Slug was set but the fetched sku does not satisfy the slug condition.", wi = "UseAdHocCard", Di = (e) => X(e) || e instanceof Error && (e.message === kn || e.message.startsWith(En));
|
|
2818
|
+
async function Ai(e, n, t, r) {
|
|
2819
|
+
const { linkText: i, productId: a } = n.isVariantOf;
|
|
2820
|
+
if (!(!t || !i || t.startsWith(i) || K(e) && r && _n(t.split("-").pop() ?? "") && await bi(e, t, a, r)))
|
|
2821
|
+
throw new Error(`${En} slug: ${t}, linkText: ${i}`);
|
|
2777
2822
|
}
|
|
2778
|
-
async function
|
|
2823
|
+
async function Pi(e, n) {
|
|
2779
2824
|
if (n == null)
|
|
2780
|
-
throw new
|
|
2825
|
+
throw new E("Missing slug or id");
|
|
2781
2826
|
const {
|
|
2782
2827
|
clients: { commerce: t, search: r }
|
|
2783
2828
|
} = e, i = await t.catalog.portal.pagetype(`${n}/p`);
|
|
2784
2829
|
if (i.pageType !== "Product" || !i.id)
|
|
2785
|
-
throw new
|
|
2786
|
-
const
|
|
2830
|
+
throw new $(`No product found for slug ${n}`);
|
|
2831
|
+
const a = await r.fetchProduct({
|
|
2787
2832
|
field: "id",
|
|
2788
2833
|
value: String(i.id)
|
|
2789
2834
|
}).catch(() => null);
|
|
2790
|
-
if (!
|
|
2791
|
-
throw new
|
|
2792
|
-
return F(le(
|
|
2835
|
+
if (!a)
|
|
2836
|
+
throw new $(`No product found for id ${i.id}`);
|
|
2837
|
+
return F(le(a.items), a);
|
|
2793
2838
|
}
|
|
2794
|
-
const
|
|
2839
|
+
const _i = {
|
|
2795
2840
|
product: async (e, { locator: n }, t) => {
|
|
2796
|
-
const r = xe(n), i = Ve(n),
|
|
2841
|
+
const r = xe(n), i = Ve(n), a = Sr(n), o = fr(n);
|
|
2797
2842
|
r && se(t, r), i && ye(t, i);
|
|
2798
2843
|
const {
|
|
2799
2844
|
loaders: { skuLoader: s }
|
|
2800
2845
|
} = t;
|
|
2801
2846
|
try {
|
|
2802
|
-
const c =
|
|
2803
|
-
if (!
|
|
2804
|
-
throw new Error(
|
|
2847
|
+
const c = a ?? o?.split("-").pop() ?? "";
|
|
2848
|
+
if (!_n(c))
|
|
2849
|
+
throw new Error(kn);
|
|
2805
2850
|
const d = await s.load(c);
|
|
2806
|
-
return await
|
|
2851
|
+
return await Ai(t, d, o, i), d;
|
|
2807
2852
|
} catch (c) {
|
|
2808
|
-
if (!
|
|
2853
|
+
if (!Di(c))
|
|
2809
2854
|
throw c;
|
|
2810
|
-
return
|
|
2855
|
+
return Pi(t, o);
|
|
2811
2856
|
}
|
|
2812
2857
|
},
|
|
2813
2858
|
collection: (e, { slug: n }, t) => {
|
|
@@ -2824,18 +2869,18 @@ const Pi = {
|
|
|
2824
2869
|
after: t,
|
|
2825
2870
|
sort: r,
|
|
2826
2871
|
term: i,
|
|
2827
|
-
selectedFacets:
|
|
2828
|
-
sponsoredCount:
|
|
2872
|
+
selectedFacets: a,
|
|
2873
|
+
sponsoredCount: o
|
|
2829
2874
|
}, s) => {
|
|
2830
|
-
const c = xe(
|
|
2875
|
+
const c = xe(a), d = Ve(a), u = hr(a);
|
|
2831
2876
|
c && se(s, c), d && ye(s, d);
|
|
2832
2877
|
const p = t ? Number(t) : 0, f = {
|
|
2833
2878
|
page: Math.ceil(p / n) || 0,
|
|
2834
2879
|
count: n,
|
|
2835
2880
|
query: i ?? void 0,
|
|
2836
2881
|
sort: Qe[r ?? "score_desc"] ?? Qe.score_desc,
|
|
2837
|
-
selectedFacets:
|
|
2838
|
-
sponsoredCount:
|
|
2882
|
+
selectedFacets: a?.flatMap(Me) ?? [],
|
|
2883
|
+
sponsoredCount: o ?? void 0
|
|
2839
2884
|
};
|
|
2840
2885
|
if (u) {
|
|
2841
2886
|
const l = (await s.clients.commerce.catalog.products.crossselling({
|
|
@@ -2872,24 +2917,24 @@ const Pi = {
|
|
|
2872
2917
|
allProducts: async (e, { first: n, after: t }, r) => {
|
|
2873
2918
|
const {
|
|
2874
2919
|
clients: { search: i }
|
|
2875
|
-
} = r,
|
|
2876
|
-
page: Math.ceil(
|
|
2920
|
+
} = r, a = t ? Number(t) : 0, o = await i.products({
|
|
2921
|
+
page: Math.ceil(a / n),
|
|
2877
2922
|
count: n
|
|
2878
|
-
}), s =
|
|
2923
|
+
}), s = o.products.flatMap(
|
|
2879
2924
|
(c) => c.items.map((d) => F(d, c))
|
|
2880
2925
|
).filter((c) => c.sellers.length > 0);
|
|
2881
2926
|
return {
|
|
2882
2927
|
pageInfo: {
|
|
2883
|
-
hasNextPage:
|
|
2884
|
-
hasPreviousPage:
|
|
2928
|
+
hasNextPage: o.pagination.after.length > 0,
|
|
2929
|
+
hasPreviousPage: o.pagination.before.length > 0,
|
|
2885
2930
|
startCursor: "0",
|
|
2886
|
-
endCursor:
|
|
2887
|
-
totalCount:
|
|
2931
|
+
endCursor: o.recordsFiltered.toString(),
|
|
2932
|
+
totalCount: o.recordsFiltered
|
|
2888
2933
|
},
|
|
2889
2934
|
// after + index is bigger than after+first itself because of the array flat() above
|
|
2890
2935
|
edges: s.map((c, d) => ({
|
|
2891
2936
|
node: c,
|
|
2892
|
-
cursor: (
|
|
2937
|
+
cursor: (a + d).toString()
|
|
2893
2938
|
}))
|
|
2894
2939
|
};
|
|
2895
2940
|
},
|
|
@@ -2901,15 +2946,15 @@ const Pi = {
|
|
|
2901
2946
|
field: "id",
|
|
2902
2947
|
values: n
|
|
2903
2948
|
})).flatMap(
|
|
2904
|
-
(
|
|
2949
|
+
(a) => a.items.map((o) => F(o, a))
|
|
2905
2950
|
).filter(
|
|
2906
|
-
(
|
|
2951
|
+
(a) => n.includes(a.itemId) && a.sellers.length > 0
|
|
2907
2952
|
) : [];
|
|
2908
2953
|
},
|
|
2909
2954
|
allCollections: async (e, { first: n, after: t }, r) => {
|
|
2910
2955
|
const {
|
|
2911
2956
|
clients: { commerce: i }
|
|
2912
|
-
} = r,
|
|
2957
|
+
} = r, a = t ? Number(t) : 0, [o, s] = await Promise.all([
|
|
2913
2958
|
i.catalog.brand.list(),
|
|
2914
2959
|
i.catalog.category.tree()
|
|
2915
2960
|
]), c = [], d = (h, v) => {
|
|
@@ -2917,7 +2962,7 @@ const Pi = {
|
|
|
2917
2962
|
id: h.id,
|
|
2918
2963
|
name: h.name,
|
|
2919
2964
|
fatherCategoryId: v,
|
|
2920
|
-
linkId:
|
|
2965
|
+
linkId: oe(h.name),
|
|
2921
2966
|
title: h.Title,
|
|
2922
2967
|
description: null,
|
|
2923
2968
|
metaTagDescription: h.MetaTagDescription,
|
|
@@ -2930,10 +2975,10 @@ const Pi = {
|
|
|
2930
2975
|
};
|
|
2931
2976
|
for (const h of s)
|
|
2932
2977
|
d(h, null);
|
|
2933
|
-
const f = [...
|
|
2978
|
+
const f = [...o.filter((h) => h.isActive).map((h) => ({
|
|
2934
2979
|
id: h.id,
|
|
2935
2980
|
name: h.name,
|
|
2936
|
-
linkId:
|
|
2981
|
+
linkId: oe(h.name),
|
|
2937
2982
|
title: h.title,
|
|
2938
2983
|
description: null,
|
|
2939
2984
|
metaTagDescription: h.metaTagDescription,
|
|
@@ -2942,25 +2987,25 @@ const Pi = {
|
|
|
2942
2987
|
})), ...c].filter((h) => !!hn.slug(h, null, r, null));
|
|
2943
2988
|
return {
|
|
2944
2989
|
pageInfo: {
|
|
2945
|
-
hasNextPage: f.length -
|
|
2946
|
-
hasPreviousPage:
|
|
2990
|
+
hasNextPage: f.length - a > n,
|
|
2991
|
+
hasPreviousPage: a > 0,
|
|
2947
2992
|
startCursor: "0",
|
|
2948
|
-
endCursor: (Math.min(n, f.length -
|
|
2993
|
+
endCursor: (Math.min(n, f.length - a) - 1).toString(),
|
|
2949
2994
|
totalCount: f.length
|
|
2950
2995
|
},
|
|
2951
|
-
edges: f.slice(
|
|
2996
|
+
edges: f.slice(a, a + n).map((h, v) => ({
|
|
2952
2997
|
node: h,
|
|
2953
|
-
cursor: (
|
|
2998
|
+
cursor: (a + v).toString()
|
|
2954
2999
|
}))
|
|
2955
3000
|
};
|
|
2956
3001
|
},
|
|
2957
3002
|
shipping: async (e, { country: n, items: t, postalCode: r }, i) => {
|
|
2958
3003
|
const {
|
|
2959
|
-
loaders: { simulationLoader:
|
|
2960
|
-
clients: { commerce:
|
|
3004
|
+
loaders: { simulationLoader: a },
|
|
3005
|
+
clients: { commerce: o }
|
|
2961
3006
|
} = i, [s, c] = await Promise.all([
|
|
2962
|
-
|
|
2963
|
-
|
|
3007
|
+
a.load({ country: n, items: t, postalCode: r }),
|
|
3008
|
+
o.checkout.address({ postalCode: r, country: n })
|
|
2964
3009
|
]);
|
|
2965
3010
|
return {
|
|
2966
3011
|
...s,
|
|
@@ -2981,10 +3026,10 @@ const Pi = {
|
|
|
2981
3026
|
url: i
|
|
2982
3027
|
};
|
|
2983
3028
|
},
|
|
2984
|
-
sellers: async (e, { postalCode: n, geoCoordinates: t, country: r, salesChannel: i },
|
|
3029
|
+
sellers: async (e, { postalCode: n, geoCoordinates: t, country: r, salesChannel: i }, a) => {
|
|
2985
3030
|
const {
|
|
2986
|
-
clients: { commerce:
|
|
2987
|
-
} =
|
|
3031
|
+
clients: { commerce: o }
|
|
3032
|
+
} = a, c = (await o.checkout.region({
|
|
2988
3033
|
postalCode: n,
|
|
2989
3034
|
geoCoordinates: t,
|
|
2990
3035
|
country: r,
|
|
@@ -2999,12 +3044,12 @@ const Pi = {
|
|
|
2999
3044
|
const {
|
|
3000
3045
|
clients: { commerce: r }
|
|
3001
3046
|
} = t, i = await r.profile.addresses(n);
|
|
3002
|
-
function
|
|
3047
|
+
function a(s) {
|
|
3003
3048
|
return !s || Object.keys(s).length === 0 ? [] : Object.values(s).map(
|
|
3004
3049
|
(c) => JSON.parse(c)
|
|
3005
3050
|
);
|
|
3006
3051
|
}
|
|
3007
|
-
return { addresses:
|
|
3052
|
+
return { addresses: a(i) };
|
|
3008
3053
|
},
|
|
3009
3054
|
productCount: async (e, { term: n }, t) => {
|
|
3010
3055
|
const {
|
|
@@ -3017,16 +3062,16 @@ const Pi = {
|
|
|
3017
3062
|
userOrder: async (e, { orderId: n }, t) => {
|
|
3018
3063
|
try {
|
|
3019
3064
|
if (!n)
|
|
3020
|
-
throw new
|
|
3065
|
+
throw new E("Missing orderId");
|
|
3021
3066
|
const {
|
|
3022
3067
|
clients: { commerce: r }
|
|
3023
3068
|
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
3024
3069
|
if (!i)
|
|
3025
|
-
throw new
|
|
3026
|
-
let
|
|
3070
|
+
throw new $(`No order found for id ${n}`);
|
|
3071
|
+
let a = null;
|
|
3027
3072
|
try {
|
|
3028
3073
|
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
3029
|
-
|
|
3074
|
+
a = Sn(c);
|
|
3030
3075
|
} catch {
|
|
3031
3076
|
}
|
|
3032
3077
|
const s = (await r.masterData.getShopperById({
|
|
@@ -3045,8 +3090,8 @@ const Pi = {
|
|
|
3045
3090
|
allowCancellation: i.allowCancellation,
|
|
3046
3091
|
storePreferencesData: i.storePreferencesData,
|
|
3047
3092
|
clientProfileData: i.clientProfileData,
|
|
3048
|
-
canProcessOrderAuthorization: (i.status === "waiting-for-confirmation" || i.status === "waiting-for-authorization") && !!
|
|
3049
|
-
ruleForAuthorization:
|
|
3093
|
+
canProcessOrderAuthorization: (i.status === "waiting-for-confirmation" || i.status === "waiting-for-authorization") && !!a,
|
|
3094
|
+
ruleForAuthorization: a,
|
|
3050
3095
|
shopper: {
|
|
3051
3096
|
firstName: s?.firstName || "",
|
|
3052
3097
|
lastName: s?.lastName || "",
|
|
@@ -3057,16 +3102,16 @@ const Pi = {
|
|
|
3057
3102
|
};
|
|
3058
3103
|
} catch (r) {
|
|
3059
3104
|
const i = r.message;
|
|
3060
|
-
let
|
|
3105
|
+
let a = {};
|
|
3061
3106
|
try {
|
|
3062
3107
|
const s = JSON.parse(i);
|
|
3063
|
-
|
|
3108
|
+
a = s.error || s;
|
|
3064
3109
|
} catch {
|
|
3065
|
-
|
|
3110
|
+
a = { message: i };
|
|
3066
3111
|
}
|
|
3067
|
-
const
|
|
3068
|
-
throw
|
|
3069
|
-
`You are forbidden to interact with order with id ${n}. ${
|
|
3112
|
+
const o = a?.message || i;
|
|
3113
|
+
throw X(r) ? new $(`No order found for id ${n}. ${o}.`) : ct(r) ? new Y(
|
|
3114
|
+
`You are forbidden to interact with order with id ${n}. ${o}.`
|
|
3070
3115
|
) : r;
|
|
3071
3116
|
}
|
|
3072
3117
|
},
|
|
@@ -3075,36 +3120,65 @@ const Pi = {
|
|
|
3075
3120
|
clients: { commerce: r }
|
|
3076
3121
|
} = t, i = await r.oms.listUserOrders(n);
|
|
3077
3122
|
return {
|
|
3078
|
-
list: i.list?.map((
|
|
3079
|
-
orderId:
|
|
3080
|
-
creationDate:
|
|
3081
|
-
clientName:
|
|
3082
|
-
items:
|
|
3083
|
-
totalValue:
|
|
3084
|
-
status:
|
|
3085
|
-
statusDescription:
|
|
3086
|
-
ShippingEstimatedDate:
|
|
3087
|
-
customFields:
|
|
3088
|
-
currencyCode:
|
|
3123
|
+
list: i.list?.map((a) => ({
|
|
3124
|
+
orderId: a.orderId,
|
|
3125
|
+
creationDate: a.creationDate,
|
|
3126
|
+
clientName: a.clientName,
|
|
3127
|
+
items: a.items,
|
|
3128
|
+
totalValue: a.totalValue,
|
|
3129
|
+
status: a.status,
|
|
3130
|
+
statusDescription: a.statusDescription,
|
|
3131
|
+
ShippingEstimatedDate: a.ShippingEstimatedDate,
|
|
3132
|
+
customFields: a.customFields,
|
|
3133
|
+
currencyCode: a.currencyCode
|
|
3089
3134
|
})),
|
|
3090
3135
|
paging: i.paging
|
|
3091
3136
|
};
|
|
3092
3137
|
},
|
|
3138
|
+
listCreditCards: async (e, n, t) => {
|
|
3139
|
+
const {
|
|
3140
|
+
clients: { commerce: r }
|
|
3141
|
+
} = t;
|
|
3142
|
+
return {
|
|
3143
|
+
list: (await r.savedCards.listCreditCards())?.map((a) => ({
|
|
3144
|
+
accountId: a.accountId,
|
|
3145
|
+
bin: a.bin,
|
|
3146
|
+
cardNumber: a.cardNumber,
|
|
3147
|
+
cardLabel: a.cardLabel,
|
|
3148
|
+
paymentSystem: a.paymentSystem,
|
|
3149
|
+
paymentSystemName: a.paymentSystemName,
|
|
3150
|
+
isDefault: a.isDefault,
|
|
3151
|
+
isActive: a.isActive,
|
|
3152
|
+
origin: a.origin
|
|
3153
|
+
}))
|
|
3154
|
+
};
|
|
3155
|
+
},
|
|
3156
|
+
hasAdHocCardAccess: async (e, n, t) => {
|
|
3157
|
+
const {
|
|
3158
|
+
account: r,
|
|
3159
|
+
headers: i,
|
|
3160
|
+
clients: { commerce: a }
|
|
3161
|
+
} = t, s = z(L(i?.cookie ?? "", r))?.userId ?? "";
|
|
3162
|
+
if (!s)
|
|
3163
|
+
return !0;
|
|
3164
|
+
const c = await a.licenseManager.isResourceGranted({ userId: s, resourceKey: wi }).catch(() => null);
|
|
3165
|
+
return typeof c == "boolean" ? c : !0;
|
|
3166
|
+
},
|
|
3093
3167
|
listUserQuotes: async (e, n, t) => {
|
|
3094
3168
|
const {
|
|
3095
3169
|
clients: { commerce: r }
|
|
3096
|
-
} = t, i = await r.quotes.listUserQuotes(n),
|
|
3170
|
+
} = t, i = await r.quotes.listUserQuotes(n), a = [
|
|
3097
3171
|
...new Set(i.items.map((c) => c.createdBy).filter(Boolean))
|
|
3098
|
-
],
|
|
3172
|
+
], o = /* @__PURE__ */ new Map();
|
|
3099
3173
|
return await Promise.all(
|
|
3100
|
-
|
|
3174
|
+
a.map(async (c) => {
|
|
3101
3175
|
try {
|
|
3102
3176
|
const [d] = await r.masterData.getShopperById({
|
|
3103
3177
|
userId: c
|
|
3104
3178
|
});
|
|
3105
3179
|
if (d) {
|
|
3106
3180
|
const u = [d.firstName, d.lastName].filter(Boolean).join(" ");
|
|
3107
|
-
u &&
|
|
3181
|
+
u && o.set(c, u);
|
|
3108
3182
|
}
|
|
3109
3183
|
} catch {
|
|
3110
3184
|
}
|
|
@@ -3117,7 +3191,7 @@ const Pi = {
|
|
|
3117
3191
|
createdAt: c.createdAt,
|
|
3118
3192
|
expiresAt: c.expiresAt,
|
|
3119
3193
|
amount: c.amount,
|
|
3120
|
-
createdBy: c.createdBy ?
|
|
3194
|
+
createdBy: c.createdBy ? o.get(c.createdBy) ?? c.createdBy : null
|
|
3121
3195
|
})),
|
|
3122
3196
|
paging: {
|
|
3123
3197
|
total: i.totalItems,
|
|
@@ -3140,11 +3214,11 @@ const Pi = {
|
|
|
3140
3214
|
const {
|
|
3141
3215
|
account: r,
|
|
3142
3216
|
headers: i,
|
|
3143
|
-
clients: { commerce:
|
|
3144
|
-
} = t, s =
|
|
3145
|
-
|
|
3146
|
-
s ?
|
|
3147
|
-
s ?
|
|
3217
|
+
clients: { commerce: a }
|
|
3218
|
+
} = t, s = z(L(i?.cookie ?? "", r))?.userId ?? "", [c, d, u] = await Promise.all([
|
|
3219
|
+
a.session("").catch(() => null),
|
|
3220
|
+
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
3221
|
+
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
3148
3222
|
]), p = d?.[0], f = c?.namespaces.authentication ?? null, h = `${(p?.firstName ?? "").trim()} ${(p?.lastName ?? "").trim()}`.trim();
|
|
3149
3223
|
return {
|
|
3150
3224
|
username: f?.storeUserEmail?.value ?? "",
|
|
@@ -3161,19 +3235,19 @@ const Pi = {
|
|
|
3161
3235
|
const {
|
|
3162
3236
|
account: r,
|
|
3163
3237
|
headers: i,
|
|
3164
|
-
clients: { commerce:
|
|
3165
|
-
} = t,
|
|
3166
|
-
if (!
|
|
3238
|
+
clients: { commerce: a }
|
|
3239
|
+
} = t, o = z(L(i?.cookie ?? "", r));
|
|
3240
|
+
if (!o?.userId)
|
|
3167
3241
|
return null;
|
|
3168
|
-
if (
|
|
3169
|
-
const c = await
|
|
3242
|
+
if (o?.isRepresentative) {
|
|
3243
|
+
const c = await a.session("").catch(() => null);
|
|
3170
3244
|
if (!c)
|
|
3171
3245
|
return null;
|
|
3172
|
-
const d = c.namespaces.profile ?? null, u = c.namespaces.shopper ?? null, p = c.namespaces.authentication ?? null, f = Ye(c) ||
|
|
3246
|
+
const d = c.namespaces.profile ?? null, u = c.namespaces.shopper ?? null, p = c.namespaces.authentication ?? null, f = Ye(c) || o?.customerId?.trim() || "";
|
|
3173
3247
|
let h = null;
|
|
3174
3248
|
if (f)
|
|
3175
3249
|
try {
|
|
3176
|
-
h = await
|
|
3250
|
+
h = await a.masterData.getContractById({ contractId: f });
|
|
3177
3251
|
} catch (g) {
|
|
3178
3252
|
console.error(
|
|
3179
3253
|
`Error while getting contract data for contract ID (${f}).`,
|
|
@@ -3182,14 +3256,14 @@ const Pi = {
|
|
|
3182
3256
|
}
|
|
3183
3257
|
const v = `${(u?.firstName?.value ?? "").trim()} ${(u?.lastName?.value ?? "").trim()}`.trim();
|
|
3184
3258
|
return {
|
|
3185
|
-
name:
|
|
3259
|
+
name: An(h, d) || v || "",
|
|
3186
3260
|
email: d?.email?.value || p?.storeUserEmail?.value || "",
|
|
3187
|
-
id: d?.id?.value || p?.customerId?.value ||
|
|
3261
|
+
id: d?.id?.value || p?.customerId?.value || o?.customerId?.trim() || ""
|
|
3188
3262
|
// createdAt: '',
|
|
3189
3263
|
};
|
|
3190
3264
|
}
|
|
3191
|
-
const s = await
|
|
3192
|
-
userId:
|
|
3265
|
+
const s = await a.licenseManager.getUserById({
|
|
3266
|
+
userId: o?.userId
|
|
3193
3267
|
}).catch(() => null);
|
|
3194
3268
|
return {
|
|
3195
3269
|
name: s?.name || "",
|
|
@@ -3202,27 +3276,27 @@ const Pi = {
|
|
|
3202
3276
|
// Contract list from VTEX session `shopper.availableContracts`.
|
|
3203
3277
|
availableContracts: async (e, { orgUnitId: n }, t) => {
|
|
3204
3278
|
if (!n)
|
|
3205
|
-
throw new
|
|
3279
|
+
throw new E("Missing orgUnitId");
|
|
3206
3280
|
const {
|
|
3207
3281
|
account: r,
|
|
3208
3282
|
headers: i,
|
|
3209
|
-
clients: { commerce:
|
|
3210
|
-
} = t,
|
|
3283
|
+
clients: { commerce: a }
|
|
3284
|
+
} = t, o = await a.session("").catch(() => null), s = L(i?.cookie ?? "", r);
|
|
3211
3285
|
let c = null;
|
|
3212
3286
|
try {
|
|
3213
|
-
c = s ?
|
|
3287
|
+
c = s ? z(s) : null;
|
|
3214
3288
|
} catch {
|
|
3215
3289
|
c = null;
|
|
3216
3290
|
}
|
|
3217
|
-
const d =
|
|
3291
|
+
const d = o?.namespaces.authentication?.unitId?.value?.trim() ?? c?.unitId?.trim() ?? "";
|
|
3218
3292
|
if (!d || d !== n)
|
|
3219
3293
|
throw new Y(
|
|
3220
3294
|
"You are not allowed to list contracts for this organization unit"
|
|
3221
3295
|
);
|
|
3222
|
-
const u =
|
|
3223
|
-
|
|
3224
|
-
), p = Ye(
|
|
3225
|
-
return
|
|
3296
|
+
const u = Xr(
|
|
3297
|
+
o?.namespaces.shopper
|
|
3298
|
+
), p = Ye(o) || c?.customerId?.trim() || "";
|
|
3299
|
+
return Jr(u, p);
|
|
3226
3300
|
},
|
|
3227
3301
|
pickupPoints: async (e, { geoCoordinates: n }, t) => {
|
|
3228
3302
|
const {
|
|
@@ -3232,10 +3306,10 @@ const Pi = {
|
|
|
3232
3306
|
geoCoordinates: n
|
|
3233
3307
|
});
|
|
3234
3308
|
},
|
|
3235
|
-
orderEntryOperation:
|
|
3236
|
-
orderFormItems:
|
|
3237
|
-
recommendations:
|
|
3238
|
-
},
|
|
3309
|
+
orderEntryOperation: Oi,
|
|
3310
|
+
orderFormItems: Ci,
|
|
3311
|
+
recommendations: vi
|
|
3312
|
+
}, ki = {
|
|
3239
3313
|
reviewRating: () => ({
|
|
3240
3314
|
ratingValue: 5,
|
|
3241
3315
|
bestRating: 5
|
|
@@ -3243,7 +3317,7 @@ const Pi = {
|
|
|
3243
3317
|
author: () => ({
|
|
3244
3318
|
name: ""
|
|
3245
3319
|
})
|
|
3246
|
-
},
|
|
3320
|
+
}, Ei = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, Ti = {
|
|
3247
3321
|
suggestions: async (e, n, t) => {
|
|
3248
3322
|
const {
|
|
3249
3323
|
clients: { search: r }
|
|
@@ -3256,13 +3330,13 @@ const Pi = {
|
|
|
3256
3330
|
})),
|
|
3257
3331
|
products: []
|
|
3258
3332
|
};
|
|
3259
|
-
const { productSearchPromise:
|
|
3333
|
+
const { productSearchPromise: a } = e, [o, s] = await Promise.all([
|
|
3260
3334
|
r.suggestedTerms(i),
|
|
3261
|
-
|
|
3335
|
+
a
|
|
3262
3336
|
]), c = s.products.map((u) => {
|
|
3263
3337
|
const p = le(u.items);
|
|
3264
3338
|
return p && F(p, u);
|
|
3265
|
-
}).filter((u) => !!u), { searches: d } =
|
|
3339
|
+
}).filter((u) => !!u), { searches: d } = o;
|
|
3266
3340
|
return {
|
|
3267
3341
|
terms: d.map((u) => ({ value: u.term, count: u.count })),
|
|
3268
3342
|
products: c
|
|
@@ -3292,9 +3366,9 @@ const Pi = {
|
|
|
3292
3366
|
clients: { search: r }
|
|
3293
3367
|
} = t;
|
|
3294
3368
|
t.storage.searchArgs = e;
|
|
3295
|
-
const { facets: i = [] } = await r.facets(e),
|
|
3369
|
+
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;
|
|
3296
3370
|
return i.filter(
|
|
3297
|
-
(d) => !
|
|
3371
|
+
(d) => !a || !Ei(d, o, s)
|
|
3298
3372
|
);
|
|
3299
3373
|
},
|
|
3300
3374
|
metadata: async ({ productSearchPromise: e }) => {
|
|
@@ -3306,12 +3380,12 @@ const Pi = {
|
|
|
3306
3380
|
};
|
|
3307
3381
|
},
|
|
3308
3382
|
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
3309
|
-
},
|
|
3383
|
+
}, Ui = {
|
|
3310
3384
|
title: ({ title: e }) => e ?? "",
|
|
3311
3385
|
description: ({ description: e }) => e ?? "",
|
|
3312
3386
|
canonical: ({ canonical: e }) => e ?? "",
|
|
3313
3387
|
titleTemplate: () => ""
|
|
3314
|
-
},
|
|
3388
|
+
}, Ri = ["bd", "d", "h", "m"], Fi = (e) => Ri.includes(e), Ni = {
|
|
3315
3389
|
bd: {
|
|
3316
3390
|
0: "Today",
|
|
3317
3391
|
1: "In 1 business day",
|
|
@@ -3332,37 +3406,37 @@ const Pi = {
|
|
|
3332
3406
|
1: "In 1 minute",
|
|
3333
3407
|
other: "Up to # minutes"
|
|
3334
3408
|
}
|
|
3335
|
-
},
|
|
3336
|
-
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i =
|
|
3409
|
+
}, Tn = (e) => {
|
|
3410
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = Fi(t);
|
|
3337
3411
|
if (!r || !i)
|
|
3338
3412
|
return "";
|
|
3339
|
-
const
|
|
3340
|
-
return
|
|
3341
|
-
},
|
|
3413
|
+
const a = Number(n) < 2 ? Number(n) : "other";
|
|
3414
|
+
return Ni[t][a].replace("#", n) ?? "";
|
|
3415
|
+
}, Li = {
|
|
3342
3416
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
3343
3417
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
3344
|
-
localizedEstimates: (e) => e?.shippingEstimate ?
|
|
3418
|
+
localizedEstimates: (e) => e?.shippingEstimate ? Tn(e.shippingEstimate) : ""
|
|
3345
3419
|
}, Ze = "skuvariation";
|
|
3346
3420
|
function en(e, n) {
|
|
3347
3421
|
const t = `${Ze}${n}`.toLowerCase(), r = e.find(
|
|
3348
|
-
(
|
|
3422
|
+
(a) => a.imageLabel === t
|
|
3349
3423
|
);
|
|
3350
3424
|
if (r)
|
|
3351
3425
|
return r;
|
|
3352
3426
|
const i = e.find(
|
|
3353
|
-
(
|
|
3427
|
+
(a) => a.imageLabel === Ze
|
|
3354
3428
|
);
|
|
3355
3429
|
return i || e[0];
|
|
3356
3430
|
}
|
|
3357
|
-
function
|
|
3431
|
+
function Bi(e, n, t) {
|
|
3358
3432
|
const r = {};
|
|
3359
3433
|
return e.forEach((i) => {
|
|
3360
|
-
const
|
|
3361
|
-
if (
|
|
3434
|
+
const a = i.variations;
|
|
3435
|
+
if (a.length === 0)
|
|
3362
3436
|
return;
|
|
3363
|
-
const
|
|
3437
|
+
const o = `${n}-${a.find(
|
|
3364
3438
|
(c) => c.name === n
|
|
3365
|
-
)?.values[0] ?? ""}`, s =
|
|
3439
|
+
)?.values[0] ?? ""}`, s = a.reduce((c, d) => d.name === n ? c : c + `-${d.name}-${d.values[0]}`, o);
|
|
3366
3440
|
r[s] = `${t}-${i.itemId}`;
|
|
3367
3441
|
}), r;
|
|
3368
3442
|
}
|
|
@@ -3372,55 +3446,55 @@ function nn(e) {
|
|
|
3372
3446
|
n[t.name] = t.values[0];
|
|
3373
3447
|
}), n;
|
|
3374
3448
|
}
|
|
3375
|
-
function
|
|
3449
|
+
function $i(e) {
|
|
3376
3450
|
const n = {};
|
|
3377
3451
|
return e?.forEach((t) => {
|
|
3378
3452
|
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
3379
3453
|
}), n;
|
|
3380
3454
|
}
|
|
3381
|
-
function
|
|
3455
|
+
function Mi(e, n) {
|
|
3382
3456
|
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
3383
3457
|
}
|
|
3384
|
-
function
|
|
3458
|
+
function zi(e) {
|
|
3385
3459
|
const n = e;
|
|
3386
3460
|
for (const t in e)
|
|
3387
3461
|
e[t].every(
|
|
3388
3462
|
(i) => !Number.isNaN(Number(i.value))
|
|
3389
|
-
) && e[t].sort((i,
|
|
3463
|
+
) && e[t].sort((i, a) => Mi(i.value, a.value));
|
|
3390
3464
|
return n;
|
|
3391
3465
|
}
|
|
3392
|
-
function
|
|
3466
|
+
function Vi(e, n, t) {
|
|
3393
3467
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
3394
|
-
return e.forEach((
|
|
3395
|
-
if (
|
|
3468
|
+
return e.forEach((a) => {
|
|
3469
|
+
if (a.variations.length === 0)
|
|
3396
3470
|
return;
|
|
3397
|
-
const
|
|
3471
|
+
const o = a.variations.find(
|
|
3398
3472
|
(c) => c.name === n
|
|
3399
3473
|
);
|
|
3400
|
-
if (!(
|
|
3401
|
-
const c = `${n}-${
|
|
3402
|
-
if (!
|
|
3474
|
+
if (!(o?.values[0] === t)) {
|
|
3475
|
+
const c = `${n}-${o?.values[0]}`;
|
|
3476
|
+
if (!o || i.has(c))
|
|
3403
3477
|
return;
|
|
3404
3478
|
i.add(c);
|
|
3405
3479
|
const d = en(
|
|
3406
|
-
|
|
3480
|
+
a.images,
|
|
3407
3481
|
n
|
|
3408
3482
|
), u = {
|
|
3409
3483
|
src: d.imageUrl,
|
|
3410
3484
|
alt: d.imageLabel ?? "",
|
|
3411
|
-
label: `${n}: ${
|
|
3412
|
-
value:
|
|
3485
|
+
label: `${n}: ${o.values[0]}`,
|
|
3486
|
+
value: o.values[0]
|
|
3413
3487
|
};
|
|
3414
|
-
r[
|
|
3488
|
+
r[o.name] ? r[o.name].push(u) : r[o.name] = [u];
|
|
3415
3489
|
return;
|
|
3416
3490
|
}
|
|
3417
|
-
|
|
3491
|
+
a.variations.forEach((c) => {
|
|
3418
3492
|
const d = `${c.name}-${c.values[0]}`;
|
|
3419
3493
|
if (i.has(d))
|
|
3420
3494
|
return;
|
|
3421
3495
|
i.add(d);
|
|
3422
3496
|
const u = en(
|
|
3423
|
-
|
|
3497
|
+
a.images,
|
|
3424
3498
|
c.name
|
|
3425
3499
|
), p = {
|
|
3426
3500
|
src: u.imageUrl,
|
|
@@ -3430,40 +3504,40 @@ function Mi(e, n, t) {
|
|
|
3430
3504
|
};
|
|
3431
3505
|
r[c.name] ? r[c.name].push(p) : r[c.name] = [p];
|
|
3432
3506
|
});
|
|
3433
|
-
}),
|
|
3507
|
+
}), zi(r);
|
|
3434
3508
|
}
|
|
3435
|
-
const
|
|
3509
|
+
const xi = {
|
|
3436
3510
|
activeVariations: (e) => nn(e.variations),
|
|
3437
|
-
allVariantsByName: (e) =>
|
|
3438
|
-
slugsMap: (e, n) =>
|
|
3511
|
+
allVariantsByName: (e) => $i(e.isVariantOf.skuSpecifications),
|
|
3512
|
+
slugsMap: (e, n) => Bi(
|
|
3439
3513
|
e.isVariantOf.items,
|
|
3440
3514
|
n.dominantVariantName ?? e.variations[0]?.name,
|
|
3441
3515
|
e.isVariantOf.linkText
|
|
3442
3516
|
),
|
|
3443
3517
|
availableVariations: (e, n) => {
|
|
3444
3518
|
const t = n.dominantVariantName ?? e.variations[0]?.name, i = nn(e.variations)[t];
|
|
3445
|
-
return
|
|
3519
|
+
return Vi(
|
|
3446
3520
|
e.isVariantOf.items,
|
|
3447
3521
|
t,
|
|
3448
3522
|
i
|
|
3449
3523
|
);
|
|
3450
3524
|
},
|
|
3451
3525
|
allVariantProducts: (e) => e.isVariantOf.items.map((n) => F(n, e.isVariantOf))
|
|
3452
|
-
},
|
|
3526
|
+
}, qi = {
|
|
3453
3527
|
"pickup-in-point": "Pickup",
|
|
3454
3528
|
delivery: "Delivery",
|
|
3455
3529
|
pickup: "Pickup",
|
|
3456
3530
|
"take-away": "Take away",
|
|
3457
3531
|
"": ""
|
|
3458
|
-
},
|
|
3532
|
+
}, ji = {
|
|
3459
3533
|
deliveryOptionsData: (e) => {
|
|
3460
|
-
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address],
|
|
3534
|
+
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
|
|
3461
3535
|
(d, u) => {
|
|
3462
|
-
const p = u?.selectedSla || "", f = u?.selectedDeliveryChannel || u?.deliveryChannel || "", h = u?.deliveryCompany || "", v = u?.deliveryWindow, l = u?.pickupStoreInfo, g = u?.shippingEstimate || "", m = u?.shippingEstimate ?
|
|
3536
|
+
const p = u?.selectedSla || "", f = u?.selectedDeliveryChannel || u?.deliveryChannel || "", h = u?.deliveryCompany || "", v = u?.deliveryWindow, l = u?.pickupStoreInfo, g = u?.shippingEstimate || "", m = u?.shippingEstimate ? Tn(u?.shippingEstimate) : "", S = u?.shippingEstimateDate || "", O = u?.addressId || "", w = u?.itemIndex ?? 0, b = t?.[w], k = b?.seller || "", I = `${p}|${f}|${h}|${k}|${g}|${S}|${O}|${v?.startDateUtc}|${v?.endDateUtc}`, D = i?.find(
|
|
3463
3537
|
(C) => C?.addressId === O
|
|
3464
|
-
),
|
|
3538
|
+
), A = `${qi[f] || ""} ${m} ${D?.neighborhood ? `to ${D?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: _, taxPriceTags: P } = Wi(
|
|
3465
3539
|
b?.priceTags ?? []
|
|
3466
|
-
), R = (b?.sellingPrice ?? 0) * (b?.quantity ?? 0) + (b?.tax ?? 0) + (
|
|
3540
|
+
), R = (b?.sellingPrice ?? 0) * (b?.quantity ?? 0) + (b?.tax ?? 0) + (_ ?? 0);
|
|
3467
3541
|
return d[I] || (d[I] = {
|
|
3468
3542
|
// static fields
|
|
3469
3543
|
selectedSla: p,
|
|
@@ -3472,9 +3546,9 @@ const zi = {
|
|
|
3472
3546
|
deliveryWindow: v,
|
|
3473
3547
|
shippingEstimate: g,
|
|
3474
3548
|
shippingEstimateDate: S,
|
|
3475
|
-
seller:
|
|
3549
|
+
seller: k,
|
|
3476
3550
|
friendlyShippingEstimate: m,
|
|
3477
|
-
friendlyDeliveryOptionName:
|
|
3551
|
+
friendlyDeliveryOptionName: A,
|
|
3478
3552
|
address: D,
|
|
3479
3553
|
pickupStoreInfo: l,
|
|
3480
3554
|
// dynamic fields
|
|
@@ -3489,20 +3563,20 @@ const zi = {
|
|
|
3489
3563
|
price: b?.price || 0,
|
|
3490
3564
|
sellingPrice: b?.sellingPrice || 0,
|
|
3491
3565
|
imageUrl: b?.imageUrl || "",
|
|
3492
|
-
taxPriceTags:
|
|
3493
|
-
taxPriceTagsTotal:
|
|
3566
|
+
taxPriceTags: P ?? [],
|
|
3567
|
+
taxPriceTagsTotal: _ ?? 0,
|
|
3494
3568
|
tax: b?.tax || 0,
|
|
3495
3569
|
total: R
|
|
3496
3570
|
}), d[I].quantityOfDifferentItems = (d[I].quantityOfDifferentItems ?? 0) + 1, d[I].total = (d[I].total ?? 0) + R), d;
|
|
3497
3571
|
},
|
|
3498
3572
|
{}
|
|
3499
|
-
),
|
|
3500
|
-
name: `${s?.firstName ?? ""} ${s?.lastName ?? ""}`.trim() ||
|
|
3573
|
+
), o = Object.values(a), s = n?.contactInformation?.[0], c = {
|
|
3574
|
+
name: `${s?.firstName ?? ""} ${s?.lastName ?? ""}`.trim() || o?.[0]?.address?.receiverName || "",
|
|
3501
3575
|
email: s?.email || "",
|
|
3502
3576
|
phone: s?.phone || ""
|
|
3503
3577
|
};
|
|
3504
3578
|
return {
|
|
3505
|
-
deliveryOptions:
|
|
3579
|
+
deliveryOptions: o,
|
|
3506
3580
|
contact: c
|
|
3507
3581
|
};
|
|
3508
3582
|
},
|
|
@@ -3511,19 +3585,19 @@ const zi = {
|
|
|
3511
3585
|
return Object.values(
|
|
3512
3586
|
n.reduce(
|
|
3513
3587
|
(t, r) => {
|
|
3514
|
-
const i = r?.linkedEntity?.type || "",
|
|
3515
|
-
return t[
|
|
3588
|
+
const i = r?.linkedEntity?.type || "", a = r?.linkedEntity?.id || "", o = `${i}|${a || ""}`;
|
|
3589
|
+
return t[o] || (t[o] = { type: i, id: a, fields: [] }), t[o].fields.push(...r?.fields || []), t;
|
|
3516
3590
|
},
|
|
3517
3591
|
{}
|
|
3518
3592
|
)
|
|
3519
3593
|
) || [];
|
|
3520
3594
|
}
|
|
3521
3595
|
};
|
|
3522
|
-
function
|
|
3596
|
+
function Wi(e) {
|
|
3523
3597
|
const t = e.filter(
|
|
3524
3598
|
(i) => i?.name?.includes("TAX")
|
|
3525
3599
|
), r = t.reduce(
|
|
3526
|
-
(i,
|
|
3600
|
+
(i, a) => i + (a.rawValue ? a.rawValue * 100 : 0),
|
|
3527
3601
|
0
|
|
3528
3602
|
);
|
|
3529
3603
|
return {
|
|
@@ -3531,28 +3605,28 @@ function qi(e) {
|
|
|
3531
3605
|
taxPriceTagsTotal: r
|
|
3532
3606
|
};
|
|
3533
3607
|
}
|
|
3534
|
-
const
|
|
3608
|
+
const Gi = {
|
|
3535
3609
|
StoreCollection: hn,
|
|
3536
|
-
StoreAggregateOffer:
|
|
3537
|
-
StoreProduct:
|
|
3538
|
-
StoreSeo:
|
|
3539
|
-
StoreFacet:
|
|
3540
|
-
StoreFacetBoolean:
|
|
3541
|
-
StoreFacetRange:
|
|
3542
|
-
StoreFacetValueBoolean:
|
|
3543
|
-
StoreOffer:
|
|
3544
|
-
StoreAggregateRating:
|
|
3545
|
-
StoreReview:
|
|
3546
|
-
StoreProductGroup:
|
|
3547
|
-
StoreSearchResult:
|
|
3548
|
-
StorePropertyValue:
|
|
3549
|
-
SkuVariants:
|
|
3550
|
-
ShippingSLA:
|
|
3551
|
-
UserOrderResult:
|
|
3552
|
-
ObjectOrString:
|
|
3553
|
-
Query:
|
|
3554
|
-
Mutation:
|
|
3555
|
-
},
|
|
3610
|
+
StoreAggregateOffer: lr,
|
|
3611
|
+
StoreProduct: hi,
|
|
3612
|
+
StoreSeo: Ui,
|
|
3613
|
+
StoreFacet: yr,
|
|
3614
|
+
StoreFacetBoolean: Ir,
|
|
3615
|
+
StoreFacetRange: vr,
|
|
3616
|
+
StoreFacetValueBoolean: Or,
|
|
3617
|
+
StoreOffer: li,
|
|
3618
|
+
StoreAggregateRating: dr,
|
|
3619
|
+
StoreReview: ki,
|
|
3620
|
+
StoreProductGroup: Si,
|
|
3621
|
+
StoreSearchResult: Ti,
|
|
3622
|
+
StorePropertyValue: yi,
|
|
3623
|
+
SkuVariants: xi,
|
|
3624
|
+
ShippingSLA: Li,
|
|
3625
|
+
UserOrderResult: ji,
|
|
3626
|
+
ObjectOrString: ci,
|
|
3627
|
+
Query: _i,
|
|
3628
|
+
Mutation: ai
|
|
3629
|
+
}, Hi = () => Gi, Xi = `"""
|
|
3556
3630
|
Address information.
|
|
3557
3631
|
"""
|
|
3558
3632
|
type Address {
|
|
@@ -3597,7 +3671,7 @@ type Address {
|
|
|
3597
3671
|
"""
|
|
3598
3672
|
geoCoordinates: [Float]
|
|
3599
3673
|
}
|
|
3600
|
-
`,
|
|
3674
|
+
`, Yi = `"""
|
|
3601
3675
|
Advertisement information about a specific product in a campaign
|
|
3602
3676
|
"""
|
|
3603
3677
|
type Advertisement {
|
|
@@ -3622,7 +3696,7 @@ type Advertisement {
|
|
|
3622
3696
|
"""
|
|
3623
3697
|
adResponseId: String!
|
|
3624
3698
|
}
|
|
3625
|
-
`,
|
|
3699
|
+
`, Ji = `"""
|
|
3626
3700
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
3627
3701
|
"""
|
|
3628
3702
|
type StoreAggregateOffer {
|
|
@@ -3651,7 +3725,7 @@ type StoreAggregateOffer {
|
|
|
3651
3725
|
"""
|
|
3652
3726
|
offers: [StoreOffer!]!
|
|
3653
3727
|
}
|
|
3654
|
-
`,
|
|
3728
|
+
`, Ki = `"""
|
|
3655
3729
|
Average rating, based on multiple ratings or reviews.
|
|
3656
3730
|
"""
|
|
3657
3731
|
type StoreAggregateRating {
|
|
@@ -3664,7 +3738,7 @@ type StoreAggregateRating {
|
|
|
3664
3738
|
"""
|
|
3665
3739
|
reviewCount: Int!
|
|
3666
3740
|
}
|
|
3667
|
-
`,
|
|
3741
|
+
`, Qi = `"""
|
|
3668
3742
|
information about the author of a product review or rating.
|
|
3669
3743
|
"""
|
|
3670
3744
|
type StoreAuthor {
|
|
@@ -3673,7 +3747,7 @@ type StoreAuthor {
|
|
|
3673
3747
|
"""
|
|
3674
3748
|
name: String!
|
|
3675
3749
|
}
|
|
3676
|
-
`,
|
|
3750
|
+
`, Zi = `"""
|
|
3677
3751
|
Brand of a given product.
|
|
3678
3752
|
"""
|
|
3679
3753
|
type StoreBrand {
|
|
@@ -3682,7 +3756,7 @@ type StoreBrand {
|
|
|
3682
3756
|
"""
|
|
3683
3757
|
name: String!
|
|
3684
3758
|
}
|
|
3685
|
-
`,
|
|
3759
|
+
`, ea = `"""
|
|
3686
3760
|
Item of a list.
|
|
3687
3761
|
"""
|
|
3688
3762
|
type StoreListItem {
|
|
@@ -3713,7 +3787,7 @@ type StoreBreadcrumbList {
|
|
|
3713
3787
|
"""
|
|
3714
3788
|
numberOfItems: Int!
|
|
3715
3789
|
}
|
|
3716
|
-
`,
|
|
3790
|
+
`, na = `"""
|
|
3717
3791
|
Shopping cart message.
|
|
3718
3792
|
"""
|
|
3719
3793
|
type StoreCartMessage {
|
|
@@ -3750,7 +3824,7 @@ input IStoreCart {
|
|
|
3750
3824
|
"""
|
|
3751
3825
|
order: IStoreOrder!
|
|
3752
3826
|
}
|
|
3753
|
-
`,
|
|
3827
|
+
`, ta = `"""
|
|
3754
3828
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\` or \`Collection\`.
|
|
3755
3829
|
|
|
3756
3830
|
\`SubCategory\` and \`Cluster\` are still declared for backward compatibility but are
|
|
@@ -3865,7 +3939,7 @@ type StoreCollectionLocale {
|
|
|
3865
3939
|
"""
|
|
3866
3940
|
slug: String!
|
|
3867
3941
|
}
|
|
3868
|
-
`,
|
|
3942
|
+
`, ra = `"""
|
|
3869
3943
|
Delivery Promise badge.
|
|
3870
3944
|
"""
|
|
3871
3945
|
type DeliveryPromiseBadge {
|
|
@@ -3874,7 +3948,7 @@ type DeliveryPromiseBadge {
|
|
|
3874
3948
|
"""
|
|
3875
3949
|
typeName: String
|
|
3876
3950
|
}
|
|
3877
|
-
`,
|
|
3951
|
+
`, ia = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
3878
3952
|
|
|
3879
3953
|
"""
|
|
3880
3954
|
Search facet range information.
|
|
@@ -3951,7 +4025,7 @@ type StoreFacetValueBoolean {
|
|
|
3951
4025
|
"""
|
|
3952
4026
|
quantity: Int
|
|
3953
4027
|
}
|
|
3954
|
-
`,
|
|
4028
|
+
`, aa = `"""
|
|
3955
4029
|
Image.
|
|
3956
4030
|
"""
|
|
3957
4031
|
type StoreImage {
|
|
@@ -3978,7 +4052,7 @@ input IStoreImage {
|
|
|
3978
4052
|
"""
|
|
3979
4053
|
alternateName: String!
|
|
3980
4054
|
}
|
|
3981
|
-
`,
|
|
4055
|
+
`, oa = `type Mutation {
|
|
3982
4056
|
"""
|
|
3983
4057
|
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\`.
|
|
3984
4058
|
"""
|
|
@@ -4020,7 +4094,7 @@ input IStoreImage {
|
|
|
4020
4094
|
"""
|
|
4021
4095
|
startRecommendationSession: Boolean!
|
|
4022
4096
|
}
|
|
4023
|
-
`,
|
|
4097
|
+
`, sa = `"""
|
|
4024
4098
|
Newsletter information.
|
|
4025
4099
|
"""
|
|
4026
4100
|
type PersonNewsletter {
|
|
@@ -4043,8 +4117,8 @@ input IPersonNewsletter {
|
|
|
4043
4117
|
"""
|
|
4044
4118
|
email: String!
|
|
4045
4119
|
}
|
|
4046
|
-
`,
|
|
4047
|
-
`,
|
|
4120
|
+
`, ca = `scalar ObjectOrString
|
|
4121
|
+
`, la = `"""
|
|
4048
4122
|
Offer information.
|
|
4049
4123
|
"""
|
|
4050
4124
|
type StoreOffer {
|
|
@@ -4137,7 +4211,7 @@ input IStoreOffer {
|
|
|
4137
4211
|
"""
|
|
4138
4212
|
priceToken: String
|
|
4139
4213
|
}
|
|
4140
|
-
`,
|
|
4214
|
+
`, da = `"""
|
|
4141
4215
|
Information of a specific order.
|
|
4142
4216
|
"""
|
|
4143
4217
|
type StoreOrder {
|
|
@@ -4178,7 +4252,7 @@ input IStoreOrder {
|
|
|
4178
4252
|
"""
|
|
4179
4253
|
shouldSplitItem: Boolean
|
|
4180
4254
|
}
|
|
4181
|
-
`,
|
|
4255
|
+
`, ua = `"""
|
|
4182
4256
|
Commercial Authorization response.
|
|
4183
4257
|
"""
|
|
4184
4258
|
type CommercialAuthorizationResponse {
|
|
@@ -4577,7 +4651,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
4577
4651
|
"""
|
|
4578
4652
|
rule: CommercialAuthorizationRule!
|
|
4579
4653
|
}
|
|
4580
|
-
`,
|
|
4654
|
+
`, pa = `"""
|
|
4581
4655
|
Input for uploading a file to the Order Entry Service.
|
|
4582
4656
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
4583
4657
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -4638,7 +4712,7 @@ type StoreOrderFormCartItem {
|
|
|
4638
4712
|
seller: String!
|
|
4639
4713
|
unitMultiplier: Float
|
|
4640
4714
|
}
|
|
4641
|
-
`,
|
|
4715
|
+
`, ga = `"""
|
|
4642
4716
|
Organization.
|
|
4643
4717
|
"""
|
|
4644
4718
|
type StoreOrganization {
|
|
@@ -4675,7 +4749,7 @@ type StoreContract {
|
|
|
4675
4749
|
"""
|
|
4676
4750
|
isActive: Boolean!
|
|
4677
4751
|
}
|
|
4678
|
-
`,
|
|
4752
|
+
`, ma = `"""
|
|
4679
4753
|
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.
|
|
4680
4754
|
"""
|
|
4681
4755
|
type StorePageInfo {
|
|
@@ -4700,7 +4774,7 @@ type StorePageInfo {
|
|
|
4700
4774
|
"""
|
|
4701
4775
|
totalCount: Int!
|
|
4702
4776
|
}
|
|
4703
|
-
`,
|
|
4777
|
+
`, ha = `"""
|
|
4704
4778
|
Input type for setting a new password.
|
|
4705
4779
|
"""
|
|
4706
4780
|
input ISetPassword {
|
|
@@ -4743,7 +4817,7 @@ type SetPasswordResponse {
|
|
|
4743
4817
|
"""
|
|
4744
4818
|
message: String
|
|
4745
4819
|
}
|
|
4746
|
-
`,
|
|
4820
|
+
`, fa = `"""
|
|
4747
4821
|
Client profile data.
|
|
4748
4822
|
"""
|
|
4749
4823
|
type StorePerson {
|
|
@@ -4786,7 +4860,7 @@ input IStorePerson {
|
|
|
4786
4860
|
"""
|
|
4787
4861
|
familyName: String!
|
|
4788
4862
|
}
|
|
4789
|
-
`,
|
|
4863
|
+
`, Sa = `type PickupPointAddress {
|
|
4790
4864
|
"""
|
|
4791
4865
|
Address city.
|
|
4792
4866
|
"""
|
|
@@ -4865,7 +4939,7 @@ type PickupPoints {
|
|
|
4865
4939
|
"""
|
|
4866
4940
|
pickupPointsHash: String
|
|
4867
4941
|
}
|
|
4868
|
-
`,
|
|
4942
|
+
`, ya = `"""
|
|
4869
4943
|
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.
|
|
4870
4944
|
"""
|
|
4871
4945
|
type StoreProduct {
|
|
@@ -5033,7 +5107,7 @@ input IStoreProduct {
|
|
|
5033
5107
|
"""
|
|
5034
5108
|
additionalProperty: [IStorePropertyValue!]
|
|
5035
5109
|
}
|
|
5036
|
-
`,
|
|
5110
|
+
`, Ia = `"""
|
|
5037
5111
|
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.
|
|
5038
5112
|
"""
|
|
5039
5113
|
type StoreProductGroup {
|
|
@@ -5060,7 +5134,7 @@ type StoreProductGroup {
|
|
|
5060
5134
|
"""
|
|
5061
5135
|
skuVariants: SkuVariants
|
|
5062
5136
|
}
|
|
5063
|
-
`,
|
|
5137
|
+
`, va = `type Profile {
|
|
5064
5138
|
"""
|
|
5065
5139
|
Collection of user's address
|
|
5066
5140
|
"""
|
|
@@ -5121,7 +5195,7 @@ type ProfileAddress {
|
|
|
5121
5195
|
"""
|
|
5122
5196
|
geoCoordinate: [Float]
|
|
5123
5197
|
}
|
|
5124
|
-
`,
|
|
5198
|
+
`, Oa = `"""
|
|
5125
5199
|
Properties that can be associated with products and products groups.
|
|
5126
5200
|
"""
|
|
5127
5201
|
type StorePropertyValue {
|
|
@@ -5161,7 +5235,7 @@ input IStorePropertyValue {
|
|
|
5161
5235
|
"""
|
|
5162
5236
|
valueReference: ObjectOrString!
|
|
5163
5237
|
}
|
|
5164
|
-
`,
|
|
5238
|
+
`, Ca = `"""
|
|
5165
5239
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
5166
5240
|
"""
|
|
5167
5241
|
type StoreProductEdge {
|
|
@@ -5553,6 +5627,25 @@ type Query {
|
|
|
5553
5627
|
@auth
|
|
5554
5628
|
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
5555
5629
|
|
|
5630
|
+
"""
|
|
5631
|
+
Returns the list of saved credit cards for the current user.
|
|
5632
|
+
"""
|
|
5633
|
+
listCreditCards: SavedCardListResult
|
|
5634
|
+
@auth
|
|
5635
|
+
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
5636
|
+
|
|
5637
|
+
"""
|
|
5638
|
+
Whether the current user holds the ad-hoc card platform permission, which
|
|
5639
|
+
gates personal card management for Unit/Contract-affiliated buyers.
|
|
5640
|
+
|
|
5641
|
+
Resolved from the user's roles by License Manager — it is not a session token
|
|
5642
|
+
claim. Fails open (\`true\`) when the permission service is unreachable, so an
|
|
5643
|
+
outage never locks buyers out of their own cards.
|
|
5644
|
+
"""
|
|
5645
|
+
hasAdHocCardAccess: Boolean!
|
|
5646
|
+
@auth
|
|
5647
|
+
@cacheControl(scope: "private", sMaxAge: 60, staleWhileRevalidate: 300)
|
|
5648
|
+
|
|
5556
5649
|
"""
|
|
5557
5650
|
Returns the list of Orders that the User can view.
|
|
5558
5651
|
"""
|
|
@@ -5791,7 +5884,7 @@ type StoreAccountProfile {
|
|
|
5791
5884
|
email: String
|
|
5792
5885
|
id: String
|
|
5793
5886
|
}
|
|
5794
|
-
`,
|
|
5887
|
+
`, ba = `"""
|
|
5795
5888
|
Summary of a quote returned in list results.
|
|
5796
5889
|
"""
|
|
5797
5890
|
type UserQuoteSummary {
|
|
@@ -5856,7 +5949,7 @@ type UserQuoteListPaging {
|
|
|
5856
5949
|
"""
|
|
5857
5950
|
perPage: Int!
|
|
5858
5951
|
}
|
|
5859
|
-
`,
|
|
5952
|
+
`, wa = `type RecommendationResponse {
|
|
5860
5953
|
products: [StoreProduct!]!
|
|
5861
5954
|
correlationId: String!
|
|
5862
5955
|
campaign: RecommendationCampaign!
|
|
@@ -5867,7 +5960,7 @@ type RecommendationCampaign {
|
|
|
5867
5960
|
title: String
|
|
5868
5961
|
type: String!
|
|
5869
5962
|
}
|
|
5870
|
-
`,
|
|
5963
|
+
`, Da = `"""
|
|
5871
5964
|
Information of a given review rating.
|
|
5872
5965
|
"""
|
|
5873
5966
|
type StoreReviewRating {
|
|
@@ -5894,7 +5987,71 @@ type StoreReview {
|
|
|
5894
5987
|
"""
|
|
5895
5988
|
author: StoreAuthor!
|
|
5896
5989
|
}
|
|
5897
|
-
`,
|
|
5990
|
+
`, Aa = `"""
|
|
5991
|
+
Whether a saved card is personally owned by the buyer or shared by their
|
|
5992
|
+
Organization/Contract. Resolved server-side by the Saved-cards service from
|
|
5993
|
+
the buyer's \`useAdHocCard\` role — never inferred client-side.
|
|
5994
|
+
"""
|
|
5995
|
+
enum CardOrigin {
|
|
5996
|
+
personal
|
|
5997
|
+
shared
|
|
5998
|
+
}
|
|
5999
|
+
|
|
6000
|
+
"""
|
|
6001
|
+
A saved payment card returned by the Saved-cards service.
|
|
6002
|
+
"""
|
|
6003
|
+
type SavedCard {
|
|
6004
|
+
"""
|
|
6005
|
+
Account identifier that owns the card.
|
|
6006
|
+
"""
|
|
6007
|
+
accountId: String
|
|
6008
|
+
"""
|
|
6009
|
+
First digits of the card (BIN).
|
|
6010
|
+
"""
|
|
6011
|
+
bin: String
|
|
6012
|
+
"""
|
|
6013
|
+
Masked card number, per PCI display rules.
|
|
6014
|
+
"""
|
|
6015
|
+
cardNumber: String
|
|
6016
|
+
"""
|
|
6017
|
+
Buyer- or admin-assigned nickname for the card (e.g. "Team lunch card"), when
|
|
6018
|
+
the Saved-cards service has one on file. Absent for most cards — callers
|
|
6019
|
+
should fall back to \`paymentSystemName\` for display.
|
|
6020
|
+
"""
|
|
6021
|
+
cardLabel: String
|
|
6022
|
+
"""
|
|
6023
|
+
Numeric payment system identifier.
|
|
6024
|
+
"""
|
|
6025
|
+
paymentSystem: String
|
|
6026
|
+
"""
|
|
6027
|
+
Human-readable payment system name (e.g. Visa, Mastercard).
|
|
6028
|
+
"""
|
|
6029
|
+
paymentSystemName: String
|
|
6030
|
+
"""
|
|
6031
|
+
Whether this card is the account default.
|
|
6032
|
+
"""
|
|
6033
|
+
isDefault: Boolean
|
|
6034
|
+
"""
|
|
6035
|
+
Whether this card is active.
|
|
6036
|
+
"""
|
|
6037
|
+
isActive: Boolean
|
|
6038
|
+
"""
|
|
6039
|
+
Whether this card is personally owned by the buyer or shared by their
|
|
6040
|
+
Organization/Contract.
|
|
6041
|
+
"""
|
|
6042
|
+
origin: CardOrigin!
|
|
6043
|
+
}
|
|
6044
|
+
|
|
6045
|
+
"""
|
|
6046
|
+
Result of listing the current user's saved credit cards.
|
|
6047
|
+
"""
|
|
6048
|
+
type SavedCardListResult {
|
|
6049
|
+
"""
|
|
6050
|
+
The list of saved credit cards.
|
|
6051
|
+
"""
|
|
6052
|
+
list: [SavedCard!]
|
|
6053
|
+
}
|
|
6054
|
+
`, Pa = `"""
|
|
5898
6055
|
Search Engine Optimization (SEO) tags data.
|
|
5899
6056
|
"""
|
|
5900
6057
|
type StoreSeo {
|
|
@@ -5915,7 +6072,7 @@ type StoreSeo {
|
|
|
5915
6072
|
"""
|
|
5916
6073
|
canonical: String!
|
|
5917
6074
|
}
|
|
5918
|
-
`,
|
|
6075
|
+
`, _a = `"""
|
|
5919
6076
|
Currency information.
|
|
5920
6077
|
"""
|
|
5921
6078
|
type StoreCurrency {
|
|
@@ -6190,7 +6347,7 @@ input IStoreSession {
|
|
|
6190
6347
|
"""
|
|
6191
6348
|
refreshAfter: String
|
|
6192
6349
|
}
|
|
6193
|
-
`,
|
|
6350
|
+
`, ka = `"""
|
|
6194
6351
|
Shipping Simulation item input.
|
|
6195
6352
|
"""
|
|
6196
6353
|
input IShippingItem {
|
|
@@ -6521,7 +6678,7 @@ type MessageFields {
|
|
|
6521
6678
|
"""
|
|
6522
6679
|
skuName: String
|
|
6523
6680
|
}
|
|
6524
|
-
`,
|
|
6681
|
+
`, Ea = `type SkuVariants {
|
|
6525
6682
|
"""
|
|
6526
6683
|
SKU property values for the current SKU.
|
|
6527
6684
|
"""
|
|
@@ -6616,7 +6773,7 @@ Example:
|
|
|
6616
6773
|
\`\`\`
|
|
6617
6774
|
"""
|
|
6618
6775
|
scalar FormattedVariants
|
|
6619
|
-
`,
|
|
6776
|
+
`, Ta = `"""
|
|
6620
6777
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
6621
6778
|
"""
|
|
6622
6779
|
enum StoreStatus {
|
|
@@ -6624,7 +6781,7 @@ enum StoreStatus {
|
|
|
6624
6781
|
WARNING
|
|
6625
6782
|
ERROR
|
|
6626
6783
|
}
|
|
6627
|
-
`,
|
|
6784
|
+
`, Ua = `scalar JSONObject
|
|
6628
6785
|
|
|
6629
6786
|
type UserOrder {
|
|
6630
6787
|
orderId: String
|
|
@@ -7448,94 +7605,96 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
7448
7605
|
type: String
|
|
7449
7606
|
id: String
|
|
7450
7607
|
}
|
|
7451
|
-
`,
|
|
7452
|
-
"./address.graphql":
|
|
7453
|
-
"./advertisement.graphql":
|
|
7454
|
-
"./aggregateOffer.graphql":
|
|
7455
|
-
"./aggregateRating.graphql":
|
|
7456
|
-
"./author.graphql":
|
|
7457
|
-
"./brand.graphql":
|
|
7458
|
-
"./breadcrumb.graphql":
|
|
7459
|
-
"./cart.graphql":
|
|
7460
|
-
"./collection.graphql":
|
|
7461
|
-
"./deliveryPromisesBadge.graphql":
|
|
7462
|
-
"./facet.graphql":
|
|
7463
|
-
"./image.graphql":
|
|
7464
|
-
"./mutation.graphql":
|
|
7465
|
-
"./newsletter.graphql":
|
|
7466
|
-
"./objectOrString.graphql":
|
|
7467
|
-
"./offer.graphql":
|
|
7468
|
-
"./order.graphql":
|
|
7469
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
7470
|
-
"./orderEntry.graphql":
|
|
7471
|
-
"./organization.graphql":
|
|
7472
|
-
"./pageInfo.graphql":
|
|
7473
|
-
"./password.graphql":
|
|
7474
|
-
"./person.graphql":
|
|
7475
|
-
"./pickupPoints.graphql":
|
|
7476
|
-
"./product.graphql":
|
|
7477
|
-
"./productGroup.graphql":
|
|
7478
|
-
"./profile.graphql":
|
|
7479
|
-
"./propertyValue.graphql":
|
|
7480
|
-
"./query.graphql":
|
|
7481
|
-
"./quote.graphql":
|
|
7482
|
-
"./recommendation.graphql":
|
|
7483
|
-
"./review.graphql":
|
|
7484
|
-
"./
|
|
7485
|
-
"./
|
|
7486
|
-
"./
|
|
7487
|
-
"./
|
|
7488
|
-
"./
|
|
7489
|
-
"./
|
|
7490
|
-
|
|
7491
|
-
|
|
7608
|
+
`, Ra = /* @__PURE__ */ Object.assign({
|
|
7609
|
+
"./address.graphql": Xi,
|
|
7610
|
+
"./advertisement.graphql": Yi,
|
|
7611
|
+
"./aggregateOffer.graphql": Ji,
|
|
7612
|
+
"./aggregateRating.graphql": Ki,
|
|
7613
|
+
"./author.graphql": Qi,
|
|
7614
|
+
"./brand.graphql": Zi,
|
|
7615
|
+
"./breadcrumb.graphql": ea,
|
|
7616
|
+
"./cart.graphql": na,
|
|
7617
|
+
"./collection.graphql": ta,
|
|
7618
|
+
"./deliveryPromisesBadge.graphql": ra,
|
|
7619
|
+
"./facet.graphql": ia,
|
|
7620
|
+
"./image.graphql": aa,
|
|
7621
|
+
"./mutation.graphql": oa,
|
|
7622
|
+
"./newsletter.graphql": sa,
|
|
7623
|
+
"./objectOrString.graphql": ca,
|
|
7624
|
+
"./offer.graphql": la,
|
|
7625
|
+
"./order.graphql": da,
|
|
7626
|
+
"./orderCommercialAuthorizaton.graphql": ua,
|
|
7627
|
+
"./orderEntry.graphql": pa,
|
|
7628
|
+
"./organization.graphql": ga,
|
|
7629
|
+
"./pageInfo.graphql": ma,
|
|
7630
|
+
"./password.graphql": ha,
|
|
7631
|
+
"./person.graphql": fa,
|
|
7632
|
+
"./pickupPoints.graphql": Sa,
|
|
7633
|
+
"./product.graphql": ya,
|
|
7634
|
+
"./productGroup.graphql": Ia,
|
|
7635
|
+
"./profile.graphql": va,
|
|
7636
|
+
"./propertyValue.graphql": Oa,
|
|
7637
|
+
"./query.graphql": Ca,
|
|
7638
|
+
"./quote.graphql": ba,
|
|
7639
|
+
"./recommendation.graphql": wa,
|
|
7640
|
+
"./review.graphql": Da,
|
|
7641
|
+
"./savedCard.graphql": Aa,
|
|
7642
|
+
"./seo.graphql": Pa,
|
|
7643
|
+
"./session.graphql": _a,
|
|
7644
|
+
"./shipping.graphql": ka,
|
|
7645
|
+
"./skuVariants.graphql": Ea,
|
|
7646
|
+
"./status.graphql": Ta,
|
|
7647
|
+
"./userOrder.graphql": Ua
|
|
7648
|
+
}), Fa = $n(
|
|
7649
|
+
Object.values(Ra).map((e) => Mn(e)).reduce(
|
|
7492
7650
|
(e, n) => tn([e, n], { sort: !0 })
|
|
7493
7651
|
)
|
|
7494
|
-
),
|
|
7652
|
+
), Na = Fa, Za = async (e) => (n) => (n.storage = {
|
|
7495
7653
|
channel: ee.parse(e.channel),
|
|
7496
7654
|
flags: e.flags ?? {},
|
|
7497
7655
|
locale: e.locale,
|
|
7498
7656
|
cookies: /* @__PURE__ */ new Map()
|
|
7499
|
-
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients =
|
|
7500
|
-
function
|
|
7501
|
-
const e =
|
|
7657
|
+
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients = Yt(e, n), n.loaders = ar(e, n), n);
|
|
7658
|
+
function La() {
|
|
7659
|
+
const e = Hi(), n = {};
|
|
7502
7660
|
for (const [t, r] of Object.entries(e))
|
|
7503
7661
|
n[t] = Object.fromEntries(
|
|
7504
|
-
Object.entries(r).map(([i,
|
|
7662
|
+
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, st(a, `${t}(${i})`)])
|
|
7505
7663
|
);
|
|
7506
7664
|
return n;
|
|
7507
7665
|
}
|
|
7508
|
-
function
|
|
7509
|
-
const t =
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
])(
|
|
7666
|
+
function eo(e) {
|
|
7667
|
+
const t = at([
|
|
7668
|
+
it,
|
|
7669
|
+
nt
|
|
7670
|
+
])(La(), Na);
|
|
7513
7671
|
return e && zn(e) ? Ln({
|
|
7514
7672
|
schemas: [t, e]
|
|
7515
7673
|
}) : t;
|
|
7516
7674
|
}
|
|
7517
7675
|
export {
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
Wn as
|
|
7676
|
+
nt as AuthDirective,
|
|
7677
|
+
E as BadRequestError,
|
|
7678
|
+
it as CacheControlDirective,
|
|
7679
|
+
Wn as CardOrigin,
|
|
7680
|
+
Gn as CommercialAuthorizationStatus,
|
|
7522
7681
|
Z as FastStoreError,
|
|
7523
7682
|
Y as ForbiddenError,
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7683
|
+
Za as GraphqlVtexContextFactory,
|
|
7684
|
+
eo as GraphqlVtexSchema,
|
|
7685
|
+
$ as NotFoundError,
|
|
7686
|
+
Hn as StoreCollectionType,
|
|
7687
|
+
Xn as StoreFacetType,
|
|
7688
|
+
Yn as StoreSort,
|
|
7689
|
+
Jn as StoreStatus,
|
|
7531
7690
|
re as UnauthorizedError,
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7691
|
+
Kn as UserOrderInvoiceType,
|
|
7692
|
+
Ka as isBadRequestError,
|
|
7693
|
+
Ja as isFastStoreError,
|
|
7694
|
+
ct as isForbiddenError,
|
|
7695
|
+
X as isNotFoundError,
|
|
7696
|
+
Qa as isUnauthorizedError,
|
|
7697
|
+
Ya as stringifyCacheControl,
|
|
7698
|
+
Na as typeDefs,
|
|
7699
|
+
at as withDirectives
|
|
7541
7700
|
};
|