@faststore/api 4.6.0-dev.0 → 4.6.0-dev.2
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 +51 -45
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +1345 -1237
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/__generated__/schema.d.ts +6 -0
- package/dist/src/__generated__/schema.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts +8 -1
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/index.d.ts +2 -1
- package/dist/src/platforms/vtex/clients/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/index.d.ts +1 -0
- package/dist/src/platforms/vtex/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/getOrderEntryOperation.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/index.d.ts +1 -0
- package/dist/src/platforms/vtex/resolvers/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/mutation.d.ts +1 -0
- package/dist/src/platforms/vtex/resolvers/mutation.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/validateCart.d.ts +1 -0
- package/dist/src/platforms/vtex/resolvers/validateCart.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/validateSession.d.ts.map +1 -1
- package/dist/src/platforms/vtex/utils/cartSalesChannel.d.ts +11 -0
- package/dist/src/platforms/vtex/utils/cartSalesChannel.d.ts.map +1 -0
- package/dist/src/platforms/vtex/utils/sessionChannel.d.ts +10 -0
- package/dist/src/platforms/vtex/utils/sessionChannel.d.ts.map +1 -0
- package/dist/src/platforms/vtex/utils/validateSessionHelpers.d.ts +88 -0
- package/dist/src/platforms/vtex/utils/validateSessionHelpers.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/__generated__/schema.ts +6 -0
- package/src/platforms/vtex/clients/commerce/index.ts +17 -2
- package/src/platforms/vtex/resolvers/validateCart.ts +86 -8
- package/src/platforms/vtex/resolvers/validateSession.ts +63 -140
- package/src/platforms/vtex/typeDefs/order.graphql +6 -0
- package/src/platforms/vtex/utils/cartSalesChannel.ts +31 -0
- package/src/platforms/vtex/utils/sessionChannel.ts +32 -0
- package/src/platforms/vtex/utils/validateSessionHelpers.ts +202 -0
package/dist/es/index.mjs
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
4
|
-
import { GraphQLScalarType as
|
|
5
|
-
import { logger as
|
|
6
|
-
import
|
|
7
|
-
import { parse as
|
|
1
|
+
import { mergeTypeDefs as tn } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as Nn, mergeSchemas as Ln } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as rn, MapperKind as on, getDirective as an } from "@graphql-tools/utils";
|
|
4
|
+
import { GraphQLScalarType as Bn, print as $n, parse as Mn, isSchema as zn } from "graphql";
|
|
5
|
+
import { logger as Vn, OTELAPI as $ } from "@faststore/diagnostics";
|
|
6
|
+
import xn from "isomorphic-unfetch";
|
|
7
|
+
import { parse as Q } from "cookie";
|
|
8
8
|
import we from "p-limit";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import de from "dataloader";
|
|
10
|
+
import qn from "sanitize-html";
|
|
11
11
|
import De from "fast-deep-equal";
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const
|
|
12
|
+
import jn from "node:crypto";
|
|
13
|
+
var Wn = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(Wn || {}), Gn = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(Gn || {}), Hn = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(Hn || {}), Xn = /* @__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))(Xn || {}), Yn = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(Yn || {}), Jn = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(Jn || {});
|
|
14
|
+
const Kn = () => 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 Y("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
|
+
}, Qn = 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 re("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 re("Authentication required") : r === 403 ? new Y("You are not allowed to access this resource") : new re("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, Zn = "auth", et = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (e) =>
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
36
|
+
transformer: (e) => rn(e, {
|
|
37
|
+
[on.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (an(e, n, Zn)?.[0]) {
|
|
39
39
|
const r = n.resolve;
|
|
40
|
-
n.resolve = async (i, o, a, s) => (await
|
|
40
|
+
n.resolve = async (i, o, a, s) => (await Qn(a), r?.(i, o, a, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, nt = "cacheControl", Ho = (e, n) => {
|
|
46
46
|
const {
|
|
47
47
|
scope: t = "private",
|
|
48
48
|
sMaxAge: r = 0,
|
|
49
49
|
staleWhileRevalidate: i = 0
|
|
50
50
|
} = e;
|
|
51
51
|
return `${n ? "private" : t}, s-maxage=${r}, stale-while-revalidate=${i}`;
|
|
52
|
-
},
|
|
52
|
+
}, ke = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, tt = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, rt = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (e) =>
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (e) => rn(e, {
|
|
55
|
+
[on.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = an(e, n, nt)?.[0];
|
|
57
57
|
if (t) {
|
|
58
58
|
const { sMaxAge: r, staleWhileRevalidate: i, scope: o } = t, a = n.resolve;
|
|
59
|
-
n.resolve = (s, c,
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
62
|
-
|
|
59
|
+
n.resolve = (s, c, d, u) => (d.cacheControl = {
|
|
60
|
+
sMaxAge: ke(d.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: ke(
|
|
62
|
+
d.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
66
|
-
}, a?.(s, c,
|
|
65
|
+
scope: tt(d.cacheControl?.scope, o)
|
|
66
|
+
}, a?.(s, c, d, u));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
71
|
+
}, it = (e) => (n, t) => {
|
|
72
|
+
const r = tn([
|
|
73
73
|
...(e ?? []).map(({ typeDefs: i }) => i),
|
|
74
74
|
t
|
|
75
75
|
]);
|
|
76
76
|
return (e ?? []).reduce(
|
|
77
77
|
(i, { transformer: o }) => o?.(i) ?? i,
|
|
78
|
-
|
|
78
|
+
Nn({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
},
|
|
84
|
-
name:
|
|
85
|
-
version:
|
|
86
|
-
},
|
|
83
|
+
}, sn = "@faststore/api", cn = "4.6.0-dev.1", Ue = {
|
|
84
|
+
name: sn,
|
|
85
|
+
version: cn
|
|
86
|
+
}, ot = Vn("@faststore/api"), at = (e, n = "Unknown Graphql Resolver") => (t, r, i, o) => {
|
|
87
87
|
if (!i?.OTEL_ENABLED)
|
|
88
88
|
return e(t, r, i, o);
|
|
89
89
|
const a = $.trace.getTracer("Graphql").startSpan(n, {
|
|
90
90
|
kind: $.SpanKind.INTERNAL,
|
|
91
91
|
attributes: {
|
|
92
92
|
timestamp: Date.now(),
|
|
93
|
-
"@faststore_version":
|
|
94
|
-
"@faststore_package_name":
|
|
93
|
+
"@faststore_version": cn,
|
|
94
|
+
"@faststore_package_name": sn,
|
|
95
95
|
"@faststore_account_name": i.account,
|
|
96
96
|
"@faststore_environment": process.env.NODE_ENV,
|
|
97
97
|
"@faststore_resolver_parent_type": o?.parentType?.name,
|
|
@@ -104,49 +104,49 @@ const Gn = () => function(n = {}) {
|
|
|
104
104
|
() => e(t, r, i, o)
|
|
105
105
|
);
|
|
106
106
|
return c instanceof Promise ? c.then(
|
|
107
|
-
(
|
|
108
|
-
(
|
|
107
|
+
(d) => (a.end(), d),
|
|
108
|
+
(d) => Te(d, a, n)
|
|
109
109
|
) : (a.end(), c);
|
|
110
110
|
} catch (c) {
|
|
111
|
-
return
|
|
111
|
+
return Te(c, a, n);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
function
|
|
114
|
+
function Te(e, n, t) {
|
|
115
115
|
throw n.setStatus({ code: $.SpanStatusCode.ERROR }), n.recordException(e), n.end(), console.error(`Error at resolver: ${t}:
|
|
116
|
-
%o`, e),
|
|
116
|
+
%o`, e), ot("error", `Error at resolver: %s
|
|
117
117
|
%o`, t, e), e;
|
|
118
118
|
}
|
|
119
|
-
class
|
|
119
|
+
class Z extends Error {
|
|
120
120
|
constructor(n, t) {
|
|
121
121
|
super(t), this.extensions = n, this.name = "FastStoreError";
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
class
|
|
124
|
+
class T extends Z {
|
|
125
125
|
constructor(n) {
|
|
126
126
|
super({ status: 400, type: "BadRequestError" }, n);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
class
|
|
129
|
+
class re extends Z {
|
|
130
130
|
constructor(n) {
|
|
131
131
|
super({ status: 401, type: "UnauthorizedError" }, n);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
class
|
|
134
|
+
class Y extends Z {
|
|
135
135
|
constructor(n) {
|
|
136
136
|
super({ status: 403, type: "ForbiddenError" }, n);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
class B extends
|
|
139
|
+
class B extends Z {
|
|
140
140
|
constructor(n) {
|
|
141
141
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
const r = await
|
|
144
|
+
const Xo = (e) => e?.name === "FastStoreError", Yo = (e) => e?.extensions?.type === "BadRequestError", Jo = (e) => e?.extensions?.type === "UnauthorizedError", st = (e) => e?.extensions?.type === "ForbiddenError", H = (e) => e?.extensions?.type === "NotFoundError", ct = `${Ue.name}@${Ue.version}`, y = async (e, n, t) => {
|
|
145
|
+
const r = await xn(e, {
|
|
146
146
|
...n,
|
|
147
147
|
headers: {
|
|
148
148
|
...n?.headers ?? {},
|
|
149
|
-
"User-Agent":
|
|
149
|
+
"User-Agent": ct
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
if (r.ok)
|
|
@@ -156,24 +156,24 @@ const No = (e) => e?.name === "FastStoreError", Lo = (e) => e?.extensions?.type
|
|
|
156
156
|
if (typeof r?.status == "number")
|
|
157
157
|
switch (r.status) {
|
|
158
158
|
case 400:
|
|
159
|
-
throw new
|
|
159
|
+
throw new T(i);
|
|
160
160
|
case 401:
|
|
161
|
-
throw new
|
|
161
|
+
throw new re(i);
|
|
162
162
|
case 403:
|
|
163
|
-
throw new
|
|
163
|
+
throw new Y(i);
|
|
164
164
|
case 404:
|
|
165
165
|
throw new B(i);
|
|
166
166
|
default:
|
|
167
|
-
throw new
|
|
167
|
+
throw new Z(
|
|
168
168
|
{ status: r.status, type: "UnknownError" },
|
|
169
169
|
i
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
throw new Error(i);
|
|
173
|
-
},
|
|
173
|
+
}, lt = ({ account: e, environment: n }) => {
|
|
174
174
|
const t = `https://${e}.${n}.com.br`;
|
|
175
175
|
return {
|
|
176
|
-
getLocalizedProduct: (r, i) =>
|
|
176
|
+
getLocalizedProduct: (r, i) => y(`${t}/api/catalog-dataplane/product/${r}`, {
|
|
177
177
|
method: "GET",
|
|
178
178
|
headers: {
|
|
179
179
|
"Accept-Language": i,
|
|
@@ -181,7 +181,7 @@ const No = (e) => e?.name === "FastStoreError", Lo = (e) => e?.extensions?.type
|
|
|
181
181
|
}
|
|
182
182
|
})
|
|
183
183
|
};
|
|
184
|
-
},
|
|
184
|
+
}, ln = (e) => {
|
|
185
185
|
if (!e)
|
|
186
186
|
return e;
|
|
187
187
|
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
@@ -195,8 +195,8 @@ const No = (e) => e?.name === "FastStoreError", Lo = (e) => e?.extensions?.type
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
198
|
-
},
|
|
199
|
-
const t = n.match(
|
|
198
|
+
}, dt = /^([^=]+)=([^;]*)/, ut = (e, n) => {
|
|
199
|
+
const t = n.match(dt);
|
|
200
200
|
if (t) {
|
|
201
201
|
const r = t[1], i = t[2];
|
|
202
202
|
e.storage.cookies.set(r, {
|
|
@@ -204,47 +204,47 @@ const No = (e) => e?.name === "FastStoreError", Lo = (e) => e?.extensions?.type
|
|
|
204
204
|
setCookie: n
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
},
|
|
207
|
+
}, pt = (e, n) => {
|
|
208
208
|
n.getSetCookie().forEach(
|
|
209
|
-
(t) =>
|
|
209
|
+
(t) => ut(e, t)
|
|
210
210
|
);
|
|
211
|
-
},
|
|
211
|
+
}, gt = (e) => (n) => pt(e, n), pe = (e) => {
|
|
212
212
|
if (!e.headers?.cookie)
|
|
213
213
|
return null;
|
|
214
|
-
const n =
|
|
214
|
+
const n = ln(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
215
215
|
return t.length === 0 ? n : t.reduce(
|
|
216
|
-
(r, [i, { value: o }]) =>
|
|
216
|
+
(r, [i, { value: o }]) => mt(
|
|
217
217
|
r,
|
|
218
218
|
i,
|
|
219
219
|
o
|
|
220
220
|
),
|
|
221
221
|
n
|
|
222
222
|
);
|
|
223
|
-
},
|
|
223
|
+
}, dn = (e) => function(t) {
|
|
224
224
|
const r = pe(e);
|
|
225
225
|
return r ? {
|
|
226
226
|
...t,
|
|
227
227
|
cookie: r
|
|
228
228
|
} : t;
|
|
229
229
|
}, z = (e, n) => {
|
|
230
|
-
const t =
|
|
231
|
-
return
|
|
232
|
-
},
|
|
230
|
+
const t = ln(e);
|
|
231
|
+
return Q(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
232
|
+
}, mt = (e, n, t) => {
|
|
233
233
|
const r = new RegExp(`(${n})=([^;]*)`), i = e.match(r);
|
|
234
234
|
return i ? e.replace(
|
|
235
235
|
i[0],
|
|
236
236
|
`${i[1]}=${t}`
|
|
237
237
|
) : `${e};${n}=${t}`;
|
|
238
238
|
};
|
|
239
|
-
function
|
|
239
|
+
function X(e) {
|
|
240
240
|
return e ? JSON.parse(Buffer.from(e.split(".")[1], "base64").toString()) : null;
|
|
241
241
|
}
|
|
242
|
-
const
|
|
242
|
+
const ht = "storefront/faststore.recommendation-shelf@v4", q = {
|
|
243
243
|
method: "POST",
|
|
244
244
|
headers: {
|
|
245
245
|
"content-type": "application/json"
|
|
246
246
|
}
|
|
247
|
-
},
|
|
247
|
+
}, ft = (e) => e.split("/").map(encodeURIComponent).join("/"), ue = (e) => e ? { headers: { "Accept-Language": e } } : void 0, St = /^\d{4}-\d{2}-\d{2}$/, yt = /* @__PURE__ */ new Set([
|
|
248
248
|
"Draft",
|
|
249
249
|
"Requested",
|
|
250
250
|
"InReview",
|
|
@@ -255,7 +255,7 @@ const dt = "storefront/faststore.recommendation-shelf@v4", j = {
|
|
|
255
255
|
"ConvertedToCart",
|
|
256
256
|
"ConvertedToOrder"
|
|
257
257
|
]);
|
|
258
|
-
function
|
|
258
|
+
function It({
|
|
259
259
|
page: e,
|
|
260
260
|
perPage: n,
|
|
261
261
|
status: t,
|
|
@@ -278,19 +278,19 @@ function mt({
|
|
|
278
278
|
["expiresAtFrom", o],
|
|
279
279
|
["expiresAtTo", a]
|
|
280
280
|
])
|
|
281
|
-
if (c && !
|
|
281
|
+
if (c && !St.test(c))
|
|
282
282
|
throw new Error(
|
|
283
283
|
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
284
284
|
);
|
|
285
285
|
if (t && t.length > 0) {
|
|
286
|
-
const s = t.filter((c) => !
|
|
286
|
+
const s = t.filter((c) => !yt.has(c));
|
|
287
287
|
if (s.length > 0)
|
|
288
288
|
throw new Error(
|
|
289
289
|
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
290
290
|
);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function vt({
|
|
294
294
|
page: e,
|
|
295
295
|
perPage: n,
|
|
296
296
|
status: t,
|
|
@@ -301,43 +301,43 @@ function ht({
|
|
|
301
301
|
label: s
|
|
302
302
|
}) {
|
|
303
303
|
const c = new URLSearchParams();
|
|
304
|
-
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((
|
|
304
|
+
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((d) => c.append("status", d)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i), o && c.append("expiresAtFrom", o), a && c.append("expiresAtTo", a), s?.trim() && c.append("label", s.trim()), c;
|
|
305
305
|
}
|
|
306
|
-
const
|
|
307
|
-
const o = `https://${e}.${n}.com.br`, a =
|
|
306
|
+
const Ot = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
307
|
+
const o = `https://${e}.${n}.com.br`, a = gt(i), s = dn(i), c = Kn(), d = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", u = r && r.map((l) => l + ".").find((l) => d.includes(l)) || "", p = d.replace(u, ""), f = `${o}/api/recommend-bff/v2`, h = s({
|
|
308
308
|
accept: "application/json",
|
|
309
309
|
"content-type": "application/json",
|
|
310
|
-
"x-vtex-rec-origin": `${e}/${
|
|
311
|
-
}), v = (
|
|
312
|
-
const
|
|
310
|
+
"x-vtex-rec-origin": `${e}/${ht}`
|
|
311
|
+
}), v = (l = {}) => {
|
|
312
|
+
const g = z(pe(i) ?? "", e);
|
|
313
313
|
return s({
|
|
314
|
-
...
|
|
315
|
-
"X-FORWARDED-HOST":
|
|
316
|
-
...
|
|
314
|
+
...l,
|
|
315
|
+
"X-FORWARDED-HOST": p,
|
|
316
|
+
...g ? { [`VtexIdclientAutCookie_${e}`]: g } : {}
|
|
317
317
|
});
|
|
318
318
|
};
|
|
319
319
|
return {
|
|
320
320
|
catalog: {
|
|
321
|
-
salesChannel: (
|
|
322
|
-
`${o}/api/catalog_system/pub/saleschannel/${
|
|
321
|
+
salesChannel: (l) => y(
|
|
322
|
+
`${o}/api/catalog_system/pub/saleschannel/${l}`,
|
|
323
323
|
void 0,
|
|
324
324
|
{ storeCookies: a }
|
|
325
325
|
),
|
|
326
326
|
brand: {
|
|
327
|
-
list: () =>
|
|
327
|
+
list: () => y(`${o}/api/catalog_system/pub/brand/list`, void 0, {
|
|
328
328
|
storeCookies: a
|
|
329
329
|
})
|
|
330
330
|
},
|
|
331
331
|
category: {
|
|
332
|
-
tree: (
|
|
333
|
-
`${o}/api/catalog_system/pub/category/tree/${
|
|
332
|
+
tree: (l = 3) => y(
|
|
333
|
+
`${o}/api/catalog_system/pub/category/tree/${l}`,
|
|
334
334
|
void 0,
|
|
335
335
|
{ storeCookies: a }
|
|
336
336
|
)
|
|
337
337
|
},
|
|
338
338
|
portal: {
|
|
339
|
-
pagetype: (
|
|
340
|
-
`${o}/api/catalog_system/pub/portal/pagetype/${
|
|
339
|
+
pagetype: (l) => y(
|
|
340
|
+
`${o}/api/catalog_system/pub/portal/pagetype/${l}`,
|
|
341
341
|
void 0,
|
|
342
342
|
{ storeCookies: a }
|
|
343
343
|
)
|
|
@@ -346,52 +346,52 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
346
346
|
// The by-linkid endpoints resolve a slug to a single catalog entity
|
|
347
347
|
// (or 404 when there is no match). We surface a 404 as `null` so the
|
|
348
348
|
// loader can cascade category → brand → collection.
|
|
349
|
-
category: async (
|
|
349
|
+
category: async (l, g) => {
|
|
350
350
|
try {
|
|
351
|
-
return await
|
|
352
|
-
`${o}/api/catalog_system/pub/category/by-linkid/${
|
|
353
|
-
ue(
|
|
351
|
+
return await y(
|
|
352
|
+
`${o}/api/catalog_system/pub/category/by-linkid/${ft(l)}`,
|
|
353
|
+
ue(g)
|
|
354
354
|
);
|
|
355
355
|
} catch (m) {
|
|
356
|
-
if (
|
|
356
|
+
if (H(m)) return null;
|
|
357
357
|
throw m;
|
|
358
358
|
}
|
|
359
359
|
},
|
|
360
|
-
brand: async (
|
|
360
|
+
brand: async (l, g) => {
|
|
361
361
|
try {
|
|
362
|
-
return await
|
|
363
|
-
`${o}/api/catalog_system/pub/brand/by-linkid/${encodeURIComponent(
|
|
364
|
-
ue(
|
|
362
|
+
return await y(
|
|
363
|
+
`${o}/api/catalog_system/pub/brand/by-linkid/${encodeURIComponent(l)}`,
|
|
364
|
+
ue(g)
|
|
365
365
|
);
|
|
366
366
|
} catch (m) {
|
|
367
|
-
if (
|
|
367
|
+
if (H(m)) return null;
|
|
368
368
|
throw m;
|
|
369
369
|
}
|
|
370
370
|
},
|
|
371
|
-
collection: async (
|
|
371
|
+
collection: async (l, g) => {
|
|
372
372
|
try {
|
|
373
|
-
return await
|
|
374
|
-
`${o}/api/catalog_system/pub/collection/by-linkid/${encodeURIComponent(
|
|
375
|
-
ue(
|
|
373
|
+
return await y(
|
|
374
|
+
`${o}/api/catalog_system/pub/collection/by-linkid/${encodeURIComponent(l)}`,
|
|
375
|
+
ue(g)
|
|
376
376
|
);
|
|
377
377
|
} catch (m) {
|
|
378
|
-
if (
|
|
378
|
+
if (H(m)) return null;
|
|
379
379
|
throw m;
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
},
|
|
383
383
|
products: {
|
|
384
384
|
crossselling: ({
|
|
385
|
-
type:
|
|
386
|
-
productId:
|
|
385
|
+
type: l,
|
|
386
|
+
productId: g,
|
|
387
387
|
groupByProduct: m = !0
|
|
388
388
|
}) => {
|
|
389
|
-
const
|
|
389
|
+
const S = new URLSearchParams({
|
|
390
390
|
sc: i.storage.channel.salesChannel,
|
|
391
391
|
groupByProduct: m.toString()
|
|
392
392
|
});
|
|
393
|
-
return
|
|
394
|
-
`${o}/api/catalog_system/pub/products/crossselling/${
|
|
393
|
+
return y(
|
|
394
|
+
`${o}/api/catalog_system/pub/products/crossselling/${l}/${g}?${S}`,
|
|
395
395
|
void 0,
|
|
396
396
|
{ storeCookies: a }
|
|
397
397
|
);
|
|
@@ -399,146 +399,147 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
399
399
|
}
|
|
400
400
|
},
|
|
401
401
|
checkout: {
|
|
402
|
-
simulation: (
|
|
402
|
+
simulation: (l, { salesChannel: g } = i.storage.channel) => {
|
|
403
403
|
const m = new URLSearchParams({
|
|
404
|
-
sc:
|
|
405
|
-
}),
|
|
404
|
+
sc: g
|
|
405
|
+
}), S = s({
|
|
406
406
|
"content-type": "application/json",
|
|
407
|
-
"X-FORWARDED-HOST":
|
|
407
|
+
"X-FORWARDED-HOST": p
|
|
408
408
|
});
|
|
409
|
-
return
|
|
409
|
+
return y(
|
|
410
410
|
`${o}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
411
411
|
{
|
|
412
|
-
...
|
|
413
|
-
headers:
|
|
414
|
-
body: JSON.stringify(
|
|
412
|
+
...q,
|
|
413
|
+
headers: S,
|
|
414
|
+
body: JSON.stringify(l)
|
|
415
415
|
},
|
|
416
416
|
{ storeCookies: a }
|
|
417
417
|
);
|
|
418
418
|
},
|
|
419
419
|
shippingData: ({
|
|
420
|
-
id:
|
|
421
|
-
index:
|
|
420
|
+
id: l,
|
|
421
|
+
index: g,
|
|
422
422
|
deliveryMode: m,
|
|
423
|
-
selectedAddresses:
|
|
423
|
+
selectedAddresses: S
|
|
424
424
|
}, O) => {
|
|
425
425
|
const w = O ? {
|
|
426
426
|
startDateUtc: m?.deliveryWindow?.startDate,
|
|
427
427
|
endDateUtc: m?.deliveryWindow?.endDate
|
|
428
|
-
} : null,
|
|
429
|
-
logisticsInfo: Array.from({ length:
|
|
428
|
+
} : null, b = {
|
|
429
|
+
logisticsInfo: Array.from({ length: g }, (I, D) => ({
|
|
430
430
|
itemIndex: D,
|
|
431
431
|
selectedDeliveryChannel: m?.deliveryChannel || null,
|
|
432
432
|
selectedSla: m?.deliveryMethod || null,
|
|
433
433
|
deliveryWindow: w
|
|
434
434
|
})),
|
|
435
|
-
selectedAddresses:
|
|
435
|
+
selectedAddresses: S,
|
|
436
436
|
clearAddressIfPostalCodeNotFound: t
|
|
437
|
-
},
|
|
437
|
+
}, U = s({
|
|
438
438
|
"content-type": "application/json",
|
|
439
|
-
"X-FORWARDED-HOST":
|
|
439
|
+
"X-FORWARDED-HOST": p
|
|
440
440
|
});
|
|
441
|
-
return
|
|
442
|
-
`${o}/api/checkout/pub/orderForm/${
|
|
441
|
+
return y(
|
|
442
|
+
`${o}/api/checkout/pub/orderForm/${l}/attachments/shippingData`,
|
|
443
443
|
{
|
|
444
|
-
...
|
|
445
|
-
headers:
|
|
446
|
-
body: JSON.stringify(
|
|
444
|
+
...q,
|
|
445
|
+
headers: U,
|
|
446
|
+
body: JSON.stringify(b)
|
|
447
447
|
},
|
|
448
448
|
{ storeCookies: a }
|
|
449
449
|
);
|
|
450
450
|
},
|
|
451
451
|
marketingData: ({
|
|
452
|
-
id:
|
|
453
|
-
marketingData:
|
|
452
|
+
id: l,
|
|
453
|
+
marketingData: g
|
|
454
454
|
}) => {
|
|
455
455
|
const m = s({
|
|
456
456
|
"content-type": "application/json",
|
|
457
|
-
"X-FORWARDED-HOST":
|
|
457
|
+
"X-FORWARDED-HOST": p
|
|
458
458
|
});
|
|
459
|
-
return
|
|
460
|
-
`${o}/api/checkout/pub/orderForm/${
|
|
459
|
+
return y(
|
|
460
|
+
`${o}/api/checkout/pub/orderForm/${l}/attachments/marketingData`,
|
|
461
461
|
{
|
|
462
462
|
headers: m,
|
|
463
|
-
body: JSON.stringify(
|
|
463
|
+
body: JSON.stringify(g),
|
|
464
464
|
method: "POST"
|
|
465
465
|
},
|
|
466
466
|
{ storeCookies: a }
|
|
467
467
|
);
|
|
468
468
|
},
|
|
469
469
|
clientPreferencesData: ({
|
|
470
|
-
id:
|
|
471
|
-
clientPreferencesData:
|
|
470
|
+
id: l,
|
|
471
|
+
clientPreferencesData: g
|
|
472
472
|
}) => {
|
|
473
473
|
const m = s({
|
|
474
474
|
"content-type": "application/json",
|
|
475
|
-
"X-FORWARDED-HOST":
|
|
475
|
+
"X-FORWARDED-HOST": p
|
|
476
476
|
});
|
|
477
|
-
return
|
|
478
|
-
`${o}/api/checkout/pub/orderForm/${
|
|
477
|
+
return y(
|
|
478
|
+
`${o}/api/checkout/pub/orderForm/${l}/attachments/clientPreferencesData`,
|
|
479
479
|
{
|
|
480
480
|
headers: m,
|
|
481
|
-
body: JSON.stringify(
|
|
481
|
+
body: JSON.stringify(g),
|
|
482
482
|
method: "POST"
|
|
483
483
|
},
|
|
484
484
|
{ storeCookies: a }
|
|
485
485
|
);
|
|
486
486
|
},
|
|
487
487
|
orderForm: ({
|
|
488
|
-
id:
|
|
489
|
-
refreshOutdatedData:
|
|
490
|
-
channel: m = i.storage.channel
|
|
488
|
+
id: l,
|
|
489
|
+
refreshOutdatedData: g = !0,
|
|
490
|
+
channel: m = i.storage.channel,
|
|
491
|
+
preserveSalesChannel: S = !1
|
|
491
492
|
}) => {
|
|
492
|
-
const { salesChannel:
|
|
493
|
+
const { salesChannel: O } = m, w = s({
|
|
493
494
|
"content-type": "application/json",
|
|
494
|
-
"X-FORWARDED-HOST":
|
|
495
|
-
}),
|
|
496
|
-
|
|
497
|
-
const
|
|
498
|
-
return
|
|
499
|
-
|
|
495
|
+
"X-FORWARDED-HOST": p
|
|
496
|
+
}), b = new URLSearchParams();
|
|
497
|
+
(!S || !l) && b.set("sc", O), l && b.set("refreshOutdatedData", g.toString());
|
|
498
|
+
const U = l ? `/${l}` : "", I = `${o}/api/checkout/pub/orderForm${U}?${b}`;
|
|
499
|
+
return y(
|
|
500
|
+
I,
|
|
500
501
|
{
|
|
501
|
-
...
|
|
502
|
-
headers:
|
|
503
|
-
...
|
|
502
|
+
...q,
|
|
503
|
+
headers: w,
|
|
504
|
+
...l ? {} : { body: "{}" }
|
|
504
505
|
},
|
|
505
506
|
{ storeCookies: a }
|
|
506
507
|
);
|
|
507
508
|
},
|
|
508
|
-
clearOrderFormMessages: ({ id:
|
|
509
|
-
const
|
|
509
|
+
clearOrderFormMessages: ({ id: l }) => {
|
|
510
|
+
const g = s({
|
|
510
511
|
"content-type": "application/json",
|
|
511
|
-
"X-FORWARDED-HOST":
|
|
512
|
+
"X-FORWARDED-HOST": p
|
|
512
513
|
});
|
|
513
|
-
return
|
|
514
|
-
`${o}/api/checkout/pub/orderForm/${
|
|
514
|
+
return y(
|
|
515
|
+
`${o}/api/checkout/pub/orderForm/${l}/messages/clear`,
|
|
515
516
|
{
|
|
516
|
-
...
|
|
517
|
-
headers:
|
|
517
|
+
...q,
|
|
518
|
+
headers: g,
|
|
518
519
|
body: "{}"
|
|
519
520
|
}
|
|
520
521
|
);
|
|
521
522
|
},
|
|
522
523
|
updateOrderFormItems: ({
|
|
523
|
-
id:
|
|
524
|
-
orderItems:
|
|
524
|
+
id: l,
|
|
525
|
+
orderItems: g,
|
|
525
526
|
allowOutdatedData: m = "paymentData",
|
|
526
|
-
salesChannel:
|
|
527
|
+
salesChannel: S = i.storage.channel.salesChannel,
|
|
527
528
|
shouldSplitItem: O = !0
|
|
528
529
|
}) => {
|
|
529
530
|
const w = new URLSearchParams({
|
|
530
531
|
allowOutdatedData: m,
|
|
531
|
-
sc:
|
|
532
|
-
}),
|
|
532
|
+
sc: S
|
|
533
|
+
}), b = s({
|
|
533
534
|
"content-type": "application/json",
|
|
534
|
-
"X-FORWARDED-HOST":
|
|
535
|
+
"X-FORWARDED-HOST": p
|
|
535
536
|
});
|
|
536
|
-
return
|
|
537
|
-
`${o}/api/checkout/pub/orderForm/${
|
|
537
|
+
return y(
|
|
538
|
+
`${o}/api/checkout/pub/orderForm/${l}/items?${w}`,
|
|
538
539
|
{
|
|
539
|
-
headers:
|
|
540
|
+
headers: b,
|
|
540
541
|
body: JSON.stringify({
|
|
541
|
-
orderItems:
|
|
542
|
+
orderItems: g,
|
|
542
543
|
noSplitItem: !O
|
|
543
544
|
}),
|
|
544
545
|
method: "PATCH"
|
|
@@ -547,60 +548,60 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
547
548
|
);
|
|
548
549
|
},
|
|
549
550
|
setCustomData: ({
|
|
550
|
-
id:
|
|
551
|
-
appId:
|
|
551
|
+
id: l,
|
|
552
|
+
appId: g,
|
|
552
553
|
key: m,
|
|
553
|
-
value:
|
|
554
|
+
value: S
|
|
554
555
|
}) => {
|
|
555
556
|
const O = s({
|
|
556
557
|
"content-type": "application/json",
|
|
557
|
-
"X-FORWARDED-HOST":
|
|
558
|
+
"X-FORWARDED-HOST": p
|
|
558
559
|
});
|
|
559
|
-
return
|
|
560
|
-
`${o}/api/checkout/pub/orderForm/${
|
|
560
|
+
return y(
|
|
561
|
+
`${o}/api/checkout/pub/orderForm/${l}/customData/${g}/${m}`,
|
|
561
562
|
{
|
|
562
563
|
headers: O,
|
|
563
|
-
body: JSON.stringify({ value:
|
|
564
|
+
body: JSON.stringify({ value: S }),
|
|
564
565
|
method: "PUT"
|
|
565
566
|
}
|
|
566
567
|
);
|
|
567
568
|
},
|
|
568
569
|
region: async ({
|
|
569
|
-
postalCode:
|
|
570
|
-
geoCoordinates:
|
|
570
|
+
postalCode: l,
|
|
571
|
+
geoCoordinates: g,
|
|
571
572
|
country: m,
|
|
572
|
-
salesChannel:
|
|
573
|
+
salesChannel: S
|
|
573
574
|
}) => {
|
|
574
575
|
const O = new URLSearchParams({
|
|
575
576
|
country: m,
|
|
576
|
-
sc:
|
|
577
|
+
sc: S ?? ""
|
|
577
578
|
});
|
|
578
|
-
|
|
579
|
+
l ? O.append("postalCode", l) : O.append(
|
|
579
580
|
"geoCoordinates",
|
|
580
|
-
`${
|
|
581
|
+
`${g?.longitude};${g?.latitude}`
|
|
581
582
|
);
|
|
582
|
-
const w = `${o}/api/checkout/pub/regions/?${O.toString()}`,
|
|
583
|
+
const w = `${o}/api/checkout/pub/regions/?${O.toString()}`, b = s({
|
|
583
584
|
"content-type": "application/json",
|
|
584
|
-
"X-FORWARDED-HOST":
|
|
585
|
+
"X-FORWARDED-HOST": p
|
|
585
586
|
});
|
|
586
|
-
return
|
|
587
|
+
return y(
|
|
587
588
|
w,
|
|
588
589
|
{
|
|
589
|
-
headers:
|
|
590
|
+
headers: b
|
|
590
591
|
},
|
|
591
592
|
{ storeCookies: a }
|
|
592
593
|
);
|
|
593
594
|
},
|
|
594
595
|
address: async ({
|
|
595
|
-
postalCode:
|
|
596
|
-
country:
|
|
596
|
+
postalCode: l,
|
|
597
|
+
country: g
|
|
597
598
|
}) => {
|
|
598
599
|
const m = s({
|
|
599
600
|
"content-type": "application/json",
|
|
600
|
-
"X-FORWARDED-HOST":
|
|
601
|
+
"X-FORWARDED-HOST": p
|
|
601
602
|
});
|
|
602
|
-
return
|
|
603
|
-
`${o}/api/checkout/pub/postal-code/${
|
|
603
|
+
return y(
|
|
604
|
+
`${o}/api/checkout/pub/postal-code/${g}/${l}`,
|
|
604
605
|
{
|
|
605
606
|
headers: m
|
|
606
607
|
},
|
|
@@ -608,21 +609,21 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
608
609
|
);
|
|
609
610
|
},
|
|
610
611
|
cancelOrder: ({
|
|
611
|
-
orderId:
|
|
612
|
-
customerEmail:
|
|
612
|
+
orderId: l,
|
|
613
|
+
customerEmail: g,
|
|
613
614
|
reason: m
|
|
614
615
|
}) => {
|
|
615
|
-
const
|
|
616
|
+
const S = s({
|
|
616
617
|
"content-type": "application/json",
|
|
617
|
-
"X-FORWARDED-HOST":
|
|
618
|
+
"X-FORWARDED-HOST": p
|
|
618
619
|
});
|
|
619
|
-
return
|
|
620
|
-
`${o}/api/checkout/pub/orders/${
|
|
620
|
+
return y(
|
|
621
|
+
`${o}/api/checkout/pub/orders/${l}/user-cancel-request`,
|
|
621
622
|
{
|
|
622
623
|
method: "POST",
|
|
623
|
-
headers:
|
|
624
|
+
headers: S,
|
|
624
625
|
body: JSON.stringify({
|
|
625
|
-
customerEmail:
|
|
626
|
+
customerEmail: g,
|
|
626
627
|
reason: m
|
|
627
628
|
})
|
|
628
629
|
},
|
|
@@ -630,122 +631,122 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
630
631
|
);
|
|
631
632
|
},
|
|
632
633
|
pickupPoints: ({
|
|
633
|
-
geoCoordinates:
|
|
634
|
+
geoCoordinates: l
|
|
634
635
|
}) => {
|
|
635
|
-
if (!
|
|
636
|
+
if (!l)
|
|
636
637
|
throw new Error(
|
|
637
638
|
"Missing required parameter for listing pickup points."
|
|
638
639
|
);
|
|
639
|
-
const
|
|
640
|
+
const g = s({
|
|
640
641
|
"content-type": "application/json",
|
|
641
|
-
"X-FORWARDED-HOST":
|
|
642
|
+
"X-FORWARDED-HOST": p
|
|
642
643
|
});
|
|
643
|
-
return
|
|
644
|
+
return y(
|
|
644
645
|
`${o}/api/logistics-shipping/pickuppoints/_search`,
|
|
645
646
|
{
|
|
646
647
|
method: "POST",
|
|
647
|
-
headers:
|
|
648
|
-
body: JSON.stringify({ coordinate:
|
|
648
|
+
headers: g,
|
|
649
|
+
body: JSON.stringify({ coordinate: l })
|
|
649
650
|
},
|
|
650
651
|
{ storeCookies: a }
|
|
651
652
|
);
|
|
652
653
|
}
|
|
653
654
|
},
|
|
654
|
-
session: (
|
|
655
|
-
const
|
|
656
|
-
|
|
655
|
+
session: (l) => {
|
|
656
|
+
const g = new URLSearchParams(l);
|
|
657
|
+
g.set(
|
|
657
658
|
"items",
|
|
658
659
|
"profile.id,profile.email,profile.firstName,profile.lastName,profile.phone,shopper.firstName,shopper.lastName,shopper.organizationManager,shopper.availableContracts,shopper.activeContractId,store.channel,store.countryCode,store.cultureInfo,store.currencyCode,store.currencySymbol,authentication.customerId,authentication.storeUserId,authentication.storeUserEmail,authentication.unitId,authentication.unitName,checkout.regionId,public.postalCode"
|
|
659
660
|
);
|
|
660
661
|
const m = s({
|
|
661
662
|
"content-type": "application/json"
|
|
662
|
-
}),
|
|
663
|
-
return
|
|
664
|
-
`${o}/api/sessions?${
|
|
663
|
+
}), S = Q(i?.headers?.cookie ?? "")?.vtex_session;
|
|
664
|
+
return y(
|
|
665
|
+
`${o}/api/sessions?${g.toString()}`,
|
|
665
666
|
{
|
|
666
|
-
method:
|
|
667
|
+
method: S ? "PATCH" : "POST",
|
|
667
668
|
headers: m,
|
|
668
669
|
body: "{}"
|
|
669
670
|
},
|
|
670
671
|
{ storeCookies: a }
|
|
671
672
|
);
|
|
672
673
|
},
|
|
673
|
-
subscribeToNewsletter: (
|
|
674
|
+
subscribeToNewsletter: (l) => y(
|
|
674
675
|
`${o}/api/dataentities/NL/documents/`,
|
|
675
676
|
{
|
|
676
|
-
...
|
|
677
|
-
body: JSON.stringify({ ...
|
|
677
|
+
...q,
|
|
678
|
+
body: JSON.stringify({ ...l, isNewsletterOptIn: !0 }),
|
|
678
679
|
method: "PATCH"
|
|
679
680
|
},
|
|
680
681
|
{ storeCookies: a }
|
|
681
682
|
),
|
|
682
683
|
profile: {
|
|
683
|
-
addresses: async (
|
|
684
|
-
const
|
|
684
|
+
addresses: async (l) => {
|
|
685
|
+
const g = s({
|
|
685
686
|
"content-type": "application/json",
|
|
686
|
-
"X-FORWARDED-HOST":
|
|
687
|
+
"X-FORWARDED-HOST": p
|
|
687
688
|
});
|
|
688
|
-
return
|
|
689
|
-
`${o}/api/profile-system/pvt/profiles/${
|
|
690
|
-
{ headers:
|
|
689
|
+
return y(
|
|
690
|
+
`${o}/api/profile-system/pvt/profiles/${l}/addresses`,
|
|
691
|
+
{ headers: g },
|
|
691
692
|
{ storeCookies: a }
|
|
692
693
|
);
|
|
693
694
|
}
|
|
694
695
|
},
|
|
695
696
|
oms: {
|
|
696
|
-
userOrder: ({ orderId:
|
|
697
|
-
const
|
|
697
|
+
userOrder: ({ orderId: l }) => {
|
|
698
|
+
const g = s({
|
|
698
699
|
"content-type": "application/json",
|
|
699
|
-
"X-FORWARDED-HOST":
|
|
700
|
+
"X-FORWARDED-HOST": p
|
|
700
701
|
});
|
|
701
|
-
return
|
|
702
|
-
`${o}/api/oms/user/orders/${
|
|
702
|
+
return y(
|
|
703
|
+
`${o}/api/oms/user/orders/${l}`,
|
|
703
704
|
{
|
|
704
705
|
method: "GET",
|
|
705
|
-
headers:
|
|
706
|
+
headers: g
|
|
706
707
|
},
|
|
707
708
|
{ storeCookies: a }
|
|
708
709
|
);
|
|
709
710
|
},
|
|
710
711
|
listUserOrders: ({
|
|
711
|
-
page:
|
|
712
|
-
status:
|
|
712
|
+
page: l,
|
|
713
|
+
status: g,
|
|
713
714
|
dateInitial: m,
|
|
714
|
-
dateFinal:
|
|
715
|
+
dateFinal: S,
|
|
715
716
|
text: O,
|
|
716
717
|
clientEmail: w,
|
|
717
|
-
perPage:
|
|
718
|
-
pendingMyApproval:
|
|
718
|
+
perPage: b,
|
|
719
|
+
pendingMyApproval: U
|
|
719
720
|
}) => {
|
|
720
|
-
const
|
|
721
|
+
const I = new URLSearchParams();
|
|
721
722
|
if (m) {
|
|
722
|
-
const
|
|
723
|
+
const P = new Date(m).setHours(
|
|
723
724
|
0,
|
|
724
725
|
0,
|
|
725
726
|
0,
|
|
726
727
|
0
|
|
727
728
|
);
|
|
728
|
-
m = new Date(
|
|
729
|
+
m = new Date(P).toISOString();
|
|
729
730
|
}
|
|
730
|
-
if (
|
|
731
|
-
const
|
|
731
|
+
if (S) {
|
|
732
|
+
const P = new Date(S).setHours(
|
|
732
733
|
23,
|
|
733
734
|
59,
|
|
734
735
|
59,
|
|
735
736
|
999
|
|
736
737
|
);
|
|
737
|
-
|
|
738
|
+
S = new Date(P).toISOString();
|
|
738
739
|
}
|
|
739
|
-
O &&
|
|
740
|
+
O && I.append("text", O), g && g.length > 0 && I.append("status", g.filter(Boolean).join(",")), m && S ? I.append(
|
|
740
741
|
"creation_date",
|
|
741
|
-
`creationDate:[${m} TO ${
|
|
742
|
-
) : m ?
|
|
742
|
+
`creationDate:[${m} TO ${S}]`
|
|
743
|
+
) : m ? I.append("creation_date", `creationDate:[${m} TO *]`) : S && I.append("creation_date", `creationDate:[* TO ${S}]`), w && I.append("clientEmail", w), l && I.append("page", l.toString()), b && I.append("per_page", b.toString()), U && I.append("my_pending_approvals", String(!0));
|
|
743
744
|
const D = s({
|
|
744
745
|
"content-type": "application/json",
|
|
745
|
-
"X-FORWARDED-HOST":
|
|
746
|
+
"X-FORWARDED-HOST": p
|
|
746
747
|
});
|
|
747
|
-
return
|
|
748
|
-
`${o}/api/oms/user/orders?${
|
|
748
|
+
return y(
|
|
749
|
+
`${o}/api/oms/user/orders?${I.toString()}`,
|
|
749
750
|
{
|
|
750
751
|
method: "GET",
|
|
751
752
|
headers: D
|
|
@@ -754,43 +755,43 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
754
755
|
);
|
|
755
756
|
},
|
|
756
757
|
getCommercialAuthorizationsByOrderId: ({
|
|
757
|
-
orderId:
|
|
758
|
+
orderId: l
|
|
758
759
|
}) => {
|
|
759
|
-
const
|
|
760
|
+
const g = s({
|
|
760
761
|
"content-type": "application/json",
|
|
761
|
-
"X-FORWARDED-HOST":
|
|
762
|
+
"X-FORWARDED-HOST": p
|
|
762
763
|
});
|
|
763
|
-
return
|
|
764
|
-
`${o}/${e}/commercial-authorizations/order/${
|
|
764
|
+
return y(
|
|
765
|
+
`${o}/${e}/commercial-authorizations/order/${l}`,
|
|
765
766
|
{
|
|
766
767
|
method: "GET",
|
|
767
|
-
headers:
|
|
768
|
+
headers: g
|
|
768
769
|
},
|
|
769
770
|
{ storeCookies: a }
|
|
770
771
|
);
|
|
771
772
|
},
|
|
772
773
|
processOrderAuthorization: async ({
|
|
773
|
-
orderAuthorizationId:
|
|
774
|
-
dimensionId:
|
|
774
|
+
orderAuthorizationId: l,
|
|
775
|
+
dimensionId: g,
|
|
775
776
|
ruleId: m,
|
|
776
|
-
approved:
|
|
777
|
+
approved: S
|
|
777
778
|
}) => {
|
|
778
779
|
const O = s({
|
|
779
780
|
"content-type": "application/json",
|
|
780
|
-
"X-FORWARDED-HOST":
|
|
781
|
-
}),
|
|
781
|
+
"X-FORWARDED-HOST": p
|
|
782
|
+
}), U = {
|
|
782
783
|
params: {
|
|
783
784
|
ruleId: m,
|
|
784
|
-
dimensionId:
|
|
785
|
-
score:
|
|
785
|
+
dimensionId: g,
|
|
786
|
+
score: S ? 100 : 0
|
|
786
787
|
}
|
|
787
788
|
};
|
|
788
|
-
return
|
|
789
|
-
`${o}/${e}/commercial-authorizations/${
|
|
789
|
+
return y(
|
|
790
|
+
`${o}/${e}/commercial-authorizations/${l}/callback`,
|
|
790
791
|
{
|
|
791
792
|
method: "POST",
|
|
792
793
|
headers: O,
|
|
793
|
-
body: JSON.stringify(
|
|
794
|
+
body: JSON.stringify(U)
|
|
794
795
|
},
|
|
795
796
|
{ storeCookies: a }
|
|
796
797
|
);
|
|
@@ -798,49 +799,49 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
798
799
|
},
|
|
799
800
|
units: {
|
|
800
801
|
getUnitByUserId: ({
|
|
801
|
-
userId:
|
|
802
|
+
userId: l
|
|
802
803
|
}) => {
|
|
803
|
-
const
|
|
804
|
+
const g = s({
|
|
804
805
|
"content-type": "application/json",
|
|
805
|
-
"X-FORWARDED-HOST":
|
|
806
|
+
"X-FORWARDED-HOST": p
|
|
806
807
|
});
|
|
807
|
-
return
|
|
808
|
-
`${o}/api/units/v1/${
|
|
808
|
+
return y(
|
|
809
|
+
`${o}/api/units/v1/${l}/unit`,
|
|
809
810
|
{
|
|
810
811
|
method: "GET",
|
|
811
|
-
headers:
|
|
812
|
+
headers: g
|
|
812
813
|
},
|
|
813
814
|
{}
|
|
814
815
|
);
|
|
815
816
|
},
|
|
816
817
|
getOrgUnitById: ({
|
|
817
|
-
orgUnitId:
|
|
818
|
+
orgUnitId: l
|
|
818
819
|
}) => {
|
|
819
|
-
const
|
|
820
|
+
const g = s({
|
|
820
821
|
"content-type": "application/json",
|
|
821
|
-
"X-FORWARDED-HOST":
|
|
822
|
+
"X-FORWARDED-HOST": p
|
|
822
823
|
});
|
|
823
|
-
return
|
|
824
|
-
`${o}/api/units/v1/${
|
|
824
|
+
return y(
|
|
825
|
+
`${o}/api/units/v1/${l}`,
|
|
825
826
|
{
|
|
826
827
|
method: "GET",
|
|
827
|
-
headers:
|
|
828
|
+
headers: g
|
|
828
829
|
},
|
|
829
830
|
{}
|
|
830
831
|
);
|
|
831
832
|
},
|
|
832
833
|
getScopesByOrgUnit: ({
|
|
833
|
-
orgUnitId:
|
|
834
|
+
orgUnitId: l
|
|
834
835
|
}) => {
|
|
835
|
-
const
|
|
836
|
+
const g = s({
|
|
836
837
|
"content-type": "application/json",
|
|
837
|
-
"X-FORWARDED-HOST":
|
|
838
|
+
"X-FORWARDED-HOST": p
|
|
838
839
|
});
|
|
839
|
-
return
|
|
840
|
-
`${o}/api/units/v1/${
|
|
840
|
+
return y(
|
|
841
|
+
`${o}/api/units/v1/${l}/scopes`,
|
|
841
842
|
{
|
|
842
843
|
method: "GET",
|
|
843
|
-
headers:
|
|
844
|
+
headers: g
|
|
844
845
|
},
|
|
845
846
|
{}
|
|
846
847
|
);
|
|
@@ -848,49 +849,49 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
848
849
|
},
|
|
849
850
|
licenseManager: {
|
|
850
851
|
getUserById: ({
|
|
851
|
-
userId:
|
|
852
|
+
userId: l
|
|
852
853
|
}) => {
|
|
853
|
-
const
|
|
854
|
+
const g = s({
|
|
854
855
|
"content-type": "application/json",
|
|
855
|
-
"X-FORWARDED-HOST":
|
|
856
|
+
"X-FORWARDED-HOST": p
|
|
856
857
|
});
|
|
857
|
-
return
|
|
858
|
-
`${o}/api/license-manager/users/${
|
|
858
|
+
return y(
|
|
859
|
+
`${o}/api/license-manager/users/${l}`,
|
|
859
860
|
{
|
|
860
861
|
method: "GET",
|
|
861
|
-
headers:
|
|
862
|
+
headers: g
|
|
862
863
|
},
|
|
863
864
|
{}
|
|
864
865
|
);
|
|
865
866
|
},
|
|
866
867
|
getUserByEmail: ({
|
|
867
|
-
email:
|
|
868
|
+
email: l
|
|
868
869
|
}) => {
|
|
869
|
-
const
|
|
870
|
+
const g = s({
|
|
870
871
|
"content-type": "application/json",
|
|
871
|
-
"X-FORWARDED-HOST":
|
|
872
|
+
"X-FORWARDED-HOST": p
|
|
872
873
|
});
|
|
873
|
-
return
|
|
874
|
-
`${o}/api/license-manager/pvt/users/${
|
|
874
|
+
return y(
|
|
875
|
+
`${o}/api/license-manager/pvt/users/${l}`,
|
|
875
876
|
{
|
|
876
877
|
method: "GET",
|
|
877
|
-
headers:
|
|
878
|
+
headers: g
|
|
878
879
|
},
|
|
879
880
|
{}
|
|
880
881
|
);
|
|
881
882
|
},
|
|
882
883
|
getUserRoles: ({
|
|
883
|
-
userId:
|
|
884
|
+
userId: l
|
|
884
885
|
}) => {
|
|
885
|
-
const
|
|
886
|
+
const g = s({
|
|
886
887
|
"content-type": "application/json",
|
|
887
|
-
"X-FORWARDED-HOST":
|
|
888
|
+
"X-FORWARDED-HOST": p
|
|
888
889
|
});
|
|
889
|
-
return
|
|
890
|
-
`${o}/api/license-manager/storefront/users/${
|
|
890
|
+
return y(
|
|
891
|
+
`${o}/api/license-manager/storefront/users/${l}/roles`,
|
|
891
892
|
{
|
|
892
893
|
method: "GET",
|
|
893
|
-
headers:
|
|
894
|
+
headers: g
|
|
894
895
|
},
|
|
895
896
|
{}
|
|
896
897
|
);
|
|
@@ -898,52 +899,52 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
898
899
|
},
|
|
899
900
|
masterData: {
|
|
900
901
|
getContractById: ({
|
|
901
|
-
contractId:
|
|
902
|
+
contractId: l
|
|
902
903
|
}) => {
|
|
903
|
-
if (!
|
|
904
|
-
throw new
|
|
905
|
-
const
|
|
904
|
+
if (!l)
|
|
905
|
+
throw new T("Missing contractId to fetch CL fields.");
|
|
906
|
+
const g = v({
|
|
906
907
|
Accept: "application/json",
|
|
907
908
|
"content-type": "application/json"
|
|
908
909
|
});
|
|
909
|
-
return
|
|
910
|
-
`${o}/api/dataentities/CL/documents/${
|
|
910
|
+
return y(
|
|
911
|
+
`${o}/api/dataentities/CL/documents/${l}?_fields=_all`,
|
|
911
912
|
{
|
|
912
913
|
method: "GET",
|
|
913
|
-
headers:
|
|
914
|
+
headers: g
|
|
914
915
|
},
|
|
915
916
|
{}
|
|
916
917
|
);
|
|
917
918
|
},
|
|
918
919
|
getShopperById: ({
|
|
919
|
-
userId:
|
|
920
|
+
userId: l
|
|
920
921
|
}) => {
|
|
921
|
-
if (!
|
|
922
|
-
throw new
|
|
923
|
-
const
|
|
922
|
+
if (!l)
|
|
923
|
+
throw new T("Missing userId to fetch shopper name.");
|
|
924
|
+
const g = c({
|
|
924
925
|
Accept: "application/json",
|
|
925
926
|
"content-type": "application/json",
|
|
926
|
-
"X-FORWARDED-HOST":
|
|
927
|
-
}), m =
|
|
928
|
-
return
|
|
929
|
-
`${o}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${
|
|
927
|
+
"X-FORWARDED-HOST": p
|
|
928
|
+
}), m = l.replace(/-/g, "");
|
|
929
|
+
return y(
|
|
930
|
+
`${o}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${l})&_fields=_all&_schema=v1`,
|
|
930
931
|
{
|
|
931
932
|
method: "GET",
|
|
932
|
-
headers:
|
|
933
|
+
headers: g
|
|
933
934
|
},
|
|
934
935
|
{}
|
|
935
936
|
);
|
|
936
937
|
}
|
|
937
938
|
},
|
|
938
939
|
quotes: {
|
|
939
|
-
listUserQuotes: (
|
|
940
|
-
|
|
941
|
-
const
|
|
940
|
+
listUserQuotes: (l) => {
|
|
941
|
+
It(l);
|
|
942
|
+
const g = vt(l), m = s({
|
|
942
943
|
"content-type": "application/json",
|
|
943
|
-
"X-FORWARDED-HOST":
|
|
944
|
+
"X-FORWARDED-HOST": p
|
|
944
945
|
});
|
|
945
|
-
return
|
|
946
|
-
`${o}/api/quoting/quotes?${
|
|
946
|
+
return y(
|
|
947
|
+
`${o}/api/quoting/quotes?${g.toString()}`,
|
|
947
948
|
{
|
|
948
949
|
method: "GET",
|
|
949
950
|
headers: m
|
|
@@ -954,15 +955,15 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
954
955
|
},
|
|
955
956
|
vtexid: {
|
|
956
957
|
validate: () => {
|
|
957
|
-
const
|
|
958
|
+
const l = s({
|
|
958
959
|
"content-type": "application/json",
|
|
959
|
-
"X-FORWARDED-HOST":
|
|
960
|
-
}),
|
|
961
|
-
return
|
|
960
|
+
"X-FORWARDED-HOST": p
|
|
961
|
+
}), g = z(pe(i) ?? "", e);
|
|
962
|
+
return y(
|
|
962
963
|
`${o}/api/vtexid/credential/validate`,
|
|
963
964
|
{
|
|
964
|
-
headers:
|
|
965
|
-
body: JSON.stringify({ token:
|
|
965
|
+
headers: l,
|
|
966
|
+
body: JSON.stringify({ token: g }),
|
|
966
967
|
method: "POST"
|
|
967
968
|
},
|
|
968
969
|
{ storeCookies: a }
|
|
@@ -971,104 +972,104 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
971
972
|
},
|
|
972
973
|
orderEntry: {
|
|
973
974
|
uploadFile: ({
|
|
974
|
-
fileBuffer:
|
|
975
|
-
fileName:
|
|
975
|
+
fileBuffer: l,
|
|
976
|
+
fileName: g,
|
|
976
977
|
mimeType: m
|
|
977
978
|
}) => {
|
|
978
|
-
const
|
|
979
|
+
const S = s({
|
|
979
980
|
"content-type": "application/json",
|
|
980
|
-
"X-FORWARDED-HOST":
|
|
981
|
+
"X-FORWARDED-HOST": p
|
|
981
982
|
}), O = `----FastStoreUploadBoundary${Date.now()}`, w = `\r
|
|
982
|
-
`,
|
|
983
|
+
`, U = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", I = g.replaceAll(/[\r\n"]/g, "_"), D = [
|
|
983
984
|
`--${O}`,
|
|
984
|
-
`Content-Disposition: form-data; name="file"; filename="${
|
|
985
|
-
`Content-Type: ${
|
|
985
|
+
`Content-Disposition: form-data; name="file"; filename="${I}"`,
|
|
986
|
+
`Content-Type: ${U}`,
|
|
986
987
|
"",
|
|
987
988
|
""
|
|
988
|
-
].join(w),
|
|
989
|
-
k.byteLength +
|
|
989
|
+
].join(w), P = `${w}--${O}--${w}`, k = Buffer.from(D), A = Buffer.from(P), R = new Uint8Array(
|
|
990
|
+
k.byteLength + l.byteLength + A.byteLength
|
|
990
991
|
);
|
|
991
|
-
let
|
|
992
|
-
return
|
|
992
|
+
let C = 0;
|
|
993
|
+
return R.set(k, C), C += k.byteLength, R.set(l, C), C += l.byteLength, R.set(A, C), y(
|
|
993
994
|
`${o}/api/order-entry/upload?an=${e}`,
|
|
994
995
|
{
|
|
995
996
|
method: "POST",
|
|
996
997
|
headers: {
|
|
997
|
-
...
|
|
998
|
+
...S,
|
|
998
999
|
"content-type": `multipart/form-data; boundary=${O}`
|
|
999
1000
|
},
|
|
1000
|
-
body:
|
|
1001
|
+
body: R.buffer
|
|
1001
1002
|
},
|
|
1002
1003
|
{}
|
|
1003
1004
|
);
|
|
1004
1005
|
},
|
|
1005
1006
|
startOperation: ({
|
|
1006
|
-
objectKey:
|
|
1007
|
-
orderFormId:
|
|
1007
|
+
objectKey: l,
|
|
1008
|
+
orderFormId: g,
|
|
1008
1009
|
sessionToken: m
|
|
1009
1010
|
}) => {
|
|
1010
|
-
const
|
|
1011
|
+
const S = s({
|
|
1011
1012
|
"content-type": "application/json",
|
|
1012
|
-
"X-FORWARDED-HOST":
|
|
1013
|
+
"X-FORWARDED-HOST": p
|
|
1013
1014
|
}), O = JSON.stringify({
|
|
1014
|
-
objectKey:
|
|
1015
|
-
orderFormId:
|
|
1015
|
+
objectKey: l,
|
|
1016
|
+
orderFormId: g,
|
|
1016
1017
|
operation: "CreateCart",
|
|
1017
1018
|
...m ? { sessionToken: m } : {}
|
|
1018
1019
|
});
|
|
1019
|
-
return
|
|
1020
|
+
return y(
|
|
1020
1021
|
`${o}/api/order-entry/operation?an=${e}`,
|
|
1021
1022
|
{
|
|
1022
1023
|
method: "POST",
|
|
1023
|
-
headers:
|
|
1024
|
+
headers: S,
|
|
1024
1025
|
body: O
|
|
1025
1026
|
},
|
|
1026
1027
|
{}
|
|
1027
1028
|
);
|
|
1028
1029
|
},
|
|
1029
1030
|
getOperation: ({
|
|
1030
|
-
operationId:
|
|
1031
|
+
operationId: l
|
|
1031
1032
|
}) => {
|
|
1032
|
-
const
|
|
1033
|
+
const g = s({
|
|
1033
1034
|
"content-type": "application/json",
|
|
1034
|
-
"X-FORWARDED-HOST":
|
|
1035
|
+
"X-FORWARDED-HOST": p
|
|
1035
1036
|
});
|
|
1036
|
-
return
|
|
1037
|
-
`${o}/api/order-entry/operation/${
|
|
1037
|
+
return y(
|
|
1038
|
+
`${o}/api/order-entry/operation/${l}?an=${e}`,
|
|
1038
1039
|
{
|
|
1039
1040
|
method: "GET",
|
|
1040
|
-
headers:
|
|
1041
|
+
headers: g
|
|
1041
1042
|
},
|
|
1042
1043
|
{}
|
|
1043
1044
|
);
|
|
1044
1045
|
},
|
|
1045
1046
|
createOrderForm: () => {
|
|
1046
|
-
const
|
|
1047
|
+
const l = s({
|
|
1047
1048
|
"content-type": "application/json",
|
|
1048
|
-
"X-FORWARDED-HOST":
|
|
1049
|
+
"X-FORWARDED-HOST": p
|
|
1049
1050
|
});
|
|
1050
|
-
return
|
|
1051
|
+
return y(
|
|
1051
1052
|
`${o}/api/checkout/pub/orderForm?sc=${i.storage.channel.salesChannel}`,
|
|
1052
1053
|
{
|
|
1053
1054
|
method: "POST",
|
|
1054
|
-
headers:
|
|
1055
|
+
headers: l,
|
|
1055
1056
|
body: "{}"
|
|
1056
1057
|
},
|
|
1057
1058
|
{}
|
|
1058
1059
|
);
|
|
1059
1060
|
},
|
|
1060
1061
|
getOrderFormItems: ({
|
|
1061
|
-
orderFormId:
|
|
1062
|
+
orderFormId: l
|
|
1062
1063
|
}) => {
|
|
1063
|
-
const
|
|
1064
|
+
const g = s({
|
|
1064
1065
|
"content-type": "application/json",
|
|
1065
|
-
"X-FORWARDED-HOST":
|
|
1066
|
+
"X-FORWARDED-HOST": p
|
|
1066
1067
|
});
|
|
1067
|
-
return
|
|
1068
|
-
`${o}/api/checkout/pub/orderForm/${
|
|
1068
|
+
return y(
|
|
1069
|
+
`${o}/api/checkout/pub/orderForm/${l}`,
|
|
1069
1070
|
{
|
|
1070
1071
|
method: "GET",
|
|
1071
|
-
headers:
|
|
1072
|
+
headers: g
|
|
1072
1073
|
},
|
|
1073
1074
|
{}
|
|
1074
1075
|
);
|
|
@@ -1080,50 +1081,50 @@ const ft = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1080
1081
|
// already hydrated in the Intelligent Search shape.
|
|
1081
1082
|
recommendation: {
|
|
1082
1083
|
recommendations: ({
|
|
1083
|
-
campaignVrn:
|
|
1084
|
-
userId:
|
|
1084
|
+
campaignVrn: l,
|
|
1085
|
+
userId: g,
|
|
1085
1086
|
products: m = [],
|
|
1086
|
-
salesChannel:
|
|
1087
|
+
salesChannel: S,
|
|
1087
1088
|
locale: O
|
|
1088
1089
|
}) => {
|
|
1089
|
-
const w = new URLSearchParams({ an: e, campaignVrn:
|
|
1090
|
-
return
|
|
1091
|
-
`${
|
|
1092
|
-
{ headers:
|
|
1090
|
+
const w = new URLSearchParams({ an: e, campaignVrn: l });
|
|
1091
|
+
return g && w.append("userId", g), m.length > 0 && w.append("products", m.join(",")), S && w.append("salesChannel", S), O && w.append("locale", O), y(
|
|
1092
|
+
`${f}/recommendations?${w.toString()}`,
|
|
1093
|
+
{ headers: h },
|
|
1093
1094
|
{ storeCookies: a }
|
|
1094
1095
|
);
|
|
1095
1096
|
},
|
|
1096
1097
|
startRecommendationSession: () => {
|
|
1097
|
-
const
|
|
1098
|
-
return
|
|
1099
|
-
`${
|
|
1100
|
-
{ method: "POST", headers:
|
|
1098
|
+
const l = new URLSearchParams({ an: e });
|
|
1099
|
+
return y(
|
|
1100
|
+
`${f}/users/start-session?${l.toString()}`,
|
|
1101
|
+
{ method: "POST", headers: h },
|
|
1101
1102
|
{ storeCookies: a }
|
|
1102
1103
|
);
|
|
1103
1104
|
}
|
|
1104
1105
|
}
|
|
1105
1106
|
};
|
|
1106
|
-
},
|
|
1107
|
-
|
|
1108
|
-
|
|
1107
|
+
}, J = (e) => e.discoveryConfig?.localization ?? {}, K = (e) => J(e).enabled === !0, Ct = (e) => Object.keys(J(e).locales ?? {}), bt = (e) => J(e).defaultLocale, ie = (e) => K(e) && e.storage.locale || void 0, ge = "fuzzy", me = "operator", he = "pickupPoint", _e = "shipping", Ee = "delivery-options", wt = "in-stock", Dt = "trade-policy", Pt = "region-id", At = /* @__PURE__ */ new Set([
|
|
1108
|
+
Dt,
|
|
1109
|
+
Pt,
|
|
1109
1110
|
ge,
|
|
1110
1111
|
me,
|
|
1111
1112
|
he
|
|
1112
|
-
]),
|
|
1113
|
+
]), kt = /* @__PURE__ */ new Set([
|
|
1113
1114
|
"zip-code",
|
|
1114
1115
|
"pickupPoint",
|
|
1115
1116
|
"country",
|
|
1116
1117
|
"coordinates",
|
|
1117
1118
|
"deliveryZonesHash",
|
|
1118
1119
|
"pickupPointsHash"
|
|
1119
|
-
]),
|
|
1120
|
+
]), Re = (e) => encodeURI(decodeURI(e)), Ut = (e) => encodeURIComponent(
|
|
1120
1121
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
1121
|
-
),
|
|
1122
|
-
function
|
|
1122
|
+
), Tt = /^pickup-in-point-(.+)$/;
|
|
1123
|
+
function un(e) {
|
|
1123
1124
|
if (!e)
|
|
1124
1125
|
return {};
|
|
1125
1126
|
try {
|
|
1126
|
-
const t =
|
|
1127
|
+
const t = Q(e).vtex_segment;
|
|
1127
1128
|
if (!t)
|
|
1128
1129
|
return {};
|
|
1129
1130
|
const r = Buffer.from(t, "base64").toString("utf-8");
|
|
@@ -1132,18 +1133,18 @@ function cn(e) {
|
|
|
1132
1133
|
return {};
|
|
1133
1134
|
}
|
|
1134
1135
|
}
|
|
1135
|
-
function
|
|
1136
|
+
function _t(e) {
|
|
1136
1137
|
const n = {}, t = [];
|
|
1137
1138
|
for (const r of e.split(";")) {
|
|
1138
1139
|
const i = r.indexOf("=");
|
|
1139
1140
|
if (i < 0) continue;
|
|
1140
1141
|
const o = r.slice(0, i), a = r.slice(i + 1);
|
|
1141
|
-
!o || !a || (
|
|
1142
|
+
!o || !a || (kt.has(o) ? n[o] = a : t.push({ key: o, value: a }));
|
|
1142
1143
|
}
|
|
1143
1144
|
return { shipping: n, extraFacets: t };
|
|
1144
1145
|
}
|
|
1145
|
-
function
|
|
1146
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } =
|
|
1146
|
+
function Et(e) {
|
|
1147
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } = _t(n);
|
|
1147
1148
|
return {
|
|
1148
1149
|
segmentParams: {
|
|
1149
1150
|
sc: e.channel,
|
|
@@ -1164,7 +1165,7 @@ function Pt(e) {
|
|
|
1164
1165
|
extraFacets: r
|
|
1165
1166
|
};
|
|
1166
1167
|
}
|
|
1167
|
-
function
|
|
1168
|
+
function pn(e, n) {
|
|
1168
1169
|
const t = [
|
|
1169
1170
|
["sc", n.sc],
|
|
1170
1171
|
["regionId", n.regionId],
|
|
@@ -1184,11 +1185,11 @@ function ln(e, n) {
|
|
|
1184
1185
|
for (const [r, i] of t)
|
|
1185
1186
|
i != null && i !== "" && e.append(r, String(i));
|
|
1186
1187
|
}
|
|
1187
|
-
function
|
|
1188
|
-
return
|
|
1188
|
+
function gn(e) {
|
|
1189
|
+
return Tt.exec(e)?.[1];
|
|
1189
1190
|
}
|
|
1190
|
-
function
|
|
1191
|
-
const n = e.find((r) => r.key === "shipping"), t = n ?
|
|
1191
|
+
function Rt(e) {
|
|
1192
|
+
const n = e.find((r) => r.key === "shipping"), t = n ? gn(n.value) : void 0;
|
|
1192
1193
|
if (t !== void 0)
|
|
1193
1194
|
try {
|
|
1194
1195
|
return decodeURIComponent(t);
|
|
@@ -1196,8 +1197,8 @@ function kt(e) {
|
|
|
1196
1197
|
return t;
|
|
1197
1198
|
}
|
|
1198
1199
|
}
|
|
1199
|
-
function
|
|
1200
|
-
const t =
|
|
1200
|
+
function Ft(e, n) {
|
|
1201
|
+
const t = Rt(
|
|
1201
1202
|
n
|
|
1202
1203
|
);
|
|
1203
1204
|
return t === void 0 ? e : {
|
|
@@ -1205,25 +1206,25 @@ function Ut(e, n) {
|
|
|
1205
1206
|
pickupPoint: t
|
|
1206
1207
|
};
|
|
1207
1208
|
}
|
|
1208
|
-
function
|
|
1209
|
-
return e.map((n) => n.key !== "shipping" ||
|
|
1209
|
+
function Nt(e) {
|
|
1210
|
+
return e.map((n) => n.key !== "shipping" || gn(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1210
1211
|
}
|
|
1211
|
-
function
|
|
1212
|
+
function Lt(e, n) {
|
|
1212
1213
|
let t = [...e];
|
|
1213
1214
|
const r = t.some((i) => i.key === "shipping");
|
|
1214
1215
|
for (const i of n)
|
|
1215
1216
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1216
|
-
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")),
|
|
1217
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), Nt(t);
|
|
1217
1218
|
}
|
|
1218
|
-
function
|
|
1219
|
+
function Bt(e) {
|
|
1219
1220
|
return e.reduce((n, t) => {
|
|
1220
1221
|
let { key: r, value: i } = t;
|
|
1221
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${
|
|
1222
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Re(r)}/${Ut(Re(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1222
1223
|
}, "");
|
|
1223
1224
|
}
|
|
1224
|
-
const
|
|
1225
|
-
function
|
|
1226
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1225
|
+
const $t = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), Mt = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1226
|
+
function zt(e, n) {
|
|
1227
|
+
const { segmentParams: t, extraFacets: r } = Et(e ?? {}), i = n?.salesChannel ?? t.sc, o = n?.regionId ?? t.regionId, a = n?.locale ?? t.locale ?? "";
|
|
1227
1228
|
return {
|
|
1228
1229
|
segmentParams: {
|
|
1229
1230
|
...t,
|
|
@@ -1234,61 +1235,61 @@ function Nt(e, n) {
|
|
|
1234
1235
|
extraFacets: r
|
|
1235
1236
|
};
|
|
1236
1237
|
}
|
|
1237
|
-
function
|
|
1238
|
-
const t = e.filter(({ key: c }) => !
|
|
1239
|
-
({ key: c, value:
|
|
1238
|
+
function Vt(e, n) {
|
|
1239
|
+
const t = e.filter(({ key: c }) => !At.has(c)), r = e.find(
|
|
1240
|
+
({ key: c, value: d }) => c === _e && d !== "all-delivery-methods"
|
|
1240
1241
|
) ?? null, i = e.find(
|
|
1241
|
-
({ key: c, value:
|
|
1242
|
+
({ key: c, value: d }) => c === Ee && d !== "all-delivery-options"
|
|
1242
1243
|
) ?? null, o = [...t], a = o.some(
|
|
1243
|
-
({ key: c }) => c === Te
|
|
1244
|
-
), s = o.some(
|
|
1245
1244
|
({ key: c }) => c === _e
|
|
1245
|
+
), s = o.some(
|
|
1246
|
+
({ key: c }) => c === Ee
|
|
1246
1247
|
);
|
|
1247
|
-
return r !== null && !a && o.push(r), i !== null && !s && o.push(i),
|
|
1248
|
+
return r !== null && !a && o.push(r), i !== null && !s && o.push(i), Lt(o, n);
|
|
1248
1249
|
}
|
|
1249
|
-
function
|
|
1250
|
+
function xt(e, n) {
|
|
1250
1251
|
const t = e.find(({ key: o }) => o === ge) ?? null, r = e.find(({ key: o }) => o === me) ?? null, i = e.find(({ key: o }) => o === he) ?? null;
|
|
1251
|
-
t &&
|
|
1252
|
+
t && $t(t) && n.append(ge, t.value), r && Mt(r) && n.append(me, r.value), i && n.append(he, i.value);
|
|
1252
1253
|
}
|
|
1253
|
-
function
|
|
1254
|
+
function Fe(e, n, t, r) {
|
|
1254
1255
|
const {
|
|
1255
1256
|
query: i = "",
|
|
1256
1257
|
page: o,
|
|
1257
1258
|
count: a,
|
|
1258
1259
|
sort: s,
|
|
1259
1260
|
selectedFacets: c = [],
|
|
1260
|
-
showInvisibleItems:
|
|
1261
|
-
sponsoredCount:
|
|
1262
|
-
hideUnavailableItems:
|
|
1263
|
-
allowRedirect:
|
|
1264
|
-
} = e,
|
|
1261
|
+
showInvisibleItems: d,
|
|
1262
|
+
sponsoredCount: u,
|
|
1263
|
+
hideUnavailableItems: p,
|
|
1264
|
+
allowRedirect: f = !1
|
|
1265
|
+
} = e, h = new URLSearchParams();
|
|
1265
1266
|
if (r.includePagination && o !== void 0 && a !== void 0) {
|
|
1266
|
-
const
|
|
1267
|
-
|
|
1267
|
+
const g = o * a, m = a === 0 ? g : g + a - 1;
|
|
1268
|
+
h.append("from", g.toString()), h.append("to", m.toString());
|
|
1268
1269
|
}
|
|
1269
|
-
i &&
|
|
1270
|
-
const v =
|
|
1270
|
+
i && h.append("query", i), r.includeSort && s && h.append("sort", s);
|
|
1271
|
+
const v = Ft(
|
|
1271
1272
|
t.segmentParams,
|
|
1272
1273
|
c
|
|
1273
1274
|
);
|
|
1274
|
-
if (
|
|
1275
|
-
const
|
|
1276
|
-
|
|
1275
|
+
if (pn(h, v ?? t.segmentParams), xt(c, h), d && h.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1276
|
+
const g = c.find(({ key: S }) => S === wt), m = g ? g.value : p?.toString() ?? n.hideUnavailableItems.toString();
|
|
1277
|
+
h.append("hideUnavailableItems", m);
|
|
1277
1278
|
}
|
|
1278
|
-
n?.simulationBehavior !== void 0 &&
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1279
|
+
n?.simulationBehavior !== void 0 && h.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && h.append("showSponsored", n.showSponsored.toString()), u !== void 0 && h.append("sponsoredCount", u.toString()), f !== void 0 && h.append("allowRedirect", f.toString());
|
|
1280
|
+
const l = Bt(
|
|
1281
|
+
Vt(c, t.extraFacets)
|
|
1281
1282
|
);
|
|
1282
|
-
return { params:
|
|
1283
|
+
return { params: h, path: l };
|
|
1283
1284
|
}
|
|
1284
|
-
function
|
|
1285
|
+
function qt(e, n) {
|
|
1285
1286
|
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: o } = e, a = new URLSearchParams({
|
|
1286
1287
|
field: t ?? "",
|
|
1287
1288
|
value: r ?? ""
|
|
1288
1289
|
});
|
|
1289
|
-
return
|
|
1290
|
+
return pn(a, n), i && a.append("hideUnavailableItems", "true"), o && a.append("show-invisible-items", "true"), a;
|
|
1290
1291
|
}
|
|
1291
|
-
function
|
|
1292
|
+
function j(e, n) {
|
|
1292
1293
|
return {
|
|
1293
1294
|
path: e,
|
|
1294
1295
|
params: n,
|
|
@@ -1298,44 +1299,44 @@ function W(e, n) {
|
|
|
1298
1299
|
}
|
|
1299
1300
|
};
|
|
1300
1301
|
}
|
|
1301
|
-
function
|
|
1302
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, o =
|
|
1302
|
+
function W(e) {
|
|
1303
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, o = zt(t, r);
|
|
1303
1304
|
switch (n) {
|
|
1304
1305
|
case "product-search":
|
|
1305
1306
|
case "facets": {
|
|
1306
|
-
const { params: a, path: s } =
|
|
1307
|
+
const { params: a, path: s } = Fe(
|
|
1307
1308
|
i,
|
|
1308
1309
|
r,
|
|
1309
1310
|
o,
|
|
1310
1311
|
{ includePagination: !0, includeSort: !0 }
|
|
1311
1312
|
);
|
|
1312
|
-
return
|
|
1313
|
+
return j(s, a);
|
|
1313
1314
|
}
|
|
1314
1315
|
case "catalog-count": {
|
|
1315
|
-
const { params: a, path: s } =
|
|
1316
|
+
const { params: a, path: s } = Fe(
|
|
1316
1317
|
i,
|
|
1317
1318
|
r,
|
|
1318
1319
|
o,
|
|
1319
1320
|
{ includePagination: !1, includeSort: !1 }
|
|
1320
1321
|
);
|
|
1321
|
-
return
|
|
1322
|
+
return j(s, a);
|
|
1322
1323
|
}
|
|
1323
1324
|
case "products": {
|
|
1324
|
-
const a =
|
|
1325
|
-
return
|
|
1325
|
+
const a = qt(i, o.segmentParams);
|
|
1326
|
+
return j("", a);
|
|
1326
1327
|
}
|
|
1327
1328
|
case "search-suggestions": {
|
|
1328
1329
|
const a = new URLSearchParams({
|
|
1329
1330
|
query: i.query?.toString() ?? "",
|
|
1330
1331
|
locale: r?.locale ?? o.segmentParams.locale ?? ""
|
|
1331
1332
|
});
|
|
1332
|
-
return
|
|
1333
|
+
return j("", a);
|
|
1333
1334
|
}
|
|
1334
1335
|
case "top-searches": {
|
|
1335
1336
|
const a = new URLSearchParams({
|
|
1336
1337
|
locale: r?.locale ?? o.segmentParams.locale ?? ""
|
|
1337
1338
|
});
|
|
1338
|
-
return
|
|
1339
|
+
return j("", a);
|
|
1339
1340
|
}
|
|
1340
1341
|
default: {
|
|
1341
1342
|
const a = n;
|
|
@@ -1343,16 +1344,16 @@ function G(e) {
|
|
|
1343
1344
|
}
|
|
1344
1345
|
}
|
|
1345
1346
|
}
|
|
1346
|
-
const
|
|
1347
|
-
function
|
|
1347
|
+
const jt = 10;
|
|
1348
|
+
function Wt(e) {
|
|
1348
1349
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1349
1350
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1350
1351
|
}
|
|
1351
|
-
function
|
|
1352
|
-
const t =
|
|
1353
|
-
return
|
|
1352
|
+
function Gt(e) {
|
|
1353
|
+
const t = un(e.headers?.cookie).cultureInfo || "";
|
|
1354
|
+
return K(e) ? e.storage.locale || t : t || e.storage.locale || "";
|
|
1354
1355
|
}
|
|
1355
|
-
const
|
|
1356
|
+
const Ht = ({
|
|
1356
1357
|
account: e,
|
|
1357
1358
|
environment: n,
|
|
1358
1359
|
hideUnavailableItems: t,
|
|
@@ -1360,69 +1361,69 @@ const xt = ({
|
|
|
1360
1361
|
showSponsored: i,
|
|
1361
1362
|
subDomainPrefix: o
|
|
1362
1363
|
}, a) => {
|
|
1363
|
-
const s = `https://${e}.${n}.com.br`, c =
|
|
1364
|
+
const s = `https://${e}.${n}.com.br`, c = dn(a), d = un(a.headers?.cookie), u = () => ({
|
|
1364
1365
|
salesChannel: a.storage.channel.salesChannel,
|
|
1365
|
-
regionId:
|
|
1366
|
-
locale:
|
|
1366
|
+
regionId: Wt(a),
|
|
1367
|
+
locale: Gt(a),
|
|
1367
1368
|
hideUnavailableItems: t,
|
|
1368
1369
|
simulationBehavior: r,
|
|
1369
1370
|
showSponsored: i
|
|
1370
|
-
}),
|
|
1371
|
+
}), p = new Headers(a.headers).get("x-forwarded-host") ?? a.headers?.host ?? "", f = o && o.map((I) => I + ".").find((I) => p.includes(I)) || "", h = p.replace(f, ""), v = c({
|
|
1371
1372
|
"content-type": "application/json",
|
|
1372
|
-
"X-FORWARDED-HOST":
|
|
1373
|
-
}),
|
|
1374
|
-
const
|
|
1375
|
-
endpoint:
|
|
1376
|
-
segment:
|
|
1377
|
-
defaults:
|
|
1373
|
+
"X-FORWARDED-HOST": h
|
|
1374
|
+
}), l = ({ type: I, ...D }) => {
|
|
1375
|
+
const P = I === "facets" ? "facets" : "product-search", k = W({
|
|
1376
|
+
endpoint: P,
|
|
1377
|
+
segment: d,
|
|
1378
|
+
defaults: u(),
|
|
1378
1379
|
args: D
|
|
1379
1380
|
});
|
|
1380
|
-
return
|
|
1381
|
-
`${s}/api/intelligent-search/v1/${
|
|
1381
|
+
return y(
|
|
1382
|
+
`${s}/api/intelligent-search/v1/${P}/${k.path}?${k.params.toString()}`,
|
|
1382
1383
|
{ headers: v }
|
|
1383
1384
|
);
|
|
1384
|
-
},
|
|
1385
|
-
field:
|
|
1385
|
+
}, g = (I) => l({ ...I, type: "product_search" }), m = ({
|
|
1386
|
+
field: I,
|
|
1386
1387
|
value: D,
|
|
1387
|
-
hideUnavailableItems:
|
|
1388
|
+
hideUnavailableItems: P,
|
|
1388
1389
|
showInvisibleItems: k
|
|
1389
1390
|
}) => {
|
|
1390
|
-
const
|
|
1391
|
+
const A = W({
|
|
1391
1392
|
endpoint: "products",
|
|
1392
|
-
segment:
|
|
1393
|
-
defaults:
|
|
1393
|
+
segment: d,
|
|
1394
|
+
defaults: u(),
|
|
1394
1395
|
args: {
|
|
1395
|
-
field:
|
|
1396
|
+
field: I,
|
|
1396
1397
|
value: D,
|
|
1397
|
-
hideUnavailableItems:
|
|
1398
|
+
hideUnavailableItems: P,
|
|
1398
1399
|
showInvisibleItems: k
|
|
1399
1400
|
}
|
|
1400
1401
|
});
|
|
1401
|
-
return
|
|
1402
|
-
`${s}/api/intelligent-search/v1/products?${
|
|
1402
|
+
return y(
|
|
1403
|
+
`${s}/api/intelligent-search/v1/products?${A.params.toString()}`,
|
|
1403
1404
|
{ headers: v }
|
|
1404
1405
|
);
|
|
1405
1406
|
};
|
|
1406
1407
|
return {
|
|
1407
|
-
facets: (
|
|
1408
|
-
products:
|
|
1408
|
+
facets: (I) => l({ ...I, type: "facets" }),
|
|
1409
|
+
products: g,
|
|
1409
1410
|
fetchProduct: m,
|
|
1410
1411
|
productsByIdentifier: async ({
|
|
1411
|
-
field:
|
|
1412
|
+
field: I,
|
|
1412
1413
|
values: D,
|
|
1413
|
-
showInvisibleItems:
|
|
1414
|
+
showInvisibleItems: P,
|
|
1414
1415
|
hideUnavailableItems: k
|
|
1415
1416
|
}) => {
|
|
1416
|
-
const
|
|
1417
|
+
const A = we(jt);
|
|
1417
1418
|
return (await Promise.all(
|
|
1418
1419
|
D.map(
|
|
1419
|
-
(
|
|
1420
|
+
(C) => A(async () => {
|
|
1420
1421
|
try {
|
|
1421
1422
|
return await m({
|
|
1422
|
-
field:
|
|
1423
|
-
value:
|
|
1423
|
+
field: I,
|
|
1424
|
+
value: C,
|
|
1424
1425
|
hideUnavailableItems: k,
|
|
1425
|
-
showInvisibleItems:
|
|
1426
|
+
showInvisibleItems: P
|
|
1426
1427
|
});
|
|
1427
1428
|
} catch {
|
|
1428
1429
|
return null;
|
|
@@ -1430,54 +1431,54 @@ const xt = ({
|
|
|
1430
1431
|
})
|
|
1431
1432
|
)
|
|
1432
1433
|
)).filter(
|
|
1433
|
-
(
|
|
1434
|
+
(C) => C !== null
|
|
1434
1435
|
);
|
|
1435
1436
|
},
|
|
1436
|
-
suggestedTerms: (
|
|
1437
|
-
const D =
|
|
1437
|
+
suggestedTerms: (I) => {
|
|
1438
|
+
const D = W({
|
|
1438
1439
|
endpoint: "search-suggestions",
|
|
1439
|
-
segment:
|
|
1440
|
-
defaults:
|
|
1441
|
-
args: { query:
|
|
1440
|
+
segment: d,
|
|
1441
|
+
defaults: u(),
|
|
1442
|
+
args: { query: I.query }
|
|
1442
1443
|
});
|
|
1443
|
-
return
|
|
1444
|
+
return y(
|
|
1444
1445
|
`${s}/api/intelligent-search/v1/search-suggestions?${D.params.toString()}`,
|
|
1445
1446
|
{ headers: v }
|
|
1446
1447
|
);
|
|
1447
1448
|
},
|
|
1448
1449
|
topSearches: () => {
|
|
1449
|
-
const
|
|
1450
|
+
const I = W({
|
|
1450
1451
|
endpoint: "top-searches",
|
|
1451
|
-
segment:
|
|
1452
|
-
defaults:
|
|
1452
|
+
segment: d,
|
|
1453
|
+
defaults: u()
|
|
1453
1454
|
});
|
|
1454
|
-
return
|
|
1455
|
-
`${s}/api/intelligent-search/v1/top-searches?${
|
|
1455
|
+
return y(
|
|
1456
|
+
`${s}/api/intelligent-search/v1/top-searches?${I.params.toString()}`,
|
|
1456
1457
|
{ headers: v }
|
|
1457
1458
|
);
|
|
1458
1459
|
},
|
|
1459
|
-
productCount: (
|
|
1460
|
-
const D =
|
|
1460
|
+
productCount: (I) => {
|
|
1461
|
+
const D = W({
|
|
1461
1462
|
endpoint: "catalog-count",
|
|
1462
|
-
segment:
|
|
1463
|
-
defaults:
|
|
1464
|
-
args:
|
|
1463
|
+
segment: d,
|
|
1464
|
+
defaults: u(),
|
|
1465
|
+
args: I
|
|
1465
1466
|
});
|
|
1466
|
-
return
|
|
1467
|
+
return y(
|
|
1467
1468
|
`${s}/api/intelligent-search/v1/catalog-count/${D.path}?${D.params.toString()}`,
|
|
1468
1469
|
{ headers: v }
|
|
1469
1470
|
);
|
|
1470
1471
|
}
|
|
1471
1472
|
};
|
|
1472
|
-
},
|
|
1473
|
-
const t =
|
|
1473
|
+
}, Xt = (e, n) => {
|
|
1474
|
+
const t = Ht(e, n), r = Ot(e, n), i = lt(e);
|
|
1474
1475
|
return {
|
|
1475
1476
|
search: t,
|
|
1476
1477
|
commerce: r,
|
|
1477
1478
|
catalog: i
|
|
1478
1479
|
};
|
|
1479
|
-
},
|
|
1480
|
-
const t = we(
|
|
1480
|
+
}, Yt = 20, Jt = (e) => e.entityType === "category", fe = (e) => e.entityType === "brand", Ne = (e) => e.entityType === "collection", Kt = (e, n) => {
|
|
1481
|
+
const t = we(Yt), r = async (i) => Promise.all(
|
|
1481
1482
|
i.map(
|
|
1482
1483
|
(o) => t(async () => {
|
|
1483
1484
|
const a = o.slug.toLowerCase(), s = o.locale, c = await n.commerce.catalog.byLinkId.category(
|
|
@@ -1490,72 +1491,72 @@ const xt = ({
|
|
|
1490
1491
|
entityType: "category",
|
|
1491
1492
|
slug: a
|
|
1492
1493
|
};
|
|
1493
|
-
const
|
|
1494
|
+
const d = await n.commerce.catalog.byLinkId.brand(
|
|
1494
1495
|
a,
|
|
1495
1496
|
s
|
|
1496
1497
|
);
|
|
1497
|
-
if (
|
|
1498
|
-
return { ...
|
|
1499
|
-
const
|
|
1498
|
+
if (d)
|
|
1499
|
+
return { ...d, entityType: "brand" };
|
|
1500
|
+
const u = await n.commerce.catalog.byLinkId.collection(
|
|
1500
1501
|
a,
|
|
1501
1502
|
s
|
|
1502
1503
|
);
|
|
1503
|
-
if (
|
|
1504
|
-
return { ...
|
|
1504
|
+
if (u)
|
|
1505
|
+
return { ...u, entityType: "collection" };
|
|
1505
1506
|
throw new B(
|
|
1506
1507
|
`No catalog entity found for slug: ${o.slug}. Cascade exhausted (category → brand → collection).`
|
|
1507
1508
|
);
|
|
1508
1509
|
})
|
|
1509
1510
|
)
|
|
1510
1511
|
);
|
|
1511
|
-
return new
|
|
1512
|
+
return new de(r, {
|
|
1512
1513
|
// DataLoader is used for caching, not batching
|
|
1513
1514
|
batch: !1,
|
|
1514
1515
|
// Dedup by lowercased slug + captured locale so casing variants share an
|
|
1515
1516
|
// entry while same-slug / different-locale loads stay isolated.
|
|
1516
1517
|
cacheKeyFn: ({ slug: i, locale: o }) => `${i.toLowerCase()}::${o ?? ""}`
|
|
1517
1518
|
});
|
|
1518
|
-
},
|
|
1519
|
+
}, Qt = (e, n) => {
|
|
1519
1520
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1520
|
-
return new
|
|
1521
|
-
},
|
|
1522
|
-
const t = we(
|
|
1523
|
-
const a = o.reduce((
|
|
1521
|
+
return new de(t);
|
|
1522
|
+
}, Zt = 1, er = (e, n) => {
|
|
1523
|
+
const t = we(Zt), r = async (o) => {
|
|
1524
|
+
const a = o.reduce((p, { items: f }) => [...p, f], []), s = [...a.flat()], c = await n.commerce.checkout.simulation({
|
|
1524
1525
|
country: o[0].country,
|
|
1525
1526
|
postalCode: o[0].postalCode,
|
|
1526
1527
|
items: s
|
|
1527
|
-
}),
|
|
1528
|
-
(
|
|
1529
|
-
const
|
|
1530
|
-
return typeof
|
|
1528
|
+
}), d = c.items.reduce(
|
|
1529
|
+
(p, f) => {
|
|
1530
|
+
const h = f.requestIndex;
|
|
1531
|
+
return typeof h == "number" && h < p.length && (p[h] = f), p;
|
|
1531
1532
|
},
|
|
1532
1533
|
Array(s.length).fill(null)
|
|
1533
|
-
),
|
|
1534
|
-
(
|
|
1534
|
+
), u = a.reduce(
|
|
1535
|
+
(p, f) => [...p, f.length + p[p.length - 1]],
|
|
1535
1536
|
[0]
|
|
1536
1537
|
);
|
|
1537
|
-
return a.map((
|
|
1538
|
+
return a.map((p, f) => ({
|
|
1538
1539
|
...c,
|
|
1539
|
-
items:
|
|
1540
|
+
items: d.slice(u[f], u[f + 1]).filter((h) => !!h)
|
|
1540
1541
|
}));
|
|
1541
1542
|
}, i = async (o) => t(r, o);
|
|
1542
|
-
return new
|
|
1543
|
+
return new de(i, {
|
|
1543
1544
|
maxBatchSize: 50
|
|
1544
1545
|
});
|
|
1545
|
-
},
|
|
1546
|
-
function
|
|
1546
|
+
}, nr = (e, n) => qn(e, n);
|
|
1547
|
+
function tr(e) {
|
|
1547
1548
|
return {
|
|
1548
1549
|
...e,
|
|
1549
|
-
description: e.description ?
|
|
1550
|
+
description: e.description ? nr(e.description) : e.description
|
|
1550
1551
|
};
|
|
1551
1552
|
}
|
|
1552
|
-
const
|
|
1553
|
+
const F = (e, n) => ({
|
|
1553
1554
|
...e,
|
|
1554
|
-
isVariantOf:
|
|
1555
|
-
}),
|
|
1555
|
+
isVariantOf: tr(n)
|
|
1556
|
+
}), rr = ({ flags: e }, n) => {
|
|
1556
1557
|
const t = async (r) => {
|
|
1557
|
-
const i = r.map((
|
|
1558
|
-
(
|
|
1558
|
+
const i = r.map((u) => u.split("-")[0]), o = r.some(
|
|
1559
|
+
(u) => u.split("-")[1] === "invisibleItems"
|
|
1559
1560
|
), s = (await n.search.productsByIdentifier({
|
|
1560
1561
|
field: "sku",
|
|
1561
1562
|
values: i,
|
|
@@ -1564,44 +1565,44 @@ const N = (e, n) => ({
|
|
|
1564
1565
|
hideUnavailableItems: !1
|
|
1565
1566
|
}
|
|
1566
1567
|
})).reduce(
|
|
1567
|
-
(
|
|
1568
|
-
for (const
|
|
1569
|
-
|
|
1570
|
-
return
|
|
1568
|
+
(u, p) => {
|
|
1569
|
+
for (const f of p.items)
|
|
1570
|
+
u[f.itemId] = F(f, p);
|
|
1571
|
+
return u;
|
|
1571
1572
|
},
|
|
1572
1573
|
{}
|
|
1573
|
-
), c = i.map((
|
|
1574
|
-
if (
|
|
1574
|
+
), c = i.map((u) => s[u]), d = i.filter((u) => !s[u]);
|
|
1575
|
+
if (d.length > 0)
|
|
1575
1576
|
throw new B(
|
|
1576
|
-
`Search API did not found the following skus: ${
|
|
1577
|
+
`Search API did not found the following skus: ${d.join(",")}`
|
|
1577
1578
|
);
|
|
1578
1579
|
return c;
|
|
1579
1580
|
};
|
|
1580
|
-
return new
|
|
1581
|
+
return new de(t, {
|
|
1581
1582
|
maxBatchSize: 99
|
|
1582
1583
|
// Max allowed batch size of Search API
|
|
1583
1584
|
});
|
|
1584
|
-
},
|
|
1585
|
-
const { clients: t } = n, r =
|
|
1585
|
+
}, ir = (e, n) => {
|
|
1586
|
+
const { clients: t } = n, r = rr(e, t), i = er(e, t), o = Kt(e, t), a = Qt(e, t);
|
|
1586
1587
|
return {
|
|
1587
1588
|
skuLoader: r,
|
|
1588
1589
|
simulationLoader: i,
|
|
1589
1590
|
collectionLoader: o,
|
|
1590
1591
|
salesChannelLoader: a
|
|
1591
1592
|
};
|
|
1592
|
-
}, L = (e) => e.AvailableQuantity > 0, V = (e) => e.spotPrice ?? 0,
|
|
1593
|
+
}, L = (e) => e.AvailableQuantity > 0, V = (e) => e.spotPrice ?? 0, or = (e) => e.Price ?? 0, Le = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", mn = (e, n) => L(e) && !L(n) ? -1 : !L(e) && L(n) ? 1 : V(e) - V(n), ar = (e) => e === "available", M = (e, n = 0, t = 1) => {
|
|
1593
1594
|
const r = n / t;
|
|
1594
1595
|
return Math.round((e + r) * 100) / 100;
|
|
1595
|
-
},
|
|
1596
|
+
}, sr = (e, n = { includeTaxes: !1 }) => {
|
|
1596
1597
|
const t = e.filter(L), r = t[t.length - 1], i = r ? V(r) : 0;
|
|
1597
1598
|
return n.includeTaxes ? M(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1598
|
-
},
|
|
1599
|
+
}, Be = (e, n = { includeTaxes: !1 }) => {
|
|
1599
1600
|
const [t] = e.filter(L), r = t ? V(t) : 0;
|
|
1600
1601
|
return n.includeTaxes ? M(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1601
|
-
},
|
|
1602
|
-
highPrice: (e) =>
|
|
1603
|
-
lowPrice: (e) =>
|
|
1604
|
-
lowPriceWithTaxes: (e) =>
|
|
1602
|
+
}, cr = {
|
|
1603
|
+
highPrice: (e) => sr(e),
|
|
1604
|
+
lowPrice: (e) => Be(e),
|
|
1605
|
+
lowPriceWithTaxes: (e) => Be(e, { includeTaxes: !0 }),
|
|
1605
1606
|
offerCount: (e) => e.length,
|
|
1606
1607
|
priceCurrency: async (e, n, t) => {
|
|
1607
1608
|
const {
|
|
@@ -1611,22 +1612,22 @@ const N = (e, n) => ({
|
|
|
1611
1612
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1612
1613
|
},
|
|
1613
1614
|
offers: (e) => e
|
|
1614
|
-
},
|
|
1615
|
+
}, lr = {
|
|
1615
1616
|
ratingValue: () => 5,
|
|
1616
1617
|
reviewCount: () => 0
|
|
1617
|
-
},
|
|
1618
|
+
}, $e = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", dr = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", ur = (e) => {
|
|
1618
1619
|
let n = e.slice(0);
|
|
1619
|
-
for (let t = 0; t <
|
|
1620
|
-
n = n.replace(new RegExp(
|
|
1620
|
+
for (let t = 0; t < $e.length; t++)
|
|
1621
|
+
n = n.replace(new RegExp($e.charAt(t), "g"), dr.charAt(t));
|
|
1621
1622
|
return n;
|
|
1622
|
-
},
|
|
1623
|
-
function
|
|
1623
|
+
}, pr = (e) => e.replace(/[·/_,:]/, "-");
|
|
1624
|
+
function ae(e) {
|
|
1624
1625
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1625
|
-
return
|
|
1626
|
+
return pr(ur(t)).toLowerCase();
|
|
1626
1627
|
}
|
|
1627
|
-
const
|
|
1628
|
+
const G = (e) => Jt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? ae(e.name), hn = {
|
|
1628
1629
|
id: ({ id: e }) => e.toString(),
|
|
1629
|
-
slug: (e) =>
|
|
1630
|
+
slug: (e) => G(e),
|
|
1630
1631
|
seo: (e) => ({
|
|
1631
1632
|
title: e.title ?? e.name,
|
|
1632
1633
|
// pagetype.metaTagDescription and catalog `description` share the same
|
|
@@ -1634,90 +1635,90 @@ const H = (e) => Wt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? oe(e.name), pn
|
|
|
1634
1635
|
// for forward-compat; fall back to description for by-linkid parity.
|
|
1635
1636
|
description: e.metaTagDescription ?? e.description
|
|
1636
1637
|
}),
|
|
1637
|
-
type: (e) => fe(e) ? "Brand" :
|
|
1638
|
+
type: (e) => fe(e) ? "Brand" : Ne(e) ? "Collection" : e.fatherCategoryId === null ? "Department" : "Category",
|
|
1638
1639
|
meta: async (e, n, t) => {
|
|
1639
|
-
const r =
|
|
1640
|
+
const r = G(e);
|
|
1640
1641
|
if (fe(e))
|
|
1641
1642
|
return { selectedFacets: [{ key: "brand", value: r }] };
|
|
1642
|
-
if (
|
|
1643
|
+
if (Ne(e))
|
|
1643
1644
|
return { selectedFacets: [{ key: "productclusterids", value: e.id }] };
|
|
1644
|
-
const { defaultLocale: i } =
|
|
1645
|
-
(
|
|
1645
|
+
const { defaultLocale: i } = J(t), o = r.split("/").filter(Boolean), a = o.map(
|
|
1646
|
+
(d, u) => o.slice(0, u + 1).join("/")
|
|
1646
1647
|
), {
|
|
1647
1648
|
loaders: { collectionLoader: s }
|
|
1648
1649
|
} = t;
|
|
1649
1650
|
return {
|
|
1650
1651
|
selectedFacets: (await Promise.all(
|
|
1651
1652
|
a.map(
|
|
1652
|
-
(
|
|
1653
|
+
(d) => s.load({ slug: d, locale: ie(t) })
|
|
1653
1654
|
)
|
|
1654
|
-
)).map((
|
|
1655
|
-
key: `category-${
|
|
1656
|
-
value: i &&
|
|
1655
|
+
)).map((d, u) => ({
|
|
1656
|
+
key: `category-${u + 1}`,
|
|
1657
|
+
value: i && d.availableLinkIds?.[i] || d.linkId
|
|
1657
1658
|
}))
|
|
1658
1659
|
};
|
|
1659
1660
|
},
|
|
1660
1661
|
breadcrumbList: async (e, n, t) => {
|
|
1661
1662
|
const {
|
|
1662
1663
|
loaders: { collectionLoader: r }
|
|
1663
|
-
} = t, o =
|
|
1664
|
-
(c,
|
|
1664
|
+
} = t, o = G(e).split("/").filter(Boolean), a = o.map(
|
|
1665
|
+
(c, d) => o.slice(0, d + 1).join("/")
|
|
1665
1666
|
), s = await Promise.all(
|
|
1666
1667
|
a.map(
|
|
1667
|
-
(c) => r.load({ slug: c, locale:
|
|
1668
|
+
(c) => r.load({ slug: c, locale: ie(t) })
|
|
1668
1669
|
)
|
|
1669
1670
|
);
|
|
1670
1671
|
return {
|
|
1671
|
-
itemListElement: s.map((c,
|
|
1672
|
-
item: `/${
|
|
1672
|
+
itemListElement: s.map((c, d) => ({
|
|
1673
|
+
item: `/${G(c)}`,
|
|
1673
1674
|
name: c.name,
|
|
1674
|
-
position:
|
|
1675
|
+
position: d + 1
|
|
1675
1676
|
})),
|
|
1676
1677
|
numberOfItems: s.length
|
|
1677
1678
|
};
|
|
1678
1679
|
},
|
|
1679
1680
|
otherLocales: async (e, n, t) => {
|
|
1680
|
-
const r =
|
|
1681
|
+
const r = J(t);
|
|
1681
1682
|
if (!r.enabled) return null;
|
|
1682
1683
|
const i = Object.keys(r.locales ?? {});
|
|
1683
1684
|
if (i.length === 0) return null;
|
|
1684
|
-
const o = t.storage.locale, a =
|
|
1685
|
+
const o = t.storage.locale, a = G(e), s = a.split("/").filter(Boolean);
|
|
1685
1686
|
if (s.length === 0) return null;
|
|
1686
1687
|
const {
|
|
1687
1688
|
loaders: { collectionLoader: c }
|
|
1688
|
-
} = t,
|
|
1689
|
-
(
|
|
1689
|
+
} = t, d = s.map(
|
|
1690
|
+
(p, f) => s.slice(0, f + 1).join("/")
|
|
1690
1691
|
);
|
|
1691
|
-
let
|
|
1692
|
+
let u;
|
|
1692
1693
|
try {
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
(
|
|
1694
|
+
u = await Promise.all(
|
|
1695
|
+
d.map(
|
|
1696
|
+
(p) => c.load({ slug: p, locale: ie(t) })
|
|
1696
1697
|
)
|
|
1697
1698
|
);
|
|
1698
|
-
} catch (
|
|
1699
|
-
return console.warn("[otherLocales] failed to load collection entities:",
|
|
1699
|
+
} catch (p) {
|
|
1700
|
+
return console.warn("[otherLocales] failed to load collection entities:", p), null;
|
|
1700
1701
|
}
|
|
1701
|
-
return i.map((
|
|
1702
|
-
if (
|
|
1703
|
-
return { locale:
|
|
1704
|
-
const
|
|
1705
|
-
for (const
|
|
1706
|
-
const v =
|
|
1702
|
+
return i.map((p) => {
|
|
1703
|
+
if (p === o)
|
|
1704
|
+
return { locale: p, slug: a };
|
|
1705
|
+
const f = [];
|
|
1706
|
+
for (const h of u) {
|
|
1707
|
+
const v = h.availableLinkIds?.[p];
|
|
1707
1708
|
if (!v) return null;
|
|
1708
|
-
|
|
1709
|
+
f.push(v);
|
|
1709
1710
|
}
|
|
1710
|
-
return
|
|
1711
|
-
}).filter((
|
|
1711
|
+
return f.length > 0 ? { locale: p, slug: f.join("/") } : null;
|
|
1712
|
+
}).filter((p) => p !== null);
|
|
1712
1713
|
}
|
|
1713
|
-
},
|
|
1714
|
+
}, fn = {
|
|
1714
1715
|
buy: "whoboughtalsobought",
|
|
1715
1716
|
view: "whosawalsosaw",
|
|
1716
1717
|
similars: "similars",
|
|
1717
1718
|
viewAndBought: "whosawalsobought",
|
|
1718
1719
|
accessories: "accessories",
|
|
1719
1720
|
suggestions: "suggestions"
|
|
1720
|
-
},
|
|
1721
|
+
}, Me = ({ key: e, value: n }) => {
|
|
1721
1722
|
switch (e) {
|
|
1722
1723
|
case "price":
|
|
1723
1724
|
return { key: e, value: n.replace("-to-", ":") };
|
|
@@ -1733,34 +1734,34 @@ const H = (e) => Wt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? oe(e.name), pn
|
|
|
1733
1734
|
default:
|
|
1734
1735
|
return { key: e, value: n };
|
|
1735
1736
|
}
|
|
1736
|
-
},
|
|
1737
|
+
}, ze = (e) => {
|
|
1737
1738
|
const n = e.split(":").map(Number);
|
|
1738
1739
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1739
|
-
},
|
|
1740
|
+
}, gr = (e) => typeof fn[e] == "string", mr = (e) => {
|
|
1740
1741
|
const n = e?.filter(
|
|
1741
|
-
(t) =>
|
|
1742
|
+
(t) => gr(t.key)
|
|
1742
1743
|
);
|
|
1743
1744
|
if (Array.isArray(n) && n.length > 1)
|
|
1744
|
-
throw new
|
|
1745
|
+
throw new T(
|
|
1745
1746
|
`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(",")}`
|
|
1746
1747
|
);
|
|
1747
1748
|
return n?.[0] ?? null;
|
|
1748
|
-
},
|
|
1749
|
+
}, hr = (e) => e?.find((n) => n.key === "slug")?.value ?? null, fr = (e) => e?.find((n) => n.key === "id")?.value ?? null, Ve = (e) => e?.find((n) => n.key === "locale")?.value ?? null, xe = (e) => e?.find((n) => n.key === "channel")?.value ?? null, Se = (e, n) => {
|
|
1749
1750
|
let t = 0;
|
|
1750
1751
|
for (let r = 1; r < e.length; r++)
|
|
1751
1752
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1752
1753
|
return e[t];
|
|
1753
|
-
},
|
|
1754
|
+
}, Sr = {
|
|
1754
1755
|
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1755
|
-
},
|
|
1756
|
+
}, yr = {
|
|
1756
1757
|
key: ({ key: e }) => e,
|
|
1757
1758
|
label: ({ name: e }) => e,
|
|
1758
1759
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1759
|
-
},
|
|
1760
|
+
}, Ir = {
|
|
1760
1761
|
key: ({ key: e }) => e,
|
|
1761
1762
|
label: ({ name: e }) => e,
|
|
1762
1763
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1763
|
-
const i =
|
|
1764
|
+
const i = ze(
|
|
1764
1765
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1765
1766
|
), a = Se(e, (s, c) => s.range.from - c.range.from)?.range?.from ?? 0;
|
|
1766
1767
|
return {
|
|
@@ -1769,7 +1770,7 @@ const H = (e) => Wt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? oe(e.name), pn
|
|
|
1769
1770
|
};
|
|
1770
1771
|
},
|
|
1771
1772
|
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1772
|
-
const i =
|
|
1773
|
+
const i = ze(
|
|
1773
1774
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1774
1775
|
), a = Se(e, (s, c) => c.range.to - s.range.to)?.range?.to ?? 0;
|
|
1775
1776
|
return {
|
|
@@ -1777,17 +1778,17 @@ const H = (e) => Wt(e) ? e.slug : fe(e) ? e.linkId : e.linkId ?? oe(e.name), pn
|
|
|
1777
1778
|
absolute: a
|
|
1778
1779
|
};
|
|
1779
1780
|
}
|
|
1780
|
-
},
|
|
1781
|
+
}, vr = {
|
|
1781
1782
|
value: ({ value: e }) => e,
|
|
1782
1783
|
label: ({ name: e }) => e || "unknown",
|
|
1783
1784
|
selected: ({ selected: e }) => e,
|
|
1784
1785
|
quantity: ({ quantity: e }) => e
|
|
1785
|
-
},
|
|
1786
|
+
}, Or = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1786
1787
|
if (!n?.orderId)
|
|
1787
|
-
throw new
|
|
1788
|
+
throw new T("Missing orderId");
|
|
1788
1789
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1789
1790
|
};
|
|
1790
|
-
function
|
|
1791
|
+
function Sn(e) {
|
|
1791
1792
|
if (!e || e.status !== "pending")
|
|
1792
1793
|
return null;
|
|
1793
1794
|
for (const n of e.dimensionStatus) {
|
|
@@ -1805,53 +1806,53 @@ function mn(e) {
|
|
|
1805
1806
|
}
|
|
1806
1807
|
return null;
|
|
1807
1808
|
}
|
|
1808
|
-
function
|
|
1809
|
+
function Cr(e) {
|
|
1809
1810
|
if (!e || e.status !== "pending") return !1;
|
|
1810
1811
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1811
1812
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1812
1813
|
}
|
|
1813
|
-
const
|
|
1814
|
-
const r = await t.oms.processOrderAuthorization(n), i =
|
|
1814
|
+
const br = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1815
|
+
const r = await t.oms.processOrderAuthorization(n), i = Sn(r);
|
|
1815
1816
|
return {
|
|
1816
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1817
|
+
isPendingForOtherAuthorizer: !i && Cr(r),
|
|
1817
1818
|
ruleForAuthorization: i
|
|
1818
1819
|
};
|
|
1819
|
-
},
|
|
1820
|
+
}, wr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1820
1821
|
if (!n?.objectKey)
|
|
1821
|
-
throw new
|
|
1822
|
+
throw new T("Missing objectKey");
|
|
1822
1823
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
1823
1824
|
return t.orderEntry.startOperation({
|
|
1824
1825
|
objectKey: n.objectKey,
|
|
1825
1826
|
orderFormId: r,
|
|
1826
1827
|
sessionToken: n.sessionToken ?? void 0
|
|
1827
1828
|
});
|
|
1828
|
-
},
|
|
1829
|
+
}, Dr = async (e, n, t) => {
|
|
1829
1830
|
if (!(await t.clients.commerce.recommendation.startRecommendationSession())?.recommendationsUserId)
|
|
1830
1831
|
throw new Error(
|
|
1831
1832
|
"Failed to start recommendation session: no session data returned"
|
|
1832
1833
|
);
|
|
1833
1834
|
return !0;
|
|
1834
|
-
},
|
|
1835
|
+
}, Pr = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), Ar = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1835
1836
|
const { fileContent: r, fileName: i, mimeType: o } = n;
|
|
1836
1837
|
if (!r || !i || !o)
|
|
1837
|
-
throw new
|
|
1838
|
+
throw new T(
|
|
1838
1839
|
"Missing required fields: fileContent, fileName, mimeType"
|
|
1839
1840
|
);
|
|
1840
1841
|
const a = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
|
|
1841
1842
|
if (Math.floor(a.length * 3 / 4) > s)
|
|
1842
|
-
throw new
|
|
1843
|
+
throw new T("File exceeds maximum allowed size of 5MB");
|
|
1843
1844
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
|
|
1844
1845
|
a
|
|
1845
1846
|
))
|
|
1846
|
-
throw new
|
|
1847
|
-
const
|
|
1847
|
+
throw new T("Invalid Base64 fileContent");
|
|
1848
|
+
const u = Buffer.from(a, "base64");
|
|
1848
1849
|
return await t.orderEntry.uploadFile({
|
|
1849
|
-
fileBuffer:
|
|
1850
|
+
fileBuffer: u,
|
|
1850
1851
|
fileName: i,
|
|
1851
1852
|
mimeType: o
|
|
1852
1853
|
});
|
|
1853
1854
|
};
|
|
1854
|
-
class
|
|
1855
|
+
class ee {
|
|
1855
1856
|
static parse(n) {
|
|
1856
1857
|
try {
|
|
1857
1858
|
const t = JSON.parse(n);
|
|
@@ -1869,23 +1870,30 @@ class ae {
|
|
|
1869
1870
|
return JSON.stringify(n);
|
|
1870
1871
|
}
|
|
1871
1872
|
}
|
|
1872
|
-
|
|
1873
|
-
e.
|
|
1874
|
-
|
|
1873
|
+
function kr(e, n) {
|
|
1874
|
+
return n == null || n === "" || String(n) === String(e.salesChannel ?? "") ? null : ee.stringify({
|
|
1875
|
+
...e,
|
|
1876
|
+
salesChannel: String(n),
|
|
1877
|
+
hasOnlyDefaultSalesChannel: !1
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
const se = (e, n) => {
|
|
1881
|
+
e.storage.channel = ee.parse(n);
|
|
1882
|
+
}, ye = (e, n) => {
|
|
1875
1883
|
e.storage.locale = n;
|
|
1876
|
-
},
|
|
1884
|
+
}, yn = (e) => jn.createHash("md5").update(e).digest("hex"), ne = {
|
|
1877
1885
|
attachment: "ATTACHMENT",
|
|
1878
1886
|
specification: "SPECIFICATION",
|
|
1879
1887
|
attribute: "ATTRIBUTE"
|
|
1880
1888
|
};
|
|
1881
|
-
function
|
|
1889
|
+
function In(e) {
|
|
1882
1890
|
return {
|
|
1883
1891
|
name: e.name,
|
|
1884
1892
|
value: e.content,
|
|
1885
1893
|
valueReference: ne.attachment
|
|
1886
1894
|
};
|
|
1887
1895
|
}
|
|
1888
|
-
function
|
|
1896
|
+
function Ur(e) {
|
|
1889
1897
|
return {
|
|
1890
1898
|
propertyID: e.id,
|
|
1891
1899
|
name: e.name,
|
|
@@ -1896,12 +1904,12 @@ function br(e) {
|
|
|
1896
1904
|
}
|
|
1897
1905
|
};
|
|
1898
1906
|
}
|
|
1899
|
-
function
|
|
1900
|
-
return
|
|
1907
|
+
function vn(e) {
|
|
1908
|
+
return yn(
|
|
1901
1909
|
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
1902
1910
|
);
|
|
1903
1911
|
}
|
|
1904
|
-
const
|
|
1912
|
+
const Tr = (e) => {
|
|
1905
1913
|
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
1906
1914
|
addressType: e.addressType || null,
|
|
1907
1915
|
postalCode: n || null,
|
|
@@ -1920,7 +1928,7 @@ const wr = (e) => {
|
|
|
1920
1928
|
r.geoCoordinates = i !== null && o !== null ? [o, i] : [];
|
|
1921
1929
|
}
|
|
1922
1930
|
return [r];
|
|
1923
|
-
},
|
|
1931
|
+
}, _r = (e, n, t) => {
|
|
1924
1932
|
const r = n.postalCode, i = n.geoCoordinates, o = e?.shippingData?.availableAddresses ?? [], a = e?.shippingData?.selectedAddresses ?? [];
|
|
1925
1933
|
if (!t && a.length > 0)
|
|
1926
1934
|
return [a[0]];
|
|
@@ -1934,32 +1942,32 @@ const wr = (e) => {
|
|
|
1934
1942
|
return [s];
|
|
1935
1943
|
}
|
|
1936
1944
|
return null;
|
|
1937
|
-
},
|
|
1938
|
-
if (!
|
|
1945
|
+
}, On = (e, n) => {
|
|
1946
|
+
if (!Er(n))
|
|
1939
1947
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1940
|
-
if (!
|
|
1948
|
+
if (!Lr(e))
|
|
1941
1949
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1942
1950
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
1943
|
-
if (
|
|
1951
|
+
if (Rr(t, n.postalCode) || Fr(t, n.geoCoordinates) || Nr(t, n.addressType))
|
|
1944
1952
|
return { updateShipping: !0, addressChanged: !0 };
|
|
1945
1953
|
const { logisticsInfo: r } = e.shippingData;
|
|
1946
|
-
return
|
|
1947
|
-
},
|
|
1954
|
+
return Br(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
1955
|
+
}, Er = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, Rr = (e, n) => typeof n == "string" && e?.postalCode !== n, Fr = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), Nr = (e, n) => typeof n == "string" && e?.addressType !== n, Lr = (e) => e.items.length !== 0, Br = (e, n) => {
|
|
1948
1956
|
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: o } = n?.deliveryMode?.deliveryWindow || {};
|
|
1949
1957
|
return e.some(
|
|
1950
1958
|
({ selectedDeliveryChannel: a, selectedSla: s, slas: c }) => {
|
|
1951
|
-
const
|
|
1952
|
-
return c?.some((
|
|
1953
|
-
(
|
|
1959
|
+
const d = t && a !== t, u = r && s !== r;
|
|
1960
|
+
return c?.some((p) => d && p.deliveryChannel === t || u && p.id === r ? !0 : i && o && p.deliveryChannel === t && p.id === r && (!p?.deliveryWindow || p?.deliveryWindow?.startDateUtc !== i || p?.deliveryWindow?.endDateUtc !== o) && p.availableDeliveryWindows?.some(
|
|
1961
|
+
(f) => f?.startDateUtc === i && f?.endDateUtc === o
|
|
1954
1962
|
));
|
|
1955
1963
|
}
|
|
1956
1964
|
);
|
|
1957
|
-
},
|
|
1965
|
+
}, Cn = (e) => e.valueReference === ne.attachment, Ie = (e) => [
|
|
1958
1966
|
e.itemOffered.sku,
|
|
1959
1967
|
e.seller.identifier,
|
|
1960
1968
|
e.price < 0.01 ? "Gift" : void 0,
|
|
1961
|
-
e.itemOffered.additionalProperty?.filter(
|
|
1962
|
-
].filter(Boolean).join("::"),
|
|
1969
|
+
e.itemOffered.additionalProperty?.filter(Cn).map(vn).join("-")
|
|
1970
|
+
].filter(Boolean).join("::"), ce = (e, n) => ({
|
|
1963
1971
|
listPrice: e.listPrice / 100,
|
|
1964
1972
|
price: e.sellingPrice / 100,
|
|
1965
1973
|
quantity: e.quantity,
|
|
@@ -1968,46 +1976,46 @@ const wr = (e) => {
|
|
|
1968
1976
|
sku: e.id,
|
|
1969
1977
|
image: [],
|
|
1970
1978
|
name: e.name,
|
|
1971
|
-
additionalProperty: e.attachments.map(
|
|
1979
|
+
additionalProperty: e.attachments.map(In)
|
|
1972
1980
|
},
|
|
1973
1981
|
index: n
|
|
1974
|
-
}),
|
|
1982
|
+
}), $r = (e) => ({
|
|
1975
1983
|
quantity: e.quantity,
|
|
1976
1984
|
seller: e.seller.identifier,
|
|
1977
1985
|
id: e.itemOffered.sku,
|
|
1978
1986
|
index: e.index,
|
|
1979
|
-
attachments: (e.itemOffered.additionalProperty?.filter(
|
|
1987
|
+
attachments: (e.itemOffered.additionalProperty?.filter(Cn) ?? []).map((n) => ({
|
|
1980
1988
|
name: n.name,
|
|
1981
1989
|
content: n.value
|
|
1982
1990
|
})),
|
|
1983
1991
|
...e.priceToken ? { priceToken: e.priceToken } : {}
|
|
1984
|
-
}),
|
|
1985
|
-
const r =
|
|
1992
|
+
}), qe = (e) => e.reduce((n, t) => {
|
|
1993
|
+
const r = Ie(t);
|
|
1986
1994
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
1987
|
-
}, /* @__PURE__ */ new Map()),
|
|
1988
|
-
const t = ({ priceToken: s, ...c },
|
|
1995
|
+
}, /* @__PURE__ */ new Map()), Mr = (e, n) => {
|
|
1996
|
+
const t = ({ priceToken: s, ...c }, d) => ({
|
|
1989
1997
|
...c,
|
|
1990
1998
|
itemOffered: {
|
|
1991
1999
|
sku: c.itemOffered.sku
|
|
1992
2000
|
},
|
|
1993
|
-
index:
|
|
1994
|
-
}), r = n.items.map(
|
|
2001
|
+
index: d
|
|
2002
|
+
}), r = n.items.map(ce).map(t), i = e.acceptedOffer.map(t), o = e.orderNumber === n.orderFormId, a = De(r, i);
|
|
1995
2003
|
return o && a;
|
|
1996
2004
|
};
|
|
1997
|
-
function
|
|
2005
|
+
function bn(e, n) {
|
|
1998
2006
|
return e?.some(
|
|
1999
2007
|
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 && e[t.parentItemIndex]?.id === n
|
|
2000
2008
|
);
|
|
2001
2009
|
}
|
|
2002
|
-
function
|
|
2010
|
+
function wn(e, n) {
|
|
2003
2011
|
return e?.some(
|
|
2004
2012
|
(t) => t.id === n && t.parentItemIndex !== null
|
|
2005
2013
|
);
|
|
2006
2014
|
}
|
|
2007
|
-
const
|
|
2015
|
+
const je = (e) => {
|
|
2008
2016
|
const n = e.items.reduce(
|
|
2009
2017
|
(t, r, i) => {
|
|
2010
|
-
const o =
|
|
2018
|
+
const o = wn(e.items, r.id) || bn(e.items, r.id) ? `${Ie(ce(r))}::${i}` : Ie(ce(r));
|
|
2011
2019
|
return t[o] || (t[o] = []), t[o].push(r), t;
|
|
2012
2020
|
},
|
|
2013
2021
|
{}
|
|
@@ -2026,20 +2034,21 @@ const qe = (e) => {
|
|
|
2026
2034
|
};
|
|
2027
2035
|
})
|
|
2028
2036
|
};
|
|
2029
|
-
},
|
|
2037
|
+
}, ve = async (e, n, t, r) => ({
|
|
2030
2038
|
order: {
|
|
2031
2039
|
orderNumber: e.orderFormId,
|
|
2032
|
-
acceptedOffer: e.items.map(async (
|
|
2033
|
-
...
|
|
2034
|
-
product: await n.load(`${
|
|
2040
|
+
acceptedOffer: e.items.map(async (i) => ({
|
|
2041
|
+
...i,
|
|
2042
|
+
product: await n.load(`${i.id}-invisibleItems`)
|
|
2035
2043
|
})),
|
|
2036
|
-
shouldSplitItem: t
|
|
2044
|
+
shouldSplitItem: t,
|
|
2045
|
+
...r ? { salesChannel: r } : {}
|
|
2037
2046
|
},
|
|
2038
|
-
messages: e.messages.map(({ text:
|
|
2039
|
-
text:
|
|
2040
|
-
status:
|
|
2047
|
+
messages: e.messages.map(({ text: i, status: o }) => ({
|
|
2048
|
+
text: i,
|
|
2049
|
+
status: o.toUpperCase()
|
|
2041
2050
|
}))
|
|
2042
|
-
}),
|
|
2051
|
+
}), Dn = ({ items: e }, n) => {
|
|
2043
2052
|
const t = e.map((r) => ({
|
|
2044
2053
|
id: r.id,
|
|
2045
2054
|
quantity: r.quantity,
|
|
@@ -2047,7 +2056,7 @@ const qe = (e) => {
|
|
|
2047
2056
|
attachments: r.attachments
|
|
2048
2057
|
// customizations
|
|
2049
2058
|
}));
|
|
2050
|
-
return
|
|
2059
|
+
return yn(
|
|
2051
2060
|
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
2052
2061
|
);
|
|
2053
2062
|
}, We = async (e, n, t) => {
|
|
@@ -2056,7 +2065,7 @@ const qe = (e) => {
|
|
|
2056
2065
|
id: e.orderFormId,
|
|
2057
2066
|
appId: "faststore",
|
|
2058
2067
|
key: "cartEtag",
|
|
2059
|
-
value:
|
|
2068
|
+
value: Dn(e, t)
|
|
2060
2069
|
});
|
|
2061
2070
|
} catch (r) {
|
|
2062
2071
|
throw console.error(
|
|
@@ -2066,22 +2075,22 @@ const qe = (e) => {
|
|
|
2066
2075
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
2067
2076
|
), r;
|
|
2068
2077
|
}
|
|
2069
|
-
},
|
|
2078
|
+
}, zr = (e, n) => {
|
|
2070
2079
|
const r = e.customData?.customApps.find(
|
|
2071
2080
|
(o) => o.id === "faststore"
|
|
2072
2081
|
)?.fields?.cartEtag;
|
|
2073
|
-
return r == null ? !0 :
|
|
2074
|
-
},
|
|
2082
|
+
return r == null ? !0 : Dn(e, n) !== r;
|
|
2083
|
+
}, Vr = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
2075
2084
|
id: e
|
|
2076
2085
|
}), Ge = async (e, n, { clients: { commerce: t } }) => {
|
|
2077
2086
|
if (!n)
|
|
2078
2087
|
return e;
|
|
2079
|
-
const { updateShipping: r, addressChanged: i } =
|
|
2088
|
+
const { updateShipping: r, addressChanged: i } = On(
|
|
2080
2089
|
e,
|
|
2081
2090
|
n
|
|
2082
2091
|
);
|
|
2083
2092
|
if (r) {
|
|
2084
|
-
const o =
|
|
2093
|
+
const o = _r(e, n, i), s = o || Tr(n);
|
|
2085
2094
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
2086
2095
|
{
|
|
2087
2096
|
id: e.orderFormId,
|
|
@@ -2101,116 +2110,159 @@ const qe = (e) => {
|
|
|
2101
2110
|
);
|
|
2102
2111
|
}
|
|
2103
2112
|
return e;
|
|
2104
|
-
},
|
|
2113
|
+
}, xr = (e, n) => {
|
|
2105
2114
|
if (!e)
|
|
2106
2115
|
return "";
|
|
2107
|
-
const r =
|
|
2116
|
+
const r = Q(e)[n];
|
|
2108
2117
|
return r ? r.split("=")[1] : "";
|
|
2109
|
-
},
|
|
2110
|
-
const
|
|
2118
|
+
}, He = (e, n) => {
|
|
2119
|
+
const t = kr(
|
|
2120
|
+
e.storage.channel,
|
|
2121
|
+
n.salesChannel
|
|
2122
|
+
);
|
|
2123
|
+
return t ? (se(e, t), n.salesChannel ? String(n.salesChannel) : null) : null;
|
|
2124
|
+
}, Xe = (e, n, t, r) => r ? ve(e, n, t, r) : null, qr = async (e, { cart: { order: n }, session: t }, r) => {
|
|
2125
|
+
const i = xr(
|
|
2111
2126
|
r.headers.cookie,
|
|
2112
2127
|
"checkout.vtex.com"
|
|
2113
2128
|
), {
|
|
2114
2129
|
clients: { commerce: o },
|
|
2115
2130
|
loaders: { skuLoader: a }
|
|
2116
2131
|
} = r, s = t?.channel, c = t?.locale;
|
|
2117
|
-
s &&
|
|
2118
|
-
const
|
|
2119
|
-
id:
|
|
2120
|
-
channel: r.storage.channel
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2132
|
+
s && se(r, s), c && ye(r, c);
|
|
2133
|
+
const d = i || void 0, u = await o.checkout.orderForm({
|
|
2134
|
+
id: d,
|
|
2135
|
+
channel: r.storage.channel,
|
|
2136
|
+
preserveSalesChannel: !!d
|
|
2137
|
+
}), p = u.orderFormId;
|
|
2138
|
+
u.messages.length !== 0 && await Vr(p, r);
|
|
2139
|
+
const f = Q(r?.headers?.cookie ?? "")?.vtex_session, h = X(f), { acceptedOffer: v, shouldSplitItem: l } = n;
|
|
2140
|
+
if (zr(u, h)) {
|
|
2141
|
+
const C = He(
|
|
2142
|
+
r,
|
|
2143
|
+
u
|
|
2144
|
+
), N = await We(
|
|
2145
|
+
u,
|
|
2127
2146
|
o,
|
|
2128
2147
|
h
|
|
2129
|
-
).then(
|
|
2130
|
-
if (
|
|
2131
|
-
return
|
|
2148
|
+
).then(je);
|
|
2149
|
+
if (p)
|
|
2150
|
+
return ve(
|
|
2151
|
+
N,
|
|
2152
|
+
a,
|
|
2153
|
+
l,
|
|
2154
|
+
C
|
|
2155
|
+
);
|
|
2132
2156
|
}
|
|
2133
|
-
const
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
const
|
|
2139
|
-
if (
|
|
2140
|
-
return
|
|
2141
|
-
const
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2157
|
+
const m = He(
|
|
2158
|
+
r,
|
|
2159
|
+
u
|
|
2160
|
+
), S = qe(v), O = qe(u.items.map(ce)), w = Array.from(O.entries()), b = Array.from(S.entries()), { itemsToAdd: U, itemsToUpdate: I } = b.reduce(
|
|
2161
|
+
(C, [N, Pe]) => {
|
|
2162
|
+
const Ae = O.get(N);
|
|
2163
|
+
if (!Ae)
|
|
2164
|
+
return Pe.forEach((x) => C.itemsToAdd.push(x)), C;
|
|
2165
|
+
const [te, ...En] = Ae;
|
|
2166
|
+
if (wn(u.items, te.itemOffered.sku) || bn(u.items, te.itemOffered.sku))
|
|
2167
|
+
return C.itemsToUpdate.push(te), C;
|
|
2168
|
+
const Rn = Pe.reduce((x, Fn) => x + Fn.quantity, 0);
|
|
2169
|
+
return C.itemsToUpdate.push({
|
|
2170
|
+
...te,
|
|
2171
|
+
quantity: Rn
|
|
2172
|
+
}), En.forEach((x) => C.itemsToUpdate.push({ ...x, quantity: 0 })), C;
|
|
2146
2173
|
},
|
|
2147
2174
|
{
|
|
2148
2175
|
itemsToAdd: [],
|
|
2149
2176
|
itemsToUpdate: []
|
|
2150
2177
|
}
|
|
2151
|
-
),
|
|
2152
|
-
|
|
2153
|
-
), { updateShipping:
|
|
2154
|
-
if (
|
|
2155
|
-
return
|
|
2178
|
+
), D = w.filter(([C]) => !S.has(C)).flatMap(([, C]) => C.map((N) => ({ ...N, quantity: 0 }))), P = [...U, ...I, ...D].map(
|
|
2179
|
+
$r
|
|
2180
|
+
), { updateShipping: k } = t ? On(u, t) : { updateShipping: !1 };
|
|
2181
|
+
if (P.length === 0 && !k)
|
|
2182
|
+
return Xe(
|
|
2183
|
+
u,
|
|
2184
|
+
a,
|
|
2185
|
+
l,
|
|
2186
|
+
m
|
|
2187
|
+
);
|
|
2156
2188
|
let A;
|
|
2157
|
-
|
|
2158
|
-
id:
|
|
2159
|
-
orderItems:
|
|
2160
|
-
shouldSplitItem:
|
|
2189
|
+
P.length > 0 ? A = await o.checkout.updateOrderFormItems({
|
|
2190
|
+
id: u.orderFormId,
|
|
2191
|
+
orderItems: P,
|
|
2192
|
+
shouldSplitItem: l
|
|
2161
2193
|
}).then(
|
|
2162
|
-
(
|
|
2194
|
+
(C) => Ge(C, t, r)
|
|
2163
2195
|
) : A = await Ge(
|
|
2164
|
-
|
|
2196
|
+
u,
|
|
2165
2197
|
t,
|
|
2166
2198
|
r
|
|
2167
|
-
), A = await Promise.resolve(A).then((
|
|
2199
|
+
), A = await Promise.resolve(A).then((C) => {
|
|
2168
2200
|
if (t?.marketingData) {
|
|
2169
|
-
const
|
|
2170
|
-
...
|
|
2201
|
+
const N = {
|
|
2202
|
+
...C.marketingData,
|
|
2171
2203
|
...t.marketingData
|
|
2172
2204
|
};
|
|
2173
2205
|
return o.checkout.marketingData({
|
|
2174
|
-
id:
|
|
2175
|
-
marketingData:
|
|
2206
|
+
id: u.orderFormId,
|
|
2207
|
+
marketingData: N
|
|
2176
2208
|
});
|
|
2177
2209
|
}
|
|
2178
|
-
return
|
|
2179
|
-
}).then((
|
|
2180
|
-
id:
|
|
2210
|
+
return C;
|
|
2211
|
+
}).then((C) => c && C.clientPreferencesData?.locale !== c ? o.checkout.clientPreferencesData({
|
|
2212
|
+
id: C.orderFormId,
|
|
2181
2213
|
clientPreferencesData: {
|
|
2182
|
-
...
|
|
2214
|
+
...C.clientPreferencesData,
|
|
2183
2215
|
locale: c
|
|
2184
2216
|
}
|
|
2185
|
-
}) :
|
|
2186
|
-
const
|
|
2187
|
-
|
|
2217
|
+
}) : C).then((C) => We(C, o, h)).then(je);
|
|
2218
|
+
const R = De(
|
|
2219
|
+
u.messages,
|
|
2188
2220
|
A.messages
|
|
2189
2221
|
);
|
|
2190
|
-
return
|
|
2191
|
-
|
|
2222
|
+
return Mr(n, A) && R ? Xe(
|
|
2223
|
+
A,
|
|
2224
|
+
a,
|
|
2225
|
+
l,
|
|
2226
|
+
m
|
|
2227
|
+
) : ve(
|
|
2228
|
+
A,
|
|
2229
|
+
a,
|
|
2230
|
+
l,
|
|
2231
|
+
m
|
|
2232
|
+
);
|
|
2233
|
+
};
|
|
2234
|
+
function jr(e, n, t, r) {
|
|
2235
|
+
const i = e.hasOnlyDefaultSalesChannel === !1, o = n ?? void 0, a = t ?? e.regionId;
|
|
2236
|
+
return ee.stringify({
|
|
2237
|
+
salesChannel: i ? e.salesChannel || o : o ?? e.salesChannel,
|
|
2238
|
+
regionId: a ?? void 0,
|
|
2239
|
+
seller: r,
|
|
2240
|
+
hasOnlyDefaultSalesChannel: i ? !1 : !o
|
|
2241
|
+
});
|
|
2242
|
+
}
|
|
2243
|
+
const Wr = (e) => {
|
|
2192
2244
|
const n = (e?.corporateName ?? "").trim();
|
|
2193
2245
|
return n || (e?.firstName ?? "").trim();
|
|
2194
|
-
},
|
|
2246
|
+
}, Gr = (e) => {
|
|
2195
2247
|
if (!e || typeof e != "object")
|
|
2196
2248
|
return !1;
|
|
2197
2249
|
const n = e;
|
|
2198
2250
|
return typeof n.customerId == "string" && n.customerId.trim() !== "" && typeof n.contractName == "string" && typeof n.isActive == "boolean" && typeof n.isCurrent == "boolean";
|
|
2199
|
-
},
|
|
2251
|
+
}, Hr = (e) => {
|
|
2200
2252
|
const n = e?.availableContracts?.value;
|
|
2201
|
-
return Array.isArray(n) ? n.filter(
|
|
2202
|
-
},
|
|
2253
|
+
return Array.isArray(n) ? n.filter(Gr) : [];
|
|
2254
|
+
}, Xr = (e) => e?.customerId ? !!((e.contractName ?? "").trim() && e.isActive) : !1, Ye = (e) => e?.namespaces?.shopper?.activeContractId?.value?.trim() ?? e?.namespaces?.authentication?.customerId?.value?.trim() ?? e?.namespaces?.profile?.id?.value?.trim() ?? "", Yr = (e, n = "") => {
|
|
2203
2255
|
const t = n.trim();
|
|
2204
|
-
return e.filter(
|
|
2256
|
+
return e.filter(Xr).map((r) => ({
|
|
2205
2257
|
id: r.customerId,
|
|
2206
2258
|
corporateName: r.contractName.trim(),
|
|
2207
2259
|
isActive: t ? r.customerId === t : r.isCurrent
|
|
2208
2260
|
}));
|
|
2209
|
-
},
|
|
2210
|
-
const t =
|
|
2261
|
+
}, Pn = (e, n) => {
|
|
2262
|
+
const t = Wr(e);
|
|
2211
2263
|
return t || (n?.firstName?.value ?? "").trim();
|
|
2212
2264
|
};
|
|
2213
|
-
async function
|
|
2265
|
+
async function Jr(e, n, t) {
|
|
2214
2266
|
try {
|
|
2215
2267
|
const r = await e.commerce.checkout.address({
|
|
2216
2268
|
postalCode: t,
|
|
@@ -2227,134 +2279,184 @@ async function qr(e, n, t) {
|
|
|
2227
2279
|
), r;
|
|
2228
2280
|
}
|
|
2229
2281
|
}
|
|
2230
|
-
|
|
2231
|
-
const a =
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2282
|
+
function Kr(e, n, t, r, i, o) {
|
|
2283
|
+
const a = new URLSearchParams(e);
|
|
2284
|
+
return a.has("facets") && a.delete("facets"), a.set("sc", a.get("sc") ?? n.salesChannel), t && a.set("postalCode", t), r && a.set("country", r), i && a.set(
|
|
2285
|
+
"geoCoordinates",
|
|
2286
|
+
`${i.longitude},${i.latitude}`
|
|
2287
|
+
// long,lat is the format expected
|
|
2288
|
+
), a.set("locale", o), a;
|
|
2289
|
+
}
|
|
2290
|
+
function Qr(e, n) {
|
|
2291
|
+
return {
|
|
2292
|
+
utmCampaign: e.get("utm_campaign") ?? n?.utmCampaign ?? "",
|
|
2293
|
+
utmMedium: e.get("utm_medium") ?? n?.utmMedium ?? "",
|
|
2294
|
+
utmSource: e.get("utm_source") ?? n?.utmSource ?? "",
|
|
2295
|
+
utmiCampaign: e.get("utmi_cp") ?? n?.utmiCampaign ?? "",
|
|
2296
|
+
utmiPage: e.get("utmi_p") ?? n?.utmiPage ?? "",
|
|
2297
|
+
utmiPart: e.get("utmi_pc") ?? n?.utmiPart ?? ""
|
|
2298
|
+
};
|
|
2299
|
+
}
|
|
2300
|
+
async function Zr(e, n, t) {
|
|
2301
|
+
const r = X(z(n ?? "", t));
|
|
2302
|
+
let i = !1;
|
|
2303
|
+
if (r)
|
|
2304
|
+
try {
|
|
2305
|
+
i = (await e.commerce.vtexid.validate())?.authStatus?.toLowerCase() === "success";
|
|
2306
|
+
} catch (o) {
|
|
2307
|
+
console.warn("JWT validation failed:", o), i = !1;
|
|
2308
|
+
}
|
|
2309
|
+
return {
|
|
2310
|
+
isRepresentative: i ? !!r?.isRepresentative : !1,
|
|
2311
|
+
customerId: i ? r?.customerId : void 0,
|
|
2312
|
+
unitId: i ? r?.unitId : void 0
|
|
2313
|
+
};
|
|
2314
|
+
}
|
|
2315
|
+
async function ei(e, n, t, r, i, o) {
|
|
2316
|
+
return !n.seller || !(t || r) ? void 0 : (await e.commerce.checkout.region({
|
|
2317
|
+
postalCode: t,
|
|
2318
|
+
geoCoordinates: r,
|
|
2319
|
+
country: i,
|
|
2320
|
+
salesChannel: o
|
|
2321
|
+
}))?.[0]?.sellers.find((c) => n.seller === c.id)?.id;
|
|
2322
|
+
}
|
|
2323
|
+
function Je(e) {
|
|
2324
|
+
return typeof e?.value == "string" ? e.value : "";
|
|
2325
|
+
}
|
|
2326
|
+
function ni(e) {
|
|
2327
|
+
if (!e.isRepresentative)
|
|
2328
|
+
return null;
|
|
2329
|
+
const n = Je(e.shopper?.firstName), t = Je(e.shopper?.lastName);
|
|
2330
|
+
return {
|
|
2331
|
+
isRepresentative: !0,
|
|
2332
|
+
customerId: e.authentication?.customerId?.value ?? e.customerId ?? "",
|
|
2333
|
+
unitName: e.authentication?.unitName?.value ?? "",
|
|
2334
|
+
unitId: e.authentication?.unitId?.value ?? e.unitId ?? "",
|
|
2335
|
+
firstName: n,
|
|
2336
|
+
lastName: t,
|
|
2337
|
+
userName: `${n} ${t}`.trim(),
|
|
2338
|
+
userEmail: e.authentication?.storeUserEmail?.value ?? "",
|
|
2339
|
+
savedPostalCode: e.publicData?.postalCode?.value ?? "",
|
|
2340
|
+
contractName: Pn(e.contract, e.profile),
|
|
2341
|
+
organizationManager: e.shopper?.organizationManager?.value ?? !1
|
|
2342
|
+
};
|
|
2343
|
+
}
|
|
2344
|
+
function ti(e) {
|
|
2345
|
+
return e?.id ? {
|
|
2346
|
+
id: e.id?.value ?? "",
|
|
2347
|
+
email: e.email?.value ?? "",
|
|
2348
|
+
givenName: e.firstName?.value ?? "",
|
|
2349
|
+
familyName: e.lastName?.value ?? ""
|
|
2350
|
+
} : null;
|
|
2351
|
+
}
|
|
2352
|
+
const ri = async (e, { session: n, search: t }, { clients: r, headers: i, account: o }) => {
|
|
2353
|
+
const a = ee.parse(n.channel ?? ""), s = String(n.postalCode ?? ""), c = n.country ?? "";
|
|
2354
|
+
let d = n.city ?? null, u = n.geoCoordinates ?? null;
|
|
2355
|
+
if ((!d || !u) && s !== "" && c !== "") {
|
|
2356
|
+
const A = await Jr(
|
|
2235
2357
|
r,
|
|
2236
2358
|
c,
|
|
2237
2359
|
s
|
|
2238
2360
|
);
|
|
2239
|
-
|
|
2361
|
+
d = A.city, u = A.geoCoordinates;
|
|
2240
2362
|
}
|
|
2241
|
-
const
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
), h
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
utmiPart: h.get("utmi_pc") ?? v?.utmiPart ?? ""
|
|
2256
|
-
}, p = Y(z(i?.cookie ?? "", o));
|
|
2257
|
-
let m = !1;
|
|
2258
|
-
if (p)
|
|
2259
|
-
try {
|
|
2260
|
-
m = (await r.commerce.vtexid.validate())?.authStatus?.toLowerCase() === "success";
|
|
2261
|
-
} catch (E) {
|
|
2262
|
-
console.warn("JWT validation failed:", E), m = !1;
|
|
2263
|
-
}
|
|
2264
|
-
const y = m ? p?.isRepresentative : !1, O = m ? p?.customerId : void 0, w = m ? p?.unitId : void 0, C = await r.commerce.session(h.toString()).catch(() => null), P = C?.namespaces.profile ?? null, S = C?.namespaces.shopper ?? null, D = C?.namespaces.store ?? null, A = C?.namespaces.authentication ?? null, k = C?.namespaces.checkout ?? null, b = C?.namespaces.public ?? null;
|
|
2265
|
-
let U = null;
|
|
2266
|
-
if (y && P?.id?.value)
|
|
2363
|
+
const f = Kr(
|
|
2364
|
+
t,
|
|
2365
|
+
a,
|
|
2366
|
+
s,
|
|
2367
|
+
c,
|
|
2368
|
+
u,
|
|
2369
|
+
n.locale
|
|
2370
|
+
), h = Qr(f, n.marketingData), { isRepresentative: v, customerId: l, unitId: g } = await Zr(
|
|
2371
|
+
r,
|
|
2372
|
+
i?.cookie,
|
|
2373
|
+
o
|
|
2374
|
+
), m = await r.commerce.session(f.toString()).catch(() => null), S = m?.namespaces.profile ?? null, O = m?.namespaces.shopper ?? null, w = m?.namespaces.store ?? null, b = m?.namespaces.authentication ?? null, U = m?.namespaces.checkout ?? null, I = m?.namespaces.public ?? null;
|
|
2375
|
+
let D = null;
|
|
2376
|
+
if (v && S?.id?.value)
|
|
2267
2377
|
try {
|
|
2268
|
-
|
|
2269
|
-
contractId:
|
|
2378
|
+
D = await r.commerce.masterData.getContractById({
|
|
2379
|
+
contractId: S.id.value
|
|
2270
2380
|
});
|
|
2271
2381
|
} catch {
|
|
2272
2382
|
console.error(
|
|
2273
|
-
`Error while getting contract data for profile ID (${
|
|
2383
|
+
`Error while getting contract data for profile ID (${S.id.value}).
|
|
2274
2384
|
`
|
|
2275
2385
|
);
|
|
2276
2386
|
}
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2387
|
+
const P = await ei(
|
|
2388
|
+
r,
|
|
2389
|
+
a,
|
|
2390
|
+
s,
|
|
2391
|
+
u,
|
|
2392
|
+
c,
|
|
2393
|
+
f.get("sc") ?? a.salesChannel
|
|
2394
|
+
), k = {
|
|
2285
2395
|
...n,
|
|
2286
2396
|
currency: {
|
|
2287
|
-
code:
|
|
2288
|
-
symbol:
|
|
2397
|
+
code: w?.currencyCode?.value ?? n.currency.code,
|
|
2398
|
+
symbol: w?.currencySymbol?.value ?? n.currency.symbol
|
|
2289
2399
|
},
|
|
2290
|
-
country:
|
|
2291
|
-
channel:
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2400
|
+
country: w?.countryCode?.value ?? c,
|
|
2401
|
+
channel: jr(
|
|
2402
|
+
a,
|
|
2403
|
+
w?.channel?.value,
|
|
2404
|
+
U?.regionId?.value,
|
|
2405
|
+
P
|
|
2406
|
+
),
|
|
2297
2407
|
/**
|
|
2298
2408
|
* B2B data structure in Session:
|
|
2299
2409
|
* - Logged user data (shopper): `shopper` namespace
|
|
2300
2410
|
* - Unit data: `authentication` namespace
|
|
2301
2411
|
* - Contract data: `profile` namespace (those info will be available inside Faststore's Session `person` object)
|
|
2302
2412
|
*/
|
|
2303
|
-
b2b:
|
|
2304
|
-
isRepresentative:
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
person: P?.id ? {
|
|
2318
|
-
id: P.id?.value ?? "",
|
|
2319
|
-
email: P.email?.value ?? "",
|
|
2320
|
-
givenName: P.firstName?.value ?? "",
|
|
2321
|
-
familyName: P.lastName?.value ?? ""
|
|
2322
|
-
} : null,
|
|
2323
|
-
geoCoordinates: g?.latitude && g?.longitude && g || null,
|
|
2324
|
-
city: l
|
|
2413
|
+
b2b: ni({
|
|
2414
|
+
isRepresentative: v,
|
|
2415
|
+
authentication: b,
|
|
2416
|
+
shopper: O,
|
|
2417
|
+
publicData: I,
|
|
2418
|
+
profile: S,
|
|
2419
|
+
contract: D,
|
|
2420
|
+
customerId: l,
|
|
2421
|
+
unitId: g
|
|
2422
|
+
}),
|
|
2423
|
+
marketingData: h,
|
|
2424
|
+
person: ti(S),
|
|
2425
|
+
geoCoordinates: u?.latitude && u?.longitude && u || null,
|
|
2426
|
+
city: d
|
|
2325
2427
|
};
|
|
2326
|
-
return De(n,
|
|
2327
|
-
},
|
|
2328
|
-
validateCart:
|
|
2329
|
-
validateSession:
|
|
2330
|
-
subscribeToNewsletter:
|
|
2331
|
-
cancelOrder:
|
|
2332
|
-
processOrderAuthorization:
|
|
2333
|
-
uploadFileToOrderEntry:
|
|
2334
|
-
startOrderEntryOperation:
|
|
2335
|
-
startRecommendationSession:
|
|
2428
|
+
return De(n, k) ? null : k;
|
|
2429
|
+
}, ii = {
|
|
2430
|
+
validateCart: qr,
|
|
2431
|
+
validateSession: ri,
|
|
2432
|
+
subscribeToNewsletter: Pr,
|
|
2433
|
+
cancelOrder: Or,
|
|
2434
|
+
processOrderAuthorization: br,
|
|
2435
|
+
uploadFileToOrderEntry: Ar,
|
|
2436
|
+
startOrderEntryOperation: wr,
|
|
2437
|
+
startRecommendationSession: Dr
|
|
2336
2438
|
};
|
|
2337
2439
|
var Oe;
|
|
2338
2440
|
(function(e) {
|
|
2339
2441
|
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";
|
|
2340
2442
|
})(Oe || (Oe = {}));
|
|
2341
|
-
const
|
|
2342
|
-
function
|
|
2443
|
+
const oi = (e) => typeof e == "string" ? An(e) : null;
|
|
2444
|
+
function An(e) {
|
|
2343
2445
|
try {
|
|
2344
2446
|
return JSON.parse(e);
|
|
2345
2447
|
} catch {
|
|
2346
2448
|
return e;
|
|
2347
2449
|
}
|
|
2348
2450
|
}
|
|
2349
|
-
const
|
|
2451
|
+
const ai = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, si = new Bn({
|
|
2350
2452
|
name: "ObjectOrString",
|
|
2351
2453
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2352
|
-
parseValue:
|
|
2353
|
-
serialize:
|
|
2454
|
+
parseValue: oi,
|
|
2455
|
+
serialize: ai,
|
|
2354
2456
|
parseLiteral(e) {
|
|
2355
|
-
return e.kind === Oe.STRING ?
|
|
2457
|
+
return e.kind === Oe.STRING ? An(e.value) : null;
|
|
2356
2458
|
}
|
|
2357
|
-
}),
|
|
2459
|
+
}), _ = (e) => "Price" in e && "seller" in e && "product" in e, E = (e) => "skuName" in e, ci = {
|
|
2358
2460
|
priceCurrency: async (e, n, t) => {
|
|
2359
2461
|
const {
|
|
2360
2462
|
loaders: { salesChannelLoader: r },
|
|
@@ -2362,35 +2464,35 @@ const Hr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2362
2464
|
} = t;
|
|
2363
2465
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
2364
2466
|
},
|
|
2365
|
-
priceValidUntil: (e) =>
|
|
2467
|
+
priceValidUntil: (e) => _(e) ? e.PriceValidUntil ?? "" : E(e) ? e.priceValidUntil ?? "" : null,
|
|
2366
2468
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2367
|
-
availability: async (e) =>
|
|
2368
|
-
seller: (e, n, t) =>
|
|
2469
|
+
availability: async (e) => _(e) ? Le(L(e)) : E(e) ? Le(ar(e.availability)) : null,
|
|
2470
|
+
seller: (e, n, t) => _(e) ? {
|
|
2369
2471
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2370
|
-
} :
|
|
2472
|
+
} : E(e) ? {
|
|
2371
2473
|
identifier: e.seller
|
|
2372
2474
|
} : null,
|
|
2373
|
-
price: (e) =>
|
|
2374
|
-
priceWithTaxes: (e) =>
|
|
2475
|
+
price: (e) => _(e) ? V(e) : E(e) ? e.sellingPrice / 100 : null,
|
|
2476
|
+
priceWithTaxes: (e) => _(e) ? M(V(e), e?.Tax, e.product.unitMultiplier) : E(e) ? M(
|
|
2375
2477
|
e.sellingPrice / 100,
|
|
2376
2478
|
e.tax / 100,
|
|
2377
2479
|
e.unitMultiplier
|
|
2378
2480
|
) : null,
|
|
2379
|
-
sellingPrice: (e) =>
|
|
2380
|
-
listPrice: (e) =>
|
|
2381
|
-
listPriceWithTaxes: (e) =>
|
|
2481
|
+
sellingPrice: (e) => _(e) ? or(e) : E(e) ? e.sellingPrice / 100 : null,
|
|
2482
|
+
listPrice: (e) => _(e) ? e.ListPrice ?? 0 : E(e) ? e.listPrice / 100 : null,
|
|
2483
|
+
listPriceWithTaxes: (e) => _(e) ? M(
|
|
2382
2484
|
e.ListPrice ?? 0,
|
|
2383
2485
|
e?.Tax,
|
|
2384
2486
|
e.product.unitMultiplier
|
|
2385
|
-
) :
|
|
2386
|
-
itemOffered: (e) =>
|
|
2487
|
+
) : E(e) ? M(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
|
|
2488
|
+
itemOffered: (e) => _(e) ? e.product : E(e) ? {
|
|
2387
2489
|
...e.product,
|
|
2388
2490
|
attachmentsValues: e.attachments
|
|
2389
2491
|
} : null,
|
|
2390
|
-
quantity: (e) =>
|
|
2391
|
-
isGift: (e) =>
|
|
2392
|
-
priceToken: (e) =>
|
|
2393
|
-
},
|
|
2492
|
+
quantity: (e) => _(e) ? e.AvailableQuantity ?? 0 : E(e) ? e.quantity : null,
|
|
2493
|
+
isGift: (e) => E(e) ? e.isGift ?? !1 : null,
|
|
2494
|
+
priceToken: (e) => _(e) ? e.PriceToken ?? null : null
|
|
2495
|
+
}, li = ({ linkText: e }) => `/${e}/p`, di = ({
|
|
2394
2496
|
offer: e,
|
|
2395
2497
|
seller: n,
|
|
2396
2498
|
product: t
|
|
@@ -2398,11 +2500,11 @@ const Hr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2398
2500
|
...e,
|
|
2399
2501
|
product: t,
|
|
2400
2502
|
seller: n
|
|
2401
|
-
}),
|
|
2503
|
+
}), ui = {
|
|
2402
2504
|
imageText: "image",
|
|
2403
2505
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2404
2506
|
imageLabel: "label"
|
|
2405
|
-
},
|
|
2507
|
+
}, oe = (e, n) => `${e}-${n}`, Ke = (e, n) => `/${oe(e, n)}/p`, pi = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2406
2508
|
function Ce(e) {
|
|
2407
2509
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2408
2510
|
}
|
|
@@ -2428,18 +2530,18 @@ async function be(e, n, t) {
|
|
|
2428
2530
|
})();
|
|
2429
2531
|
return i.set(r, a), a;
|
|
2430
2532
|
}
|
|
2431
|
-
const
|
|
2533
|
+
const gi = (e, n) => {
|
|
2432
2534
|
const t = e.findIndex((r) => Ce(r).split("/").at(-1) === n);
|
|
2433
2535
|
return t < 0 ? 0 : t;
|
|
2434
|
-
},
|
|
2536
|
+
}, mi = {
|
|
2435
2537
|
productID: ({ itemId: e }) => e,
|
|
2436
2538
|
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2437
|
-
slug: ({ isVariantOf: { linkText: e }, itemId: n }) =>
|
|
2539
|
+
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => oe(e, n),
|
|
2438
2540
|
description: ({ isVariantOf: { description: e } }) => e,
|
|
2439
2541
|
seo: ({ isVariantOf: e }) => ({
|
|
2440
2542
|
title: e.productTitle || e.productName,
|
|
2441
2543
|
description: e.metaTagDescription || e.description,
|
|
2442
|
-
canonical:
|
|
2544
|
+
canonical: li(e)
|
|
2443
2545
|
}),
|
|
2444
2546
|
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2445
2547
|
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
@@ -2453,61 +2555,61 @@ const ei = (e, n) => {
|
|
|
2453
2555
|
categoriesIds: s,
|
|
2454
2556
|
productId: c
|
|
2455
2557
|
},
|
|
2456
|
-
itemId:
|
|
2457
|
-
} = e,
|
|
2458
|
-
if (
|
|
2459
|
-
const v = await be(t, c,
|
|
2558
|
+
itemId: d
|
|
2559
|
+
} = e, u = gi(s, a), p = r[u], f = Ce(p).split("/"), h = t.storage.locale;
|
|
2560
|
+
if (K(t) && h) {
|
|
2561
|
+
const v = await be(t, c, h);
|
|
2460
2562
|
if (v) {
|
|
2461
|
-
const
|
|
2462
|
-
Ce(s[
|
|
2463
|
-
),
|
|
2464
|
-
(
|
|
2563
|
+
const l = new Set(
|
|
2564
|
+
Ce(s[u]).split("/").filter(Boolean)
|
|
2565
|
+
), g = v.categories.filter((S) => l.has(S.id.toString())).sort(
|
|
2566
|
+
(S, O) => S.fullPath.split("/").length - O.fullPath.split("/").length
|
|
2465
2567
|
);
|
|
2466
|
-
if (
|
|
2568
|
+
if (g.length === f.length)
|
|
2467
2569
|
return {
|
|
2468
2570
|
itemListElement: [
|
|
2469
2571
|
// Category items: both name and slug come from Catalog Dataplane, ensuring
|
|
2470
2572
|
// they are always consistent with each other for the requested locale.
|
|
2471
|
-
...
|
|
2472
|
-
name:
|
|
2473
|
-
item: `/${
|
|
2573
|
+
...g.map((S, O) => ({
|
|
2574
|
+
name: S.name,
|
|
2575
|
+
item: `/${S.fullPathUriName}/`,
|
|
2474
2576
|
position: O + 1
|
|
2475
2577
|
})),
|
|
2476
2578
|
{
|
|
2477
2579
|
name: i,
|
|
2478
|
-
item:
|
|
2479
|
-
position:
|
|
2580
|
+
item: Ke(v.linkId, d),
|
|
2581
|
+
position: f.length + 1
|
|
2480
2582
|
}
|
|
2481
2583
|
],
|
|
2482
|
-
numberOfItems:
|
|
2584
|
+
numberOfItems: f.length
|
|
2483
2585
|
};
|
|
2484
2586
|
}
|
|
2485
2587
|
}
|
|
2486
2588
|
return {
|
|
2487
2589
|
itemListElement: [
|
|
2488
|
-
...
|
|
2489
|
-
const
|
|
2590
|
+
...f.map((v, l) => {
|
|
2591
|
+
const g = `/${f.slice(0, l + 1).map(ae).join("/")}/`;
|
|
2490
2592
|
return {
|
|
2491
2593
|
name: v,
|
|
2492
|
-
item:
|
|
2493
|
-
position:
|
|
2594
|
+
item: g,
|
|
2595
|
+
position: l + 1
|
|
2494
2596
|
};
|
|
2495
2597
|
}),
|
|
2496
2598
|
{
|
|
2497
2599
|
name: i,
|
|
2498
|
-
item:
|
|
2499
|
-
position:
|
|
2600
|
+
item: Ke(o, d),
|
|
2601
|
+
position: f.length + 1
|
|
2500
2602
|
}
|
|
2501
2603
|
],
|
|
2502
|
-
numberOfItems:
|
|
2604
|
+
numberOfItems: f.length
|
|
2503
2605
|
};
|
|
2504
2606
|
},
|
|
2505
2607
|
image: ({ images: e }, n) => {
|
|
2506
|
-
const t = (
|
|
2507
|
-
({ imageUrl: s, imageText: c, imageLabel:
|
|
2608
|
+
const t = (pi(e) ?? [ui]).map(
|
|
2609
|
+
({ imageUrl: s, imageText: c, imageLabel: d }) => ({
|
|
2508
2610
|
alternateName: c ?? "",
|
|
2509
2611
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
2510
|
-
keywords:
|
|
2612
|
+
keywords: d
|
|
2511
2613
|
})
|
|
2512
2614
|
);
|
|
2513
2615
|
if (typeof n != "object")
|
|
@@ -2526,12 +2628,12 @@ const ei = (e, n) => {
|
|
|
2526
2628
|
review: () => [],
|
|
2527
2629
|
aggregateRating: () => ({}),
|
|
2528
2630
|
offers: (e) => e.sellers.map(
|
|
2529
|
-
(n) =>
|
|
2631
|
+
(n) => di({
|
|
2530
2632
|
offer: n.commertialOffer,
|
|
2531
2633
|
seller: n,
|
|
2532
2634
|
product: e
|
|
2533
2635
|
})
|
|
2534
|
-
).sort(
|
|
2636
|
+
).sort(mn),
|
|
2535
2637
|
isVariantOf: (e) => e,
|
|
2536
2638
|
additionalProperty: ({
|
|
2537
2639
|
// Search uses the name variations for specifications
|
|
@@ -2546,8 +2648,8 @@ const ei = (e, n) => {
|
|
|
2546
2648
|
valueReference: ne.specification
|
|
2547
2649
|
}))
|
|
2548
2650
|
), i = n.map(
|
|
2549
|
-
|
|
2550
|
-
), o = t.map(
|
|
2651
|
+
In
|
|
2652
|
+
), o = t.map(Ur);
|
|
2551
2653
|
return [
|
|
2552
2654
|
...r,
|
|
2553
2655
|
...i,
|
|
@@ -2561,26 +2663,26 @@ const ei = (e, n) => {
|
|
|
2561
2663
|
advertisement: ({ isVariantOf: { advertisement: e } }) => e,
|
|
2562
2664
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e,
|
|
2563
2665
|
otherLocales: async (e, n, t) => {
|
|
2564
|
-
if (!
|
|
2565
|
-
const r =
|
|
2666
|
+
if (!K(t)) return null;
|
|
2667
|
+
const r = Ct(t);
|
|
2566
2668
|
if (r.length === 0) return null;
|
|
2567
|
-
const i = e.isVariantOf.productId, o = e.itemId, a = t.storage.locale, s =
|
|
2669
|
+
const i = e.isVariantOf.productId, o = e.itemId, a = t.storage.locale, s = bt(t), c = await be(t, i, a);
|
|
2568
2670
|
if (!c?.availableLinkIds) return null;
|
|
2569
|
-
const { availableLinkIds:
|
|
2570
|
-
return r.map((
|
|
2571
|
-
if (
|
|
2572
|
-
return { locale:
|
|
2573
|
-
const
|
|
2574
|
-
return
|
|
2575
|
-
}).filter((
|
|
2671
|
+
const { availableLinkIds: d } = c, { linkText: u } = e.isVariantOf;
|
|
2672
|
+
return r.map((p) => {
|
|
2673
|
+
if (p === s)
|
|
2674
|
+
return { locale: p, slug: oe(u, o) };
|
|
2675
|
+
const f = d[p];
|
|
2676
|
+
return f ? { locale: p, slug: oe(f, o) } : null;
|
|
2677
|
+
}).filter((p) => p !== null);
|
|
2576
2678
|
}
|
|
2577
|
-
},
|
|
2578
|
-
hasVariant: (e) => e.isVariantOf.items.map((n) =>
|
|
2679
|
+
}, hi = /* @__PURE__ */ new Set(["allSpecifications"]), fi = {
|
|
2680
|
+
hasVariant: (e) => e.isVariantOf.items.map((n) => F(n, e.isVariantOf)),
|
|
2579
2681
|
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
2580
2682
|
name: (e) => e.isVariantOf.productName,
|
|
2581
2683
|
skuVariants: (e) => e,
|
|
2582
2684
|
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
2583
|
-
(n) => !
|
|
2685
|
+
(n) => !hi.has(n.name)
|
|
2584
2686
|
).flatMap(
|
|
2585
2687
|
({ specifications: n }) => n.flatMap(
|
|
2586
2688
|
({ name: t, values: r }) => r.map((i) => ({
|
|
@@ -2590,12 +2692,12 @@ const ei = (e, n) => {
|
|
|
2590
2692
|
}))
|
|
2591
2693
|
)
|
|
2592
2694
|
)
|
|
2593
|
-
},
|
|
2594
|
-
propertyID: (e) => e.propertyID ||
|
|
2695
|
+
}, Si = {
|
|
2696
|
+
propertyID: (e) => e.propertyID || vn(e),
|
|
2595
2697
|
name: ({ name: e }) => e,
|
|
2596
2698
|
value: ({ value: e }) => e,
|
|
2597
2699
|
valueReference: ({ valueReference: e }) => e
|
|
2598
|
-
},
|
|
2700
|
+
}, le = (e) => {
|
|
2599
2701
|
const n = e.flatMap(
|
|
2600
2702
|
(r) => r.sellers.map((i) => ({
|
|
2601
2703
|
offer: i.commertialOffer,
|
|
@@ -2603,38 +2705,38 @@ const ei = (e, n) => {
|
|
|
2603
2705
|
}))
|
|
2604
2706
|
), t = Se(
|
|
2605
2707
|
n,
|
|
2606
|
-
({ offer: r }, { offer: i }) =>
|
|
2708
|
+
({ offer: r }, { offer: i }) => mn(r, i)
|
|
2607
2709
|
);
|
|
2608
2710
|
return t ? t.sku : e[0];
|
|
2609
|
-
},
|
|
2711
|
+
}, kn = (e) => e !== "" && !Number.isNaN(Number(e)), yi = /^vrn:recommendations:[^:]+:[^:]+:[^:]+$/, Ii = async (e, { campaignVrn: n, userId: t, products: r }, i) => {
|
|
2610
2712
|
const {
|
|
2611
2713
|
clients: { commerce: o }
|
|
2612
2714
|
} = i, { salesChannel: a } = i.storage.channel, s = n?.trim();
|
|
2613
|
-
if (!s || !
|
|
2614
|
-
throw new
|
|
2715
|
+
if (!s || !yi.test(s))
|
|
2716
|
+
throw new T(`Invalid campaignVrn: "${n}"`);
|
|
2615
2717
|
const c = t?.trim();
|
|
2616
2718
|
if (t != null && !c)
|
|
2617
|
-
throw new
|
|
2618
|
-
if (r != null && (!Array.isArray(r) || r.some((
|
|
2619
|
-
throw new
|
|
2719
|
+
throw new T("Invalid userId: must be a non-empty string");
|
|
2720
|
+
if (r != null && (!Array.isArray(r) || r.some((h) => !h?.trim())))
|
|
2721
|
+
throw new T(
|
|
2620
2722
|
"Invalid products: must be an array of non-empty strings"
|
|
2621
2723
|
);
|
|
2622
|
-
const
|
|
2724
|
+
const d = await o.recommendation.recommendations({
|
|
2623
2725
|
campaignVrn: s,
|
|
2624
2726
|
userId: c || void 0,
|
|
2625
2727
|
products: r ?? [],
|
|
2626
2728
|
salesChannel: a ?? void 0,
|
|
2627
2729
|
locale: i.storage.locale
|
|
2628
|
-
}), { campaign:
|
|
2730
|
+
}), { campaign: u, correlationId: p } = d;
|
|
2629
2731
|
return {
|
|
2630
|
-
products: (
|
|
2631
|
-
const v =
|
|
2632
|
-
return v ?
|
|
2633
|
-
}).filter((
|
|
2634
|
-
correlationId:
|
|
2635
|
-
campaign:
|
|
2732
|
+
products: (d.products ?? []).map((h) => {
|
|
2733
|
+
const v = le(h.items);
|
|
2734
|
+
return v ? F(v, h) : null;
|
|
2735
|
+
}).filter((h) => !!h),
|
|
2736
|
+
correlationId: p,
|
|
2737
|
+
campaign: u
|
|
2636
2738
|
};
|
|
2637
|
-
},
|
|
2739
|
+
}, Qe = {
|
|
2638
2740
|
price_desc: "price:desc",
|
|
2639
2741
|
price_asc: "price:asc",
|
|
2640
2742
|
orders_desc: "orders:desc",
|
|
@@ -2643,13 +2745,13 @@ const ei = (e, n) => {
|
|
|
2643
2745
|
release_desc: "release:desc",
|
|
2644
2746
|
discount_desc: "discount:desc",
|
|
2645
2747
|
score_desc: ""
|
|
2646
|
-
},
|
|
2748
|
+
}, vi = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
2647
2749
|
if (!n)
|
|
2648
|
-
throw new
|
|
2750
|
+
throw new T("Missing operationId");
|
|
2649
2751
|
return t.orderEntry.getOperation({ operationId: n });
|
|
2650
|
-
},
|
|
2752
|
+
}, Oi = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
2651
2753
|
if (!n)
|
|
2652
|
-
throw new
|
|
2754
|
+
throw new T("Missing orderFormId");
|
|
2653
2755
|
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
2654
2756
|
return (r ?? []).map((i) => ({
|
|
2655
2757
|
id: i.id,
|
|
@@ -2663,19 +2765,19 @@ const ei = (e, n) => {
|
|
|
2663
2765
|
unitMultiplier: i.unitMultiplier ?? 1
|
|
2664
2766
|
}));
|
|
2665
2767
|
};
|
|
2666
|
-
async function
|
|
2768
|
+
async function Ci(e, n, t, r) {
|
|
2667
2769
|
const i = n.slice(0, n.lastIndexOf("-"));
|
|
2668
2770
|
return (await be(e, t, r))?.linkId === i;
|
|
2669
2771
|
}
|
|
2670
|
-
const
|
|
2671
|
-
async function
|
|
2772
|
+
const Un = "Invalid SkuId", Tn = "Slug was set but the fetched sku does not satisfy the slug condition.", bi = (e) => H(e) || e instanceof Error && (e.message === Un || e.message.startsWith(Tn));
|
|
2773
|
+
async function wi(e, n, t, r) {
|
|
2672
2774
|
const { linkText: i, productId: o } = n.isVariantOf;
|
|
2673
|
-
if (!(!t || !i || t.startsWith(i) ||
|
|
2674
|
-
throw new Error(`${
|
|
2775
|
+
if (!(!t || !i || t.startsWith(i) || K(e) && r && kn(t.split("-").pop() ?? "") && await Ci(e, t, o, r)))
|
|
2776
|
+
throw new Error(`${Tn} slug: ${t}, linkText: ${i}`);
|
|
2675
2777
|
}
|
|
2676
|
-
async function
|
|
2778
|
+
async function Di(e, n) {
|
|
2677
2779
|
if (n == null)
|
|
2678
|
-
throw new
|
|
2780
|
+
throw new T("Missing slug or id");
|
|
2679
2781
|
const {
|
|
2680
2782
|
clients: { commerce: t, search: r }
|
|
2681
2783
|
} = e, i = await t.catalog.portal.pagetype(`${n}/p`);
|
|
@@ -2687,25 +2789,25 @@ async function pi(e, n) {
|
|
|
2687
2789
|
}).catch(() => null);
|
|
2688
2790
|
if (!o)
|
|
2689
2791
|
throw new B(`No product found for id ${i.id}`);
|
|
2690
|
-
return
|
|
2792
|
+
return F(le(o.items), o);
|
|
2691
2793
|
}
|
|
2692
|
-
const
|
|
2794
|
+
const Pi = {
|
|
2693
2795
|
product: async (e, { locator: n }, t) => {
|
|
2694
|
-
const r =
|
|
2695
|
-
r &&
|
|
2796
|
+
const r = xe(n), i = Ve(n), o = fr(n), a = hr(n);
|
|
2797
|
+
r && se(t, r), i && ye(t, i);
|
|
2696
2798
|
const {
|
|
2697
2799
|
loaders: { skuLoader: s }
|
|
2698
2800
|
} = t;
|
|
2699
2801
|
try {
|
|
2700
2802
|
const c = o ?? a?.split("-").pop() ?? "";
|
|
2701
|
-
if (!
|
|
2702
|
-
throw new Error(
|
|
2703
|
-
const
|
|
2704
|
-
return await
|
|
2803
|
+
if (!kn(c))
|
|
2804
|
+
throw new Error(Un);
|
|
2805
|
+
const d = await s.load(c);
|
|
2806
|
+
return await wi(t, d, a, i), d;
|
|
2705
2807
|
} catch (c) {
|
|
2706
|
-
if (!
|
|
2808
|
+
if (!bi(c))
|
|
2707
2809
|
throw c;
|
|
2708
|
-
return
|
|
2810
|
+
return Di(t, a);
|
|
2709
2811
|
}
|
|
2710
2812
|
},
|
|
2711
2813
|
collection: (e, { slug: n }, t) => {
|
|
@@ -2714,7 +2816,7 @@ const gi = {
|
|
|
2714
2816
|
} = t;
|
|
2715
2817
|
return r.load({
|
|
2716
2818
|
slug: n,
|
|
2717
|
-
locale:
|
|
2819
|
+
locale: ie(t)
|
|
2718
2820
|
});
|
|
2719
2821
|
},
|
|
2720
2822
|
search: async (e, {
|
|
@@ -2725,21 +2827,21 @@ const gi = {
|
|
|
2725
2827
|
selectedFacets: o,
|
|
2726
2828
|
sponsoredCount: a
|
|
2727
2829
|
}, s) => {
|
|
2728
|
-
const c =
|
|
2729
|
-
c &&
|
|
2730
|
-
const
|
|
2731
|
-
page: Math.ceil(
|
|
2830
|
+
const c = xe(o), d = Ve(o), u = mr(o);
|
|
2831
|
+
c && se(s, c), d && ye(s, d);
|
|
2832
|
+
const p = t ? Number(t) : 0, f = {
|
|
2833
|
+
page: Math.ceil(p / n) || 0,
|
|
2732
2834
|
count: n,
|
|
2733
2835
|
query: i ?? void 0,
|
|
2734
|
-
sort:
|
|
2735
|
-
selectedFacets: o?.flatMap(
|
|
2836
|
+
sort: Qe[r ?? "score_desc"] ?? Qe.score_desc,
|
|
2837
|
+
selectedFacets: o?.flatMap(Me) ?? [],
|
|
2736
2838
|
sponsoredCount: a ?? void 0
|
|
2737
2839
|
};
|
|
2738
|
-
if (
|
|
2739
|
-
const
|
|
2740
|
-
type:
|
|
2741
|
-
productId:
|
|
2742
|
-
})).map((m) => m.productId).slice(0, n),
|
|
2840
|
+
if (u) {
|
|
2841
|
+
const l = (await s.clients.commerce.catalog.products.crossselling({
|
|
2842
|
+
type: fn[u.key],
|
|
2843
|
+
productId: u.value
|
|
2844
|
+
})).map((m) => m.productId).slice(0, n), g = s.clients.search.productsByIdentifier({ field: "id", values: l }).then((m) => ({
|
|
2743
2845
|
products: m,
|
|
2744
2846
|
recordsFiltered: m.length,
|
|
2745
2847
|
pagination: {
|
|
@@ -2762,10 +2864,10 @@ const gi = {
|
|
|
2762
2864
|
fuzzy: "0",
|
|
2763
2865
|
searchId: ""
|
|
2764
2866
|
}));
|
|
2765
|
-
return { searchArgs:
|
|
2867
|
+
return { searchArgs: f, productSearchPromise: g };
|
|
2766
2868
|
}
|
|
2767
|
-
const
|
|
2768
|
-
return { searchArgs:
|
|
2869
|
+
const h = s.clients.search.products(f);
|
|
2870
|
+
return { searchArgs: f, productSearchPromise: h };
|
|
2769
2871
|
},
|
|
2770
2872
|
allProducts: async (e, { first: n, after: t }, r) => {
|
|
2771
2873
|
const {
|
|
@@ -2774,7 +2876,7 @@ const gi = {
|
|
|
2774
2876
|
page: Math.ceil(o / n),
|
|
2775
2877
|
count: n
|
|
2776
2878
|
}), s = a.products.flatMap(
|
|
2777
|
-
(c) => c.items.map((
|
|
2879
|
+
(c) => c.items.map((d) => F(d, c))
|
|
2778
2880
|
).filter((c) => c.sellers.length > 0);
|
|
2779
2881
|
return {
|
|
2780
2882
|
pageInfo: {
|
|
@@ -2785,9 +2887,9 @@ const gi = {
|
|
|
2785
2887
|
totalCount: a.recordsFiltered
|
|
2786
2888
|
},
|
|
2787
2889
|
// after + index is bigger than after+first itself because of the array flat() above
|
|
2788
|
-
edges: s.map((c,
|
|
2890
|
+
edges: s.map((c, d) => ({
|
|
2789
2891
|
node: c,
|
|
2790
|
-
cursor: (o +
|
|
2892
|
+
cursor: (o + d).toString()
|
|
2791
2893
|
}))
|
|
2792
2894
|
};
|
|
2793
2895
|
},
|
|
@@ -2799,7 +2901,7 @@ const gi = {
|
|
|
2799
2901
|
field: "id",
|
|
2800
2902
|
values: n
|
|
2801
2903
|
})).flatMap(
|
|
2802
|
-
(o) => o.items.map((a) =>
|
|
2904
|
+
(o) => o.items.map((a) => F(a, o))
|
|
2803
2905
|
).filter(
|
|
2804
2906
|
(o) => n.includes(o.itemId) && o.sellers.length > 0
|
|
2805
2907
|
) : [];
|
|
@@ -2810,44 +2912,44 @@ const gi = {
|
|
|
2810
2912
|
} = r, o = t ? Number(t) : 0, [a, s] = await Promise.all([
|
|
2811
2913
|
i.catalog.brand.list(),
|
|
2812
2914
|
i.catalog.category.tree()
|
|
2813
|
-
]), c = [],
|
|
2915
|
+
]), c = [], d = (h, v) => {
|
|
2814
2916
|
c.push({
|
|
2815
|
-
id:
|
|
2816
|
-
name:
|
|
2917
|
+
id: h.id,
|
|
2918
|
+
name: h.name,
|
|
2817
2919
|
fatherCategoryId: v,
|
|
2818
|
-
linkId:
|
|
2819
|
-
title:
|
|
2920
|
+
linkId: ae(h.name),
|
|
2921
|
+
title: h.Title,
|
|
2820
2922
|
description: null,
|
|
2821
|
-
metaTagDescription:
|
|
2923
|
+
metaTagDescription: h.MetaTagDescription,
|
|
2822
2924
|
availableLinkIds: null,
|
|
2823
2925
|
entityType: "category",
|
|
2824
|
-
slug: new URL(
|
|
2926
|
+
slug: new URL(h.url).pathname.slice(1).toLowerCase()
|
|
2825
2927
|
});
|
|
2826
|
-
for (const
|
|
2827
|
-
l
|
|
2928
|
+
for (const l of h.children)
|
|
2929
|
+
d(l, h.id);
|
|
2828
2930
|
};
|
|
2829
|
-
for (const
|
|
2830
|
-
|
|
2831
|
-
const
|
|
2832
|
-
id:
|
|
2833
|
-
name:
|
|
2834
|
-
linkId:
|
|
2835
|
-
title:
|
|
2931
|
+
for (const h of s)
|
|
2932
|
+
d(h, null);
|
|
2933
|
+
const f = [...a.filter((h) => h.isActive).map((h) => ({
|
|
2934
|
+
id: h.id,
|
|
2935
|
+
name: h.name,
|
|
2936
|
+
linkId: ae(h.name),
|
|
2937
|
+
title: h.title,
|
|
2836
2938
|
description: null,
|
|
2837
|
-
metaTagDescription:
|
|
2939
|
+
metaTagDescription: h.metaTagDescription,
|
|
2838
2940
|
availableLinkIds: null,
|
|
2839
2941
|
entityType: "brand"
|
|
2840
|
-
})), ...c].filter((
|
|
2942
|
+
})), ...c].filter((h) => !!hn.slug(h, null, r, null));
|
|
2841
2943
|
return {
|
|
2842
2944
|
pageInfo: {
|
|
2843
|
-
hasNextPage:
|
|
2945
|
+
hasNextPage: f.length - o > n,
|
|
2844
2946
|
hasPreviousPage: o > 0,
|
|
2845
2947
|
startCursor: "0",
|
|
2846
|
-
endCursor: (Math.min(n,
|
|
2847
|
-
totalCount:
|
|
2948
|
+
endCursor: (Math.min(n, f.length - o) - 1).toString(),
|
|
2949
|
+
totalCount: f.length
|
|
2848
2950
|
},
|
|
2849
|
-
edges:
|
|
2850
|
-
node:
|
|
2951
|
+
edges: f.slice(o, o + n).map((h, v) => ({
|
|
2952
|
+
node: h,
|
|
2851
2953
|
cursor: (o + v).toString()
|
|
2852
2954
|
}))
|
|
2853
2955
|
};
|
|
@@ -2872,7 +2974,7 @@ const gi = {
|
|
|
2872
2974
|
page: 1,
|
|
2873
2975
|
count: 1,
|
|
2874
2976
|
query: n ?? void 0,
|
|
2875
|
-
selectedFacets: t?.flatMap(
|
|
2977
|
+
selectedFacets: t?.flatMap(Me) ?? [],
|
|
2876
2978
|
allowRedirect: !0
|
|
2877
2979
|
});
|
|
2878
2980
|
return {
|
|
@@ -2887,10 +2989,10 @@ const gi = {
|
|
|
2887
2989
|
geoCoordinates: t,
|
|
2888
2990
|
country: r,
|
|
2889
2991
|
salesChannel: i
|
|
2890
|
-
}))?.[0], { id:
|
|
2992
|
+
}))?.[0], { id: d, sellers: u } = c;
|
|
2891
2993
|
return {
|
|
2892
|
-
id:
|
|
2893
|
-
sellers:
|
|
2994
|
+
id: d,
|
|
2995
|
+
sellers: u
|
|
2894
2996
|
};
|
|
2895
2997
|
},
|
|
2896
2998
|
profile: async (e, { id: n }, t) => {
|
|
@@ -2915,7 +3017,7 @@ const gi = {
|
|
|
2915
3017
|
userOrder: async (e, { orderId: n }, t) => {
|
|
2916
3018
|
try {
|
|
2917
3019
|
if (!n)
|
|
2918
|
-
throw new
|
|
3020
|
+
throw new T("Missing orderId");
|
|
2919
3021
|
const {
|
|
2920
3022
|
clients: { commerce: r }
|
|
2921
3023
|
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
@@ -2924,7 +3026,7 @@ const gi = {
|
|
|
2924
3026
|
let o = null;
|
|
2925
3027
|
try {
|
|
2926
3028
|
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
2927
|
-
o =
|
|
3029
|
+
o = Sn(c);
|
|
2928
3030
|
} catch {
|
|
2929
3031
|
}
|
|
2930
3032
|
const s = (await r.masterData.getShopperById({
|
|
@@ -2963,7 +3065,7 @@ const gi = {
|
|
|
2963
3065
|
o = { message: i };
|
|
2964
3066
|
}
|
|
2965
3067
|
const a = o?.message || i;
|
|
2966
|
-
throw
|
|
3068
|
+
throw H(r) ? new B(`No order found for id ${n}. ${a}.`) : st(r) ? new Y(
|
|
2967
3069
|
`You are forbidden to interact with order with id ${n}. ${a}.`
|
|
2968
3070
|
) : r;
|
|
2969
3071
|
}
|
|
@@ -2997,12 +3099,12 @@ const gi = {
|
|
|
2997
3099
|
return await Promise.all(
|
|
2998
3100
|
o.map(async (c) => {
|
|
2999
3101
|
try {
|
|
3000
|
-
const [
|
|
3102
|
+
const [d] = await r.masterData.getShopperById({
|
|
3001
3103
|
userId: c
|
|
3002
3104
|
});
|
|
3003
|
-
if (
|
|
3004
|
-
const
|
|
3005
|
-
|
|
3105
|
+
if (d) {
|
|
3106
|
+
const u = [d.firstName, d.lastName].filter(Boolean).join(" ");
|
|
3107
|
+
u && a.set(c, u);
|
|
3006
3108
|
}
|
|
3007
3109
|
} catch {
|
|
3008
3110
|
}
|
|
@@ -3039,18 +3141,18 @@ const gi = {
|
|
|
3039
3141
|
account: r,
|
|
3040
3142
|
headers: i,
|
|
3041
3143
|
clients: { commerce: o }
|
|
3042
|
-
} = t, s =
|
|
3144
|
+
} = t, s = X(z(i?.cookie ?? "", r))?.userId ?? "", [c, d, u] = await Promise.all([
|
|
3043
3145
|
o.session("").catch(() => null),
|
|
3044
3146
|
s ? o.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
3045
3147
|
s ? o.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
3046
|
-
]),
|
|
3148
|
+
]), p = d?.[0], f = c?.namespaces.authentication ?? null, h = `${(p?.firstName ?? "").trim()} ${(p?.lastName ?? "").trim()}`.trim();
|
|
3047
3149
|
return {
|
|
3048
|
-
username:
|
|
3049
|
-
name:
|
|
3050
|
-
email:
|
|
3051
|
-
phone:
|
|
3052
|
-
role:
|
|
3053
|
-
orgUnit:
|
|
3150
|
+
username: f?.storeUserEmail?.value ?? "",
|
|
3151
|
+
name: h,
|
|
3152
|
+
email: f?.storeUserEmail?.value ?? "",
|
|
3153
|
+
phone: p?.phone ?? "",
|
|
3154
|
+
role: u?.Roles?.map((v) => v.Name) ?? [],
|
|
3155
|
+
orgUnit: f?.unitName?.value ?? ""
|
|
3054
3156
|
};
|
|
3055
3157
|
},
|
|
3056
3158
|
// If isRepresentative, return b2b information.
|
|
@@ -3060,29 +3162,29 @@ const gi = {
|
|
|
3060
3162
|
account: r,
|
|
3061
3163
|
headers: i,
|
|
3062
3164
|
clients: { commerce: o }
|
|
3063
|
-
} = t, a =
|
|
3165
|
+
} = t, a = X(z(i?.cookie ?? "", r));
|
|
3064
3166
|
if (!a?.userId)
|
|
3065
3167
|
return null;
|
|
3066
3168
|
if (a?.isRepresentative) {
|
|
3067
3169
|
const c = await o.session("").catch(() => null);
|
|
3068
3170
|
if (!c)
|
|
3069
3171
|
return null;
|
|
3070
|
-
const
|
|
3071
|
-
let
|
|
3072
|
-
if (
|
|
3172
|
+
const d = c.namespaces.profile ?? null, u = c.namespaces.shopper ?? null, p = c.namespaces.authentication ?? null, f = Ye(c) || a?.customerId?.trim() || "";
|
|
3173
|
+
let h = null;
|
|
3174
|
+
if (f)
|
|
3073
3175
|
try {
|
|
3074
|
-
|
|
3075
|
-
} catch (
|
|
3176
|
+
h = await o.masterData.getContractById({ contractId: f });
|
|
3177
|
+
} catch (g) {
|
|
3076
3178
|
console.error(
|
|
3077
|
-
`Error while getting contract data for contract ID (${
|
|
3078
|
-
|
|
3179
|
+
`Error while getting contract data for contract ID (${f}).`,
|
|
3180
|
+
g
|
|
3079
3181
|
);
|
|
3080
3182
|
}
|
|
3081
|
-
const v = `${(
|
|
3183
|
+
const v = `${(u?.firstName?.value ?? "").trim()} ${(u?.lastName?.value ?? "").trim()}`.trim();
|
|
3082
3184
|
return {
|
|
3083
|
-
name:
|
|
3084
|
-
email:
|
|
3085
|
-
id:
|
|
3185
|
+
name: Pn(h, d) || v || "",
|
|
3186
|
+
email: d?.email?.value || p?.storeUserEmail?.value || "",
|
|
3187
|
+
id: d?.id?.value || p?.customerId?.value || a?.customerId?.trim() || ""
|
|
3086
3188
|
// createdAt: '',
|
|
3087
3189
|
};
|
|
3088
3190
|
}
|
|
@@ -3100,7 +3202,7 @@ const gi = {
|
|
|
3100
3202
|
// Contract list from VTEX session `shopper.availableContracts`.
|
|
3101
3203
|
availableContracts: async (e, { orgUnitId: n }, t) => {
|
|
3102
3204
|
if (!n)
|
|
3103
|
-
throw new
|
|
3205
|
+
throw new T("Missing orgUnitId");
|
|
3104
3206
|
const {
|
|
3105
3207
|
account: r,
|
|
3106
3208
|
headers: i,
|
|
@@ -3108,19 +3210,19 @@ const gi = {
|
|
|
3108
3210
|
} = t, a = await o.session("").catch(() => null), s = z(i?.cookie ?? "", r);
|
|
3109
3211
|
let c = null;
|
|
3110
3212
|
try {
|
|
3111
|
-
c = s ?
|
|
3213
|
+
c = s ? X(s) : null;
|
|
3112
3214
|
} catch {
|
|
3113
3215
|
c = null;
|
|
3114
3216
|
}
|
|
3115
|
-
const
|
|
3116
|
-
if (!
|
|
3117
|
-
throw new
|
|
3217
|
+
const d = a?.namespaces.authentication?.unitId?.value?.trim() ?? c?.unitId?.trim() ?? "";
|
|
3218
|
+
if (!d || d !== n)
|
|
3219
|
+
throw new Y(
|
|
3118
3220
|
"You are not allowed to list contracts for this organization unit"
|
|
3119
3221
|
);
|
|
3120
|
-
const
|
|
3222
|
+
const u = Hr(
|
|
3121
3223
|
a?.namespaces.shopper
|
|
3122
|
-
),
|
|
3123
|
-
return
|
|
3224
|
+
), p = Ye(a) || c?.customerId?.trim() || "";
|
|
3225
|
+
return Yr(u, p);
|
|
3124
3226
|
},
|
|
3125
3227
|
pickupPoints: async (e, { geoCoordinates: n }, t) => {
|
|
3126
3228
|
const {
|
|
@@ -3130,10 +3232,10 @@ const gi = {
|
|
|
3130
3232
|
geoCoordinates: n
|
|
3131
3233
|
});
|
|
3132
3234
|
},
|
|
3133
|
-
orderEntryOperation:
|
|
3134
|
-
orderFormItems:
|
|
3135
|
-
recommendations:
|
|
3136
|
-
},
|
|
3235
|
+
orderEntryOperation: vi,
|
|
3236
|
+
orderFormItems: Oi,
|
|
3237
|
+
recommendations: Ii
|
|
3238
|
+
}, Ai = {
|
|
3137
3239
|
reviewRating: () => ({
|
|
3138
3240
|
ratingValue: 5,
|
|
3139
3241
|
bestRating: 5
|
|
@@ -3141,35 +3243,35 @@ const gi = {
|
|
|
3141
3243
|
author: () => ({
|
|
3142
3244
|
name: ""
|
|
3143
3245
|
})
|
|
3144
|
-
},
|
|
3246
|
+
}, ki = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, Ui = {
|
|
3145
3247
|
suggestions: async (e, n, t) => {
|
|
3146
3248
|
const {
|
|
3147
3249
|
clients: { search: r }
|
|
3148
3250
|
} = t, { searchArgs: i } = e;
|
|
3149
3251
|
if (!i.query)
|
|
3150
3252
|
return {
|
|
3151
|
-
terms: (await r.topSearches()).searches.map((
|
|
3152
|
-
value:
|
|
3153
|
-
count:
|
|
3253
|
+
terms: (await r.topSearches()).searches.map((p) => ({
|
|
3254
|
+
value: p.term,
|
|
3255
|
+
count: p.count
|
|
3154
3256
|
})),
|
|
3155
3257
|
products: []
|
|
3156
3258
|
};
|
|
3157
3259
|
const { productSearchPromise: o } = e, [a, s] = await Promise.all([
|
|
3158
3260
|
r.suggestedTerms(i),
|
|
3159
3261
|
o
|
|
3160
|
-
]), c = s.products.map((
|
|
3161
|
-
const
|
|
3162
|
-
return
|
|
3163
|
-
}).filter((
|
|
3262
|
+
]), c = s.products.map((u) => {
|
|
3263
|
+
const p = le(u.items);
|
|
3264
|
+
return p && F(p, u);
|
|
3265
|
+
}).filter((u) => !!u), { searches: d } = a;
|
|
3164
3266
|
return {
|
|
3165
|
-
terms:
|
|
3267
|
+
terms: d.map((u) => ({ value: u.term, count: u.count })),
|
|
3166
3268
|
products: c
|
|
3167
3269
|
};
|
|
3168
3270
|
},
|
|
3169
3271
|
products: async ({ productSearchPromise: e }) => {
|
|
3170
3272
|
const n = await e, t = n.products.map((r) => {
|
|
3171
|
-
const i =
|
|
3172
|
-
return i &&
|
|
3273
|
+
const i = le(r.items);
|
|
3274
|
+
return i && F(i, r);
|
|
3173
3275
|
}).filter((r) => !!r);
|
|
3174
3276
|
return {
|
|
3175
3277
|
pageInfo: {
|
|
@@ -3192,7 +3294,7 @@ const gi = {
|
|
|
3192
3294
|
t.storage.searchArgs = e;
|
|
3193
3295
|
const { facets: i = [] } = await r.facets(e), o = !e.query, a = e.selectedFacets?.length ? e.selectedFacets[0].key === "category-1" : !1, s = e.selectedFacets?.length ? e.selectedFacets[0].key === "brand" : !1;
|
|
3194
3296
|
return i.filter(
|
|
3195
|
-
(
|
|
3297
|
+
(d) => !o || !ki(d, a, s)
|
|
3196
3298
|
);
|
|
3197
3299
|
},
|
|
3198
3300
|
metadata: async ({ productSearchPromise: e }) => {
|
|
@@ -3204,12 +3306,12 @@ const gi = {
|
|
|
3204
3306
|
};
|
|
3205
3307
|
},
|
|
3206
3308
|
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
3207
|
-
},
|
|
3309
|
+
}, Ti = {
|
|
3208
3310
|
title: ({ title: e }) => e ?? "",
|
|
3209
3311
|
description: ({ description: e }) => e ?? "",
|
|
3210
3312
|
canonical: ({ canonical: e }) => e ?? "",
|
|
3211
3313
|
titleTemplate: () => ""
|
|
3212
|
-
},
|
|
3314
|
+
}, _i = ["bd", "d", "h", "m"], Ei = (e) => _i.includes(e), Ri = {
|
|
3213
3315
|
bd: {
|
|
3214
3316
|
0: "Today",
|
|
3215
3317
|
1: "In 1 business day",
|
|
@@ -3230,29 +3332,29 @@ const gi = {
|
|
|
3230
3332
|
1: "In 1 minute",
|
|
3231
3333
|
other: "Up to # minutes"
|
|
3232
3334
|
}
|
|
3233
|
-
},
|
|
3234
|
-
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i =
|
|
3335
|
+
}, _n = (e) => {
|
|
3336
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = Ei(t);
|
|
3235
3337
|
if (!r || !i)
|
|
3236
3338
|
return "";
|
|
3237
3339
|
const o = Number(n) < 2 ? Number(n) : "other";
|
|
3238
|
-
return
|
|
3239
|
-
},
|
|
3340
|
+
return Ri[t][o].replace("#", n) ?? "";
|
|
3341
|
+
}, Fi = {
|
|
3240
3342
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
3241
3343
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
3242
|
-
localizedEstimates: (e) => e?.shippingEstimate ?
|
|
3243
|
-
},
|
|
3244
|
-
function
|
|
3245
|
-
const t = `${
|
|
3344
|
+
localizedEstimates: (e) => e?.shippingEstimate ? _n(e.shippingEstimate) : ""
|
|
3345
|
+
}, Ze = "skuvariation";
|
|
3346
|
+
function en(e, n) {
|
|
3347
|
+
const t = `${Ze}${n}`.toLowerCase(), r = e.find(
|
|
3246
3348
|
(o) => o.imageLabel === t
|
|
3247
3349
|
);
|
|
3248
3350
|
if (r)
|
|
3249
3351
|
return r;
|
|
3250
3352
|
const i = e.find(
|
|
3251
|
-
(o) => o.imageLabel ===
|
|
3353
|
+
(o) => o.imageLabel === Ze
|
|
3252
3354
|
);
|
|
3253
3355
|
return i || e[0];
|
|
3254
3356
|
}
|
|
3255
|
-
function
|
|
3357
|
+
function Ni(e, n, t) {
|
|
3256
3358
|
const r = {};
|
|
3257
3359
|
return e.forEach((i) => {
|
|
3258
3360
|
const o = i.variations;
|
|
@@ -3260,34 +3362,34 @@ function Ci(e, n, t) {
|
|
|
3260
3362
|
return;
|
|
3261
3363
|
const a = `${n}-${o.find(
|
|
3262
3364
|
(c) => c.name === n
|
|
3263
|
-
)?.values[0] ?? ""}`, s = o.reduce((c,
|
|
3365
|
+
)?.values[0] ?? ""}`, s = o.reduce((c, d) => d.name === n ? c : c + `-${d.name}-${d.values[0]}`, a);
|
|
3264
3366
|
r[s] = `${t}-${i.itemId}`;
|
|
3265
3367
|
}), r;
|
|
3266
3368
|
}
|
|
3267
|
-
function
|
|
3369
|
+
function nn(e) {
|
|
3268
3370
|
const n = {};
|
|
3269
3371
|
return e.forEach((t) => {
|
|
3270
3372
|
n[t.name] = t.values[0];
|
|
3271
3373
|
}), n;
|
|
3272
3374
|
}
|
|
3273
|
-
function
|
|
3375
|
+
function Li(e) {
|
|
3274
3376
|
const n = {};
|
|
3275
3377
|
return e?.forEach((t) => {
|
|
3276
3378
|
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
3277
3379
|
}), n;
|
|
3278
3380
|
}
|
|
3279
|
-
function
|
|
3381
|
+
function Bi(e, n) {
|
|
3280
3382
|
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
3281
3383
|
}
|
|
3282
|
-
function
|
|
3384
|
+
function $i(e) {
|
|
3283
3385
|
const n = e;
|
|
3284
3386
|
for (const t in e)
|
|
3285
3387
|
e[t].every(
|
|
3286
3388
|
(i) => !Number.isNaN(Number(i.value))
|
|
3287
|
-
) && e[t].sort((i, o) =>
|
|
3389
|
+
) && e[t].sort((i, o) => Bi(i.value, o.value));
|
|
3288
3390
|
return n;
|
|
3289
3391
|
}
|
|
3290
|
-
function
|
|
3392
|
+
function Mi(e, n, t) {
|
|
3291
3393
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
3292
3394
|
return e.forEach((o) => {
|
|
3293
3395
|
if (o.variations.length === 0)
|
|
@@ -3300,98 +3402,98 @@ function Ai(e, n, t) {
|
|
|
3300
3402
|
if (!a || i.has(c))
|
|
3301
3403
|
return;
|
|
3302
3404
|
i.add(c);
|
|
3303
|
-
const
|
|
3405
|
+
const d = en(
|
|
3304
3406
|
o.images,
|
|
3305
3407
|
n
|
|
3306
|
-
),
|
|
3307
|
-
src:
|
|
3308
|
-
alt:
|
|
3408
|
+
), u = {
|
|
3409
|
+
src: d.imageUrl,
|
|
3410
|
+
alt: d.imageLabel ?? "",
|
|
3309
3411
|
label: `${n}: ${a.values[0]}`,
|
|
3310
3412
|
value: a.values[0]
|
|
3311
3413
|
};
|
|
3312
|
-
r[a.name] ? r[a.name].push(
|
|
3414
|
+
r[a.name] ? r[a.name].push(u) : r[a.name] = [u];
|
|
3313
3415
|
return;
|
|
3314
3416
|
}
|
|
3315
3417
|
o.variations.forEach((c) => {
|
|
3316
|
-
const
|
|
3317
|
-
if (i.has(
|
|
3418
|
+
const d = `${c.name}-${c.values[0]}`;
|
|
3419
|
+
if (i.has(d))
|
|
3318
3420
|
return;
|
|
3319
|
-
i.add(
|
|
3320
|
-
const
|
|
3421
|
+
i.add(d);
|
|
3422
|
+
const u = en(
|
|
3321
3423
|
o.images,
|
|
3322
3424
|
c.name
|
|
3323
|
-
),
|
|
3324
|
-
src:
|
|
3325
|
-
alt:
|
|
3425
|
+
), p = {
|
|
3426
|
+
src: u.imageUrl,
|
|
3427
|
+
alt: u.imageText ?? "",
|
|
3326
3428
|
label: `${c.name}: ${c.values[0]}`,
|
|
3327
3429
|
value: c.values[0]
|
|
3328
3430
|
};
|
|
3329
|
-
r[c.name] ? r[c.name].push(
|
|
3431
|
+
r[c.name] ? r[c.name].push(p) : r[c.name] = [p];
|
|
3330
3432
|
});
|
|
3331
|
-
}),
|
|
3433
|
+
}), $i(r);
|
|
3332
3434
|
}
|
|
3333
|
-
const
|
|
3334
|
-
activeVariations: (e) =>
|
|
3335
|
-
allVariantsByName: (e) =>
|
|
3336
|
-
slugsMap: (e, n) =>
|
|
3435
|
+
const zi = {
|
|
3436
|
+
activeVariations: (e) => nn(e.variations),
|
|
3437
|
+
allVariantsByName: (e) => Li(e.isVariantOf.skuSpecifications),
|
|
3438
|
+
slugsMap: (e, n) => Ni(
|
|
3337
3439
|
e.isVariantOf.items,
|
|
3338
3440
|
n.dominantVariantName ?? e.variations[0]?.name,
|
|
3339
3441
|
e.isVariantOf.linkText
|
|
3340
3442
|
),
|
|
3341
3443
|
availableVariations: (e, n) => {
|
|
3342
|
-
const t = n.dominantVariantName ?? e.variations[0]?.name, i =
|
|
3343
|
-
return
|
|
3444
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = nn(e.variations)[t];
|
|
3445
|
+
return Mi(
|
|
3344
3446
|
e.isVariantOf.items,
|
|
3345
3447
|
t,
|
|
3346
3448
|
i
|
|
3347
3449
|
);
|
|
3348
3450
|
},
|
|
3349
|
-
allVariantProducts: (e) => e.isVariantOf.items.map((n) =>
|
|
3350
|
-
},
|
|
3451
|
+
allVariantProducts: (e) => e.isVariantOf.items.map((n) => F(n, e.isVariantOf))
|
|
3452
|
+
}, Vi = {
|
|
3351
3453
|
"pickup-in-point": "Pickup",
|
|
3352
3454
|
delivery: "Delivery",
|
|
3353
3455
|
pickup: "Pickup",
|
|
3354
3456
|
"take-away": "Take away",
|
|
3355
3457
|
"": ""
|
|
3356
|
-
},
|
|
3458
|
+
}, xi = {
|
|
3357
3459
|
deliveryOptionsData: (e) => {
|
|
3358
3460
|
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], o = r.reduce(
|
|
3359
|
-
(
|
|
3360
|
-
const
|
|
3361
|
-
(
|
|
3362
|
-
),
|
|
3363
|
-
|
|
3364
|
-
),
|
|
3365
|
-
return
|
|
3461
|
+
(d, u) => {
|
|
3462
|
+
const p = u?.selectedSla || "", f = u?.selectedDeliveryChannel || u?.deliveryChannel || "", h = u?.deliveryCompany || "", v = u?.deliveryWindow, l = u?.pickupStoreInfo, g = u?.shippingEstimate || "", m = u?.shippingEstimate ? _n(u?.shippingEstimate) : "", S = u?.shippingEstimateDate || "", O = u?.addressId || "", w = u?.itemIndex ?? 0, b = t?.[w], U = b?.seller || "", I = `${p}|${f}|${h}|${U}|${g}|${S}|${O}|${v?.startDateUtc}|${v?.endDateUtc}`, D = i?.find(
|
|
3463
|
+
(C) => C?.addressId === O
|
|
3464
|
+
), P = `${Vi[f] || ""} ${m} ${D?.neighborhood ? `to ${D?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: k, taxPriceTags: A } = qi(
|
|
3465
|
+
b?.priceTags ?? []
|
|
3466
|
+
), R = (b?.sellingPrice ?? 0) * (b?.quantity ?? 0) + (b?.tax ?? 0) + (k ?? 0);
|
|
3467
|
+
return d[I] || (d[I] = {
|
|
3366
3468
|
// static fields
|
|
3367
|
-
selectedSla:
|
|
3368
|
-
deliveryChannel:
|
|
3369
|
-
deliveryCompany:
|
|
3469
|
+
selectedSla: p,
|
|
3470
|
+
deliveryChannel: f,
|
|
3471
|
+
deliveryCompany: h,
|
|
3370
3472
|
deliveryWindow: v,
|
|
3371
|
-
shippingEstimate:
|
|
3372
|
-
shippingEstimateDate:
|
|
3373
|
-
seller:
|
|
3473
|
+
shippingEstimate: g,
|
|
3474
|
+
shippingEstimateDate: S,
|
|
3475
|
+
seller: U,
|
|
3374
3476
|
friendlyShippingEstimate: m,
|
|
3375
|
-
friendlyDeliveryOptionName:
|
|
3477
|
+
friendlyDeliveryOptionName: P,
|
|
3376
3478
|
address: D,
|
|
3377
|
-
pickupStoreInfo:
|
|
3479
|
+
pickupStoreInfo: l,
|
|
3378
3480
|
// dynamic fields
|
|
3379
3481
|
quantityOfDifferentItems: 0,
|
|
3380
3482
|
total: 0,
|
|
3381
3483
|
items: []
|
|
3382
|
-
}),
|
|
3383
|
-
id:
|
|
3384
|
-
uniqueId:
|
|
3385
|
-
name:
|
|
3386
|
-
quantity:
|
|
3387
|
-
price:
|
|
3388
|
-
sellingPrice:
|
|
3389
|
-
imageUrl:
|
|
3390
|
-
taxPriceTags:
|
|
3484
|
+
}), d[I] && (d[I].items?.push({
|
|
3485
|
+
id: b?.id || "",
|
|
3486
|
+
uniqueId: b?.uniqueId || "",
|
|
3487
|
+
name: b?.name || "",
|
|
3488
|
+
quantity: b?.quantity || 0,
|
|
3489
|
+
price: b?.price || 0,
|
|
3490
|
+
sellingPrice: b?.sellingPrice || 0,
|
|
3491
|
+
imageUrl: b?.imageUrl || "",
|
|
3492
|
+
taxPriceTags: A ?? [],
|
|
3391
3493
|
taxPriceTagsTotal: k ?? 0,
|
|
3392
|
-
tax:
|
|
3393
|
-
total:
|
|
3394
|
-
}),
|
|
3494
|
+
tax: b?.tax || 0,
|
|
3495
|
+
total: R
|
|
3496
|
+
}), d[I].quantityOfDifferentItems = (d[I].quantityOfDifferentItems ?? 0) + 1, d[I].total = (d[I].total ?? 0) + R), d;
|
|
3395
3497
|
},
|
|
3396
3498
|
{}
|
|
3397
3499
|
), a = Object.values(o), s = n?.contactInformation?.[0], c = {
|
|
@@ -3417,7 +3519,7 @@ const Pi = {
|
|
|
3417
3519
|
) || [];
|
|
3418
3520
|
}
|
|
3419
3521
|
};
|
|
3420
|
-
function
|
|
3522
|
+
function qi(e) {
|
|
3421
3523
|
const t = e.filter(
|
|
3422
3524
|
(i) => i?.name?.includes("TAX")
|
|
3423
3525
|
), r = t.reduce(
|
|
@@ -3429,28 +3531,28 @@ function Ti(e) {
|
|
|
3429
3531
|
taxPriceTagsTotal: r
|
|
3430
3532
|
};
|
|
3431
3533
|
}
|
|
3432
|
-
const
|
|
3433
|
-
StoreCollection:
|
|
3434
|
-
StoreAggregateOffer:
|
|
3435
|
-
StoreProduct:
|
|
3436
|
-
StoreSeo:
|
|
3437
|
-
StoreFacet:
|
|
3438
|
-
StoreFacetBoolean:
|
|
3439
|
-
StoreFacetRange:
|
|
3440
|
-
StoreFacetValueBoolean:
|
|
3441
|
-
StoreOffer:
|
|
3442
|
-
StoreAggregateRating:
|
|
3443
|
-
StoreReview:
|
|
3444
|
-
StoreProductGroup:
|
|
3445
|
-
StoreSearchResult:
|
|
3446
|
-
StorePropertyValue:
|
|
3447
|
-
SkuVariants:
|
|
3448
|
-
ShippingSLA:
|
|
3449
|
-
UserOrderResult:
|
|
3450
|
-
ObjectOrString:
|
|
3451
|
-
Query:
|
|
3452
|
-
Mutation:
|
|
3453
|
-
},
|
|
3534
|
+
const ji = {
|
|
3535
|
+
StoreCollection: hn,
|
|
3536
|
+
StoreAggregateOffer: cr,
|
|
3537
|
+
StoreProduct: mi,
|
|
3538
|
+
StoreSeo: Ti,
|
|
3539
|
+
StoreFacet: Sr,
|
|
3540
|
+
StoreFacetBoolean: yr,
|
|
3541
|
+
StoreFacetRange: Ir,
|
|
3542
|
+
StoreFacetValueBoolean: vr,
|
|
3543
|
+
StoreOffer: ci,
|
|
3544
|
+
StoreAggregateRating: lr,
|
|
3545
|
+
StoreReview: Ai,
|
|
3546
|
+
StoreProductGroup: fi,
|
|
3547
|
+
StoreSearchResult: Ui,
|
|
3548
|
+
StorePropertyValue: Si,
|
|
3549
|
+
SkuVariants: zi,
|
|
3550
|
+
ShippingSLA: Fi,
|
|
3551
|
+
UserOrderResult: xi,
|
|
3552
|
+
ObjectOrString: si,
|
|
3553
|
+
Query: Pi,
|
|
3554
|
+
Mutation: ii
|
|
3555
|
+
}, Wi = () => ji, Gi = `"""
|
|
3454
3556
|
Address information.
|
|
3455
3557
|
"""
|
|
3456
3558
|
type Address {
|
|
@@ -3495,7 +3597,7 @@ type Address {
|
|
|
3495
3597
|
"""
|
|
3496
3598
|
geoCoordinates: [Float]
|
|
3497
3599
|
}
|
|
3498
|
-
`,
|
|
3600
|
+
`, Hi = `"""
|
|
3499
3601
|
Advertisement information about a specific product in a campaign
|
|
3500
3602
|
"""
|
|
3501
3603
|
type Advertisement {
|
|
@@ -3520,7 +3622,7 @@ type Advertisement {
|
|
|
3520
3622
|
"""
|
|
3521
3623
|
adResponseId: String!
|
|
3522
3624
|
}
|
|
3523
|
-
`,
|
|
3625
|
+
`, Xi = `"""
|
|
3524
3626
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
3525
3627
|
"""
|
|
3526
3628
|
type StoreAggregateOffer {
|
|
@@ -3549,7 +3651,7 @@ type StoreAggregateOffer {
|
|
|
3549
3651
|
"""
|
|
3550
3652
|
offers: [StoreOffer!]!
|
|
3551
3653
|
}
|
|
3552
|
-
`,
|
|
3654
|
+
`, Yi = `"""
|
|
3553
3655
|
Average rating, based on multiple ratings or reviews.
|
|
3554
3656
|
"""
|
|
3555
3657
|
type StoreAggregateRating {
|
|
@@ -3562,7 +3664,7 @@ type StoreAggregateRating {
|
|
|
3562
3664
|
"""
|
|
3563
3665
|
reviewCount: Int!
|
|
3564
3666
|
}
|
|
3565
|
-
`,
|
|
3667
|
+
`, Ji = `"""
|
|
3566
3668
|
information about the author of a product review or rating.
|
|
3567
3669
|
"""
|
|
3568
3670
|
type StoreAuthor {
|
|
@@ -3571,7 +3673,7 @@ type StoreAuthor {
|
|
|
3571
3673
|
"""
|
|
3572
3674
|
name: String!
|
|
3573
3675
|
}
|
|
3574
|
-
`,
|
|
3676
|
+
`, Ki = `"""
|
|
3575
3677
|
Brand of a given product.
|
|
3576
3678
|
"""
|
|
3577
3679
|
type StoreBrand {
|
|
@@ -3580,7 +3682,7 @@ type StoreBrand {
|
|
|
3580
3682
|
"""
|
|
3581
3683
|
name: String!
|
|
3582
3684
|
}
|
|
3583
|
-
`,
|
|
3685
|
+
`, Qi = `"""
|
|
3584
3686
|
Item of a list.
|
|
3585
3687
|
"""
|
|
3586
3688
|
type StoreListItem {
|
|
@@ -3611,7 +3713,7 @@ type StoreBreadcrumbList {
|
|
|
3611
3713
|
"""
|
|
3612
3714
|
numberOfItems: Int!
|
|
3613
3715
|
}
|
|
3614
|
-
`,
|
|
3716
|
+
`, Zi = `"""
|
|
3615
3717
|
Shopping cart message.
|
|
3616
3718
|
"""
|
|
3617
3719
|
type StoreCartMessage {
|
|
@@ -3648,7 +3750,7 @@ input IStoreCart {
|
|
|
3648
3750
|
"""
|
|
3649
3751
|
order: IStoreOrder!
|
|
3650
3752
|
}
|
|
3651
|
-
`,
|
|
3753
|
+
`, eo = `"""
|
|
3652
3754
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\` or \`Collection\`.
|
|
3653
3755
|
|
|
3654
3756
|
\`SubCategory\` and \`Cluster\` are still declared for backward compatibility but are
|
|
@@ -3763,7 +3865,7 @@ type StoreCollectionLocale {
|
|
|
3763
3865
|
"""
|
|
3764
3866
|
slug: String!
|
|
3765
3867
|
}
|
|
3766
|
-
`,
|
|
3868
|
+
`, no = `"""
|
|
3767
3869
|
Delivery Promise badge.
|
|
3768
3870
|
"""
|
|
3769
3871
|
type DeliveryPromiseBadge {
|
|
@@ -3772,7 +3874,7 @@ type DeliveryPromiseBadge {
|
|
|
3772
3874
|
"""
|
|
3773
3875
|
typeName: String
|
|
3774
3876
|
}
|
|
3775
|
-
`,
|
|
3877
|
+
`, to = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
3776
3878
|
|
|
3777
3879
|
"""
|
|
3778
3880
|
Search facet range information.
|
|
@@ -3849,7 +3951,7 @@ type StoreFacetValueBoolean {
|
|
|
3849
3951
|
"""
|
|
3850
3952
|
quantity: Int
|
|
3851
3953
|
}
|
|
3852
|
-
`,
|
|
3954
|
+
`, ro = `"""
|
|
3853
3955
|
Image.
|
|
3854
3956
|
"""
|
|
3855
3957
|
type StoreImage {
|
|
@@ -3876,7 +3978,7 @@ input IStoreImage {
|
|
|
3876
3978
|
"""
|
|
3877
3979
|
alternateName: String!
|
|
3878
3980
|
}
|
|
3879
|
-
`,
|
|
3981
|
+
`, io = `type Mutation {
|
|
3880
3982
|
"""
|
|
3881
3983
|
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\`.
|
|
3882
3984
|
"""
|
|
@@ -3918,7 +4020,7 @@ input IStoreImage {
|
|
|
3918
4020
|
"""
|
|
3919
4021
|
startRecommendationSession: Boolean!
|
|
3920
4022
|
}
|
|
3921
|
-
`,
|
|
4023
|
+
`, oo = `"""
|
|
3922
4024
|
Newsletter information.
|
|
3923
4025
|
"""
|
|
3924
4026
|
type PersonNewsletter {
|
|
@@ -3941,8 +4043,8 @@ input IPersonNewsletter {
|
|
|
3941
4043
|
"""
|
|
3942
4044
|
email: String!
|
|
3943
4045
|
}
|
|
3944
|
-
`,
|
|
3945
|
-
`,
|
|
4046
|
+
`, ao = `scalar ObjectOrString
|
|
4047
|
+
`, so = `"""
|
|
3946
4048
|
Offer information.
|
|
3947
4049
|
"""
|
|
3948
4050
|
type StoreOffer {
|
|
@@ -4035,7 +4137,7 @@ input IStoreOffer {
|
|
|
4035
4137
|
"""
|
|
4036
4138
|
priceToken: String
|
|
4037
4139
|
}
|
|
4038
|
-
`,
|
|
4140
|
+
`, co = `"""
|
|
4039
4141
|
Information of a specific order.
|
|
4040
4142
|
"""
|
|
4041
4143
|
type StoreOrder {
|
|
@@ -4051,6 +4153,12 @@ type StoreOrder {
|
|
|
4051
4153
|
Indicates whether or not items with attachments should be split.
|
|
4052
4154
|
"""
|
|
4053
4155
|
shouldSplitItem: Boolean
|
|
4156
|
+
"""
|
|
4157
|
+
Sales channel of the underlying orderForm when FastStore adopted it because
|
|
4158
|
+
the browser session was stale (e.g. after Quick Order). Clients should align
|
|
4159
|
+
\`session.channel\` to this value. Null when no SC adoption happened.
|
|
4160
|
+
"""
|
|
4161
|
+
salesChannel: String
|
|
4054
4162
|
}
|
|
4055
4163
|
|
|
4056
4164
|
"""
|
|
@@ -4070,7 +4178,7 @@ input IStoreOrder {
|
|
|
4070
4178
|
"""
|
|
4071
4179
|
shouldSplitItem: Boolean
|
|
4072
4180
|
}
|
|
4073
|
-
`,
|
|
4181
|
+
`, lo = `"""
|
|
4074
4182
|
Commercial Authorization response.
|
|
4075
4183
|
"""
|
|
4076
4184
|
type CommercialAuthorizationResponse {
|
|
@@ -4469,7 +4577,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
4469
4577
|
"""
|
|
4470
4578
|
rule: CommercialAuthorizationRule!
|
|
4471
4579
|
}
|
|
4472
|
-
`,
|
|
4580
|
+
`, uo = `"""
|
|
4473
4581
|
Input for uploading a file to the Order Entry Service.
|
|
4474
4582
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
4475
4583
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -4530,7 +4638,7 @@ type StoreOrderFormCartItem {
|
|
|
4530
4638
|
seller: String!
|
|
4531
4639
|
unitMultiplier: Float
|
|
4532
4640
|
}
|
|
4533
|
-
`,
|
|
4641
|
+
`, po = `"""
|
|
4534
4642
|
Organization.
|
|
4535
4643
|
"""
|
|
4536
4644
|
type StoreOrganization {
|
|
@@ -4567,7 +4675,7 @@ type StoreContract {
|
|
|
4567
4675
|
"""
|
|
4568
4676
|
isActive: Boolean!
|
|
4569
4677
|
}
|
|
4570
|
-
`,
|
|
4678
|
+
`, go = `"""
|
|
4571
4679
|
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.
|
|
4572
4680
|
"""
|
|
4573
4681
|
type StorePageInfo {
|
|
@@ -4592,7 +4700,7 @@ type StorePageInfo {
|
|
|
4592
4700
|
"""
|
|
4593
4701
|
totalCount: Int!
|
|
4594
4702
|
}
|
|
4595
|
-
`,
|
|
4703
|
+
`, mo = `"""
|
|
4596
4704
|
Input type for setting a new password.
|
|
4597
4705
|
"""
|
|
4598
4706
|
input ISetPassword {
|
|
@@ -4635,7 +4743,7 @@ type SetPasswordResponse {
|
|
|
4635
4743
|
"""
|
|
4636
4744
|
message: String
|
|
4637
4745
|
}
|
|
4638
|
-
`,
|
|
4746
|
+
`, ho = `"""
|
|
4639
4747
|
Client profile data.
|
|
4640
4748
|
"""
|
|
4641
4749
|
type StorePerson {
|
|
@@ -4678,7 +4786,7 @@ input IStorePerson {
|
|
|
4678
4786
|
"""
|
|
4679
4787
|
familyName: String!
|
|
4680
4788
|
}
|
|
4681
|
-
`,
|
|
4789
|
+
`, fo = `type PickupPointAddress {
|
|
4682
4790
|
"""
|
|
4683
4791
|
Address city.
|
|
4684
4792
|
"""
|
|
@@ -4757,7 +4865,7 @@ type PickupPoints {
|
|
|
4757
4865
|
"""
|
|
4758
4866
|
pickupPointsHash: String
|
|
4759
4867
|
}
|
|
4760
|
-
`,
|
|
4868
|
+
`, So = `"""
|
|
4761
4869
|
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.
|
|
4762
4870
|
"""
|
|
4763
4871
|
type StoreProduct {
|
|
@@ -4925,7 +5033,7 @@ input IStoreProduct {
|
|
|
4925
5033
|
"""
|
|
4926
5034
|
additionalProperty: [IStorePropertyValue!]
|
|
4927
5035
|
}
|
|
4928
|
-
`,
|
|
5036
|
+
`, yo = `"""
|
|
4929
5037
|
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.
|
|
4930
5038
|
"""
|
|
4931
5039
|
type StoreProductGroup {
|
|
@@ -4952,7 +5060,7 @@ type StoreProductGroup {
|
|
|
4952
5060
|
"""
|
|
4953
5061
|
skuVariants: SkuVariants
|
|
4954
5062
|
}
|
|
4955
|
-
`,
|
|
5063
|
+
`, Io = `type Profile {
|
|
4956
5064
|
"""
|
|
4957
5065
|
Collection of user's address
|
|
4958
5066
|
"""
|
|
@@ -5013,7 +5121,7 @@ type ProfileAddress {
|
|
|
5013
5121
|
"""
|
|
5014
5122
|
geoCoordinate: [Float]
|
|
5015
5123
|
}
|
|
5016
|
-
`,
|
|
5124
|
+
`, vo = `"""
|
|
5017
5125
|
Properties that can be associated with products and products groups.
|
|
5018
5126
|
"""
|
|
5019
5127
|
type StorePropertyValue {
|
|
@@ -5053,7 +5161,7 @@ input IStorePropertyValue {
|
|
|
5053
5161
|
"""
|
|
5054
5162
|
valueReference: ObjectOrString!
|
|
5055
5163
|
}
|
|
5056
|
-
`,
|
|
5164
|
+
`, Oo = `"""
|
|
5057
5165
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
5058
5166
|
"""
|
|
5059
5167
|
type StoreProductEdge {
|
|
@@ -5683,7 +5791,7 @@ type StoreAccountProfile {
|
|
|
5683
5791
|
email: String
|
|
5684
5792
|
id: String
|
|
5685
5793
|
}
|
|
5686
|
-
`,
|
|
5794
|
+
`, Co = `"""
|
|
5687
5795
|
Summary of a quote returned in list results.
|
|
5688
5796
|
"""
|
|
5689
5797
|
type UserQuoteSummary {
|
|
@@ -5748,7 +5856,7 @@ type UserQuoteListPaging {
|
|
|
5748
5856
|
"""
|
|
5749
5857
|
perPage: Int!
|
|
5750
5858
|
}
|
|
5751
|
-
`,
|
|
5859
|
+
`, bo = `type RecommendationResponse {
|
|
5752
5860
|
products: [StoreProduct!]!
|
|
5753
5861
|
correlationId: String!
|
|
5754
5862
|
campaign: RecommendationCampaign!
|
|
@@ -5759,7 +5867,7 @@ type RecommendationCampaign {
|
|
|
5759
5867
|
title: String
|
|
5760
5868
|
type: String!
|
|
5761
5869
|
}
|
|
5762
|
-
`,
|
|
5870
|
+
`, wo = `"""
|
|
5763
5871
|
Information of a given review rating.
|
|
5764
5872
|
"""
|
|
5765
5873
|
type StoreReviewRating {
|
|
@@ -5786,7 +5894,7 @@ type StoreReview {
|
|
|
5786
5894
|
"""
|
|
5787
5895
|
author: StoreAuthor!
|
|
5788
5896
|
}
|
|
5789
|
-
`,
|
|
5897
|
+
`, Do = `"""
|
|
5790
5898
|
Search Engine Optimization (SEO) tags data.
|
|
5791
5899
|
"""
|
|
5792
5900
|
type StoreSeo {
|
|
@@ -5807,7 +5915,7 @@ type StoreSeo {
|
|
|
5807
5915
|
"""
|
|
5808
5916
|
canonical: String!
|
|
5809
5917
|
}
|
|
5810
|
-
`,
|
|
5918
|
+
`, Po = `"""
|
|
5811
5919
|
Currency information.
|
|
5812
5920
|
"""
|
|
5813
5921
|
type StoreCurrency {
|
|
@@ -6082,7 +6190,7 @@ input IStoreSession {
|
|
|
6082
6190
|
"""
|
|
6083
6191
|
refreshAfter: String
|
|
6084
6192
|
}
|
|
6085
|
-
`,
|
|
6193
|
+
`, Ao = `"""
|
|
6086
6194
|
Shipping Simulation item input.
|
|
6087
6195
|
"""
|
|
6088
6196
|
input IShippingItem {
|
|
@@ -6413,7 +6521,7 @@ type MessageFields {
|
|
|
6413
6521
|
"""
|
|
6414
6522
|
skuName: String
|
|
6415
6523
|
}
|
|
6416
|
-
`,
|
|
6524
|
+
`, ko = `type SkuVariants {
|
|
6417
6525
|
"""
|
|
6418
6526
|
SKU property values for the current SKU.
|
|
6419
6527
|
"""
|
|
@@ -6508,7 +6616,7 @@ Example:
|
|
|
6508
6616
|
\`\`\`
|
|
6509
6617
|
"""
|
|
6510
6618
|
scalar FormattedVariants
|
|
6511
|
-
`,
|
|
6619
|
+
`, Uo = `"""
|
|
6512
6620
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
6513
6621
|
"""
|
|
6514
6622
|
enum StoreStatus {
|
|
@@ -6516,7 +6624,7 @@ enum StoreStatus {
|
|
|
6516
6624
|
WARNING
|
|
6517
6625
|
ERROR
|
|
6518
6626
|
}
|
|
6519
|
-
`,
|
|
6627
|
+
`, To = `scalar JSONObject
|
|
6520
6628
|
|
|
6521
6629
|
type UserOrder {
|
|
6522
6630
|
orderId: String
|
|
@@ -7340,94 +7448,94 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
7340
7448
|
type: String
|
|
7341
7449
|
id: String
|
|
7342
7450
|
}
|
|
7343
|
-
`,
|
|
7344
|
-
"./address.graphql":
|
|
7345
|
-
"./advertisement.graphql":
|
|
7346
|
-
"./aggregateOffer.graphql":
|
|
7347
|
-
"./aggregateRating.graphql":
|
|
7348
|
-
"./author.graphql":
|
|
7349
|
-
"./brand.graphql":
|
|
7350
|
-
"./breadcrumb.graphql":
|
|
7351
|
-
"./cart.graphql":
|
|
7352
|
-
"./collection.graphql":
|
|
7353
|
-
"./deliveryPromisesBadge.graphql":
|
|
7354
|
-
"./facet.graphql":
|
|
7355
|
-
"./image.graphql":
|
|
7356
|
-
"./mutation.graphql":
|
|
7357
|
-
"./newsletter.graphql":
|
|
7358
|
-
"./objectOrString.graphql":
|
|
7359
|
-
"./offer.graphql":
|
|
7360
|
-
"./order.graphql":
|
|
7361
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
7362
|
-
"./orderEntry.graphql":
|
|
7363
|
-
"./organization.graphql":
|
|
7364
|
-
"./pageInfo.graphql":
|
|
7365
|
-
"./password.graphql":
|
|
7366
|
-
"./person.graphql":
|
|
7367
|
-
"./pickupPoints.graphql":
|
|
7368
|
-
"./product.graphql":
|
|
7369
|
-
"./productGroup.graphql":
|
|
7370
|
-
"./profile.graphql":
|
|
7371
|
-
"./propertyValue.graphql":
|
|
7372
|
-
"./query.graphql":
|
|
7373
|
-
"./quote.graphql":
|
|
7374
|
-
"./recommendation.graphql":
|
|
7375
|
-
"./review.graphql":
|
|
7376
|
-
"./seo.graphql":
|
|
7377
|
-
"./session.graphql":
|
|
7378
|
-
"./shipping.graphql":
|
|
7379
|
-
"./skuVariants.graphql":
|
|
7380
|
-
"./status.graphql":
|
|
7381
|
-
"./userOrder.graphql":
|
|
7382
|
-
}),
|
|
7383
|
-
Object.values(
|
|
7384
|
-
(e, n) =>
|
|
7451
|
+
`, _o = /* @__PURE__ */ Object.assign({
|
|
7452
|
+
"./address.graphql": Gi,
|
|
7453
|
+
"./advertisement.graphql": Hi,
|
|
7454
|
+
"./aggregateOffer.graphql": Xi,
|
|
7455
|
+
"./aggregateRating.graphql": Yi,
|
|
7456
|
+
"./author.graphql": Ji,
|
|
7457
|
+
"./brand.graphql": Ki,
|
|
7458
|
+
"./breadcrumb.graphql": Qi,
|
|
7459
|
+
"./cart.graphql": Zi,
|
|
7460
|
+
"./collection.graphql": eo,
|
|
7461
|
+
"./deliveryPromisesBadge.graphql": no,
|
|
7462
|
+
"./facet.graphql": to,
|
|
7463
|
+
"./image.graphql": ro,
|
|
7464
|
+
"./mutation.graphql": io,
|
|
7465
|
+
"./newsletter.graphql": oo,
|
|
7466
|
+
"./objectOrString.graphql": ao,
|
|
7467
|
+
"./offer.graphql": so,
|
|
7468
|
+
"./order.graphql": co,
|
|
7469
|
+
"./orderCommercialAuthorizaton.graphql": lo,
|
|
7470
|
+
"./orderEntry.graphql": uo,
|
|
7471
|
+
"./organization.graphql": po,
|
|
7472
|
+
"./pageInfo.graphql": go,
|
|
7473
|
+
"./password.graphql": mo,
|
|
7474
|
+
"./person.graphql": ho,
|
|
7475
|
+
"./pickupPoints.graphql": fo,
|
|
7476
|
+
"./product.graphql": So,
|
|
7477
|
+
"./productGroup.graphql": yo,
|
|
7478
|
+
"./profile.graphql": Io,
|
|
7479
|
+
"./propertyValue.graphql": vo,
|
|
7480
|
+
"./query.graphql": Oo,
|
|
7481
|
+
"./quote.graphql": Co,
|
|
7482
|
+
"./recommendation.graphql": bo,
|
|
7483
|
+
"./review.graphql": wo,
|
|
7484
|
+
"./seo.graphql": Do,
|
|
7485
|
+
"./session.graphql": Po,
|
|
7486
|
+
"./shipping.graphql": Ao,
|
|
7487
|
+
"./skuVariants.graphql": ko,
|
|
7488
|
+
"./status.graphql": Uo,
|
|
7489
|
+
"./userOrder.graphql": To
|
|
7490
|
+
}), Eo = $n(
|
|
7491
|
+
Object.values(_o).map((e) => Mn(e)).reduce(
|
|
7492
|
+
(e, n) => tn([e, n], { sort: !0 })
|
|
7385
7493
|
)
|
|
7386
|
-
),
|
|
7387
|
-
channel:
|
|
7494
|
+
), Ro = Eo, Ko = async (e) => (n) => (n.storage = {
|
|
7495
|
+
channel: ee.parse(e.channel),
|
|
7388
7496
|
flags: e.flags ?? {},
|
|
7389
7497
|
locale: e.locale,
|
|
7390
7498
|
cookies: /* @__PURE__ */ new Map()
|
|
7391
|
-
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients =
|
|
7392
|
-
function
|
|
7393
|
-
const e =
|
|
7499
|
+
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients = Xt(e, n), n.loaders = ir(e, n), n);
|
|
7500
|
+
function Fo() {
|
|
7501
|
+
const e = Wi(), n = {};
|
|
7394
7502
|
for (const [t, r] of Object.entries(e))
|
|
7395
7503
|
n[t] = Object.fromEntries(
|
|
7396
|
-
Object.entries(r).map(([i, o]) => typeof o != "function" ? [i, o] : [i,
|
|
7504
|
+
Object.entries(r).map(([i, o]) => typeof o != "function" ? [i, o] : [i, at(o, `${t}(${i})`)])
|
|
7397
7505
|
);
|
|
7398
7506
|
return n;
|
|
7399
7507
|
}
|
|
7400
|
-
function
|
|
7401
|
-
const t =
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
])(
|
|
7405
|
-
return e &&
|
|
7508
|
+
function Qo(e) {
|
|
7509
|
+
const t = it([
|
|
7510
|
+
rt,
|
|
7511
|
+
et
|
|
7512
|
+
])(Fo(), Ro);
|
|
7513
|
+
return e && zn(e) ? Ln({
|
|
7406
7514
|
schemas: [t, e]
|
|
7407
7515
|
}) : t;
|
|
7408
7516
|
}
|
|
7409
7517
|
export {
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7518
|
+
et as AuthDirective,
|
|
7519
|
+
T as BadRequestError,
|
|
7520
|
+
rt as CacheControlDirective,
|
|
7521
|
+
Wn as CommercialAuthorizationStatus,
|
|
7522
|
+
Z as FastStoreError,
|
|
7523
|
+
Y as ForbiddenError,
|
|
7524
|
+
Ko as GraphqlVtexContextFactory,
|
|
7525
|
+
Qo as GraphqlVtexSchema,
|
|
7418
7526
|
B as NotFoundError,
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7527
|
+
Gn as StoreCollectionType,
|
|
7528
|
+
Hn as StoreFacetType,
|
|
7529
|
+
Xn as StoreSort,
|
|
7530
|
+
Yn as StoreStatus,
|
|
7531
|
+
re as UnauthorizedError,
|
|
7532
|
+
Jn as UserOrderInvoiceType,
|
|
7533
|
+
Yo as isBadRequestError,
|
|
7534
|
+
Xo as isFastStoreError,
|
|
7535
|
+
st as isForbiddenError,
|
|
7536
|
+
H as isNotFoundError,
|
|
7537
|
+
Jo as isUnauthorizedError,
|
|
7538
|
+
Ho as stringifyCacheControl,
|
|
7539
|
+
Ro as typeDefs,
|
|
7540
|
+
it as withDirectives
|
|
7433
7541
|
};
|