@faststore/api 4.9.3-dev.2 → 4.10.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +65 -50
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +922 -884
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/__generated__/schema.d.ts +8 -2
- package/dist/src/__generated__/schema.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts +0 -2
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/index.d.ts +1 -1
- package/dist/src/platforms/vtex/clients/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/search/index.d.ts +27 -0
- package/dist/src/platforms/vtex/clients/search/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/index.d.ts +22 -1
- package/dist/src/platforms/vtex/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/getOrderEntryOperation.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/index.d.ts +22 -1
- package/dist/src/platforms/vtex/resolvers/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts +22 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts.map +1 -1
- package/dist/src/platforms/vtex/utils/intelligentSearchRequest.d.ts +7 -1
- package/dist/src/platforms/vtex/utils/intelligentSearchRequest.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/__generated__/schema.ts +8 -2
- package/src/platforms/vtex/clients/commerce/index.ts +0 -25
- package/src/platforms/vtex/clients/search/index.ts +49 -0
- package/src/platforms/vtex/resolvers/query.ts +19 -5
- package/src/platforms/vtex/typeDefs/pickupPoints.graphql +4 -1
- package/src/platforms/vtex/typeDefs/query.graphql +15 -3
- package/src/platforms/vtex/utils/intelligentSearchRequest.ts +96 -0
- package/dist/src/platforms/vtex/clients/commerce/types/PickupPoints.d.ts +0 -37
- package/dist/src/platforms/vtex/clients/commerce/types/PickupPoints.d.ts.map +0 -1
- package/src/platforms/vtex/clients/commerce/types/PickupPoints.ts +0 -40
package/dist/es/index.mjs
CHANGED
|
@@ -1,152 +1,152 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
4
|
-
import { GraphQLScalarType as
|
|
5
|
-
import { logger as
|
|
6
|
-
import
|
|
7
|
-
import { parse as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
1
|
+
import { mergeTypeDefs as un } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as Kn, mergeSchemas as Qn } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as pn, MapperKind as gn, getDirective as mn } from "@graphql-tools/utils";
|
|
4
|
+
import { GraphQLScalarType as Zn, print as et, parse as nt, isSchema as tt } from "graphql";
|
|
5
|
+
import { logger as rt, OTELAPI as W } from "@faststore/diagnostics";
|
|
6
|
+
import it from "isomorphic-unfetch";
|
|
7
|
+
import { parse as ie } from "cookie";
|
|
8
|
+
import Ue from "p-limit";
|
|
9
|
+
import fe from "dataloader";
|
|
10
|
+
import at from "sanitize-html";
|
|
11
11
|
import _e from "fast-deep-equal";
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const
|
|
12
|
+
import ot from "node:crypto";
|
|
13
|
+
var st = /* @__PURE__ */ ((e) => (e.Personal = "personal", e.Shared = "shared", e))(st || {}), ct = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(ct || {}), lt = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(lt || {}), dt = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(dt || {}), ut = /* @__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))(ut || {}), pt = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(pt || {}), gt = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(gt || {});
|
|
14
|
+
const mt = () => 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 te("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
|
+
}, ht = 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 de("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 de("Authentication required") : r === 403 ? new te("You are not allowed to access this resource") : new de("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, ft = "auth", St = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (e) =>
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
36
|
+
transformer: (e) => pn(e, {
|
|
37
|
+
[gn.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (mn(e, n, ft)?.[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 ht(o), r?.(i, a, o, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, yt = "cacheControl", Uo = (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
|
+
}, Fe = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, It = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, vt = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (e) =>
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (e) => pn(e, {
|
|
55
|
+
[gn.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = mn(e, n, yt)?.[0];
|
|
57
57
|
if (t) {
|
|
58
58
|
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
|
|
59
59
|
n.resolve = (s, c, d, g) => (d.cacheControl = {
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
60
|
+
sMaxAge: Fe(d.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: Fe(
|
|
62
62
|
d.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
65
|
+
scope: It(d.cacheControl?.scope, a)
|
|
66
66
|
}, o?.(s, c, d, g));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
71
|
+
}, Ot = (e) => (n, t) => {
|
|
72
|
+
const r = un([
|
|
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
|
+
Kn({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
},
|
|
84
|
-
name:
|
|
85
|
-
version:
|
|
86
|
-
},
|
|
83
|
+
}, hn = "@faststore/api", fn = "4.10.0-dev.0", Ne = {
|
|
84
|
+
name: hn,
|
|
85
|
+
version: fn
|
|
86
|
+
}, Sn = rt("@faststore/api"), Ct = (e, n = "Unknown Graphql Resolver") => (t, r, i, a) => {
|
|
87
87
|
if (!i?.OTEL_ENABLED)
|
|
88
88
|
return e(t, r, i, a);
|
|
89
|
-
const o =
|
|
90
|
-
kind:
|
|
89
|
+
const o = W.trace.getTracer("Graphql").startSpan(n, {
|
|
90
|
+
kind: W.SpanKind.INTERNAL,
|
|
91
91
|
attributes: {
|
|
92
92
|
timestamp: Date.now(),
|
|
93
|
-
"@faststore_version":
|
|
94
|
-
"@faststore_package_name":
|
|
93
|
+
"@faststore_version": fn,
|
|
94
|
+
"@faststore_package_name": hn,
|
|
95
95
|
"@faststore_account_name": i.account,
|
|
96
96
|
"@faststore_environment": process.env.NODE_ENV,
|
|
97
97
|
"@faststore_resolver_parent_type": a?.parentType?.name,
|
|
98
98
|
"@faststore_resolver_field_name": a?.fieldName
|
|
99
99
|
}
|
|
100
|
-
}), s =
|
|
100
|
+
}), s = W.trace.setSpan(W.context.active(), o);
|
|
101
101
|
try {
|
|
102
|
-
const c =
|
|
102
|
+
const c = W.context.with(
|
|
103
103
|
s,
|
|
104
104
|
() => e(t, r, i, a)
|
|
105
105
|
);
|
|
106
106
|
return c instanceof Promise ? c.then(
|
|
107
107
|
(d) => (o.end(), d),
|
|
108
|
-
(d) =>
|
|
108
|
+
(d) => Le(d, o, n)
|
|
109
109
|
) : (o.end(), c);
|
|
110
110
|
} catch (c) {
|
|
111
|
-
return
|
|
111
|
+
return Le(c, o, n);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
function
|
|
115
|
-
throw n.setStatus({ code:
|
|
116
|
-
%o`, e),
|
|
114
|
+
function Le(e, n, t) {
|
|
115
|
+
throw n.setStatus({ code: W.SpanStatusCode.ERROR }), n.recordException(e), n.end(), console.error(`Error at resolver: ${t}:
|
|
116
|
+
%o`, e), Sn("error", `Error at resolver: %s
|
|
117
117
|
%o`, t, e), e;
|
|
118
118
|
}
|
|
119
|
-
class
|
|
119
|
+
class J extends Error {
|
|
120
120
|
constructor(n, t) {
|
|
121
121
|
super(t), this.extensions = n, this.name = "FastStoreError";
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
class
|
|
124
|
+
class U extends J {
|
|
125
125
|
constructor(n) {
|
|
126
126
|
super({ status: 400, type: "BadRequestError" }, n);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
class
|
|
129
|
+
class de extends J {
|
|
130
130
|
constructor(n) {
|
|
131
131
|
super({ status: 401, type: "UnauthorizedError" }, n);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
class
|
|
134
|
+
class te extends J {
|
|
135
135
|
constructor(n) {
|
|
136
136
|
super({ status: 403, type: "ForbiddenError" }, n);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
class z extends
|
|
139
|
+
class z extends J {
|
|
140
140
|
constructor(n) {
|
|
141
141
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
const r = await
|
|
144
|
+
const _o = (e) => e?.name === "FastStoreError", Ro = (e) => e?.extensions?.type === "BadRequestError", To = (e) => e?.extensions?.type === "UnauthorizedError", bt = (e) => e?.extensions?.type === "ForbiddenError", ee = (e) => e?.extensions?.type === "NotFoundError", wt = `${Ne.name}@${Ne.version}`, y = async (e, n, t) => {
|
|
145
|
+
const r = await it(e, {
|
|
146
146
|
...n,
|
|
147
147
|
headers: {
|
|
148
148
|
...n?.headers ?? {},
|
|
149
|
-
"User-Agent":
|
|
149
|
+
"User-Agent": wt
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
if (r.ok)
|
|
@@ -156,21 +156,21 @@ const ko = (e) => e?.name === "FastStoreError", _o = (e) => e?.extensions?.type
|
|
|
156
156
|
if (typeof r?.status == "number")
|
|
157
157
|
switch (r.status) {
|
|
158
158
|
case 400:
|
|
159
|
-
throw new
|
|
159
|
+
throw new U(i);
|
|
160
160
|
case 401:
|
|
161
|
-
throw new
|
|
161
|
+
throw new de(i);
|
|
162
162
|
case 403:
|
|
163
|
-
throw new
|
|
163
|
+
throw new te(i);
|
|
164
164
|
case 404:
|
|
165
165
|
throw new z(i);
|
|
166
166
|
default:
|
|
167
|
-
throw new
|
|
167
|
+
throw new J(
|
|
168
168
|
{ status: r.status, type: "UnknownError" },
|
|
169
169
|
i
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
throw new Error(i);
|
|
173
|
-
},
|
|
173
|
+
}, At = ({ account: e, environment: n }) => {
|
|
174
174
|
const t = `https://${e}.${n}.com.br`;
|
|
175
175
|
return {
|
|
176
176
|
getLocalizedProduct: (r, i) => y(`${t}/api/catalog-dataplane/product/${r}`, {
|
|
@@ -181,7 +181,7 @@ const ko = (e) => e?.name === "FastStoreError", _o = (e) => e?.extensions?.type
|
|
|
181
181
|
}
|
|
182
182
|
})
|
|
183
183
|
};
|
|
184
|
-
},
|
|
184
|
+
}, yn = (e) => {
|
|
185
185
|
if (!e)
|
|
186
186
|
return e;
|
|
187
187
|
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
@@ -195,8 +195,8 @@ const ko = (e) => e?.name === "FastStoreError", _o = (e) => e?.extensions?.type
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
198
|
-
},
|
|
199
|
-
const t = n.match(
|
|
198
|
+
}, Dt = /^([^=]+)=([^;]*)/, Pt = (e, n) => {
|
|
199
|
+
const t = n.match(Dt);
|
|
200
200
|
if (t) {
|
|
201
201
|
const r = t[1], i = t[2];
|
|
202
202
|
e.storage.cookies.set(r, {
|
|
@@ -204,39 +204,39 @@ const ko = (e) => e?.name === "FastStoreError", _o = (e) => e?.extensions?.type
|
|
|
204
204
|
setCookie: n
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
},
|
|
207
|
+
}, kt = (e, n) => {
|
|
208
208
|
n.getSetCookie().forEach(
|
|
209
|
-
(t) =>
|
|
209
|
+
(t) => Pt(e, t)
|
|
210
210
|
);
|
|
211
|
-
},
|
|
211
|
+
}, Et = (e) => (n) => kt(e, n), Ie = (e) => {
|
|
212
212
|
if (!e.headers?.cookie)
|
|
213
213
|
return null;
|
|
214
|
-
const n =
|
|
214
|
+
const n = yn(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
215
215
|
return t.length === 0 ? n : t.reduce(
|
|
216
|
-
(r, [i, { value: a }]) =>
|
|
216
|
+
(r, [i, { value: a }]) => Ut(
|
|
217
217
|
r,
|
|
218
218
|
i,
|
|
219
219
|
a
|
|
220
220
|
),
|
|
221
221
|
n
|
|
222
222
|
);
|
|
223
|
-
},
|
|
224
|
-
const r =
|
|
223
|
+
}, In = (e) => function(t) {
|
|
224
|
+
const r = Ie(e);
|
|
225
225
|
return r ? {
|
|
226
226
|
...t,
|
|
227
227
|
cookie: r
|
|
228
228
|
} : t;
|
|
229
229
|
}, $ = (e, n) => {
|
|
230
|
-
const t =
|
|
231
|
-
return
|
|
232
|
-
},
|
|
230
|
+
const t = yn(e);
|
|
231
|
+
return ie(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
232
|
+
}, Ut = (e, n, t) => {
|
|
233
233
|
const r = new RegExp(`(${n})=([^;]*)`), i = e.match(r);
|
|
234
234
|
return i ? e.replace(
|
|
235
235
|
i[0],
|
|
236
236
|
`${i[1]}=${t}`
|
|
237
237
|
) : `${e};${n}=${t}`;
|
|
238
238
|
};
|
|
239
|
-
function
|
|
239
|
+
function H(e) {
|
|
240
240
|
if (!e)
|
|
241
241
|
return null;
|
|
242
242
|
try {
|
|
@@ -245,12 +245,12 @@ function j(e) {
|
|
|
245
245
|
return null;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
const
|
|
248
|
+
const _t = "storefront/faststore.recommendation-shelf@v4", Z = {
|
|
249
249
|
method: "POST",
|
|
250
250
|
headers: {
|
|
251
251
|
"content-type": "application/json"
|
|
252
252
|
}
|
|
253
|
-
},
|
|
253
|
+
}, Rt = (e) => e.split("/").map(encodeURIComponent).join("/"), Se = (e) => e ? { headers: { "Accept-Language": e } } : void 0, Tt = /^\d{4}-\d{2}-\d{2}$/, Ft = /* @__PURE__ */ new Set([
|
|
254
254
|
"Draft",
|
|
255
255
|
"Requested",
|
|
256
256
|
"InReview",
|
|
@@ -261,7 +261,7 @@ const kt = "storefront/faststore.recommendation-shelf@v4", K = {
|
|
|
261
261
|
"ConvertedToCart",
|
|
262
262
|
"ConvertedToOrder"
|
|
263
263
|
]);
|
|
264
|
-
function
|
|
264
|
+
function Nt({
|
|
265
265
|
page: e,
|
|
266
266
|
perPage: n,
|
|
267
267
|
status: t,
|
|
@@ -284,19 +284,19 @@ function Tt({
|
|
|
284
284
|
["expiresAtFrom", a],
|
|
285
285
|
["expiresAtTo", o]
|
|
286
286
|
])
|
|
287
|
-
if (c && !
|
|
287
|
+
if (c && !Tt.test(c))
|
|
288
288
|
throw new Error(
|
|
289
289
|
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
290
290
|
);
|
|
291
291
|
if (t && t.length > 0) {
|
|
292
|
-
const s = t.filter((c) => !
|
|
292
|
+
const s = t.filter((c) => !Ft.has(c));
|
|
293
293
|
if (s.length > 0)
|
|
294
294
|
throw new Error(
|
|
295
295
|
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
296
296
|
);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function Lt({
|
|
300
300
|
page: e,
|
|
301
301
|
perPage: n,
|
|
302
302
|
status: t,
|
|
@@ -309,13 +309,13 @@ function Ft({
|
|
|
309
309
|
const c = new URLSearchParams();
|
|
310
310
|
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((d) => c.append("status", d)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i), a && c.append("expiresAtFrom", a), o && c.append("expiresAtTo", o), s?.trim() && c.append("label", s.trim()), c;
|
|
311
311
|
}
|
|
312
|
-
const
|
|
313
|
-
const a = `https://${e}.${n}.com.br`, o =
|
|
312
|
+
const Bt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
313
|
+
const a = `https://${e}.${n}.com.br`, o = Et(i), s = In(i), c = mt(), d = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", g = r && r.map((l) => l + ".").find((l) => d.includes(l)) || "", p = d.replace(g, ""), f = `${a}/api/recommend-bff/v2`, h = s({
|
|
314
314
|
accept: "application/json",
|
|
315
315
|
"content-type": "application/json",
|
|
316
|
-
"x-vtex-rec-origin": `${e}/${
|
|
317
|
-
}),
|
|
318
|
-
const u = $(
|
|
316
|
+
"x-vtex-rec-origin": `${e}/${_t}`
|
|
317
|
+
}), I = (l = {}) => {
|
|
318
|
+
const u = $(Ie(i) ?? "", e);
|
|
319
319
|
return s({
|
|
320
320
|
...l,
|
|
321
321
|
"X-FORWARDED-HOST": p,
|
|
@@ -355,8 +355,8 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
355
355
|
category: async (l, u) => {
|
|
356
356
|
try {
|
|
357
357
|
return await y(
|
|
358
|
-
`${a}/api/catalog_system/pub/category/by-linkid/${
|
|
359
|
-
|
|
358
|
+
`${a}/api/catalog_system/pub/category/by-linkid/${Rt(l)}`,
|
|
359
|
+
Se(u)
|
|
360
360
|
);
|
|
361
361
|
} catch (m) {
|
|
362
362
|
if (ee(m)) return null;
|
|
@@ -367,7 +367,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
367
367
|
try {
|
|
368
368
|
return await y(
|
|
369
369
|
`${a}/api/catalog_system/pub/brand/by-linkid/${encodeURIComponent(l)}`,
|
|
370
|
-
|
|
370
|
+
Se(u)
|
|
371
371
|
);
|
|
372
372
|
} catch (m) {
|
|
373
373
|
if (ee(m)) return null;
|
|
@@ -378,7 +378,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
378
378
|
try {
|
|
379
379
|
return await y(
|
|
380
380
|
`${a}/api/catalog_system/pub/collection/by-linkid/${encodeURIComponent(l)}`,
|
|
381
|
-
|
|
381
|
+
Se(u)
|
|
382
382
|
);
|
|
383
383
|
} catch (m) {
|
|
384
384
|
if (ee(m)) return null;
|
|
@@ -415,7 +415,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
415
415
|
return y(
|
|
416
416
|
`${a}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
417
417
|
{
|
|
418
|
-
...
|
|
418
|
+
...Z,
|
|
419
419
|
headers: S,
|
|
420
420
|
body: JSON.stringify(l)
|
|
421
421
|
},
|
|
@@ -427,13 +427,13 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
427
427
|
index: u,
|
|
428
428
|
deliveryMode: m,
|
|
429
429
|
selectedAddresses: S
|
|
430
|
-
},
|
|
431
|
-
const b =
|
|
430
|
+
}, v) => {
|
|
431
|
+
const b = v ? {
|
|
432
432
|
startDateUtc: m?.deliveryWindow?.startDate,
|
|
433
433
|
endDateUtc: m?.deliveryWindow?.endDate
|
|
434
434
|
} : null, C = {
|
|
435
|
-
logisticsInfo: Array.from({ length: u }, (
|
|
436
|
-
itemIndex:
|
|
435
|
+
logisticsInfo: Array.from({ length: u }, (A, O) => ({
|
|
436
|
+
itemIndex: O,
|
|
437
437
|
selectedDeliveryChannel: m?.deliveryChannel || null,
|
|
438
438
|
selectedSla: m?.deliveryMethod || null,
|
|
439
439
|
deliveryWindow: b
|
|
@@ -447,7 +447,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
447
447
|
return y(
|
|
448
448
|
`${a}/api/checkout/pub/orderForm/${l}/attachments/shippingData`,
|
|
449
449
|
{
|
|
450
|
-
...
|
|
450
|
+
...Z,
|
|
451
451
|
headers: _,
|
|
452
452
|
body: JSON.stringify(C)
|
|
453
453
|
},
|
|
@@ -496,16 +496,16 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
496
496
|
channel: m = i.storage.channel,
|
|
497
497
|
preserveSalesChannel: S = !1
|
|
498
498
|
}) => {
|
|
499
|
-
const { salesChannel:
|
|
499
|
+
const { salesChannel: v } = m, b = s({
|
|
500
500
|
"content-type": "application/json",
|
|
501
501
|
"X-FORWARDED-HOST": p
|
|
502
502
|
}), C = new URLSearchParams();
|
|
503
|
-
(!S || !l) && C.set("sc",
|
|
504
|
-
const _ = l ? `/${l}` : "",
|
|
503
|
+
(!S || !l) && C.set("sc", v), l && C.set("refreshOutdatedData", u.toString());
|
|
504
|
+
const _ = l ? `/${l}` : "", A = `${a}/api/checkout/pub/orderForm${_}?${C}`;
|
|
505
505
|
return y(
|
|
506
|
-
|
|
506
|
+
A,
|
|
507
507
|
{
|
|
508
|
-
...
|
|
508
|
+
...Z,
|
|
509
509
|
headers: b,
|
|
510
510
|
...l ? {} : { body: "{}" }
|
|
511
511
|
},
|
|
@@ -520,7 +520,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
520
520
|
return y(
|
|
521
521
|
`${a}/api/checkout/pub/orderForm/${l}/messages/clear`,
|
|
522
522
|
{
|
|
523
|
-
...
|
|
523
|
+
...Z,
|
|
524
524
|
headers: u,
|
|
525
525
|
body: "{}"
|
|
526
526
|
}
|
|
@@ -531,7 +531,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
531
531
|
orderItems: u,
|
|
532
532
|
allowOutdatedData: m = "paymentData",
|
|
533
533
|
salesChannel: S = i.storage.channel.salesChannel,
|
|
534
|
-
shouldSplitItem:
|
|
534
|
+
shouldSplitItem: v = !0
|
|
535
535
|
}) => {
|
|
536
536
|
const b = new URLSearchParams({
|
|
537
537
|
allowOutdatedData: m,
|
|
@@ -546,7 +546,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
546
546
|
headers: C,
|
|
547
547
|
body: JSON.stringify({
|
|
548
548
|
orderItems: u,
|
|
549
|
-
noSplitItem: !
|
|
549
|
+
noSplitItem: !v
|
|
550
550
|
}),
|
|
551
551
|
method: "PATCH"
|
|
552
552
|
},
|
|
@@ -559,14 +559,14 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
559
559
|
key: m,
|
|
560
560
|
value: S
|
|
561
561
|
}) => {
|
|
562
|
-
const
|
|
562
|
+
const v = s({
|
|
563
563
|
"content-type": "application/json",
|
|
564
564
|
"X-FORWARDED-HOST": p
|
|
565
565
|
});
|
|
566
566
|
return y(
|
|
567
567
|
`${a}/api/checkout/pub/orderForm/${l}/customData/${u}/${m}`,
|
|
568
568
|
{
|
|
569
|
-
headers:
|
|
569
|
+
headers: v,
|
|
570
570
|
body: JSON.stringify({ value: S }),
|
|
571
571
|
method: "PUT"
|
|
572
572
|
}
|
|
@@ -578,15 +578,15 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
578
578
|
country: m,
|
|
579
579
|
salesChannel: S
|
|
580
580
|
}) => {
|
|
581
|
-
const
|
|
581
|
+
const v = new URLSearchParams({
|
|
582
582
|
country: m,
|
|
583
583
|
sc: S ?? ""
|
|
584
584
|
});
|
|
585
|
-
l ?
|
|
585
|
+
l ? v.append("postalCode", l) : v.append(
|
|
586
586
|
"geoCoordinates",
|
|
587
587
|
`${u?.longitude};${u?.latitude}`
|
|
588
588
|
);
|
|
589
|
-
const b = `${a}/api/checkout/pub/regions/?${
|
|
589
|
+
const b = `${a}/api/checkout/pub/regions/?${v.toString()}`, C = s({
|
|
590
590
|
"content-type": "application/json",
|
|
591
591
|
"X-FORWARDED-HOST": p
|
|
592
592
|
});
|
|
@@ -635,27 +635,6 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
635
635
|
},
|
|
636
636
|
{}
|
|
637
637
|
);
|
|
638
|
-
},
|
|
639
|
-
pickupPoints: ({
|
|
640
|
-
geoCoordinates: l
|
|
641
|
-
}) => {
|
|
642
|
-
if (!l)
|
|
643
|
-
throw new Error(
|
|
644
|
-
"Missing required parameter for listing pickup points."
|
|
645
|
-
);
|
|
646
|
-
const u = s({
|
|
647
|
-
"content-type": "application/json",
|
|
648
|
-
"X-FORWARDED-HOST": p
|
|
649
|
-
});
|
|
650
|
-
return y(
|
|
651
|
-
`${a}/api/logistics-shipping/pickuppoints/_search`,
|
|
652
|
-
{
|
|
653
|
-
method: "POST",
|
|
654
|
-
headers: u,
|
|
655
|
-
body: JSON.stringify({ coordinate: l })
|
|
656
|
-
},
|
|
657
|
-
{ storeCookies: o }
|
|
658
|
-
);
|
|
659
638
|
}
|
|
660
639
|
},
|
|
661
640
|
session: (l) => {
|
|
@@ -666,7 +645,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
666
645
|
);
|
|
667
646
|
const m = s({
|
|
668
647
|
"content-type": "application/json"
|
|
669
|
-
}), S =
|
|
648
|
+
}), S = ie(i?.headers?.cookie ?? "")?.vtex_session;
|
|
670
649
|
return y(
|
|
671
650
|
`${a}/api/sessions?${u.toString()}`,
|
|
672
651
|
{
|
|
@@ -699,7 +678,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
699
678
|
subscribeToNewsletter: (l) => y(
|
|
700
679
|
`${a}/api/dataentities/NL/documents/`,
|
|
701
680
|
{
|
|
702
|
-
...
|
|
681
|
+
...Z,
|
|
703
682
|
body: JSON.stringify({ ...l, isNewsletterOptIn: !0 }),
|
|
704
683
|
method: "PATCH"
|
|
705
684
|
},
|
|
@@ -738,43 +717,43 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
738
717
|
status: u,
|
|
739
718
|
dateInitial: m,
|
|
740
719
|
dateFinal: S,
|
|
741
|
-
text:
|
|
720
|
+
text: v,
|
|
742
721
|
clientEmail: b,
|
|
743
722
|
perPage: C,
|
|
744
723
|
pendingMyApproval: _
|
|
745
724
|
}) => {
|
|
746
|
-
const
|
|
725
|
+
const A = new URLSearchParams();
|
|
747
726
|
if (m) {
|
|
748
|
-
const
|
|
727
|
+
const P = new Date(m).setHours(
|
|
749
728
|
0,
|
|
750
729
|
0,
|
|
751
730
|
0,
|
|
752
731
|
0
|
|
753
732
|
);
|
|
754
|
-
m = new Date(
|
|
733
|
+
m = new Date(P).toISOString();
|
|
755
734
|
}
|
|
756
735
|
if (S) {
|
|
757
|
-
const
|
|
736
|
+
const P = new Date(S).setHours(
|
|
758
737
|
23,
|
|
759
738
|
59,
|
|
760
739
|
59,
|
|
761
740
|
999
|
|
762
741
|
);
|
|
763
|
-
S = new Date(
|
|
742
|
+
S = new Date(P).toISOString();
|
|
764
743
|
}
|
|
765
|
-
|
|
744
|
+
v && A.append("text", v), u && u.length > 0 && A.append("status", u.filter(Boolean).join(",")), m && S ? A.append(
|
|
766
745
|
"creation_date",
|
|
767
746
|
`creationDate:[${m} TO ${S}]`
|
|
768
|
-
) : m ?
|
|
769
|
-
const
|
|
747
|
+
) : m ? A.append("creation_date", `creationDate:[${m} TO *]`) : S && A.append("creation_date", `creationDate:[* TO ${S}]`), b && A.append("clientEmail", b), l && A.append("page", l.toString()), C && A.append("per_page", C.toString()), _ && A.append("my_pending_approvals", String(!0));
|
|
748
|
+
const O = s({
|
|
770
749
|
"content-type": "application/json",
|
|
771
750
|
"X-FORWARDED-HOST": p
|
|
772
751
|
});
|
|
773
752
|
return y(
|
|
774
|
-
`${a}/api/oms/user/orders?${
|
|
753
|
+
`${a}/api/oms/user/orders?${A.toString()}`,
|
|
775
754
|
{
|
|
776
755
|
method: "GET",
|
|
777
|
-
headers:
|
|
756
|
+
headers: O
|
|
778
757
|
},
|
|
779
758
|
{ storeCookies: o }
|
|
780
759
|
);
|
|
@@ -801,7 +780,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
801
780
|
ruleId: m,
|
|
802
781
|
approved: S
|
|
803
782
|
}) => {
|
|
804
|
-
const
|
|
783
|
+
const v = s({
|
|
805
784
|
"content-type": "application/json",
|
|
806
785
|
"X-FORWARDED-HOST": p
|
|
807
786
|
}), _ = {
|
|
@@ -815,7 +794,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
815
794
|
`${a}/${e}/commercial-authorizations/${l}/callback`,
|
|
816
795
|
{
|
|
817
796
|
method: "POST",
|
|
818
|
-
headers:
|
|
797
|
+
headers: v,
|
|
819
798
|
body: JSON.stringify(_)
|
|
820
799
|
},
|
|
821
800
|
{ storeCookies: o }
|
|
@@ -966,8 +945,8 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
966
945
|
contractId: l
|
|
967
946
|
}) => {
|
|
968
947
|
if (!l)
|
|
969
|
-
throw new
|
|
970
|
-
const u =
|
|
948
|
+
throw new U("Missing contractId to fetch CL fields.");
|
|
949
|
+
const u = I({
|
|
971
950
|
Accept: "application/json",
|
|
972
951
|
"content-type": "application/json"
|
|
973
952
|
});
|
|
@@ -984,7 +963,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
984
963
|
userId: l
|
|
985
964
|
}) => {
|
|
986
965
|
if (!l)
|
|
987
|
-
throw new
|
|
966
|
+
throw new U("Missing userId to fetch shopper name.");
|
|
988
967
|
const u = c({
|
|
989
968
|
Accept: "application/json",
|
|
990
969
|
"content-type": "application/json",
|
|
@@ -1002,8 +981,8 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1002
981
|
},
|
|
1003
982
|
quotes: {
|
|
1004
983
|
listUserQuotes: (l) => {
|
|
1005
|
-
|
|
1006
|
-
const u =
|
|
984
|
+
Nt(l);
|
|
985
|
+
const u = Lt(l), m = s({
|
|
1007
986
|
"content-type": "application/json",
|
|
1008
987
|
"X-FORWARDED-HOST": p
|
|
1009
988
|
});
|
|
@@ -1022,7 +1001,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1022
1001
|
const l = s({
|
|
1023
1002
|
"content-type": "application/json",
|
|
1024
1003
|
"X-FORWARDED-HOST": p
|
|
1025
|
-
}), u = $(
|
|
1004
|
+
}), u = $(Ie(i) ?? "", e);
|
|
1026
1005
|
return y(
|
|
1027
1006
|
`${a}/api/vtexid/credential/validate`,
|
|
1028
1007
|
{
|
|
@@ -1043,26 +1022,26 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1043
1022
|
const S = s({
|
|
1044
1023
|
"content-type": "application/json",
|
|
1045
1024
|
"X-FORWARDED-HOST": p
|
|
1046
|
-
}),
|
|
1047
|
-
`, _ = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream",
|
|
1048
|
-
`--${
|
|
1049
|
-
`Content-Disposition: form-data; name="file"; filename="${
|
|
1025
|
+
}), v = `----FastStoreUploadBoundary${Date.now()}`, b = `\r
|
|
1026
|
+
`, _ = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", A = u.replaceAll(/[\r\n"]/g, "_"), O = [
|
|
1027
|
+
`--${v}`,
|
|
1028
|
+
`Content-Disposition: form-data; name="file"; filename="${A}"`,
|
|
1050
1029
|
`Content-Type: ${_}`,
|
|
1051
1030
|
"",
|
|
1052
1031
|
""
|
|
1053
|
-
].join(b),
|
|
1054
|
-
D.byteLength + l.byteLength +
|
|
1032
|
+
].join(b), P = `${b}--${v}--${b}`, D = Buffer.from(O), E = Buffer.from(P), k = new Uint8Array(
|
|
1033
|
+
D.byteLength + l.byteLength + E.byteLength
|
|
1055
1034
|
);
|
|
1056
|
-
let
|
|
1057
|
-
return
|
|
1035
|
+
let R = 0;
|
|
1036
|
+
return k.set(D, R), R += D.byteLength, k.set(l, R), R += l.byteLength, k.set(E, R), y(
|
|
1058
1037
|
`${a}/api/order-entry/upload?an=${e}`,
|
|
1059
1038
|
{
|
|
1060
1039
|
method: "POST",
|
|
1061
1040
|
headers: {
|
|
1062
1041
|
...S,
|
|
1063
|
-
"content-type": `multipart/form-data; boundary=${
|
|
1042
|
+
"content-type": `multipart/form-data; boundary=${v}`
|
|
1064
1043
|
},
|
|
1065
|
-
body:
|
|
1044
|
+
body: k.buffer
|
|
1066
1045
|
},
|
|
1067
1046
|
{}
|
|
1068
1047
|
);
|
|
@@ -1075,7 +1054,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1075
1054
|
const S = s({
|
|
1076
1055
|
"content-type": "application/json",
|
|
1077
1056
|
"X-FORWARDED-HOST": p
|
|
1078
|
-
}),
|
|
1057
|
+
}), v = JSON.stringify({
|
|
1079
1058
|
objectKey: l,
|
|
1080
1059
|
orderFormId: u,
|
|
1081
1060
|
operation: "CreateCart",
|
|
@@ -1086,7 +1065,7 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1086
1065
|
{
|
|
1087
1066
|
method: "POST",
|
|
1088
1067
|
headers: S,
|
|
1089
|
-
body:
|
|
1068
|
+
body: v
|
|
1090
1069
|
},
|
|
1091
1070
|
{}
|
|
1092
1071
|
);
|
|
@@ -1149,10 +1128,10 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1149
1128
|
userId: u,
|
|
1150
1129
|
products: m = [],
|
|
1151
1130
|
salesChannel: S,
|
|
1152
|
-
locale:
|
|
1131
|
+
locale: v
|
|
1153
1132
|
}) => {
|
|
1154
1133
|
const b = new URLSearchParams({ an: e, campaignVrn: l });
|
|
1155
|
-
return u && b.append("userId", u), m.length > 0 && b.append("products", m.join(",")), S && b.append("salesChannel", S),
|
|
1134
|
+
return u && b.append("userId", u), m.length > 0 && b.append("products", m.join(",")), S && b.append("salesChannel", S), v && b.append("locale", v), y(
|
|
1156
1135
|
`${f}/recommendations?${b.toString()}`,
|
|
1157
1136
|
{ headers: h },
|
|
1158
1137
|
{ storeCookies: o }
|
|
@@ -1168,27 +1147,27 @@ const Nt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1168
1147
|
}
|
|
1169
1148
|
}
|
|
1170
1149
|
};
|
|
1171
|
-
},
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
Ie,
|
|
1150
|
+
}, re = (e) => e.discoveryConfig?.localization ?? {}, X = (e) => re(e).enabled === !0, $t = (e) => Object.keys(re(e).locales ?? {}), Mt = (e) => re(e).defaultLocale, vn = (e) => X(e) && e.storage.locale || void 0, ve = "fuzzy", Oe = "operator", Ce = "pickupPoint", Be = "shipping", $e = "delivery-options", zt = "in-stock", Vt = "trade-policy", qt = "region-id", xt = /* @__PURE__ */ new Set([
|
|
1151
|
+
Vt,
|
|
1152
|
+
qt,
|
|
1175
1153
|
ve,
|
|
1176
|
-
Oe
|
|
1177
|
-
|
|
1154
|
+
Oe,
|
|
1155
|
+
Ce
|
|
1156
|
+
]), jt = /* @__PURE__ */ new Set([
|
|
1178
1157
|
"zip-code",
|
|
1179
1158
|
"pickupPoint",
|
|
1180
1159
|
"country",
|
|
1181
1160
|
"coordinates",
|
|
1182
1161
|
"deliveryZonesHash",
|
|
1183
1162
|
"pickupPointsHash"
|
|
1184
|
-
]),
|
|
1163
|
+
]), Me = (e) => encodeURI(decodeURI(e)), Wt = (e) => encodeURIComponent(
|
|
1185
1164
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
1186
|
-
),
|
|
1187
|
-
function
|
|
1165
|
+
), Ht = /^pickup-in-point-(.+)$/;
|
|
1166
|
+
function On(e) {
|
|
1188
1167
|
if (!e)
|
|
1189
1168
|
return {};
|
|
1190
1169
|
try {
|
|
1191
|
-
const t =
|
|
1170
|
+
const t = ie(e).vtex_segment;
|
|
1192
1171
|
if (!t)
|
|
1193
1172
|
return {};
|
|
1194
1173
|
const r = Buffer.from(t, "base64").toString("utf-8");
|
|
@@ -1197,18 +1176,18 @@ function vn(e) {
|
|
|
1197
1176
|
return {};
|
|
1198
1177
|
}
|
|
1199
1178
|
}
|
|
1200
|
-
function
|
|
1179
|
+
function Gt(e) {
|
|
1201
1180
|
const n = {}, t = [];
|
|
1202
1181
|
for (const r of e.split(";")) {
|
|
1203
1182
|
const i = r.indexOf("=");
|
|
1204
1183
|
if (i < 0) continue;
|
|
1205
1184
|
const a = r.slice(0, i), o = r.slice(i + 1);
|
|
1206
|
-
!a || !o || (
|
|
1185
|
+
!a || !o || (jt.has(a) ? n[a] = o : t.push({ key: a, value: o }));
|
|
1207
1186
|
}
|
|
1208
1187
|
return { shipping: n, extraFacets: t };
|
|
1209
1188
|
}
|
|
1210
|
-
function
|
|
1211
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } =
|
|
1189
|
+
function Xt(e) {
|
|
1190
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } = Gt(n);
|
|
1212
1191
|
return {
|
|
1213
1192
|
segmentParams: {
|
|
1214
1193
|
sc: e.channel,
|
|
@@ -1229,7 +1208,7 @@ function Gt(e) {
|
|
|
1229
1208
|
extraFacets: r
|
|
1230
1209
|
};
|
|
1231
1210
|
}
|
|
1232
|
-
function
|
|
1211
|
+
function Cn(e, n) {
|
|
1233
1212
|
const t = [
|
|
1234
1213
|
["sc", n.sc],
|
|
1235
1214
|
["regionId", n.regionId],
|
|
@@ -1249,11 +1228,11 @@ function On(e, n) {
|
|
|
1249
1228
|
for (const [r, i] of t)
|
|
1250
1229
|
i != null && i !== "" && e.append(r, String(i));
|
|
1251
1230
|
}
|
|
1252
|
-
function
|
|
1253
|
-
return
|
|
1231
|
+
function bn(e) {
|
|
1232
|
+
return Ht.exec(e)?.[1];
|
|
1254
1233
|
}
|
|
1255
|
-
function
|
|
1256
|
-
const n = e.find((r) => r.key === "shipping"), t = n ?
|
|
1234
|
+
function Yt(e) {
|
|
1235
|
+
const n = e.find((r) => r.key === "shipping"), t = n ? bn(n.value) : void 0;
|
|
1257
1236
|
if (t !== void 0)
|
|
1258
1237
|
try {
|
|
1259
1238
|
return decodeURIComponent(t);
|
|
@@ -1261,8 +1240,8 @@ function Ht(e) {
|
|
|
1261
1240
|
return t;
|
|
1262
1241
|
}
|
|
1263
1242
|
}
|
|
1264
|
-
function
|
|
1265
|
-
const t =
|
|
1243
|
+
function Jt(e, n) {
|
|
1244
|
+
const t = Yt(
|
|
1266
1245
|
n
|
|
1267
1246
|
);
|
|
1268
1247
|
return t === void 0 ? e : {
|
|
@@ -1270,25 +1249,25 @@ function Xt(e, n) {
|
|
|
1270
1249
|
pickupPoint: t
|
|
1271
1250
|
};
|
|
1272
1251
|
}
|
|
1273
|
-
function
|
|
1274
|
-
return e.map((n) => n.key !== "shipping" ||
|
|
1252
|
+
function Kt(e) {
|
|
1253
|
+
return e.map((n) => n.key !== "shipping" || bn(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1275
1254
|
}
|
|
1276
|
-
function
|
|
1255
|
+
function Qt(e, n) {
|
|
1277
1256
|
let t = [...e];
|
|
1278
1257
|
const r = t.some((i) => i.key === "shipping");
|
|
1279
1258
|
for (const i of n)
|
|
1280
1259
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1281
|
-
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")),
|
|
1260
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), Kt(t);
|
|
1282
1261
|
}
|
|
1283
|
-
function
|
|
1262
|
+
function wn(e) {
|
|
1284
1263
|
return e.reduce((n, t) => {
|
|
1285
1264
|
let { key: r, value: i } = t;
|
|
1286
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${
|
|
1265
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Me(r)}/${Wt(Me(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1287
1266
|
}, "");
|
|
1288
1267
|
}
|
|
1289
|
-
const
|
|
1290
|
-
function
|
|
1291
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1268
|
+
const Zt = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), er = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1269
|
+
function nr(e, n) {
|
|
1270
|
+
const { segmentParams: t, extraFacets: r } = Xt(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
|
|
1292
1271
|
return {
|
|
1293
1272
|
segmentParams: {
|
|
1294
1273
|
...t,
|
|
@@ -1299,23 +1278,23 @@ function er(e, n) {
|
|
|
1299
1278
|
extraFacets: r
|
|
1300
1279
|
};
|
|
1301
1280
|
}
|
|
1302
|
-
function
|
|
1303
|
-
const t = e.filter(({ key: c }) => !
|
|
1304
|
-
({ key: c, value: d }) => c ===
|
|
1281
|
+
function tr(e, n) {
|
|
1282
|
+
const t = e.filter(({ key: c }) => !xt.has(c)), r = e.find(
|
|
1283
|
+
({ key: c, value: d }) => c === Be && d !== "all-delivery-methods"
|
|
1305
1284
|
) ?? null, i = e.find(
|
|
1306
|
-
({ key: c, value: d }) => c ===
|
|
1285
|
+
({ key: c, value: d }) => c === $e && d !== "all-delivery-options"
|
|
1307
1286
|
) ?? null, a = [...t], o = a.some(
|
|
1308
|
-
({ key: c }) => c === Le
|
|
1309
|
-
), s = a.some(
|
|
1310
1287
|
({ key: c }) => c === Be
|
|
1288
|
+
), s = a.some(
|
|
1289
|
+
({ key: c }) => c === $e
|
|
1311
1290
|
);
|
|
1312
|
-
return r !== null && !o && a.push(r), i !== null && !s && a.push(i),
|
|
1291
|
+
return r !== null && !o && a.push(r), i !== null && !s && a.push(i), Qt(a, n);
|
|
1313
1292
|
}
|
|
1314
|
-
function
|
|
1315
|
-
const t = e.find(({ key: a }) => a ===
|
|
1316
|
-
t &&
|
|
1293
|
+
function rr(e, n) {
|
|
1294
|
+
const t = e.find(({ key: a }) => a === ve) ?? null, r = e.find(({ key: a }) => a === Oe) ?? null, i = e.find(({ key: a }) => a === Ce) ?? null;
|
|
1295
|
+
t && Zt(t) && n.append(ve, t.value), r && er(r) && n.append(Oe, r.value), i && n.append(Ce, i.value);
|
|
1317
1296
|
}
|
|
1318
|
-
function
|
|
1297
|
+
function ze(e, n, t, r) {
|
|
1319
1298
|
const {
|
|
1320
1299
|
query: i = "",
|
|
1321
1300
|
page: a,
|
|
@@ -1332,28 +1311,42 @@ function Me(e, n, t, r) {
|
|
|
1332
1311
|
h.append("from", u.toString()), h.append("to", m.toString());
|
|
1333
1312
|
}
|
|
1334
1313
|
i && h.append("query", i), r.includeSort && s && h.append("sort", s);
|
|
1335
|
-
const
|
|
1314
|
+
const I = Jt(
|
|
1336
1315
|
t.segmentParams,
|
|
1337
1316
|
c
|
|
1338
1317
|
);
|
|
1339
|
-
if (
|
|
1340
|
-
const u = c.find(({ key: S }) => S ===
|
|
1318
|
+
if (Cn(h, I ?? t.segmentParams), rr(c, h), d && h.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1319
|
+
const u = c.find(({ key: S }) => S === zt), m = u ? u.value : p?.toString() ?? n.hideUnavailableItems.toString();
|
|
1341
1320
|
h.append("hideUnavailableItems", m);
|
|
1342
1321
|
}
|
|
1343
1322
|
n?.simulationBehavior !== void 0 && h.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && h.append("showSponsored", n.showSponsored.toString()), g !== void 0 && h.append("sponsoredCount", g.toString()), f !== void 0 && h.append("allowRedirect", f.toString());
|
|
1344
|
-
const l =
|
|
1345
|
-
|
|
1323
|
+
const l = wn(
|
|
1324
|
+
tr(c, t.extraFacets)
|
|
1346
1325
|
);
|
|
1347
1326
|
return { params: h, path: l };
|
|
1348
1327
|
}
|
|
1349
|
-
function
|
|
1328
|
+
function ir(e, n) {
|
|
1350
1329
|
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: a } = e, o = new URLSearchParams({
|
|
1351
1330
|
field: t ?? "",
|
|
1352
1331
|
value: r ?? ""
|
|
1353
1332
|
});
|
|
1354
|
-
return
|
|
1333
|
+
return Cn(o, n), i && o.append("hideUnavailableItems", "true"), a && o.append("show-invisible-items", "true"), o;
|
|
1334
|
+
}
|
|
1335
|
+
function ce(e) {
|
|
1336
|
+
return (e ?? "").replaceAll(/[\s-]/g, "").toUpperCase();
|
|
1337
|
+
}
|
|
1338
|
+
function ar(e, n) {
|
|
1339
|
+
const { segmentParams: t, extraFacets: r } = n, { postalCode: i, country: a, coordinates: o } = e, s = !!i, c = a || t.country, d = s && ce(i) === ce(t["zip-code"]) && ce(c) === ce(t.country), g = s ? i : t["zip-code"], p = s ? c : t.country, f = d ? t.coordinates : void 0, h = s ? o ?? f : o || t.coordinates, I = !s || d, l = !!(t.deliveryZonesHash && t.pickupPointHash);
|
|
1340
|
+
if ((!g || !p) && !!!h && !(I && l))
|
|
1341
|
+
throw new Error(
|
|
1342
|
+
"Missing delivery location for pickup point availability. Provide postalCode and country, coordinates, or a segment with zip-code."
|
|
1343
|
+
);
|
|
1344
|
+
const m = new URLSearchParams(), S = (v, b) => {
|
|
1345
|
+
b != null && String(b) !== "" && m.append(v, String(b));
|
|
1346
|
+
};
|
|
1347
|
+
return S("sc", t.sc), S("locale", t.locale), S("country", p), S("zip-code", g), S("coordinates", h), I && (S("deliveryZonesHash", t.deliveryZonesHash), S("pickupPointsHash", t.pickupPointHash)), { params: m, path: wn(r) };
|
|
1355
1348
|
}
|
|
1356
|
-
function
|
|
1349
|
+
function q(e, n) {
|
|
1357
1350
|
return {
|
|
1358
1351
|
path: e,
|
|
1359
1352
|
params: n,
|
|
@@ -1363,44 +1356,51 @@ function Q(e, n) {
|
|
|
1363
1356
|
}
|
|
1364
1357
|
};
|
|
1365
1358
|
}
|
|
1366
|
-
function
|
|
1367
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a =
|
|
1359
|
+
function x(e) {
|
|
1360
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a = nr(t, r);
|
|
1368
1361
|
switch (n) {
|
|
1369
1362
|
case "product-search":
|
|
1370
1363
|
case "facets": {
|
|
1371
|
-
const { params: o, path: s } =
|
|
1364
|
+
const { params: o, path: s } = ze(
|
|
1372
1365
|
i,
|
|
1373
1366
|
r,
|
|
1374
1367
|
a,
|
|
1375
1368
|
{ includePagination: !0, includeSort: !0 }
|
|
1376
1369
|
);
|
|
1377
|
-
return
|
|
1370
|
+
return q(s, o);
|
|
1378
1371
|
}
|
|
1379
1372
|
case "catalog-count": {
|
|
1380
|
-
const { params: o, path: s } =
|
|
1373
|
+
const { params: o, path: s } = ze(
|
|
1381
1374
|
i,
|
|
1382
1375
|
r,
|
|
1383
1376
|
a,
|
|
1384
1377
|
{ includePagination: !1, includeSort: !1 }
|
|
1385
1378
|
);
|
|
1386
|
-
return
|
|
1379
|
+
return q(s, o);
|
|
1387
1380
|
}
|
|
1388
1381
|
case "products": {
|
|
1389
|
-
const o =
|
|
1390
|
-
return
|
|
1382
|
+
const o = ir(i, a.segmentParams);
|
|
1383
|
+
return q("", o);
|
|
1391
1384
|
}
|
|
1392
1385
|
case "search-suggestions": {
|
|
1393
1386
|
const o = new URLSearchParams({
|
|
1394
1387
|
query: i.query?.toString() ?? "",
|
|
1395
1388
|
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1396
1389
|
});
|
|
1397
|
-
return
|
|
1390
|
+
return q("", o);
|
|
1398
1391
|
}
|
|
1399
1392
|
case "top-searches": {
|
|
1400
1393
|
const o = new URLSearchParams({
|
|
1401
1394
|
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1402
1395
|
});
|
|
1403
|
-
return
|
|
1396
|
+
return q("", o);
|
|
1397
|
+
}
|
|
1398
|
+
case "pickup-point-availability": {
|
|
1399
|
+
const { params: o, path: s } = ar(
|
|
1400
|
+
i,
|
|
1401
|
+
a
|
|
1402
|
+
);
|
|
1403
|
+
return q(s, o);
|
|
1404
1404
|
}
|
|
1405
1405
|
default: {
|
|
1406
1406
|
const o = n;
|
|
@@ -1408,16 +1408,16 @@ function Z(e) {
|
|
|
1408
1408
|
}
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
-
const
|
|
1412
|
-
function
|
|
1411
|
+
const or = 10;
|
|
1412
|
+
function sr(e) {
|
|
1413
1413
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1414
1414
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1415
1415
|
}
|
|
1416
|
-
function
|
|
1417
|
-
const t =
|
|
1418
|
-
return
|
|
1416
|
+
function cr(e) {
|
|
1417
|
+
const t = On(e.headers?.cookie).cultureInfo || "";
|
|
1418
|
+
return X(e) ? e.storage.locale || t : t || e.storage.locale || "";
|
|
1419
1419
|
}
|
|
1420
|
-
const
|
|
1420
|
+
const lr = ({
|
|
1421
1421
|
account: e,
|
|
1422
1422
|
environment: n,
|
|
1423
1423
|
hideUnavailableItems: t,
|
|
@@ -1425,69 +1425,69 @@ const sr = ({
|
|
|
1425
1425
|
showSponsored: i,
|
|
1426
1426
|
subDomainPrefix: a
|
|
1427
1427
|
}, o) => {
|
|
1428
|
-
const s = `https://${e}.${n}.com.br`, c =
|
|
1428
|
+
const s = `https://${e}.${n}.com.br`, c = In(o), d = On(o.headers?.cookie), g = () => ({
|
|
1429
1429
|
salesChannel: o.storage.channel.salesChannel,
|
|
1430
|
-
regionId:
|
|
1431
|
-
locale:
|
|
1430
|
+
regionId: sr(o),
|
|
1431
|
+
locale: cr(o),
|
|
1432
1432
|
hideUnavailableItems: t,
|
|
1433
1433
|
simulationBehavior: r,
|
|
1434
1434
|
showSponsored: i
|
|
1435
|
-
}), p = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "", f = a && a.map((
|
|
1435
|
+
}), p = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "", f = a && a.map((O) => O + ".").find((O) => p.includes(O)) || "", h = p.replace(f, ""), I = c({
|
|
1436
1436
|
"content-type": "application/json",
|
|
1437
1437
|
"X-FORWARDED-HOST": h
|
|
1438
|
-
}), l = ({ type:
|
|
1439
|
-
const
|
|
1440
|
-
endpoint:
|
|
1438
|
+
}), l = ({ type: O, ...P }) => {
|
|
1439
|
+
const D = O === "facets" ? "facets" : "product-search", E = x({
|
|
1440
|
+
endpoint: D,
|
|
1441
1441
|
segment: d,
|
|
1442
1442
|
defaults: g(),
|
|
1443
|
-
args:
|
|
1443
|
+
args: P
|
|
1444
1444
|
});
|
|
1445
1445
|
return y(
|
|
1446
|
-
`${s}/api/intelligent-search/v1/${
|
|
1447
|
-
{ headers:
|
|
1446
|
+
`${s}/api/intelligent-search/v1/${D}/${E.path}?${E.params.toString()}`,
|
|
1447
|
+
{ headers: I }
|
|
1448
1448
|
);
|
|
1449
|
-
}, u = (
|
|
1450
|
-
field:
|
|
1451
|
-
value:
|
|
1452
|
-
hideUnavailableItems:
|
|
1453
|
-
showInvisibleItems:
|
|
1449
|
+
}, u = (O) => l({ ...O, type: "product_search" }), m = ({
|
|
1450
|
+
field: O,
|
|
1451
|
+
value: P,
|
|
1452
|
+
hideUnavailableItems: D,
|
|
1453
|
+
showInvisibleItems: E
|
|
1454
1454
|
}) => {
|
|
1455
|
-
const
|
|
1455
|
+
const k = x({
|
|
1456
1456
|
endpoint: "products",
|
|
1457
1457
|
segment: d,
|
|
1458
1458
|
defaults: g(),
|
|
1459
1459
|
args: {
|
|
1460
|
-
field:
|
|
1461
|
-
value:
|
|
1462
|
-
hideUnavailableItems:
|
|
1463
|
-
showInvisibleItems:
|
|
1460
|
+
field: O,
|
|
1461
|
+
value: P,
|
|
1462
|
+
hideUnavailableItems: D,
|
|
1463
|
+
showInvisibleItems: E
|
|
1464
1464
|
}
|
|
1465
1465
|
});
|
|
1466
1466
|
return y(
|
|
1467
|
-
`${s}/api/intelligent-search/v1/products?${
|
|
1468
|
-
{ headers:
|
|
1467
|
+
`${s}/api/intelligent-search/v1/products?${k.params.toString()}`,
|
|
1468
|
+
{ headers: I }
|
|
1469
1469
|
);
|
|
1470
1470
|
};
|
|
1471
1471
|
return {
|
|
1472
|
-
facets: (
|
|
1472
|
+
facets: (O) => l({ ...O, type: "facets" }),
|
|
1473
1473
|
products: u,
|
|
1474
1474
|
fetchProduct: m,
|
|
1475
1475
|
productsByIdentifier: async ({
|
|
1476
|
-
field:
|
|
1477
|
-
values:
|
|
1478
|
-
showInvisibleItems:
|
|
1479
|
-
hideUnavailableItems:
|
|
1476
|
+
field: O,
|
|
1477
|
+
values: P,
|
|
1478
|
+
showInvisibleItems: D,
|
|
1479
|
+
hideUnavailableItems: E
|
|
1480
1480
|
}) => {
|
|
1481
|
-
const
|
|
1481
|
+
const k = Ue(or);
|
|
1482
1482
|
return (await Promise.all(
|
|
1483
|
-
|
|
1484
|
-
(
|
|
1483
|
+
P.map(
|
|
1484
|
+
(w) => k(async () => {
|
|
1485
1485
|
try {
|
|
1486
1486
|
return await m({
|
|
1487
|
-
field:
|
|
1488
|
-
value:
|
|
1489
|
-
hideUnavailableItems:
|
|
1490
|
-
showInvisibleItems:
|
|
1487
|
+
field: O,
|
|
1488
|
+
value: w,
|
|
1489
|
+
hideUnavailableItems: E,
|
|
1490
|
+
showInvisibleItems: D
|
|
1491
1491
|
});
|
|
1492
1492
|
} catch {
|
|
1493
1493
|
return null;
|
|
@@ -1495,54 +1495,70 @@ const sr = ({
|
|
|
1495
1495
|
})
|
|
1496
1496
|
)
|
|
1497
1497
|
)).filter(
|
|
1498
|
-
(
|
|
1498
|
+
(w) => w !== null
|
|
1499
1499
|
);
|
|
1500
1500
|
},
|
|
1501
|
-
suggestedTerms: (
|
|
1502
|
-
const
|
|
1501
|
+
suggestedTerms: (O) => {
|
|
1502
|
+
const P = x({
|
|
1503
1503
|
endpoint: "search-suggestions",
|
|
1504
1504
|
segment: d,
|
|
1505
1505
|
defaults: g(),
|
|
1506
|
-
args: { query:
|
|
1506
|
+
args: { query: O.query }
|
|
1507
1507
|
});
|
|
1508
1508
|
return y(
|
|
1509
|
-
`${s}/api/intelligent-search/v1/search-suggestions?${
|
|
1510
|
-
{ headers:
|
|
1509
|
+
`${s}/api/intelligent-search/v1/search-suggestions?${P.params.toString()}`,
|
|
1510
|
+
{ headers: I }
|
|
1511
1511
|
);
|
|
1512
1512
|
},
|
|
1513
1513
|
topSearches: () => {
|
|
1514
|
-
const
|
|
1514
|
+
const O = x({
|
|
1515
1515
|
endpoint: "top-searches",
|
|
1516
1516
|
segment: d,
|
|
1517
1517
|
defaults: g()
|
|
1518
1518
|
});
|
|
1519
1519
|
return y(
|
|
1520
|
-
`${s}/api/intelligent-search/v1/top-searches?${
|
|
1521
|
-
{ headers:
|
|
1520
|
+
`${s}/api/intelligent-search/v1/top-searches?${O.params.toString()}`,
|
|
1521
|
+
{ headers: I }
|
|
1522
1522
|
);
|
|
1523
1523
|
},
|
|
1524
|
-
productCount: (
|
|
1525
|
-
const
|
|
1524
|
+
productCount: (O) => {
|
|
1525
|
+
const P = x({
|
|
1526
1526
|
endpoint: "catalog-count",
|
|
1527
1527
|
segment: d,
|
|
1528
1528
|
defaults: g(),
|
|
1529
|
-
args:
|
|
1529
|
+
args: O
|
|
1530
1530
|
});
|
|
1531
1531
|
return y(
|
|
1532
|
-
`${s}/api/intelligent-search/v1/catalog-count/${
|
|
1533
|
-
{ headers:
|
|
1532
|
+
`${s}/api/intelligent-search/v1/catalog-count/${P.path}?${P.params.toString()}`,
|
|
1533
|
+
{ headers: I }
|
|
1534
|
+
);
|
|
1535
|
+
},
|
|
1536
|
+
pickupPointAvailability: ({
|
|
1537
|
+
postalCode: O,
|
|
1538
|
+
country: P,
|
|
1539
|
+
coordinates: D
|
|
1540
|
+
}) => {
|
|
1541
|
+
const E = x({
|
|
1542
|
+
endpoint: "pickup-point-availability",
|
|
1543
|
+
segment: d,
|
|
1544
|
+
defaults: g(),
|
|
1545
|
+
args: { postalCode: O, country: P, coordinates: D }
|
|
1546
|
+
}), k = E.path ? `/${E.path}` : "";
|
|
1547
|
+
return y(
|
|
1548
|
+
`${s}/api/intelligent-search/v1/pickup-point-availability${k}?${E.params.toString()}`,
|
|
1549
|
+
{ headers: I }
|
|
1534
1550
|
);
|
|
1535
1551
|
}
|
|
1536
1552
|
};
|
|
1537
|
-
},
|
|
1538
|
-
const t =
|
|
1553
|
+
}, dr = (e, n) => {
|
|
1554
|
+
const t = lr(e, n), r = Bt(e, n), i = At(e);
|
|
1539
1555
|
return {
|
|
1540
1556
|
search: t,
|
|
1541
1557
|
commerce: r,
|
|
1542
1558
|
catalog: i
|
|
1543
1559
|
};
|
|
1544
|
-
},
|
|
1545
|
-
const t =
|
|
1560
|
+
}, ur = 20, pr = (e) => e.entityType === "category", be = (e) => e.entityType === "brand", Ve = (e) => e.entityType === "collection", gr = (e, n) => {
|
|
1561
|
+
const t = Ue(ur), r = async (i) => Promise.all(
|
|
1546
1562
|
i.map(
|
|
1547
1563
|
(a) => t(async () => {
|
|
1548
1564
|
const o = a.slug.toLowerCase(), s = a.locale, c = await n.commerce.catalog.byLinkId.category(
|
|
@@ -1573,18 +1589,18 @@ const sr = ({
|
|
|
1573
1589
|
})
|
|
1574
1590
|
)
|
|
1575
1591
|
);
|
|
1576
|
-
return new
|
|
1592
|
+
return new fe(r, {
|
|
1577
1593
|
// DataLoader is used for caching, not batching
|
|
1578
1594
|
batch: !1,
|
|
1579
1595
|
// Dedup by lowercased slug + captured locale so casing variants share an
|
|
1580
1596
|
// entry while same-slug / different-locale loads stay isolated.
|
|
1581
1597
|
cacheKeyFn: ({ slug: i, locale: a }) => `${i.toLowerCase()}::${a ?? ""}`
|
|
1582
1598
|
});
|
|
1583
|
-
},
|
|
1599
|
+
}, mr = (e, n) => {
|
|
1584
1600
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1585
|
-
return new
|
|
1586
|
-
},
|
|
1587
|
-
const t =
|
|
1601
|
+
return new fe(t);
|
|
1602
|
+
}, hr = 1, fr = (e, n) => {
|
|
1603
|
+
const t = Ue(hr), r = async (a) => {
|
|
1588
1604
|
const o = a.reduce((p, { items: f }) => [...p, f], []), s = [...o.flat()], c = await n.commerce.checkout.simulation({
|
|
1589
1605
|
country: a[0].country,
|
|
1590
1606
|
postalCode: a[0].postalCode,
|
|
@@ -1604,20 +1620,20 @@ const sr = ({
|
|
|
1604
1620
|
items: d.slice(g[f], g[f + 1]).filter((h) => !!h)
|
|
1605
1621
|
}));
|
|
1606
1622
|
}, i = async (a) => t(r, a);
|
|
1607
|
-
return new
|
|
1623
|
+
return new fe(i, {
|
|
1608
1624
|
maxBatchSize: 50
|
|
1609
1625
|
});
|
|
1610
|
-
},
|
|
1611
|
-
function
|
|
1626
|
+
}, Sr = (e, n) => at(e, n);
|
|
1627
|
+
function yr(e) {
|
|
1612
1628
|
return {
|
|
1613
1629
|
...e,
|
|
1614
|
-
description: e.description ?
|
|
1630
|
+
description: e.description ? Sr(e.description) : e.description
|
|
1615
1631
|
};
|
|
1616
1632
|
}
|
|
1617
1633
|
const L = (e, n) => ({
|
|
1618
1634
|
...e,
|
|
1619
|
-
isVariantOf:
|
|
1620
|
-
}),
|
|
1635
|
+
isVariantOf: yr(n)
|
|
1636
|
+
}), Ir = ({ flags: e }, n) => {
|
|
1621
1637
|
const t = async (r) => {
|
|
1622
1638
|
const i = r.map((g) => g.split("-")[0]), a = r.some(
|
|
1623
1639
|
(g) => g.split("-")[1] === "invisibleItems"
|
|
@@ -1642,31 +1658,31 @@ const L = (e, n) => ({
|
|
|
1642
1658
|
);
|
|
1643
1659
|
return c;
|
|
1644
1660
|
};
|
|
1645
|
-
return new
|
|
1661
|
+
return new fe(t, {
|
|
1646
1662
|
maxBatchSize: 99
|
|
1647
1663
|
// Max allowed batch size of Search API
|
|
1648
1664
|
});
|
|
1649
|
-
},
|
|
1650
|
-
const { clients: t } = n, r =
|
|
1665
|
+
}, vr = (e, n) => {
|
|
1666
|
+
const { clients: t } = n, r = Ir(e, t), i = fr(e, t), a = gr(e, t), o = mr(e, t);
|
|
1651
1667
|
return {
|
|
1652
1668
|
skuLoader: r,
|
|
1653
1669
|
simulationLoader: i,
|
|
1654
1670
|
collectionLoader: a,
|
|
1655
1671
|
salesChannelLoader: o
|
|
1656
1672
|
};
|
|
1657
|
-
}, M = (e) => e.AvailableQuantity > 0,
|
|
1673
|
+
}, M = (e) => e.AvailableQuantity > 0, Y = (e) => e.spotPrice ?? 0, Or = (e) => e.Price ?? 0, qe = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", An = (e, n) => M(e) && !M(n) ? -1 : !M(e) && M(n) ? 1 : Y(e) - Y(n), Cr = (e) => e === "available", G = (e, n = 0, t = 1) => {
|
|
1658
1674
|
const r = n / t;
|
|
1659
1675
|
return Math.round((e + r) * 100) / 100;
|
|
1660
|
-
},
|
|
1661
|
-
const t = e.filter(M), r = t[t.length - 1], i = r ?
|
|
1662
|
-
return n.includeTaxes ?
|
|
1663
|
-
},
|
|
1664
|
-
const [t] = e.filter(M), r = t ?
|
|
1665
|
-
return n.includeTaxes ?
|
|
1666
|
-
},
|
|
1667
|
-
highPrice: (e) =>
|
|
1668
|
-
lowPrice: (e) =>
|
|
1669
|
-
lowPriceWithTaxes: (e) =>
|
|
1676
|
+
}, br = (e, n = { includeTaxes: !1 }) => {
|
|
1677
|
+
const t = e.filter(M), r = t[t.length - 1], i = r ? Y(r) : 0;
|
|
1678
|
+
return n.includeTaxes ? G(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1679
|
+
}, xe = (e, n = { includeTaxes: !1 }) => {
|
|
1680
|
+
const [t] = e.filter(M), r = t ? Y(t) : 0;
|
|
1681
|
+
return n.includeTaxes ? G(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1682
|
+
}, wr = {
|
|
1683
|
+
highPrice: (e) => br(e),
|
|
1684
|
+
lowPrice: (e) => xe(e),
|
|
1685
|
+
lowPriceWithTaxes: (e) => xe(e, { includeTaxes: !0 }),
|
|
1670
1686
|
offerCount: (e) => e.length,
|
|
1671
1687
|
priceCurrency: async (e, n, t) => {
|
|
1672
1688
|
const {
|
|
@@ -1676,20 +1692,20 @@ const L = (e, n) => ({
|
|
|
1676
1692
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1677
1693
|
},
|
|
1678
1694
|
offers: (e) => e
|
|
1679
|
-
},
|
|
1695
|
+
}, Ar = {
|
|
1680
1696
|
ratingValue: () => 5,
|
|
1681
1697
|
reviewCount: () => 0
|
|
1682
|
-
},
|
|
1698
|
+
}, je = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", Dr = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", Pr = (e) => {
|
|
1683
1699
|
let n = e.slice(0);
|
|
1684
|
-
for (let t = 0; t <
|
|
1685
|
-
n = n.replace(new RegExp(
|
|
1700
|
+
for (let t = 0; t < je.length; t++)
|
|
1701
|
+
n = n.replace(new RegExp(je.charAt(t), "g"), Dr.charAt(t));
|
|
1686
1702
|
return n;
|
|
1687
|
-
},
|
|
1688
|
-
function
|
|
1703
|
+
}, kr = (e) => e.replace(/[·/_,:]/, "-");
|
|
1704
|
+
function ge(e) {
|
|
1689
1705
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1690
|
-
return
|
|
1706
|
+
return kr(Pr(t)).toLowerCase();
|
|
1691
1707
|
}
|
|
1692
|
-
const
|
|
1708
|
+
const ye = (e) => e.toLowerCase(), le = (e, n) => {
|
|
1693
1709
|
const t = n.split("/").filter(Boolean), {
|
|
1694
1710
|
loaders: { collectionLoader: r }
|
|
1695
1711
|
} = e;
|
|
@@ -1697,13 +1713,13 @@ const Se = (e) => e.toLowerCase(), se = (e, n) => {
|
|
|
1697
1713
|
t.map(
|
|
1698
1714
|
(i, a) => r.load({
|
|
1699
1715
|
slug: t.slice(0, a + 1).join("/"),
|
|
1700
|
-
locale:
|
|
1716
|
+
locale: vn(e)
|
|
1701
1717
|
})
|
|
1702
1718
|
)
|
|
1703
1719
|
);
|
|
1704
|
-
},
|
|
1720
|
+
}, j = (e) => pr(e) ? e.slug : be(e) ? e.linkId : e.linkId ?? ge(e.name), Dn = {
|
|
1705
1721
|
id: ({ id: e }) => e.toString(),
|
|
1706
|
-
slug: (e) =>
|
|
1722
|
+
slug: (e) => j(e),
|
|
1707
1723
|
seo: (e) => ({
|
|
1708
1724
|
title: e.title ?? e.name,
|
|
1709
1725
|
// pagetype.metaTagDescription and catalog `description` share the same
|
|
@@ -1711,26 +1727,26 @@ const Se = (e) => e.toLowerCase(), se = (e, n) => {
|
|
|
1711
1727
|
// for forward-compat; fall back to description for by-linkid parity.
|
|
1712
1728
|
description: e.metaTagDescription ?? e.description
|
|
1713
1729
|
}),
|
|
1714
|
-
type: (e) =>
|
|
1730
|
+
type: (e) => be(e) ? "Brand" : Ve(e) ? "Collection" : e.fatherCategoryId === null ? "Department" : "Category",
|
|
1715
1731
|
meta: async (e, n, t) => {
|
|
1716
|
-
const r =
|
|
1717
|
-
if (
|
|
1732
|
+
const r = j(e);
|
|
1733
|
+
if (be(e))
|
|
1718
1734
|
return { selectedFacets: [{ key: "brand", value: r }] };
|
|
1719
|
-
if (
|
|
1735
|
+
if (Ve(e))
|
|
1720
1736
|
return { selectedFacets: [{ key: "productclusterids", value: e.id }] };
|
|
1721
|
-
const { defaultLocale: i } =
|
|
1737
|
+
const { defaultLocale: i } = re(t);
|
|
1722
1738
|
return {
|
|
1723
|
-
selectedFacets: (await
|
|
1739
|
+
selectedFacets: (await le(t, r)).map((o, s) => ({
|
|
1724
1740
|
key: `category-${s + 1}`,
|
|
1725
1741
|
value: i && o.availableLinkIds?.[i] || o.linkId
|
|
1726
1742
|
}))
|
|
1727
1743
|
};
|
|
1728
1744
|
},
|
|
1729
1745
|
breadcrumbList: async (e, n, t) => {
|
|
1730
|
-
const r = await
|
|
1746
|
+
const r = await le(t, j(e));
|
|
1731
1747
|
return {
|
|
1732
1748
|
itemListElement: r.map((i, a) => ({
|
|
1733
|
-
item: `/${
|
|
1749
|
+
item: `/${j(i)}`,
|
|
1734
1750
|
name: i.name,
|
|
1735
1751
|
position: a + 1
|
|
1736
1752
|
})),
|
|
@@ -1738,15 +1754,15 @@ const Se = (e) => e.toLowerCase(), se = (e, n) => {
|
|
|
1738
1754
|
};
|
|
1739
1755
|
},
|
|
1740
1756
|
otherLocales: async (e, n, t) => {
|
|
1741
|
-
const r =
|
|
1757
|
+
const r = re(t);
|
|
1742
1758
|
if (!r.enabled) return null;
|
|
1743
1759
|
const i = Object.keys(r.locales ?? {});
|
|
1744
1760
|
if (i.length === 0) return null;
|
|
1745
|
-
const a =
|
|
1761
|
+
const a = j(e);
|
|
1746
1762
|
if (a.split("/").filter(Boolean).length === 0) return null;
|
|
1747
1763
|
let o;
|
|
1748
1764
|
try {
|
|
1749
|
-
o = await
|
|
1765
|
+
o = await le(t, a);
|
|
1750
1766
|
} catch (s) {
|
|
1751
1767
|
return console.warn("[otherLocales] failed to load collection entities:", s), null;
|
|
1752
1768
|
}
|
|
@@ -1759,30 +1775,30 @@ const Se = (e) => e.toLowerCase(), se = (e, n) => {
|
|
|
1759
1775
|
}
|
|
1760
1776
|
return c.length > 0 ? {
|
|
1761
1777
|
locale: s,
|
|
1762
|
-
slug:
|
|
1778
|
+
slug: ye(c.join("/"))
|
|
1763
1779
|
} : null;
|
|
1764
1780
|
}).filter((s) => s !== null);
|
|
1765
1781
|
},
|
|
1766
1782
|
canonicalSlug: async (e, n, t) => {
|
|
1767
|
-
const r =
|
|
1783
|
+
const r = j(e);
|
|
1768
1784
|
if (r.split("/").filter(Boolean).length === 0) return null;
|
|
1769
1785
|
let i;
|
|
1770
1786
|
try {
|
|
1771
|
-
i = await
|
|
1787
|
+
i = await le(t, r);
|
|
1772
1788
|
} catch (o) {
|
|
1773
1789
|
return console.warn("[canonicalSlug] failed to load collection entities:", o), null;
|
|
1774
1790
|
}
|
|
1775
1791
|
const a = i.map((o) => o.linkId);
|
|
1776
|
-
return a.every((o) => !!o) ?
|
|
1792
|
+
return a.every((o) => !!o) ? ye(a.join("/")) : ye(r);
|
|
1777
1793
|
}
|
|
1778
|
-
},
|
|
1794
|
+
}, Pn = {
|
|
1779
1795
|
buy: "whoboughtalsobought",
|
|
1780
1796
|
view: "whosawalsosaw",
|
|
1781
1797
|
similars: "similars",
|
|
1782
1798
|
viewAndBought: "whosawalsobought",
|
|
1783
1799
|
accessories: "accessories",
|
|
1784
1800
|
suggestions: "suggestions"
|
|
1785
|
-
},
|
|
1801
|
+
}, We = ({ key: e, value: n }) => {
|
|
1786
1802
|
switch (e) {
|
|
1787
1803
|
case "price":
|
|
1788
1804
|
return { key: e, value: n.replace("-to-", ":") };
|
|
@@ -1798,61 +1814,61 @@ const Se = (e) => e.toLowerCase(), se = (e, n) => {
|
|
|
1798
1814
|
default:
|
|
1799
1815
|
return { key: e, value: n };
|
|
1800
1816
|
}
|
|
1801
|
-
},
|
|
1817
|
+
}, He = (e) => {
|
|
1802
1818
|
const n = e.split(":").map(Number);
|
|
1803
1819
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1804
|
-
},
|
|
1820
|
+
}, Er = (e) => typeof Pn[e] == "string", Ur = (e) => {
|
|
1805
1821
|
const n = e?.filter(
|
|
1806
|
-
(t) =>
|
|
1822
|
+
(t) => Er(t.key)
|
|
1807
1823
|
);
|
|
1808
1824
|
if (Array.isArray(n) && n.length > 1)
|
|
1809
|
-
throw new
|
|
1825
|
+
throw new U(
|
|
1810
1826
|
`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(",")}`
|
|
1811
1827
|
);
|
|
1812
1828
|
return n?.[0] ?? null;
|
|
1813
|
-
},
|
|
1829
|
+
}, _r = (e) => e?.find((n) => n.key === "slug")?.value ?? null, Rr = (e) => e?.find((n) => n.key === "id")?.value ?? null, Ge = (e) => e?.find((n) => n.key === "locale")?.value ?? null, Xe = (e) => e?.find((n) => n.key === "channel")?.value ?? null, we = (e, n) => {
|
|
1814
1830
|
let t = 0;
|
|
1815
1831
|
for (let r = 1; r < e.length; r++)
|
|
1816
1832
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1817
1833
|
return e[t];
|
|
1818
|
-
},
|
|
1834
|
+
}, Tr = {
|
|
1819
1835
|
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1820
|
-
},
|
|
1836
|
+
}, Fr = {
|
|
1821
1837
|
key: ({ key: e }) => e,
|
|
1822
1838
|
label: ({ name: e }) => e,
|
|
1823
1839
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1824
|
-
},
|
|
1840
|
+
}, Nr = {
|
|
1825
1841
|
key: ({ key: e }) => e,
|
|
1826
1842
|
label: ({ name: e }) => e,
|
|
1827
1843
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1828
|
-
const i =
|
|
1844
|
+
const i = He(
|
|
1829
1845
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1830
|
-
), o =
|
|
1846
|
+
), o = we(e, (s, c) => s.range.from - c.range.from)?.range?.from ?? 0;
|
|
1831
1847
|
return {
|
|
1832
1848
|
selected: i?.[0] ?? o,
|
|
1833
1849
|
absolute: o
|
|
1834
1850
|
};
|
|
1835
1851
|
},
|
|
1836
1852
|
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1837
|
-
const i =
|
|
1853
|
+
const i = He(
|
|
1838
1854
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1839
|
-
), o =
|
|
1855
|
+
), o = we(e, (s, c) => c.range.to - s.range.to)?.range?.to ?? 0;
|
|
1840
1856
|
return {
|
|
1841
1857
|
selected: i?.[1] ?? o,
|
|
1842
1858
|
absolute: o
|
|
1843
1859
|
};
|
|
1844
1860
|
}
|
|
1845
|
-
},
|
|
1861
|
+
}, Lr = {
|
|
1846
1862
|
value: ({ value: e }) => e,
|
|
1847
1863
|
label: ({ name: e }) => e || "unknown",
|
|
1848
1864
|
selected: ({ selected: e }) => e,
|
|
1849
1865
|
quantity: ({ quantity: e }) => e
|
|
1850
|
-
},
|
|
1866
|
+
}, Br = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1851
1867
|
if (!n?.orderId)
|
|
1852
|
-
throw new
|
|
1868
|
+
throw new U("Missing orderId");
|
|
1853
1869
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1854
1870
|
};
|
|
1855
|
-
function
|
|
1871
|
+
function kn(e) {
|
|
1856
1872
|
if (!e || e.status !== "pending")
|
|
1857
1873
|
return null;
|
|
1858
1874
|
for (const n of e.dimensionStatus) {
|
|
@@ -1870,45 +1886,45 @@ function Dn(e) {
|
|
|
1870
1886
|
}
|
|
1871
1887
|
return null;
|
|
1872
1888
|
}
|
|
1873
|
-
function
|
|
1889
|
+
function $r(e) {
|
|
1874
1890
|
if (!e || e.status !== "pending") return !1;
|
|
1875
1891
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1876
1892
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1877
1893
|
}
|
|
1878
|
-
const
|
|
1879
|
-
const r = await t.oms.processOrderAuthorization(n), i =
|
|
1894
|
+
const Mr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1895
|
+
const r = await t.oms.processOrderAuthorization(n), i = kn(r);
|
|
1880
1896
|
return {
|
|
1881
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1897
|
+
isPendingForOtherAuthorizer: !i && $r(r),
|
|
1882
1898
|
ruleForAuthorization: i
|
|
1883
1899
|
};
|
|
1884
|
-
},
|
|
1900
|
+
}, zr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1885
1901
|
if (!n?.objectKey)
|
|
1886
|
-
throw new
|
|
1902
|
+
throw new U("Missing objectKey");
|
|
1887
1903
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
1888
1904
|
return t.orderEntry.startOperation({
|
|
1889
1905
|
objectKey: n.objectKey,
|
|
1890
1906
|
orderFormId: r,
|
|
1891
1907
|
sessionToken: n.sessionToken ?? void 0
|
|
1892
1908
|
});
|
|
1893
|
-
},
|
|
1909
|
+
}, Vr = async (e, n, t) => {
|
|
1894
1910
|
if (!(await t.clients.commerce.recommendation.startRecommendationSession())?.recommendationsUserId)
|
|
1895
1911
|
throw new Error(
|
|
1896
1912
|
"Failed to start recommendation session: no session data returned"
|
|
1897
1913
|
);
|
|
1898
1914
|
return !0;
|
|
1899
|
-
},
|
|
1915
|
+
}, qr = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), xr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1900
1916
|
const { fileContent: r, fileName: i, mimeType: a } = n;
|
|
1901
1917
|
if (!r || !i || !a)
|
|
1902
|
-
throw new
|
|
1918
|
+
throw new U(
|
|
1903
1919
|
"Missing required fields: fileContent, fileName, mimeType"
|
|
1904
1920
|
);
|
|
1905
1921
|
const o = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
|
|
1906
1922
|
if (Math.floor(o.length * 3 / 4) > s)
|
|
1907
|
-
throw new
|
|
1923
|
+
throw new U("File exceeds maximum allowed size of 5MB");
|
|
1908
1924
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
|
|
1909
1925
|
o
|
|
1910
1926
|
))
|
|
1911
|
-
throw new
|
|
1927
|
+
throw new U("Invalid Base64 fileContent");
|
|
1912
1928
|
const g = Buffer.from(o, "base64");
|
|
1913
1929
|
return await t.orderEntry.uploadFile({
|
|
1914
1930
|
fileBuffer: g,
|
|
@@ -1916,7 +1932,7 @@ const Br = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
|
1916
1932
|
mimeType: a
|
|
1917
1933
|
});
|
|
1918
1934
|
};
|
|
1919
|
-
class
|
|
1935
|
+
class ae {
|
|
1920
1936
|
static parse(n) {
|
|
1921
1937
|
try {
|
|
1922
1938
|
const t = JSON.parse(n);
|
|
@@ -1934,35 +1950,35 @@ class ie {
|
|
|
1934
1950
|
return JSON.stringify(n);
|
|
1935
1951
|
}
|
|
1936
1952
|
}
|
|
1937
|
-
function
|
|
1938
|
-
return n == null || n === "" || String(n) === String(e.salesChannel ?? "") ? null :
|
|
1953
|
+
function jr(e, n) {
|
|
1954
|
+
return n == null || n === "" || String(n) === String(e.salesChannel ?? "") ? null : ae.stringify({
|
|
1939
1955
|
...e,
|
|
1940
1956
|
salesChannel: String(n),
|
|
1941
1957
|
hasOnlyDefaultSalesChannel: !1
|
|
1942
1958
|
});
|
|
1943
1959
|
}
|
|
1944
|
-
function
|
|
1960
|
+
function Wr(e, n, t) {
|
|
1945
1961
|
return t != null && String(e.salesChannel ?? "") === t && String(n ?? "") !== t ? !1 : e.items.length > 0 ? !0 : e.salesChannel == null || e.salesChannel === "" ? !1 : String(e.salesChannel) === String(n ?? "");
|
|
1946
1962
|
}
|
|
1947
|
-
const
|
|
1963
|
+
const En = (e) => {
|
|
1948
1964
|
try {
|
|
1949
1965
|
return JSON.parse(e ?? "") ?? {};
|
|
1950
1966
|
} catch {
|
|
1951
1967
|
return {};
|
|
1952
1968
|
}
|
|
1953
1969
|
};
|
|
1954
|
-
function
|
|
1955
|
-
const t =
|
|
1970
|
+
function Un(e, { localizationEnabled: n = !0 } = {}) {
|
|
1971
|
+
const t = En(e).salesChannelSource;
|
|
1956
1972
|
return t === "url" ? n ? t : void 0 : t === "orderForm" ? t : void 0;
|
|
1957
1973
|
}
|
|
1958
|
-
const
|
|
1959
|
-
function
|
|
1960
|
-
const n =
|
|
1974
|
+
const _n = (e) => !!e?.localization?.enabled;
|
|
1975
|
+
function Rn(e) {
|
|
1976
|
+
const n = En(e).rejectedSalesChannel;
|
|
1961
1977
|
return (typeof n == "string" || typeof n == "number") && String(n) || void 0;
|
|
1962
1978
|
}
|
|
1963
|
-
function
|
|
1979
|
+
function Hr(e, n, t, r, i, a) {
|
|
1964
1980
|
const o = n ?? void 0, s = t ?? e.regionId, c = i ? e.salesChannel || o : o ?? e.salesChannel, d = a != null && a !== String(c ?? "");
|
|
1965
|
-
return
|
|
1981
|
+
return ae.stringify({
|
|
1966
1982
|
salesChannel: c,
|
|
1967
1983
|
regionId: s ?? void 0,
|
|
1968
1984
|
seller: r,
|
|
@@ -1971,16 +1987,16 @@ function jr(e, n, t, r, i, a) {
|
|
|
1971
1987
|
...d ? { rejectedSalesChannel: a } : {}
|
|
1972
1988
|
});
|
|
1973
1989
|
}
|
|
1974
|
-
const
|
|
1975
|
-
function
|
|
1990
|
+
const Ye = "1";
|
|
1991
|
+
function Gr(e, n, t, r) {
|
|
1976
1992
|
const i = String(e.salesChannel ?? "");
|
|
1977
|
-
return n === void 0 && i ===
|
|
1993
|
+
return n === void 0 && i === Ye && !!t && t !== Ye && !new URLSearchParams(r).has("sc") ? t : i;
|
|
1978
1994
|
}
|
|
1979
|
-
const
|
|
1980
|
-
e.storage.channel =
|
|
1981
|
-
},
|
|
1995
|
+
const ne = (e, n) => {
|
|
1996
|
+
e.storage.channel = ae.parse(n);
|
|
1997
|
+
}, Ae = (e, n) => {
|
|
1982
1998
|
e.storage.locale = n;
|
|
1983
|
-
},
|
|
1999
|
+
}, Re = (e) => ot.createHash("md5").update(e).digest("hex"), V = {
|
|
1984
2000
|
attachment: "ATTACHMENT",
|
|
1985
2001
|
specification: "SPECIFICATION",
|
|
1986
2002
|
attribute: "ATTRIBUTE",
|
|
@@ -1991,14 +2007,14 @@ const pe = (e, n) => {
|
|
|
1991
2007
|
*/
|
|
1992
2008
|
service: "SERVICE"
|
|
1993
2009
|
};
|
|
1994
|
-
function
|
|
2010
|
+
function Tn(e) {
|
|
1995
2011
|
return {
|
|
1996
2012
|
name: e.name,
|
|
1997
2013
|
value: e.content,
|
|
1998
2014
|
valueReference: V.attachment
|
|
1999
2015
|
};
|
|
2000
2016
|
}
|
|
2001
|
-
function
|
|
2017
|
+
function Xr(e) {
|
|
2002
2018
|
return {
|
|
2003
2019
|
propertyID: e.id,
|
|
2004
2020
|
name: e.name,
|
|
@@ -2009,27 +2025,27 @@ function Gr(e) {
|
|
|
2009
2025
|
}
|
|
2010
2026
|
};
|
|
2011
2027
|
}
|
|
2012
|
-
function
|
|
2013
|
-
return
|
|
2028
|
+
function Fn(e) {
|
|
2029
|
+
return Re(
|
|
2014
2030
|
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
2015
2031
|
);
|
|
2016
2032
|
}
|
|
2017
|
-
const
|
|
2033
|
+
const Nn = (e, n) => e < n ? -1 : e > n ? 1 : 0, Yr = (e, n) => Nn(e.name, n.name), Jr = (e) => [...e ?? []].sort(Yr), Je = (e) => e !== null && typeof e == "object" && !Array.isArray(e), Kr = (e) => Je(e) && typeof e.name == "string" && Je(e.content), Qr = (e) => ({
|
|
2018
2034
|
name: e.name,
|
|
2019
2035
|
content: Object.fromEntries(
|
|
2020
|
-
Object.keys(e.content).sort(
|
|
2036
|
+
Object.keys(e.content).sort(Nn).map((n) => [n, e.content[n]])
|
|
2021
2037
|
)
|
|
2022
|
-
}),
|
|
2038
|
+
}), Ln = (e, n) => Re(
|
|
2023
2039
|
`SERVICE:${e}:${JSON.stringify(
|
|
2024
|
-
|
|
2025
|
-
|
|
2040
|
+
Jr((n ?? []).filter(Kr)).map(
|
|
2041
|
+
Qr
|
|
2026
2042
|
)
|
|
2027
2043
|
)}`
|
|
2028
|
-
),
|
|
2029
|
-
function
|
|
2044
|
+
), Zr = "SERVICE:unreadable";
|
|
2045
|
+
function Te(e) {
|
|
2030
2046
|
const n = e.attachments ?? [];
|
|
2031
2047
|
return {
|
|
2032
|
-
propertyID:
|
|
2048
|
+
propertyID: Ln(e.id, n),
|
|
2033
2049
|
name: e.name,
|
|
2034
2050
|
value: {
|
|
2035
2051
|
id: e.id,
|
|
@@ -2039,27 +2055,27 @@ function Re(e) {
|
|
|
2039
2055
|
valueReference: V.service
|
|
2040
2056
|
};
|
|
2041
2057
|
}
|
|
2042
|
-
const
|
|
2058
|
+
const ei = (e) => {
|
|
2043
2059
|
try {
|
|
2044
2060
|
return JSON.parse(e);
|
|
2045
2061
|
} catch {
|
|
2046
2062
|
return null;
|
|
2047
2063
|
}
|
|
2048
|
-
},
|
|
2049
|
-
const n = typeof e == "string" ?
|
|
2064
|
+
}, ni = (e) => {
|
|
2065
|
+
const n = typeof e == "string" ? ei(e) : e;
|
|
2050
2066
|
if (n === null || typeof n != "object")
|
|
2051
2067
|
return null;
|
|
2052
2068
|
const { id: t, attachments: r } = n;
|
|
2053
2069
|
return typeof t != "string" && typeof t != "number" ? null : { id: String(t), attachments: r };
|
|
2054
2070
|
};
|
|
2055
|
-
function
|
|
2056
|
-
const n =
|
|
2057
|
-
return n ?
|
|
2071
|
+
function ti(e) {
|
|
2072
|
+
const n = ni(e.value);
|
|
2073
|
+
return n ? Ln(
|
|
2058
2074
|
n.id,
|
|
2059
2075
|
Array.isArray(n.attachments) ? n.attachments : []
|
|
2060
|
-
) :
|
|
2076
|
+
) : Zr;
|
|
2061
2077
|
}
|
|
2062
|
-
const
|
|
2078
|
+
const ri = (e) => {
|
|
2063
2079
|
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
2064
2080
|
addressType: e.addressType || null,
|
|
2065
2081
|
postalCode: n || null,
|
|
@@ -2078,7 +2094,7 @@ const ni = (e) => {
|
|
|
2078
2094
|
r.geoCoordinates = i !== null && a !== null ? [a, i] : [];
|
|
2079
2095
|
}
|
|
2080
2096
|
return [r];
|
|
2081
|
-
},
|
|
2097
|
+
}, ii = (e, n, t) => {
|
|
2082
2098
|
const r = n.postalCode, i = n.geoCoordinates, a = e?.shippingData?.availableAddresses ?? [], o = e?.shippingData?.selectedAddresses ?? [];
|
|
2083
2099
|
if (!t && o.length > 0)
|
|
2084
2100
|
return [o[0]];
|
|
@@ -2092,17 +2108,17 @@ const ni = (e) => {
|
|
|
2092
2108
|
return [s];
|
|
2093
2109
|
}
|
|
2094
2110
|
return null;
|
|
2095
|
-
},
|
|
2096
|
-
if (!
|
|
2111
|
+
}, Bn = (e, n) => {
|
|
2112
|
+
if (!ai(n))
|
|
2097
2113
|
return { updateShipping: !1, addressChanged: !1 };
|
|
2098
|
-
if (!
|
|
2114
|
+
if (!li(e))
|
|
2099
2115
|
return { updateShipping: !1, addressChanged: !1 };
|
|
2100
2116
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
2101
|
-
if (
|
|
2117
|
+
if (oi(t, n.postalCode) || si(t, n.geoCoordinates) || ci(t, n.addressType))
|
|
2102
2118
|
return { updateShipping: !0, addressChanged: !0 };
|
|
2103
2119
|
const { logisticsInfo: r } = e.shippingData;
|
|
2104
|
-
return
|
|
2105
|
-
},
|
|
2120
|
+
return di(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
2121
|
+
}, ai = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, oi = (e, n) => typeof n == "string" && e?.postalCode !== n, si = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), ci = (e, n) => typeof n == "string" && e?.addressType !== n, li = (e) => e.items.length !== 0, di = (e, n) => {
|
|
2106
2122
|
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
|
|
2107
2123
|
return e.some(
|
|
2108
2124
|
({ selectedDeliveryChannel: o, selectedSla: s, slas: c }) => {
|
|
@@ -2112,16 +2128,16 @@ const ni = (e) => {
|
|
|
2112
2128
|
));
|
|
2113
2129
|
}
|
|
2114
2130
|
);
|
|
2115
|
-
},
|
|
2116
|
-
const n =
|
|
2131
|
+
}, $n = (e) => e.valueReference === V.attachment, ui = (e) => e.valueReference === V.service, pi = (e) => (e.itemOffered.additionalProperty ?? []).filter(ui).map(ti).sort((n, t) => n.localeCompare(t)), Mn = (e) => {
|
|
2132
|
+
const n = pi(e);
|
|
2117
2133
|
return n.length > 0 ? `services:${n.join("-")}` : void 0;
|
|
2118
|
-
},
|
|
2134
|
+
}, De = (e) => [
|
|
2119
2135
|
e.itemOffered.sku,
|
|
2120
2136
|
e.seller.identifier,
|
|
2121
2137
|
e.price < 0.01 ? "Gift" : void 0,
|
|
2122
|
-
e.itemOffered.additionalProperty?.filter(
|
|
2123
|
-
|
|
2124
|
-
].filter(Boolean).join("::"),
|
|
2138
|
+
e.itemOffered.additionalProperty?.filter($n).map(Fn).join("-"),
|
|
2139
|
+
Mn(e)
|
|
2140
|
+
].filter(Boolean).join("::"), me = (e, n) => ({
|
|
2125
2141
|
listPrice: e.listPrice / 100,
|
|
2126
2142
|
price: e.sellingPrice / 100,
|
|
2127
2143
|
quantity: e.quantity,
|
|
@@ -2131,49 +2147,49 @@ const ni = (e) => {
|
|
|
2131
2147
|
image: [],
|
|
2132
2148
|
name: e.name,
|
|
2133
2149
|
additionalProperty: [
|
|
2134
|
-
...e.attachments.map(
|
|
2135
|
-
...(e.bundleItems ?? []).map(
|
|
2150
|
+
...e.attachments.map(Tn),
|
|
2151
|
+
...(e.bundleItems ?? []).map(Te)
|
|
2136
2152
|
]
|
|
2137
2153
|
},
|
|
2138
2154
|
index: n
|
|
2139
|
-
}),
|
|
2155
|
+
}), gi = (e) => ({
|
|
2140
2156
|
quantity: e.quantity,
|
|
2141
2157
|
seller: e.seller.identifier,
|
|
2142
2158
|
id: e.itemOffered.sku,
|
|
2143
2159
|
index: e.index,
|
|
2144
|
-
attachments: (e.itemOffered.additionalProperty?.filter(
|
|
2160
|
+
attachments: (e.itemOffered.additionalProperty?.filter($n) ?? []).map((n) => ({
|
|
2145
2161
|
name: n.name,
|
|
2146
2162
|
content: n.value
|
|
2147
2163
|
})),
|
|
2148
2164
|
...e.priceToken ? { priceToken: e.priceToken } : {}
|
|
2149
|
-
}),
|
|
2150
|
-
const r =
|
|
2165
|
+
}), Ke = (e) => e.reduce((n, t) => {
|
|
2166
|
+
const r = De(t);
|
|
2151
2167
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
2152
|
-
}, /* @__PURE__ */ new Map()),
|
|
2168
|
+
}, /* @__PURE__ */ new Map()), mi = (e, n) => {
|
|
2153
2169
|
const t = ({ priceToken: s, ...c }, d) => ({
|
|
2154
2170
|
...c,
|
|
2155
2171
|
itemOffered: {
|
|
2156
2172
|
sku: c.itemOffered.sku
|
|
2157
2173
|
},
|
|
2158
|
-
services:
|
|
2174
|
+
services: Mn(c),
|
|
2159
2175
|
index: d
|
|
2160
|
-
}), r = n.items.map(
|
|
2176
|
+
}), r = n.items.map(me).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = _e(r, i);
|
|
2161
2177
|
return a && o;
|
|
2162
2178
|
};
|
|
2163
|
-
function
|
|
2179
|
+
function zn(e, n) {
|
|
2164
2180
|
return e?.some(
|
|
2165
2181
|
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 && e[t.parentItemIndex]?.id === n
|
|
2166
2182
|
);
|
|
2167
2183
|
}
|
|
2168
|
-
function
|
|
2184
|
+
function Vn(e, n) {
|
|
2169
2185
|
return e?.some(
|
|
2170
2186
|
(t) => t.id === n && t.parentItemIndex !== null
|
|
2171
2187
|
);
|
|
2172
2188
|
}
|
|
2173
|
-
const
|
|
2189
|
+
const Qe = (e) => {
|
|
2174
2190
|
const n = e.items.reduce(
|
|
2175
2191
|
(t, r, i) => {
|
|
2176
|
-
const a =
|
|
2192
|
+
const a = Vn(e.items, r.id) || zn(e.items, r.id) ? `${De(me(r))}::${i}` : De(me(r));
|
|
2177
2193
|
return t[a] || (t[a] = []), t[a].push(r), t;
|
|
2178
2194
|
},
|
|
2179
2195
|
{}
|
|
@@ -2192,7 +2208,7 @@ const Ke = (e) => {
|
|
|
2192
2208
|
};
|
|
2193
2209
|
})
|
|
2194
2210
|
};
|
|
2195
|
-
},
|
|
2211
|
+
}, Pe = async (e, n, t, r) => ({
|
|
2196
2212
|
order: {
|
|
2197
2213
|
orderNumber: e.orderFormId,
|
|
2198
2214
|
acceptedOffer: e.items.map(async (i) => ({
|
|
@@ -2206,9 +2222,9 @@ const Ke = (e) => {
|
|
|
2206
2222
|
text: i,
|
|
2207
2223
|
status: a.toUpperCase()
|
|
2208
2224
|
}))
|
|
2209
|
-
}),
|
|
2225
|
+
}), qn = ({ items: e }, n) => {
|
|
2210
2226
|
const t = e.map((r) => {
|
|
2211
|
-
const i = (r.bundleItems ?? []).map(
|
|
2227
|
+
const i = (r.bundleItems ?? []).map(Te).map(({ propertyID: a }) => a).sort((a, o) => a.localeCompare(o));
|
|
2212
2228
|
return {
|
|
2213
2229
|
id: r.id,
|
|
2214
2230
|
quantity: r.quantity,
|
|
@@ -2218,16 +2234,16 @@ const Ke = (e) => {
|
|
|
2218
2234
|
...i.length > 0 ? { services: i } : {}
|
|
2219
2235
|
};
|
|
2220
2236
|
});
|
|
2221
|
-
return
|
|
2237
|
+
return Re(
|
|
2222
2238
|
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
2223
2239
|
);
|
|
2224
|
-
},
|
|
2240
|
+
}, Ze = async (e, n, t) => {
|
|
2225
2241
|
try {
|
|
2226
2242
|
return await n.checkout.setCustomData({
|
|
2227
2243
|
id: e.orderFormId,
|
|
2228
2244
|
appId: "faststore",
|
|
2229
2245
|
key: "cartEtag",
|
|
2230
|
-
value:
|
|
2246
|
+
value: qn(e, t)
|
|
2231
2247
|
});
|
|
2232
2248
|
} catch (r) {
|
|
2233
2249
|
throw console.error(
|
|
@@ -2237,22 +2253,22 @@ const Ke = (e) => {
|
|
|
2237
2253
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
2238
2254
|
), r;
|
|
2239
2255
|
}
|
|
2240
|
-
},
|
|
2256
|
+
}, hi = (e, n) => {
|
|
2241
2257
|
const r = e.customData?.customApps.find(
|
|
2242
2258
|
(a) => a.id === "faststore"
|
|
2243
2259
|
)?.fields?.cartEtag;
|
|
2244
|
-
return r == null ? !0 :
|
|
2245
|
-
},
|
|
2260
|
+
return r == null ? !0 : qn(e, n) !== r;
|
|
2261
|
+
}, fi = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
2246
2262
|
id: e
|
|
2247
|
-
}),
|
|
2263
|
+
}), en = async (e, n, { clients: { commerce: t } }) => {
|
|
2248
2264
|
if (!n)
|
|
2249
2265
|
return e;
|
|
2250
|
-
const { updateShipping: r, addressChanged: i } =
|
|
2266
|
+
const { updateShipping: r, addressChanged: i } = Bn(
|
|
2251
2267
|
e,
|
|
2252
2268
|
n
|
|
2253
2269
|
);
|
|
2254
2270
|
if (r) {
|
|
2255
|
-
const a =
|
|
2271
|
+
const a = ii(e, n, i), s = a || ri(n);
|
|
2256
2272
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
2257
2273
|
{
|
|
2258
2274
|
id: e.orderFormId,
|
|
@@ -2272,18 +2288,18 @@ const Ke = (e) => {
|
|
|
2272
2288
|
);
|
|
2273
2289
|
}
|
|
2274
2290
|
return e;
|
|
2275
|
-
},
|
|
2291
|
+
}, Si = (e, n) => {
|
|
2276
2292
|
if (!e)
|
|
2277
2293
|
return "";
|
|
2278
|
-
const r =
|
|
2294
|
+
const r = ie(e)[n];
|
|
2279
2295
|
return r ? r.split("=")[1] : "";
|
|
2280
|
-
},
|
|
2296
|
+
}, yi = async (e, n, t, r) => {
|
|
2281
2297
|
const { commerce: i } = e.clients, a = await i.checkout.orderForm({
|
|
2282
2298
|
id: n,
|
|
2283
2299
|
channel: e.storage.channel,
|
|
2284
2300
|
preserveSalesChannel: !!n && !t
|
|
2285
2301
|
});
|
|
2286
|
-
return !n ||
|
|
2302
|
+
return !n || Wr(
|
|
2287
2303
|
a,
|
|
2288
2304
|
e.storage.channel.salesChannel,
|
|
2289
2305
|
r
|
|
@@ -2291,98 +2307,98 @@ const Ke = (e) => {
|
|
|
2291
2307
|
id: n,
|
|
2292
2308
|
channel: e.storage.channel
|
|
2293
2309
|
});
|
|
2294
|
-
},
|
|
2310
|
+
}, nn = (e, n, t) => {
|
|
2295
2311
|
if (!t || n.items.length === 0)
|
|
2296
2312
|
return null;
|
|
2297
|
-
const r =
|
|
2313
|
+
const r = jr(
|
|
2298
2314
|
e.storage.channel,
|
|
2299
2315
|
n.salesChannel
|
|
2300
2316
|
);
|
|
2301
|
-
return r ? (
|
|
2302
|
-
},
|
|
2303
|
-
const i =
|
|
2317
|
+
return r ? (ne(e, r), n.salesChannel ? String(n.salesChannel) : null) : null;
|
|
2318
|
+
}, tn = (e, n, t, r) => r ? Pe(e, n, t, r) : null, Ii = async (e, { cart: { order: n }, session: t }, r) => {
|
|
2319
|
+
const i = Si(
|
|
2304
2320
|
r.headers.cookie,
|
|
2305
2321
|
"checkout.vtex.com"
|
|
2306
2322
|
), {
|
|
2307
2323
|
clients: { commerce: a },
|
|
2308
2324
|
loaders: { skuLoader: o }
|
|
2309
|
-
} = r, s = t?.channel, c = t?.locale, d =
|
|
2310
|
-
localizationEnabled:
|
|
2311
|
-
}) === "url", g =
|
|
2312
|
-
s &&
|
|
2313
|
-
const p = await
|
|
2325
|
+
} = r, s = t?.channel, c = t?.locale, d = Un(s, {
|
|
2326
|
+
localizationEnabled: _n(r.discoveryConfig)
|
|
2327
|
+
}) === "url", g = Rn(s);
|
|
2328
|
+
s && ne(r, s), c && Ae(r, c);
|
|
2329
|
+
const p = await yi(
|
|
2314
2330
|
r,
|
|
2315
2331
|
i || void 0,
|
|
2316
2332
|
d,
|
|
2317
2333
|
g
|
|
2318
2334
|
), f = p.orderFormId;
|
|
2319
|
-
p.messages.length !== 0 && await
|
|
2320
|
-
const h =
|
|
2321
|
-
if (
|
|
2322
|
-
const
|
|
2335
|
+
p.messages.length !== 0 && await fi(f, r);
|
|
2336
|
+
const h = ie(r?.headers?.cookie ?? "")?.vtex_session, I = H(h), { acceptedOffer: l, shouldSplitItem: u } = n;
|
|
2337
|
+
if (hi(p, I)) {
|
|
2338
|
+
const w = nn(
|
|
2323
2339
|
r,
|
|
2324
2340
|
p,
|
|
2325
2341
|
!d
|
|
2326
|
-
), N = await
|
|
2342
|
+
), N = await Ze(
|
|
2327
2343
|
p,
|
|
2328
2344
|
a,
|
|
2329
|
-
|
|
2330
|
-
).then(
|
|
2345
|
+
I
|
|
2346
|
+
).then(Qe);
|
|
2331
2347
|
if (f)
|
|
2332
|
-
return
|
|
2348
|
+
return Pe(
|
|
2333
2349
|
N,
|
|
2334
2350
|
o,
|
|
2335
2351
|
u,
|
|
2336
|
-
|
|
2352
|
+
w
|
|
2337
2353
|
);
|
|
2338
2354
|
}
|
|
2339
|
-
const S =
|
|
2355
|
+
const S = nn(
|
|
2340
2356
|
r,
|
|
2341
2357
|
p,
|
|
2342
2358
|
!d
|
|
2343
|
-
),
|
|
2344
|
-
(
|
|
2345
|
-
const
|
|
2346
|
-
if (!
|
|
2347
|
-
return
|
|
2348
|
-
const [B, ...
|
|
2349
|
-
if (
|
|
2350
|
-
return
|
|
2351
|
-
const
|
|
2352
|
-
return
|
|
2359
|
+
), v = Ke(l), b = Ke(p.items.map(me)), C = Array.from(b.entries()), _ = Array.from(v.entries()), { itemsToAdd: A, itemsToUpdate: O } = _.reduce(
|
|
2360
|
+
(w, [N, K]) => {
|
|
2361
|
+
const oe = b.get(N);
|
|
2362
|
+
if (!oe)
|
|
2363
|
+
return K.forEach((Q) => w.itemsToAdd.push(Q)), w;
|
|
2364
|
+
const [B, ...se] = oe;
|
|
2365
|
+
if (Vn(p.items, B.itemOffered.sku) || zn(p.items, B.itemOffered.sku))
|
|
2366
|
+
return w.itemsToUpdate.push(B), w;
|
|
2367
|
+
const Yn = K.reduce((Q, Jn) => Q + Jn.quantity, 0);
|
|
2368
|
+
return w.itemsToUpdate.push({
|
|
2353
2369
|
...B,
|
|
2354
|
-
quantity:
|
|
2355
|
-
}),
|
|
2370
|
+
quantity: Yn
|
|
2371
|
+
}), se.forEach((Q) => w.itemsToUpdate.push({ ...Q, quantity: 0 })), w;
|
|
2356
2372
|
},
|
|
2357
2373
|
{
|
|
2358
2374
|
itemsToAdd: [],
|
|
2359
2375
|
itemsToUpdate: []
|
|
2360
2376
|
}
|
|
2361
|
-
),
|
|
2362
|
-
|
|
2363
|
-
), { updateShipping:
|
|
2364
|
-
if (D.length === 0 && !
|
|
2365
|
-
return
|
|
2377
|
+
), P = C.filter(([w]) => !v.has(w)).flatMap(([, w]) => w.map((N) => ({ ...N, quantity: 0 }))), D = [...A, ...O, ...P].map(
|
|
2378
|
+
gi
|
|
2379
|
+
), { updateShipping: E } = t ? Bn(p, t) : { updateShipping: !1 };
|
|
2380
|
+
if (D.length === 0 && !E)
|
|
2381
|
+
return tn(
|
|
2366
2382
|
p,
|
|
2367
2383
|
o,
|
|
2368
2384
|
u,
|
|
2369
2385
|
S
|
|
2370
2386
|
);
|
|
2371
|
-
let
|
|
2372
|
-
D.length > 0 ?
|
|
2387
|
+
let k;
|
|
2388
|
+
D.length > 0 ? k = await a.checkout.updateOrderFormItems({
|
|
2373
2389
|
id: p.orderFormId,
|
|
2374
2390
|
orderItems: D,
|
|
2375
2391
|
shouldSplitItem: u
|
|
2376
2392
|
}).then(
|
|
2377
|
-
(
|
|
2378
|
-
) :
|
|
2393
|
+
(w) => en(w, t, r)
|
|
2394
|
+
) : k = await en(
|
|
2379
2395
|
p,
|
|
2380
2396
|
t,
|
|
2381
2397
|
r
|
|
2382
|
-
),
|
|
2398
|
+
), k = await Promise.resolve(k).then((w) => {
|
|
2383
2399
|
if (t?.marketingData) {
|
|
2384
2400
|
const N = {
|
|
2385
|
-
...
|
|
2401
|
+
...w.marketingData,
|
|
2386
2402
|
...t.marketingData
|
|
2387
2403
|
};
|
|
2388
2404
|
return a.checkout.marketingData({
|
|
@@ -2390,57 +2406,57 @@ const Ke = (e) => {
|
|
|
2390
2406
|
marketingData: N
|
|
2391
2407
|
});
|
|
2392
2408
|
}
|
|
2393
|
-
return
|
|
2394
|
-
}).then((
|
|
2395
|
-
id:
|
|
2409
|
+
return w;
|
|
2410
|
+
}).then((w) => c && w.clientPreferencesData?.locale !== c ? a.checkout.clientPreferencesData({
|
|
2411
|
+
id: w.orderFormId,
|
|
2396
2412
|
clientPreferencesData: {
|
|
2397
|
-
...
|
|
2413
|
+
...w.clientPreferencesData,
|
|
2398
2414
|
locale: c
|
|
2399
2415
|
}
|
|
2400
|
-
}) :
|
|
2401
|
-
const
|
|
2416
|
+
}) : w).then((w) => Ze(w, a, I)).then(Qe);
|
|
2417
|
+
const R = _e(
|
|
2402
2418
|
p.messages,
|
|
2403
|
-
|
|
2419
|
+
k.messages
|
|
2404
2420
|
);
|
|
2405
|
-
return
|
|
2406
|
-
|
|
2421
|
+
return mi(n, k) && R ? tn(
|
|
2422
|
+
k,
|
|
2407
2423
|
o,
|
|
2408
2424
|
u,
|
|
2409
2425
|
S
|
|
2410
|
-
) :
|
|
2411
|
-
|
|
2426
|
+
) : Pe(
|
|
2427
|
+
k,
|
|
2412
2428
|
o,
|
|
2413
2429
|
u,
|
|
2414
2430
|
S
|
|
2415
2431
|
);
|
|
2416
|
-
},
|
|
2432
|
+
}, vi = (e) => {
|
|
2417
2433
|
const n = (e?.corporateName ?? "").trim();
|
|
2418
2434
|
return n || (e?.firstName ?? "").trim();
|
|
2419
|
-
},
|
|
2435
|
+
}, Oi = (e) => {
|
|
2420
2436
|
if (!e || typeof e != "object")
|
|
2421
2437
|
return !1;
|
|
2422
2438
|
const n = e;
|
|
2423
2439
|
return typeof n.customerId == "string" && n.customerId.trim() !== "" && typeof n.contractName == "string" && typeof n.isActive == "boolean" && typeof n.isCurrent == "boolean";
|
|
2424
|
-
},
|
|
2440
|
+
}, Ci = (e) => {
|
|
2425
2441
|
const n = e?.availableContracts?.value;
|
|
2426
|
-
return Array.isArray(n) ? n.filter(
|
|
2427
|
-
},
|
|
2442
|
+
return Array.isArray(n) ? n.filter(Oi) : [];
|
|
2443
|
+
}, bi = (e) => e?.customerId ? !!((e.contractName ?? "").trim() && e.isActive) : !1, rn = (e) => e?.namespaces?.shopper?.activeContractId?.value?.trim() ?? e?.namespaces?.authentication?.customerId?.value?.trim() ?? e?.namespaces?.profile?.id?.value?.trim() ?? "", wi = (e) => {
|
|
2428
2444
|
if (!Array.isArray(e) || e.length === 0) return "";
|
|
2429
2445
|
const n = e.find((t) => t?.isDefault === !0) ?? e[0];
|
|
2430
2446
|
return String(n?.id ?? "").trim();
|
|
2431
|
-
},
|
|
2447
|
+
}, Ai = (e, n = "", t = "") => {
|
|
2432
2448
|
const r = n.trim(), i = t.trim();
|
|
2433
|
-
return e.filter(
|
|
2449
|
+
return e.filter(bi).map((a) => ({
|
|
2434
2450
|
id: a.customerId,
|
|
2435
2451
|
corporateName: a.contractName.trim(),
|
|
2436
2452
|
isActive: r ? a.customerId === r : a.isCurrent,
|
|
2437
2453
|
isDefault: i !== "" && a.customerId === i
|
|
2438
2454
|
}));
|
|
2439
|
-
},
|
|
2440
|
-
const t =
|
|
2455
|
+
}, xn = (e, n) => {
|
|
2456
|
+
const t = vi(e);
|
|
2441
2457
|
return t || (n?.firstName?.value ?? "").trim();
|
|
2442
2458
|
};
|
|
2443
|
-
async function
|
|
2459
|
+
async function Di(e, n, t) {
|
|
2444
2460
|
try {
|
|
2445
2461
|
const r = await e.commerce.checkout.address({
|
|
2446
2462
|
postalCode: t,
|
|
@@ -2457,7 +2473,7 @@ async function wi(e, n, t) {
|
|
|
2457
2473
|
), r;
|
|
2458
2474
|
}
|
|
2459
2475
|
}
|
|
2460
|
-
function
|
|
2476
|
+
function Pi(e, n, t, r, i, a) {
|
|
2461
2477
|
const o = new URLSearchParams(e);
|
|
2462
2478
|
return o.has("facets") && o.delete("facets"), o.set("sc", o.get("sc") ?? n.salesChannel), t && o.set("postalCode", t), r && o.set("country", r), i && o.set(
|
|
2463
2479
|
"geoCoordinates",
|
|
@@ -2465,7 +2481,7 @@ function Ai(e, n, t, r, i, a) {
|
|
|
2465
2481
|
// long,lat is the format expected
|
|
2466
2482
|
), o.set("locale", a), o;
|
|
2467
2483
|
}
|
|
2468
|
-
function
|
|
2484
|
+
function ki(e, n) {
|
|
2469
2485
|
return {
|
|
2470
2486
|
utmCampaign: e.get("utm_campaign") ?? n?.utmCampaign ?? "",
|
|
2471
2487
|
utmMedium: e.get("utm_medium") ?? n?.utmMedium ?? "",
|
|
@@ -2475,8 +2491,8 @@ function Di(e, n) {
|
|
|
2475
2491
|
utmiPart: e.get("utmi_pc") ?? n?.utmiPart ?? ""
|
|
2476
2492
|
};
|
|
2477
2493
|
}
|
|
2478
|
-
async function
|
|
2479
|
-
const r =
|
|
2494
|
+
async function Ei(e, n, t) {
|
|
2495
|
+
const r = H($(n ?? "", t));
|
|
2480
2496
|
let i = !1;
|
|
2481
2497
|
if (r)
|
|
2482
2498
|
try {
|
|
@@ -2490,7 +2506,7 @@ async function Pi(e, n, t) {
|
|
|
2490
2506
|
unitId: i ? r?.unitId : void 0
|
|
2491
2507
|
};
|
|
2492
2508
|
}
|
|
2493
|
-
async function
|
|
2509
|
+
async function Ui(e, n, t, r, i, a) {
|
|
2494
2510
|
return !n.seller || !(t || r) ? void 0 : (await e.commerce.checkout.region({
|
|
2495
2511
|
postalCode: t,
|
|
2496
2512
|
geoCoordinates: r,
|
|
@@ -2498,13 +2514,13 @@ async function Ei(e, n, t, r, i, a) {
|
|
|
2498
2514
|
salesChannel: a
|
|
2499
2515
|
}))?.[0]?.sellers.find((c) => n.seller === c.id)?.id;
|
|
2500
2516
|
}
|
|
2501
|
-
function
|
|
2517
|
+
function an(e) {
|
|
2502
2518
|
return typeof e?.value == "string" ? e.value : "";
|
|
2503
2519
|
}
|
|
2504
|
-
function
|
|
2520
|
+
function _i(e) {
|
|
2505
2521
|
if (!e.isRepresentative)
|
|
2506
2522
|
return null;
|
|
2507
|
-
const n =
|
|
2523
|
+
const n = an(e.shopper?.firstName), t = an(e.shopper?.lastName);
|
|
2508
2524
|
return {
|
|
2509
2525
|
isRepresentative: !0,
|
|
2510
2526
|
customerId: e.authentication?.customerId?.value ?? e.customerId ?? "",
|
|
@@ -2515,11 +2531,11 @@ function ki(e) {
|
|
|
2515
2531
|
userName: `${n} ${t}`.trim(),
|
|
2516
2532
|
userEmail: e.authentication?.storeUserEmail?.value ?? "",
|
|
2517
2533
|
savedPostalCode: e.publicData?.postalCode?.value ?? "",
|
|
2518
|
-
contractName:
|
|
2534
|
+
contractName: xn(e.contract, e.profile),
|
|
2519
2535
|
organizationManager: e.shopper?.organizationManager?.value ?? !1
|
|
2520
2536
|
};
|
|
2521
2537
|
}
|
|
2522
|
-
function
|
|
2538
|
+
function Ri(e) {
|
|
2523
2539
|
return e?.id ? {
|
|
2524
2540
|
id: e.id?.value ?? "",
|
|
2525
2541
|
email: e.email?.value ?? "",
|
|
@@ -2527,14 +2543,14 @@ function _i(e) {
|
|
|
2527
2543
|
familyName: e.lastName?.value ?? ""
|
|
2528
2544
|
} : null;
|
|
2529
2545
|
}
|
|
2530
|
-
const
|
|
2546
|
+
const Ti = (e) => e instanceof J && (e.extensions.status === 401 || e.extensions.status === 403), Fi = (e) => e instanceof Error && /sales\s*channel/i.test(e.message), Ni = (e, n, t, r) => {
|
|
2531
2547
|
if (n !== "orderForm" || t !== r)
|
|
2532
2548
|
return !1;
|
|
2533
|
-
if (
|
|
2549
|
+
if (Fi(e))
|
|
2534
2550
|
return !0;
|
|
2535
2551
|
const i = `[validateSession] Session Manager rejected adopted sales channel ${t} with an unrecognized error; keeping the adoption.`, a = e instanceof Error ? e.message : e;
|
|
2536
|
-
return console.warn(i, a),
|
|
2537
|
-
},
|
|
2552
|
+
return console.warn(i, a), Sn("warn", "%s %o", i, a), !1;
|
|
2553
|
+
}, Li = async (e, n, t, r) => {
|
|
2538
2554
|
const i = { salesChannelSource: t, rejectedSalesChannel: void 0 };
|
|
2539
2555
|
try {
|
|
2540
2556
|
return {
|
|
@@ -2542,9 +2558,9 @@ const Ui = (e) => e instanceof X && (e.extensions.status === 401 || e.extensions
|
|
|
2542
2558
|
sessionData: await e.commerce.session(n.toString())
|
|
2543
2559
|
};
|
|
2544
2560
|
} catch (a) {
|
|
2545
|
-
if (t === "url" || !
|
|
2561
|
+
if (t === "url" || !Ti(a))
|
|
2546
2562
|
return { ...i, sessionData: null };
|
|
2547
|
-
const o = n.get("sc") ?? void 0, s =
|
|
2563
|
+
const o = n.get("sc") ?? void 0, s = Ni(
|
|
2548
2564
|
a,
|
|
2549
2565
|
t,
|
|
2550
2566
|
o,
|
|
@@ -2558,77 +2574,77 @@ const Ui = (e) => e instanceof X && (e.extensions.status === 401 || e.extensions
|
|
|
2558
2574
|
rejectedSalesChannel: o
|
|
2559
2575
|
};
|
|
2560
2576
|
}
|
|
2561
|
-
},
|
|
2562
|
-
const c =
|
|
2563
|
-
localizationEnabled:
|
|
2577
|
+
}, Bi = async (e, { session: n, search: t }, { clients: r, headers: i, account: a, storage: o, discoveryConfig: s }) => {
|
|
2578
|
+
const c = ae.parse(n.channel ?? ""), d = Un(n.channel, {
|
|
2579
|
+
localizationEnabled: _n(s)
|
|
2564
2580
|
}), g = {
|
|
2565
2581
|
...c,
|
|
2566
|
-
salesChannel:
|
|
2582
|
+
salesChannel: Gr(
|
|
2567
2583
|
c,
|
|
2568
2584
|
d,
|
|
2569
2585
|
o?.channel?.salesChannel ? String(o.channel.salesChannel) : void 0,
|
|
2570
2586
|
t
|
|
2571
2587
|
)
|
|
2572
2588
|
}, p = String(n.postalCode ?? ""), f = n.country ?? "";
|
|
2573
|
-
let h = n.city ?? null,
|
|
2574
|
-
if ((!h || !
|
|
2575
|
-
const
|
|
2589
|
+
let h = n.city ?? null, I = n.geoCoordinates ?? null;
|
|
2590
|
+
if ((!h || !I) && p !== "" && f !== "") {
|
|
2591
|
+
const se = await Di(
|
|
2576
2592
|
r,
|
|
2577
2593
|
f,
|
|
2578
2594
|
p
|
|
2579
2595
|
);
|
|
2580
|
-
h =
|
|
2596
|
+
h = se.city, I = se.geoCoordinates;
|
|
2581
2597
|
}
|
|
2582
|
-
const u =
|
|
2598
|
+
const u = Pi(
|
|
2583
2599
|
t,
|
|
2584
2600
|
g,
|
|
2585
2601
|
p,
|
|
2586
2602
|
f,
|
|
2587
|
-
|
|
2603
|
+
I,
|
|
2588
2604
|
n.locale
|
|
2589
|
-
), m =
|
|
2605
|
+
), m = ki(u, n.marketingData), { isRepresentative: S, customerId: v, unitId: b } = await Ei(
|
|
2590
2606
|
r,
|
|
2591
2607
|
i?.cookie,
|
|
2592
2608
|
a
|
|
2593
|
-
), { sessionData: C, salesChannelSource: _, rejectedSalesChannel:
|
|
2609
|
+
), { sessionData: C, salesChannelSource: _, rejectedSalesChannel: A } = await Li(
|
|
2594
2610
|
r,
|
|
2595
2611
|
u,
|
|
2596
2612
|
d,
|
|
2597
2613
|
String(g.salesChannel ?? "")
|
|
2598
|
-
),
|
|
2599
|
-
let
|
|
2600
|
-
if (S &&
|
|
2614
|
+
), O = C?.namespaces.profile ?? null, P = C?.namespaces.shopper ?? null, D = C?.namespaces.store ?? null, E = C?.namespaces.authentication ?? null, k = C?.namespaces.checkout ?? null, R = C?.namespaces.public ?? null;
|
|
2615
|
+
let w = null;
|
|
2616
|
+
if (S && O?.id?.value)
|
|
2601
2617
|
try {
|
|
2602
|
-
|
|
2603
|
-
contractId:
|
|
2618
|
+
w = await r.commerce.masterData.getContractById({
|
|
2619
|
+
contractId: O.id.value
|
|
2604
2620
|
});
|
|
2605
2621
|
} catch {
|
|
2606
2622
|
console.error(
|
|
2607
|
-
`Error while getting contract data for profile ID (${
|
|
2623
|
+
`Error while getting contract data for profile ID (${O.id.value}).
|
|
2608
2624
|
`
|
|
2609
2625
|
);
|
|
2610
2626
|
}
|
|
2611
|
-
const N = await
|
|
2627
|
+
const N = await Ui(
|
|
2612
2628
|
r,
|
|
2613
2629
|
g,
|
|
2614
2630
|
p,
|
|
2615
|
-
|
|
2631
|
+
I,
|
|
2616
2632
|
f,
|
|
2617
2633
|
u.get("sc") ?? D?.channel?.value ?? g.salesChannel
|
|
2618
|
-
),
|
|
2634
|
+
), K = Ri(O), oe = (n.person?.id ?? null) === (K?.id ?? null) ? Rn(n.channel) : void 0, B = {
|
|
2619
2635
|
...n,
|
|
2620
2636
|
currency: {
|
|
2621
2637
|
code: D?.currencyCode?.value ?? n.currency.code,
|
|
2622
2638
|
symbol: D?.currencySymbol?.value ?? n.currency.symbol
|
|
2623
2639
|
},
|
|
2624
2640
|
country: D?.countryCode?.value ?? f,
|
|
2625
|
-
channel:
|
|
2641
|
+
channel: Hr(
|
|
2626
2642
|
g,
|
|
2627
2643
|
D?.channel?.value,
|
|
2628
|
-
|
|
2644
|
+
k?.regionId?.value,
|
|
2629
2645
|
N,
|
|
2630
2646
|
_,
|
|
2631
|
-
|
|
2647
|
+
A ?? oe
|
|
2632
2648
|
),
|
|
2633
2649
|
/**
|
|
2634
2650
|
* B2B data structure in Session:
|
|
@@ -2636,53 +2652,53 @@ const Ui = (e) => e instanceof X && (e.extensions.status === 401 || e.extensions
|
|
|
2636
2652
|
* - Unit data: `authentication` namespace
|
|
2637
2653
|
* - Contract data: `profile` namespace (those info will be available inside Faststore's Session `person` object)
|
|
2638
2654
|
*/
|
|
2639
|
-
b2b:
|
|
2655
|
+
b2b: _i({
|
|
2640
2656
|
isRepresentative: S,
|
|
2641
|
-
authentication:
|
|
2642
|
-
shopper:
|
|
2643
|
-
publicData:
|
|
2644
|
-
profile:
|
|
2645
|
-
contract:
|
|
2646
|
-
customerId:
|
|
2657
|
+
authentication: E,
|
|
2658
|
+
shopper: P,
|
|
2659
|
+
publicData: R,
|
|
2660
|
+
profile: O,
|
|
2661
|
+
contract: w,
|
|
2662
|
+
customerId: v,
|
|
2647
2663
|
unitId: b
|
|
2648
2664
|
}),
|
|
2649
2665
|
marketingData: m,
|
|
2650
|
-
person:
|
|
2651
|
-
geoCoordinates:
|
|
2666
|
+
person: K,
|
|
2667
|
+
geoCoordinates: I?.latitude && I?.longitude && I || null,
|
|
2652
2668
|
city: h
|
|
2653
2669
|
};
|
|
2654
2670
|
return _e(n, B) ? null : B;
|
|
2655
|
-
},
|
|
2656
|
-
validateCart:
|
|
2657
|
-
validateSession:
|
|
2658
|
-
subscribeToNewsletter:
|
|
2659
|
-
cancelOrder:
|
|
2660
|
-
processOrderAuthorization:
|
|
2661
|
-
uploadFileToOrderEntry:
|
|
2662
|
-
startOrderEntryOperation:
|
|
2663
|
-
startRecommendationSession:
|
|
2671
|
+
}, $i = {
|
|
2672
|
+
validateCart: Ii,
|
|
2673
|
+
validateSession: Bi,
|
|
2674
|
+
subscribeToNewsletter: qr,
|
|
2675
|
+
cancelOrder: Br,
|
|
2676
|
+
processOrderAuthorization: Mr,
|
|
2677
|
+
uploadFileToOrderEntry: xr,
|
|
2678
|
+
startOrderEntryOperation: zr,
|
|
2679
|
+
startRecommendationSession: Vr
|
|
2664
2680
|
};
|
|
2665
|
-
var
|
|
2681
|
+
var ke;
|
|
2666
2682
|
(function(e) {
|
|
2667
2683
|
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";
|
|
2668
|
-
})(
|
|
2669
|
-
const
|
|
2670
|
-
function
|
|
2684
|
+
})(ke || (ke = {}));
|
|
2685
|
+
const Mi = (e) => typeof e == "string" ? jn(e) : null;
|
|
2686
|
+
function jn(e) {
|
|
2671
2687
|
try {
|
|
2672
2688
|
return JSON.parse(e);
|
|
2673
2689
|
} catch {
|
|
2674
2690
|
return e;
|
|
2675
2691
|
}
|
|
2676
2692
|
}
|
|
2677
|
-
const
|
|
2693
|
+
const zi = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Vi = new Zn({
|
|
2678
2694
|
name: "ObjectOrString",
|
|
2679
2695
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2680
|
-
parseValue:
|
|
2681
|
-
serialize:
|
|
2696
|
+
parseValue: Mi,
|
|
2697
|
+
serialize: zi,
|
|
2682
2698
|
parseLiteral(e) {
|
|
2683
|
-
return e.kind ===
|
|
2699
|
+
return e.kind === ke.STRING ? jn(e.value) : null;
|
|
2684
2700
|
}
|
|
2685
|
-
}), T = (e) => "Price" in e && "seller" in e && "product" in e, F = (e) => "skuName" in e,
|
|
2701
|
+
}), T = (e) => "Price" in e && "seller" in e && "product" in e, F = (e) => "skuName" in e, qi = {
|
|
2686
2702
|
priceCurrency: async (e, n, t) => {
|
|
2687
2703
|
const {
|
|
2688
2704
|
loaders: { salesChannelLoader: r },
|
|
@@ -2692,25 +2708,25 @@ const $i = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2692
2708
|
},
|
|
2693
2709
|
priceValidUntil: (e) => T(e) ? e.PriceValidUntil ?? "" : F(e) ? e.priceValidUntil ?? "" : null,
|
|
2694
2710
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2695
|
-
availability: async (e) => T(e) ?
|
|
2711
|
+
availability: async (e) => T(e) ? qe(M(e)) : F(e) ? qe(Cr(e.availability)) : null,
|
|
2696
2712
|
seller: (e, n, t) => T(e) ? {
|
|
2697
2713
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2698
2714
|
} : F(e) ? {
|
|
2699
2715
|
identifier: e.seller
|
|
2700
2716
|
} : null,
|
|
2701
|
-
price: (e) => T(e) ?
|
|
2702
|
-
priceWithTaxes: (e) => T(e) ?
|
|
2717
|
+
price: (e) => T(e) ? Y(e) : F(e) ? e.sellingPrice / 100 : null,
|
|
2718
|
+
priceWithTaxes: (e) => T(e) ? G(Y(e), e?.Tax, e.product.unitMultiplier) : F(e) ? G(
|
|
2703
2719
|
e.sellingPrice / 100,
|
|
2704
2720
|
e.tax / 100,
|
|
2705
2721
|
e.unitMultiplier
|
|
2706
2722
|
) : null,
|
|
2707
|
-
sellingPrice: (e) => T(e) ?
|
|
2723
|
+
sellingPrice: (e) => T(e) ? Or(e) : F(e) ? e.sellingPrice / 100 : null,
|
|
2708
2724
|
listPrice: (e) => T(e) ? e.ListPrice ?? 0 : F(e) ? e.listPrice / 100 : null,
|
|
2709
|
-
listPriceWithTaxes: (e) => T(e) ?
|
|
2725
|
+
listPriceWithTaxes: (e) => T(e) ? G(
|
|
2710
2726
|
e.ListPrice ?? 0,
|
|
2711
2727
|
e?.Tax,
|
|
2712
2728
|
e.product.unitMultiplier
|
|
2713
|
-
) : F(e) ?
|
|
2729
|
+
) : F(e) ? G(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
|
|
2714
2730
|
itemOffered: (e) => T(e) ? e.product : F(e) ? {
|
|
2715
2731
|
...e.product,
|
|
2716
2732
|
attachmentsValues: e.attachments,
|
|
@@ -2719,7 +2735,7 @@ const $i = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2719
2735
|
quantity: (e) => T(e) ? e.AvailableQuantity ?? 0 : F(e) ? e.quantity : null,
|
|
2720
2736
|
isGift: (e) => F(e) ? e.isGift ?? !1 : null,
|
|
2721
2737
|
priceToken: (e) => T(e) ? e.PriceToken ?? null : null
|
|
2722
|
-
},
|
|
2738
|
+
}, xi = ({ linkText: e }) => `/${e}/p`, ji = ({
|
|
2723
2739
|
offer: e,
|
|
2724
2740
|
seller: n,
|
|
2725
2741
|
product: t
|
|
@@ -2727,15 +2743,15 @@ const $i = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2727
2743
|
...e,
|
|
2728
2744
|
product: t,
|
|
2729
2745
|
seller: n
|
|
2730
|
-
}),
|
|
2746
|
+
}), Wi = {
|
|
2731
2747
|
imageText: "image",
|
|
2732
2748
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2733
2749
|
imageLabel: "label"
|
|
2734
|
-
},
|
|
2750
|
+
}, ue = (e, n) => `${e}-${n}`, on = (e, n) => `/${ue(e, n)}/p`, Hi = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2735
2751
|
function Ee(e) {
|
|
2736
2752
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2737
2753
|
}
|
|
2738
|
-
async function
|
|
2754
|
+
async function pe(e, n, t) {
|
|
2739
2755
|
const r = `${n}:${t}`;
|
|
2740
2756
|
e.storage.productTranslationsCache ??= /* @__PURE__ */ new Map();
|
|
2741
2757
|
const i = e.storage.productTranslationsCache, a = i.get(r);
|
|
@@ -2760,18 +2776,18 @@ async function de(e, n, t) {
|
|
|
2760
2776
|
})();
|
|
2761
2777
|
return i.set(r, o), o;
|
|
2762
2778
|
}
|
|
2763
|
-
const
|
|
2779
|
+
const Gi = (e, n) => {
|
|
2764
2780
|
const t = e.findIndex((r) => Ee(r).split("/").at(-1) === n);
|
|
2765
2781
|
return t < 0 ? 0 : t;
|
|
2766
|
-
},
|
|
2782
|
+
}, Xi = {
|
|
2767
2783
|
productID: ({ itemId: e }) => e,
|
|
2768
2784
|
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2769
|
-
slug: ({ isVariantOf: { linkText: e }, itemId: n }) =>
|
|
2785
|
+
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => ue(e, n),
|
|
2770
2786
|
description: ({ isVariantOf: { description: e } }) => e,
|
|
2771
2787
|
seo: ({ isVariantOf: e }) => ({
|
|
2772
2788
|
title: e.productTitle || e.productName,
|
|
2773
2789
|
description: e.metaTagDescription || e.description,
|
|
2774
|
-
canonical:
|
|
2790
|
+
canonical: xi(e)
|
|
2775
2791
|
}),
|
|
2776
2792
|
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2777
2793
|
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
@@ -2786,28 +2802,28 @@ const Wi = (e, n) => {
|
|
|
2786
2802
|
productId: c
|
|
2787
2803
|
},
|
|
2788
2804
|
itemId: d
|
|
2789
|
-
} = e, g =
|
|
2790
|
-
if (
|
|
2791
|
-
const
|
|
2792
|
-
if (
|
|
2805
|
+
} = e, g = Gi(s, o), p = r[g], f = Ee(p).split("/"), h = t.storage.locale;
|
|
2806
|
+
if (X(t) && h) {
|
|
2807
|
+
const I = await pe(t, c, h);
|
|
2808
|
+
if (I) {
|
|
2793
2809
|
const l = new Set(
|
|
2794
2810
|
Ee(s[g]).split("/").filter(Boolean)
|
|
2795
|
-
), u =
|
|
2796
|
-
(S,
|
|
2811
|
+
), u = I.categories.filter((S) => l.has(S.id.toString())).sort(
|
|
2812
|
+
(S, v) => S.fullPath.split("/").length - v.fullPath.split("/").length
|
|
2797
2813
|
);
|
|
2798
2814
|
if (u.length === f.length)
|
|
2799
2815
|
return {
|
|
2800
2816
|
itemListElement: [
|
|
2801
2817
|
// Category items: both name and slug come from Catalog Dataplane, ensuring
|
|
2802
2818
|
// they are always consistent with each other for the requested locale.
|
|
2803
|
-
...u.map((S,
|
|
2819
|
+
...u.map((S, v) => ({
|
|
2804
2820
|
name: S.name,
|
|
2805
2821
|
item: `/${S.fullPathUriName}/`,
|
|
2806
|
-
position:
|
|
2822
|
+
position: v + 1
|
|
2807
2823
|
})),
|
|
2808
2824
|
{
|
|
2809
2825
|
name: i,
|
|
2810
|
-
item:
|
|
2826
|
+
item: on(I.linkId, d),
|
|
2811
2827
|
position: f.length + 1
|
|
2812
2828
|
}
|
|
2813
2829
|
],
|
|
@@ -2817,17 +2833,17 @@ const Wi = (e, n) => {
|
|
|
2817
2833
|
}
|
|
2818
2834
|
return {
|
|
2819
2835
|
itemListElement: [
|
|
2820
|
-
...f.map((
|
|
2821
|
-
const u = `/${f.slice(0, l + 1).map(
|
|
2836
|
+
...f.map((I, l) => {
|
|
2837
|
+
const u = `/${f.slice(0, l + 1).map(ge).join("/")}/`;
|
|
2822
2838
|
return {
|
|
2823
|
-
name:
|
|
2839
|
+
name: I,
|
|
2824
2840
|
item: u,
|
|
2825
2841
|
position: l + 1
|
|
2826
2842
|
};
|
|
2827
2843
|
}),
|
|
2828
2844
|
{
|
|
2829
2845
|
name: i,
|
|
2830
|
-
item:
|
|
2846
|
+
item: on(a, d),
|
|
2831
2847
|
position: f.length + 1
|
|
2832
2848
|
}
|
|
2833
2849
|
],
|
|
@@ -2835,7 +2851,7 @@ const Wi = (e, n) => {
|
|
|
2835
2851
|
};
|
|
2836
2852
|
},
|
|
2837
2853
|
image: ({ images: e }, n) => {
|
|
2838
|
-
const t = (
|
|
2854
|
+
const t = (Hi(e) ?? [Wi]).map(
|
|
2839
2855
|
({ imageUrl: s, imageText: c, imageLabel: d }) => ({
|
|
2840
2856
|
alternateName: c ?? "",
|
|
2841
2857
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
@@ -2858,12 +2874,12 @@ const Wi = (e, n) => {
|
|
|
2858
2874
|
review: () => [],
|
|
2859
2875
|
aggregateRating: () => ({}),
|
|
2860
2876
|
offers: (e) => e.sellers.map(
|
|
2861
|
-
(n) =>
|
|
2877
|
+
(n) => ji({
|
|
2862
2878
|
offer: n.commertialOffer,
|
|
2863
2879
|
seller: n,
|
|
2864
2880
|
product: e
|
|
2865
2881
|
})
|
|
2866
|
-
).sort(
|
|
2882
|
+
).sort(An),
|
|
2867
2883
|
isVariantOf: (e) => e,
|
|
2868
2884
|
additionalProperty: ({
|
|
2869
2885
|
// Search uses the name variations for specifications
|
|
@@ -2879,8 +2895,8 @@ const Wi = (e, n) => {
|
|
|
2879
2895
|
valueReference: V.specification
|
|
2880
2896
|
}))
|
|
2881
2897
|
), a = n.map(
|
|
2882
|
-
|
|
2883
|
-
), o = t.map(
|
|
2898
|
+
Tn
|
|
2899
|
+
), o = t.map(Xr), s = r.map(Te);
|
|
2884
2900
|
return [
|
|
2885
2901
|
...i,
|
|
2886
2902
|
...a,
|
|
@@ -2898,36 +2914,36 @@ const Wi = (e, n) => {
|
|
|
2898
2914
|
advertisement: ({ isVariantOf: { advertisement: e } }) => e,
|
|
2899
2915
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e,
|
|
2900
2916
|
otherLocales: async (e, n, t) => {
|
|
2901
|
-
if (!
|
|
2902
|
-
const r =
|
|
2917
|
+
if (!X(t)) return null;
|
|
2918
|
+
const r = $t(t);
|
|
2903
2919
|
if (r.length === 0) return null;
|
|
2904
|
-
const i = e.isVariantOf.productId, a = e.itemId, o = t.storage.locale, s = await
|
|
2920
|
+
const i = e.isVariantOf.productId, a = e.itemId, o = t.storage.locale, s = await pe(t, i, o);
|
|
2905
2921
|
if (!s?.availableLinkIds) return null;
|
|
2906
2922
|
const { availableLinkIds: c } = s;
|
|
2907
2923
|
return r.map((d) => {
|
|
2908
2924
|
const g = c[d];
|
|
2909
|
-
return g ? { locale: d, slug:
|
|
2925
|
+
return g ? { locale: d, slug: ue(g, a) } : null;
|
|
2910
2926
|
}).filter((d) => d !== null);
|
|
2911
2927
|
},
|
|
2912
2928
|
defaultLocaleSlug: async (e, n, t) => {
|
|
2913
|
-
if (!
|
|
2914
|
-
const r =
|
|
2929
|
+
if (!X(t)) return null;
|
|
2930
|
+
const r = Mt(t);
|
|
2915
2931
|
if (!r) return null;
|
|
2916
|
-
const { productId: i, linkText: a } = e.isVariantOf, o = e.itemId, c = (await
|
|
2932
|
+
const { productId: i, linkText: a } = e.isVariantOf, o = e.itemId, c = (await pe(
|
|
2917
2933
|
t,
|
|
2918
2934
|
i,
|
|
2919
2935
|
t.storage.locale
|
|
2920
2936
|
))?.availableLinkIds?.[r] ?? a;
|
|
2921
|
-
return
|
|
2937
|
+
return ue(c, o);
|
|
2922
2938
|
}
|
|
2923
|
-
},
|
|
2939
|
+
}, Yi = /* @__PURE__ */ new Set(["allSpecifications"]), Ji = {
|
|
2924
2940
|
hasVariant: (e) => e.isVariantOf.items.map((n) => L(n, e.isVariantOf)),
|
|
2925
2941
|
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
2926
2942
|
productClusters: ({ isVariantOf: e }) => e.productClusters ?? [],
|
|
2927
2943
|
name: (e) => e.isVariantOf.productName,
|
|
2928
2944
|
skuVariants: (e) => e,
|
|
2929
2945
|
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
2930
|
-
(n) => !
|
|
2946
|
+
(n) => !Yi.has(n.name)
|
|
2931
2947
|
).flatMap(
|
|
2932
2948
|
({ specifications: n }) => n.flatMap(
|
|
2933
2949
|
({ name: t, values: r }) => r.map((i) => ({
|
|
@@ -2937,33 +2953,33 @@ const Wi = (e, n) => {
|
|
|
2937
2953
|
}))
|
|
2938
2954
|
)
|
|
2939
2955
|
)
|
|
2940
|
-
},
|
|
2941
|
-
propertyID: (e) => e.propertyID ||
|
|
2956
|
+
}, Ki = {
|
|
2957
|
+
propertyID: (e) => e.propertyID || Fn(e),
|
|
2942
2958
|
name: ({ name: e }) => e,
|
|
2943
2959
|
value: ({ value: e }) => e,
|
|
2944
2960
|
valueReference: ({ valueReference: e }) => e
|
|
2945
|
-
},
|
|
2961
|
+
}, he = (e) => {
|
|
2946
2962
|
const n = e.flatMap(
|
|
2947
2963
|
(r) => r.sellers.map((i) => ({
|
|
2948
2964
|
offer: i.commertialOffer,
|
|
2949
2965
|
sku: r
|
|
2950
2966
|
}))
|
|
2951
|
-
), t =
|
|
2967
|
+
), t = we(
|
|
2952
2968
|
n,
|
|
2953
|
-
({ offer: r }, { offer: i }) =>
|
|
2969
|
+
({ offer: r }, { offer: i }) => An(r, i)
|
|
2954
2970
|
);
|
|
2955
2971
|
return t ? t.sku : e[0];
|
|
2956
|
-
},
|
|
2972
|
+
}, Wn = (e) => e !== "" && !Number.isNaN(Number(e)), Qi = /^vrn:recommendations:[^:]+:[^:]+:[^:]+$/, Zi = async (e, { campaignVrn: n, userId: t, products: r }, i) => {
|
|
2957
2973
|
const {
|
|
2958
2974
|
clients: { commerce: a }
|
|
2959
2975
|
} = i, { salesChannel: o } = i.storage.channel, s = n?.trim();
|
|
2960
|
-
if (!s || !
|
|
2961
|
-
throw new
|
|
2976
|
+
if (!s || !Qi.test(s))
|
|
2977
|
+
throw new U(`Invalid campaignVrn: "${n}"`);
|
|
2962
2978
|
const c = t?.trim();
|
|
2963
2979
|
if (t != null && !c)
|
|
2964
|
-
throw new
|
|
2980
|
+
throw new U("Invalid userId: must be a non-empty string");
|
|
2965
2981
|
if (r != null && (!Array.isArray(r) || r.some((h) => !h?.trim())))
|
|
2966
|
-
throw new
|
|
2982
|
+
throw new U(
|
|
2967
2983
|
"Invalid products: must be an array of non-empty strings"
|
|
2968
2984
|
);
|
|
2969
2985
|
const d = await a.recommendation.recommendations({
|
|
@@ -2975,13 +2991,13 @@ const Wi = (e, n) => {
|
|
|
2975
2991
|
}), { campaign: g, correlationId: p } = d;
|
|
2976
2992
|
return {
|
|
2977
2993
|
products: (d.products ?? []).map((h) => {
|
|
2978
|
-
const
|
|
2979
|
-
return
|
|
2994
|
+
const I = he(h.items);
|
|
2995
|
+
return I ? L(I, h) : null;
|
|
2980
2996
|
}).filter((h) => !!h),
|
|
2981
2997
|
correlationId: p,
|
|
2982
2998
|
campaign: g
|
|
2983
2999
|
};
|
|
2984
|
-
},
|
|
3000
|
+
}, sn = {
|
|
2985
3001
|
price_desc: "price:desc",
|
|
2986
3002
|
price_asc: "price:asc",
|
|
2987
3003
|
orders_desc: "orders:desc",
|
|
@@ -2991,19 +3007,19 @@ const Wi = (e, n) => {
|
|
|
2991
3007
|
discount_desc: "discount:desc",
|
|
2992
3008
|
score_desc: ""
|
|
2993
3009
|
};
|
|
2994
|
-
function
|
|
3010
|
+
function ea(e, n) {
|
|
2995
3011
|
let t;
|
|
2996
|
-
if (Object.hasOwn(n, e) ? t = n[e] : Object.hasOwn(
|
|
2997
|
-
throw new
|
|
3012
|
+
if (Object.hasOwn(n, e) ? t = n[e] : Object.hasOwn(sn, e) && (t = sn[e]), t === void 0)
|
|
3013
|
+
throw new U(`Unknown sort value: ${e}`);
|
|
2998
3014
|
return t;
|
|
2999
3015
|
}
|
|
3000
|
-
const
|
|
3016
|
+
const na = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
3001
3017
|
if (!n)
|
|
3002
|
-
throw new
|
|
3018
|
+
throw new U("Missing operationId");
|
|
3003
3019
|
return t.orderEntry.getOperation({ operationId: n });
|
|
3004
|
-
},
|
|
3020
|
+
}, ta = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
3005
3021
|
if (!n)
|
|
3006
|
-
throw new
|
|
3022
|
+
throw new U("Missing orderFormId");
|
|
3007
3023
|
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
3008
3024
|
return (r ?? []).map((i) => ({
|
|
3009
3025
|
id: i.id,
|
|
@@ -3017,19 +3033,19 @@ const Zi = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
|
3017
3033
|
unitMultiplier: i.unitMultiplier ?? 1
|
|
3018
3034
|
}));
|
|
3019
3035
|
};
|
|
3020
|
-
async function
|
|
3036
|
+
async function ra(e, n, t, r) {
|
|
3021
3037
|
const i = n.slice(0, n.lastIndexOf("-"));
|
|
3022
|
-
return (await
|
|
3038
|
+
return (await pe(e, t, r))?.linkId === i;
|
|
3023
3039
|
}
|
|
3024
|
-
const
|
|
3025
|
-
async function
|
|
3040
|
+
const Hn = "Invalid SkuId", Gn = "Slug was set but the fetched sku does not satisfy the slug condition.", ia = "UseAdHocCard", aa = (e) => ee(e) || e instanceof Error && (e.message === Hn || e.message.startsWith(Gn));
|
|
3041
|
+
async function oa(e, n, t, r) {
|
|
3026
3042
|
const { linkText: i, productId: a } = n.isVariantOf;
|
|
3027
|
-
if (!(!t || !i || t.startsWith(i) ||
|
|
3028
|
-
throw new Error(`${
|
|
3043
|
+
if (!(!t || !i || t.startsWith(i) || X(e) && r && Wn(t.split("-").pop() ?? "") && await ra(e, t, a, r)))
|
|
3044
|
+
throw new Error(`${Gn} slug: ${t}, linkText: ${i}`);
|
|
3029
3045
|
}
|
|
3030
|
-
async function
|
|
3046
|
+
async function sa(e, n) {
|
|
3031
3047
|
if (n == null)
|
|
3032
|
-
throw new
|
|
3048
|
+
throw new U("Missing slug or id");
|
|
3033
3049
|
const {
|
|
3034
3050
|
clients: { commerce: t, search: r }
|
|
3035
3051
|
} = e, i = await t.catalog.portal.pagetype(`${n}/p`);
|
|
@@ -3041,25 +3057,25 @@ async function aa(e, n) {
|
|
|
3041
3057
|
}).catch(() => null);
|
|
3042
3058
|
if (!a)
|
|
3043
3059
|
throw new z(`No product found for id ${i.id}`);
|
|
3044
|
-
return L(
|
|
3060
|
+
return L(he(a.items), a);
|
|
3045
3061
|
}
|
|
3046
|
-
const
|
|
3062
|
+
const ca = {
|
|
3047
3063
|
product: async (e, { locator: n }, t) => {
|
|
3048
|
-
const r =
|
|
3049
|
-
r &&
|
|
3064
|
+
const r = Xe(n), i = Ge(n), a = Rr(n), o = _r(n);
|
|
3065
|
+
r && ne(t, r), i && Ae(t, i);
|
|
3050
3066
|
const {
|
|
3051
3067
|
loaders: { skuLoader: s }
|
|
3052
3068
|
} = t;
|
|
3053
3069
|
try {
|
|
3054
3070
|
const c = a ?? o?.split("-").pop() ?? "";
|
|
3055
|
-
if (!
|
|
3056
|
-
throw new Error(
|
|
3071
|
+
if (!Wn(c))
|
|
3072
|
+
throw new Error(Hn);
|
|
3057
3073
|
const d = await s.load(c);
|
|
3058
|
-
return await
|
|
3074
|
+
return await oa(t, d, o, i), d;
|
|
3059
3075
|
} catch (c) {
|
|
3060
|
-
if (!
|
|
3076
|
+
if (!aa(c))
|
|
3061
3077
|
throw c;
|
|
3062
|
-
return
|
|
3078
|
+
return sa(t, o);
|
|
3063
3079
|
}
|
|
3064
3080
|
},
|
|
3065
3081
|
collection: (e, { slug: n }, t) => {
|
|
@@ -3068,7 +3084,7 @@ const oa = {
|
|
|
3068
3084
|
} = t;
|
|
3069
3085
|
return r.load({
|
|
3070
3086
|
slug: n,
|
|
3071
|
-
locale:
|
|
3087
|
+
locale: vn(t)
|
|
3072
3088
|
});
|
|
3073
3089
|
},
|
|
3074
3090
|
search: async (e, {
|
|
@@ -3079,19 +3095,19 @@ const oa = {
|
|
|
3079
3095
|
selectedFacets: a,
|
|
3080
3096
|
sponsoredCount: o
|
|
3081
3097
|
}, s) => {
|
|
3082
|
-
const c =
|
|
3083
|
-
c &&
|
|
3098
|
+
const c = Xe(a), d = Ge(a), g = Ur(a);
|
|
3099
|
+
c && ne(s, c), d && Ae(s, d);
|
|
3084
3100
|
const p = t ? Number(t) : 0, f = {
|
|
3085
3101
|
page: Math.ceil(p / n) || 0,
|
|
3086
3102
|
count: n,
|
|
3087
3103
|
query: i ?? void 0,
|
|
3088
|
-
sort:
|
|
3089
|
-
selectedFacets: a?.flatMap(
|
|
3104
|
+
sort: ea(r ?? "score_desc", s.storage.customSortMap),
|
|
3105
|
+
selectedFacets: a?.flatMap(We) ?? [],
|
|
3090
3106
|
sponsoredCount: o ?? void 0
|
|
3091
3107
|
};
|
|
3092
3108
|
if (g) {
|
|
3093
3109
|
const l = (await s.clients.commerce.catalog.products.crossselling({
|
|
3094
|
-
type:
|
|
3110
|
+
type: Pn[g.key],
|
|
3095
3111
|
productId: g.value
|
|
3096
3112
|
})).map((m) => m.productId).slice(0, n), u = s.clients.search.productsByIdentifier({ field: "id", values: l }).then((m) => ({
|
|
3097
3113
|
products: m,
|
|
@@ -3164,12 +3180,12 @@ const oa = {
|
|
|
3164
3180
|
} = r, a = t ? Number(t) : 0, [o, s] = await Promise.all([
|
|
3165
3181
|
i.catalog.brand.list(),
|
|
3166
3182
|
i.catalog.category.tree()
|
|
3167
|
-
]), c = [], d = (h,
|
|
3183
|
+
]), c = [], d = (h, I) => {
|
|
3168
3184
|
c.push({
|
|
3169
3185
|
id: h.id,
|
|
3170
3186
|
name: h.name,
|
|
3171
|
-
fatherCategoryId:
|
|
3172
|
-
linkId:
|
|
3187
|
+
fatherCategoryId: I,
|
|
3188
|
+
linkId: ge(h.name),
|
|
3173
3189
|
title: h.Title,
|
|
3174
3190
|
description: null,
|
|
3175
3191
|
metaTagDescription: h.MetaTagDescription,
|
|
@@ -3185,13 +3201,13 @@ const oa = {
|
|
|
3185
3201
|
const f = [...o.filter((h) => h.isActive).map((h) => ({
|
|
3186
3202
|
id: h.id,
|
|
3187
3203
|
name: h.name,
|
|
3188
|
-
linkId:
|
|
3204
|
+
linkId: ge(h.name),
|
|
3189
3205
|
title: h.title,
|
|
3190
3206
|
description: null,
|
|
3191
3207
|
metaTagDescription: h.metaTagDescription,
|
|
3192
3208
|
availableLinkIds: null,
|
|
3193
3209
|
entityType: "brand"
|
|
3194
|
-
})), ...c].filter((h) => !!
|
|
3210
|
+
})), ...c].filter((h) => !!Dn.slug(h, null, r, null));
|
|
3195
3211
|
return {
|
|
3196
3212
|
pageInfo: {
|
|
3197
3213
|
hasNextPage: f.length - a > n,
|
|
@@ -3200,9 +3216,9 @@ const oa = {
|
|
|
3200
3216
|
endCursor: (Math.min(n, f.length - a) - 1).toString(),
|
|
3201
3217
|
totalCount: f.length
|
|
3202
3218
|
},
|
|
3203
|
-
edges: f.slice(a, a + n).map((h,
|
|
3219
|
+
edges: f.slice(a, a + n).map((h, I) => ({
|
|
3204
3220
|
node: h,
|
|
3205
|
-
cursor: (a +
|
|
3221
|
+
cursor: (a + I).toString()
|
|
3206
3222
|
}))
|
|
3207
3223
|
};
|
|
3208
3224
|
},
|
|
@@ -3226,7 +3242,7 @@ const oa = {
|
|
|
3226
3242
|
page: 1,
|
|
3227
3243
|
count: 1,
|
|
3228
3244
|
query: n ?? void 0,
|
|
3229
|
-
selectedFacets: t?.flatMap(
|
|
3245
|
+
selectedFacets: t?.flatMap(We) ?? [],
|
|
3230
3246
|
allowRedirect: !0
|
|
3231
3247
|
});
|
|
3232
3248
|
return {
|
|
@@ -3269,7 +3285,7 @@ const oa = {
|
|
|
3269
3285
|
userOrder: async (e, { orderId: n }, t) => {
|
|
3270
3286
|
try {
|
|
3271
3287
|
if (!n)
|
|
3272
|
-
throw new
|
|
3288
|
+
throw new U("Missing orderId");
|
|
3273
3289
|
const {
|
|
3274
3290
|
clients: { commerce: r }
|
|
3275
3291
|
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
@@ -3278,7 +3294,7 @@ const oa = {
|
|
|
3278
3294
|
let a = null;
|
|
3279
3295
|
try {
|
|
3280
3296
|
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
3281
|
-
a =
|
|
3297
|
+
a = kn(c);
|
|
3282
3298
|
} catch {
|
|
3283
3299
|
}
|
|
3284
3300
|
const s = (await r.masterData.getShopperById({
|
|
@@ -3317,7 +3333,7 @@ const oa = {
|
|
|
3317
3333
|
a = { message: i };
|
|
3318
3334
|
}
|
|
3319
3335
|
const o = a?.message || i;
|
|
3320
|
-
throw ee(r) ? new z(`No order found for id ${n}. ${o}.`) :
|
|
3336
|
+
throw ee(r) ? new z(`No order found for id ${n}. ${o}.`) : bt(r) ? new te(
|
|
3321
3337
|
`You are forbidden to interact with order with id ${n}. ${o}.`
|
|
3322
3338
|
) : r;
|
|
3323
3339
|
}
|
|
@@ -3365,10 +3381,10 @@ const oa = {
|
|
|
3365
3381
|
account: r,
|
|
3366
3382
|
headers: i,
|
|
3367
3383
|
clients: { commerce: a }
|
|
3368
|
-
} = t, s =
|
|
3384
|
+
} = t, s = H($(i?.cookie ?? "", r))?.userId ?? "";
|
|
3369
3385
|
if (!s)
|
|
3370
3386
|
return !0;
|
|
3371
|
-
const c = await a.licenseManager.isResourceGranted({ userId: s, resourceKey:
|
|
3387
|
+
const c = await a.licenseManager.isResourceGranted({ userId: s, resourceKey: ia }).catch(() => null);
|
|
3372
3388
|
return typeof c == "boolean" ? c : !0;
|
|
3373
3389
|
},
|
|
3374
3390
|
listUserQuotes: async (e, n, t) => {
|
|
@@ -3422,7 +3438,7 @@ const oa = {
|
|
|
3422
3438
|
account: r,
|
|
3423
3439
|
headers: i,
|
|
3424
3440
|
clients: { commerce: a }
|
|
3425
|
-
} = t, s =
|
|
3441
|
+
} = t, s = H($(i?.cookie ?? "", r))?.userId ?? "", [c, d, g] = await Promise.all([
|
|
3426
3442
|
a.session("").catch(() => null),
|
|
3427
3443
|
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
3428
3444
|
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
@@ -3432,7 +3448,7 @@ const oa = {
|
|
|
3432
3448
|
name: h,
|
|
3433
3449
|
email: f?.storeUserEmail?.value ?? "",
|
|
3434
3450
|
phone: p?.phone ?? "",
|
|
3435
|
-
role: g?.Roles?.map((
|
|
3451
|
+
role: g?.Roles?.map((I) => I.Name) ?? [],
|
|
3436
3452
|
orgUnit: f?.unitName?.value ?? ""
|
|
3437
3453
|
};
|
|
3438
3454
|
},
|
|
@@ -3443,14 +3459,14 @@ const oa = {
|
|
|
3443
3459
|
account: r,
|
|
3444
3460
|
headers: i,
|
|
3445
3461
|
clients: { commerce: a }
|
|
3446
|
-
} = t, o =
|
|
3462
|
+
} = t, o = H($(i?.cookie ?? "", r));
|
|
3447
3463
|
if (!o?.userId)
|
|
3448
3464
|
return null;
|
|
3449
3465
|
if (o?.isRepresentative) {
|
|
3450
3466
|
const c = await a.session("").catch(() => null);
|
|
3451
3467
|
if (!c)
|
|
3452
3468
|
return null;
|
|
3453
|
-
const d = c.namespaces.profile ?? null, g = c.namespaces.shopper ?? null, p = c.namespaces.authentication ?? null, f =
|
|
3469
|
+
const d = c.namespaces.profile ?? null, g = c.namespaces.shopper ?? null, p = c.namespaces.authentication ?? null, f = rn(c) || o?.customerId?.trim() || "";
|
|
3454
3470
|
let h = null;
|
|
3455
3471
|
if (f)
|
|
3456
3472
|
try {
|
|
@@ -3461,9 +3477,9 @@ const oa = {
|
|
|
3461
3477
|
u
|
|
3462
3478
|
);
|
|
3463
3479
|
}
|
|
3464
|
-
const
|
|
3480
|
+
const I = `${(g?.firstName?.value ?? "").trim()} ${(g?.lastName?.value ?? "").trim()}`.trim();
|
|
3465
3481
|
return {
|
|
3466
|
-
name:
|
|
3482
|
+
name: xn(h, d) || I || "",
|
|
3467
3483
|
email: d?.email?.value || p?.storeUserEmail?.value || "",
|
|
3468
3484
|
id: d?.id?.value || p?.customerId?.value || o?.customerId?.trim() || ""
|
|
3469
3485
|
// createdAt: '',
|
|
@@ -3483,7 +3499,7 @@ const oa = {
|
|
|
3483
3499
|
// Contract list from VTEX session `shopper.availableContracts`.
|
|
3484
3500
|
availableContracts: async (e, { orgUnitId: n }, t) => {
|
|
3485
3501
|
if (!n)
|
|
3486
|
-
throw new
|
|
3502
|
+
throw new U("Missing orgUnitId");
|
|
3487
3503
|
const {
|
|
3488
3504
|
account: r,
|
|
3489
3505
|
headers: i,
|
|
@@ -3491,39 +3507,46 @@ const oa = {
|
|
|
3491
3507
|
} = t, o = await a.session("").catch(() => null), s = $(i?.cookie ?? "", r);
|
|
3492
3508
|
let c = null;
|
|
3493
3509
|
try {
|
|
3494
|
-
c = s ?
|
|
3510
|
+
c = s ? H(s) : null;
|
|
3495
3511
|
} catch {
|
|
3496
3512
|
c = null;
|
|
3497
3513
|
}
|
|
3498
3514
|
const d = o?.namespaces.authentication?.unitId?.value?.trim() ?? c?.unitId?.trim() ?? "";
|
|
3499
3515
|
if (!d || d !== n)
|
|
3500
|
-
throw new
|
|
3516
|
+
throw new te(
|
|
3501
3517
|
"You are not allowed to list contracts for this organization unit"
|
|
3502
3518
|
);
|
|
3503
|
-
const g =
|
|
3519
|
+
const g = Ci(
|
|
3504
3520
|
o?.namespaces.shopper
|
|
3505
|
-
), p =
|
|
3521
|
+
), p = rn(o) || c?.customerId?.trim() || "", f = await a.storeFront.attachedContracts(n).catch((I) => (console.warn(
|
|
3506
3522
|
"availableContracts: default contract lookup failed",
|
|
3507
|
-
|
|
3508
|
-
), null)), h =
|
|
3509
|
-
return
|
|
3523
|
+
I
|
|
3524
|
+
), null)), h = wi(f?.contracts);
|
|
3525
|
+
return Ai(
|
|
3510
3526
|
g,
|
|
3511
3527
|
p,
|
|
3512
3528
|
h
|
|
3513
3529
|
);
|
|
3514
3530
|
},
|
|
3515
|
-
pickupPoints: async (e, { geoCoordinates: n },
|
|
3531
|
+
pickupPoints: async (e, { geoCoordinates: n, postalCode: t, country: r, channel: i }, a) => {
|
|
3516
3532
|
const {
|
|
3517
|
-
clients: {
|
|
3518
|
-
} =
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3533
|
+
clients: { search: o }
|
|
3534
|
+
} = a;
|
|
3535
|
+
i && ne(a, i);
|
|
3536
|
+
const s = n?.longitude != null && n?.latitude != null ? `${n.longitude},${n.latitude}` : void 0;
|
|
3537
|
+
return {
|
|
3538
|
+
pickupPointDistances: (await o.pickupPointAvailability({
|
|
3539
|
+
postalCode: t ?? void 0,
|
|
3540
|
+
country: r ?? void 0,
|
|
3541
|
+
coordinates: s
|
|
3542
|
+
}))?.pickupPointDistances ?? [],
|
|
3543
|
+
pickupPointsHash: null
|
|
3544
|
+
};
|
|
3522
3545
|
},
|
|
3523
|
-
orderEntryOperation:
|
|
3524
|
-
orderFormItems:
|
|
3525
|
-
recommendations:
|
|
3526
|
-
},
|
|
3546
|
+
orderEntryOperation: na,
|
|
3547
|
+
orderFormItems: ta,
|
|
3548
|
+
recommendations: Zi
|
|
3549
|
+
}, la = {
|
|
3527
3550
|
reviewRating: () => ({
|
|
3528
3551
|
ratingValue: 5,
|
|
3529
3552
|
bestRating: 5
|
|
@@ -3531,7 +3554,7 @@ const oa = {
|
|
|
3531
3554
|
author: () => ({
|
|
3532
3555
|
name: ""
|
|
3533
3556
|
})
|
|
3534
|
-
},
|
|
3557
|
+
}, da = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, ua = {
|
|
3535
3558
|
suggestions: async (e, n, t) => {
|
|
3536
3559
|
const {
|
|
3537
3560
|
clients: { search: r }
|
|
@@ -3548,7 +3571,7 @@ const oa = {
|
|
|
3548
3571
|
r.suggestedTerms(i),
|
|
3549
3572
|
a
|
|
3550
3573
|
]), c = s.products.map((g) => {
|
|
3551
|
-
const p =
|
|
3574
|
+
const p = he(g.items);
|
|
3552
3575
|
return p && L(p, g);
|
|
3553
3576
|
}).filter((g) => !!g), { searches: d } = o;
|
|
3554
3577
|
return {
|
|
@@ -3558,7 +3581,7 @@ const oa = {
|
|
|
3558
3581
|
},
|
|
3559
3582
|
products: async ({ productSearchPromise: e }) => {
|
|
3560
3583
|
const n = await e, t = n.products.map((r) => {
|
|
3561
|
-
const i =
|
|
3584
|
+
const i = he(r.items);
|
|
3562
3585
|
return i && L(i, r);
|
|
3563
3586
|
}).filter((r) => !!r);
|
|
3564
3587
|
return {
|
|
@@ -3582,7 +3605,7 @@ const oa = {
|
|
|
3582
3605
|
t.storage.searchArgs = e;
|
|
3583
3606
|
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;
|
|
3584
3607
|
return i.filter(
|
|
3585
|
-
(d) => !a || !
|
|
3608
|
+
(d) => !a || !da(d, o, s)
|
|
3586
3609
|
);
|
|
3587
3610
|
},
|
|
3588
3611
|
metadata: async ({ productSearchPromise: e }) => {
|
|
@@ -3594,12 +3617,12 @@ const oa = {
|
|
|
3594
3617
|
};
|
|
3595
3618
|
},
|
|
3596
3619
|
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
3597
|
-
},
|
|
3620
|
+
}, pa = {
|
|
3598
3621
|
title: ({ title: e }) => e ?? "",
|
|
3599
3622
|
description: ({ description: e }) => e ?? "",
|
|
3600
3623
|
canonical: ({ canonical: e }) => e ?? "",
|
|
3601
3624
|
titleTemplate: () => ""
|
|
3602
|
-
},
|
|
3625
|
+
}, ga = ["bd", "d", "h", "m"], ma = (e) => ga.includes(e), ha = {
|
|
3603
3626
|
bd: {
|
|
3604
3627
|
0: "Today",
|
|
3605
3628
|
1: "In 1 business day",
|
|
@@ -3620,29 +3643,29 @@ const oa = {
|
|
|
3620
3643
|
1: "In 1 minute",
|
|
3621
3644
|
other: "Up to # minutes"
|
|
3622
3645
|
}
|
|
3623
|
-
},
|
|
3624
|
-
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i =
|
|
3646
|
+
}, Xn = (e) => {
|
|
3647
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = ma(t);
|
|
3625
3648
|
if (!r || !i)
|
|
3626
3649
|
return "";
|
|
3627
3650
|
const a = Number(n) < 2 ? Number(n) : "other";
|
|
3628
|
-
return
|
|
3629
|
-
},
|
|
3651
|
+
return ha[t][a].replace("#", n) ?? "";
|
|
3652
|
+
}, fa = {
|
|
3630
3653
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
3631
3654
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
3632
|
-
localizedEstimates: (e) => e?.shippingEstimate ?
|
|
3633
|
-
},
|
|
3634
|
-
function
|
|
3635
|
-
const t = `${
|
|
3655
|
+
localizedEstimates: (e) => e?.shippingEstimate ? Xn(e.shippingEstimate) : ""
|
|
3656
|
+
}, cn = "skuvariation";
|
|
3657
|
+
function ln(e, n) {
|
|
3658
|
+
const t = `${cn}${n}`.toLowerCase(), r = e.find(
|
|
3636
3659
|
(a) => a.imageLabel === t
|
|
3637
3660
|
);
|
|
3638
3661
|
if (r)
|
|
3639
3662
|
return r;
|
|
3640
3663
|
const i = e.find(
|
|
3641
|
-
(a) => a.imageLabel ===
|
|
3664
|
+
(a) => a.imageLabel === cn
|
|
3642
3665
|
);
|
|
3643
3666
|
return i || e[0];
|
|
3644
3667
|
}
|
|
3645
|
-
function
|
|
3668
|
+
function Sa(e, n, t) {
|
|
3646
3669
|
const r = {};
|
|
3647
3670
|
return e.forEach((i) => {
|
|
3648
3671
|
const a = i.variations;
|
|
@@ -3654,30 +3677,30 @@ function ha(e, n, t) {
|
|
|
3654
3677
|
r[s] = `${t}-${i.itemId}`;
|
|
3655
3678
|
}), r;
|
|
3656
3679
|
}
|
|
3657
|
-
function
|
|
3680
|
+
function dn(e) {
|
|
3658
3681
|
const n = {};
|
|
3659
3682
|
return e.forEach((t) => {
|
|
3660
3683
|
n[t.name] = t.values[0];
|
|
3661
3684
|
}), n;
|
|
3662
3685
|
}
|
|
3663
|
-
function
|
|
3686
|
+
function ya(e) {
|
|
3664
3687
|
const n = {};
|
|
3665
3688
|
return e?.forEach((t) => {
|
|
3666
3689
|
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
3667
3690
|
}), n;
|
|
3668
3691
|
}
|
|
3669
|
-
function
|
|
3692
|
+
function Ia(e, n) {
|
|
3670
3693
|
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
3671
3694
|
}
|
|
3672
|
-
function
|
|
3695
|
+
function va(e) {
|
|
3673
3696
|
const n = e;
|
|
3674
3697
|
for (const t in e)
|
|
3675
3698
|
e[t].every(
|
|
3676
3699
|
(i) => !Number.isNaN(Number(i.value))
|
|
3677
|
-
) && e[t].sort((i, a) =>
|
|
3700
|
+
) && e[t].sort((i, a) => Ia(i.value, a.value));
|
|
3678
3701
|
return n;
|
|
3679
3702
|
}
|
|
3680
|
-
function
|
|
3703
|
+
function Oa(e, n, t) {
|
|
3681
3704
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
3682
3705
|
return e.forEach((a) => {
|
|
3683
3706
|
if (a.variations.length === 0)
|
|
@@ -3690,7 +3713,7 @@ function Ia(e, n, t) {
|
|
|
3690
3713
|
if (!o || i.has(c))
|
|
3691
3714
|
return;
|
|
3692
3715
|
i.add(c);
|
|
3693
|
-
const d =
|
|
3716
|
+
const d = ln(
|
|
3694
3717
|
a.images,
|
|
3695
3718
|
n
|
|
3696
3719
|
), g = {
|
|
@@ -3707,7 +3730,7 @@ function Ia(e, n, t) {
|
|
|
3707
3730
|
if (i.has(d))
|
|
3708
3731
|
return;
|
|
3709
3732
|
i.add(d);
|
|
3710
|
-
const g =
|
|
3733
|
+
const g = ln(
|
|
3711
3734
|
a.images,
|
|
3712
3735
|
c.name
|
|
3713
3736
|
), p = {
|
|
@@ -3718,58 +3741,58 @@ function Ia(e, n, t) {
|
|
|
3718
3741
|
};
|
|
3719
3742
|
r[c.name] ? r[c.name].push(p) : r[c.name] = [p];
|
|
3720
3743
|
});
|
|
3721
|
-
}),
|
|
3744
|
+
}), va(r);
|
|
3722
3745
|
}
|
|
3723
|
-
const
|
|
3724
|
-
activeVariations: (e) =>
|
|
3725
|
-
allVariantsByName: (e) =>
|
|
3726
|
-
slugsMap: (e, n) =>
|
|
3746
|
+
const Ca = {
|
|
3747
|
+
activeVariations: (e) => dn(e.variations),
|
|
3748
|
+
allVariantsByName: (e) => ya(e.isVariantOf.skuSpecifications),
|
|
3749
|
+
slugsMap: (e, n) => Sa(
|
|
3727
3750
|
e.isVariantOf.items,
|
|
3728
3751
|
n.dominantVariantName ?? e.variations[0]?.name,
|
|
3729
3752
|
e.isVariantOf.linkText
|
|
3730
3753
|
),
|
|
3731
3754
|
availableVariations: (e, n) => {
|
|
3732
|
-
const t = n.dominantVariantName ?? e.variations[0]?.name, i =
|
|
3733
|
-
return
|
|
3755
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = dn(e.variations)[t];
|
|
3756
|
+
return Oa(
|
|
3734
3757
|
e.isVariantOf.items,
|
|
3735
3758
|
t,
|
|
3736
3759
|
i
|
|
3737
3760
|
);
|
|
3738
3761
|
},
|
|
3739
3762
|
allVariantProducts: (e) => e.isVariantOf.items.map((n) => L(n, e.isVariantOf))
|
|
3740
|
-
},
|
|
3763
|
+
}, ba = {
|
|
3741
3764
|
"pickup-in-point": "Pickup",
|
|
3742
3765
|
delivery: "Delivery",
|
|
3743
3766
|
pickup: "Pickup",
|
|
3744
3767
|
"take-away": "Take away",
|
|
3745
3768
|
"": ""
|
|
3746
|
-
},
|
|
3769
|
+
}, wa = {
|
|
3747
3770
|
deliveryOptionsData: (e) => {
|
|
3748
3771
|
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
|
|
3749
3772
|
(d, g) => {
|
|
3750
|
-
const p = g?.selectedSla || "", f = g?.selectedDeliveryChannel || g?.deliveryChannel || "", h = g?.deliveryCompany || "",
|
|
3751
|
-
(
|
|
3752
|
-
),
|
|
3773
|
+
const p = g?.selectedSla || "", f = g?.selectedDeliveryChannel || g?.deliveryChannel || "", h = g?.deliveryCompany || "", I = g?.deliveryWindow, l = g?.pickupStoreInfo, u = g?.shippingEstimate || "", m = g?.shippingEstimate ? Xn(g?.shippingEstimate) : "", S = g?.shippingEstimateDate || "", v = g?.addressId || "", b = g?.itemIndex ?? 0, C = t?.[b], _ = C?.seller || "", A = `${p}|${f}|${h}|${_}|${u}|${S}|${v}|${I?.startDateUtc}|${I?.endDateUtc}`, O = i?.find(
|
|
3774
|
+
(R) => R?.addressId === v
|
|
3775
|
+
), P = `${ba[f] || ""} ${m} ${O?.neighborhood ? `to ${O?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: D, taxPriceTags: E } = Aa(
|
|
3753
3776
|
C?.priceTags ?? []
|
|
3754
|
-
),
|
|
3755
|
-
return d[
|
|
3777
|
+
), k = (C?.sellingPrice ?? 0) * (C?.quantity ?? 0) + (C?.tax ?? 0) + (D ?? 0);
|
|
3778
|
+
return d[A] || (d[A] = {
|
|
3756
3779
|
// static fields
|
|
3757
3780
|
selectedSla: p,
|
|
3758
3781
|
deliveryChannel: f,
|
|
3759
3782
|
deliveryCompany: h,
|
|
3760
|
-
deliveryWindow:
|
|
3783
|
+
deliveryWindow: I,
|
|
3761
3784
|
shippingEstimate: u,
|
|
3762
3785
|
shippingEstimateDate: S,
|
|
3763
3786
|
seller: _,
|
|
3764
3787
|
friendlyShippingEstimate: m,
|
|
3765
|
-
friendlyDeliveryOptionName:
|
|
3766
|
-
address:
|
|
3788
|
+
friendlyDeliveryOptionName: P,
|
|
3789
|
+
address: O,
|
|
3767
3790
|
pickupStoreInfo: l,
|
|
3768
3791
|
// dynamic fields
|
|
3769
3792
|
quantityOfDifferentItems: 0,
|
|
3770
3793
|
total: 0,
|
|
3771
3794
|
items: []
|
|
3772
|
-
}), d[
|
|
3795
|
+
}), d[A] && (d[A].items?.push({
|
|
3773
3796
|
id: C?.id || "",
|
|
3774
3797
|
uniqueId: C?.uniqueId || "",
|
|
3775
3798
|
name: C?.name || "",
|
|
@@ -3777,11 +3800,11 @@ const va = {
|
|
|
3777
3800
|
price: C?.price || 0,
|
|
3778
3801
|
sellingPrice: C?.sellingPrice || 0,
|
|
3779
3802
|
imageUrl: C?.imageUrl || "",
|
|
3780
|
-
taxPriceTags:
|
|
3803
|
+
taxPriceTags: E ?? [],
|
|
3781
3804
|
taxPriceTagsTotal: D ?? 0,
|
|
3782
3805
|
tax: C?.tax || 0,
|
|
3783
|
-
total:
|
|
3784
|
-
}), d[
|
|
3806
|
+
total: k
|
|
3807
|
+
}), d[A].quantityOfDifferentItems = (d[A].quantityOfDifferentItems ?? 0) + 1, d[A].total = (d[A].total ?? 0) + k), d;
|
|
3785
3808
|
},
|
|
3786
3809
|
{}
|
|
3787
3810
|
), o = Object.values(a), s = n?.contactInformation?.[0], c = {
|
|
@@ -3807,7 +3830,7 @@ const va = {
|
|
|
3807
3830
|
) || [];
|
|
3808
3831
|
}
|
|
3809
3832
|
};
|
|
3810
|
-
function
|
|
3833
|
+
function Aa(e) {
|
|
3811
3834
|
const t = e.filter(
|
|
3812
3835
|
(i) => i?.name?.includes("TAX")
|
|
3813
3836
|
), r = t.reduce(
|
|
@@ -3819,28 +3842,28 @@ function ba(e) {
|
|
|
3819
3842
|
taxPriceTagsTotal: r
|
|
3820
3843
|
};
|
|
3821
3844
|
}
|
|
3822
|
-
const
|
|
3823
|
-
StoreCollection:
|
|
3824
|
-
StoreAggregateOffer:
|
|
3825
|
-
StoreProduct:
|
|
3826
|
-
StoreSeo:
|
|
3827
|
-
StoreFacet:
|
|
3828
|
-
StoreFacetBoolean:
|
|
3829
|
-
StoreFacetRange:
|
|
3830
|
-
StoreFacetValueBoolean:
|
|
3831
|
-
StoreOffer:
|
|
3832
|
-
StoreAggregateRating:
|
|
3833
|
-
StoreReview:
|
|
3834
|
-
StoreProductGroup:
|
|
3835
|
-
StoreSearchResult:
|
|
3836
|
-
StorePropertyValue:
|
|
3837
|
-
SkuVariants:
|
|
3838
|
-
ShippingSLA:
|
|
3839
|
-
UserOrderResult:
|
|
3840
|
-
ObjectOrString:
|
|
3841
|
-
Query:
|
|
3842
|
-
Mutation:
|
|
3843
|
-
},
|
|
3845
|
+
const Da = {
|
|
3846
|
+
StoreCollection: Dn,
|
|
3847
|
+
StoreAggregateOffer: wr,
|
|
3848
|
+
StoreProduct: Xi,
|
|
3849
|
+
StoreSeo: pa,
|
|
3850
|
+
StoreFacet: Tr,
|
|
3851
|
+
StoreFacetBoolean: Fr,
|
|
3852
|
+
StoreFacetRange: Nr,
|
|
3853
|
+
StoreFacetValueBoolean: Lr,
|
|
3854
|
+
StoreOffer: qi,
|
|
3855
|
+
StoreAggregateRating: Ar,
|
|
3856
|
+
StoreReview: la,
|
|
3857
|
+
StoreProductGroup: Ji,
|
|
3858
|
+
StoreSearchResult: ua,
|
|
3859
|
+
StorePropertyValue: Ki,
|
|
3860
|
+
SkuVariants: Ca,
|
|
3861
|
+
ShippingSLA: fa,
|
|
3862
|
+
UserOrderResult: wa,
|
|
3863
|
+
ObjectOrString: Vi,
|
|
3864
|
+
Query: ca,
|
|
3865
|
+
Mutation: $i
|
|
3866
|
+
}, Pa = () => Da, ka = `"""
|
|
3844
3867
|
Address information.
|
|
3845
3868
|
"""
|
|
3846
3869
|
type Address {
|
|
@@ -3885,7 +3908,7 @@ type Address {
|
|
|
3885
3908
|
"""
|
|
3886
3909
|
geoCoordinates: [Float]
|
|
3887
3910
|
}
|
|
3888
|
-
`,
|
|
3911
|
+
`, Ea = `"""
|
|
3889
3912
|
Advertisement information about a specific product in a campaign
|
|
3890
3913
|
"""
|
|
3891
3914
|
type Advertisement {
|
|
@@ -3910,7 +3933,7 @@ type Advertisement {
|
|
|
3910
3933
|
"""
|
|
3911
3934
|
adResponseId: String!
|
|
3912
3935
|
}
|
|
3913
|
-
`,
|
|
3936
|
+
`, Ua = `"""
|
|
3914
3937
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
3915
3938
|
"""
|
|
3916
3939
|
type StoreAggregateOffer {
|
|
@@ -3939,7 +3962,7 @@ type StoreAggregateOffer {
|
|
|
3939
3962
|
"""
|
|
3940
3963
|
offers: [StoreOffer!]!
|
|
3941
3964
|
}
|
|
3942
|
-
`,
|
|
3965
|
+
`, _a = `"""
|
|
3943
3966
|
Average rating, based on multiple ratings or reviews.
|
|
3944
3967
|
"""
|
|
3945
3968
|
type StoreAggregateRating {
|
|
@@ -3952,7 +3975,7 @@ type StoreAggregateRating {
|
|
|
3952
3975
|
"""
|
|
3953
3976
|
reviewCount: Int!
|
|
3954
3977
|
}
|
|
3955
|
-
`,
|
|
3978
|
+
`, Ra = `"""
|
|
3956
3979
|
information about the author of a product review or rating.
|
|
3957
3980
|
"""
|
|
3958
3981
|
type StoreAuthor {
|
|
@@ -3961,7 +3984,7 @@ type StoreAuthor {
|
|
|
3961
3984
|
"""
|
|
3962
3985
|
name: String!
|
|
3963
3986
|
}
|
|
3964
|
-
`,
|
|
3987
|
+
`, Ta = `"""
|
|
3965
3988
|
Brand of a given product.
|
|
3966
3989
|
"""
|
|
3967
3990
|
type StoreBrand {
|
|
@@ -3970,7 +3993,7 @@ type StoreBrand {
|
|
|
3970
3993
|
"""
|
|
3971
3994
|
name: String!
|
|
3972
3995
|
}
|
|
3973
|
-
`,
|
|
3996
|
+
`, Fa = `"""
|
|
3974
3997
|
Item of a list.
|
|
3975
3998
|
"""
|
|
3976
3999
|
type StoreListItem {
|
|
@@ -4001,7 +4024,7 @@ type StoreBreadcrumbList {
|
|
|
4001
4024
|
"""
|
|
4002
4025
|
numberOfItems: Int!
|
|
4003
4026
|
}
|
|
4004
|
-
`,
|
|
4027
|
+
`, Na = `"""
|
|
4005
4028
|
Shopping cart message.
|
|
4006
4029
|
"""
|
|
4007
4030
|
type StoreCartMessage {
|
|
@@ -4038,7 +4061,7 @@ input IStoreCart {
|
|
|
4038
4061
|
"""
|
|
4039
4062
|
order: IStoreOrder!
|
|
4040
4063
|
}
|
|
4041
|
-
`,
|
|
4064
|
+
`, La = `"""
|
|
4042
4065
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\` or \`Collection\`.
|
|
4043
4066
|
|
|
4044
4067
|
\`SubCategory\` and \`Cluster\` are still declared for backward compatibility but are
|
|
@@ -4164,7 +4187,7 @@ type StoreCollectionLocale {
|
|
|
4164
4187
|
"""
|
|
4165
4188
|
slug: String!
|
|
4166
4189
|
}
|
|
4167
|
-
`,
|
|
4190
|
+
`, Ba = `"""
|
|
4168
4191
|
Delivery Promise badge.
|
|
4169
4192
|
"""
|
|
4170
4193
|
type DeliveryPromiseBadge {
|
|
@@ -4173,7 +4196,7 @@ type DeliveryPromiseBadge {
|
|
|
4173
4196
|
"""
|
|
4174
4197
|
typeName: String
|
|
4175
4198
|
}
|
|
4176
|
-
`,
|
|
4199
|
+
`, $a = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
4177
4200
|
|
|
4178
4201
|
"""
|
|
4179
4202
|
Search facet range information.
|
|
@@ -4250,7 +4273,7 @@ type StoreFacetValueBoolean {
|
|
|
4250
4273
|
"""
|
|
4251
4274
|
quantity: Int
|
|
4252
4275
|
}
|
|
4253
|
-
`,
|
|
4276
|
+
`, Ma = `"""
|
|
4254
4277
|
Image.
|
|
4255
4278
|
"""
|
|
4256
4279
|
type StoreImage {
|
|
@@ -4277,7 +4300,7 @@ input IStoreImage {
|
|
|
4277
4300
|
"""
|
|
4278
4301
|
alternateName: String!
|
|
4279
4302
|
}
|
|
4280
|
-
`,
|
|
4303
|
+
`, za = `type Mutation {
|
|
4281
4304
|
"""
|
|
4282
4305
|
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\`.
|
|
4283
4306
|
"""
|
|
@@ -4319,7 +4342,7 @@ input IStoreImage {
|
|
|
4319
4342
|
"""
|
|
4320
4343
|
startRecommendationSession: Boolean!
|
|
4321
4344
|
}
|
|
4322
|
-
`,
|
|
4345
|
+
`, Va = `"""
|
|
4323
4346
|
Newsletter information.
|
|
4324
4347
|
"""
|
|
4325
4348
|
type PersonNewsletter {
|
|
@@ -4342,8 +4365,8 @@ input IPersonNewsletter {
|
|
|
4342
4365
|
"""
|
|
4343
4366
|
email: String!
|
|
4344
4367
|
}
|
|
4345
|
-
`,
|
|
4346
|
-
`,
|
|
4368
|
+
`, qa = `scalar ObjectOrString
|
|
4369
|
+
`, xa = `"""
|
|
4347
4370
|
Offer information.
|
|
4348
4371
|
"""
|
|
4349
4372
|
type StoreOffer {
|
|
@@ -4436,7 +4459,7 @@ input IStoreOffer {
|
|
|
4436
4459
|
"""
|
|
4437
4460
|
priceToken: String
|
|
4438
4461
|
}
|
|
4439
|
-
`,
|
|
4462
|
+
`, ja = `"""
|
|
4440
4463
|
Information of a specific order.
|
|
4441
4464
|
"""
|
|
4442
4465
|
type StoreOrder {
|
|
@@ -4477,7 +4500,7 @@ input IStoreOrder {
|
|
|
4477
4500
|
"""
|
|
4478
4501
|
shouldSplitItem: Boolean
|
|
4479
4502
|
}
|
|
4480
|
-
`,
|
|
4503
|
+
`, Wa = `"""
|
|
4481
4504
|
Commercial Authorization response.
|
|
4482
4505
|
"""
|
|
4483
4506
|
type CommercialAuthorizationResponse {
|
|
@@ -4876,7 +4899,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
4876
4899
|
"""
|
|
4877
4900
|
rule: CommercialAuthorizationRule!
|
|
4878
4901
|
}
|
|
4879
|
-
`,
|
|
4902
|
+
`, Ha = `"""
|
|
4880
4903
|
Input for uploading a file to the Order Entry Service.
|
|
4881
4904
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
4882
4905
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -4937,7 +4960,7 @@ type StoreOrderFormCartItem {
|
|
|
4937
4960
|
seller: String!
|
|
4938
4961
|
unitMultiplier: Float
|
|
4939
4962
|
}
|
|
4940
|
-
`,
|
|
4963
|
+
`, Ga = `"""
|
|
4941
4964
|
Organization.
|
|
4942
4965
|
"""
|
|
4943
4966
|
type StoreOrganization {
|
|
@@ -4978,7 +5001,7 @@ type StoreContract {
|
|
|
4978
5001
|
"""
|
|
4979
5002
|
isDefault: Boolean!
|
|
4980
5003
|
}
|
|
4981
|
-
`,
|
|
5004
|
+
`, Xa = `"""
|
|
4982
5005
|
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.
|
|
4983
5006
|
"""
|
|
4984
5007
|
type StorePageInfo {
|
|
@@ -5003,7 +5026,7 @@ type StorePageInfo {
|
|
|
5003
5026
|
"""
|
|
5004
5027
|
totalCount: Int!
|
|
5005
5028
|
}
|
|
5006
|
-
`,
|
|
5029
|
+
`, Ya = `"""
|
|
5007
5030
|
Input type for setting a new password.
|
|
5008
5031
|
"""
|
|
5009
5032
|
input ISetPassword {
|
|
@@ -5046,7 +5069,7 @@ type SetPasswordResponse {
|
|
|
5046
5069
|
"""
|
|
5047
5070
|
message: String
|
|
5048
5071
|
}
|
|
5049
|
-
`,
|
|
5072
|
+
`, Ja = `"""
|
|
5050
5073
|
Client profile data.
|
|
5051
5074
|
"""
|
|
5052
5075
|
type StorePerson {
|
|
@@ -5089,7 +5112,7 @@ input IStorePerson {
|
|
|
5089
5112
|
"""
|
|
5090
5113
|
familyName: String!
|
|
5091
5114
|
}
|
|
5092
|
-
`,
|
|
5115
|
+
`, Ka = `type PickupPointAddress {
|
|
5093
5116
|
"""
|
|
5094
5117
|
Address city.
|
|
5095
5118
|
"""
|
|
@@ -5164,11 +5187,14 @@ type PickupPoints {
|
|
|
5164
5187
|
"""
|
|
5165
5188
|
pickupPointDistances: [PickupPointDistance]
|
|
5166
5189
|
"""
|
|
5167
|
-
|
|
5190
|
+
Not returned by Intelligent Search pickup-point-availability. Always null.
|
|
5168
5191
|
"""
|
|
5169
5192
|
pickupPointsHash: String
|
|
5193
|
+
@deprecated(
|
|
5194
|
+
reason: "Not returned by Intelligent Search pickup-point-availability. Always null."
|
|
5195
|
+
)
|
|
5170
5196
|
}
|
|
5171
|
-
`,
|
|
5197
|
+
`, Qa = `"""
|
|
5172
5198
|
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.
|
|
5173
5199
|
"""
|
|
5174
5200
|
type StoreProduct {
|
|
@@ -5344,7 +5370,7 @@ input IStoreProduct {
|
|
|
5344
5370
|
"""
|
|
5345
5371
|
additionalProperty: [IStorePropertyValue!]
|
|
5346
5372
|
}
|
|
5347
|
-
`,
|
|
5373
|
+
`, Za = `"""
|
|
5348
5374
|
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.
|
|
5349
5375
|
"""
|
|
5350
5376
|
type StoreProductGroup {
|
|
@@ -5389,7 +5415,7 @@ type StoreProductCluster {
|
|
|
5389
5415
|
"""
|
|
5390
5416
|
name: String!
|
|
5391
5417
|
}
|
|
5392
|
-
`,
|
|
5418
|
+
`, eo = `type Profile {
|
|
5393
5419
|
"""
|
|
5394
5420
|
Collection of user's address
|
|
5395
5421
|
"""
|
|
@@ -5450,7 +5476,7 @@ type ProfileAddress {
|
|
|
5450
5476
|
"""
|
|
5451
5477
|
geoCoordinate: [Float]
|
|
5452
5478
|
}
|
|
5453
|
-
`,
|
|
5479
|
+
`, no = `"""
|
|
5454
5480
|
Properties that can be associated with products and products groups.
|
|
5455
5481
|
"""
|
|
5456
5482
|
type StorePropertyValue {
|
|
@@ -5490,7 +5516,7 @@ input IStorePropertyValue {
|
|
|
5490
5516
|
"""
|
|
5491
5517
|
valueReference: ObjectOrString!
|
|
5492
5518
|
}
|
|
5493
|
-
`,
|
|
5519
|
+
`, to = `"""
|
|
5494
5520
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
5495
5521
|
"""
|
|
5496
5522
|
type StoreProductEdge {
|
|
@@ -6022,15 +6048,27 @@ type Query {
|
|
|
6022
6048
|
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
6023
6049
|
|
|
6024
6050
|
"""
|
|
6025
|
-
Returns
|
|
6051
|
+
Returns pickup points that have products available for the shopper location and sales channel.
|
|
6026
6052
|
"""
|
|
6027
6053
|
pickupPoints(
|
|
6028
6054
|
"""
|
|
6029
|
-
Geo coordinates
|
|
6055
|
+
Geo coordinates used to sort pickup points by distance (\`longitude,latitude\`). Without \`postalCode\`, the segment postal code stays in place.
|
|
6030
6056
|
"""
|
|
6031
6057
|
geoCoordinates: IStoreGeoCoordinates
|
|
6058
|
+
"""
|
|
6059
|
+
Postal code. When it differs from the segment cookie, delivery hashes are omitted so a simulated address is not resolved against the previous CEP.
|
|
6060
|
+
"""
|
|
6061
|
+
postalCode: String
|
|
6062
|
+
"""
|
|
6063
|
+
Three-letter country code for \`postalCode\`.
|
|
6064
|
+
"""
|
|
6065
|
+
country: String
|
|
6066
|
+
"""
|
|
6067
|
+
Shopper channel, the same JSON string used by the \`channel\` search facet. When set, its sales channel is used instead of the store default.
|
|
6068
|
+
"""
|
|
6069
|
+
channel: String
|
|
6032
6070
|
): PickupPoints
|
|
6033
|
-
@cacheControl(scope: "
|
|
6071
|
+
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
6034
6072
|
"""
|
|
6035
6073
|
Returns the status of an Order Entry Service operation by its ID.
|
|
6036
6074
|
"""
|
|
@@ -6139,7 +6177,7 @@ type StoreAccountProfile {
|
|
|
6139
6177
|
email: String
|
|
6140
6178
|
id: String
|
|
6141
6179
|
}
|
|
6142
|
-
`,
|
|
6180
|
+
`, ro = `"""
|
|
6143
6181
|
Summary of a quote returned in list results.
|
|
6144
6182
|
"""
|
|
6145
6183
|
type UserQuoteSummary {
|
|
@@ -6204,7 +6242,7 @@ type UserQuoteListPaging {
|
|
|
6204
6242
|
"""
|
|
6205
6243
|
perPage: Int!
|
|
6206
6244
|
}
|
|
6207
|
-
`,
|
|
6245
|
+
`, io = `type RecommendationResponse {
|
|
6208
6246
|
products: [StoreProduct!]!
|
|
6209
6247
|
correlationId: String!
|
|
6210
6248
|
campaign: RecommendationCampaign!
|
|
@@ -6215,7 +6253,7 @@ type RecommendationCampaign {
|
|
|
6215
6253
|
title: String
|
|
6216
6254
|
type: String!
|
|
6217
6255
|
}
|
|
6218
|
-
`,
|
|
6256
|
+
`, ao = `"""
|
|
6219
6257
|
Information of a given review rating.
|
|
6220
6258
|
"""
|
|
6221
6259
|
type StoreReviewRating {
|
|
@@ -6242,7 +6280,7 @@ type StoreReview {
|
|
|
6242
6280
|
"""
|
|
6243
6281
|
author: StoreAuthor!
|
|
6244
6282
|
}
|
|
6245
|
-
`,
|
|
6283
|
+
`, oo = `"""
|
|
6246
6284
|
Whether a saved card is personally owned by the buyer or shared by their
|
|
6247
6285
|
Organization/Contract. Resolved server-side by the Saved-cards service from
|
|
6248
6286
|
the buyer's \`useAdHocCard\` role — never inferred client-side.
|
|
@@ -6306,7 +6344,7 @@ type SavedCardListResult {
|
|
|
6306
6344
|
"""
|
|
6307
6345
|
list: [SavedCard!]
|
|
6308
6346
|
}
|
|
6309
|
-
`,
|
|
6347
|
+
`, so = `"""
|
|
6310
6348
|
Search Engine Optimization (SEO) tags data.
|
|
6311
6349
|
"""
|
|
6312
6350
|
type StoreSeo {
|
|
@@ -6327,7 +6365,7 @@ type StoreSeo {
|
|
|
6327
6365
|
"""
|
|
6328
6366
|
canonical: String!
|
|
6329
6367
|
}
|
|
6330
|
-
`,
|
|
6368
|
+
`, co = `"""
|
|
6331
6369
|
Currency information.
|
|
6332
6370
|
"""
|
|
6333
6371
|
type StoreCurrency {
|
|
@@ -6602,7 +6640,7 @@ input IStoreSession {
|
|
|
6602
6640
|
"""
|
|
6603
6641
|
refreshAfter: String
|
|
6604
6642
|
}
|
|
6605
|
-
`,
|
|
6643
|
+
`, lo = `"""
|
|
6606
6644
|
Shipping Simulation item input.
|
|
6607
6645
|
"""
|
|
6608
6646
|
input IShippingItem {
|
|
@@ -6933,7 +6971,7 @@ type MessageFields {
|
|
|
6933
6971
|
"""
|
|
6934
6972
|
skuName: String
|
|
6935
6973
|
}
|
|
6936
|
-
`,
|
|
6974
|
+
`, uo = `type SkuVariants {
|
|
6937
6975
|
"""
|
|
6938
6976
|
SKU property values for the current SKU.
|
|
6939
6977
|
"""
|
|
@@ -7028,7 +7066,7 @@ Example:
|
|
|
7028
7066
|
\`\`\`
|
|
7029
7067
|
"""
|
|
7030
7068
|
scalar FormattedVariants
|
|
7031
|
-
`,
|
|
7069
|
+
`, po = `"""
|
|
7032
7070
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
7033
7071
|
"""
|
|
7034
7072
|
enum StoreStatus {
|
|
@@ -7036,7 +7074,7 @@ enum StoreStatus {
|
|
|
7036
7074
|
WARNING
|
|
7037
7075
|
ERROR
|
|
7038
7076
|
}
|
|
7039
|
-
`,
|
|
7077
|
+
`, go = `scalar JSONObject
|
|
7040
7078
|
|
|
7041
7079
|
type UserOrder {
|
|
7042
7080
|
orderId: String
|
|
@@ -7860,99 +7898,99 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
7860
7898
|
type: String
|
|
7861
7899
|
id: String
|
|
7862
7900
|
}
|
|
7863
|
-
`,
|
|
7864
|
-
"./address.graphql":
|
|
7865
|
-
"./advertisement.graphql":
|
|
7866
|
-
"./aggregateOffer.graphql":
|
|
7867
|
-
"./aggregateRating.graphql":
|
|
7868
|
-
"./author.graphql":
|
|
7869
|
-
"./brand.graphql":
|
|
7870
|
-
"./breadcrumb.graphql":
|
|
7871
|
-
"./cart.graphql":
|
|
7872
|
-
"./collection.graphql":
|
|
7873
|
-
"./deliveryPromisesBadge.graphql":
|
|
7874
|
-
"./facet.graphql":
|
|
7875
|
-
"./image.graphql":
|
|
7876
|
-
"./mutation.graphql":
|
|
7877
|
-
"./newsletter.graphql":
|
|
7878
|
-
"./objectOrString.graphql":
|
|
7879
|
-
"./offer.graphql":
|
|
7880
|
-
"./order.graphql":
|
|
7881
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
7882
|
-
"./orderEntry.graphql":
|
|
7883
|
-
"./organization.graphql":
|
|
7884
|
-
"./pageInfo.graphql":
|
|
7885
|
-
"./password.graphql":
|
|
7886
|
-
"./person.graphql":
|
|
7887
|
-
"./pickupPoints.graphql":
|
|
7888
|
-
"./product.graphql":
|
|
7889
|
-
"./productGroup.graphql":
|
|
7890
|
-
"./profile.graphql":
|
|
7891
|
-
"./propertyValue.graphql":
|
|
7892
|
-
"./query.graphql":
|
|
7893
|
-
"./quote.graphql":
|
|
7894
|
-
"./recommendation.graphql":
|
|
7895
|
-
"./review.graphql":
|
|
7896
|
-
"./savedCard.graphql":
|
|
7897
|
-
"./seo.graphql":
|
|
7898
|
-
"./session.graphql":
|
|
7899
|
-
"./shipping.graphql":
|
|
7900
|
-
"./skuVariants.graphql":
|
|
7901
|
-
"./status.graphql":
|
|
7902
|
-
"./userOrder.graphql":
|
|
7903
|
-
}),
|
|
7904
|
-
Object.values(
|
|
7905
|
-
(e, n) =>
|
|
7901
|
+
`, mo = /* @__PURE__ */ Object.assign({
|
|
7902
|
+
"./address.graphql": ka,
|
|
7903
|
+
"./advertisement.graphql": Ea,
|
|
7904
|
+
"./aggregateOffer.graphql": Ua,
|
|
7905
|
+
"./aggregateRating.graphql": _a,
|
|
7906
|
+
"./author.graphql": Ra,
|
|
7907
|
+
"./brand.graphql": Ta,
|
|
7908
|
+
"./breadcrumb.graphql": Fa,
|
|
7909
|
+
"./cart.graphql": Na,
|
|
7910
|
+
"./collection.graphql": La,
|
|
7911
|
+
"./deliveryPromisesBadge.graphql": Ba,
|
|
7912
|
+
"./facet.graphql": $a,
|
|
7913
|
+
"./image.graphql": Ma,
|
|
7914
|
+
"./mutation.graphql": za,
|
|
7915
|
+
"./newsletter.graphql": Va,
|
|
7916
|
+
"./objectOrString.graphql": qa,
|
|
7917
|
+
"./offer.graphql": xa,
|
|
7918
|
+
"./order.graphql": ja,
|
|
7919
|
+
"./orderCommercialAuthorizaton.graphql": Wa,
|
|
7920
|
+
"./orderEntry.graphql": Ha,
|
|
7921
|
+
"./organization.graphql": Ga,
|
|
7922
|
+
"./pageInfo.graphql": Xa,
|
|
7923
|
+
"./password.graphql": Ya,
|
|
7924
|
+
"./person.graphql": Ja,
|
|
7925
|
+
"./pickupPoints.graphql": Ka,
|
|
7926
|
+
"./product.graphql": Qa,
|
|
7927
|
+
"./productGroup.graphql": Za,
|
|
7928
|
+
"./profile.graphql": eo,
|
|
7929
|
+
"./propertyValue.graphql": no,
|
|
7930
|
+
"./query.graphql": to,
|
|
7931
|
+
"./quote.graphql": ro,
|
|
7932
|
+
"./recommendation.graphql": io,
|
|
7933
|
+
"./review.graphql": ao,
|
|
7934
|
+
"./savedCard.graphql": oo,
|
|
7935
|
+
"./seo.graphql": so,
|
|
7936
|
+
"./session.graphql": co,
|
|
7937
|
+
"./shipping.graphql": lo,
|
|
7938
|
+
"./skuVariants.graphql": uo,
|
|
7939
|
+
"./status.graphql": po,
|
|
7940
|
+
"./userOrder.graphql": go
|
|
7941
|
+
}), ho = et(
|
|
7942
|
+
Object.values(mo).map((e) => nt(e)).reduce(
|
|
7943
|
+
(e, n) => un([e, n], { sort: !0 })
|
|
7906
7944
|
)
|
|
7907
|
-
),
|
|
7908
|
-
channel:
|
|
7945
|
+
), fo = ho, Fo = async (e) => (n) => (n.storage = {
|
|
7946
|
+
channel: ae.parse(e.channel),
|
|
7909
7947
|
flags: e.flags ?? {},
|
|
7910
7948
|
locale: e.locale,
|
|
7911
7949
|
customSortMap: e.customSortMap ?? {},
|
|
7912
7950
|
cookies: /* @__PURE__ */ new Map()
|
|
7913
|
-
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients =
|
|
7914
|
-
function
|
|
7915
|
-
const e =
|
|
7951
|
+
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients = dr(e, n), n.loaders = vr(e, n), n);
|
|
7952
|
+
function So() {
|
|
7953
|
+
const e = Pa(), n = {};
|
|
7916
7954
|
for (const [t, r] of Object.entries(e))
|
|
7917
7955
|
n[t] = Object.fromEntries(
|
|
7918
|
-
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i,
|
|
7956
|
+
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, Ct(a, `${t}(${i})`)])
|
|
7919
7957
|
);
|
|
7920
7958
|
return n;
|
|
7921
7959
|
}
|
|
7922
|
-
function
|
|
7923
|
-
const t =
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
])(
|
|
7927
|
-
return e &&
|
|
7960
|
+
function No(e) {
|
|
7961
|
+
const t = Ot([
|
|
7962
|
+
vt,
|
|
7963
|
+
St
|
|
7964
|
+
])(So(), fo);
|
|
7965
|
+
return e && tt(e) ? Qn({
|
|
7928
7966
|
schemas: [t, e]
|
|
7929
7967
|
}) : t;
|
|
7930
7968
|
}
|
|
7931
7969
|
export {
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7970
|
+
St as AuthDirective,
|
|
7971
|
+
U as BadRequestError,
|
|
7972
|
+
vt as CacheControlDirective,
|
|
7973
|
+
st as CardOrigin,
|
|
7974
|
+
ct as CommercialAuthorizationStatus,
|
|
7975
|
+
J as FastStoreError,
|
|
7976
|
+
te as ForbiddenError,
|
|
7977
|
+
Fo as GraphqlVtexContextFactory,
|
|
7978
|
+
No as GraphqlVtexSchema,
|
|
7941
7979
|
z as NotFoundError,
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7980
|
+
lt as StoreCollectionType,
|
|
7981
|
+
dt as StoreFacetType,
|
|
7982
|
+
ut as StoreSort,
|
|
7983
|
+
pt as StoreStatus,
|
|
7984
|
+
de as UnauthorizedError,
|
|
7985
|
+
gt as UserOrderInvoiceType,
|
|
7948
7986
|
$ as getAuthCookie,
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7987
|
+
Ro as isBadRequestError,
|
|
7988
|
+
_o as isFastStoreError,
|
|
7989
|
+
bt as isForbiddenError,
|
|
7952
7990
|
ee as isNotFoundError,
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7991
|
+
To as isUnauthorizedError,
|
|
7992
|
+
Uo as stringifyCacheControl,
|
|
7993
|
+
fo as typeDefs,
|
|
7994
|
+
ht as validateUserAuthentication,
|
|
7995
|
+
Ot as withDirectives
|
|
7958
7996
|
};
|