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