@faststore/api 4.5.0-dev.2 → 4.5.0-dev.4
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 +95 -44
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +1088 -837
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/__generated__/schema.d.ts +44 -3
- package/dist/src/__generated__/schema.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/catalog/index.d.ts +34 -0
- package/dist/src/platforms/vtex/clients/catalog/index.d.ts.map +1 -0
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts +6 -0
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/types/ByLinkId.d.ts +45 -0
- package/dist/src/platforms/vtex/clients/commerce/types/ByLinkId.d.ts.map +1 -0
- package/dist/src/platforms/vtex/clients/index.d.ts +8 -0
- package/dist/src/platforms/vtex/clients/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/search/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/index.d.ts +12 -13
- package/dist/src/platforms/vtex/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/loaders/collection.d.ts +32 -3
- package/dist/src/platforms/vtex/loaders/collection.d.ts.map +1 -1
- package/dist/src/platforms/vtex/loaders/index.d.ts +2 -2
- package/dist/src/platforms/vtex/loaders/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/collection.d.ts +20 -2
- package/dist/src/platforms/vtex/resolvers/collection.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 +3 -13
- package/dist/src/platforms/vtex/resolvers/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/product.d.ts +13 -1
- package/dist/src/platforms/vtex/resolvers/product.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts +8 -17
- package/dist/src/platforms/vtex/resolvers/query.d.ts.map +1 -1
- package/dist/src/platforms/vtex/utils/localization.d.ts +28 -0
- package/dist/src/platforms/vtex/utils/localization.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/__generated__/schema.ts +46 -3
- package/src/platforms/vtex/clients/catalog/index.ts +52 -0
- package/src/platforms/vtex/clients/commerce/index.ts +71 -0
- package/src/platforms/vtex/clients/commerce/types/ByLinkId.ts +46 -0
- package/src/platforms/vtex/clients/index.ts +3 -0
- package/src/platforms/vtex/clients/search/index.ts +16 -4
- package/src/platforms/vtex/index.ts +17 -2
- package/src/platforms/vtex/loaders/collection.ts +99 -25
- package/src/platforms/vtex/loaders/index.ts +2 -1
- package/src/platforms/vtex/resolvers/collection.ts +173 -66
- package/src/platforms/vtex/resolvers/product.ts +160 -11
- package/src/platforms/vtex/resolvers/query.ts +148 -56
- package/src/platforms/vtex/typeDefs/collection.graphql +33 -1
- package/src/platforms/vtex/typeDefs/product.graphql +19 -0
- package/src/platforms/vtex/utils/localization.ts +45 -0
package/dist/es/index.mjs
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
4
|
-
import { OTELAPI as
|
|
5
|
-
import { GraphQLScalarType as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const
|
|
1
|
+
import { mergeTypeDefs as Ze } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as Un, mergeSchemas as kn } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as en, MapperKind as nn, getDirective as tn } from "@graphql-tools/utils";
|
|
4
|
+
import { OTELAPI as L } from "@faststore/diagnostics";
|
|
5
|
+
import { GraphQLScalarType as _n, print as Tn, parse as En, isSchema as Rn } from "graphql";
|
|
6
|
+
import Fn from "isomorphic-unfetch";
|
|
7
|
+
import { parse as Z } from "cookie";
|
|
8
|
+
import Ae from "p-limit";
|
|
9
|
+
import le from "dataloader";
|
|
10
|
+
import Nn from "sanitize-html";
|
|
11
|
+
import Pe from "fast-deep-equal";
|
|
12
|
+
import Ln from "node:crypto";
|
|
13
|
+
var Bn = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(Bn || {}), $n = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))($n || {}), Mn = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(Mn || {}), zn = /* @__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))(zn || {}), Vn = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(Vn || {}), xn = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(xn || {});
|
|
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
|
-
throw new
|
|
17
|
+
throw new J("No authentication AppKey and AppToken passed.");
|
|
18
18
|
return {
|
|
19
19
|
...n,
|
|
20
20
|
"X-VTEX-API-AppKey": t,
|
|
21
21
|
"X-VTEX-API-AppToken": r
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, jn = async (e) => {
|
|
24
24
|
const {
|
|
25
25
|
clients: { commerce: n }
|
|
26
26
|
} = e;
|
|
27
27
|
try {
|
|
28
28
|
if ((await n.vtexid.validate())?.authStatus?.toLowerCase() !== "success")
|
|
29
|
-
throw new
|
|
29
|
+
throw new te("Authentication required");
|
|
30
30
|
} catch (t) {
|
|
31
31
|
const r = t.extensions?.status ?? t.status;
|
|
32
|
-
throw r === 401 ? new
|
|
32
|
+
throw r === 401 ? new te("Authentication required") : r === 403 ? new J("You are not allowed to access this resource") : new te("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, Wn = "auth", Gn = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (e) =>
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
36
|
+
transformer: (e) => en(e, {
|
|
37
|
+
[nn.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (tn(e, n, Wn)?.[0]) {
|
|
39
39
|
const r = n.resolve;
|
|
40
|
-
n.resolve = async (i, a, o, s) => (await
|
|
40
|
+
n.resolve = async (i, a, o, s) => (await jn(o), r?.(i, a, o, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, Hn = "cacheControl", Ta = (e, n) => {
|
|
46
46
|
const {
|
|
47
47
|
scope: t = "private",
|
|
48
48
|
sMaxAge: r = 0,
|
|
49
49
|
staleWhileRevalidate: i = 0
|
|
50
50
|
} = e;
|
|
51
51
|
return `${n ? "private" : t}, s-maxage=${r}, stale-while-revalidate=${i}`;
|
|
52
|
-
},
|
|
52
|
+
}, ke = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, Xn = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, Yn = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (e) =>
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (e) => en(e, {
|
|
55
|
+
[nn.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = tn(e, n, Hn)?.[0];
|
|
57
57
|
if (t) {
|
|
58
58
|
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
|
|
59
59
|
n.resolve = (s, c, l, p) => (l.cacheControl = {
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
60
|
+
sMaxAge: ke(l.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: ke(
|
|
62
62
|
l.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
65
|
+
scope: Xn(l.cacheControl?.scope, a)
|
|
66
66
|
}, o?.(s, c, l, p));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
71
|
+
}, Jn = (e) => (n, t) => {
|
|
72
|
+
const r = Ze([
|
|
73
73
|
...(e ?? []).map(({ typeDefs: i }) => i),
|
|
74
74
|
t
|
|
75
75
|
]);
|
|
76
76
|
return (e ?? []).reduce(
|
|
77
77
|
(i, { transformer: a }) => a?.(i) ?? i,
|
|
78
|
-
|
|
78
|
+
Un({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
},
|
|
84
|
-
name:
|
|
85
|
-
version:
|
|
86
|
-
},
|
|
83
|
+
}, pe = "@faststore/api", ge = "4.5.0-dev.3", _e = {
|
|
84
|
+
name: pe,
|
|
85
|
+
version: ge
|
|
86
|
+
}, Kn = (e, n) => (t, r, i, a) => {
|
|
87
87
|
if ((i?.OTEL?.enabled ?? !1) === !1)
|
|
88
88
|
return e(t, r, i, a);
|
|
89
|
-
const o =
|
|
90
|
-
|
|
89
|
+
const o = L.trace.getTracer(pe, ge), s = L.propagation.extract(
|
|
90
|
+
L.context.active(),
|
|
91
91
|
i.OTEL
|
|
92
92
|
);
|
|
93
|
-
return
|
|
93
|
+
return L.context.with(s, () => {
|
|
94
94
|
const c = o.startSpan(n ?? "Unknown Graphql Resolver", {
|
|
95
95
|
startTime: Date.now(),
|
|
96
|
-
kind:
|
|
96
|
+
kind: L.SpanKind.INTERNAL,
|
|
97
97
|
attributes: {
|
|
98
98
|
timestamp: Date.now(),
|
|
99
|
-
"@faststore_version":
|
|
100
|
-
"@faststore_package_name":
|
|
99
|
+
"@faststore_version": ge,
|
|
100
|
+
"@faststore_package_name": pe,
|
|
101
101
|
"@faststore_account_name": i.account,
|
|
102
102
|
"@faststore_environment": process.env.NODE_ENV
|
|
103
103
|
}
|
|
@@ -111,37 +111,37 @@ const Bn = () => function(n = {}) {
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
};
|
|
114
|
-
class
|
|
114
|
+
class ee extends Error {
|
|
115
115
|
constructor(n, t) {
|
|
116
116
|
super(t), this.extensions = n, this.name = "FastStoreError";
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
class T extends
|
|
119
|
+
class T extends ee {
|
|
120
120
|
constructor(n) {
|
|
121
121
|
super({ status: 400, type: "BadRequestError" }, n);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
class
|
|
124
|
+
class te extends ee {
|
|
125
125
|
constructor(n) {
|
|
126
126
|
super({ status: 401, type: "UnauthorizedError" }, n);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
class
|
|
129
|
+
class J extends ee {
|
|
130
130
|
constructor(n) {
|
|
131
131
|
super({ status: 403, type: "ForbiddenError" }, n);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
class
|
|
134
|
+
class $ extends ee {
|
|
135
135
|
constructor(n) {
|
|
136
136
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const
|
|
140
|
-
const r = await
|
|
139
|
+
const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type === "BadRequestError", Fa = (e) => e?.extensions?.type === "UnauthorizedError", Qn = (e) => e?.extensions?.type === "ForbiddenError", X = (e) => e?.extensions?.type === "NotFoundError", Zn = `${_e.name}@${_e.version}`, I = async (e, n, t) => {
|
|
140
|
+
const r = await Fn(e, {
|
|
141
141
|
...n,
|
|
142
142
|
headers: {
|
|
143
143
|
...n?.headers ?? {},
|
|
144
|
-
"User-Agent":
|
|
144
|
+
"User-Agent": Zn
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
if (r.ok)
|
|
@@ -153,19 +153,30 @@ const Oa = (e) => e?.name === "FastStoreError", Ca = (e) => e?.extensions?.type
|
|
|
153
153
|
case 400:
|
|
154
154
|
throw new T(i);
|
|
155
155
|
case 401:
|
|
156
|
-
throw new
|
|
156
|
+
throw new te(i);
|
|
157
157
|
case 403:
|
|
158
|
-
throw new
|
|
158
|
+
throw new J(i);
|
|
159
159
|
case 404:
|
|
160
|
-
throw new
|
|
160
|
+
throw new $(i);
|
|
161
161
|
default:
|
|
162
|
-
throw new
|
|
162
|
+
throw new ee(
|
|
163
163
|
{ status: r.status, type: "UnknownError" },
|
|
164
164
|
i
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
throw new Error(i);
|
|
168
|
-
},
|
|
168
|
+
}, et = ({ account: e, environment: n }) => {
|
|
169
|
+
const t = `https://${e}.${n}.com.br`;
|
|
170
|
+
return {
|
|
171
|
+
getLocalizedProduct: (r, i) => I(`${t}/api/catalog-dataplane/product/${r}`, {
|
|
172
|
+
method: "GET",
|
|
173
|
+
headers: {
|
|
174
|
+
"Accept-Language": i,
|
|
175
|
+
"Content-Type": "application/json"
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
};
|
|
179
|
+
}, rn = (e) => {
|
|
169
180
|
if (!e)
|
|
170
181
|
return e;
|
|
171
182
|
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
@@ -179,8 +190,8 @@ const Oa = (e) => e?.name === "FastStoreError", Ca = (e) => e?.extensions?.type
|
|
|
179
190
|
}
|
|
180
191
|
}
|
|
181
192
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
182
|
-
},
|
|
183
|
-
const t = n.match(
|
|
193
|
+
}, nt = /^([^=]+)=([^;]*)/, tt = (e, n) => {
|
|
194
|
+
const t = n.match(nt);
|
|
184
195
|
if (t) {
|
|
185
196
|
const r = t[1], i = t[2];
|
|
186
197
|
e.storage.cookies.set(r, {
|
|
@@ -188,47 +199,47 @@ const Oa = (e) => e?.name === "FastStoreError", Ca = (e) => e?.extensions?.type
|
|
|
188
199
|
setCookie: n
|
|
189
200
|
});
|
|
190
201
|
}
|
|
191
|
-
},
|
|
202
|
+
}, rt = (e, n) => {
|
|
192
203
|
n.getSetCookie().forEach(
|
|
193
|
-
(t) =>
|
|
204
|
+
(t) => tt(e, t)
|
|
194
205
|
);
|
|
195
|
-
},
|
|
206
|
+
}, it = (e) => (n) => rt(e, n), me = (e) => {
|
|
196
207
|
if (!e.headers?.cookie)
|
|
197
208
|
return null;
|
|
198
|
-
const n =
|
|
209
|
+
const n = rn(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
199
210
|
return t.length === 0 ? n : t.reduce(
|
|
200
|
-
(r, [i, { value: a }]) =>
|
|
211
|
+
(r, [i, { value: a }]) => at(
|
|
201
212
|
r,
|
|
202
213
|
i,
|
|
203
214
|
a
|
|
204
215
|
),
|
|
205
216
|
n
|
|
206
217
|
);
|
|
207
|
-
},
|
|
208
|
-
const r =
|
|
218
|
+
}, an = (e) => function(t) {
|
|
219
|
+
const r = me(e);
|
|
209
220
|
return r ? {
|
|
210
221
|
...t,
|
|
211
222
|
cookie: r
|
|
212
223
|
} : t;
|
|
213
224
|
}, z = (e, n) => {
|
|
214
|
-
const t =
|
|
215
|
-
return
|
|
216
|
-
},
|
|
225
|
+
const t = rn(e);
|
|
226
|
+
return Z(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
227
|
+
}, at = (e, n, t) => {
|
|
217
228
|
const r = new RegExp(`(${n})=([^;]*)`), i = e.match(r);
|
|
218
229
|
return i ? e.replace(
|
|
219
230
|
i[0],
|
|
220
231
|
`${i[1]}=${t}`
|
|
221
232
|
) : `${e};${n}=${t}`;
|
|
222
233
|
};
|
|
223
|
-
function
|
|
234
|
+
function Y(e) {
|
|
224
235
|
return e ? JSON.parse(Buffer.from(e.split(".")[1], "base64").toString()) : null;
|
|
225
236
|
}
|
|
226
|
-
const
|
|
237
|
+
const ot = "storefront/faststore.recommendation-shelf@v4", j = {
|
|
227
238
|
method: "POST",
|
|
228
239
|
headers: {
|
|
229
240
|
"content-type": "application/json"
|
|
230
241
|
}
|
|
231
|
-
},
|
|
242
|
+
}, st = (e) => e.split("/").map(encodeURIComponent).join("/"), ue = (e) => e ? { headers: { "Accept-Language": e } } : void 0, ct = /^\d{4}-\d{2}-\d{2}$/, lt = /* @__PURE__ */ new Set([
|
|
232
243
|
"Draft",
|
|
233
244
|
"Requested",
|
|
234
245
|
"InReview",
|
|
@@ -239,7 +250,7 @@ const Kn = "storefront/faststore.recommendation-shelf@v4", W = {
|
|
|
239
250
|
"ConvertedToCart",
|
|
240
251
|
"ConvertedToOrder"
|
|
241
252
|
]);
|
|
242
|
-
function
|
|
253
|
+
function dt({
|
|
243
254
|
page: e,
|
|
244
255
|
perPage: n,
|
|
245
256
|
status: t,
|
|
@@ -262,19 +273,19 @@ function nt({
|
|
|
262
273
|
["expiresAtFrom", a],
|
|
263
274
|
["expiresAtTo", o]
|
|
264
275
|
])
|
|
265
|
-
if (c && !
|
|
276
|
+
if (c && !ct.test(c))
|
|
266
277
|
throw new Error(
|
|
267
278
|
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
268
279
|
);
|
|
269
280
|
if (t && t.length > 0) {
|
|
270
|
-
const s = t.filter((c) => !
|
|
281
|
+
const s = t.filter((c) => !lt.has(c));
|
|
271
282
|
if (s.length > 0)
|
|
272
283
|
throw new Error(
|
|
273
284
|
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
274
285
|
);
|
|
275
286
|
}
|
|
276
287
|
}
|
|
277
|
-
function
|
|
288
|
+
function ut({
|
|
278
289
|
page: e,
|
|
279
290
|
perPage: n,
|
|
280
291
|
status: t,
|
|
@@ -287,13 +298,13 @@ function tt({
|
|
|
287
298
|
const c = new URLSearchParams();
|
|
288
299
|
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((l) => c.append("status", l)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i), a && c.append("expiresAtFrom", a), o && c.append("expiresAtTo", o), s?.trim() && c.append("label", s.trim()), c;
|
|
289
300
|
}
|
|
290
|
-
const
|
|
291
|
-
const a = `https://${e}.${n}.com.br`, o =
|
|
301
|
+
const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
302
|
+
const a = `https://${e}.${n}.com.br`, o = it(i), s = an(i), c = qn(), l = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", p = r && r.map((d) => d + ".").find((d) => l.includes(d)) || "", u = l.replace(p, ""), h = `${a}/api/recommend-bff/v2`, f = s({
|
|
292
303
|
accept: "application/json",
|
|
293
304
|
"content-type": "application/json",
|
|
294
|
-
"x-vtex-rec-origin": `${e}/${
|
|
295
|
-
}),
|
|
296
|
-
const g = z(
|
|
305
|
+
"x-vtex-rec-origin": `${e}/${ot}`
|
|
306
|
+
}), v = (d = {}) => {
|
|
307
|
+
const g = z(me(i) ?? "", e);
|
|
297
308
|
return s({
|
|
298
309
|
...d,
|
|
299
310
|
"X-FORWARDED-HOST": u,
|
|
@@ -326,6 +337,44 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
326
337
|
{ storeCookies: o }
|
|
327
338
|
)
|
|
328
339
|
},
|
|
340
|
+
byLinkId: {
|
|
341
|
+
// The by-linkid endpoints resolve a slug to a single catalog entity
|
|
342
|
+
// (or 404 when there is no match). We surface a 404 as `null` so the
|
|
343
|
+
// loader can cascade category → brand → collection.
|
|
344
|
+
category: async (d, g) => {
|
|
345
|
+
try {
|
|
346
|
+
return await I(
|
|
347
|
+
`${a}/api/catalog_system/pub/category/by-linkid/${st(d)}`,
|
|
348
|
+
ue(g)
|
|
349
|
+
);
|
|
350
|
+
} catch (m) {
|
|
351
|
+
if (X(m)) return null;
|
|
352
|
+
throw m;
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
brand: async (d, g) => {
|
|
356
|
+
try {
|
|
357
|
+
return await I(
|
|
358
|
+
`${a}/api/catalog_system/pub/brand/by-linkid/${encodeURIComponent(d)}`,
|
|
359
|
+
ue(g)
|
|
360
|
+
);
|
|
361
|
+
} catch (m) {
|
|
362
|
+
if (X(m)) return null;
|
|
363
|
+
throw m;
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
collection: async (d, g) => {
|
|
367
|
+
try {
|
|
368
|
+
return await I(
|
|
369
|
+
`${a}/api/catalog_system/pub/collection/by-linkid/${encodeURIComponent(d)}`,
|
|
370
|
+
ue(g)
|
|
371
|
+
);
|
|
372
|
+
} catch (m) {
|
|
373
|
+
if (X(m)) return null;
|
|
374
|
+
throw m;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
},
|
|
329
378
|
products: {
|
|
330
379
|
crossselling: ({
|
|
331
380
|
type: d,
|
|
@@ -355,7 +404,7 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
355
404
|
return I(
|
|
356
405
|
`${a}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
357
406
|
{
|
|
358
|
-
...
|
|
407
|
+
...j,
|
|
359
408
|
headers: y,
|
|
360
409
|
body: JSON.stringify(d)
|
|
361
410
|
},
|
|
@@ -367,12 +416,12 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
367
416
|
index: g,
|
|
368
417
|
deliveryMode: m,
|
|
369
418
|
selectedAddresses: y
|
|
370
|
-
},
|
|
371
|
-
const w =
|
|
419
|
+
}, O) => {
|
|
420
|
+
const w = O ? {
|
|
372
421
|
startDateUtc: m?.deliveryWindow?.startDate,
|
|
373
422
|
endDateUtc: m?.deliveryWindow?.endDate
|
|
374
|
-
} : null,
|
|
375
|
-
logisticsInfo: Array.from({ length: g }, (
|
|
423
|
+
} : null, C = {
|
|
424
|
+
logisticsInfo: Array.from({ length: g }, (S, D) => ({
|
|
376
425
|
itemIndex: D,
|
|
377
426
|
selectedDeliveryChannel: m?.deliveryChannel || null,
|
|
378
427
|
selectedSla: m?.deliveryMethod || null,
|
|
@@ -387,9 +436,9 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
387
436
|
return I(
|
|
388
437
|
`${a}/api/checkout/pub/orderForm/${d}/attachments/shippingData`,
|
|
389
438
|
{
|
|
390
|
-
...
|
|
439
|
+
...j,
|
|
391
440
|
headers: P,
|
|
392
|
-
body: JSON.stringify(
|
|
441
|
+
body: JSON.stringify(C)
|
|
393
442
|
},
|
|
394
443
|
{ storeCookies: o }
|
|
395
444
|
);
|
|
@@ -435,17 +484,17 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
435
484
|
refreshOutdatedData: g = !0,
|
|
436
485
|
channel: m = i.storage.channel
|
|
437
486
|
}) => {
|
|
438
|
-
const { salesChannel: y } = m,
|
|
487
|
+
const { salesChannel: y } = m, O = s({
|
|
439
488
|
"content-type": "application/json",
|
|
440
489
|
"X-FORWARDED-HOST": u
|
|
441
490
|
}), w = new URLSearchParams({ sc: y });
|
|
442
491
|
d && w.set("refreshOutdatedData", g.toString());
|
|
443
|
-
const
|
|
492
|
+
const C = `${a}/api/checkout/pub/orderForm${d ? `/${d}` : ""}?${w.toString()}`;
|
|
444
493
|
return I(
|
|
445
|
-
|
|
494
|
+
C,
|
|
446
495
|
{
|
|
447
|
-
...
|
|
448
|
-
headers:
|
|
496
|
+
...j,
|
|
497
|
+
headers: O,
|
|
449
498
|
...d ? {} : { body: "{}" }
|
|
450
499
|
},
|
|
451
500
|
{ storeCookies: o }
|
|
@@ -459,7 +508,7 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
459
508
|
return I(
|
|
460
509
|
`${a}/api/checkout/pub/orderForm/${d}/messages/clear`,
|
|
461
510
|
{
|
|
462
|
-
...
|
|
511
|
+
...j,
|
|
463
512
|
headers: g,
|
|
464
513
|
body: "{}"
|
|
465
514
|
}
|
|
@@ -470,22 +519,22 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
470
519
|
orderItems: g,
|
|
471
520
|
allowOutdatedData: m = "paymentData",
|
|
472
521
|
salesChannel: y = i.storage.channel.salesChannel,
|
|
473
|
-
shouldSplitItem:
|
|
522
|
+
shouldSplitItem: O = !0
|
|
474
523
|
}) => {
|
|
475
524
|
const w = new URLSearchParams({
|
|
476
525
|
allowOutdatedData: m,
|
|
477
526
|
sc: y
|
|
478
|
-
}),
|
|
527
|
+
}), C = s({
|
|
479
528
|
"content-type": "application/json",
|
|
480
529
|
"X-FORWARDED-HOST": u
|
|
481
530
|
});
|
|
482
531
|
return I(
|
|
483
532
|
`${a}/api/checkout/pub/orderForm/${d}/items?${w}`,
|
|
484
533
|
{
|
|
485
|
-
headers:
|
|
534
|
+
headers: C,
|
|
486
535
|
body: JSON.stringify({
|
|
487
536
|
orderItems: g,
|
|
488
|
-
noSplitItem: !
|
|
537
|
+
noSplitItem: !O
|
|
489
538
|
}),
|
|
490
539
|
method: "PATCH"
|
|
491
540
|
},
|
|
@@ -498,14 +547,14 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
498
547
|
key: m,
|
|
499
548
|
value: y
|
|
500
549
|
}) => {
|
|
501
|
-
const
|
|
550
|
+
const O = s({
|
|
502
551
|
"content-type": "application/json",
|
|
503
552
|
"X-FORWARDED-HOST": u
|
|
504
553
|
});
|
|
505
554
|
return I(
|
|
506
555
|
`${a}/api/checkout/pub/orderForm/${d}/customData/${g}/${m}`,
|
|
507
556
|
{
|
|
508
|
-
headers:
|
|
557
|
+
headers: O,
|
|
509
558
|
body: JSON.stringify({ value: y }),
|
|
510
559
|
method: "PUT"
|
|
511
560
|
}
|
|
@@ -517,22 +566,22 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
517
566
|
country: m,
|
|
518
567
|
salesChannel: y
|
|
519
568
|
}) => {
|
|
520
|
-
const
|
|
569
|
+
const O = new URLSearchParams({
|
|
521
570
|
country: m,
|
|
522
571
|
sc: y ?? ""
|
|
523
572
|
});
|
|
524
|
-
d ?
|
|
573
|
+
d ? O.append("postalCode", d) : O.append(
|
|
525
574
|
"geoCoordinates",
|
|
526
575
|
`${g?.longitude};${g?.latitude}`
|
|
527
576
|
);
|
|
528
|
-
const w = `${a}/api/checkout/pub/regions/?${
|
|
577
|
+
const w = `${a}/api/checkout/pub/regions/?${O.toString()}`, C = s({
|
|
529
578
|
"content-type": "application/json",
|
|
530
579
|
"X-FORWARDED-HOST": u
|
|
531
580
|
});
|
|
532
581
|
return I(
|
|
533
582
|
w,
|
|
534
583
|
{
|
|
535
|
-
headers:
|
|
584
|
+
headers: C
|
|
536
585
|
},
|
|
537
586
|
{ storeCookies: o }
|
|
538
587
|
);
|
|
@@ -605,7 +654,7 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
605
654
|
);
|
|
606
655
|
const m = s({
|
|
607
656
|
"content-type": "application/json"
|
|
608
|
-
}), y =
|
|
657
|
+
}), y = Z(i?.headers?.cookie ?? "")?.vtex_session;
|
|
609
658
|
return I(
|
|
610
659
|
`${a}/api/sessions?${g.toString()}`,
|
|
611
660
|
{
|
|
@@ -619,7 +668,7 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
619
668
|
subscribeToNewsletter: (d) => I(
|
|
620
669
|
`${a}/api/dataentities/NL/documents/`,
|
|
621
670
|
{
|
|
622
|
-
...
|
|
671
|
+
...j,
|
|
623
672
|
body: JSON.stringify({ ...d, isNewsletterOptIn: !0 }),
|
|
624
673
|
method: "PATCH"
|
|
625
674
|
},
|
|
@@ -658,12 +707,12 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
658
707
|
status: g,
|
|
659
708
|
dateInitial: m,
|
|
660
709
|
dateFinal: y,
|
|
661
|
-
text:
|
|
710
|
+
text: O,
|
|
662
711
|
clientEmail: w,
|
|
663
|
-
perPage:
|
|
712
|
+
perPage: C,
|
|
664
713
|
pendingMyApproval: P
|
|
665
714
|
}) => {
|
|
666
|
-
const
|
|
715
|
+
const S = new URLSearchParams();
|
|
667
716
|
if (m) {
|
|
668
717
|
const A = new Date(m).setHours(
|
|
669
718
|
0,
|
|
@@ -682,16 +731,16 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
682
731
|
);
|
|
683
732
|
y = new Date(A).toISOString();
|
|
684
733
|
}
|
|
685
|
-
|
|
734
|
+
O && S.append("text", O), g && g.length > 0 && S.append("status", g.filter(Boolean).join(",")), m && y ? S.append(
|
|
686
735
|
"creation_date",
|
|
687
736
|
`creationDate:[${m} TO ${y}]`
|
|
688
|
-
) : m ?
|
|
737
|
+
) : m ? S.append("creation_date", `creationDate:[${m} TO *]`) : y && S.append("creation_date", `creationDate:[* TO ${y}]`), w && S.append("clientEmail", w), d && S.append("page", d.toString()), C && S.append("per_page", C.toString()), P && S.append("my_pending_approvals", String(!0));
|
|
689
738
|
const D = s({
|
|
690
739
|
"content-type": "application/json",
|
|
691
740
|
"X-FORWARDED-HOST": u
|
|
692
741
|
});
|
|
693
742
|
return I(
|
|
694
|
-
`${a}/api/oms/user/orders?${
|
|
743
|
+
`${a}/api/oms/user/orders?${S.toString()}`,
|
|
695
744
|
{
|
|
696
745
|
method: "GET",
|
|
697
746
|
headers: D
|
|
@@ -721,7 +770,7 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
721
770
|
ruleId: m,
|
|
722
771
|
approved: y
|
|
723
772
|
}) => {
|
|
724
|
-
const
|
|
773
|
+
const O = s({
|
|
725
774
|
"content-type": "application/json",
|
|
726
775
|
"X-FORWARDED-HOST": u
|
|
727
776
|
}), P = {
|
|
@@ -735,7 +784,7 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
735
784
|
`${a}/${e}/commercial-authorizations/${d}/callback`,
|
|
736
785
|
{
|
|
737
786
|
method: "POST",
|
|
738
|
-
headers:
|
|
787
|
+
headers: O,
|
|
739
788
|
body: JSON.stringify(P)
|
|
740
789
|
},
|
|
741
790
|
{ storeCookies: o }
|
|
@@ -848,7 +897,7 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
848
897
|
}) => {
|
|
849
898
|
if (!d)
|
|
850
899
|
throw new T("Missing contractId to fetch CL fields.");
|
|
851
|
-
const g =
|
|
900
|
+
const g = v({
|
|
852
901
|
Accept: "application/json",
|
|
853
902
|
"content-type": "application/json"
|
|
854
903
|
});
|
|
@@ -883,8 +932,8 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
883
932
|
},
|
|
884
933
|
quotes: {
|
|
885
934
|
listUserQuotes: (d) => {
|
|
886
|
-
|
|
887
|
-
const g =
|
|
935
|
+
dt(d);
|
|
936
|
+
const g = ut(d), m = s({
|
|
888
937
|
"content-type": "application/json",
|
|
889
938
|
"X-FORWARDED-HOST": u
|
|
890
939
|
});
|
|
@@ -903,7 +952,7 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
903
952
|
const d = s({
|
|
904
953
|
"content-type": "application/json",
|
|
905
954
|
"X-FORWARDED-HOST": u
|
|
906
|
-
}), g = z(
|
|
955
|
+
}), g = z(me(i) ?? "", e);
|
|
907
956
|
return I(
|
|
908
957
|
`${a}/api/vtexid/credential/validate`,
|
|
909
958
|
{
|
|
@@ -924,26 +973,26 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
924
973
|
const y = s({
|
|
925
974
|
"content-type": "application/json",
|
|
926
975
|
"X-FORWARDED-HOST": u
|
|
927
|
-
}),
|
|
928
|
-
`, P = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream",
|
|
929
|
-
`--${
|
|
930
|
-
`Content-Disposition: form-data; name="file"; filename="${
|
|
976
|
+
}), O = `----FastStoreUploadBoundary${Date.now()}`, w = `\r
|
|
977
|
+
`, P = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", S = g.replaceAll(/[\r\n"]/g, "_"), D = [
|
|
978
|
+
`--${O}`,
|
|
979
|
+
`Content-Disposition: form-data; name="file"; filename="${S}"`,
|
|
931
980
|
`Content-Type: ${P}`,
|
|
932
981
|
"",
|
|
933
982
|
""
|
|
934
|
-
].join(w), A = `${w}--${
|
|
935
|
-
U.byteLength + d.byteLength +
|
|
983
|
+
].join(w), A = `${w}--${O}--${w}`, U = Buffer.from(D), b = Buffer.from(A), k = new Uint8Array(
|
|
984
|
+
U.byteLength + d.byteLength + b.byteLength
|
|
936
985
|
);
|
|
937
986
|
let _ = 0;
|
|
938
|
-
return
|
|
987
|
+
return k.set(U, _), _ += U.byteLength, k.set(d, _), _ += d.byteLength, k.set(b, _), I(
|
|
939
988
|
`${a}/api/order-entry/upload?an=${e}`,
|
|
940
989
|
{
|
|
941
990
|
method: "POST",
|
|
942
991
|
headers: {
|
|
943
992
|
...y,
|
|
944
|
-
"content-type": `multipart/form-data; boundary=${
|
|
993
|
+
"content-type": `multipart/form-data; boundary=${O}`
|
|
945
994
|
},
|
|
946
|
-
body:
|
|
995
|
+
body: k.buffer
|
|
947
996
|
},
|
|
948
997
|
{}
|
|
949
998
|
);
|
|
@@ -956,7 +1005,7 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
956
1005
|
const y = s({
|
|
957
1006
|
"content-type": "application/json",
|
|
958
1007
|
"X-FORWARDED-HOST": u
|
|
959
|
-
}),
|
|
1008
|
+
}), O = JSON.stringify({
|
|
960
1009
|
objectKey: d,
|
|
961
1010
|
orderFormId: g,
|
|
962
1011
|
operation: "CreateCart",
|
|
@@ -967,7 +1016,7 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
967
1016
|
{
|
|
968
1017
|
method: "POST",
|
|
969
1018
|
headers: y,
|
|
970
|
-
body:
|
|
1019
|
+
body: O
|
|
971
1020
|
},
|
|
972
1021
|
{}
|
|
973
1022
|
);
|
|
@@ -1030,12 +1079,12 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1030
1079
|
userId: g,
|
|
1031
1080
|
products: m = [],
|
|
1032
1081
|
salesChannel: y,
|
|
1033
|
-
locale:
|
|
1082
|
+
locale: O
|
|
1034
1083
|
}) => {
|
|
1035
1084
|
const w = new URLSearchParams({ an: e, campaignVrn: d });
|
|
1036
|
-
return g && w.append("userId", g), m.length > 0 && w.append("products", m.join(",")), y && w.append("salesChannel", y),
|
|
1085
|
+
return g && w.append("userId", g), m.length > 0 && w.append("products", m.join(",")), y && w.append("salesChannel", y), O && w.append("locale", O), I(
|
|
1037
1086
|
`${h}/recommendations?${w.toString()}`,
|
|
1038
|
-
{ headers:
|
|
1087
|
+
{ headers: f },
|
|
1039
1088
|
{ storeCookies: o }
|
|
1040
1089
|
);
|
|
1041
1090
|
},
|
|
@@ -1043,33 +1092,33 @@ const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1043
1092
|
const d = new URLSearchParams({ an: e });
|
|
1044
1093
|
return I(
|
|
1045
1094
|
`${h}/users/start-session?${d.toString()}`,
|
|
1046
|
-
{ method: "POST", headers:
|
|
1095
|
+
{ method: "POST", headers: f },
|
|
1047
1096
|
{ storeCookies: o }
|
|
1048
1097
|
);
|
|
1049
1098
|
}
|
|
1050
1099
|
}
|
|
1051
1100
|
};
|
|
1052
|
-
},
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
]),
|
|
1101
|
+
}, K = (e) => e.discoveryConfig?.localization ?? {}, Q = (e) => K(e).enabled === !0, gt = (e) => Object.keys(K(e).locales ?? {}), mt = (e) => K(e).defaultLocale, re = (e) => Q(e) && e.storage.locale || void 0, he = "fuzzy", fe = "operator", Se = "pickupPoint", Te = "shipping", Ee = "delivery-options", ht = "in-stock", ft = "trade-policy", St = "region-id", yt = /* @__PURE__ */ new Set([
|
|
1102
|
+
ft,
|
|
1103
|
+
St,
|
|
1104
|
+
he,
|
|
1105
|
+
fe,
|
|
1106
|
+
Se
|
|
1107
|
+
]), It = /* @__PURE__ */ new Set([
|
|
1059
1108
|
"zip-code",
|
|
1060
1109
|
"pickupPoint",
|
|
1061
1110
|
"country",
|
|
1062
1111
|
"coordinates",
|
|
1063
1112
|
"deliveryZonesHash",
|
|
1064
1113
|
"pickupPointsHash"
|
|
1065
|
-
]),
|
|
1114
|
+
]), vt = /* @__PURE__ */ new Set(["productClusterIds"]), Re = (e) => encodeURI(decodeURI(e)), Ot = (e) => encodeURIComponent(
|
|
1066
1115
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
1067
|
-
),
|
|
1068
|
-
function
|
|
1116
|
+
), Ct = /^pickup-in-point-(.+)$/;
|
|
1117
|
+
function on(e) {
|
|
1069
1118
|
if (!e)
|
|
1070
1119
|
return {};
|
|
1071
1120
|
try {
|
|
1072
|
-
const t =
|
|
1121
|
+
const t = Z(e).vtex_segment;
|
|
1073
1122
|
if (!t)
|
|
1074
1123
|
return {};
|
|
1075
1124
|
const r = Buffer.from(t, "base64").toString("utf-8");
|
|
@@ -1078,18 +1127,18 @@ function Qe(e) {
|
|
|
1078
1127
|
return {};
|
|
1079
1128
|
}
|
|
1080
1129
|
}
|
|
1081
|
-
function
|
|
1130
|
+
function bt(e) {
|
|
1082
1131
|
const n = {}, t = {}, r = [];
|
|
1083
1132
|
for (const i of e.split(";")) {
|
|
1084
1133
|
const a = i.indexOf("=");
|
|
1085
1134
|
if (a < 0) continue;
|
|
1086
1135
|
const o = i.slice(0, a), s = i.slice(a + 1);
|
|
1087
|
-
!o || !s || (
|
|
1136
|
+
!o || !s || (It.has(o) ? n[o] = s : vt.has(o) ? t[o] = s : r.push({ key: o, value: s }));
|
|
1088
1137
|
}
|
|
1089
1138
|
return { shipping: n, queryParams: t, extraFacets: r };
|
|
1090
1139
|
}
|
|
1091
|
-
function
|
|
1092
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, queryParams: r, extraFacets: i } =
|
|
1140
|
+
function wt(e) {
|
|
1141
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, queryParams: r, extraFacets: i } = bt(n);
|
|
1093
1142
|
return {
|
|
1094
1143
|
segmentParams: {
|
|
1095
1144
|
sc: e.channel,
|
|
@@ -1111,7 +1160,7 @@ function gt(e) {
|
|
|
1111
1160
|
extraFacets: i
|
|
1112
1161
|
};
|
|
1113
1162
|
}
|
|
1114
|
-
function
|
|
1163
|
+
function sn(e, n) {
|
|
1115
1164
|
const t = [
|
|
1116
1165
|
["sc", n.sc],
|
|
1117
1166
|
["regionId", n.regionId],
|
|
@@ -1132,11 +1181,11 @@ function Ke(e, n) {
|
|
|
1132
1181
|
for (const [r, i] of t)
|
|
1133
1182
|
i != null && i !== "" && e.append(r, String(i));
|
|
1134
1183
|
}
|
|
1135
|
-
function
|
|
1136
|
-
return
|
|
1184
|
+
function cn(e) {
|
|
1185
|
+
return Ct.exec(e)?.[1];
|
|
1137
1186
|
}
|
|
1138
|
-
function
|
|
1139
|
-
const n = e.find((r) => r.key === "shipping"), t = n ?
|
|
1187
|
+
function Dt(e) {
|
|
1188
|
+
const n = e.find((r) => r.key === "shipping"), t = n ? cn(n.value) : void 0;
|
|
1140
1189
|
if (t !== void 0)
|
|
1141
1190
|
try {
|
|
1142
1191
|
return decodeURIComponent(t);
|
|
@@ -1144,8 +1193,8 @@ function mt(e) {
|
|
|
1144
1193
|
return t;
|
|
1145
1194
|
}
|
|
1146
1195
|
}
|
|
1147
|
-
function
|
|
1148
|
-
const t =
|
|
1196
|
+
function At(e, n) {
|
|
1197
|
+
const t = Dt(
|
|
1149
1198
|
n
|
|
1150
1199
|
);
|
|
1151
1200
|
return t === void 0 ? e : {
|
|
@@ -1153,25 +1202,25 @@ function ht(e, n) {
|
|
|
1153
1202
|
pickupPoint: t
|
|
1154
1203
|
};
|
|
1155
1204
|
}
|
|
1156
|
-
function
|
|
1157
|
-
return e.map((n) => n.key !== "shipping" ||
|
|
1205
|
+
function Pt(e) {
|
|
1206
|
+
return e.map((n) => n.key !== "shipping" || cn(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1158
1207
|
}
|
|
1159
|
-
function
|
|
1208
|
+
function Ut(e, n) {
|
|
1160
1209
|
let t = [...e];
|
|
1161
1210
|
const r = t.some((i) => i.key === "shipping");
|
|
1162
1211
|
for (const i of n)
|
|
1163
1212
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1164
|
-
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")),
|
|
1213
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), Pt(t);
|
|
1165
1214
|
}
|
|
1166
|
-
function
|
|
1215
|
+
function kt(e) {
|
|
1167
1216
|
return e.reduce((n, t) => {
|
|
1168
1217
|
let { key: r, value: i } = t;
|
|
1169
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${
|
|
1218
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Re(r)}/${Ot(Re(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1170
1219
|
}, "");
|
|
1171
1220
|
}
|
|
1172
|
-
const
|
|
1173
|
-
function
|
|
1174
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1221
|
+
const _t = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), Tt = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1222
|
+
function Et(e, n) {
|
|
1223
|
+
const { segmentParams: t, extraFacets: r } = wt(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
|
|
1175
1224
|
return {
|
|
1176
1225
|
segmentParams: {
|
|
1177
1226
|
...t,
|
|
@@ -1182,23 +1231,23 @@ function Ot(e, n) {
|
|
|
1182
1231
|
extraFacets: r
|
|
1183
1232
|
};
|
|
1184
1233
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const t = e.filter(({ key: c }) => !
|
|
1187
|
-
({ key: c, value: l }) => c ===
|
|
1234
|
+
function Rt(e, n) {
|
|
1235
|
+
const t = e.filter(({ key: c }) => !yt.has(c)), r = e.find(
|
|
1236
|
+
({ key: c, value: l }) => c === Te && l !== "all-delivery-methods"
|
|
1188
1237
|
) ?? null, i = e.find(
|
|
1189
|
-
({ key: c, value: l }) => c ===
|
|
1238
|
+
({ key: c, value: l }) => c === Ee && l !== "all-delivery-options"
|
|
1190
1239
|
) ?? null, a = [...t], o = a.some(
|
|
1191
|
-
({ key: c }) => c ===
|
|
1240
|
+
({ key: c }) => c === Te
|
|
1192
1241
|
), s = a.some(
|
|
1193
|
-
({ key: c }) => c ===
|
|
1242
|
+
({ key: c }) => c === Ee
|
|
1194
1243
|
);
|
|
1195
|
-
return r !== null && !o && a.push(r), i !== null && !s && a.push(i),
|
|
1244
|
+
return r !== null && !o && a.push(r), i !== null && !s && a.push(i), Ut(a, n);
|
|
1196
1245
|
}
|
|
1197
|
-
function
|
|
1198
|
-
const t = e.find(({ key: a }) => a ===
|
|
1199
|
-
t &&
|
|
1246
|
+
function Ft(e, n) {
|
|
1247
|
+
const t = e.find(({ key: a }) => a === he) ?? null, r = e.find(({ key: a }) => a === fe) ?? null, i = e.find(({ key: a }) => a === Se) ?? null;
|
|
1248
|
+
t && _t(t) && n.append(he, t.value), r && Tt(r) && n.append(fe, r.value), i && n.append(Se, i.value);
|
|
1200
1249
|
}
|
|
1201
|
-
function
|
|
1250
|
+
function Fe(e, n, t, r) {
|
|
1202
1251
|
const {
|
|
1203
1252
|
query: i = "",
|
|
1204
1253
|
page: a,
|
|
@@ -1209,34 +1258,34 @@ function Pe(e, n, t, r) {
|
|
|
1209
1258
|
sponsoredCount: p,
|
|
1210
1259
|
hideUnavailableItems: u,
|
|
1211
1260
|
allowRedirect: h = !1
|
|
1212
|
-
} = e,
|
|
1261
|
+
} = e, f = new URLSearchParams();
|
|
1213
1262
|
if (r.includePagination && a !== void 0 && o !== void 0) {
|
|
1214
1263
|
const g = a * o, m = o === 0 ? g : g + o - 1;
|
|
1215
|
-
|
|
1264
|
+
f.append("from", g.toString()), f.append("to", m.toString());
|
|
1216
1265
|
}
|
|
1217
|
-
i &&
|
|
1218
|
-
const
|
|
1266
|
+
i && f.append("query", i), r.includeSort && s && f.append("sort", s);
|
|
1267
|
+
const v = At(
|
|
1219
1268
|
t.segmentParams,
|
|
1220
1269
|
c
|
|
1221
1270
|
);
|
|
1222
|
-
if (
|
|
1223
|
-
const g = c.find(({ key: y }) => y ===
|
|
1224
|
-
|
|
1271
|
+
if (sn(f, v ?? t.segmentParams), Ft(c, f), l && f.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1272
|
+
const g = c.find(({ key: y }) => y === ht), m = g ? g.value : u?.toString() ?? n.hideUnavailableItems.toString();
|
|
1273
|
+
f.append("hideUnavailableItems", m);
|
|
1225
1274
|
}
|
|
1226
|
-
n?.simulationBehavior !== void 0 &&
|
|
1227
|
-
const d =
|
|
1228
|
-
|
|
1275
|
+
n?.simulationBehavior !== void 0 && f.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && f.append("showSponsored", n.showSponsored.toString()), p !== void 0 && f.append("sponsoredCount", p.toString()), h !== void 0 && f.append("allowRedirect", h.toString());
|
|
1276
|
+
const d = kt(
|
|
1277
|
+
Rt(c, t.extraFacets)
|
|
1229
1278
|
);
|
|
1230
|
-
return { params:
|
|
1279
|
+
return { params: f, path: d };
|
|
1231
1280
|
}
|
|
1232
|
-
function
|
|
1281
|
+
function Nt(e, n) {
|
|
1233
1282
|
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: a } = e, o = new URLSearchParams({
|
|
1234
1283
|
field: t ?? "",
|
|
1235
1284
|
value: r ?? ""
|
|
1236
1285
|
});
|
|
1237
|
-
return
|
|
1286
|
+
return sn(o, n), i && o.append("hideUnavailableItems", "true"), a && o.append("show-invisible-items", "true"), o;
|
|
1238
1287
|
}
|
|
1239
|
-
function
|
|
1288
|
+
function W(e, n) {
|
|
1240
1289
|
return {
|
|
1241
1290
|
path: e,
|
|
1242
1291
|
params: n,
|
|
@@ -1246,44 +1295,44 @@ function G(e, n) {
|
|
|
1246
1295
|
}
|
|
1247
1296
|
};
|
|
1248
1297
|
}
|
|
1249
|
-
function
|
|
1250
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a =
|
|
1298
|
+
function G(e) {
|
|
1299
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a = Et(t, r);
|
|
1251
1300
|
switch (n) {
|
|
1252
1301
|
case "product-search":
|
|
1253
1302
|
case "facets": {
|
|
1254
|
-
const { params: o, path: s } =
|
|
1303
|
+
const { params: o, path: s } = Fe(
|
|
1255
1304
|
i,
|
|
1256
1305
|
r,
|
|
1257
1306
|
a,
|
|
1258
1307
|
{ includePagination: !0, includeSort: !0 }
|
|
1259
1308
|
);
|
|
1260
|
-
return
|
|
1309
|
+
return W(s, o);
|
|
1261
1310
|
}
|
|
1262
1311
|
case "catalog-count": {
|
|
1263
|
-
const { params: o, path: s } =
|
|
1312
|
+
const { params: o, path: s } = Fe(
|
|
1264
1313
|
i,
|
|
1265
1314
|
r,
|
|
1266
1315
|
a,
|
|
1267
1316
|
{ includePagination: !1, includeSort: !1 }
|
|
1268
1317
|
);
|
|
1269
|
-
return
|
|
1318
|
+
return W(s, o);
|
|
1270
1319
|
}
|
|
1271
1320
|
case "products": {
|
|
1272
|
-
const o =
|
|
1273
|
-
return
|
|
1321
|
+
const o = Nt(i, a.segmentParams);
|
|
1322
|
+
return W("", o);
|
|
1274
1323
|
}
|
|
1275
1324
|
case "search-suggestions": {
|
|
1276
1325
|
const o = new URLSearchParams({
|
|
1277
1326
|
query: i.query?.toString() ?? "",
|
|
1278
1327
|
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1279
1328
|
});
|
|
1280
|
-
return
|
|
1329
|
+
return W("", o);
|
|
1281
1330
|
}
|
|
1282
1331
|
case "top-searches": {
|
|
1283
1332
|
const o = new URLSearchParams({
|
|
1284
1333
|
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1285
1334
|
});
|
|
1286
|
-
return
|
|
1335
|
+
return W("", o);
|
|
1287
1336
|
}
|
|
1288
1337
|
default: {
|
|
1289
1338
|
const o = n;
|
|
@@ -1291,16 +1340,16 @@ function H(e) {
|
|
|
1291
1340
|
}
|
|
1292
1341
|
}
|
|
1293
1342
|
}
|
|
1294
|
-
const
|
|
1295
|
-
function
|
|
1343
|
+
const Lt = 10;
|
|
1344
|
+
function Bt(e) {
|
|
1296
1345
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1297
1346
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1298
1347
|
}
|
|
1299
|
-
function
|
|
1300
|
-
const
|
|
1301
|
-
return e.storage.locale ||
|
|
1348
|
+
function $t(e) {
|
|
1349
|
+
const t = on(e.headers?.cookie).cultureInfo || "";
|
|
1350
|
+
return Q(e) ? e.storage.locale || t : t || e.storage.locale || "";
|
|
1302
1351
|
}
|
|
1303
|
-
const
|
|
1352
|
+
const Mt = ({
|
|
1304
1353
|
account: e,
|
|
1305
1354
|
environment: n,
|
|
1306
1355
|
hideUnavailableItems: t,
|
|
@@ -1308,18 +1357,18 @@ const Ut = ({
|
|
|
1308
1357
|
showSponsored: i,
|
|
1309
1358
|
subDomainPrefix: a
|
|
1310
1359
|
}, o) => {
|
|
1311
|
-
const s = `https://${e}.${n}.com.br`, c =
|
|
1360
|
+
const s = `https://${e}.${n}.com.br`, c = an(o), l = on(o.headers?.cookie), p = () => ({
|
|
1312
1361
|
salesChannel: o.storage.channel.salesChannel,
|
|
1313
|
-
regionId:
|
|
1314
|
-
locale:
|
|
1362
|
+
regionId: Bt(o),
|
|
1363
|
+
locale: $t(o),
|
|
1315
1364
|
hideUnavailableItems: t,
|
|
1316
1365
|
simulationBehavior: r,
|
|
1317
1366
|
showSponsored: i
|
|
1318
|
-
}), u = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "", h = a && a.map((
|
|
1367
|
+
}), u = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "", h = a && a.map((S) => S + ".").find((S) => u.includes(S)) || "", f = u.replace(h, ""), v = c({
|
|
1319
1368
|
"content-type": "application/json",
|
|
1320
|
-
"X-FORWARDED-HOST":
|
|
1321
|
-
}), d = ({ type:
|
|
1322
|
-
const A =
|
|
1369
|
+
"X-FORWARDED-HOST": f
|
|
1370
|
+
}), d = ({ type: S, ...D }) => {
|
|
1371
|
+
const A = S === "facets" ? "facets" : "product-search", U = G({
|
|
1323
1372
|
endpoint: A,
|
|
1324
1373
|
segment: l,
|
|
1325
1374
|
defaults: p(),
|
|
@@ -1327,47 +1376,47 @@ const Ut = ({
|
|
|
1327
1376
|
});
|
|
1328
1377
|
return I(
|
|
1329
1378
|
`${s}/api/intelligent-search/v1/${A}/${U.path}?${U.params.toString()}`,
|
|
1330
|
-
{ headers:
|
|
1379
|
+
{ headers: v }
|
|
1331
1380
|
);
|
|
1332
|
-
}, g = (
|
|
1333
|
-
field:
|
|
1381
|
+
}, g = (S) => d({ ...S, type: "product_search" }), m = ({
|
|
1382
|
+
field: S,
|
|
1334
1383
|
value: D,
|
|
1335
1384
|
hideUnavailableItems: A,
|
|
1336
1385
|
showInvisibleItems: U
|
|
1337
1386
|
}) => {
|
|
1338
|
-
const
|
|
1387
|
+
const b = G({
|
|
1339
1388
|
endpoint: "products",
|
|
1340
1389
|
segment: l,
|
|
1341
1390
|
defaults: p(),
|
|
1342
1391
|
args: {
|
|
1343
|
-
field:
|
|
1392
|
+
field: S,
|
|
1344
1393
|
value: D,
|
|
1345
1394
|
hideUnavailableItems: A,
|
|
1346
1395
|
showInvisibleItems: U
|
|
1347
1396
|
}
|
|
1348
1397
|
});
|
|
1349
1398
|
return I(
|
|
1350
|
-
`${s}/api/intelligent-search/v1/products?${
|
|
1351
|
-
{ headers:
|
|
1399
|
+
`${s}/api/intelligent-search/v1/products?${b.params.toString()}`,
|
|
1400
|
+
{ headers: v }
|
|
1352
1401
|
);
|
|
1353
1402
|
};
|
|
1354
1403
|
return {
|
|
1355
|
-
facets: (
|
|
1404
|
+
facets: (S) => d({ ...S, type: "facets" }),
|
|
1356
1405
|
products: g,
|
|
1357
1406
|
fetchProduct: m,
|
|
1358
1407
|
productsByIdentifier: async ({
|
|
1359
|
-
field:
|
|
1408
|
+
field: S,
|
|
1360
1409
|
values: D,
|
|
1361
1410
|
showInvisibleItems: A,
|
|
1362
1411
|
hideUnavailableItems: U
|
|
1363
1412
|
}) => {
|
|
1364
|
-
const
|
|
1413
|
+
const b = Ae(Lt);
|
|
1365
1414
|
return (await Promise.all(
|
|
1366
1415
|
D.map(
|
|
1367
|
-
(_) =>
|
|
1416
|
+
(_) => b(async () => {
|
|
1368
1417
|
try {
|
|
1369
1418
|
return await m({
|
|
1370
|
-
field:
|
|
1419
|
+
field: S,
|
|
1371
1420
|
value: _,
|
|
1372
1421
|
hideUnavailableItems: U,
|
|
1373
1422
|
showInvisibleItems: A
|
|
@@ -1381,85 +1430,101 @@ const Ut = ({
|
|
|
1381
1430
|
(_) => _ !== null
|
|
1382
1431
|
);
|
|
1383
1432
|
},
|
|
1384
|
-
suggestedTerms: (
|
|
1385
|
-
const D =
|
|
1433
|
+
suggestedTerms: (S) => {
|
|
1434
|
+
const D = G({
|
|
1386
1435
|
endpoint: "search-suggestions",
|
|
1387
1436
|
segment: l,
|
|
1388
1437
|
defaults: p(),
|
|
1389
|
-
args: { query:
|
|
1438
|
+
args: { query: S.query }
|
|
1390
1439
|
});
|
|
1391
1440
|
return I(
|
|
1392
1441
|
`${s}/api/intelligent-search/v1/search-suggestions?${D.params.toString()}`,
|
|
1393
|
-
{ headers:
|
|
1442
|
+
{ headers: v }
|
|
1394
1443
|
);
|
|
1395
1444
|
},
|
|
1396
1445
|
topSearches: () => {
|
|
1397
|
-
const
|
|
1446
|
+
const S = G({
|
|
1398
1447
|
endpoint: "top-searches",
|
|
1399
1448
|
segment: l,
|
|
1400
1449
|
defaults: p()
|
|
1401
1450
|
});
|
|
1402
1451
|
return I(
|
|
1403
|
-
`${s}/api/intelligent-search/v1/top-searches?${
|
|
1404
|
-
{ headers:
|
|
1452
|
+
`${s}/api/intelligent-search/v1/top-searches?${S.params.toString()}`,
|
|
1453
|
+
{ headers: v }
|
|
1405
1454
|
);
|
|
1406
1455
|
},
|
|
1407
|
-
productCount: (
|
|
1408
|
-
const D =
|
|
1456
|
+
productCount: (S) => {
|
|
1457
|
+
const D = G({
|
|
1409
1458
|
endpoint: "catalog-count",
|
|
1410
1459
|
segment: l,
|
|
1411
1460
|
defaults: p(),
|
|
1412
|
-
args:
|
|
1461
|
+
args: S
|
|
1413
1462
|
});
|
|
1414
1463
|
return I(
|
|
1415
1464
|
`${s}/api/intelligent-search/v1/catalog-count/${D.path}?${D.params.toString()}`,
|
|
1416
|
-
{ headers:
|
|
1465
|
+
{ headers: v }
|
|
1417
1466
|
);
|
|
1418
1467
|
}
|
|
1419
1468
|
};
|
|
1420
|
-
},
|
|
1421
|
-
const t =
|
|
1469
|
+
}, zt = (e, n) => {
|
|
1470
|
+
const t = Mt(e, n), r = pt(e, n), i = et(e);
|
|
1422
1471
|
return {
|
|
1423
1472
|
search: t,
|
|
1424
|
-
commerce: r
|
|
1473
|
+
commerce: r,
|
|
1474
|
+
catalog: i
|
|
1425
1475
|
};
|
|
1426
|
-
},
|
|
1427
|
-
|
|
1428
|
-
"category",
|
|
1429
|
-
"department",
|
|
1430
|
-
"subcategory",
|
|
1431
|
-
"collection",
|
|
1432
|
-
"cluster"
|
|
1433
|
-
]), x = (e) => typeof e.pageType == "string" && Tt.has(e.pageType.toLowerCase()), Rt = (e, n) => {
|
|
1434
|
-
const t = Ie(_t), r = async (i) => Promise.all(
|
|
1476
|
+
}, Vt = 20, xt = (e) => e.entityType === "category", ye = (e) => e.entityType === "brand", Ne = (e) => e.entityType === "collection", qt = (e, n) => {
|
|
1477
|
+
const t = Ae(Vt), r = async (i) => Promise.all(
|
|
1435
1478
|
i.map(
|
|
1436
1479
|
(a) => t(async () => {
|
|
1437
|
-
const o = await n.commerce.catalog.
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1480
|
+
const o = a.slug.toLowerCase(), s = a.locale, c = await n.commerce.catalog.byLinkId.category(
|
|
1481
|
+
o,
|
|
1482
|
+
s
|
|
1483
|
+
);
|
|
1484
|
+
if (c)
|
|
1485
|
+
return {
|
|
1486
|
+
...c,
|
|
1487
|
+
entityType: "category",
|
|
1488
|
+
slug: o
|
|
1489
|
+
};
|
|
1490
|
+
const l = await n.commerce.catalog.byLinkId.brand(
|
|
1491
|
+
o,
|
|
1492
|
+
s
|
|
1493
|
+
);
|
|
1494
|
+
if (l)
|
|
1495
|
+
return { ...l, entityType: "brand" };
|
|
1496
|
+
const p = await n.commerce.catalog.byLinkId.collection(
|
|
1497
|
+
o,
|
|
1498
|
+
s
|
|
1499
|
+
);
|
|
1500
|
+
if (p)
|
|
1501
|
+
return { ...p, entityType: "collection" };
|
|
1502
|
+
throw new $(
|
|
1503
|
+
`No catalog entity found for slug: ${a.slug}. Cascade exhausted (category → brand → collection).`
|
|
1442
1504
|
);
|
|
1443
1505
|
})
|
|
1444
1506
|
)
|
|
1445
1507
|
);
|
|
1446
|
-
return new
|
|
1447
|
-
// DataLoader is
|
|
1448
|
-
batch: !1
|
|
1508
|
+
return new le(r, {
|
|
1509
|
+
// DataLoader is used for caching, not batching
|
|
1510
|
+
batch: !1,
|
|
1511
|
+
// Dedup by lowercased slug + captured locale so casing variants share an
|
|
1512
|
+
// entry while same-slug / different-locale loads stay isolated.
|
|
1513
|
+
cacheKeyFn: ({ slug: i, locale: a }) => `${i.toLowerCase()}::${a ?? ""}`
|
|
1449
1514
|
});
|
|
1450
|
-
},
|
|
1515
|
+
}, jt = (e, n) => {
|
|
1451
1516
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1452
|
-
return new
|
|
1453
|
-
},
|
|
1454
|
-
const t =
|
|
1517
|
+
return new le(t);
|
|
1518
|
+
}, Wt = 1, Gt = (e, n) => {
|
|
1519
|
+
const t = Ae(Wt), r = async (a) => {
|
|
1455
1520
|
const o = a.reduce((u, { items: h }) => [...u, h], []), s = [...o.flat()], c = await n.commerce.checkout.simulation({
|
|
1456
1521
|
country: a[0].country,
|
|
1457
1522
|
postalCode: a[0].postalCode,
|
|
1458
1523
|
items: s
|
|
1459
1524
|
}), l = c.items.reduce(
|
|
1460
1525
|
(u, h) => {
|
|
1461
|
-
const
|
|
1462
|
-
return typeof
|
|
1526
|
+
const f = h.requestIndex;
|
|
1527
|
+
return typeof f == "number" && f < u.length && (u[f] = h), u;
|
|
1463
1528
|
},
|
|
1464
1529
|
Array(s.length).fill(null)
|
|
1465
1530
|
), p = o.reduce(
|
|
@@ -1468,23 +1533,23 @@ const Ut = ({
|
|
|
1468
1533
|
);
|
|
1469
1534
|
return o.map((u, h) => ({
|
|
1470
1535
|
...c,
|
|
1471
|
-
items: l.slice(p[h], p[h + 1]).filter((
|
|
1536
|
+
items: l.slice(p[h], p[h + 1]).filter((f) => !!f)
|
|
1472
1537
|
}));
|
|
1473
1538
|
}, i = async (a) => t(r, a);
|
|
1474
|
-
return new
|
|
1539
|
+
return new le(i, {
|
|
1475
1540
|
maxBatchSize: 50
|
|
1476
1541
|
});
|
|
1477
|
-
},
|
|
1478
|
-
function
|
|
1542
|
+
}, Ht = (e, n) => Nn(e, n);
|
|
1543
|
+
function Xt(e) {
|
|
1479
1544
|
return {
|
|
1480
1545
|
...e,
|
|
1481
|
-
description: e.description ?
|
|
1546
|
+
description: e.description ? Ht(e.description) : e.description
|
|
1482
1547
|
};
|
|
1483
1548
|
}
|
|
1484
1549
|
const N = (e, n) => ({
|
|
1485
1550
|
...e,
|
|
1486
|
-
isVariantOf:
|
|
1487
|
-
}),
|
|
1551
|
+
isVariantOf: Xt(n)
|
|
1552
|
+
}), Yt = ({ flags: e }, n) => {
|
|
1488
1553
|
const t = async (r) => {
|
|
1489
1554
|
const i = r.map((p) => p.split("-")[0]), a = r.some(
|
|
1490
1555
|
(p) => p.split("-")[1] === "invisibleItems"
|
|
@@ -1504,36 +1569,36 @@ const N = (e, n) => ({
|
|
|
1504
1569
|
{}
|
|
1505
1570
|
), c = i.map((p) => s[p]), l = i.filter((p) => !s[p]);
|
|
1506
1571
|
if (l.length > 0)
|
|
1507
|
-
throw new
|
|
1572
|
+
throw new $(
|
|
1508
1573
|
`Search API did not found the following skus: ${l.join(",")}`
|
|
1509
1574
|
);
|
|
1510
1575
|
return c;
|
|
1511
1576
|
};
|
|
1512
|
-
return new
|
|
1577
|
+
return new le(t, {
|
|
1513
1578
|
maxBatchSize: 99
|
|
1514
1579
|
// Max allowed batch size of Search API
|
|
1515
1580
|
});
|
|
1516
|
-
},
|
|
1517
|
-
const t =
|
|
1581
|
+
}, Jt = (e, n) => {
|
|
1582
|
+
const { clients: t } = n, r = Yt(e, t), i = Gt(e, t), a = qt(e, t), o = jt(e, t);
|
|
1518
1583
|
return {
|
|
1519
|
-
skuLoader:
|
|
1520
|
-
simulationLoader:
|
|
1521
|
-
collectionLoader:
|
|
1522
|
-
salesChannelLoader:
|
|
1584
|
+
skuLoader: r,
|
|
1585
|
+
simulationLoader: i,
|
|
1586
|
+
collectionLoader: a,
|
|
1587
|
+
salesChannelLoader: o
|
|
1523
1588
|
};
|
|
1524
|
-
},
|
|
1589
|
+
}, B = (e) => e.AvailableQuantity > 0, V = (e) => e.spotPrice ?? 0, Kt = (e) => e.Price ?? 0, Le = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", ln = (e, n) => B(e) && !B(n) ? -1 : !B(e) && B(n) ? 1 : V(e) - V(n), Qt = (e) => e === "available", M = (e, n = 0, t = 1) => {
|
|
1525
1590
|
const r = n / t;
|
|
1526
1591
|
return Math.round((e + r) * 100) / 100;
|
|
1527
|
-
},
|
|
1528
|
-
const t = e.filter(
|
|
1529
|
-
return n.includeTaxes ?
|
|
1530
|
-
},
|
|
1531
|
-
const [t] = e.filter(
|
|
1532
|
-
return n.includeTaxes ?
|
|
1533
|
-
},
|
|
1534
|
-
highPrice: (e) =>
|
|
1535
|
-
lowPrice: (e) =>
|
|
1536
|
-
lowPriceWithTaxes: (e) =>
|
|
1592
|
+
}, Zt = (e, n = { includeTaxes: !1 }) => {
|
|
1593
|
+
const t = e.filter(B), r = t[t.length - 1], i = r ? V(r) : 0;
|
|
1594
|
+
return n.includeTaxes ? M(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1595
|
+
}, Be = (e, n = { includeTaxes: !1 }) => {
|
|
1596
|
+
const [t] = e.filter(B), r = t ? V(t) : 0;
|
|
1597
|
+
return n.includeTaxes ? M(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1598
|
+
}, er = {
|
|
1599
|
+
highPrice: (e) => Zt(e),
|
|
1600
|
+
lowPrice: (e) => Be(e),
|
|
1601
|
+
lowPriceWithTaxes: (e) => Be(e, { includeTaxes: !0 }),
|
|
1537
1602
|
offerCount: (e) => e.length,
|
|
1538
1603
|
priceCurrency: async (e, n, t) => {
|
|
1539
1604
|
const {
|
|
@@ -1543,73 +1608,113 @@ const N = (e, n) => ({
|
|
|
1543
1608
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1544
1609
|
},
|
|
1545
1610
|
offers: (e) => e
|
|
1546
|
-
},
|
|
1611
|
+
}, nr = {
|
|
1547
1612
|
ratingValue: () => 5,
|
|
1548
1613
|
reviewCount: () => 0
|
|
1549
|
-
},
|
|
1614
|
+
}, $e = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", tr = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", rr = (e) => {
|
|
1550
1615
|
let n = e.slice(0);
|
|
1551
|
-
for (let t = 0; t <
|
|
1552
|
-
n = n.replace(new RegExp(
|
|
1616
|
+
for (let t = 0; t < $e.length; t++)
|
|
1617
|
+
n = n.replace(new RegExp($e.charAt(t), "g"), tr.charAt(t));
|
|
1553
1618
|
return n;
|
|
1554
|
-
},
|
|
1555
|
-
function
|
|
1619
|
+
}, ir = (e) => e.replace(/[·/_,:]/, "-");
|
|
1620
|
+
function ae(e) {
|
|
1556
1621
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1557
|
-
return
|
|
1622
|
+
return ir(rr(t)).toLowerCase();
|
|
1558
1623
|
}
|
|
1559
|
-
const
|
|
1624
|
+
const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), dn = {
|
|
1560
1625
|
id: ({ id: e }) => e.toString(),
|
|
1561
|
-
slug: (e) =>
|
|
1562
|
-
seo: (e) =>
|
|
1626
|
+
slug: (e) => H(e),
|
|
1627
|
+
seo: (e) => ({
|
|
1563
1628
|
title: e.title ?? e.name,
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
description: e.
|
|
1568
|
-
},
|
|
1569
|
-
type: (e) =>
|
|
1570
|
-
meta: (e) => {
|
|
1571
|
-
const
|
|
1572
|
-
|
|
1573
|
-
selectedFacets: [{ key: "brand", value:
|
|
1574
|
-
|
|
1575
|
-
selectedFacets: [{ key: "productclusterids", value: e.id }]
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1629
|
+
// pagetype.metaTagDescription and catalog `description` share the same
|
|
1630
|
+
// source (confirmed with Catalog). Prefer metaTagDescription when present
|
|
1631
|
+
// for forward-compat; fall back to description for by-linkid parity.
|
|
1632
|
+
description: e.metaTagDescription ?? e.description
|
|
1633
|
+
}),
|
|
1634
|
+
type: (e) => ye(e) ? "Brand" : Ne(e) ? "Collection" : e.fatherCategoryId === null ? "Department" : "Category",
|
|
1635
|
+
meta: async (e, n, t) => {
|
|
1636
|
+
const r = H(e);
|
|
1637
|
+
if (ye(e))
|
|
1638
|
+
return { selectedFacets: [{ key: "brand", value: r }] };
|
|
1639
|
+
if (Ne(e))
|
|
1640
|
+
return { selectedFacets: [{ key: "productclusterids", value: e.id }] };
|
|
1641
|
+
const { defaultLocale: i } = K(t), a = r.split("/").filter(Boolean), o = a.map(
|
|
1642
|
+
(l, p) => a.slice(0, p + 1).join("/")
|
|
1643
|
+
), {
|
|
1644
|
+
loaders: { collectionLoader: s }
|
|
1645
|
+
} = t;
|
|
1646
|
+
return {
|
|
1647
|
+
selectedFacets: (await Promise.all(
|
|
1648
|
+
o.map(
|
|
1649
|
+
(l) => s.load({ slug: l, locale: re(t) })
|
|
1650
|
+
)
|
|
1651
|
+
)).map((l, p) => ({
|
|
1652
|
+
key: `category-${p + 1}`,
|
|
1653
|
+
value: i && l.availableLinkIds?.[i] || l.linkId
|
|
1580
1654
|
}))
|
|
1581
1655
|
};
|
|
1582
1656
|
},
|
|
1583
1657
|
breadcrumbList: async (e, n, t) => {
|
|
1584
1658
|
const {
|
|
1585
1659
|
loaders: { collectionLoader: r }
|
|
1586
|
-
} = t, a =
|
|
1660
|
+
} = t, a = H(e).split("/").filter(Boolean), o = a.map(
|
|
1587
1661
|
(c, l) => a.slice(0, l + 1).join("/")
|
|
1588
1662
|
), s = await Promise.all(
|
|
1589
|
-
o.map(
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
})
|
|
1663
|
+
o.map(
|
|
1664
|
+
(c) => r.load({ slug: c, locale: re(t) })
|
|
1665
|
+
)
|
|
1593
1666
|
);
|
|
1594
1667
|
return {
|
|
1595
1668
|
itemListElement: s.map((c, l) => ({
|
|
1596
|
-
item:
|
|
1597
|
-
`https://${c.url}`
|
|
1598
|
-
).pathname.toLowerCase(),
|
|
1669
|
+
item: `/${H(c)}`,
|
|
1599
1670
|
name: c.name,
|
|
1600
1671
|
position: l + 1
|
|
1601
1672
|
})),
|
|
1602
1673
|
numberOfItems: s.length
|
|
1603
1674
|
};
|
|
1675
|
+
},
|
|
1676
|
+
otherLocales: async (e, n, t) => {
|
|
1677
|
+
const r = K(t);
|
|
1678
|
+
if (!r.enabled) return null;
|
|
1679
|
+
const i = Object.keys(r.locales ?? {});
|
|
1680
|
+
if (i.length === 0) return null;
|
|
1681
|
+
const a = t.storage.locale, o = H(e), s = o.split("/").filter(Boolean);
|
|
1682
|
+
if (s.length === 0) return null;
|
|
1683
|
+
const {
|
|
1684
|
+
loaders: { collectionLoader: c }
|
|
1685
|
+
} = t, l = s.map(
|
|
1686
|
+
(u, h) => s.slice(0, h + 1).join("/")
|
|
1687
|
+
);
|
|
1688
|
+
let p;
|
|
1689
|
+
try {
|
|
1690
|
+
p = await Promise.all(
|
|
1691
|
+
l.map(
|
|
1692
|
+
(u) => c.load({ slug: u, locale: re(t) })
|
|
1693
|
+
)
|
|
1694
|
+
);
|
|
1695
|
+
} catch (u) {
|
|
1696
|
+
return console.warn("[otherLocales] failed to load collection entities:", u), null;
|
|
1697
|
+
}
|
|
1698
|
+
return i.map((u) => {
|
|
1699
|
+
if (u === a)
|
|
1700
|
+
return { locale: u, slug: o };
|
|
1701
|
+
const h = [];
|
|
1702
|
+
for (const f of p) {
|
|
1703
|
+
const v = f.availableLinkIds?.[u];
|
|
1704
|
+
if (!v) return null;
|
|
1705
|
+
h.push(v);
|
|
1706
|
+
}
|
|
1707
|
+
return h.length > 0 ? { locale: u, slug: h.join("/") } : null;
|
|
1708
|
+
}).filter((u) => u !== null);
|
|
1604
1709
|
}
|
|
1605
|
-
},
|
|
1710
|
+
}, un = {
|
|
1606
1711
|
buy: "whoboughtalsobought",
|
|
1607
1712
|
view: "whosawalsosaw",
|
|
1608
1713
|
similars: "similars",
|
|
1609
1714
|
viewAndBought: "whosawalsobought",
|
|
1610
1715
|
accessories: "accessories",
|
|
1611
1716
|
suggestions: "suggestions"
|
|
1612
|
-
},
|
|
1717
|
+
}, Me = ({ key: e, value: n }) => {
|
|
1613
1718
|
switch (e) {
|
|
1614
1719
|
case "price":
|
|
1615
1720
|
return { key: e, value: n.replace("-to-", ":") };
|
|
@@ -1625,61 +1730,61 @@ const ee = (e) => e.type === "brand" || x(e) && e.pageType.toLowerCase() === "br
|
|
|
1625
1730
|
default:
|
|
1626
1731
|
return { key: e, value: n };
|
|
1627
1732
|
}
|
|
1628
|
-
},
|
|
1733
|
+
}, ze = (e) => {
|
|
1629
1734
|
const n = e.split(":").map(Number);
|
|
1630
1735
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1631
|
-
},
|
|
1736
|
+
}, ar = (e) => typeof un[e] == "string", or = (e) => {
|
|
1632
1737
|
const n = e?.filter(
|
|
1633
|
-
(t) =>
|
|
1738
|
+
(t) => ar(t.key)
|
|
1634
1739
|
);
|
|
1635
1740
|
if (Array.isArray(n) && n.length > 1)
|
|
1636
1741
|
throw new T(
|
|
1637
1742
|
`You passed ${n.length} cross selling facets but only one is allowed. Please leave one of the following facet: ${n.map((t) => t.key).join(",")}`
|
|
1638
1743
|
);
|
|
1639
1744
|
return n?.[0] ?? null;
|
|
1640
|
-
},
|
|
1745
|
+
}, sr = (e) => e?.find((n) => n.key === "slug")?.value ?? null, cr = (e) => e?.find((n) => n.key === "id")?.value ?? null, Ve = (e) => e?.find((n) => n.key === "locale")?.value ?? null, xe = (e) => e?.find((n) => n.key === "channel")?.value ?? null, Ie = (e, n) => {
|
|
1641
1746
|
let t = 0;
|
|
1642
1747
|
for (let r = 1; r < e.length; r++)
|
|
1643
1748
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1644
1749
|
return e[t];
|
|
1645
|
-
},
|
|
1750
|
+
}, lr = {
|
|
1646
1751
|
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1647
|
-
},
|
|
1752
|
+
}, dr = {
|
|
1648
1753
|
key: ({ key: e }) => e,
|
|
1649
1754
|
label: ({ name: e }) => e,
|
|
1650
1755
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1651
|
-
},
|
|
1756
|
+
}, ur = {
|
|
1652
1757
|
key: ({ key: e }) => e,
|
|
1653
1758
|
label: ({ name: e }) => e,
|
|
1654
1759
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1655
|
-
const i =
|
|
1760
|
+
const i = ze(
|
|
1656
1761
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1657
|
-
), o =
|
|
1762
|
+
), o = Ie(e, (s, c) => s.range.from - c.range.from)?.range?.from ?? 0;
|
|
1658
1763
|
return {
|
|
1659
1764
|
selected: i?.[0] ?? o,
|
|
1660
1765
|
absolute: o
|
|
1661
1766
|
};
|
|
1662
1767
|
},
|
|
1663
1768
|
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1664
|
-
const i =
|
|
1769
|
+
const i = ze(
|
|
1665
1770
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1666
|
-
), o =
|
|
1771
|
+
), o = Ie(e, (s, c) => c.range.to - s.range.to)?.range?.to ?? 0;
|
|
1667
1772
|
return {
|
|
1668
1773
|
selected: i?.[1] ?? o,
|
|
1669
1774
|
absolute: o
|
|
1670
1775
|
};
|
|
1671
1776
|
}
|
|
1672
|
-
},
|
|
1777
|
+
}, pr = {
|
|
1673
1778
|
value: ({ value: e }) => e,
|
|
1674
1779
|
label: ({ name: e }) => e || "unknown",
|
|
1675
1780
|
selected: ({ selected: e }) => e,
|
|
1676
1781
|
quantity: ({ quantity: e }) => e
|
|
1677
|
-
},
|
|
1782
|
+
}, gr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1678
1783
|
if (!n?.orderId)
|
|
1679
1784
|
throw new T("Missing orderId");
|
|
1680
1785
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1681
1786
|
};
|
|
1682
|
-
function
|
|
1787
|
+
function pn(e) {
|
|
1683
1788
|
if (!e || e.status !== "pending")
|
|
1684
1789
|
return null;
|
|
1685
1790
|
for (const n of e.dimensionStatus) {
|
|
@@ -1697,18 +1802,18 @@ function an(e) {
|
|
|
1697
1802
|
}
|
|
1698
1803
|
return null;
|
|
1699
1804
|
}
|
|
1700
|
-
function
|
|
1805
|
+
function mr(e) {
|
|
1701
1806
|
if (!e || e.status !== "pending") return !1;
|
|
1702
1807
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1703
1808
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1704
1809
|
}
|
|
1705
|
-
const
|
|
1706
|
-
const r = await t.oms.processOrderAuthorization(n), i =
|
|
1810
|
+
const hr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1811
|
+
const r = await t.oms.processOrderAuthorization(n), i = pn(r);
|
|
1707
1812
|
return {
|
|
1708
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1813
|
+
isPendingForOtherAuthorizer: !i && mr(r),
|
|
1709
1814
|
ruleForAuthorization: i
|
|
1710
1815
|
};
|
|
1711
|
-
},
|
|
1816
|
+
}, fr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1712
1817
|
if (!n?.objectKey)
|
|
1713
1818
|
throw new T("Missing objectKey");
|
|
1714
1819
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
@@ -1717,13 +1822,13 @@ const ir = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
|
1717
1822
|
orderFormId: r,
|
|
1718
1823
|
sessionToken: n.sessionToken ?? void 0
|
|
1719
1824
|
});
|
|
1720
|
-
},
|
|
1825
|
+
}, Sr = async (e, n, t) => {
|
|
1721
1826
|
if (!(await t.clients.commerce.recommendation.startRecommendationSession())?.recommendationsUserId)
|
|
1722
1827
|
throw new Error(
|
|
1723
1828
|
"Failed to start recommendation session: no session data returned"
|
|
1724
1829
|
);
|
|
1725
1830
|
return !0;
|
|
1726
|
-
},
|
|
1831
|
+
}, yr = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), Ir = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1727
1832
|
const { fileContent: r, fileName: i, mimeType: a } = n;
|
|
1728
1833
|
if (!r || !i || !a)
|
|
1729
1834
|
throw new T(
|
|
@@ -1743,7 +1848,7 @@ const ir = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
|
1743
1848
|
mimeType: a
|
|
1744
1849
|
});
|
|
1745
1850
|
};
|
|
1746
|
-
class
|
|
1851
|
+
class oe {
|
|
1747
1852
|
static parse(n) {
|
|
1748
1853
|
try {
|
|
1749
1854
|
const t = JSON.parse(n);
|
|
@@ -1761,39 +1866,39 @@ class ne {
|
|
|
1761
1866
|
return JSON.stringify(n);
|
|
1762
1867
|
}
|
|
1763
1868
|
}
|
|
1764
|
-
const
|
|
1765
|
-
e.storage.channel =
|
|
1766
|
-
},
|
|
1869
|
+
const ve = (e, n) => {
|
|
1870
|
+
e.storage.channel = oe.parse(n);
|
|
1871
|
+
}, Oe = (e, n) => {
|
|
1767
1872
|
e.storage.locale = n;
|
|
1768
|
-
},
|
|
1873
|
+
}, gn = (e) => Ln.createHash("md5").update(e).digest("hex"), ne = {
|
|
1769
1874
|
attachment: "ATTACHMENT",
|
|
1770
1875
|
specification: "SPECIFICATION",
|
|
1771
1876
|
attribute: "ATTRIBUTE"
|
|
1772
1877
|
};
|
|
1773
|
-
function
|
|
1878
|
+
function mn(e) {
|
|
1774
1879
|
return {
|
|
1775
1880
|
name: e.name,
|
|
1776
1881
|
value: e.content,
|
|
1777
|
-
valueReference:
|
|
1882
|
+
valueReference: ne.attachment
|
|
1778
1883
|
};
|
|
1779
1884
|
}
|
|
1780
|
-
function
|
|
1885
|
+
function vr(e) {
|
|
1781
1886
|
return {
|
|
1782
1887
|
propertyID: e.id,
|
|
1783
1888
|
name: e.name,
|
|
1784
1889
|
value: e.value,
|
|
1785
1890
|
valueReference: {
|
|
1786
|
-
valueReference:
|
|
1891
|
+
valueReference: ne.attribute,
|
|
1787
1892
|
visible: e.visible
|
|
1788
1893
|
}
|
|
1789
1894
|
};
|
|
1790
1895
|
}
|
|
1791
|
-
function
|
|
1792
|
-
return
|
|
1896
|
+
function hn(e) {
|
|
1897
|
+
return gn(
|
|
1793
1898
|
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
1794
1899
|
);
|
|
1795
1900
|
}
|
|
1796
|
-
const
|
|
1901
|
+
const Or = (e) => {
|
|
1797
1902
|
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
1798
1903
|
addressType: e.addressType || null,
|
|
1799
1904
|
postalCode: n || null,
|
|
@@ -1812,7 +1917,7 @@ const dr = (e) => {
|
|
|
1812
1917
|
r.geoCoordinates = i !== null && a !== null ? [a, i] : [];
|
|
1813
1918
|
}
|
|
1814
1919
|
return [r];
|
|
1815
|
-
},
|
|
1920
|
+
}, Cr = (e, n, t) => {
|
|
1816
1921
|
const r = n.postalCode, i = n.geoCoordinates, a = e?.shippingData?.availableAddresses ?? [], o = e?.shippingData?.selectedAddresses ?? [];
|
|
1817
1922
|
if (!t && o.length > 0)
|
|
1818
1923
|
return [o[0]];
|
|
@@ -1826,17 +1931,17 @@ const dr = (e) => {
|
|
|
1826
1931
|
return [s];
|
|
1827
1932
|
}
|
|
1828
1933
|
return null;
|
|
1829
|
-
},
|
|
1830
|
-
if (!
|
|
1934
|
+
}, fn = (e, n) => {
|
|
1935
|
+
if (!br(n))
|
|
1831
1936
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1832
|
-
if (!
|
|
1937
|
+
if (!Pr(e))
|
|
1833
1938
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1834
1939
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
1835
|
-
if (
|
|
1940
|
+
if (wr(t, n.postalCode) || Dr(t, n.geoCoordinates) || Ar(t, n.addressType))
|
|
1836
1941
|
return { updateShipping: !0, addressChanged: !0 };
|
|
1837
1942
|
const { logisticsInfo: r } = e.shippingData;
|
|
1838
|
-
return
|
|
1839
|
-
},
|
|
1943
|
+
return Ur(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
1944
|
+
}, br = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, wr = (e, n) => typeof n == "string" && e?.postalCode !== n, Dr = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), Ar = (e, n) => typeof n == "string" && e?.addressType !== n, Pr = (e) => e.items.length !== 0, Ur = (e, n) => {
|
|
1840
1945
|
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
|
|
1841
1946
|
return e.some(
|
|
1842
1947
|
({ selectedDeliveryChannel: o, selectedSla: s, slas: c }) => {
|
|
@@ -1846,12 +1951,12 @@ const dr = (e) => {
|
|
|
1846
1951
|
));
|
|
1847
1952
|
}
|
|
1848
1953
|
);
|
|
1849
|
-
},
|
|
1954
|
+
}, Sn = (e) => e.valueReference === ne.attachment, Ce = (e) => [
|
|
1850
1955
|
e.itemOffered.sku,
|
|
1851
1956
|
e.seller.identifier,
|
|
1852
1957
|
e.price < 0.01 ? "Gift" : void 0,
|
|
1853
|
-
e.itemOffered.additionalProperty?.filter(
|
|
1854
|
-
].filter(Boolean).join("::"),
|
|
1958
|
+
e.itemOffered.additionalProperty?.filter(Sn).map(hn).join("-")
|
|
1959
|
+
].filter(Boolean).join("::"), se = (e, n) => ({
|
|
1855
1960
|
listPrice: e.listPrice / 100,
|
|
1856
1961
|
price: e.sellingPrice / 100,
|
|
1857
1962
|
quantity: e.quantity,
|
|
@@ -1860,45 +1965,45 @@ const dr = (e) => {
|
|
|
1860
1965
|
sku: e.id,
|
|
1861
1966
|
image: [],
|
|
1862
1967
|
name: e.name,
|
|
1863
|
-
additionalProperty: e.attachments.map(
|
|
1968
|
+
additionalProperty: e.attachments.map(mn)
|
|
1864
1969
|
},
|
|
1865
1970
|
index: n
|
|
1866
|
-
}),
|
|
1971
|
+
}), kr = (e) => ({
|
|
1867
1972
|
quantity: e.quantity,
|
|
1868
1973
|
seller: e.seller.identifier,
|
|
1869
1974
|
id: e.itemOffered.sku,
|
|
1870
1975
|
index: e.index,
|
|
1871
|
-
attachments: (e.itemOffered.additionalProperty?.filter(
|
|
1976
|
+
attachments: (e.itemOffered.additionalProperty?.filter(Sn) ?? []).map((n) => ({
|
|
1872
1977
|
name: n.name,
|
|
1873
1978
|
content: n.value
|
|
1874
1979
|
}))
|
|
1875
|
-
}),
|
|
1876
|
-
const r =
|
|
1980
|
+
}), qe = (e) => e.reduce((n, t) => {
|
|
1981
|
+
const r = Ce(t);
|
|
1877
1982
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
1878
|
-
}, /* @__PURE__ */ new Map()),
|
|
1983
|
+
}, /* @__PURE__ */ new Map()), _r = (e, n) => {
|
|
1879
1984
|
const t = (s, c) => ({
|
|
1880
1985
|
...s,
|
|
1881
1986
|
itemOffered: {
|
|
1882
1987
|
sku: s.itemOffered.sku
|
|
1883
1988
|
},
|
|
1884
1989
|
index: c
|
|
1885
|
-
}), r = n.items.map(
|
|
1990
|
+
}), r = n.items.map(se).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = Pe(r, i);
|
|
1886
1991
|
return a && o;
|
|
1887
1992
|
};
|
|
1888
|
-
function
|
|
1993
|
+
function yn(e, n) {
|
|
1889
1994
|
return e?.some(
|
|
1890
1995
|
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 && e[t.parentItemIndex]?.id === n
|
|
1891
1996
|
);
|
|
1892
1997
|
}
|
|
1893
|
-
function
|
|
1998
|
+
function In(e, n) {
|
|
1894
1999
|
return e?.some(
|
|
1895
2000
|
(t) => t.id === n && t.parentItemIndex !== null
|
|
1896
2001
|
);
|
|
1897
2002
|
}
|
|
1898
|
-
const
|
|
2003
|
+
const je = (e) => {
|
|
1899
2004
|
const n = e.items.reduce(
|
|
1900
2005
|
(t, r, i) => {
|
|
1901
|
-
const a =
|
|
2006
|
+
const a = In(e.items, r.id) || yn(e.items, r.id) ? `${Ce(se(r))}::${i}` : Ce(se(r));
|
|
1902
2007
|
return t[a] || (t[a] = []), t[a].push(r), t;
|
|
1903
2008
|
},
|
|
1904
2009
|
{}
|
|
@@ -1917,7 +2022,7 @@ const Be = (e) => {
|
|
|
1917
2022
|
};
|
|
1918
2023
|
})
|
|
1919
2024
|
};
|
|
1920
|
-
},
|
|
2025
|
+
}, We = async (e, n, t) => ({
|
|
1921
2026
|
order: {
|
|
1922
2027
|
orderNumber: e.orderFormId,
|
|
1923
2028
|
acceptedOffer: e.items.map(async (r) => ({
|
|
@@ -1930,7 +2035,7 @@ const Be = (e) => {
|
|
|
1930
2035
|
text: r,
|
|
1931
2036
|
status: i.toUpperCase()
|
|
1932
2037
|
}))
|
|
1933
|
-
}),
|
|
2038
|
+
}), vn = ({ items: e }, n) => {
|
|
1934
2039
|
const t = e.map((r) => ({
|
|
1935
2040
|
id: r.id,
|
|
1936
2041
|
quantity: r.quantity,
|
|
@@ -1938,16 +2043,16 @@ const Be = (e) => {
|
|
|
1938
2043
|
attachments: r.attachments
|
|
1939
2044
|
// customizations
|
|
1940
2045
|
}));
|
|
1941
|
-
return
|
|
2046
|
+
return gn(
|
|
1942
2047
|
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
1943
2048
|
);
|
|
1944
|
-
},
|
|
2049
|
+
}, Ge = async (e, n, t) => {
|
|
1945
2050
|
try {
|
|
1946
2051
|
return await n.checkout.setCustomData({
|
|
1947
2052
|
id: e.orderFormId,
|
|
1948
2053
|
appId: "faststore",
|
|
1949
2054
|
key: "cartEtag",
|
|
1950
|
-
value:
|
|
2055
|
+
value: vn(e, t)
|
|
1951
2056
|
});
|
|
1952
2057
|
} catch (r) {
|
|
1953
2058
|
throw console.error(
|
|
@@ -1957,22 +2062,22 @@ const Be = (e) => {
|
|
|
1957
2062
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
1958
2063
|
), r;
|
|
1959
2064
|
}
|
|
1960
|
-
},
|
|
2065
|
+
}, Tr = (e, n) => {
|
|
1961
2066
|
const r = e.customData?.customApps.find(
|
|
1962
2067
|
(a) => a.id === "faststore"
|
|
1963
2068
|
)?.fields?.cartEtag;
|
|
1964
|
-
return r == null ? !0 :
|
|
1965
|
-
},
|
|
2069
|
+
return r == null ? !0 : vn(e, n) !== r;
|
|
2070
|
+
}, Er = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
1966
2071
|
id: e
|
|
1967
|
-
}),
|
|
2072
|
+
}), He = async (e, n, { clients: { commerce: t } }) => {
|
|
1968
2073
|
if (!n)
|
|
1969
2074
|
return e;
|
|
1970
|
-
const { updateShipping: r, addressChanged: i } =
|
|
2075
|
+
const { updateShipping: r, addressChanged: i } = fn(
|
|
1971
2076
|
e,
|
|
1972
2077
|
n
|
|
1973
2078
|
);
|
|
1974
2079
|
if (r) {
|
|
1975
|
-
const a =
|
|
2080
|
+
const a = Cr(e, n, i), s = a || Or(n);
|
|
1976
2081
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
1977
2082
|
{
|
|
1978
2083
|
id: e.orderFormId,
|
|
@@ -1992,116 +2097,116 @@ const Be = (e) => {
|
|
|
1992
2097
|
);
|
|
1993
2098
|
}
|
|
1994
2099
|
return e;
|
|
1995
|
-
},
|
|
2100
|
+
}, Rr = (e, n) => {
|
|
1996
2101
|
if (!e)
|
|
1997
2102
|
return "";
|
|
1998
|
-
const r =
|
|
2103
|
+
const r = Z(e)[n];
|
|
1999
2104
|
return r ? r.split("=")[1] : "";
|
|
2000
|
-
},
|
|
2001
|
-
const i =
|
|
2105
|
+
}, Fr = async (e, { cart: { order: n }, session: t }, r) => {
|
|
2106
|
+
const i = Rr(
|
|
2002
2107
|
r.headers.cookie,
|
|
2003
2108
|
"checkout.vtex.com"
|
|
2004
2109
|
), {
|
|
2005
2110
|
clients: { commerce: a },
|
|
2006
2111
|
loaders: { skuLoader: o }
|
|
2007
2112
|
} = r, s = t?.channel, c = t?.locale;
|
|
2008
|
-
s &&
|
|
2113
|
+
s && ve(r, s), c && Oe(r, c);
|
|
2009
2114
|
const l = await a.checkout.orderForm({
|
|
2010
2115
|
id: i || void 0,
|
|
2011
2116
|
channel: r.storage.channel
|
|
2012
2117
|
}), p = l.orderFormId;
|
|
2013
|
-
l.messages.length !== 0 && await
|
|
2014
|
-
const u =
|
|
2015
|
-
if (
|
|
2016
|
-
const
|
|
2118
|
+
l.messages.length !== 0 && await Er(p, r);
|
|
2119
|
+
const u = Z(r?.headers?.cookie ?? "")?.vtex_session, h = Y(u), { acceptedOffer: f, shouldSplitItem: v } = n;
|
|
2120
|
+
if (Tr(l, h)) {
|
|
2121
|
+
const b = await Ge(
|
|
2017
2122
|
l,
|
|
2018
2123
|
a,
|
|
2019
2124
|
h
|
|
2020
|
-
).then(
|
|
2125
|
+
).then(je);
|
|
2021
2126
|
if (p)
|
|
2022
|
-
return
|
|
2127
|
+
return We(b, o, v);
|
|
2023
2128
|
}
|
|
2024
|
-
const g =
|
|
2025
|
-
(
|
|
2026
|
-
const
|
|
2027
|
-
if (!
|
|
2028
|
-
return _.forEach((
|
|
2029
|
-
const [
|
|
2030
|
-
if (
|
|
2031
|
-
return
|
|
2032
|
-
const
|
|
2033
|
-
return
|
|
2034
|
-
...
|
|
2035
|
-
quantity:
|
|
2036
|
-
}),
|
|
2129
|
+
const g = qe(f), m = qe(l.items.map(se)), y = Array.from(m.entries()), O = Array.from(g.entries()), { itemsToAdd: w, itemsToUpdate: C } = O.reduce(
|
|
2130
|
+
(b, [k, _]) => {
|
|
2131
|
+
const x = m.get(k);
|
|
2132
|
+
if (!x)
|
|
2133
|
+
return _.forEach((q) => b.itemsToAdd.push(q)), b;
|
|
2134
|
+
const [E, ...Ue] = x;
|
|
2135
|
+
if (In(l.items, E.itemOffered.sku) || yn(l.items, E.itemOffered.sku))
|
|
2136
|
+
return b.itemsToUpdate.push(E), b;
|
|
2137
|
+
const de = _.reduce((q, Pn) => q + Pn.quantity, 0);
|
|
2138
|
+
return b.itemsToUpdate.push({
|
|
2139
|
+
...E,
|
|
2140
|
+
quantity: de
|
|
2141
|
+
}), Ue.forEach((q) => b.itemsToUpdate.push({ ...q, quantity: 0 })), b;
|
|
2037
2142
|
},
|
|
2038
2143
|
{
|
|
2039
2144
|
itemsToAdd: [],
|
|
2040
2145
|
itemsToUpdate: []
|
|
2041
2146
|
}
|
|
2042
|
-
), P = y.filter(([
|
|
2043
|
-
|
|
2044
|
-
), { updateShipping: D } = t ?
|
|
2045
|
-
if (
|
|
2147
|
+
), P = y.filter(([b]) => !g.has(b)).flatMap(([, b]) => b.map((k) => ({ ...k, quantity: 0 }))), S = [...w, ...C, ...P].map(
|
|
2148
|
+
kr
|
|
2149
|
+
), { updateShipping: D } = t ? fn(l, t) : { updateShipping: !1 };
|
|
2150
|
+
if (S.length === 0 && !D)
|
|
2046
2151
|
return null;
|
|
2047
2152
|
let A;
|
|
2048
|
-
|
|
2153
|
+
S.length > 0 ? A = await a.checkout.updateOrderFormItems({
|
|
2049
2154
|
id: l.orderFormId,
|
|
2050
|
-
orderItems:
|
|
2051
|
-
shouldSplitItem:
|
|
2155
|
+
orderItems: S,
|
|
2156
|
+
shouldSplitItem: v
|
|
2052
2157
|
}).then(
|
|
2053
|
-
(
|
|
2054
|
-
) : A = await
|
|
2158
|
+
(b) => He(b, t, r)
|
|
2159
|
+
) : A = await He(
|
|
2055
2160
|
l,
|
|
2056
2161
|
t,
|
|
2057
2162
|
r
|
|
2058
|
-
), A = await Promise.resolve(A).then((
|
|
2163
|
+
), A = await Promise.resolve(A).then((b) => {
|
|
2059
2164
|
if (t?.marketingData) {
|
|
2060
|
-
const
|
|
2061
|
-
...
|
|
2165
|
+
const k = {
|
|
2166
|
+
...b.marketingData,
|
|
2062
2167
|
...t.marketingData
|
|
2063
2168
|
};
|
|
2064
2169
|
return a.checkout.marketingData({
|
|
2065
2170
|
id: l.orderFormId,
|
|
2066
|
-
marketingData:
|
|
2171
|
+
marketingData: k
|
|
2067
2172
|
});
|
|
2068
2173
|
}
|
|
2069
|
-
return
|
|
2070
|
-
}).then((
|
|
2071
|
-
id:
|
|
2174
|
+
return b;
|
|
2175
|
+
}).then((b) => c && b.clientPreferencesData?.locale !== c ? a.checkout.clientPreferencesData({
|
|
2176
|
+
id: b.orderFormId,
|
|
2072
2177
|
clientPreferencesData: {
|
|
2073
|
-
...
|
|
2178
|
+
...b.clientPreferencesData,
|
|
2074
2179
|
locale: c
|
|
2075
2180
|
}
|
|
2076
|
-
}) :
|
|
2077
|
-
const U =
|
|
2181
|
+
}) : b).then((b) => Ge(b, a, h)).then(je);
|
|
2182
|
+
const U = Pe(
|
|
2078
2183
|
l.messages,
|
|
2079
2184
|
A.messages
|
|
2080
2185
|
);
|
|
2081
|
-
return
|
|
2082
|
-
},
|
|
2186
|
+
return _r(n, A) && U ? null : We(A, o, v);
|
|
2187
|
+
}, Nr = (e) => {
|
|
2083
2188
|
const n = (e?.corporateName ?? "").trim();
|
|
2084
2189
|
return n || (e?.firstName ?? "").trim();
|
|
2085
|
-
},
|
|
2190
|
+
}, Lr = (e) => {
|
|
2086
2191
|
if (!e || typeof e != "object")
|
|
2087
2192
|
return !1;
|
|
2088
2193
|
const n = e;
|
|
2089
2194
|
return typeof n.customerId == "string" && n.customerId.trim() !== "" && typeof n.contractName == "string" && typeof n.isActive == "boolean" && typeof n.isCurrent == "boolean";
|
|
2090
|
-
},
|
|
2195
|
+
}, Br = (e) => {
|
|
2091
2196
|
const n = e?.availableContracts?.value;
|
|
2092
|
-
return Array.isArray(n) ? n.filter(
|
|
2093
|
-
},
|
|
2197
|
+
return Array.isArray(n) ? n.filter(Lr) : [];
|
|
2198
|
+
}, $r = (e) => e?.customerId ? !!((e.contractName ?? "").trim() && e.isActive) : !1, Mr = (e) => e?.namespaces?.shopper?.activeContractId?.value?.trim() ?? e?.namespaces?.authentication?.customerId?.value?.trim() ?? e?.namespaces?.profile?.id?.value?.trim() ?? "", zr = (e, n = "") => {
|
|
2094
2199
|
const t = n.trim();
|
|
2095
|
-
return e.filter(
|
|
2200
|
+
return e.filter($r).map((r) => ({
|
|
2096
2201
|
id: r.customerId,
|
|
2097
2202
|
corporateName: r.contractName.trim(),
|
|
2098
2203
|
isActive: t ? r.customerId === t : r.isCurrent
|
|
2099
2204
|
}));
|
|
2100
|
-
},
|
|
2101
|
-
const t =
|
|
2205
|
+
}, On = (e, n) => {
|
|
2206
|
+
const t = Nr(e);
|
|
2102
2207
|
return t || (n?.firstName?.value ?? "").trim();
|
|
2103
2208
|
};
|
|
2104
|
-
async function
|
|
2209
|
+
async function Vr(e, n, t) {
|
|
2105
2210
|
try {
|
|
2106
2211
|
const r = await e.commerce.checkout.address({
|
|
2107
2212
|
postalCode: t,
|
|
@@ -2118,45 +2223,45 @@ async function _r(e, n, t) {
|
|
|
2118
2223
|
), r;
|
|
2119
2224
|
}
|
|
2120
2225
|
}
|
|
2121
|
-
const
|
|
2122
|
-
const o =
|
|
2226
|
+
const xr = async (e, { session: n, search: t }, { clients: r, headers: i, account: a }) => {
|
|
2227
|
+
const o = oe.parse(n.channel ?? ""), s = String(n.postalCode ?? ""), c = n.country ?? "";
|
|
2123
2228
|
let l = n.city ?? null, p = n.geoCoordinates ?? null;
|
|
2124
2229
|
if ((!l || !p) && s !== "" && c !== "") {
|
|
2125
|
-
const
|
|
2230
|
+
const E = await Vr(
|
|
2126
2231
|
r,
|
|
2127
2232
|
c,
|
|
2128
2233
|
s
|
|
2129
2234
|
);
|
|
2130
|
-
l =
|
|
2235
|
+
l = E.city, p = E.geoCoordinates;
|
|
2131
2236
|
}
|
|
2132
2237
|
const h = new URLSearchParams(t);
|
|
2133
2238
|
h.has("facets") && h.delete("facets");
|
|
2134
|
-
const
|
|
2135
|
-
h.set("sc",
|
|
2239
|
+
const f = h.get("sc") ?? o.salesChannel;
|
|
2240
|
+
h.set("sc", f), s && h.set("postalCode", s), c && h.set("country", c), p && h.set(
|
|
2136
2241
|
"geoCoordinates",
|
|
2137
2242
|
`${p.longitude},${p.latitude}`
|
|
2138
2243
|
// long,lat is the format expected
|
|
2139
2244
|
), h.set("locale", n.locale);
|
|
2140
|
-
const { marketingData:
|
|
2141
|
-
utmCampaign: h.get("utm_campaign") ??
|
|
2142
|
-
utmMedium: h.get("utm_medium") ??
|
|
2143
|
-
utmSource: h.get("utm_source") ??
|
|
2144
|
-
utmiCampaign: h.get("utmi_cp") ??
|
|
2145
|
-
utmiPage: h.get("utmi_p") ??
|
|
2146
|
-
utmiPart: h.get("utmi_pc") ??
|
|
2147
|
-
}, g =
|
|
2245
|
+
const { marketingData: v } = n, d = {
|
|
2246
|
+
utmCampaign: h.get("utm_campaign") ?? v?.utmCampaign ?? "",
|
|
2247
|
+
utmMedium: h.get("utm_medium") ?? v?.utmMedium ?? "",
|
|
2248
|
+
utmSource: h.get("utm_source") ?? v?.utmSource ?? "",
|
|
2249
|
+
utmiCampaign: h.get("utmi_cp") ?? v?.utmiCampaign ?? "",
|
|
2250
|
+
utmiPage: h.get("utmi_p") ?? v?.utmiPage ?? "",
|
|
2251
|
+
utmiPart: h.get("utmi_pc") ?? v?.utmiPart ?? ""
|
|
2252
|
+
}, g = Y(z(i?.cookie ?? "", a));
|
|
2148
2253
|
let m = !1;
|
|
2149
2254
|
if (g)
|
|
2150
2255
|
try {
|
|
2151
2256
|
m = (await r.commerce.vtexid.validate())?.authStatus?.toLowerCase() === "success";
|
|
2152
|
-
} catch (
|
|
2153
|
-
console.warn("JWT validation failed:",
|
|
2257
|
+
} catch (E) {
|
|
2258
|
+
console.warn("JWT validation failed:", E), m = !1;
|
|
2154
2259
|
}
|
|
2155
|
-
const y = m ? g?.isRepresentative : !1,
|
|
2156
|
-
let
|
|
2260
|
+
const y = m ? g?.isRepresentative : !1, O = m ? g?.customerId : void 0, w = m ? g?.unitId : void 0, C = await r.commerce.session(h.toString()).catch(() => null), P = C?.namespaces.profile ?? null, S = C?.namespaces.shopper ?? null, D = C?.namespaces.store ?? null, A = C?.namespaces.authentication ?? null, U = C?.namespaces.checkout ?? null, b = C?.namespaces.public ?? null;
|
|
2261
|
+
let k = null;
|
|
2157
2262
|
if (y && P?.id?.value)
|
|
2158
2263
|
try {
|
|
2159
|
-
|
|
2264
|
+
k = await r.commerce.masterData.getContractById({
|
|
2160
2265
|
contractId: P.id.value
|
|
2161
2266
|
});
|
|
2162
2267
|
} catch {
|
|
@@ -2170,16 +2275,16 @@ const Tr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2170
2275
|
postalCode: s,
|
|
2171
2276
|
geoCoordinates: p,
|
|
2172
2277
|
country: c,
|
|
2173
|
-
salesChannel:
|
|
2174
|
-
}))?.[0]?.sellers.find((
|
|
2175
|
-
const
|
|
2278
|
+
salesChannel: f
|
|
2279
|
+
}))?.[0]?.sellers.find((de) => o.seller === de.id));
|
|
2280
|
+
const x = {
|
|
2176
2281
|
...n,
|
|
2177
2282
|
currency: {
|
|
2178
2283
|
code: D?.currencyCode?.value ?? n.currency.code,
|
|
2179
2284
|
symbol: D?.currencySymbol?.value ?? n.currency.symbol
|
|
2180
2285
|
},
|
|
2181
2286
|
country: D?.countryCode?.value ?? c,
|
|
2182
|
-
channel:
|
|
2287
|
+
channel: oe.stringify({
|
|
2183
2288
|
salesChannel: D?.channel?.value ?? o.salesChannel,
|
|
2184
2289
|
regionId: U?.regionId?.value ?? o.regionId,
|
|
2185
2290
|
seller: _?.id,
|
|
@@ -2193,16 +2298,16 @@ const Tr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2193
2298
|
*/
|
|
2194
2299
|
b2b: y ? {
|
|
2195
2300
|
isRepresentative: y ?? !1,
|
|
2196
|
-
customerId: A?.customerId?.value ??
|
|
2301
|
+
customerId: A?.customerId?.value ?? O ?? "",
|
|
2197
2302
|
unitName: A?.unitName?.value ?? "",
|
|
2198
2303
|
unitId: A?.unitId?.value ?? w ?? "",
|
|
2199
|
-
firstName: typeof
|
|
2200
|
-
lastName: typeof
|
|
2201
|
-
userName: `${typeof
|
|
2304
|
+
firstName: typeof S?.firstName?.value == "string" ? S.firstName.value : "",
|
|
2305
|
+
lastName: typeof S?.lastName?.value == "string" ? S.lastName.value : "",
|
|
2306
|
+
userName: `${typeof S?.firstName?.value == "string" ? S.firstName.value : ""} ${typeof S?.lastName?.value == "string" ? S.lastName.value : ""}`.trim(),
|
|
2202
2307
|
userEmail: A?.storeUserEmail.value ?? "",
|
|
2203
|
-
savedPostalCode:
|
|
2204
|
-
contractName:
|
|
2205
|
-
organizationManager:
|
|
2308
|
+
savedPostalCode: b?.postalCode?.value ?? "",
|
|
2309
|
+
contractName: On(k, P),
|
|
2310
|
+
organizationManager: S?.organizationManager?.value ?? !1
|
|
2206
2311
|
} : null,
|
|
2207
2312
|
marketingData: d,
|
|
2208
2313
|
person: P?.id ? {
|
|
@@ -2214,38 +2319,38 @@ const Tr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2214
2319
|
geoCoordinates: p?.latitude && p?.longitude && p || null,
|
|
2215
2320
|
city: l
|
|
2216
2321
|
};
|
|
2217
|
-
return
|
|
2218
|
-
},
|
|
2219
|
-
validateCart:
|
|
2220
|
-
validateSession:
|
|
2221
|
-
subscribeToNewsletter:
|
|
2222
|
-
cancelOrder:
|
|
2223
|
-
processOrderAuthorization:
|
|
2224
|
-
uploadFileToOrderEntry:
|
|
2225
|
-
startOrderEntryOperation:
|
|
2226
|
-
startRecommendationSession:
|
|
2322
|
+
return Pe(n, x) ? null : x;
|
|
2323
|
+
}, qr = {
|
|
2324
|
+
validateCart: Fr,
|
|
2325
|
+
validateSession: xr,
|
|
2326
|
+
subscribeToNewsletter: yr,
|
|
2327
|
+
cancelOrder: gr,
|
|
2328
|
+
processOrderAuthorization: hr,
|
|
2329
|
+
uploadFileToOrderEntry: Ir,
|
|
2330
|
+
startOrderEntryOperation: fr,
|
|
2331
|
+
startRecommendationSession: Sr
|
|
2227
2332
|
};
|
|
2228
|
-
var
|
|
2333
|
+
var be;
|
|
2229
2334
|
(function(e) {
|
|
2230
2335
|
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";
|
|
2231
|
-
})(
|
|
2232
|
-
const
|
|
2233
|
-
function
|
|
2336
|
+
})(be || (be = {}));
|
|
2337
|
+
const jr = (e) => typeof e == "string" ? Cn(e) : null;
|
|
2338
|
+
function Cn(e) {
|
|
2234
2339
|
try {
|
|
2235
2340
|
return JSON.parse(e);
|
|
2236
2341
|
} catch {
|
|
2237
2342
|
return e;
|
|
2238
2343
|
}
|
|
2239
2344
|
}
|
|
2240
|
-
const
|
|
2345
|
+
const Wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Gr = new _n({
|
|
2241
2346
|
name: "ObjectOrString",
|
|
2242
2347
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2243
|
-
parseValue:
|
|
2244
|
-
serialize:
|
|
2348
|
+
parseValue: jr,
|
|
2349
|
+
serialize: Wr,
|
|
2245
2350
|
parseLiteral(e) {
|
|
2246
|
-
return e.kind ===
|
|
2351
|
+
return e.kind === be.STRING ? Cn(e.value) : null;
|
|
2247
2352
|
}
|
|
2248
|
-
}), F = (e) => "Price" in e && "seller" in e && "product" in e,
|
|
2353
|
+
}), F = (e) => "Price" in e && "seller" in e && "product" in e, R = (e) => "skuName" in e, Hr = {
|
|
2249
2354
|
priceCurrency: async (e, n, t) => {
|
|
2250
2355
|
const {
|
|
2251
2356
|
loaders: { salesChannelLoader: r },
|
|
@@ -2253,34 +2358,34 @@ const Fr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2253
2358
|
} = t;
|
|
2254
2359
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
2255
2360
|
},
|
|
2256
|
-
priceValidUntil: (e) => F(e) ? e.PriceValidUntil ?? "" :
|
|
2361
|
+
priceValidUntil: (e) => F(e) ? e.PriceValidUntil ?? "" : R(e) ? e.priceValidUntil ?? "" : null,
|
|
2257
2362
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2258
|
-
availability: async (e) => F(e) ?
|
|
2363
|
+
availability: async (e) => F(e) ? Le(B(e)) : R(e) ? Le(Qt(e.availability)) : null,
|
|
2259
2364
|
seller: (e, n, t) => F(e) ? {
|
|
2260
2365
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2261
|
-
} :
|
|
2366
|
+
} : R(e) ? {
|
|
2262
2367
|
identifier: e.seller
|
|
2263
2368
|
} : null,
|
|
2264
|
-
price: (e) => F(e) ? V(e) :
|
|
2265
|
-
priceWithTaxes: (e) => F(e) ?
|
|
2369
|
+
price: (e) => F(e) ? V(e) : R(e) ? e.sellingPrice / 100 : null,
|
|
2370
|
+
priceWithTaxes: (e) => F(e) ? M(V(e), e?.Tax, e.product.unitMultiplier) : R(e) ? M(
|
|
2266
2371
|
e.sellingPrice / 100,
|
|
2267
2372
|
e.tax / 100,
|
|
2268
2373
|
e.unitMultiplier
|
|
2269
2374
|
) : null,
|
|
2270
|
-
sellingPrice: (e) => F(e) ?
|
|
2271
|
-
listPrice: (e) => F(e) ? e.ListPrice ?? 0 :
|
|
2272
|
-
listPriceWithTaxes: (e) => F(e) ?
|
|
2375
|
+
sellingPrice: (e) => F(e) ? Kt(e) : R(e) ? e.sellingPrice / 100 : null,
|
|
2376
|
+
listPrice: (e) => F(e) ? e.ListPrice ?? 0 : R(e) ? e.listPrice / 100 : null,
|
|
2377
|
+
listPriceWithTaxes: (e) => F(e) ? M(
|
|
2273
2378
|
e.ListPrice ?? 0,
|
|
2274
2379
|
e?.Tax,
|
|
2275
2380
|
e.product.unitMultiplier
|
|
2276
|
-
) :
|
|
2277
|
-
itemOffered: (e) => F(e) ? e.product :
|
|
2381
|
+
) : R(e) ? M(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
|
|
2382
|
+
itemOffered: (e) => F(e) ? e.product : R(e) ? {
|
|
2278
2383
|
...e.product,
|
|
2279
2384
|
attachmentsValues: e.attachments
|
|
2280
2385
|
} : null,
|
|
2281
|
-
quantity: (e) => F(e) ? e.AvailableQuantity ?? 0 :
|
|
2282
|
-
isGift: (e) =>
|
|
2283
|
-
},
|
|
2386
|
+
quantity: (e) => F(e) ? e.AvailableQuantity ?? 0 : R(e) ? e.quantity : null,
|
|
2387
|
+
isGift: (e) => R(e) ? e.isGift ?? !1 : null
|
|
2388
|
+
}, Xr = ({ linkText: e }) => `/${e}/p`, Yr = ({
|
|
2284
2389
|
offer: e,
|
|
2285
2390
|
seller: n,
|
|
2286
2391
|
product: t
|
|
@@ -2288,61 +2393,112 @@ const Fr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2288
2393
|
...e,
|
|
2289
2394
|
product: t,
|
|
2290
2395
|
seller: n
|
|
2291
|
-
}),
|
|
2396
|
+
}), Jr = {
|
|
2292
2397
|
imageText: "image",
|
|
2293
2398
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2294
2399
|
imageLabel: "label"
|
|
2295
|
-
},
|
|
2296
|
-
function
|
|
2400
|
+
}, ie = (e, n) => `${e}-${n}`, Xe = (e, n) => `/${ie(e, n)}/p`, Kr = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2401
|
+
function we(e) {
|
|
2297
2402
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2298
2403
|
}
|
|
2299
|
-
|
|
2300
|
-
const
|
|
2404
|
+
async function De(e, n, t) {
|
|
2405
|
+
const r = `${n}:${t}`;
|
|
2406
|
+
e.storage.productTranslationsCache ??= /* @__PURE__ */ new Map();
|
|
2407
|
+
const i = e.storage.productTranslationsCache, a = i.get(r);
|
|
2408
|
+
if (a) return a;
|
|
2409
|
+
const o = (async () => {
|
|
2410
|
+
try {
|
|
2411
|
+
const s = await e.clients.catalog.getLocalizedProduct(
|
|
2412
|
+
n,
|
|
2413
|
+
t
|
|
2414
|
+
);
|
|
2415
|
+
return {
|
|
2416
|
+
linkId: s.linkId,
|
|
2417
|
+
categories: s.categories ?? [],
|
|
2418
|
+
availableLinkIds: s.availableLinkIds ?? {}
|
|
2419
|
+
};
|
|
2420
|
+
} catch {
|
|
2421
|
+
return null;
|
|
2422
|
+
}
|
|
2423
|
+
})();
|
|
2424
|
+
return i.set(r, o), o;
|
|
2425
|
+
}
|
|
2426
|
+
const Qr = (e, n) => {
|
|
2427
|
+
const t = e.findIndex((r) => we(r).split("/").at(-1) === n);
|
|
2301
2428
|
return t < 0 ? 0 : t;
|
|
2302
|
-
},
|
|
2429
|
+
}, Zr = {
|
|
2303
2430
|
productID: ({ itemId: e }) => e,
|
|
2304
2431
|
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2305
|
-
slug: ({ isVariantOf: { linkText: e }, itemId: n }) =>
|
|
2432
|
+
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => ie(e, n),
|
|
2306
2433
|
description: ({ isVariantOf: { description: e } }) => e,
|
|
2307
2434
|
seo: ({ isVariantOf: e }) => ({
|
|
2308
2435
|
title: e.productTitle || e.productName,
|
|
2309
2436
|
description: e.metaTagDescription || e.description,
|
|
2310
|
-
canonical:
|
|
2437
|
+
canonical: Xr(e)
|
|
2311
2438
|
}),
|
|
2312
2439
|
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2313
2440
|
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
2314
|
-
breadcrumbList: ({
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2441
|
+
breadcrumbList: async (e, n, t) => {
|
|
2442
|
+
const {
|
|
2443
|
+
isVariantOf: {
|
|
2444
|
+
categories: r,
|
|
2445
|
+
productName: i,
|
|
2446
|
+
linkText: a,
|
|
2447
|
+
categoryId: o,
|
|
2448
|
+
categoriesIds: s,
|
|
2449
|
+
productId: c
|
|
2450
|
+
},
|
|
2451
|
+
itemId: l
|
|
2452
|
+
} = e, p = Qr(s, o), u = r[p], h = we(u).split("/"), f = t.storage.locale;
|
|
2453
|
+
if (Q(t) && f) {
|
|
2454
|
+
const v = await De(t, c, f);
|
|
2455
|
+
if (v) {
|
|
2456
|
+
const d = new Set(
|
|
2457
|
+
we(s[p]).split("/").filter(Boolean)
|
|
2458
|
+
), g = v.categories.filter((y) => d.has(y.id.toString())).sort(
|
|
2459
|
+
(y, O) => y.fullPath.split("/").length - O.fullPath.split("/").length
|
|
2460
|
+
);
|
|
2461
|
+
if (g.length === h.length)
|
|
2462
|
+
return {
|
|
2463
|
+
itemListElement: [
|
|
2464
|
+
// Category items: both name and slug come from Catalog Dataplane, ensuring
|
|
2465
|
+
// they are always consistent with each other for the requested locale.
|
|
2466
|
+
...g.map((y, O) => ({
|
|
2467
|
+
name: y.name,
|
|
2468
|
+
item: `/${y.fullPathUriName}/`,
|
|
2469
|
+
position: O + 1
|
|
2470
|
+
})),
|
|
2471
|
+
{
|
|
2472
|
+
name: i,
|
|
2473
|
+
item: Xe(v.linkId, l),
|
|
2474
|
+
position: h.length + 1
|
|
2475
|
+
}
|
|
2476
|
+
],
|
|
2477
|
+
numberOfItems: h.length
|
|
2478
|
+
};
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2325
2481
|
return {
|
|
2326
2482
|
itemListElement: [
|
|
2327
|
-
...
|
|
2328
|
-
const
|
|
2483
|
+
...h.map((v, d) => {
|
|
2484
|
+
const g = `/${h.slice(0, d + 1).map(ae).join("/")}/`;
|
|
2329
2485
|
return {
|
|
2330
|
-
name:
|
|
2331
|
-
item:
|
|
2332
|
-
position:
|
|
2486
|
+
name: v,
|
|
2487
|
+
item: g,
|
|
2488
|
+
position: d + 1
|
|
2333
2489
|
};
|
|
2334
2490
|
}),
|
|
2335
2491
|
{
|
|
2336
|
-
name:
|
|
2337
|
-
item:
|
|
2338
|
-
position:
|
|
2492
|
+
name: i,
|
|
2493
|
+
item: Xe(a, l),
|
|
2494
|
+
position: h.length + 1
|
|
2339
2495
|
}
|
|
2340
2496
|
],
|
|
2341
|
-
numberOfItems:
|
|
2497
|
+
numberOfItems: h.length
|
|
2342
2498
|
};
|
|
2343
2499
|
},
|
|
2344
2500
|
image: ({ images: e }, n) => {
|
|
2345
|
-
const t = (
|
|
2501
|
+
const t = (Kr(e) ?? [Jr]).map(
|
|
2346
2502
|
({ imageUrl: s, imageText: c, imageLabel: l }) => ({
|
|
2347
2503
|
alternateName: c ?? "",
|
|
2348
2504
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
@@ -2365,12 +2521,12 @@ const Vr = (e, n) => {
|
|
|
2365
2521
|
review: () => [],
|
|
2366
2522
|
aggregateRating: () => ({}),
|
|
2367
2523
|
offers: (e) => e.sellers.map(
|
|
2368
|
-
(n) =>
|
|
2524
|
+
(n) => Yr({
|
|
2369
2525
|
offer: n.commertialOffer,
|
|
2370
2526
|
seller: n,
|
|
2371
2527
|
product: e
|
|
2372
2528
|
})
|
|
2373
|
-
).sort(
|
|
2529
|
+
).sort(ln),
|
|
2374
2530
|
isVariantOf: (e) => e,
|
|
2375
2531
|
additionalProperty: ({
|
|
2376
2532
|
// Search uses the name variations for specifications
|
|
@@ -2382,11 +2538,11 @@ const Vr = (e, n) => {
|
|
|
2382
2538
|
({ name: o, values: s }) => s.map((c) => ({
|
|
2383
2539
|
name: o,
|
|
2384
2540
|
value: c,
|
|
2385
|
-
valueReference:
|
|
2541
|
+
valueReference: ne.specification
|
|
2386
2542
|
}))
|
|
2387
2543
|
), i = n.map(
|
|
2388
|
-
|
|
2389
|
-
), a = t.map(
|
|
2544
|
+
mn
|
|
2545
|
+
), a = t.map(vr);
|
|
2390
2546
|
return [
|
|
2391
2547
|
...r,
|
|
2392
2548
|
...i,
|
|
@@ -2398,68 +2554,63 @@ const Vr = (e, n) => {
|
|
|
2398
2554
|
specificationGroups: ({ isVariantOf: { specificationGroups: e } }) => e,
|
|
2399
2555
|
releaseDate: ({ isVariantOf: { releaseDate: e } }) => e ?? "",
|
|
2400
2556
|
advertisement: ({ isVariantOf: { advertisement: e } }) => e,
|
|
2401
|
-
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e
|
|
2402
|
-
|
|
2557
|
+
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e,
|
|
2558
|
+
otherLocales: async (e, n, t) => {
|
|
2559
|
+
if (!Q(t)) return null;
|
|
2560
|
+
const r = gt(t);
|
|
2561
|
+
if (r.length === 0) return null;
|
|
2562
|
+
const i = e.isVariantOf.productId, a = e.itemId, o = t.storage.locale, s = mt(t), c = await De(t, i, o);
|
|
2563
|
+
if (!c?.availableLinkIds) return null;
|
|
2564
|
+
const { availableLinkIds: l } = c, { linkText: p } = e.isVariantOf;
|
|
2565
|
+
return r.map((u) => {
|
|
2566
|
+
if (u === s)
|
|
2567
|
+
return { locale: u, slug: ie(p, a) };
|
|
2568
|
+
const h = l[u];
|
|
2569
|
+
return h ? { locale: u, slug: ie(h, a) } : null;
|
|
2570
|
+
}).filter((u) => u !== null);
|
|
2571
|
+
}
|
|
2572
|
+
}, ei = /* @__PURE__ */ new Set(["allSpecifications"]), ni = {
|
|
2403
2573
|
hasVariant: (e) => e.isVariantOf.items.map((n) => N(n, e.isVariantOf)),
|
|
2404
2574
|
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
2405
2575
|
name: (e) => e.isVariantOf.productName,
|
|
2406
2576
|
skuVariants: (e) => e,
|
|
2407
2577
|
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
2408
|
-
(n) => !
|
|
2578
|
+
(n) => !ei.has(n.name)
|
|
2409
2579
|
).flatMap(
|
|
2410
2580
|
({ specifications: n }) => n.flatMap(
|
|
2411
2581
|
({ name: t, values: r }) => r.map((i) => ({
|
|
2412
2582
|
name: t,
|
|
2413
2583
|
value: i,
|
|
2414
|
-
valueReference:
|
|
2584
|
+
valueReference: ne.specification
|
|
2415
2585
|
}))
|
|
2416
2586
|
)
|
|
2417
2587
|
)
|
|
2418
|
-
},
|
|
2419
|
-
propertyID: (e) => e.propertyID ||
|
|
2588
|
+
}, ti = {
|
|
2589
|
+
propertyID: (e) => e.propertyID || hn(e),
|
|
2420
2590
|
name: ({ name: e }) => e,
|
|
2421
2591
|
value: ({ value: e }) => e,
|
|
2422
2592
|
valueReference: ({ valueReference: e }) => e
|
|
2423
|
-
},
|
|
2424
|
-
if (!n)
|
|
2425
|
-
throw new T("Missing operationId");
|
|
2426
|
-
return t.orderEntry.getOperation({ operationId: n });
|
|
2427
|
-
}, Xr = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
2428
|
-
if (!n)
|
|
2429
|
-
throw new T("Missing orderFormId");
|
|
2430
|
-
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
2431
|
-
return (r ?? []).map((i) => ({
|
|
2432
|
-
id: i.id,
|
|
2433
|
-
name: i.name,
|
|
2434
|
-
price: i.price,
|
|
2435
|
-
listPrice: i.listPrice,
|
|
2436
|
-
quantity: i.quantity,
|
|
2437
|
-
imageUrl: i.imageUrl ?? null,
|
|
2438
|
-
availability: i.availability,
|
|
2439
|
-
seller: i.seller,
|
|
2440
|
-
unitMultiplier: i.unitMultiplier ?? 1
|
|
2441
|
-
}));
|
|
2442
|
-
}, re = (e) => {
|
|
2593
|
+
}, ce = (e) => {
|
|
2443
2594
|
const n = e.flatMap(
|
|
2444
2595
|
(r) => r.sellers.map((i) => ({
|
|
2445
2596
|
offer: i.commertialOffer,
|
|
2446
2597
|
sku: r
|
|
2447
2598
|
}))
|
|
2448
|
-
), t =
|
|
2599
|
+
), t = Ie(
|
|
2449
2600
|
n,
|
|
2450
|
-
({ offer: r }, { offer: i }) =>
|
|
2601
|
+
({ offer: r }, { offer: i }) => ln(r, i)
|
|
2451
2602
|
);
|
|
2452
2603
|
return t ? t.sku : e[0];
|
|
2453
|
-
},
|
|
2604
|
+
}, bn = (e) => e !== "" && !Number.isNaN(Number(e)), ri = /^vrn:recommendations:[^:]+:[^:]+:[^:]+$/, ii = async (e, { campaignVrn: n, userId: t, products: r }, i) => {
|
|
2454
2605
|
const {
|
|
2455
2606
|
clients: { commerce: a }
|
|
2456
2607
|
} = i, { salesChannel: o } = i.storage.channel, s = n?.trim();
|
|
2457
|
-
if (!s || !
|
|
2608
|
+
if (!s || !ri.test(s))
|
|
2458
2609
|
throw new T(`Invalid campaignVrn: "${n}"`);
|
|
2459
2610
|
const c = t?.trim();
|
|
2460
2611
|
if (t != null && !c)
|
|
2461
2612
|
throw new T("Invalid userId: must be a non-empty string");
|
|
2462
|
-
if (r != null && (!Array.isArray(r) || r.some((
|
|
2613
|
+
if (r != null && (!Array.isArray(r) || r.some((f) => !f?.trim())))
|
|
2463
2614
|
throw new T(
|
|
2464
2615
|
"Invalid products: must be an array of non-empty strings"
|
|
2465
2616
|
);
|
|
@@ -2471,14 +2622,14 @@ const Vr = (e, n) => {
|
|
|
2471
2622
|
locale: i.storage.locale
|
|
2472
2623
|
}), { campaign: p, correlationId: u } = l;
|
|
2473
2624
|
return {
|
|
2474
|
-
products: (l.products ?? []).map((
|
|
2475
|
-
const
|
|
2476
|
-
return
|
|
2477
|
-
}).filter((
|
|
2625
|
+
products: (l.products ?? []).map((f) => {
|
|
2626
|
+
const v = ce(f.items);
|
|
2627
|
+
return v ? N(v, f) : null;
|
|
2628
|
+
}).filter((f) => !!f),
|
|
2478
2629
|
correlationId: u,
|
|
2479
2630
|
campaign: p
|
|
2480
2631
|
};
|
|
2481
|
-
},
|
|
2632
|
+
}, Ye = {
|
|
2482
2633
|
price_desc: "price:desc",
|
|
2483
2634
|
price_asc: "price:asc",
|
|
2484
2635
|
orders_desc: "orders:desc",
|
|
@@ -2487,47 +2638,79 @@ const Vr = (e, n) => {
|
|
|
2487
2638
|
release_desc: "release:desc",
|
|
2488
2639
|
discount_desc: "discount:desc",
|
|
2489
2640
|
score_desc: ""
|
|
2490
|
-
},
|
|
2641
|
+
}, ai = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
2642
|
+
if (!n)
|
|
2643
|
+
throw new T("Missing operationId");
|
|
2644
|
+
return t.orderEntry.getOperation({ operationId: n });
|
|
2645
|
+
}, oi = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
2646
|
+
if (!n)
|
|
2647
|
+
throw new T("Missing orderFormId");
|
|
2648
|
+
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
2649
|
+
return (r ?? []).map((i) => ({
|
|
2650
|
+
id: i.id,
|
|
2651
|
+
name: i.name,
|
|
2652
|
+
price: i.price,
|
|
2653
|
+
listPrice: i.listPrice,
|
|
2654
|
+
quantity: i.quantity,
|
|
2655
|
+
imageUrl: i.imageUrl ?? null,
|
|
2656
|
+
availability: i.availability,
|
|
2657
|
+
seller: i.seller,
|
|
2658
|
+
unitMultiplier: i.unitMultiplier ?? 1
|
|
2659
|
+
}));
|
|
2660
|
+
};
|
|
2661
|
+
async function si(e, n, t, r) {
|
|
2662
|
+
const i = n.slice(0, n.lastIndexOf("-"));
|
|
2663
|
+
return (await De(e, t, r))?.linkId === i;
|
|
2664
|
+
}
|
|
2665
|
+
const wn = "Invalid SkuId", Dn = "Slug was set but the fetched sku does not satisfy the slug condition.", ci = (e) => X(e) || e instanceof Error && (e.message === wn || e.message.startsWith(Dn));
|
|
2666
|
+
async function li(e, n, t, r) {
|
|
2667
|
+
const { linkText: i, productId: a } = n.isVariantOf;
|
|
2668
|
+
if (!(!t || !i || t.startsWith(i) || Q(e) && r && bn(t.split("-").pop() ?? "") && await si(e, t, a, r)))
|
|
2669
|
+
throw new Error(`${Dn} slug: ${t}, linkText: ${i}`);
|
|
2670
|
+
}
|
|
2671
|
+
async function di(e, n) {
|
|
2672
|
+
if (n == null)
|
|
2673
|
+
throw new T("Missing slug or id");
|
|
2674
|
+
const {
|
|
2675
|
+
clients: { commerce: t, search: r }
|
|
2676
|
+
} = e, i = await t.catalog.portal.pagetype(`${n}/p`);
|
|
2677
|
+
if (i.pageType !== "Product" || !i.id)
|
|
2678
|
+
throw new $(`No product found for slug ${n}`);
|
|
2679
|
+
const a = await r.fetchProduct({
|
|
2680
|
+
field: "id",
|
|
2681
|
+
value: String(i.id)
|
|
2682
|
+
}).catch(() => null);
|
|
2683
|
+
if (!a)
|
|
2684
|
+
throw new $(`No product found for id ${i.id}`);
|
|
2685
|
+
return N(ce(a.items), a);
|
|
2686
|
+
}
|
|
2687
|
+
const ui = {
|
|
2491
2688
|
product: async (e, { locator: n }, t) => {
|
|
2492
|
-
const r =
|
|
2493
|
-
r &&
|
|
2689
|
+
const r = xe(n), i = Ve(n), a = cr(n), o = sr(n);
|
|
2690
|
+
r && ve(t, r), i && Oe(t, i);
|
|
2494
2691
|
const {
|
|
2495
|
-
loaders: { skuLoader: s }
|
|
2496
|
-
clients: { commerce: c, search: l }
|
|
2692
|
+
loaders: { skuLoader: s }
|
|
2497
2693
|
} = t;
|
|
2498
2694
|
try {
|
|
2499
|
-
const
|
|
2500
|
-
if (!
|
|
2501
|
-
throw new Error(
|
|
2502
|
-
const
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
return
|
|
2508
|
-
} catch (p) {
|
|
2509
|
-
if (!Zr(p))
|
|
2510
|
-
throw p;
|
|
2511
|
-
if (o == null)
|
|
2512
|
-
throw new T("Missing slug or id");
|
|
2513
|
-
const u = await c.catalog.portal.pagetype(`${o}/p`);
|
|
2514
|
-
if (u.pageType !== "Product" || !u.id)
|
|
2515
|
-
throw new L(`No product found for slug ${o}`);
|
|
2516
|
-
const h = await l.fetchProduct({
|
|
2517
|
-
field: "id",
|
|
2518
|
-
value: String(u.id)
|
|
2519
|
-
}).catch(() => null);
|
|
2520
|
-
if (!h)
|
|
2521
|
-
throw new L(`No product found for id ${u.id}`);
|
|
2522
|
-
const S = re(h.items);
|
|
2523
|
-
return N(S, h);
|
|
2695
|
+
const c = a ?? o?.split("-").pop() ?? "";
|
|
2696
|
+
if (!bn(c))
|
|
2697
|
+
throw new Error(wn);
|
|
2698
|
+
const l = await s.load(c);
|
|
2699
|
+
return await li(t, l, o, i), l;
|
|
2700
|
+
} catch (c) {
|
|
2701
|
+
if (!ci(c))
|
|
2702
|
+
throw c;
|
|
2703
|
+
return di(t, o);
|
|
2524
2704
|
}
|
|
2525
2705
|
},
|
|
2526
2706
|
collection: (e, { slug: n }, t) => {
|
|
2527
2707
|
const {
|
|
2528
2708
|
loaders: { collectionLoader: r }
|
|
2529
2709
|
} = t;
|
|
2530
|
-
return r.load(
|
|
2710
|
+
return r.load({
|
|
2711
|
+
slug: n,
|
|
2712
|
+
locale: re(t)
|
|
2713
|
+
});
|
|
2531
2714
|
},
|
|
2532
2715
|
search: async (e, {
|
|
2533
2716
|
first: n,
|
|
@@ -2537,19 +2720,19 @@ const Vr = (e, n) => {
|
|
|
2537
2720
|
selectedFacets: a,
|
|
2538
2721
|
sponsoredCount: o
|
|
2539
2722
|
}, s) => {
|
|
2540
|
-
const c =
|
|
2541
|
-
c &&
|
|
2723
|
+
const c = xe(a), l = Ve(a), p = or(a);
|
|
2724
|
+
c && ve(s, c), l && Oe(s, l);
|
|
2542
2725
|
const u = t ? Number(t) : 0, h = {
|
|
2543
2726
|
page: Math.ceil(u / n) || 0,
|
|
2544
2727
|
count: n,
|
|
2545
2728
|
query: i ?? void 0,
|
|
2546
|
-
sort:
|
|
2547
|
-
selectedFacets: a?.flatMap(
|
|
2729
|
+
sort: Ye[r ?? "score_desc"] ?? Ye.score_desc,
|
|
2730
|
+
selectedFacets: a?.flatMap(Me) ?? [],
|
|
2548
2731
|
sponsoredCount: o ?? void 0
|
|
2549
2732
|
};
|
|
2550
2733
|
if (p) {
|
|
2551
2734
|
const d = (await s.clients.commerce.catalog.products.crossselling({
|
|
2552
|
-
type:
|
|
2735
|
+
type: un[p.key],
|
|
2553
2736
|
productId: p.value
|
|
2554
2737
|
})).map((m) => m.productId).slice(0, n), g = s.clients.search.productsByIdentifier({ field: "id", values: d }).then((m) => ({
|
|
2555
2738
|
products: m,
|
|
@@ -2576,8 +2759,8 @@ const Vr = (e, n) => {
|
|
|
2576
2759
|
}));
|
|
2577
2760
|
return { searchArgs: h, productSearchPromise: g };
|
|
2578
2761
|
}
|
|
2579
|
-
const
|
|
2580
|
-
return { searchArgs: h, productSearchPromise:
|
|
2762
|
+
const f = s.clients.search.products(h);
|
|
2763
|
+
return { searchArgs: h, productSearchPromise: f };
|
|
2581
2764
|
},
|
|
2582
2765
|
allProducts: async (e, { first: n, after: t }, r) => {
|
|
2583
2766
|
const {
|
|
@@ -2622,28 +2805,45 @@ const Vr = (e, n) => {
|
|
|
2622
2805
|
} = r, a = t ? Number(t) : 0, [o, s] = await Promise.all([
|
|
2623
2806
|
i.catalog.brand.list(),
|
|
2624
2807
|
i.catalog.category.tree()
|
|
2625
|
-
]), c = [], l = (
|
|
2626
|
-
c.push({
|
|
2627
|
-
|
|
2628
|
-
|
|
2808
|
+
]), c = [], l = (f, v) => {
|
|
2809
|
+
c.push({
|
|
2810
|
+
id: f.id,
|
|
2811
|
+
name: f.name,
|
|
2812
|
+
fatherCategoryId: v,
|
|
2813
|
+
linkId: ae(f.name),
|
|
2814
|
+
title: f.Title,
|
|
2815
|
+
description: null,
|
|
2816
|
+
metaTagDescription: f.MetaTagDescription,
|
|
2817
|
+
availableLinkIds: null,
|
|
2818
|
+
entityType: "category",
|
|
2819
|
+
slug: new URL(f.url).pathname.slice(1).toLowerCase()
|
|
2820
|
+
});
|
|
2821
|
+
for (const d of f.children)
|
|
2822
|
+
l(d, f.id);
|
|
2629
2823
|
};
|
|
2630
|
-
for (const
|
|
2631
|
-
l(
|
|
2632
|
-
const
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2824
|
+
for (const f of s)
|
|
2825
|
+
l(f, null);
|
|
2826
|
+
const h = [...o.filter((f) => f.isActive).map((f) => ({
|
|
2827
|
+
id: f.id,
|
|
2828
|
+
name: f.name,
|
|
2829
|
+
linkId: ae(f.name),
|
|
2830
|
+
title: f.title,
|
|
2831
|
+
description: null,
|
|
2832
|
+
metaTagDescription: f.metaTagDescription,
|
|
2833
|
+
availableLinkIds: null,
|
|
2834
|
+
entityType: "brand"
|
|
2835
|
+
})), ...c].filter((f) => !!dn.slug(f, null, r, null));
|
|
2636
2836
|
return {
|
|
2637
2837
|
pageInfo: {
|
|
2638
|
-
hasNextPage:
|
|
2838
|
+
hasNextPage: h.length - a > n,
|
|
2639
2839
|
hasPreviousPage: a > 0,
|
|
2640
2840
|
startCursor: "0",
|
|
2641
|
-
endCursor: (Math.min(n,
|
|
2642
|
-
totalCount:
|
|
2841
|
+
endCursor: (Math.min(n, h.length - a) - 1).toString(),
|
|
2842
|
+
totalCount: h.length
|
|
2643
2843
|
},
|
|
2644
|
-
edges:
|
|
2645
|
-
node:
|
|
2646
|
-
cursor: (a +
|
|
2844
|
+
edges: h.slice(a, a + n).map((f, v) => ({
|
|
2845
|
+
node: f,
|
|
2846
|
+
cursor: (a + v).toString()
|
|
2647
2847
|
}))
|
|
2648
2848
|
};
|
|
2649
2849
|
},
|
|
@@ -2667,7 +2867,7 @@ const Vr = (e, n) => {
|
|
|
2667
2867
|
page: 1,
|
|
2668
2868
|
count: 1,
|
|
2669
2869
|
query: n ?? void 0,
|
|
2670
|
-
selectedFacets: t?.flatMap(
|
|
2870
|
+
selectedFacets: t?.flatMap(Me) ?? [],
|
|
2671
2871
|
allowRedirect: !0
|
|
2672
2872
|
});
|
|
2673
2873
|
return {
|
|
@@ -2715,11 +2915,11 @@ const Vr = (e, n) => {
|
|
|
2715
2915
|
clients: { commerce: r }
|
|
2716
2916
|
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
2717
2917
|
if (!i)
|
|
2718
|
-
throw new
|
|
2918
|
+
throw new $(`No order found for id ${n}`);
|
|
2719
2919
|
let a = null;
|
|
2720
2920
|
try {
|
|
2721
2921
|
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
2722
|
-
a =
|
|
2922
|
+
a = pn(c);
|
|
2723
2923
|
} catch {
|
|
2724
2924
|
}
|
|
2725
2925
|
const s = (await r.masterData.getShopperById({
|
|
@@ -2758,7 +2958,7 @@ const Vr = (e, n) => {
|
|
|
2758
2958
|
a = { message: i };
|
|
2759
2959
|
}
|
|
2760
2960
|
const o = a?.message || i;
|
|
2761
|
-
throw
|
|
2961
|
+
throw X(r) ? new $(`No order found for id ${n}. ${o}.`) : Qn(r) ? new J(
|
|
2762
2962
|
`You are forbidden to interact with order with id ${n}. ${o}.`
|
|
2763
2963
|
) : r;
|
|
2764
2964
|
}
|
|
@@ -2834,17 +3034,17 @@ const Vr = (e, n) => {
|
|
|
2834
3034
|
account: r,
|
|
2835
3035
|
headers: i,
|
|
2836
3036
|
clients: { commerce: a }
|
|
2837
|
-
} = t, s =
|
|
3037
|
+
} = t, s = Y(z(i?.cookie ?? "", r))?.userId ?? "", [c, l, p] = await Promise.all([
|
|
2838
3038
|
a.session("").catch(() => null),
|
|
2839
3039
|
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
2840
3040
|
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
2841
|
-
]), u = l?.[0], h = c?.namespaces.authentication ?? null,
|
|
3041
|
+
]), u = l?.[0], h = c?.namespaces.authentication ?? null, f = `${(u?.firstName ?? "").trim()} ${(u?.lastName ?? "").trim()}`.trim();
|
|
2842
3042
|
return {
|
|
2843
3043
|
username: h?.storeUserEmail?.value ?? "",
|
|
2844
|
-
name:
|
|
3044
|
+
name: f,
|
|
2845
3045
|
email: h?.storeUserEmail?.value ?? "",
|
|
2846
3046
|
phone: u?.phone ?? "",
|
|
2847
|
-
role: p?.Roles?.map((
|
|
3047
|
+
role: p?.Roles?.map((v) => v.Name) ?? [],
|
|
2848
3048
|
orgUnit: h?.unitName?.value ?? ""
|
|
2849
3049
|
};
|
|
2850
3050
|
},
|
|
@@ -2855,7 +3055,7 @@ const Vr = (e, n) => {
|
|
|
2855
3055
|
account: r,
|
|
2856
3056
|
headers: i,
|
|
2857
3057
|
clients: { commerce: a }
|
|
2858
|
-
} = t, o =
|
|
3058
|
+
} = t, o = Y(z(i?.cookie ?? "", r));
|
|
2859
3059
|
if (!o?.userId)
|
|
2860
3060
|
return null;
|
|
2861
3061
|
if (o?.isRepresentative) {
|
|
@@ -2866,7 +3066,7 @@ const Vr = (e, n) => {
|
|
|
2866
3066
|
contractId: l?.id?.value ?? ""
|
|
2867
3067
|
});
|
|
2868
3068
|
return {
|
|
2869
|
-
name:
|
|
3069
|
+
name: On(p, l) || "",
|
|
2870
3070
|
email: l?.email?.value || "",
|
|
2871
3071
|
id: l?.id?.value || ""
|
|
2872
3072
|
// createdAt: '',
|
|
@@ -2894,19 +3094,19 @@ const Vr = (e, n) => {
|
|
|
2894
3094
|
} = t, o = await a.session("").catch(() => null), s = z(i?.cookie ?? "", r);
|
|
2895
3095
|
let c = null;
|
|
2896
3096
|
try {
|
|
2897
|
-
c = s ?
|
|
3097
|
+
c = s ? Y(s) : null;
|
|
2898
3098
|
} catch {
|
|
2899
3099
|
c = null;
|
|
2900
3100
|
}
|
|
2901
3101
|
const l = o?.namespaces.authentication?.unitId?.value?.trim() ?? c?.unitId?.trim() ?? "";
|
|
2902
3102
|
if (!l || l !== n)
|
|
2903
|
-
throw new
|
|
3103
|
+
throw new J(
|
|
2904
3104
|
"You are not allowed to list contracts for this organization unit"
|
|
2905
3105
|
);
|
|
2906
|
-
const p =
|
|
3106
|
+
const p = Br(
|
|
2907
3107
|
o?.namespaces.shopper
|
|
2908
|
-
), u =
|
|
2909
|
-
return
|
|
3108
|
+
), u = Mr(o) || c?.customerId?.trim() || "";
|
|
3109
|
+
return zr(p, u);
|
|
2910
3110
|
},
|
|
2911
3111
|
pickupPoints: async (e, { geoCoordinates: n }, t) => {
|
|
2912
3112
|
const {
|
|
@@ -2916,10 +3116,10 @@ const Vr = (e, n) => {
|
|
|
2916
3116
|
geoCoordinates: n
|
|
2917
3117
|
});
|
|
2918
3118
|
},
|
|
2919
|
-
orderEntryOperation:
|
|
2920
|
-
orderFormItems:
|
|
2921
|
-
recommendations:
|
|
2922
|
-
},
|
|
3119
|
+
orderEntryOperation: ai,
|
|
3120
|
+
orderFormItems: oi,
|
|
3121
|
+
recommendations: ii
|
|
3122
|
+
}, pi = {
|
|
2923
3123
|
reviewRating: () => ({
|
|
2924
3124
|
ratingValue: 5,
|
|
2925
3125
|
bestRating: 5
|
|
@@ -2927,7 +3127,7 @@ const Vr = (e, n) => {
|
|
|
2927
3127
|
author: () => ({
|
|
2928
3128
|
name: ""
|
|
2929
3129
|
})
|
|
2930
|
-
},
|
|
3130
|
+
}, gi = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, mi = {
|
|
2931
3131
|
suggestions: async (e, n, t) => {
|
|
2932
3132
|
const {
|
|
2933
3133
|
clients: { search: r }
|
|
@@ -2944,7 +3144,7 @@ const Vr = (e, n) => {
|
|
|
2944
3144
|
r.suggestedTerms(i),
|
|
2945
3145
|
a
|
|
2946
3146
|
]), c = s.products.map((p) => {
|
|
2947
|
-
const u =
|
|
3147
|
+
const u = ce(p.items);
|
|
2948
3148
|
return u && N(u, p);
|
|
2949
3149
|
}).filter((p) => !!p), { searches: l } = o;
|
|
2950
3150
|
return {
|
|
@@ -2954,7 +3154,7 @@ const Vr = (e, n) => {
|
|
|
2954
3154
|
},
|
|
2955
3155
|
products: async ({ productSearchPromise: e }) => {
|
|
2956
3156
|
const n = await e, t = n.products.map((r) => {
|
|
2957
|
-
const i =
|
|
3157
|
+
const i = ce(r.items);
|
|
2958
3158
|
return i && N(i, r);
|
|
2959
3159
|
}).filter((r) => !!r);
|
|
2960
3160
|
return {
|
|
@@ -2978,7 +3178,7 @@ const Vr = (e, n) => {
|
|
|
2978
3178
|
t.storage.searchArgs = e;
|
|
2979
3179
|
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;
|
|
2980
3180
|
return i.filter(
|
|
2981
|
-
(l) => !a || !
|
|
3181
|
+
(l) => !a || !gi(l, o, s)
|
|
2982
3182
|
);
|
|
2983
3183
|
},
|
|
2984
3184
|
metadata: async ({ productSearchPromise: e }) => {
|
|
@@ -2990,12 +3190,12 @@ const Vr = (e, n) => {
|
|
|
2990
3190
|
};
|
|
2991
3191
|
},
|
|
2992
3192
|
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
2993
|
-
},
|
|
3193
|
+
}, hi = {
|
|
2994
3194
|
title: ({ title: e }) => e ?? "",
|
|
2995
3195
|
description: ({ description: e }) => e ?? "",
|
|
2996
3196
|
canonical: ({ canonical: e }) => e ?? "",
|
|
2997
3197
|
titleTemplate: () => ""
|
|
2998
|
-
},
|
|
3198
|
+
}, fi = ["bd", "d", "h", "m"], Si = (e) => fi.includes(e), yi = {
|
|
2999
3199
|
bd: {
|
|
3000
3200
|
0: "Today",
|
|
3001
3201
|
1: "In 1 business day",
|
|
@@ -3016,29 +3216,29 @@ const Vr = (e, n) => {
|
|
|
3016
3216
|
1: "In 1 minute",
|
|
3017
3217
|
other: "Up to # minutes"
|
|
3018
3218
|
}
|
|
3019
|
-
},
|
|
3020
|
-
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i =
|
|
3219
|
+
}, An = (e) => {
|
|
3220
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = Si(t);
|
|
3021
3221
|
if (!r || !i)
|
|
3022
3222
|
return "";
|
|
3023
3223
|
const a = Number(n) < 2 ? Number(n) : "other";
|
|
3024
|
-
return
|
|
3025
|
-
},
|
|
3224
|
+
return yi[t][a].replace("#", n) ?? "";
|
|
3225
|
+
}, Ii = {
|
|
3026
3226
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
3027
3227
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
3028
|
-
localizedEstimates: (e) => e?.shippingEstimate ?
|
|
3029
|
-
},
|
|
3030
|
-
function
|
|
3031
|
-
const t = `${
|
|
3228
|
+
localizedEstimates: (e) => e?.shippingEstimate ? An(e.shippingEstimate) : ""
|
|
3229
|
+
}, Je = "skuvariation";
|
|
3230
|
+
function Ke(e, n) {
|
|
3231
|
+
const t = `${Je}${n}`.toLowerCase(), r = e.find(
|
|
3032
3232
|
(a) => a.imageLabel === t
|
|
3033
3233
|
);
|
|
3034
3234
|
if (r)
|
|
3035
3235
|
return r;
|
|
3036
3236
|
const i = e.find(
|
|
3037
|
-
(a) => a.imageLabel ===
|
|
3237
|
+
(a) => a.imageLabel === Je
|
|
3038
3238
|
);
|
|
3039
3239
|
return i || e[0];
|
|
3040
3240
|
}
|
|
3041
|
-
function
|
|
3241
|
+
function vi(e, n, t) {
|
|
3042
3242
|
const r = {};
|
|
3043
3243
|
return e.forEach((i) => {
|
|
3044
3244
|
const a = i.variations;
|
|
@@ -3050,30 +3250,30 @@ function li(e, n, t) {
|
|
|
3050
3250
|
r[s] = `${t}-${i.itemId}`;
|
|
3051
3251
|
}), r;
|
|
3052
3252
|
}
|
|
3053
|
-
function
|
|
3253
|
+
function Qe(e) {
|
|
3054
3254
|
const n = {};
|
|
3055
3255
|
return e.forEach((t) => {
|
|
3056
3256
|
n[t.name] = t.values[0];
|
|
3057
3257
|
}), n;
|
|
3058
3258
|
}
|
|
3059
|
-
function
|
|
3259
|
+
function Oi(e) {
|
|
3060
3260
|
const n = {};
|
|
3061
3261
|
return e?.forEach((t) => {
|
|
3062
3262
|
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
3063
3263
|
}), n;
|
|
3064
3264
|
}
|
|
3065
|
-
function
|
|
3265
|
+
function Ci(e, n) {
|
|
3066
3266
|
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
3067
3267
|
}
|
|
3068
|
-
function
|
|
3268
|
+
function bi(e) {
|
|
3069
3269
|
const n = e;
|
|
3070
3270
|
for (const t in e)
|
|
3071
3271
|
e[t].every(
|
|
3072
3272
|
(i) => !Number.isNaN(Number(i.value))
|
|
3073
|
-
) && e[t].sort((i, a) =>
|
|
3273
|
+
) && e[t].sort((i, a) => Ci(i.value, a.value));
|
|
3074
3274
|
return n;
|
|
3075
3275
|
}
|
|
3076
|
-
function
|
|
3276
|
+
function wi(e, n, t) {
|
|
3077
3277
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
3078
3278
|
return e.forEach((a) => {
|
|
3079
3279
|
if (a.variations.length === 0)
|
|
@@ -3086,7 +3286,7 @@ function gi(e, n, t) {
|
|
|
3086
3286
|
if (!o || i.has(c))
|
|
3087
3287
|
return;
|
|
3088
3288
|
i.add(c);
|
|
3089
|
-
const l =
|
|
3289
|
+
const l = Ke(
|
|
3090
3290
|
a.images,
|
|
3091
3291
|
n
|
|
3092
3292
|
), p = {
|
|
@@ -3103,7 +3303,7 @@ function gi(e, n, t) {
|
|
|
3103
3303
|
if (i.has(l))
|
|
3104
3304
|
return;
|
|
3105
3305
|
i.add(l);
|
|
3106
|
-
const p =
|
|
3306
|
+
const p = Ke(
|
|
3107
3307
|
a.images,
|
|
3108
3308
|
c.name
|
|
3109
3309
|
), u = {
|
|
@@ -3114,46 +3314,46 @@ function gi(e, n, t) {
|
|
|
3114
3314
|
};
|
|
3115
3315
|
r[c.name] ? r[c.name].push(u) : r[c.name] = [u];
|
|
3116
3316
|
});
|
|
3117
|
-
}),
|
|
3317
|
+
}), bi(r);
|
|
3118
3318
|
}
|
|
3119
|
-
const
|
|
3120
|
-
activeVariations: (e) =>
|
|
3121
|
-
allVariantsByName: (e) =>
|
|
3122
|
-
slugsMap: (e, n) =>
|
|
3319
|
+
const Di = {
|
|
3320
|
+
activeVariations: (e) => Qe(e.variations),
|
|
3321
|
+
allVariantsByName: (e) => Oi(e.isVariantOf.skuSpecifications),
|
|
3322
|
+
slugsMap: (e, n) => vi(
|
|
3123
3323
|
e.isVariantOf.items,
|
|
3124
3324
|
n.dominantVariantName ?? e.variations[0]?.name,
|
|
3125
3325
|
e.isVariantOf.linkText
|
|
3126
3326
|
),
|
|
3127
3327
|
availableVariations: (e, n) => {
|
|
3128
|
-
const t = n.dominantVariantName ?? e.variations[0]?.name, i =
|
|
3129
|
-
return
|
|
3328
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = Qe(e.variations)[t];
|
|
3329
|
+
return wi(
|
|
3130
3330
|
e.isVariantOf.items,
|
|
3131
3331
|
t,
|
|
3132
3332
|
i
|
|
3133
3333
|
);
|
|
3134
3334
|
},
|
|
3135
3335
|
allVariantProducts: (e) => e.isVariantOf.items.map((n) => N(n, e.isVariantOf))
|
|
3136
|
-
},
|
|
3336
|
+
}, Ai = {
|
|
3137
3337
|
"pickup-in-point": "Pickup",
|
|
3138
3338
|
delivery: "Delivery",
|
|
3139
3339
|
pickup: "Pickup",
|
|
3140
3340
|
"take-away": "Take away",
|
|
3141
3341
|
"": ""
|
|
3142
|
-
},
|
|
3342
|
+
}, Pi = {
|
|
3143
3343
|
deliveryOptionsData: (e) => {
|
|
3144
3344
|
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
|
|
3145
3345
|
(l, p) => {
|
|
3146
|
-
const u = p?.selectedSla || "", h = p?.selectedDeliveryChannel || p?.deliveryChannel || "",
|
|
3147
|
-
(_) => _?.addressId ===
|
|
3148
|
-
), A = `${
|
|
3149
|
-
|
|
3150
|
-
),
|
|
3151
|
-
return l[
|
|
3346
|
+
const u = p?.selectedSla || "", h = p?.selectedDeliveryChannel || p?.deliveryChannel || "", f = p?.deliveryCompany || "", v = p?.deliveryWindow, d = p?.pickupStoreInfo, g = p?.shippingEstimate || "", m = p?.shippingEstimate ? An(p?.shippingEstimate) : "", y = p?.shippingEstimateDate || "", O = p?.addressId || "", w = p?.itemIndex ?? 0, C = t?.[w], P = C?.seller || "", S = `${u}|${h}|${f}|${P}|${g}|${y}|${O}|${v?.startDateUtc}|${v?.endDateUtc}`, D = i?.find(
|
|
3347
|
+
(_) => _?.addressId === O
|
|
3348
|
+
), A = `${Ai[h] || ""} ${m} ${D?.neighborhood ? `to ${D?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: U, taxPriceTags: b } = Ui(
|
|
3349
|
+
C?.priceTags ?? []
|
|
3350
|
+
), k = (C?.sellingPrice ?? 0) * (C?.quantity ?? 0) + (C?.tax ?? 0) + (U ?? 0);
|
|
3351
|
+
return l[S] || (l[S] = {
|
|
3152
3352
|
// static fields
|
|
3153
3353
|
selectedSla: u,
|
|
3154
3354
|
deliveryChannel: h,
|
|
3155
|
-
deliveryCompany:
|
|
3156
|
-
deliveryWindow:
|
|
3355
|
+
deliveryCompany: f,
|
|
3356
|
+
deliveryWindow: v,
|
|
3157
3357
|
shippingEstimate: g,
|
|
3158
3358
|
shippingEstimateDate: y,
|
|
3159
3359
|
seller: P,
|
|
@@ -3165,19 +3365,19 @@ const mi = {
|
|
|
3165
3365
|
quantityOfDifferentItems: 0,
|
|
3166
3366
|
total: 0,
|
|
3167
3367
|
items: []
|
|
3168
|
-
}), l[
|
|
3169
|
-
id:
|
|
3170
|
-
uniqueId:
|
|
3171
|
-
name:
|
|
3172
|
-
quantity:
|
|
3173
|
-
price:
|
|
3174
|
-
sellingPrice:
|
|
3175
|
-
imageUrl:
|
|
3176
|
-
taxPriceTags:
|
|
3368
|
+
}), l[S] && (l[S].items?.push({
|
|
3369
|
+
id: C?.id || "",
|
|
3370
|
+
uniqueId: C?.uniqueId || "",
|
|
3371
|
+
name: C?.name || "",
|
|
3372
|
+
quantity: C?.quantity || 0,
|
|
3373
|
+
price: C?.price || 0,
|
|
3374
|
+
sellingPrice: C?.sellingPrice || 0,
|
|
3375
|
+
imageUrl: C?.imageUrl || "",
|
|
3376
|
+
taxPriceTags: b ?? [],
|
|
3177
3377
|
taxPriceTagsTotal: U ?? 0,
|
|
3178
|
-
tax:
|
|
3179
|
-
total:
|
|
3180
|
-
}), l[
|
|
3378
|
+
tax: C?.tax || 0,
|
|
3379
|
+
total: k
|
|
3380
|
+
}), l[S].quantityOfDifferentItems = (l[S].quantityOfDifferentItems ?? 0) + 1, l[S].total = (l[S].total ?? 0) + k), l;
|
|
3181
3381
|
},
|
|
3182
3382
|
{}
|
|
3183
3383
|
), o = Object.values(a), s = n?.contactInformation?.[0], c = {
|
|
@@ -3203,7 +3403,7 @@ const mi = {
|
|
|
3203
3403
|
) || [];
|
|
3204
3404
|
}
|
|
3205
3405
|
};
|
|
3206
|
-
function
|
|
3406
|
+
function Ui(e) {
|
|
3207
3407
|
const t = e.filter(
|
|
3208
3408
|
(i) => i?.name?.includes("TAX")
|
|
3209
3409
|
), r = t.reduce(
|
|
@@ -3215,28 +3415,28 @@ function Si(e) {
|
|
|
3215
3415
|
taxPriceTagsTotal: r
|
|
3216
3416
|
};
|
|
3217
3417
|
}
|
|
3218
|
-
const
|
|
3219
|
-
StoreCollection:
|
|
3220
|
-
StoreAggregateOffer:
|
|
3221
|
-
StoreProduct:
|
|
3222
|
-
StoreSeo:
|
|
3223
|
-
StoreFacet:
|
|
3224
|
-
StoreFacetBoolean:
|
|
3225
|
-
StoreFacetRange:
|
|
3226
|
-
StoreFacetValueBoolean:
|
|
3227
|
-
StoreOffer:
|
|
3228
|
-
StoreAggregateRating:
|
|
3229
|
-
StoreReview:
|
|
3230
|
-
StoreProductGroup:
|
|
3231
|
-
StoreSearchResult:
|
|
3232
|
-
StorePropertyValue:
|
|
3233
|
-
SkuVariants:
|
|
3234
|
-
ShippingSLA:
|
|
3235
|
-
UserOrderResult:
|
|
3236
|
-
ObjectOrString:
|
|
3237
|
-
Query:
|
|
3238
|
-
Mutation:
|
|
3239
|
-
},
|
|
3418
|
+
const ki = {
|
|
3419
|
+
StoreCollection: dn,
|
|
3420
|
+
StoreAggregateOffer: er,
|
|
3421
|
+
StoreProduct: Zr,
|
|
3422
|
+
StoreSeo: hi,
|
|
3423
|
+
StoreFacet: lr,
|
|
3424
|
+
StoreFacetBoolean: dr,
|
|
3425
|
+
StoreFacetRange: ur,
|
|
3426
|
+
StoreFacetValueBoolean: pr,
|
|
3427
|
+
StoreOffer: Hr,
|
|
3428
|
+
StoreAggregateRating: nr,
|
|
3429
|
+
StoreReview: pi,
|
|
3430
|
+
StoreProductGroup: ni,
|
|
3431
|
+
StoreSearchResult: mi,
|
|
3432
|
+
StorePropertyValue: ti,
|
|
3433
|
+
SkuVariants: Di,
|
|
3434
|
+
ShippingSLA: Ii,
|
|
3435
|
+
UserOrderResult: Pi,
|
|
3436
|
+
ObjectOrString: Gr,
|
|
3437
|
+
Query: ui,
|
|
3438
|
+
Mutation: qr
|
|
3439
|
+
}, _i = () => ki, Ti = `"""
|
|
3240
3440
|
Address information.
|
|
3241
3441
|
"""
|
|
3242
3442
|
type Address {
|
|
@@ -3281,7 +3481,7 @@ type Address {
|
|
|
3281
3481
|
"""
|
|
3282
3482
|
geoCoordinates: [Float]
|
|
3283
3483
|
}
|
|
3284
|
-
`,
|
|
3484
|
+
`, Ei = `"""
|
|
3285
3485
|
Advertisement information about a specific product in a campaign
|
|
3286
3486
|
"""
|
|
3287
3487
|
type Advertisement {
|
|
@@ -3306,7 +3506,7 @@ type Advertisement {
|
|
|
3306
3506
|
"""
|
|
3307
3507
|
adResponseId: String!
|
|
3308
3508
|
}
|
|
3309
|
-
`,
|
|
3509
|
+
`, Ri = `"""
|
|
3310
3510
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
3311
3511
|
"""
|
|
3312
3512
|
type StoreAggregateOffer {
|
|
@@ -3335,7 +3535,7 @@ type StoreAggregateOffer {
|
|
|
3335
3535
|
"""
|
|
3336
3536
|
offers: [StoreOffer!]!
|
|
3337
3537
|
}
|
|
3338
|
-
`,
|
|
3538
|
+
`, Fi = `"""
|
|
3339
3539
|
Average rating, based on multiple ratings or reviews.
|
|
3340
3540
|
"""
|
|
3341
3541
|
type StoreAggregateRating {
|
|
@@ -3348,7 +3548,7 @@ type StoreAggregateRating {
|
|
|
3348
3548
|
"""
|
|
3349
3549
|
reviewCount: Int!
|
|
3350
3550
|
}
|
|
3351
|
-
`,
|
|
3551
|
+
`, Ni = `"""
|
|
3352
3552
|
information about the author of a product review or rating.
|
|
3353
3553
|
"""
|
|
3354
3554
|
type StoreAuthor {
|
|
@@ -3357,7 +3557,7 @@ type StoreAuthor {
|
|
|
3357
3557
|
"""
|
|
3358
3558
|
name: String!
|
|
3359
3559
|
}
|
|
3360
|
-
`,
|
|
3560
|
+
`, Li = `"""
|
|
3361
3561
|
Brand of a given product.
|
|
3362
3562
|
"""
|
|
3363
3563
|
type StoreBrand {
|
|
@@ -3366,7 +3566,7 @@ type StoreBrand {
|
|
|
3366
3566
|
"""
|
|
3367
3567
|
name: String!
|
|
3368
3568
|
}
|
|
3369
|
-
`,
|
|
3569
|
+
`, Bi = `"""
|
|
3370
3570
|
Item of a list.
|
|
3371
3571
|
"""
|
|
3372
3572
|
type StoreListItem {
|
|
@@ -3397,7 +3597,7 @@ type StoreBreadcrumbList {
|
|
|
3397
3597
|
"""
|
|
3398
3598
|
numberOfItems: Int!
|
|
3399
3599
|
}
|
|
3400
|
-
`,
|
|
3600
|
+
`, $i = `"""
|
|
3401
3601
|
Shopping cart message.
|
|
3402
3602
|
"""
|
|
3403
3603
|
type StoreCartMessage {
|
|
@@ -3434,8 +3634,11 @@ input IStoreCart {
|
|
|
3434
3634
|
"""
|
|
3435
3635
|
order: IStoreOrder!
|
|
3436
3636
|
}
|
|
3437
|
-
`,
|
|
3438
|
-
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand
|
|
3637
|
+
`, Mi = `"""
|
|
3638
|
+
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\` or \`Collection\`.
|
|
3639
|
+
|
|
3640
|
+
\`SubCategory\` and \`Cluster\` are still declared for backward compatibility but are
|
|
3641
|
+
deprecated and never returned.
|
|
3439
3642
|
"""
|
|
3440
3643
|
enum StoreCollectionType {
|
|
3441
3644
|
"""
|
|
@@ -3448,16 +3651,26 @@ enum StoreCollectionType {
|
|
|
3448
3651
|
Category
|
|
3449
3652
|
"""
|
|
3450
3653
|
Third level of product categorization.
|
|
3654
|
+
|
|
3655
|
+
Deprecated: never returned — third-level categories resolve as \`Category\`.
|
|
3451
3656
|
"""
|
|
3452
3657
|
SubCategory
|
|
3658
|
+
@deprecated(
|
|
3659
|
+
reason: "Never returned since the by-linkid migration: the category response only exposes \`fatherCategoryId\`, which distinguishes root from non-root but not tree depth, so third-level categories resolve as \`Category\`. Scheduled for removal in the next major."
|
|
3660
|
+
)
|
|
3453
3661
|
"""
|
|
3454
3662
|
Product brand.
|
|
3455
3663
|
"""
|
|
3456
3664
|
Brand
|
|
3457
3665
|
"""
|
|
3458
3666
|
Product cluster.
|
|
3667
|
+
|
|
3668
|
+
Deprecated: never returned — clusters resolve as \`Collection\`.
|
|
3459
3669
|
"""
|
|
3460
3670
|
Cluster
|
|
3671
|
+
@deprecated(
|
|
3672
|
+
reason: "Never returned since the by-linkid migration: clusters and curated collections are both served by \`collection/by-linkid\`, whose response carries no discriminator between them, so both resolve as \`Collection\`. Scheduled for removal in the next major."
|
|
3673
|
+
)
|
|
3461
3674
|
"""
|
|
3462
3675
|
Product collection.
|
|
3463
3676
|
"""
|
|
@@ -3516,8 +3729,27 @@ type StoreCollection {
|
|
|
3516
3729
|
Collection type.
|
|
3517
3730
|
"""
|
|
3518
3731
|
type: StoreCollectionType!
|
|
3732
|
+
"""
|
|
3733
|
+
Localized versions of this collection for all available locales.
|
|
3734
|
+
Only populated when localization is enabled.
|
|
3735
|
+
"""
|
|
3736
|
+
otherLocales: [StoreCollectionLocale!]
|
|
3519
3737
|
}
|
|
3520
|
-
|
|
3738
|
+
|
|
3739
|
+
"""
|
|
3740
|
+
Localized collection data for a specific locale.
|
|
3741
|
+
"""
|
|
3742
|
+
type StoreCollectionLocale {
|
|
3743
|
+
"""
|
|
3744
|
+
Locale code (e.g. "pt-BR", "it-IT").
|
|
3745
|
+
"""
|
|
3746
|
+
locale: String!
|
|
3747
|
+
"""
|
|
3748
|
+
Localized collection slug (e.g. "vestuario/camisetas").
|
|
3749
|
+
"""
|
|
3750
|
+
slug: String!
|
|
3751
|
+
}
|
|
3752
|
+
`, zi = `"""
|
|
3521
3753
|
Delivery Promise badge.
|
|
3522
3754
|
"""
|
|
3523
3755
|
type DeliveryPromiseBadge {
|
|
@@ -3526,7 +3758,7 @@ type DeliveryPromiseBadge {
|
|
|
3526
3758
|
"""
|
|
3527
3759
|
typeName: String
|
|
3528
3760
|
}
|
|
3529
|
-
`,
|
|
3761
|
+
`, Vi = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
3530
3762
|
|
|
3531
3763
|
"""
|
|
3532
3764
|
Search facet range information.
|
|
@@ -3603,7 +3835,7 @@ type StoreFacetValueBoolean {
|
|
|
3603
3835
|
"""
|
|
3604
3836
|
quantity: Int
|
|
3605
3837
|
}
|
|
3606
|
-
`,
|
|
3838
|
+
`, xi = `"""
|
|
3607
3839
|
Image.
|
|
3608
3840
|
"""
|
|
3609
3841
|
type StoreImage {
|
|
@@ -3630,7 +3862,7 @@ input IStoreImage {
|
|
|
3630
3862
|
"""
|
|
3631
3863
|
alternateName: String!
|
|
3632
3864
|
}
|
|
3633
|
-
`,
|
|
3865
|
+
`, qi = `type Mutation {
|
|
3634
3866
|
"""
|
|
3635
3867
|
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\`.
|
|
3636
3868
|
"""
|
|
@@ -3672,7 +3904,7 @@ input IStoreImage {
|
|
|
3672
3904
|
"""
|
|
3673
3905
|
startRecommendationSession: Boolean!
|
|
3674
3906
|
}
|
|
3675
|
-
`,
|
|
3907
|
+
`, ji = `"""
|
|
3676
3908
|
Newsletter information.
|
|
3677
3909
|
"""
|
|
3678
3910
|
type PersonNewsletter {
|
|
@@ -3695,8 +3927,8 @@ input IPersonNewsletter {
|
|
|
3695
3927
|
"""
|
|
3696
3928
|
email: String!
|
|
3697
3929
|
}
|
|
3698
|
-
`,
|
|
3699
|
-
`,
|
|
3930
|
+
`, Wi = `scalar ObjectOrString
|
|
3931
|
+
`, Gi = `"""
|
|
3700
3932
|
Offer information.
|
|
3701
3933
|
"""
|
|
3702
3934
|
type StoreOffer {
|
|
@@ -3779,7 +4011,7 @@ input IStoreOffer {
|
|
|
3779
4011
|
"""
|
|
3780
4012
|
quantity: Int!
|
|
3781
4013
|
}
|
|
3782
|
-
`,
|
|
4014
|
+
`, Hi = `"""
|
|
3783
4015
|
Information of a specific order.
|
|
3784
4016
|
"""
|
|
3785
4017
|
type StoreOrder {
|
|
@@ -3814,7 +4046,7 @@ input IStoreOrder {
|
|
|
3814
4046
|
"""
|
|
3815
4047
|
shouldSplitItem: Boolean
|
|
3816
4048
|
}
|
|
3817
|
-
`,
|
|
4049
|
+
`, Xi = `"""
|
|
3818
4050
|
Commercial Authorization response.
|
|
3819
4051
|
"""
|
|
3820
4052
|
type CommercialAuthorizationResponse {
|
|
@@ -4213,7 +4445,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
4213
4445
|
"""
|
|
4214
4446
|
rule: CommercialAuthorizationRule!
|
|
4215
4447
|
}
|
|
4216
|
-
`,
|
|
4448
|
+
`, Yi = `"""
|
|
4217
4449
|
Input for uploading a file to the Order Entry Service.
|
|
4218
4450
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
4219
4451
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -4274,7 +4506,7 @@ type StoreOrderFormCartItem {
|
|
|
4274
4506
|
seller: String!
|
|
4275
4507
|
unitMultiplier: Float
|
|
4276
4508
|
}
|
|
4277
|
-
`,
|
|
4509
|
+
`, Ji = `"""
|
|
4278
4510
|
Organization.
|
|
4279
4511
|
"""
|
|
4280
4512
|
type StoreOrganization {
|
|
@@ -4311,7 +4543,7 @@ type StoreContract {
|
|
|
4311
4543
|
"""
|
|
4312
4544
|
isActive: Boolean!
|
|
4313
4545
|
}
|
|
4314
|
-
`,
|
|
4546
|
+
`, Ki = `"""
|
|
4315
4547
|
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.
|
|
4316
4548
|
"""
|
|
4317
4549
|
type StorePageInfo {
|
|
@@ -4336,7 +4568,7 @@ type StorePageInfo {
|
|
|
4336
4568
|
"""
|
|
4337
4569
|
totalCount: Int!
|
|
4338
4570
|
}
|
|
4339
|
-
`,
|
|
4571
|
+
`, Qi = `"""
|
|
4340
4572
|
Input type for setting a new password.
|
|
4341
4573
|
"""
|
|
4342
4574
|
input ISetPassword {
|
|
@@ -4379,7 +4611,7 @@ type SetPasswordResponse {
|
|
|
4379
4611
|
"""
|
|
4380
4612
|
message: String
|
|
4381
4613
|
}
|
|
4382
|
-
`,
|
|
4614
|
+
`, Zi = `"""
|
|
4383
4615
|
Client profile data.
|
|
4384
4616
|
"""
|
|
4385
4617
|
type StorePerson {
|
|
@@ -4422,7 +4654,7 @@ input IStorePerson {
|
|
|
4422
4654
|
"""
|
|
4423
4655
|
familyName: String!
|
|
4424
4656
|
}
|
|
4425
|
-
`,
|
|
4657
|
+
`, ea = `type PickupPointAddress {
|
|
4426
4658
|
"""
|
|
4427
4659
|
Address city.
|
|
4428
4660
|
"""
|
|
@@ -4501,7 +4733,7 @@ type PickupPoints {
|
|
|
4501
4733
|
"""
|
|
4502
4734
|
pickupPointsHash: String
|
|
4503
4735
|
}
|
|
4504
|
-
`,
|
|
4736
|
+
`, na = `"""
|
|
4505
4737
|
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.
|
|
4506
4738
|
"""
|
|
4507
4739
|
type StoreProduct {
|
|
@@ -4597,6 +4829,25 @@ type StoreProduct {
|
|
|
4597
4829
|
Delivery Promise product's badge.
|
|
4598
4830
|
"""
|
|
4599
4831
|
deliveryPromiseBadges: [DeliveryPromiseBadge]
|
|
4832
|
+
"""
|
|
4833
|
+
Localized versions of this product for all available locales.
|
|
4834
|
+
Only populated when localization is enabled.
|
|
4835
|
+
"""
|
|
4836
|
+
otherLocales: [StoreProductLocale!]
|
|
4837
|
+
}
|
|
4838
|
+
|
|
4839
|
+
"""
|
|
4840
|
+
Localized product data for a specific locale.
|
|
4841
|
+
"""
|
|
4842
|
+
type StoreProductLocale {
|
|
4843
|
+
"""
|
|
4844
|
+
Locale code (e.g. "pt-BR", "it-IT").
|
|
4845
|
+
"""
|
|
4846
|
+
locale: String!
|
|
4847
|
+
"""
|
|
4848
|
+
Localized product slug including the SKU ID suffix (e.g. "adidas-polo-uomo-65").
|
|
4849
|
+
"""
|
|
4850
|
+
slug: String!
|
|
4600
4851
|
}
|
|
4601
4852
|
|
|
4602
4853
|
type SkuSpecification {
|
|
@@ -4650,7 +4901,7 @@ input IStoreProduct {
|
|
|
4650
4901
|
"""
|
|
4651
4902
|
additionalProperty: [IStorePropertyValue!]
|
|
4652
4903
|
}
|
|
4653
|
-
`,
|
|
4904
|
+
`, ta = `"""
|
|
4654
4905
|
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.
|
|
4655
4906
|
"""
|
|
4656
4907
|
type StoreProductGroup {
|
|
@@ -4677,7 +4928,7 @@ type StoreProductGroup {
|
|
|
4677
4928
|
"""
|
|
4678
4929
|
skuVariants: SkuVariants
|
|
4679
4930
|
}
|
|
4680
|
-
`,
|
|
4931
|
+
`, ra = `type Profile {
|
|
4681
4932
|
"""
|
|
4682
4933
|
Collection of user's address
|
|
4683
4934
|
"""
|
|
@@ -4738,7 +4989,7 @@ type ProfileAddress {
|
|
|
4738
4989
|
"""
|
|
4739
4990
|
geoCoordinate: [Float]
|
|
4740
4991
|
}
|
|
4741
|
-
`,
|
|
4992
|
+
`, ia = `"""
|
|
4742
4993
|
Properties that can be associated with products and products groups.
|
|
4743
4994
|
"""
|
|
4744
4995
|
type StorePropertyValue {
|
|
@@ -4778,7 +5029,7 @@ input IStorePropertyValue {
|
|
|
4778
5029
|
"""
|
|
4779
5030
|
valueReference: ObjectOrString!
|
|
4780
5031
|
}
|
|
4781
|
-
`,
|
|
5032
|
+
`, aa = `"""
|
|
4782
5033
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
4783
5034
|
"""
|
|
4784
5035
|
type StoreProductEdge {
|
|
@@ -5408,7 +5659,7 @@ type StoreAccountProfile {
|
|
|
5408
5659
|
email: String
|
|
5409
5660
|
id: String
|
|
5410
5661
|
}
|
|
5411
|
-
`,
|
|
5662
|
+
`, oa = `"""
|
|
5412
5663
|
Summary of a quote returned in list results.
|
|
5413
5664
|
"""
|
|
5414
5665
|
type UserQuoteSummary {
|
|
@@ -5473,7 +5724,7 @@ type UserQuoteListPaging {
|
|
|
5473
5724
|
"""
|
|
5474
5725
|
perPage: Int!
|
|
5475
5726
|
}
|
|
5476
|
-
`,
|
|
5727
|
+
`, sa = `type RecommendationResponse {
|
|
5477
5728
|
products: [StoreProduct!]!
|
|
5478
5729
|
correlationId: String!
|
|
5479
5730
|
campaign: RecommendationCampaign!
|
|
@@ -5484,7 +5735,7 @@ type RecommendationCampaign {
|
|
|
5484
5735
|
title: String
|
|
5485
5736
|
type: String!
|
|
5486
5737
|
}
|
|
5487
|
-
`,
|
|
5738
|
+
`, ca = `"""
|
|
5488
5739
|
Information of a given review rating.
|
|
5489
5740
|
"""
|
|
5490
5741
|
type StoreReviewRating {
|
|
@@ -5511,7 +5762,7 @@ type StoreReview {
|
|
|
5511
5762
|
"""
|
|
5512
5763
|
author: StoreAuthor!
|
|
5513
5764
|
}
|
|
5514
|
-
`,
|
|
5765
|
+
`, la = `"""
|
|
5515
5766
|
Search Engine Optimization (SEO) tags data.
|
|
5516
5767
|
"""
|
|
5517
5768
|
type StoreSeo {
|
|
@@ -5532,7 +5783,7 @@ type StoreSeo {
|
|
|
5532
5783
|
"""
|
|
5533
5784
|
canonical: String!
|
|
5534
5785
|
}
|
|
5535
|
-
`,
|
|
5786
|
+
`, da = `"""
|
|
5536
5787
|
Currency information.
|
|
5537
5788
|
"""
|
|
5538
5789
|
type StoreCurrency {
|
|
@@ -5807,7 +6058,7 @@ input IStoreSession {
|
|
|
5807
6058
|
"""
|
|
5808
6059
|
refreshAfter: String
|
|
5809
6060
|
}
|
|
5810
|
-
`,
|
|
6061
|
+
`, ua = `"""
|
|
5811
6062
|
Shipping Simulation item input.
|
|
5812
6063
|
"""
|
|
5813
6064
|
input IShippingItem {
|
|
@@ -6138,7 +6389,7 @@ type MessageFields {
|
|
|
6138
6389
|
"""
|
|
6139
6390
|
skuName: String
|
|
6140
6391
|
}
|
|
6141
|
-
`,
|
|
6392
|
+
`, pa = `type SkuVariants {
|
|
6142
6393
|
"""
|
|
6143
6394
|
SKU property values for the current SKU.
|
|
6144
6395
|
"""
|
|
@@ -6233,7 +6484,7 @@ Example:
|
|
|
6233
6484
|
\`\`\`
|
|
6234
6485
|
"""
|
|
6235
6486
|
scalar FormattedVariants
|
|
6236
|
-
`,
|
|
6487
|
+
`, ga = `"""
|
|
6237
6488
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
6238
6489
|
"""
|
|
6239
6490
|
enum StoreStatus {
|
|
@@ -6241,7 +6492,7 @@ enum StoreStatus {
|
|
|
6241
6492
|
WARNING
|
|
6242
6493
|
ERROR
|
|
6243
6494
|
}
|
|
6244
|
-
`,
|
|
6495
|
+
`, ma = `scalar JSONObject
|
|
6245
6496
|
|
|
6246
6497
|
type UserOrder {
|
|
6247
6498
|
orderId: String
|
|
@@ -7065,97 +7316,97 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
7065
7316
|
type: String
|
|
7066
7317
|
id: String
|
|
7067
7318
|
}
|
|
7068
|
-
`,
|
|
7069
|
-
"./address.graphql":
|
|
7070
|
-
"./advertisement.graphql":
|
|
7071
|
-
"./aggregateOffer.graphql":
|
|
7072
|
-
"./aggregateRating.graphql":
|
|
7073
|
-
"./author.graphql":
|
|
7074
|
-
"./brand.graphql":
|
|
7075
|
-
"./breadcrumb.graphql":
|
|
7076
|
-
"./cart.graphql":
|
|
7077
|
-
"./collection.graphql":
|
|
7078
|
-
"./deliveryPromisesBadge.graphql":
|
|
7079
|
-
"./facet.graphql":
|
|
7080
|
-
"./image.graphql":
|
|
7081
|
-
"./mutation.graphql":
|
|
7082
|
-
"./newsletter.graphql":
|
|
7083
|
-
"./objectOrString.graphql":
|
|
7084
|
-
"./offer.graphql":
|
|
7085
|
-
"./order.graphql":
|
|
7086
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
7087
|
-
"./orderEntry.graphql":
|
|
7088
|
-
"./organization.graphql":
|
|
7089
|
-
"./pageInfo.graphql":
|
|
7090
|
-
"./password.graphql":
|
|
7091
|
-
"./person.graphql":
|
|
7092
|
-
"./pickupPoints.graphql":
|
|
7093
|
-
"./product.graphql":
|
|
7094
|
-
"./productGroup.graphql":
|
|
7095
|
-
"./profile.graphql":
|
|
7096
|
-
"./propertyValue.graphql":
|
|
7097
|
-
"./query.graphql":
|
|
7098
|
-
"./quote.graphql":
|
|
7099
|
-
"./recommendation.graphql":
|
|
7100
|
-
"./review.graphql":
|
|
7101
|
-
"./seo.graphql":
|
|
7102
|
-
"./session.graphql":
|
|
7103
|
-
"./shipping.graphql":
|
|
7104
|
-
"./skuVariants.graphql":
|
|
7105
|
-
"./status.graphql":
|
|
7106
|
-
"./userOrder.graphql":
|
|
7107
|
-
}),
|
|
7108
|
-
Object.values(
|
|
7109
|
-
(e, n) =>
|
|
7319
|
+
`, ha = /* @__PURE__ */ Object.assign({
|
|
7320
|
+
"./address.graphql": Ti,
|
|
7321
|
+
"./advertisement.graphql": Ei,
|
|
7322
|
+
"./aggregateOffer.graphql": Ri,
|
|
7323
|
+
"./aggregateRating.graphql": Fi,
|
|
7324
|
+
"./author.graphql": Ni,
|
|
7325
|
+
"./brand.graphql": Li,
|
|
7326
|
+
"./breadcrumb.graphql": Bi,
|
|
7327
|
+
"./cart.graphql": $i,
|
|
7328
|
+
"./collection.graphql": Mi,
|
|
7329
|
+
"./deliveryPromisesBadge.graphql": zi,
|
|
7330
|
+
"./facet.graphql": Vi,
|
|
7331
|
+
"./image.graphql": xi,
|
|
7332
|
+
"./mutation.graphql": qi,
|
|
7333
|
+
"./newsletter.graphql": ji,
|
|
7334
|
+
"./objectOrString.graphql": Wi,
|
|
7335
|
+
"./offer.graphql": Gi,
|
|
7336
|
+
"./order.graphql": Hi,
|
|
7337
|
+
"./orderCommercialAuthorizaton.graphql": Xi,
|
|
7338
|
+
"./orderEntry.graphql": Yi,
|
|
7339
|
+
"./organization.graphql": Ji,
|
|
7340
|
+
"./pageInfo.graphql": Ki,
|
|
7341
|
+
"./password.graphql": Qi,
|
|
7342
|
+
"./person.graphql": Zi,
|
|
7343
|
+
"./pickupPoints.graphql": ea,
|
|
7344
|
+
"./product.graphql": na,
|
|
7345
|
+
"./productGroup.graphql": ta,
|
|
7346
|
+
"./profile.graphql": ra,
|
|
7347
|
+
"./propertyValue.graphql": ia,
|
|
7348
|
+
"./query.graphql": aa,
|
|
7349
|
+
"./quote.graphql": oa,
|
|
7350
|
+
"./recommendation.graphql": sa,
|
|
7351
|
+
"./review.graphql": ca,
|
|
7352
|
+
"./seo.graphql": la,
|
|
7353
|
+
"./session.graphql": da,
|
|
7354
|
+
"./shipping.graphql": ua,
|
|
7355
|
+
"./skuVariants.graphql": pa,
|
|
7356
|
+
"./status.graphql": ga,
|
|
7357
|
+
"./userOrder.graphql": ma
|
|
7358
|
+
}), fa = Tn(
|
|
7359
|
+
Object.values(ha).map((e) => En(e)).reduce(
|
|
7360
|
+
(e, n) => Ze([e, n], { sort: !0 })
|
|
7110
7361
|
)
|
|
7111
|
-
),
|
|
7112
|
-
|
|
7362
|
+
), Sa = fa, Na = async (e) => L.context.with(
|
|
7363
|
+
L.propagation.extract(L.context.active(), e.OTEL),
|
|
7113
7364
|
() => (n) => (n.storage = {
|
|
7114
|
-
channel:
|
|
7365
|
+
channel: oe.parse(e.channel),
|
|
7115
7366
|
flags: e.flags ?? {},
|
|
7116
7367
|
locale: e.locale,
|
|
7117
7368
|
cookies: /* @__PURE__ */ new Map()
|
|
7118
|
-
}, n.
|
|
7369
|
+
}, n.account = e.account, n.OTEL = e.OTEL, n.discoveryConfig = e.discoveryConfig, n.clients = zt(e, n), n.loaders = Jt(e, n), n)
|
|
7119
7370
|
);
|
|
7120
|
-
function
|
|
7121
|
-
const e =
|
|
7371
|
+
function ya() {
|
|
7372
|
+
const e = _i(), n = {};
|
|
7122
7373
|
for (const [t, r] of Object.entries(e))
|
|
7123
7374
|
n[t] = Object.fromEntries(
|
|
7124
|
-
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i,
|
|
7375
|
+
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, Kn(a, `${t}(${i})`)])
|
|
7125
7376
|
);
|
|
7126
7377
|
return n;
|
|
7127
7378
|
}
|
|
7128
|
-
function
|
|
7129
|
-
const t =
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
])(
|
|
7133
|
-
return e &&
|
|
7379
|
+
function La(e) {
|
|
7380
|
+
const t = Jn([
|
|
7381
|
+
Yn,
|
|
7382
|
+
Gn
|
|
7383
|
+
])(ya(), Sa);
|
|
7384
|
+
return e && Rn(e) ? kn({
|
|
7134
7385
|
schemas: [t, e]
|
|
7135
7386
|
}) : t;
|
|
7136
7387
|
}
|
|
7137
7388
|
export {
|
|
7138
|
-
|
|
7389
|
+
Gn as AuthDirective,
|
|
7139
7390
|
T as BadRequestError,
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7391
|
+
Yn as CacheControlDirective,
|
|
7392
|
+
Bn as CommercialAuthorizationStatus,
|
|
7393
|
+
ee as FastStoreError,
|
|
7394
|
+
J as ForbiddenError,
|
|
7395
|
+
Na as GraphqlVtexContextFactory,
|
|
7396
|
+
La as GraphqlVtexSchema,
|
|
7397
|
+
$ as NotFoundError,
|
|
7398
|
+
$n as StoreCollectionType,
|
|
7399
|
+
Mn as StoreFacetType,
|
|
7400
|
+
zn as StoreSort,
|
|
7401
|
+
Vn as StoreStatus,
|
|
7402
|
+
te as UnauthorizedError,
|
|
7403
|
+
xn as UserOrderInvoiceType,
|
|
7404
|
+
Ra as isBadRequestError,
|
|
7405
|
+
Ea as isFastStoreError,
|
|
7406
|
+
Qn as isForbiddenError,
|
|
7407
|
+
X as isNotFoundError,
|
|
7408
|
+
Fa as isUnauthorizedError,
|
|
7409
|
+
Ta as stringifyCacheControl,
|
|
7410
|
+
Sa as typeDefs,
|
|
7411
|
+
Jn as withDirectives
|
|
7161
7412
|
};
|