@faststore/api 4.4.1-dev.0 → 4.5.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +207 -41
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +1545 -1138
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/__generated__/schema.d.ts +90 -0
- package/dist/src/__generated__/schema.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/Contract.d.ts +1 -0
- package/dist/src/platforms/vtex/clients/commerce/Contract.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts +16 -0
- package/dist/src/platforms/vtex/clients/commerce/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/types/Quote.d.ts +26 -0
- package/dist/src/platforms/vtex/clients/commerce/types/Quote.d.ts.map +1 -0
- package/dist/src/platforms/vtex/clients/commerce/types/RecommendationResult.d.ts +25 -0
- package/dist/src/platforms/vtex/clients/commerce/types/RecommendationResult.d.ts.map +1 -0
- package/dist/src/platforms/vtex/clients/commerce/types/Session.d.ts +10 -0
- package/dist/src/platforms/vtex/clients/commerce/types/Session.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/index.d.ts +7 -0
- package/dist/src/platforms/vtex/clients/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/index.d.ts +33 -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 +33 -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 +33 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/recommendations.d.ts +18 -0
- package/dist/src/platforms/vtex/resolvers/recommendations.d.ts.map +1 -0
- package/dist/src/platforms/vtex/resolvers/startRecommendationSession.d.ts +11 -0
- package/dist/src/platforms/vtex/resolvers/startRecommendationSession.d.ts.map +1 -0
- package/dist/src/platforms/vtex/resolvers/validateSession.d.ts.map +1 -1
- package/dist/src/platforms/vtex/utils/contract.d.ts +59 -0
- package/dist/src/platforms/vtex/utils/contract.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/__generated__/schema.ts +102 -0
- package/src/platforms/vtex/clients/commerce/Contract.ts +1 -0
- package/src/platforms/vtex/clients/commerce/index.ts +188 -3
- package/src/platforms/vtex/clients/commerce/types/Quote.ts +27 -0
- package/src/platforms/vtex/clients/commerce/types/RecommendationResult.ts +27 -0
- package/src/platforms/vtex/clients/commerce/types/Session.ts +9 -0
- package/src/platforms/vtex/resolvers/mutation.ts +2 -0
- package/src/platforms/vtex/resolvers/query.ts +137 -3
- package/src/platforms/vtex/resolvers/recommendations.ts +80 -0
- package/src/platforms/vtex/resolvers/startRecommendationSession.ts +30 -0
- package/src/platforms/vtex/resolvers/validateSession.ts +2 -1
- package/src/platforms/vtex/typeDefs/mutation.graphql +4 -0
- package/src/platforms/vtex/typeDefs/organization.graphql +18 -0
- package/src/platforms/vtex/typeDefs/query.graphql +68 -0
- package/src/platforms/vtex/typeDefs/quote.graphql +65 -0
- package/src/platforms/vtex/typeDefs/recommendation.graphql +11 -0
- package/src/platforms/vtex/utils/contract.ts +144 -0
package/dist/es/index.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
4
|
-
import { OTELAPI as
|
|
5
|
-
import { GraphQLScalarType as
|
|
6
|
-
import { parse as
|
|
1
|
+
import { mergeTypeDefs as je } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as On, mergeSchemas as Cn } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as We, MapperKind as Ge, getDirective as He } from "@graphql-tools/utils";
|
|
4
|
+
import { OTELAPI as B } from "@faststore/diagnostics";
|
|
5
|
+
import { GraphQLScalarType as bn, print as wn, parse as Dn, isSchema as An } from "graphql";
|
|
6
|
+
import { parse as J } from "cookie";
|
|
7
7
|
import Pn from "isomorphic-unfetch";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
8
|
+
import Ie from "p-limit";
|
|
9
|
+
import ie from "dataloader";
|
|
10
|
+
import Un from "sanitize-html";
|
|
11
|
+
import ve from "fast-deep-equal";
|
|
12
12
|
import En from "node:crypto";
|
|
13
|
-
var
|
|
14
|
-
const
|
|
13
|
+
var _n = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(_n || {}), Tn = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(Tn || {}), Rn = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(Rn || {}), kn = /* @__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))(kn || {}), Fn = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(Fn || {}), Nn = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(Nn || {});
|
|
14
|
+
const Bn = () => 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,
|
|
@@ -26,122 +26,122 @@ const Nn = () => function(n = {}) {
|
|
|
26
26
|
} = e;
|
|
27
27
|
try {
|
|
28
28
|
if ((await n.vtexid.validate())?.authStatus?.toLowerCase() !== "success")
|
|
29
|
-
throw new
|
|
29
|
+
throw new Z("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 Z("Authentication required") : r === 403 ? new Y("You are not allowed to access this resource") : new Z("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, Mn = "auth", $n = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (e) =>
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
36
|
+
transformer: (e) => We(e, {
|
|
37
|
+
[Ge.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (He(e, n, Mn)?.[0]) {
|
|
39
39
|
const r = n.resolve;
|
|
40
40
|
n.resolve = async (i, a, o, s) => (await Ln(o), r?.(i, a, o, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, zn = "cacheControl", va = (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
|
+
}, Ce = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, xn = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, Vn = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (e) =>
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (e) => We(e, {
|
|
55
|
+
[Ge.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = He(e, n, zn)?.[0];
|
|
57
57
|
if (t) {
|
|
58
58
|
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
|
|
59
|
-
n.resolve = (s,
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
62
|
-
|
|
59
|
+
n.resolve = (s, c, l, p) => (l.cacheControl = {
|
|
60
|
+
sMaxAge: Ce(l.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: Ce(
|
|
62
|
+
l.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
66
|
-
}, o?.(s,
|
|
65
|
+
scope: xn(l.cacheControl?.scope, a)
|
|
66
|
+
}, o?.(s, c, l, p));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
71
|
+
}, qn = (e) => (n, t) => {
|
|
72
|
+
const r = je([
|
|
73
73
|
...(e ?? []).map(({ typeDefs: i }) => i),
|
|
74
74
|
t
|
|
75
75
|
]);
|
|
76
76
|
return (e ?? []).reduce(
|
|
77
77
|
(i, { transformer: a }) => a?.(i) ?? i,
|
|
78
|
-
|
|
78
|
+
On({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
},
|
|
84
|
-
name:
|
|
85
|
-
version:
|
|
86
|
-
},
|
|
83
|
+
}, se = "@faststore/api", ce = "4.5.0-dev.0", be = {
|
|
84
|
+
name: se,
|
|
85
|
+
version: ce
|
|
86
|
+
}, jn = (e, n) => (t, r, i, a) => {
|
|
87
87
|
if ((i?.OTEL?.enabled ?? !1) === !1)
|
|
88
88
|
return e(t, r, i, a);
|
|
89
|
-
const o =
|
|
90
|
-
|
|
89
|
+
const o = B.trace.getTracer(se, ce), s = B.propagation.extract(
|
|
90
|
+
B.context.active(),
|
|
91
91
|
i.OTEL
|
|
92
92
|
);
|
|
93
|
-
return
|
|
94
|
-
const
|
|
93
|
+
return B.context.with(s, () => {
|
|
94
|
+
const c = o.startSpan(n ?? "Unknown Graphql Resolver", {
|
|
95
95
|
startTime: Date.now(),
|
|
96
|
-
kind:
|
|
96
|
+
kind: B.SpanKind.INTERNAL,
|
|
97
97
|
attributes: {
|
|
98
98
|
timestamp: Date.now(),
|
|
99
|
-
"@faststore_version":
|
|
100
|
-
"@faststore_package_name":
|
|
99
|
+
"@faststore_version": ce,
|
|
100
|
+
"@faststore_package_name": se,
|
|
101
101
|
"@faststore_account_name": i.account,
|
|
102
102
|
"@faststore_environment": process.env.NODE_ENV
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
|
-
if (!
|
|
105
|
+
if (!c) return e(t, r, i, a);
|
|
106
106
|
try {
|
|
107
|
-
const
|
|
108
|
-
return
|
|
109
|
-
} catch (
|
|
110
|
-
throw
|
|
107
|
+
const l = e(t, r, i, a);
|
|
108
|
+
return l instanceof Promise ? l.then((p) => (c.end(), p)) : (c.end(), l);
|
|
109
|
+
} catch (l) {
|
|
110
|
+
throw c.end(), console.error(`Error when executing resolver: ${n}`, l), l;
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
};
|
|
114
|
-
class
|
|
114
|
+
class Q extends Error {
|
|
115
115
|
constructor(n, t) {
|
|
116
116
|
super(t), this.extensions = n, this.name = "FastStoreError";
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
class
|
|
119
|
+
class T extends Q {
|
|
120
120
|
constructor(n) {
|
|
121
121
|
super({ status: 400, type: "BadRequestError" }, n);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
class
|
|
124
|
+
class Z extends Q {
|
|
125
125
|
constructor(n) {
|
|
126
126
|
super({ status: 401, type: "UnauthorizedError" }, n);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
class
|
|
129
|
+
class Y extends Q {
|
|
130
130
|
constructor(n) {
|
|
131
131
|
super({ status: 403, type: "ForbiddenError" }, n);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
class
|
|
134
|
+
class L extends Q {
|
|
135
135
|
constructor(n) {
|
|
136
136
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const Oa = (e) => e?.name === "FastStoreError", Ca = (e) => e?.extensions?.type === "BadRequestError", ba = (e) => e?.extensions?.type === "UnauthorizedError", Wn = (e) => e?.extensions?.type === "ForbiddenError", Xe = (e) => e?.extensions?.type === "NotFoundError", Gn = `${be.name}@${be.version}`, I = async (e, n, t) => {
|
|
140
140
|
const r = await Pn(e, {
|
|
141
141
|
...n,
|
|
142
142
|
headers: {
|
|
143
143
|
...n?.headers ?? {},
|
|
144
|
-
"User-Agent":
|
|
144
|
+
"User-Agent": Gn
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
if (r.ok)
|
|
@@ -151,21 +151,21 @@ const ia = (e) => e?.name === "FastStoreError", aa = (e) => e?.extensions?.type
|
|
|
151
151
|
if (typeof r?.status == "number")
|
|
152
152
|
switch (r.status) {
|
|
153
153
|
case 400:
|
|
154
|
-
throw new
|
|
154
|
+
throw new T(i);
|
|
155
155
|
case 401:
|
|
156
|
-
throw new
|
|
156
|
+
throw new Z(i);
|
|
157
157
|
case 403:
|
|
158
|
-
throw new
|
|
158
|
+
throw new Y(i);
|
|
159
159
|
case 404:
|
|
160
|
-
throw new
|
|
160
|
+
throw new L(i);
|
|
161
161
|
default:
|
|
162
|
-
throw new
|
|
162
|
+
throw new Q(
|
|
163
163
|
{ status: r.status, type: "UnknownError" },
|
|
164
164
|
i
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
throw new Error(i);
|
|
168
|
-
},
|
|
168
|
+
}, Ye = (e) => {
|
|
169
169
|
if (!e)
|
|
170
170
|
return e;
|
|
171
171
|
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
@@ -174,13 +174,13 @@ const ia = (e) => e?.name === "FastStoreError", aa = (e) => e?.extensions?.type
|
|
|
174
174
|
if (a) {
|
|
175
175
|
const o = a.indexOf("=");
|
|
176
176
|
if (o > 0) {
|
|
177
|
-
const s = a.substring(0, o),
|
|
178
|
-
n.has(s) || r.push(s), n.set(s,
|
|
177
|
+
const s = a.substring(0, o), c = a.substring(o + 1);
|
|
178
|
+
n.has(s) || r.push(s), n.set(s, c);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
182
|
-
},
|
|
183
|
-
const t = n.match(
|
|
182
|
+
}, Hn = /^([^=]+)=([^;]*)/, Xn = (e, n) => {
|
|
183
|
+
const t = n.match(Hn);
|
|
184
184
|
if (t) {
|
|
185
185
|
const r = t[1], i = t[2];
|
|
186
186
|
e.storage.cookies.set(r, {
|
|
@@ -188,16 +188,16 @@ const ia = (e) => e?.name === "FastStoreError", aa = (e) => e?.extensions?.type
|
|
|
188
188
|
setCookie: n
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
},
|
|
191
|
+
}, Yn = (e, n) => {
|
|
192
192
|
n.getSetCookie().forEach(
|
|
193
|
-
(t) =>
|
|
193
|
+
(t) => Xn(e, t)
|
|
194
194
|
);
|
|
195
|
-
},
|
|
195
|
+
}, Jn = (e) => (n) => Yn(e, n), le = (e) => {
|
|
196
196
|
if (!e.headers?.cookie)
|
|
197
197
|
return null;
|
|
198
|
-
const n =
|
|
198
|
+
const n = Ye(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
199
199
|
return t.length === 0 ? n : t.reduce(
|
|
200
|
-
(r, [i, { value: a }]) =>
|
|
200
|
+
(r, [i, { value: a }]) => Qn(
|
|
201
201
|
r,
|
|
202
202
|
i,
|
|
203
203
|
a
|
|
@@ -205,69 +205,139 @@ const ia = (e) => e?.name === "FastStoreError", aa = (e) => e?.extensions?.type
|
|
|
205
205
|
n
|
|
206
206
|
);
|
|
207
207
|
}, Je = (e) => function(t) {
|
|
208
|
-
const r =
|
|
208
|
+
const r = le(e);
|
|
209
209
|
return r ? {
|
|
210
210
|
...t,
|
|
211
211
|
cookie: r
|
|
212
212
|
} : t;
|
|
213
|
-
},
|
|
214
|
-
const t =
|
|
215
|
-
return
|
|
216
|
-
},
|
|
213
|
+
}, z = (e, n) => {
|
|
214
|
+
const t = Ye(e);
|
|
215
|
+
return J(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
216
|
+
}, Qn = (e, n, t) => {
|
|
217
217
|
const r = new RegExp(`(${n})=([^;]*)`), i = e.match(r);
|
|
218
218
|
return i ? e.replace(
|
|
219
219
|
i[0],
|
|
220
220
|
`${i[1]}=${t}`
|
|
221
221
|
) : `${e};${n}=${t}`;
|
|
222
222
|
};
|
|
223
|
-
function
|
|
223
|
+
function X(e) {
|
|
224
224
|
return e ? JSON.parse(Buffer.from(e.split(".")[1], "base64").toString()) : null;
|
|
225
225
|
}
|
|
226
|
-
const
|
|
226
|
+
const Kn = "storefront/faststore.recommendation-shelf@v4", W = {
|
|
227
227
|
method: "POST",
|
|
228
228
|
headers: {
|
|
229
229
|
"content-type": "application/json"
|
|
230
230
|
}
|
|
231
|
-
},
|
|
232
|
-
|
|
231
|
+
}, Zn = /^\d{4}-\d{2}-\d{2}$/, et = /* @__PURE__ */ new Set([
|
|
232
|
+
"Draft",
|
|
233
|
+
"Requested",
|
|
234
|
+
"InReview",
|
|
235
|
+
"Reviewed",
|
|
236
|
+
"Approved",
|
|
237
|
+
"Declined",
|
|
238
|
+
"Expired",
|
|
239
|
+
"ConvertedToCart",
|
|
240
|
+
"ConvertedToOrder"
|
|
241
|
+
]);
|
|
242
|
+
function nt({
|
|
243
|
+
page: e,
|
|
244
|
+
perPage: n,
|
|
245
|
+
status: t,
|
|
246
|
+
createdAtFrom: r,
|
|
247
|
+
createdAtTo: i,
|
|
248
|
+
expiresAtFrom: a,
|
|
249
|
+
expiresAtTo: o
|
|
250
|
+
}) {
|
|
251
|
+
if (e !== void 0 && (!Number.isInteger(e) || e < 1))
|
|
252
|
+
throw new Error(
|
|
253
|
+
`listUserQuotes: invalid page "${e}" — must be a positive integer`
|
|
254
|
+
);
|
|
255
|
+
if (n !== void 0 && (!Number.isInteger(n) || n < 1))
|
|
256
|
+
throw new Error(
|
|
257
|
+
`listUserQuotes: invalid perPage "${n}" — must be a positive integer`
|
|
258
|
+
);
|
|
259
|
+
for (const [s, c] of [
|
|
260
|
+
["createdAtFrom", r],
|
|
261
|
+
["createdAtTo", i],
|
|
262
|
+
["expiresAtFrom", a],
|
|
263
|
+
["expiresAtTo", o]
|
|
264
|
+
])
|
|
265
|
+
if (c && !Zn.test(c))
|
|
266
|
+
throw new Error(
|
|
267
|
+
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
268
|
+
);
|
|
269
|
+
if (t && t.length > 0) {
|
|
270
|
+
const s = t.filter((c) => !et.has(c));
|
|
271
|
+
if (s.length > 0)
|
|
272
|
+
throw new Error(
|
|
273
|
+
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
function tt({
|
|
278
|
+
page: e,
|
|
279
|
+
perPage: n,
|
|
280
|
+
status: t,
|
|
281
|
+
createdAtFrom: r,
|
|
282
|
+
createdAtTo: i,
|
|
283
|
+
expiresAtFrom: a,
|
|
284
|
+
expiresAtTo: o,
|
|
285
|
+
label: s
|
|
286
|
+
}) {
|
|
287
|
+
const c = new URLSearchParams();
|
|
288
|
+
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((l) => c.append("status", l)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i), a && c.append("expiresAtFrom", a), o && c.append("expiresAtTo", o), s?.trim() && c.append("label", s.trim()), c;
|
|
289
|
+
}
|
|
290
|
+
const rt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
291
|
+
const a = `https://${e}.${n}.com.br`, o = Jn(i), s = Je(i), c = Bn(), l = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", p = r && r.map((d) => d + ".").find((d) => l.includes(d)) || "", u = l.replace(p, ""), h = `${a}/api/recommend-bff/v2`, S = s({
|
|
292
|
+
accept: "application/json",
|
|
293
|
+
"content-type": "application/json",
|
|
294
|
+
"x-vtex-rec-origin": `${e}/${Kn}`
|
|
295
|
+
}), b = (d = {}) => {
|
|
296
|
+
const g = z(le(i) ?? "", e);
|
|
297
|
+
return s({
|
|
298
|
+
...d,
|
|
299
|
+
"X-FORWARDED-HOST": u,
|
|
300
|
+
...g ? { [`VtexIdclientAutCookie_${e}`]: g } : {}
|
|
301
|
+
});
|
|
302
|
+
};
|
|
233
303
|
return {
|
|
234
304
|
catalog: {
|
|
235
|
-
salesChannel: (
|
|
236
|
-
`${a}/api/catalog_system/pub/saleschannel/${
|
|
305
|
+
salesChannel: (d) => I(
|
|
306
|
+
`${a}/api/catalog_system/pub/saleschannel/${d}`,
|
|
237
307
|
void 0,
|
|
238
308
|
{ storeCookies: o }
|
|
239
309
|
),
|
|
240
310
|
brand: {
|
|
241
|
-
list: () =>
|
|
311
|
+
list: () => I(`${a}/api/catalog_system/pub/brand/list`, void 0, {
|
|
242
312
|
storeCookies: o
|
|
243
313
|
})
|
|
244
314
|
},
|
|
245
315
|
category: {
|
|
246
|
-
tree: (
|
|
247
|
-
`${a}/api/catalog_system/pub/category/tree/${
|
|
316
|
+
tree: (d = 3) => I(
|
|
317
|
+
`${a}/api/catalog_system/pub/category/tree/${d}`,
|
|
248
318
|
void 0,
|
|
249
319
|
{ storeCookies: o }
|
|
250
320
|
)
|
|
251
321
|
},
|
|
252
322
|
portal: {
|
|
253
|
-
pagetype: (
|
|
254
|
-
`${a}/api/catalog_system/pub/portal/pagetype/${
|
|
323
|
+
pagetype: (d) => I(
|
|
324
|
+
`${a}/api/catalog_system/pub/portal/pagetype/${d}`,
|
|
255
325
|
void 0,
|
|
256
326
|
{ storeCookies: o }
|
|
257
327
|
)
|
|
258
328
|
},
|
|
259
329
|
products: {
|
|
260
330
|
crossselling: ({
|
|
261
|
-
type:
|
|
262
|
-
productId:
|
|
331
|
+
type: d,
|
|
332
|
+
productId: g,
|
|
263
333
|
groupByProduct: m = !0
|
|
264
334
|
}) => {
|
|
265
|
-
const
|
|
335
|
+
const y = new URLSearchParams({
|
|
266
336
|
sc: i.storage.channel.salesChannel,
|
|
267
337
|
groupByProduct: m.toString()
|
|
268
338
|
});
|
|
269
|
-
return
|
|
270
|
-
`${a}/api/catalog_system/pub/products/crossselling/${
|
|
339
|
+
return I(
|
|
340
|
+
`${a}/api/catalog_system/pub/products/crossselling/${d}/${g}?${y}`,
|
|
271
341
|
void 0,
|
|
272
342
|
{ storeCookies: o }
|
|
273
343
|
);
|
|
@@ -275,147 +345,147 @@ const j = {
|
|
|
275
345
|
}
|
|
276
346
|
},
|
|
277
347
|
checkout: {
|
|
278
|
-
simulation: (
|
|
348
|
+
simulation: (d, { salesChannel: g } = i.storage.channel) => {
|
|
279
349
|
const m = new URLSearchParams({
|
|
280
|
-
sc:
|
|
281
|
-
}),
|
|
350
|
+
sc: g
|
|
351
|
+
}), y = s({
|
|
282
352
|
"content-type": "application/json",
|
|
283
|
-
"X-FORWARDED-HOST":
|
|
353
|
+
"X-FORWARDED-HOST": u
|
|
284
354
|
});
|
|
285
|
-
return
|
|
355
|
+
return I(
|
|
286
356
|
`${a}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
287
357
|
{
|
|
288
|
-
...
|
|
289
|
-
headers:
|
|
290
|
-
body: JSON.stringify(
|
|
358
|
+
...W,
|
|
359
|
+
headers: y,
|
|
360
|
+
body: JSON.stringify(d)
|
|
291
361
|
},
|
|
292
362
|
{ storeCookies: o }
|
|
293
363
|
);
|
|
294
364
|
},
|
|
295
365
|
shippingData: ({
|
|
296
|
-
id:
|
|
297
|
-
index:
|
|
366
|
+
id: d,
|
|
367
|
+
index: g,
|
|
298
368
|
deliveryMode: m,
|
|
299
|
-
selectedAddresses:
|
|
300
|
-
},
|
|
301
|
-
const
|
|
369
|
+
selectedAddresses: y
|
|
370
|
+
}, C) => {
|
|
371
|
+
const w = C ? {
|
|
302
372
|
startDateUtc: m?.deliveryWindow?.startDate,
|
|
303
373
|
endDateUtc: m?.deliveryWindow?.endDate
|
|
304
|
-
} : null,
|
|
305
|
-
logisticsInfo: Array.from({ length:
|
|
306
|
-
itemIndex:
|
|
374
|
+
} : null, v = {
|
|
375
|
+
logisticsInfo: Array.from({ length: g }, (f, D) => ({
|
|
376
|
+
itemIndex: D,
|
|
307
377
|
selectedDeliveryChannel: m?.deliveryChannel || null,
|
|
308
378
|
selectedSla: m?.deliveryMethod || null,
|
|
309
|
-
deliveryWindow:
|
|
379
|
+
deliveryWindow: w
|
|
310
380
|
})),
|
|
311
|
-
selectedAddresses:
|
|
381
|
+
selectedAddresses: y,
|
|
312
382
|
clearAddressIfPostalCodeNotFound: t
|
|
313
|
-
},
|
|
383
|
+
}, P = s({
|
|
314
384
|
"content-type": "application/json",
|
|
315
|
-
"X-FORWARDED-HOST":
|
|
385
|
+
"X-FORWARDED-HOST": u
|
|
316
386
|
});
|
|
317
|
-
return
|
|
318
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
387
|
+
return I(
|
|
388
|
+
`${a}/api/checkout/pub/orderForm/${d}/attachments/shippingData`,
|
|
319
389
|
{
|
|
320
|
-
...
|
|
321
|
-
headers:
|
|
322
|
-
body: JSON.stringify(
|
|
390
|
+
...W,
|
|
391
|
+
headers: P,
|
|
392
|
+
body: JSON.stringify(v)
|
|
323
393
|
},
|
|
324
394
|
{ storeCookies: o }
|
|
325
395
|
);
|
|
326
396
|
},
|
|
327
397
|
marketingData: ({
|
|
328
|
-
id:
|
|
329
|
-
marketingData:
|
|
398
|
+
id: d,
|
|
399
|
+
marketingData: g
|
|
330
400
|
}) => {
|
|
331
401
|
const m = s({
|
|
332
402
|
"content-type": "application/json",
|
|
333
|
-
"X-FORWARDED-HOST":
|
|
403
|
+
"X-FORWARDED-HOST": u
|
|
334
404
|
});
|
|
335
|
-
return
|
|
336
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
405
|
+
return I(
|
|
406
|
+
`${a}/api/checkout/pub/orderForm/${d}/attachments/marketingData`,
|
|
337
407
|
{
|
|
338
408
|
headers: m,
|
|
339
|
-
body: JSON.stringify(
|
|
409
|
+
body: JSON.stringify(g),
|
|
340
410
|
method: "POST"
|
|
341
411
|
},
|
|
342
412
|
{ storeCookies: o }
|
|
343
413
|
);
|
|
344
414
|
},
|
|
345
415
|
clientPreferencesData: ({
|
|
346
|
-
id:
|
|
347
|
-
clientPreferencesData:
|
|
416
|
+
id: d,
|
|
417
|
+
clientPreferencesData: g
|
|
348
418
|
}) => {
|
|
349
419
|
const m = s({
|
|
350
420
|
"content-type": "application/json",
|
|
351
|
-
"X-FORWARDED-HOST":
|
|
421
|
+
"X-FORWARDED-HOST": u
|
|
352
422
|
});
|
|
353
|
-
return
|
|
354
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
423
|
+
return I(
|
|
424
|
+
`${a}/api/checkout/pub/orderForm/${d}/attachments/clientPreferencesData`,
|
|
355
425
|
{
|
|
356
426
|
headers: m,
|
|
357
|
-
body: JSON.stringify(
|
|
427
|
+
body: JSON.stringify(g),
|
|
358
428
|
method: "POST"
|
|
359
429
|
},
|
|
360
430
|
{ storeCookies: o }
|
|
361
431
|
);
|
|
362
432
|
},
|
|
363
433
|
orderForm: ({
|
|
364
|
-
id:
|
|
365
|
-
refreshOutdatedData:
|
|
434
|
+
id: d,
|
|
435
|
+
refreshOutdatedData: g = !0,
|
|
366
436
|
channel: m = i.storage.channel
|
|
367
437
|
}) => {
|
|
368
|
-
const { salesChannel:
|
|
438
|
+
const { salesChannel: y } = m, C = s({
|
|
369
439
|
"content-type": "application/json",
|
|
370
|
-
"X-FORWARDED-HOST":
|
|
371
|
-
}),
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
return
|
|
375
|
-
|
|
440
|
+
"X-FORWARDED-HOST": u
|
|
441
|
+
}), w = new URLSearchParams({ sc: y });
|
|
442
|
+
d && w.set("refreshOutdatedData", g.toString());
|
|
443
|
+
const v = `${a}/api/checkout/pub/orderForm${d ? `/${d}` : ""}?${w.toString()}`;
|
|
444
|
+
return I(
|
|
445
|
+
v,
|
|
376
446
|
{
|
|
377
|
-
...
|
|
378
|
-
headers:
|
|
379
|
-
...
|
|
447
|
+
...W,
|
|
448
|
+
headers: C,
|
|
449
|
+
...d ? {} : { body: "{}" }
|
|
380
450
|
},
|
|
381
451
|
{ storeCookies: o }
|
|
382
452
|
);
|
|
383
453
|
},
|
|
384
|
-
clearOrderFormMessages: ({ id:
|
|
385
|
-
const
|
|
454
|
+
clearOrderFormMessages: ({ id: d }) => {
|
|
455
|
+
const g = s({
|
|
386
456
|
"content-type": "application/json",
|
|
387
|
-
"X-FORWARDED-HOST":
|
|
457
|
+
"X-FORWARDED-HOST": u
|
|
388
458
|
});
|
|
389
|
-
return
|
|
390
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
459
|
+
return I(
|
|
460
|
+
`${a}/api/checkout/pub/orderForm/${d}/messages/clear`,
|
|
391
461
|
{
|
|
392
|
-
...
|
|
393
|
-
headers:
|
|
462
|
+
...W,
|
|
463
|
+
headers: g,
|
|
394
464
|
body: "{}"
|
|
395
465
|
}
|
|
396
466
|
);
|
|
397
467
|
},
|
|
398
468
|
updateOrderFormItems: ({
|
|
399
|
-
id:
|
|
400
|
-
orderItems:
|
|
469
|
+
id: d,
|
|
470
|
+
orderItems: g,
|
|
401
471
|
allowOutdatedData: m = "paymentData",
|
|
402
|
-
salesChannel:
|
|
403
|
-
shouldSplitItem:
|
|
472
|
+
salesChannel: y = i.storage.channel.salesChannel,
|
|
473
|
+
shouldSplitItem: C = !0
|
|
404
474
|
}) => {
|
|
405
|
-
const
|
|
475
|
+
const w = new URLSearchParams({
|
|
406
476
|
allowOutdatedData: m,
|
|
407
|
-
sc:
|
|
408
|
-
}),
|
|
477
|
+
sc: y
|
|
478
|
+
}), v = s({
|
|
409
479
|
"content-type": "application/json",
|
|
410
|
-
"X-FORWARDED-HOST":
|
|
480
|
+
"X-FORWARDED-HOST": u
|
|
411
481
|
});
|
|
412
|
-
return
|
|
413
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
482
|
+
return I(
|
|
483
|
+
`${a}/api/checkout/pub/orderForm/${d}/items?${w}`,
|
|
414
484
|
{
|
|
415
|
-
headers:
|
|
485
|
+
headers: v,
|
|
416
486
|
body: JSON.stringify({
|
|
417
|
-
orderItems:
|
|
418
|
-
noSplitItem: !
|
|
487
|
+
orderItems: g,
|
|
488
|
+
noSplitItem: !C
|
|
419
489
|
}),
|
|
420
490
|
method: "PATCH"
|
|
421
491
|
},
|
|
@@ -423,60 +493,60 @@ const j = {
|
|
|
423
493
|
);
|
|
424
494
|
},
|
|
425
495
|
setCustomData: ({
|
|
426
|
-
id:
|
|
427
|
-
appId:
|
|
496
|
+
id: d,
|
|
497
|
+
appId: g,
|
|
428
498
|
key: m,
|
|
429
|
-
value:
|
|
499
|
+
value: y
|
|
430
500
|
}) => {
|
|
431
|
-
const
|
|
501
|
+
const C = s({
|
|
432
502
|
"content-type": "application/json",
|
|
433
|
-
"X-FORWARDED-HOST":
|
|
503
|
+
"X-FORWARDED-HOST": u
|
|
434
504
|
});
|
|
435
|
-
return
|
|
436
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
505
|
+
return I(
|
|
506
|
+
`${a}/api/checkout/pub/orderForm/${d}/customData/${g}/${m}`,
|
|
437
507
|
{
|
|
438
|
-
headers:
|
|
439
|
-
body: JSON.stringify({ value:
|
|
508
|
+
headers: C,
|
|
509
|
+
body: JSON.stringify({ value: y }),
|
|
440
510
|
method: "PUT"
|
|
441
511
|
}
|
|
442
512
|
);
|
|
443
513
|
},
|
|
444
514
|
region: async ({
|
|
445
|
-
postalCode:
|
|
446
|
-
geoCoordinates:
|
|
515
|
+
postalCode: d,
|
|
516
|
+
geoCoordinates: g,
|
|
447
517
|
country: m,
|
|
448
|
-
salesChannel:
|
|
518
|
+
salesChannel: y
|
|
449
519
|
}) => {
|
|
450
|
-
const
|
|
520
|
+
const C = new URLSearchParams({
|
|
451
521
|
country: m,
|
|
452
|
-
sc:
|
|
522
|
+
sc: y ?? ""
|
|
453
523
|
});
|
|
454
|
-
|
|
524
|
+
d ? C.append("postalCode", d) : C.append(
|
|
455
525
|
"geoCoordinates",
|
|
456
|
-
`${
|
|
526
|
+
`${g?.longitude};${g?.latitude}`
|
|
457
527
|
);
|
|
458
|
-
const
|
|
528
|
+
const w = `${a}/api/checkout/pub/regions/?${C.toString()}`, v = s({
|
|
459
529
|
"content-type": "application/json",
|
|
460
|
-
"X-FORWARDED-HOST":
|
|
530
|
+
"X-FORWARDED-HOST": u
|
|
461
531
|
});
|
|
462
|
-
return
|
|
463
|
-
|
|
532
|
+
return I(
|
|
533
|
+
w,
|
|
464
534
|
{
|
|
465
|
-
headers:
|
|
535
|
+
headers: v
|
|
466
536
|
},
|
|
467
537
|
{ storeCookies: o }
|
|
468
538
|
);
|
|
469
539
|
},
|
|
470
540
|
address: async ({
|
|
471
|
-
postalCode:
|
|
472
|
-
country:
|
|
541
|
+
postalCode: d,
|
|
542
|
+
country: g
|
|
473
543
|
}) => {
|
|
474
544
|
const m = s({
|
|
475
545
|
"content-type": "application/json",
|
|
476
|
-
"X-FORWARDED-HOST":
|
|
546
|
+
"X-FORWARDED-HOST": u
|
|
477
547
|
});
|
|
478
|
-
return
|
|
479
|
-
`${a}/api/checkout/pub/postal-code/${
|
|
548
|
+
return I(
|
|
549
|
+
`${a}/api/checkout/pub/postal-code/${g}/${d}`,
|
|
480
550
|
{
|
|
481
551
|
headers: m
|
|
482
552
|
},
|
|
@@ -484,21 +554,21 @@ const j = {
|
|
|
484
554
|
);
|
|
485
555
|
},
|
|
486
556
|
cancelOrder: ({
|
|
487
|
-
orderId:
|
|
488
|
-
customerEmail:
|
|
557
|
+
orderId: d,
|
|
558
|
+
customerEmail: g,
|
|
489
559
|
reason: m
|
|
490
560
|
}) => {
|
|
491
|
-
const
|
|
561
|
+
const y = s({
|
|
492
562
|
"content-type": "application/json",
|
|
493
|
-
"X-FORWARDED-HOST":
|
|
563
|
+
"X-FORWARDED-HOST": u
|
|
494
564
|
});
|
|
495
|
-
return
|
|
496
|
-
`${a}/api/checkout/pub/orders/${
|
|
565
|
+
return I(
|
|
566
|
+
`${a}/api/checkout/pub/orders/${d}/user-cancel-request`,
|
|
497
567
|
{
|
|
498
568
|
method: "POST",
|
|
499
|
-
headers:
|
|
569
|
+
headers: y,
|
|
500
570
|
body: JSON.stringify({
|
|
501
|
-
customerEmail:
|
|
571
|
+
customerEmail: g,
|
|
502
572
|
reason: m
|
|
503
573
|
})
|
|
504
574
|
},
|
|
@@ -506,167 +576,167 @@ const j = {
|
|
|
506
576
|
);
|
|
507
577
|
},
|
|
508
578
|
pickupPoints: ({
|
|
509
|
-
geoCoordinates:
|
|
579
|
+
geoCoordinates: d
|
|
510
580
|
}) => {
|
|
511
|
-
if (!
|
|
581
|
+
if (!d)
|
|
512
582
|
throw new Error(
|
|
513
583
|
"Missing required parameter for listing pickup points."
|
|
514
584
|
);
|
|
515
|
-
const
|
|
585
|
+
const g = s({
|
|
516
586
|
"content-type": "application/json",
|
|
517
|
-
"X-FORWARDED-HOST":
|
|
587
|
+
"X-FORWARDED-HOST": u
|
|
518
588
|
});
|
|
519
|
-
return
|
|
589
|
+
return I(
|
|
520
590
|
`${a}/api/logistics-shipping/pickuppoints/_search`,
|
|
521
591
|
{
|
|
522
592
|
method: "POST",
|
|
523
|
-
headers:
|
|
524
|
-
body: JSON.stringify({ coordinate:
|
|
593
|
+
headers: g,
|
|
594
|
+
body: JSON.stringify({ coordinate: d })
|
|
525
595
|
},
|
|
526
596
|
{ storeCookies: o }
|
|
527
597
|
);
|
|
528
598
|
}
|
|
529
599
|
},
|
|
530
|
-
session: (
|
|
531
|
-
const
|
|
532
|
-
|
|
600
|
+
session: (d) => {
|
|
601
|
+
const g = new URLSearchParams(d);
|
|
602
|
+
g.set(
|
|
533
603
|
"items",
|
|
534
|
-
"profile.id,profile.email,profile.firstName,profile.lastName,profile.phone,shopper.firstName,shopper.lastName,shopper.organizationManager,store.channel,store.countryCode,store.cultureInfo,store.currencyCode,store.currencySymbol,authentication.customerId,authentication.storeUserId,authentication.storeUserEmail,authentication.unitId,authentication.unitName,checkout.regionId,public.postalCode"
|
|
604
|
+
"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"
|
|
535
605
|
);
|
|
536
606
|
const m = s({
|
|
537
607
|
"content-type": "application/json"
|
|
538
|
-
}),
|
|
539
|
-
return
|
|
540
|
-
`${a}/api/sessions?${
|
|
608
|
+
}), y = J(i?.headers?.cookie ?? "")?.vtex_session;
|
|
609
|
+
return I(
|
|
610
|
+
`${a}/api/sessions?${g.toString()}`,
|
|
541
611
|
{
|
|
542
|
-
method:
|
|
612
|
+
method: y ? "PATCH" : "POST",
|
|
543
613
|
headers: m,
|
|
544
614
|
body: "{}"
|
|
545
615
|
},
|
|
546
616
|
{ storeCookies: o }
|
|
547
617
|
);
|
|
548
618
|
},
|
|
549
|
-
subscribeToNewsletter: (
|
|
619
|
+
subscribeToNewsletter: (d) => I(
|
|
550
620
|
`${a}/api/dataentities/NL/documents/`,
|
|
551
621
|
{
|
|
552
|
-
...
|
|
553
|
-
body: JSON.stringify({ ...
|
|
622
|
+
...W,
|
|
623
|
+
body: JSON.stringify({ ...d, isNewsletterOptIn: !0 }),
|
|
554
624
|
method: "PATCH"
|
|
555
625
|
},
|
|
556
626
|
{ storeCookies: o }
|
|
557
627
|
),
|
|
558
628
|
profile: {
|
|
559
|
-
addresses: async (
|
|
560
|
-
const
|
|
629
|
+
addresses: async (d) => {
|
|
630
|
+
const g = s({
|
|
561
631
|
"content-type": "application/json",
|
|
562
|
-
"X-FORWARDED-HOST":
|
|
632
|
+
"X-FORWARDED-HOST": u
|
|
563
633
|
});
|
|
564
|
-
return
|
|
565
|
-
`${a}/api/profile-system/pvt/profiles/${
|
|
566
|
-
{ headers:
|
|
634
|
+
return I(
|
|
635
|
+
`${a}/api/profile-system/pvt/profiles/${d}/addresses`,
|
|
636
|
+
{ headers: g },
|
|
567
637
|
{ storeCookies: o }
|
|
568
638
|
);
|
|
569
639
|
}
|
|
570
640
|
},
|
|
571
641
|
oms: {
|
|
572
|
-
userOrder: ({ orderId:
|
|
573
|
-
const
|
|
642
|
+
userOrder: ({ orderId: d }) => {
|
|
643
|
+
const g = s({
|
|
574
644
|
"content-type": "application/json",
|
|
575
|
-
"X-FORWARDED-HOST":
|
|
645
|
+
"X-FORWARDED-HOST": u
|
|
576
646
|
});
|
|
577
|
-
return
|
|
578
|
-
`${a}/api/oms/user/orders/${
|
|
647
|
+
return I(
|
|
648
|
+
`${a}/api/oms/user/orders/${d}`,
|
|
579
649
|
{
|
|
580
650
|
method: "GET",
|
|
581
|
-
headers:
|
|
651
|
+
headers: g
|
|
582
652
|
},
|
|
583
653
|
{ storeCookies: o }
|
|
584
654
|
);
|
|
585
655
|
},
|
|
586
656
|
listUserOrders: ({
|
|
587
|
-
page:
|
|
588
|
-
status:
|
|
657
|
+
page: d,
|
|
658
|
+
status: g,
|
|
589
659
|
dateInitial: m,
|
|
590
|
-
dateFinal:
|
|
591
|
-
text:
|
|
592
|
-
clientEmail:
|
|
593
|
-
perPage:
|
|
594
|
-
pendingMyApproval:
|
|
660
|
+
dateFinal: y,
|
|
661
|
+
text: C,
|
|
662
|
+
clientEmail: w,
|
|
663
|
+
perPage: v,
|
|
664
|
+
pendingMyApproval: P
|
|
595
665
|
}) => {
|
|
596
|
-
const
|
|
666
|
+
const f = new URLSearchParams();
|
|
597
667
|
if (m) {
|
|
598
|
-
const
|
|
668
|
+
const A = new Date(m).setHours(
|
|
599
669
|
0,
|
|
600
670
|
0,
|
|
601
671
|
0,
|
|
602
672
|
0
|
|
603
673
|
);
|
|
604
|
-
m = new Date(
|
|
674
|
+
m = new Date(A).toISOString();
|
|
605
675
|
}
|
|
606
|
-
if (
|
|
607
|
-
const
|
|
676
|
+
if (y) {
|
|
677
|
+
const A = new Date(y).setHours(
|
|
608
678
|
23,
|
|
609
679
|
59,
|
|
610
680
|
59,
|
|
611
681
|
999
|
|
612
682
|
);
|
|
613
|
-
|
|
683
|
+
y = new Date(A).toISOString();
|
|
614
684
|
}
|
|
615
|
-
|
|
685
|
+
C && f.append("text", C), g && g.length > 0 && f.append("status", g.filter(Boolean).join(",")), m && y ? f.append(
|
|
616
686
|
"creation_date",
|
|
617
|
-
`creationDate:[${m} TO ${
|
|
618
|
-
) : m ?
|
|
619
|
-
const
|
|
687
|
+
`creationDate:[${m} TO ${y}]`
|
|
688
|
+
) : m ? f.append("creation_date", `creationDate:[${m} TO *]`) : y && f.append("creation_date", `creationDate:[* TO ${y}]`), w && f.append("clientEmail", w), d && f.append("page", d.toString()), v && f.append("per_page", v.toString()), P && f.append("my_pending_approvals", String(!0));
|
|
689
|
+
const D = s({
|
|
620
690
|
"content-type": "application/json",
|
|
621
|
-
"X-FORWARDED-HOST":
|
|
691
|
+
"X-FORWARDED-HOST": u
|
|
622
692
|
});
|
|
623
|
-
return
|
|
624
|
-
`${a}/api/oms/user/orders?${
|
|
693
|
+
return I(
|
|
694
|
+
`${a}/api/oms/user/orders?${f.toString()}`,
|
|
625
695
|
{
|
|
626
696
|
method: "GET",
|
|
627
|
-
headers:
|
|
697
|
+
headers: D
|
|
628
698
|
},
|
|
629
699
|
{ storeCookies: o }
|
|
630
700
|
);
|
|
631
701
|
},
|
|
632
702
|
getCommercialAuthorizationsByOrderId: ({
|
|
633
|
-
orderId:
|
|
703
|
+
orderId: d
|
|
634
704
|
}) => {
|
|
635
|
-
const
|
|
705
|
+
const g = s({
|
|
636
706
|
"content-type": "application/json",
|
|
637
|
-
"X-FORWARDED-HOST":
|
|
707
|
+
"X-FORWARDED-HOST": u
|
|
638
708
|
});
|
|
639
|
-
return
|
|
640
|
-
`${a}/${e}/commercial-authorizations/order/${
|
|
709
|
+
return I(
|
|
710
|
+
`${a}/${e}/commercial-authorizations/order/${d}`,
|
|
641
711
|
{
|
|
642
712
|
method: "GET",
|
|
643
|
-
headers:
|
|
713
|
+
headers: g
|
|
644
714
|
},
|
|
645
715
|
{ storeCookies: o }
|
|
646
716
|
);
|
|
647
717
|
},
|
|
648
718
|
processOrderAuthorization: async ({
|
|
649
|
-
orderAuthorizationId:
|
|
650
|
-
dimensionId:
|
|
719
|
+
orderAuthorizationId: d,
|
|
720
|
+
dimensionId: g,
|
|
651
721
|
ruleId: m,
|
|
652
|
-
approved:
|
|
722
|
+
approved: y
|
|
653
723
|
}) => {
|
|
654
|
-
const
|
|
724
|
+
const C = s({
|
|
655
725
|
"content-type": "application/json",
|
|
656
|
-
"X-FORWARDED-HOST":
|
|
657
|
-
}),
|
|
726
|
+
"X-FORWARDED-HOST": u
|
|
727
|
+
}), P = {
|
|
658
728
|
params: {
|
|
659
729
|
ruleId: m,
|
|
660
|
-
dimensionId:
|
|
661
|
-
score:
|
|
730
|
+
dimensionId: g,
|
|
731
|
+
score: y ? 100 : 0
|
|
662
732
|
}
|
|
663
733
|
};
|
|
664
|
-
return
|
|
665
|
-
`${a}/${e}/commercial-authorizations/${
|
|
734
|
+
return I(
|
|
735
|
+
`${a}/${e}/commercial-authorizations/${d}/callback`,
|
|
666
736
|
{
|
|
667
737
|
method: "POST",
|
|
668
|
-
headers:
|
|
669
|
-
body: JSON.stringify(
|
|
738
|
+
headers: C,
|
|
739
|
+
body: JSON.stringify(P)
|
|
670
740
|
},
|
|
671
741
|
{ storeCookies: o }
|
|
672
742
|
);
|
|
@@ -674,49 +744,49 @@ const j = {
|
|
|
674
744
|
},
|
|
675
745
|
units: {
|
|
676
746
|
getUnitByUserId: ({
|
|
677
|
-
userId:
|
|
747
|
+
userId: d
|
|
678
748
|
}) => {
|
|
679
|
-
const
|
|
749
|
+
const g = s({
|
|
680
750
|
"content-type": "application/json",
|
|
681
|
-
"X-FORWARDED-HOST":
|
|
751
|
+
"X-FORWARDED-HOST": u
|
|
682
752
|
});
|
|
683
|
-
return
|
|
684
|
-
`${a}/api/units/v1/${
|
|
753
|
+
return I(
|
|
754
|
+
`${a}/api/units/v1/${d}/unit`,
|
|
685
755
|
{
|
|
686
756
|
method: "GET",
|
|
687
|
-
headers:
|
|
757
|
+
headers: g
|
|
688
758
|
},
|
|
689
759
|
{}
|
|
690
760
|
);
|
|
691
761
|
},
|
|
692
762
|
getOrgUnitById: ({
|
|
693
|
-
orgUnitId:
|
|
763
|
+
orgUnitId: d
|
|
694
764
|
}) => {
|
|
695
|
-
const
|
|
765
|
+
const g = s({
|
|
696
766
|
"content-type": "application/json",
|
|
697
|
-
"X-FORWARDED-HOST":
|
|
767
|
+
"X-FORWARDED-HOST": u
|
|
698
768
|
});
|
|
699
|
-
return
|
|
700
|
-
`${a}/api/units/v1/${
|
|
769
|
+
return I(
|
|
770
|
+
`${a}/api/units/v1/${d}`,
|
|
701
771
|
{
|
|
702
772
|
method: "GET",
|
|
703
|
-
headers:
|
|
773
|
+
headers: g
|
|
704
774
|
},
|
|
705
775
|
{}
|
|
706
776
|
);
|
|
707
777
|
},
|
|
708
778
|
getScopesByOrgUnit: ({
|
|
709
|
-
orgUnitId:
|
|
779
|
+
orgUnitId: d
|
|
710
780
|
}) => {
|
|
711
|
-
const
|
|
781
|
+
const g = s({
|
|
712
782
|
"content-type": "application/json",
|
|
713
|
-
"X-FORWARDED-HOST":
|
|
783
|
+
"X-FORWARDED-HOST": u
|
|
714
784
|
});
|
|
715
|
-
return
|
|
716
|
-
`${a}/api/units/v1/${
|
|
785
|
+
return I(
|
|
786
|
+
`${a}/api/units/v1/${d}/scopes`,
|
|
717
787
|
{
|
|
718
788
|
method: "GET",
|
|
719
|
-
headers:
|
|
789
|
+
headers: g
|
|
720
790
|
},
|
|
721
791
|
{}
|
|
722
792
|
);
|
|
@@ -724,49 +794,49 @@ const j = {
|
|
|
724
794
|
},
|
|
725
795
|
licenseManager: {
|
|
726
796
|
getUserById: ({
|
|
727
|
-
userId:
|
|
797
|
+
userId: d
|
|
728
798
|
}) => {
|
|
729
|
-
const
|
|
799
|
+
const g = s({
|
|
730
800
|
"content-type": "application/json",
|
|
731
|
-
"X-FORWARDED-HOST":
|
|
801
|
+
"X-FORWARDED-HOST": u
|
|
732
802
|
});
|
|
733
|
-
return
|
|
734
|
-
`${a}/api/license-manager/users/${
|
|
803
|
+
return I(
|
|
804
|
+
`${a}/api/license-manager/users/${d}`,
|
|
735
805
|
{
|
|
736
806
|
method: "GET",
|
|
737
|
-
headers:
|
|
807
|
+
headers: g
|
|
738
808
|
},
|
|
739
809
|
{}
|
|
740
810
|
);
|
|
741
811
|
},
|
|
742
812
|
getUserByEmail: ({
|
|
743
|
-
email:
|
|
813
|
+
email: d
|
|
744
814
|
}) => {
|
|
745
|
-
const
|
|
815
|
+
const g = s({
|
|
746
816
|
"content-type": "application/json",
|
|
747
|
-
"X-FORWARDED-HOST":
|
|
817
|
+
"X-FORWARDED-HOST": u
|
|
748
818
|
});
|
|
749
|
-
return
|
|
750
|
-
`${a}/api/license-manager/pvt/users/${
|
|
819
|
+
return I(
|
|
820
|
+
`${a}/api/license-manager/pvt/users/${d}`,
|
|
751
821
|
{
|
|
752
822
|
method: "GET",
|
|
753
|
-
headers:
|
|
823
|
+
headers: g
|
|
754
824
|
},
|
|
755
825
|
{}
|
|
756
826
|
);
|
|
757
827
|
},
|
|
758
828
|
getUserRoles: ({
|
|
759
|
-
userId:
|
|
829
|
+
userId: d
|
|
760
830
|
}) => {
|
|
761
|
-
const
|
|
831
|
+
const g = s({
|
|
762
832
|
"content-type": "application/json",
|
|
763
|
-
"X-FORWARDED-HOST":
|
|
833
|
+
"X-FORWARDED-HOST": u
|
|
764
834
|
});
|
|
765
|
-
return
|
|
766
|
-
`${a}/api/license-manager/storefront/users/${
|
|
835
|
+
return I(
|
|
836
|
+
`${a}/api/license-manager/storefront/users/${d}/roles`,
|
|
767
837
|
{
|
|
768
838
|
method: "GET",
|
|
769
|
-
headers:
|
|
839
|
+
headers: g
|
|
770
840
|
},
|
|
771
841
|
{}
|
|
772
842
|
);
|
|
@@ -774,55 +844,71 @@ const j = {
|
|
|
774
844
|
},
|
|
775
845
|
masterData: {
|
|
776
846
|
getContractById: ({
|
|
777
|
-
contractId:
|
|
847
|
+
contractId: d
|
|
778
848
|
}) => {
|
|
779
|
-
if (!
|
|
780
|
-
throw new
|
|
781
|
-
const
|
|
849
|
+
if (!d)
|
|
850
|
+
throw new T("Missing contractId to fetch CL fields.");
|
|
851
|
+
const g = b({
|
|
782
852
|
Accept: "application/json",
|
|
783
|
-
"content-type": "application/json"
|
|
784
|
-
"X-FORWARDED-HOST": p
|
|
853
|
+
"content-type": "application/json"
|
|
785
854
|
});
|
|
786
|
-
return
|
|
787
|
-
`${a}/api/dataentities/CL/documents/${
|
|
855
|
+
return I(
|
|
856
|
+
`${a}/api/dataentities/CL/documents/${d}?_fields=_all`,
|
|
788
857
|
{
|
|
789
858
|
method: "GET",
|
|
790
|
-
headers:
|
|
859
|
+
headers: g
|
|
791
860
|
},
|
|
792
861
|
{}
|
|
793
862
|
);
|
|
794
863
|
},
|
|
795
864
|
getShopperById: ({
|
|
796
|
-
userId:
|
|
865
|
+
userId: d
|
|
797
866
|
}) => {
|
|
798
|
-
if (!
|
|
799
|
-
throw new
|
|
800
|
-
const
|
|
867
|
+
if (!d)
|
|
868
|
+
throw new T("Missing userId to fetch shopper name.");
|
|
869
|
+
const g = c({
|
|
801
870
|
Accept: "application/json",
|
|
802
871
|
"content-type": "application/json",
|
|
803
|
-
"X-FORWARDED-HOST":
|
|
804
|
-
}), m =
|
|
805
|
-
return
|
|
806
|
-
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${
|
|
872
|
+
"X-FORWARDED-HOST": u
|
|
873
|
+
}), m = d.replace(/-/g, "");
|
|
874
|
+
return I(
|
|
875
|
+
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${d})&_fields=_all&_schema=v1`,
|
|
807
876
|
{
|
|
808
877
|
method: "GET",
|
|
809
|
-
headers:
|
|
878
|
+
headers: g
|
|
810
879
|
},
|
|
811
880
|
{}
|
|
812
881
|
);
|
|
813
882
|
}
|
|
814
883
|
},
|
|
884
|
+
quotes: {
|
|
885
|
+
listUserQuotes: (d) => {
|
|
886
|
+
nt(d);
|
|
887
|
+
const g = tt(d), m = s({
|
|
888
|
+
"content-type": "application/json",
|
|
889
|
+
"X-FORWARDED-HOST": u
|
|
890
|
+
});
|
|
891
|
+
return I(
|
|
892
|
+
`${a}/api/quoting/quotes?${g.toString()}`,
|
|
893
|
+
{
|
|
894
|
+
method: "GET",
|
|
895
|
+
headers: m
|
|
896
|
+
},
|
|
897
|
+
{ storeCookies: o }
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
},
|
|
815
901
|
vtexid: {
|
|
816
902
|
validate: () => {
|
|
817
|
-
const
|
|
903
|
+
const d = s({
|
|
818
904
|
"content-type": "application/json",
|
|
819
|
-
"X-FORWARDED-HOST":
|
|
820
|
-
}),
|
|
821
|
-
return
|
|
905
|
+
"X-FORWARDED-HOST": u
|
|
906
|
+
}), g = z(le(i) ?? "", e);
|
|
907
|
+
return I(
|
|
822
908
|
`${a}/api/vtexid/credential/validate`,
|
|
823
909
|
{
|
|
824
|
-
headers:
|
|
825
|
-
body: JSON.stringify({ token:
|
|
910
|
+
headers: d,
|
|
911
|
+
body: JSON.stringify({ token: g }),
|
|
826
912
|
method: "POST"
|
|
827
913
|
},
|
|
828
914
|
{ storeCookies: o }
|
|
@@ -831,131 +917,159 @@ const j = {
|
|
|
831
917
|
},
|
|
832
918
|
orderEntry: {
|
|
833
919
|
uploadFile: ({
|
|
834
|
-
fileBuffer:
|
|
835
|
-
fileName:
|
|
920
|
+
fileBuffer: d,
|
|
921
|
+
fileName: g,
|
|
836
922
|
mimeType: m
|
|
837
923
|
}) => {
|
|
838
|
-
const
|
|
924
|
+
const y = s({
|
|
839
925
|
"content-type": "application/json",
|
|
840
|
-
"X-FORWARDED-HOST":
|
|
841
|
-
}),
|
|
842
|
-
`,
|
|
843
|
-
`--${
|
|
844
|
-
`Content-Disposition: form-data; name="file"; filename="${
|
|
845
|
-
`Content-Type: ${
|
|
926
|
+
"X-FORWARDED-HOST": u
|
|
927
|
+
}), C = `----FastStoreUploadBoundary${Date.now()}`, w = `\r
|
|
928
|
+
`, P = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", f = g.replaceAll(/[\r\n"]/g, "_"), D = [
|
|
929
|
+
`--${C}`,
|
|
930
|
+
`Content-Disposition: form-data; name="file"; filename="${f}"`,
|
|
931
|
+
`Content-Type: ${P}`,
|
|
846
932
|
"",
|
|
847
933
|
""
|
|
848
|
-
].join(
|
|
849
|
-
|
|
934
|
+
].join(w), A = `${w}--${C}--${w}`, U = Buffer.from(D), O = Buffer.from(A), E = new Uint8Array(
|
|
935
|
+
U.byteLength + d.byteLength + O.byteLength
|
|
850
936
|
);
|
|
851
|
-
let
|
|
852
|
-
return
|
|
937
|
+
let _ = 0;
|
|
938
|
+
return E.set(U, _), _ += U.byteLength, E.set(d, _), _ += d.byteLength, E.set(O, _), I(
|
|
853
939
|
`${a}/api/order-entry/upload?an=${e}`,
|
|
854
940
|
{
|
|
855
941
|
method: "POST",
|
|
856
942
|
headers: {
|
|
857
|
-
...
|
|
858
|
-
"content-type": `multipart/form-data; boundary=${
|
|
943
|
+
...y,
|
|
944
|
+
"content-type": `multipart/form-data; boundary=${C}`
|
|
859
945
|
},
|
|
860
|
-
body:
|
|
946
|
+
body: E.buffer
|
|
861
947
|
},
|
|
862
948
|
{}
|
|
863
949
|
);
|
|
864
950
|
},
|
|
865
951
|
startOperation: ({
|
|
866
|
-
objectKey:
|
|
867
|
-
orderFormId:
|
|
952
|
+
objectKey: d,
|
|
953
|
+
orderFormId: g,
|
|
868
954
|
sessionToken: m
|
|
869
955
|
}) => {
|
|
870
|
-
const
|
|
956
|
+
const y = s({
|
|
871
957
|
"content-type": "application/json",
|
|
872
|
-
"X-FORWARDED-HOST":
|
|
873
|
-
}),
|
|
874
|
-
objectKey:
|
|
875
|
-
orderFormId:
|
|
958
|
+
"X-FORWARDED-HOST": u
|
|
959
|
+
}), C = JSON.stringify({
|
|
960
|
+
objectKey: d,
|
|
961
|
+
orderFormId: g,
|
|
876
962
|
operation: "CreateCart",
|
|
877
963
|
...m ? { sessionToken: m } : {}
|
|
878
964
|
});
|
|
879
|
-
return
|
|
965
|
+
return I(
|
|
880
966
|
`${a}/api/order-entry/operation?an=${e}`,
|
|
881
967
|
{
|
|
882
968
|
method: "POST",
|
|
883
|
-
headers:
|
|
884
|
-
body:
|
|
969
|
+
headers: y,
|
|
970
|
+
body: C
|
|
885
971
|
},
|
|
886
972
|
{}
|
|
887
973
|
);
|
|
888
974
|
},
|
|
889
975
|
getOperation: ({
|
|
890
|
-
operationId:
|
|
976
|
+
operationId: d
|
|
891
977
|
}) => {
|
|
892
|
-
const
|
|
978
|
+
const g = s({
|
|
893
979
|
"content-type": "application/json",
|
|
894
|
-
"X-FORWARDED-HOST":
|
|
980
|
+
"X-FORWARDED-HOST": u
|
|
895
981
|
});
|
|
896
|
-
return
|
|
897
|
-
`${a}/api/order-entry/operation/${
|
|
982
|
+
return I(
|
|
983
|
+
`${a}/api/order-entry/operation/${d}?an=${e}`,
|
|
898
984
|
{
|
|
899
985
|
method: "GET",
|
|
900
|
-
headers:
|
|
986
|
+
headers: g
|
|
901
987
|
},
|
|
902
988
|
{}
|
|
903
989
|
);
|
|
904
990
|
},
|
|
905
991
|
createOrderForm: () => {
|
|
906
|
-
const
|
|
992
|
+
const d = s({
|
|
907
993
|
"content-type": "application/json",
|
|
908
|
-
"X-FORWARDED-HOST":
|
|
994
|
+
"X-FORWARDED-HOST": u
|
|
909
995
|
});
|
|
910
|
-
return
|
|
996
|
+
return I(
|
|
911
997
|
`${a}/api/checkout/pub/orderForm?sc=${i.storage.channel.salesChannel}`,
|
|
912
998
|
{
|
|
913
999
|
method: "POST",
|
|
914
|
-
headers:
|
|
1000
|
+
headers: d,
|
|
915
1001
|
body: "{}"
|
|
916
1002
|
},
|
|
917
1003
|
{}
|
|
918
1004
|
);
|
|
919
1005
|
},
|
|
920
1006
|
getOrderFormItems: ({
|
|
921
|
-
orderFormId:
|
|
1007
|
+
orderFormId: d
|
|
922
1008
|
}) => {
|
|
923
|
-
const
|
|
1009
|
+
const g = s({
|
|
924
1010
|
"content-type": "application/json",
|
|
925
|
-
"X-FORWARDED-HOST":
|
|
1011
|
+
"X-FORWARDED-HOST": u
|
|
926
1012
|
});
|
|
927
|
-
return
|
|
928
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
1013
|
+
return I(
|
|
1014
|
+
`${a}/api/checkout/pub/orderForm/${d}`,
|
|
929
1015
|
{
|
|
930
1016
|
method: "GET",
|
|
931
|
-
headers:
|
|
1017
|
+
headers: g
|
|
932
1018
|
},
|
|
933
1019
|
{}
|
|
934
1020
|
);
|
|
935
1021
|
}
|
|
1022
|
+
},
|
|
1023
|
+
// Anonymous personalization / recommendations served by the VTEX
|
|
1024
|
+
// Recommendations BFF. The BFF replies with `vtex-rec-*` Set-Cookie headers
|
|
1025
|
+
// (forwarded to the browser via `ctx.storage.cookies`) and returns products
|
|
1026
|
+
// already hydrated in the Intelligent Search shape.
|
|
1027
|
+
recommendation: {
|
|
1028
|
+
recommendations: ({
|
|
1029
|
+
campaignVrn: d,
|
|
1030
|
+
userId: g,
|
|
1031
|
+
products: m = [],
|
|
1032
|
+
salesChannel: y,
|
|
1033
|
+
locale: C
|
|
1034
|
+
}) => {
|
|
1035
|
+
const w = new URLSearchParams({ an: e, campaignVrn: d });
|
|
1036
|
+
return g && w.append("userId", g), m.length > 0 && w.append("products", m.join(",")), y && w.append("salesChannel", y), C && w.append("locale", C), I(
|
|
1037
|
+
`${h}/recommendations?${w.toString()}`,
|
|
1038
|
+
{ headers: S },
|
|
1039
|
+
{ storeCookies: o }
|
|
1040
|
+
);
|
|
1041
|
+
},
|
|
1042
|
+
startRecommendationSession: () => {
|
|
1043
|
+
const d = new URLSearchParams({ an: e });
|
|
1044
|
+
return I(
|
|
1045
|
+
`${h}/users/start-session?${d.toString()}`,
|
|
1046
|
+
{ method: "POST", headers: S },
|
|
1047
|
+
{ storeCookies: o }
|
|
1048
|
+
);
|
|
1049
|
+
}
|
|
936
1050
|
}
|
|
937
1051
|
};
|
|
938
|
-
},
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
]),
|
|
1052
|
+
}, de = "fuzzy", ue = "operator", pe = "pickupPoint", we = "shipping", De = "delivery-options", it = "in-stock", at = "trade-policy", ot = "region-id", st = /* @__PURE__ */ new Set([
|
|
1053
|
+
at,
|
|
1054
|
+
ot,
|
|
1055
|
+
de,
|
|
1056
|
+
ue,
|
|
1057
|
+
pe
|
|
1058
|
+
]), ct = /* @__PURE__ */ new Set([
|
|
945
1059
|
"zip-code",
|
|
946
1060
|
"pickupPoint",
|
|
947
1061
|
"country",
|
|
948
1062
|
"coordinates",
|
|
949
1063
|
"deliveryZonesHash",
|
|
950
1064
|
"pickupPointsHash"
|
|
951
|
-
]),
|
|
1065
|
+
]), lt = /* @__PURE__ */ new Set(["productClusterIds"]), Ae = (e) => encodeURI(decodeURI(e)), dt = (e) => encodeURIComponent(
|
|
952
1066
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
953
|
-
),
|
|
954
|
-
function
|
|
1067
|
+
), ut = /^pickup-in-point-(.+)$/;
|
|
1068
|
+
function Qe(e) {
|
|
955
1069
|
if (!e)
|
|
956
1070
|
return {};
|
|
957
1071
|
try {
|
|
958
|
-
const t =
|
|
1072
|
+
const t = J(e).vtex_segment;
|
|
959
1073
|
if (!t)
|
|
960
1074
|
return {};
|
|
961
1075
|
const r = Buffer.from(t, "base64").toString("utf-8");
|
|
@@ -964,18 +1078,18 @@ function Ke(e) {
|
|
|
964
1078
|
return {};
|
|
965
1079
|
}
|
|
966
1080
|
}
|
|
967
|
-
function
|
|
1081
|
+
function pt(e) {
|
|
968
1082
|
const n = {}, t = {}, r = [];
|
|
969
1083
|
for (const i of e.split(";")) {
|
|
970
1084
|
const a = i.indexOf("=");
|
|
971
1085
|
if (a < 0) continue;
|
|
972
1086
|
const o = i.slice(0, a), s = i.slice(a + 1);
|
|
973
|
-
!o || !s || (
|
|
1087
|
+
!o || !s || (ct.has(o) ? n[o] = s : lt.has(o) ? t[o] = s : r.push({ key: o, value: s }));
|
|
974
1088
|
}
|
|
975
1089
|
return { shipping: n, queryParams: t, extraFacets: r };
|
|
976
1090
|
}
|
|
977
|
-
function
|
|
978
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, queryParams: r, extraFacets: i } =
|
|
1091
|
+
function gt(e) {
|
|
1092
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, queryParams: r, extraFacets: i } = pt(n);
|
|
979
1093
|
return {
|
|
980
1094
|
segmentParams: {
|
|
981
1095
|
sc: e.channel,
|
|
@@ -997,7 +1111,7 @@ function st(e) {
|
|
|
997
1111
|
extraFacets: i
|
|
998
1112
|
};
|
|
999
1113
|
}
|
|
1000
|
-
function
|
|
1114
|
+
function Ke(e, n) {
|
|
1001
1115
|
const t = [
|
|
1002
1116
|
["sc", n.sc],
|
|
1003
1117
|
["regionId", n.regionId],
|
|
@@ -1019,9 +1133,9 @@ function Qe(e, n) {
|
|
|
1019
1133
|
i != null && i !== "" && e.append(r, String(i));
|
|
1020
1134
|
}
|
|
1021
1135
|
function Ze(e) {
|
|
1022
|
-
return
|
|
1136
|
+
return ut.exec(e)?.[1];
|
|
1023
1137
|
}
|
|
1024
|
-
function
|
|
1138
|
+
function mt(e) {
|
|
1025
1139
|
const n = e.find((r) => r.key === "shipping"), t = n ? Ze(n.value) : void 0;
|
|
1026
1140
|
if (t !== void 0)
|
|
1027
1141
|
try {
|
|
@@ -1030,8 +1144,8 @@ function ct(e) {
|
|
|
1030
1144
|
return t;
|
|
1031
1145
|
}
|
|
1032
1146
|
}
|
|
1033
|
-
function
|
|
1034
|
-
const t =
|
|
1147
|
+
function ht(e, n) {
|
|
1148
|
+
const t = mt(
|
|
1035
1149
|
n
|
|
1036
1150
|
);
|
|
1037
1151
|
return t === void 0 ? e : {
|
|
@@ -1039,25 +1153,25 @@ function lt(e, n) {
|
|
|
1039
1153
|
pickupPoint: t
|
|
1040
1154
|
};
|
|
1041
1155
|
}
|
|
1042
|
-
function
|
|
1156
|
+
function ft(e) {
|
|
1043
1157
|
return e.map((n) => n.key !== "shipping" || Ze(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1044
1158
|
}
|
|
1045
|
-
function
|
|
1159
|
+
function St(e, n) {
|
|
1046
1160
|
let t = [...e];
|
|
1047
1161
|
const r = t.some((i) => i.key === "shipping");
|
|
1048
1162
|
for (const i of n)
|
|
1049
1163
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1050
|
-
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")),
|
|
1164
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), ft(t);
|
|
1051
1165
|
}
|
|
1052
|
-
function
|
|
1166
|
+
function yt(e) {
|
|
1053
1167
|
return e.reduce((n, t) => {
|
|
1054
1168
|
let { key: r, value: i } = t;
|
|
1055
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${
|
|
1169
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Ae(r)}/${dt(Ae(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1056
1170
|
}, "");
|
|
1057
1171
|
}
|
|
1058
|
-
const
|
|
1059
|
-
function
|
|
1060
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1172
|
+
const It = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), vt = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1173
|
+
function Ot(e, n) {
|
|
1174
|
+
const { segmentParams: t, extraFacets: r } = gt(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
|
|
1061
1175
|
return {
|
|
1062
1176
|
segmentParams: {
|
|
1063
1177
|
...t,
|
|
@@ -1068,21 +1182,21 @@ function ht(e, n) {
|
|
|
1068
1182
|
extraFacets: r
|
|
1069
1183
|
};
|
|
1070
1184
|
}
|
|
1071
|
-
function
|
|
1072
|
-
const t = e.filter(({ key:
|
|
1073
|
-
({ key:
|
|
1185
|
+
function Ct(e, n) {
|
|
1186
|
+
const t = e.filter(({ key: c }) => !st.has(c)), r = e.find(
|
|
1187
|
+
({ key: c, value: l }) => c === we && l !== "all-delivery-methods"
|
|
1074
1188
|
) ?? null, i = e.find(
|
|
1075
|
-
({ key:
|
|
1189
|
+
({ key: c, value: l }) => c === De && l !== "all-delivery-options"
|
|
1076
1190
|
) ?? null, a = [...t], o = a.some(
|
|
1077
|
-
({ key:
|
|
1191
|
+
({ key: c }) => c === we
|
|
1078
1192
|
), s = a.some(
|
|
1079
|
-
({ key:
|
|
1193
|
+
({ key: c }) => c === De
|
|
1080
1194
|
);
|
|
1081
|
-
return r !== null && !o && a.push(r), i !== null && !s && a.push(i),
|
|
1195
|
+
return r !== null && !o && a.push(r), i !== null && !s && a.push(i), St(a, n);
|
|
1082
1196
|
}
|
|
1083
|
-
function
|
|
1084
|
-
const t = e.find(({ key: a }) => a ===
|
|
1085
|
-
t &&
|
|
1197
|
+
function bt(e, n) {
|
|
1198
|
+
const t = e.find(({ key: a }) => a === de) ?? null, r = e.find(({ key: a }) => a === ue) ?? null, i = e.find(({ key: a }) => a === pe) ?? null;
|
|
1199
|
+
t && It(t) && n.append(de, t.value), r && vt(r) && n.append(ue, r.value), i && n.append(pe, i.value);
|
|
1086
1200
|
}
|
|
1087
1201
|
function Pe(e, n, t, r) {
|
|
1088
1202
|
const {
|
|
@@ -1090,39 +1204,39 @@ function Pe(e, n, t, r) {
|
|
|
1090
1204
|
page: a,
|
|
1091
1205
|
count: o,
|
|
1092
1206
|
sort: s,
|
|
1093
|
-
selectedFacets:
|
|
1094
|
-
showInvisibleItems:
|
|
1095
|
-
sponsoredCount:
|
|
1096
|
-
hideUnavailableItems:
|
|
1097
|
-
allowRedirect:
|
|
1098
|
-
} = e,
|
|
1207
|
+
selectedFacets: c = [],
|
|
1208
|
+
showInvisibleItems: l,
|
|
1209
|
+
sponsoredCount: p,
|
|
1210
|
+
hideUnavailableItems: u,
|
|
1211
|
+
allowRedirect: h = !1
|
|
1212
|
+
} = e, S = new URLSearchParams();
|
|
1099
1213
|
if (r.includePagination && a !== void 0 && o !== void 0) {
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1214
|
+
const g = a * o, m = o === 0 ? g : g + o - 1;
|
|
1215
|
+
S.append("from", g.toString()), S.append("to", m.toString());
|
|
1102
1216
|
}
|
|
1103
|
-
i &&
|
|
1104
|
-
const
|
|
1217
|
+
i && S.append("query", i), r.includeSort && s && S.append("sort", s);
|
|
1218
|
+
const b = ht(
|
|
1105
1219
|
t.segmentParams,
|
|
1106
|
-
|
|
1220
|
+
c
|
|
1107
1221
|
);
|
|
1108
|
-
if (
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1222
|
+
if (Ke(S, b ?? t.segmentParams), bt(c, S), l && S.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1223
|
+
const g = c.find(({ key: y }) => y === it), m = g ? g.value : u?.toString() ?? n.hideUnavailableItems.toString();
|
|
1224
|
+
S.append("hideUnavailableItems", m);
|
|
1111
1225
|
}
|
|
1112
|
-
n?.simulationBehavior !== void 0 &&
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1226
|
+
n?.simulationBehavior !== void 0 && S.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && S.append("showSponsored", n.showSponsored.toString()), p !== void 0 && S.append("sponsoredCount", p.toString()), h !== void 0 && S.append("allowRedirect", h.toString());
|
|
1227
|
+
const d = yt(
|
|
1228
|
+
Ct(c, t.extraFacets)
|
|
1115
1229
|
);
|
|
1116
|
-
return { params:
|
|
1230
|
+
return { params: S, path: d };
|
|
1117
1231
|
}
|
|
1118
|
-
function
|
|
1232
|
+
function wt(e, n) {
|
|
1119
1233
|
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: a } = e, o = new URLSearchParams({
|
|
1120
1234
|
field: t ?? "",
|
|
1121
1235
|
value: r ?? ""
|
|
1122
1236
|
});
|
|
1123
|
-
return
|
|
1237
|
+
return Ke(o, n), i && o.append("hideUnavailableItems", "true"), a && o.append("show-invisible-items", "true"), o;
|
|
1124
1238
|
}
|
|
1125
|
-
function
|
|
1239
|
+
function G(e, n) {
|
|
1126
1240
|
return {
|
|
1127
1241
|
path: e,
|
|
1128
1242
|
params: n,
|
|
@@ -1132,8 +1246,8 @@ function W(e, n) {
|
|
|
1132
1246
|
}
|
|
1133
1247
|
};
|
|
1134
1248
|
}
|
|
1135
|
-
function
|
|
1136
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a =
|
|
1249
|
+
function H(e) {
|
|
1250
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a = Ot(t, r);
|
|
1137
1251
|
switch (n) {
|
|
1138
1252
|
case "product-search":
|
|
1139
1253
|
case "facets": {
|
|
@@ -1143,7 +1257,7 @@ function G(e) {
|
|
|
1143
1257
|
a,
|
|
1144
1258
|
{ includePagination: !0, includeSort: !0 }
|
|
1145
1259
|
);
|
|
1146
|
-
return
|
|
1260
|
+
return G(s, o);
|
|
1147
1261
|
}
|
|
1148
1262
|
case "catalog-count": {
|
|
1149
1263
|
const { params: o, path: s } = Pe(
|
|
@@ -1152,24 +1266,24 @@ function G(e) {
|
|
|
1152
1266
|
a,
|
|
1153
1267
|
{ includePagination: !1, includeSort: !1 }
|
|
1154
1268
|
);
|
|
1155
|
-
return
|
|
1269
|
+
return G(s, o);
|
|
1156
1270
|
}
|
|
1157
1271
|
case "products": {
|
|
1158
|
-
const o =
|
|
1159
|
-
return
|
|
1272
|
+
const o = wt(i, a.segmentParams);
|
|
1273
|
+
return G("", o);
|
|
1160
1274
|
}
|
|
1161
1275
|
case "search-suggestions": {
|
|
1162
1276
|
const o = new URLSearchParams({
|
|
1163
1277
|
query: i.query?.toString() ?? "",
|
|
1164
1278
|
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1165
1279
|
});
|
|
1166
|
-
return
|
|
1280
|
+
return G("", o);
|
|
1167
1281
|
}
|
|
1168
1282
|
case "top-searches": {
|
|
1169
1283
|
const o = new URLSearchParams({
|
|
1170
1284
|
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1171
1285
|
});
|
|
1172
|
-
return
|
|
1286
|
+
return G("", o);
|
|
1173
1287
|
}
|
|
1174
1288
|
default: {
|
|
1175
1289
|
const o = n;
|
|
@@ -1177,16 +1291,16 @@ function G(e) {
|
|
|
1177
1291
|
}
|
|
1178
1292
|
}
|
|
1179
1293
|
}
|
|
1180
|
-
const
|
|
1181
|
-
function
|
|
1294
|
+
const Dt = 10;
|
|
1295
|
+
function At(e) {
|
|
1182
1296
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1183
1297
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1184
1298
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const n =
|
|
1299
|
+
function Pt(e) {
|
|
1300
|
+
const n = Qe(e.headers?.cookie);
|
|
1187
1301
|
return e.storage.locale || n.cultureInfo || "";
|
|
1188
1302
|
}
|
|
1189
|
-
const
|
|
1303
|
+
const Ut = ({
|
|
1190
1304
|
account: e,
|
|
1191
1305
|
environment: n,
|
|
1192
1306
|
hideUnavailableItems: t,
|
|
@@ -1194,69 +1308,69 @@ const Ct = ({
|
|
|
1194
1308
|
showSponsored: i,
|
|
1195
1309
|
subDomainPrefix: a
|
|
1196
1310
|
}, o) => {
|
|
1197
|
-
const s = `https://${e}.${n}.com.br`,
|
|
1311
|
+
const s = `https://${e}.${n}.com.br`, c = Je(o), l = Qe(o.headers?.cookie), p = () => ({
|
|
1198
1312
|
salesChannel: o.storage.channel.salesChannel,
|
|
1199
|
-
regionId:
|
|
1200
|
-
locale:
|
|
1313
|
+
regionId: At(o),
|
|
1314
|
+
locale: Pt(o),
|
|
1201
1315
|
hideUnavailableItems: t,
|
|
1202
1316
|
simulationBehavior: r,
|
|
1203
1317
|
showSponsored: i
|
|
1204
|
-
}),
|
|
1318
|
+
}), u = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "", h = a && a.map((f) => f + ".").find((f) => u.includes(f)) || "", S = u.replace(h, ""), b = c({
|
|
1205
1319
|
"content-type": "application/json",
|
|
1206
|
-
"X-FORWARDED-HOST":
|
|
1207
|
-
}),
|
|
1208
|
-
const
|
|
1209
|
-
endpoint:
|
|
1210
|
-
segment:
|
|
1211
|
-
defaults:
|
|
1212
|
-
args:
|
|
1320
|
+
"X-FORWARDED-HOST": S
|
|
1321
|
+
}), d = ({ type: f, ...D }) => {
|
|
1322
|
+
const A = f === "facets" ? "facets" : "product-search", U = H({
|
|
1323
|
+
endpoint: A,
|
|
1324
|
+
segment: l,
|
|
1325
|
+
defaults: p(),
|
|
1326
|
+
args: D
|
|
1213
1327
|
});
|
|
1214
|
-
return
|
|
1215
|
-
`${s}/api/intelligent-search/v1/${
|
|
1216
|
-
{ headers:
|
|
1328
|
+
return I(
|
|
1329
|
+
`${s}/api/intelligent-search/v1/${A}/${U.path}?${U.params.toString()}`,
|
|
1330
|
+
{ headers: b }
|
|
1217
1331
|
);
|
|
1218
|
-
},
|
|
1219
|
-
field:
|
|
1220
|
-
value:
|
|
1221
|
-
hideUnavailableItems:
|
|
1222
|
-
showInvisibleItems:
|
|
1332
|
+
}, g = (f) => d({ ...f, type: "product_search" }), m = ({
|
|
1333
|
+
field: f,
|
|
1334
|
+
value: D,
|
|
1335
|
+
hideUnavailableItems: A,
|
|
1336
|
+
showInvisibleItems: U
|
|
1223
1337
|
}) => {
|
|
1224
|
-
const
|
|
1338
|
+
const O = H({
|
|
1225
1339
|
endpoint: "products",
|
|
1226
|
-
segment:
|
|
1227
|
-
defaults:
|
|
1340
|
+
segment: l,
|
|
1341
|
+
defaults: p(),
|
|
1228
1342
|
args: {
|
|
1229
|
-
field:
|
|
1230
|
-
value:
|
|
1231
|
-
hideUnavailableItems:
|
|
1232
|
-
showInvisibleItems:
|
|
1343
|
+
field: f,
|
|
1344
|
+
value: D,
|
|
1345
|
+
hideUnavailableItems: A,
|
|
1346
|
+
showInvisibleItems: U
|
|
1233
1347
|
}
|
|
1234
1348
|
});
|
|
1235
|
-
return
|
|
1236
|
-
`${s}/api/intelligent-search/v1/products?${
|
|
1237
|
-
{ headers:
|
|
1349
|
+
return I(
|
|
1350
|
+
`${s}/api/intelligent-search/v1/products?${O.params.toString()}`,
|
|
1351
|
+
{ headers: b }
|
|
1238
1352
|
);
|
|
1239
1353
|
};
|
|
1240
1354
|
return {
|
|
1241
|
-
facets: (
|
|
1242
|
-
products:
|
|
1243
|
-
fetchProduct:
|
|
1355
|
+
facets: (f) => d({ ...f, type: "facets" }),
|
|
1356
|
+
products: g,
|
|
1357
|
+
fetchProduct: m,
|
|
1244
1358
|
productsByIdentifier: async ({
|
|
1245
|
-
field:
|
|
1246
|
-
values:
|
|
1247
|
-
showInvisibleItems:
|
|
1248
|
-
hideUnavailableItems:
|
|
1359
|
+
field: f,
|
|
1360
|
+
values: D,
|
|
1361
|
+
showInvisibleItems: A,
|
|
1362
|
+
hideUnavailableItems: U
|
|
1249
1363
|
}) => {
|
|
1250
|
-
const
|
|
1364
|
+
const O = Ie(Dt);
|
|
1251
1365
|
return (await Promise.all(
|
|
1252
|
-
|
|
1253
|
-
(_) =>
|
|
1366
|
+
D.map(
|
|
1367
|
+
(_) => O(async () => {
|
|
1254
1368
|
try {
|
|
1255
|
-
return await
|
|
1256
|
-
field:
|
|
1369
|
+
return await m({
|
|
1370
|
+
field: f,
|
|
1257
1371
|
value: _,
|
|
1258
|
-
hideUnavailableItems:
|
|
1259
|
-
showInvisibleItems:
|
|
1372
|
+
hideUnavailableItems: U,
|
|
1373
|
+
showInvisibleItems: A
|
|
1260
1374
|
});
|
|
1261
1375
|
} catch {
|
|
1262
1376
|
return null;
|
|
@@ -1267,113 +1381,113 @@ const Ct = ({
|
|
|
1267
1381
|
(_) => _ !== null
|
|
1268
1382
|
);
|
|
1269
1383
|
},
|
|
1270
|
-
suggestedTerms: (
|
|
1271
|
-
const
|
|
1384
|
+
suggestedTerms: (f) => {
|
|
1385
|
+
const D = H({
|
|
1272
1386
|
endpoint: "search-suggestions",
|
|
1273
|
-
segment:
|
|
1274
|
-
defaults:
|
|
1275
|
-
args: { query:
|
|
1387
|
+
segment: l,
|
|
1388
|
+
defaults: p(),
|
|
1389
|
+
args: { query: f.query }
|
|
1276
1390
|
});
|
|
1277
|
-
return
|
|
1278
|
-
`${s}/api/intelligent-search/v1/search-suggestions?${
|
|
1279
|
-
{ headers:
|
|
1391
|
+
return I(
|
|
1392
|
+
`${s}/api/intelligent-search/v1/search-suggestions?${D.params.toString()}`,
|
|
1393
|
+
{ headers: b }
|
|
1280
1394
|
);
|
|
1281
1395
|
},
|
|
1282
1396
|
topSearches: () => {
|
|
1283
|
-
const
|
|
1397
|
+
const f = H({
|
|
1284
1398
|
endpoint: "top-searches",
|
|
1285
|
-
segment:
|
|
1286
|
-
defaults:
|
|
1399
|
+
segment: l,
|
|
1400
|
+
defaults: p()
|
|
1287
1401
|
});
|
|
1288
|
-
return
|
|
1289
|
-
`${s}/api/intelligent-search/v1/top-searches?${
|
|
1290
|
-
{ headers:
|
|
1402
|
+
return I(
|
|
1403
|
+
`${s}/api/intelligent-search/v1/top-searches?${f.params.toString()}`,
|
|
1404
|
+
{ headers: b }
|
|
1291
1405
|
);
|
|
1292
1406
|
},
|
|
1293
|
-
productCount: (
|
|
1294
|
-
const
|
|
1407
|
+
productCount: (f) => {
|
|
1408
|
+
const D = H({
|
|
1295
1409
|
endpoint: "catalog-count",
|
|
1296
|
-
segment:
|
|
1297
|
-
defaults:
|
|
1298
|
-
args:
|
|
1410
|
+
segment: l,
|
|
1411
|
+
defaults: p(),
|
|
1412
|
+
args: f
|
|
1299
1413
|
});
|
|
1300
|
-
return
|
|
1301
|
-
`${s}/api/intelligent-search/v1/catalog-count/${
|
|
1302
|
-
{ headers:
|
|
1414
|
+
return I(
|
|
1415
|
+
`${s}/api/intelligent-search/v1/catalog-count/${D.path}?${D.params.toString()}`,
|
|
1416
|
+
{ headers: b }
|
|
1303
1417
|
);
|
|
1304
1418
|
}
|
|
1305
1419
|
};
|
|
1306
|
-
},
|
|
1307
|
-
const t =
|
|
1420
|
+
}, Et = (e, n) => {
|
|
1421
|
+
const t = Ut(e, n), r = rt(e, n);
|
|
1308
1422
|
return {
|
|
1309
1423
|
search: t,
|
|
1310
1424
|
commerce: r
|
|
1311
1425
|
};
|
|
1312
|
-
},
|
|
1426
|
+
}, _t = 20, Tt = /* @__PURE__ */ new Set([
|
|
1313
1427
|
"brand",
|
|
1314
1428
|
"category",
|
|
1315
1429
|
"department",
|
|
1316
1430
|
"subcategory",
|
|
1317
1431
|
"collection",
|
|
1318
1432
|
"cluster"
|
|
1319
|
-
]),
|
|
1320
|
-
const t =
|
|
1433
|
+
]), x = (e) => typeof e.pageType == "string" && Tt.has(e.pageType.toLowerCase()), Rt = (e, n) => {
|
|
1434
|
+
const t = Ie(_t), r = async (i) => Promise.all(
|
|
1321
1435
|
i.map(
|
|
1322
1436
|
(a) => t(async () => {
|
|
1323
1437
|
const o = await n.commerce.catalog.portal.pagetype(a);
|
|
1324
|
-
if (
|
|
1438
|
+
if (x(o))
|
|
1325
1439
|
return o;
|
|
1326
|
-
throw new
|
|
1440
|
+
throw new L(
|
|
1327
1441
|
`Catalog returned ${o.pageType} for slug: ${a}. This usually happens when there is more than one category with the same name in the same category tree level.`
|
|
1328
1442
|
);
|
|
1329
1443
|
})
|
|
1330
1444
|
)
|
|
1331
1445
|
);
|
|
1332
|
-
return new
|
|
1446
|
+
return new ie(r, {
|
|
1333
1447
|
// DataLoader is being used to cache requests, not to batch them
|
|
1334
1448
|
batch: !1
|
|
1335
1449
|
});
|
|
1336
|
-
},
|
|
1450
|
+
}, kt = (e, n) => {
|
|
1337
1451
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1338
|
-
return new
|
|
1339
|
-
},
|
|
1340
|
-
const t =
|
|
1341
|
-
const o = a.reduce((
|
|
1452
|
+
return new ie(t);
|
|
1453
|
+
}, Ft = 1, Nt = (e, n) => {
|
|
1454
|
+
const t = Ie(Ft), r = async (a) => {
|
|
1455
|
+
const o = a.reduce((u, { items: h }) => [...u, h], []), s = [...o.flat()], c = await n.commerce.checkout.simulation({
|
|
1342
1456
|
country: a[0].country,
|
|
1343
1457
|
postalCode: a[0].postalCode,
|
|
1344
1458
|
items: s
|
|
1345
|
-
}),
|
|
1346
|
-
(
|
|
1347
|
-
const
|
|
1348
|
-
return typeof
|
|
1459
|
+
}), l = c.items.reduce(
|
|
1460
|
+
(u, h) => {
|
|
1461
|
+
const S = h.requestIndex;
|
|
1462
|
+
return typeof S == "number" && S < u.length && (u[S] = h), u;
|
|
1349
1463
|
},
|
|
1350
1464
|
Array(s.length).fill(null)
|
|
1351
|
-
),
|
|
1352
|
-
(
|
|
1465
|
+
), p = o.reduce(
|
|
1466
|
+
(u, h) => [...u, h.length + u[u.length - 1]],
|
|
1353
1467
|
[0]
|
|
1354
1468
|
);
|
|
1355
|
-
return o.map((
|
|
1356
|
-
...
|
|
1357
|
-
items:
|
|
1469
|
+
return o.map((u, h) => ({
|
|
1470
|
+
...c,
|
|
1471
|
+
items: l.slice(p[h], p[h + 1]).filter((S) => !!S)
|
|
1358
1472
|
}));
|
|
1359
1473
|
}, i = async (a) => t(r, a);
|
|
1360
|
-
return new
|
|
1474
|
+
return new ie(i, {
|
|
1361
1475
|
maxBatchSize: 50
|
|
1362
1476
|
});
|
|
1363
|
-
},
|
|
1364
|
-
function
|
|
1477
|
+
}, Bt = (e, n) => Un(e, n);
|
|
1478
|
+
function Lt(e) {
|
|
1365
1479
|
return {
|
|
1366
1480
|
...e,
|
|
1367
|
-
description: e.description ?
|
|
1481
|
+
description: e.description ? Bt(e.description) : e.description
|
|
1368
1482
|
};
|
|
1369
1483
|
}
|
|
1370
|
-
const
|
|
1484
|
+
const N = (e, n) => ({
|
|
1371
1485
|
...e,
|
|
1372
|
-
isVariantOf:
|
|
1373
|
-
}),
|
|
1486
|
+
isVariantOf: Lt(n)
|
|
1487
|
+
}), Mt = ({ flags: e }, n) => {
|
|
1374
1488
|
const t = async (r) => {
|
|
1375
|
-
const i = r.map((
|
|
1376
|
-
(
|
|
1489
|
+
const i = r.map((p) => p.split("-")[0]), a = r.some(
|
|
1490
|
+
(p) => p.split("-")[1] === "invisibleItems"
|
|
1377
1491
|
), s = (await n.search.productsByIdentifier({
|
|
1378
1492
|
field: "sku",
|
|
1379
1493
|
values: i,
|
|
@@ -1382,42 +1496,42 @@ const L = (e, n) => ({
|
|
|
1382
1496
|
hideUnavailableItems: !1
|
|
1383
1497
|
}
|
|
1384
1498
|
})).reduce(
|
|
1385
|
-
(
|
|
1386
|
-
for (const
|
|
1387
|
-
|
|
1388
|
-
return
|
|
1499
|
+
(p, u) => {
|
|
1500
|
+
for (const h of u.items)
|
|
1501
|
+
p[h.itemId] = N(h, u);
|
|
1502
|
+
return p;
|
|
1389
1503
|
},
|
|
1390
1504
|
{}
|
|
1391
|
-
),
|
|
1392
|
-
if (
|
|
1393
|
-
throw new
|
|
1394
|
-
`Search API did not found the following skus: ${
|
|
1505
|
+
), c = i.map((p) => s[p]), l = i.filter((p) => !s[p]);
|
|
1506
|
+
if (l.length > 0)
|
|
1507
|
+
throw new L(
|
|
1508
|
+
`Search API did not found the following skus: ${l.join(",")}`
|
|
1395
1509
|
);
|
|
1396
|
-
return
|
|
1510
|
+
return c;
|
|
1397
1511
|
};
|
|
1398
|
-
return new
|
|
1512
|
+
return new ie(t, {
|
|
1399
1513
|
maxBatchSize: 99
|
|
1400
1514
|
// Max allowed batch size of Search API
|
|
1401
1515
|
});
|
|
1402
|
-
},
|
|
1403
|
-
const t =
|
|
1516
|
+
}, $t = (e, { clients: n }) => {
|
|
1517
|
+
const t = Mt(e, n), r = Nt(e, n), i = Rt(e, n), a = kt(e, n);
|
|
1404
1518
|
return {
|
|
1405
1519
|
skuLoader: t,
|
|
1406
1520
|
simulationLoader: r,
|
|
1407
1521
|
collectionLoader: i,
|
|
1408
1522
|
salesChannelLoader: a
|
|
1409
1523
|
};
|
|
1410
|
-
}, M = (e) => e.AvailableQuantity > 0, V = (e) => e.spotPrice ?? 0,
|
|
1524
|
+
}, M = (e) => e.AvailableQuantity > 0, V = (e) => e.spotPrice ?? 0, zt = (e) => e.Price ?? 0, Ue = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", en = (e, n) => M(e) && !M(n) ? -1 : !M(e) && M(n) ? 1 : V(e) - V(n), xt = (e) => e === "available", $ = (e, n = 0, t = 1) => {
|
|
1411
1525
|
const r = n / t;
|
|
1412
1526
|
return Math.round((e + r) * 100) / 100;
|
|
1413
|
-
},
|
|
1527
|
+
}, Vt = (e, n = { includeTaxes: !1 }) => {
|
|
1414
1528
|
const t = e.filter(M), r = t[t.length - 1], i = r ? V(r) : 0;
|
|
1415
1529
|
return n.includeTaxes ? $(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1416
1530
|
}, Ee = (e, n = { includeTaxes: !1 }) => {
|
|
1417
1531
|
const [t] = e.filter(M), r = t ? V(t) : 0;
|
|
1418
1532
|
return n.includeTaxes ? $(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1419
|
-
},
|
|
1420
|
-
highPrice: (e) =>
|
|
1533
|
+
}, qt = {
|
|
1534
|
+
highPrice: (e) => Vt(e),
|
|
1421
1535
|
lowPrice: (e) => Ee(e),
|
|
1422
1536
|
lowPriceWithTaxes: (e) => Ee(e, { includeTaxes: !0 }),
|
|
1423
1537
|
offerCount: (e) => e.length,
|
|
@@ -1429,35 +1543,35 @@ const L = (e, n) => ({
|
|
|
1429
1543
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1430
1544
|
},
|
|
1431
1545
|
offers: (e) => e
|
|
1432
|
-
},
|
|
1546
|
+
}, jt = {
|
|
1433
1547
|
ratingValue: () => 5,
|
|
1434
1548
|
reviewCount: () => 0
|
|
1435
|
-
},
|
|
1549
|
+
}, _e = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", Wt = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", Gt = (e) => {
|
|
1436
1550
|
let n = e.slice(0);
|
|
1437
|
-
for (let t = 0; t <
|
|
1438
|
-
n = n.replace(new RegExp(
|
|
1551
|
+
for (let t = 0; t < _e.length; t++)
|
|
1552
|
+
n = n.replace(new RegExp(_e.charAt(t), "g"), Wt.charAt(t));
|
|
1439
1553
|
return n;
|
|
1440
|
-
},
|
|
1554
|
+
}, Ht = (e) => e.replace(/[·/_,:]/, "-");
|
|
1441
1555
|
function nn(e) {
|
|
1442
1556
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1443
|
-
return
|
|
1557
|
+
return Ht(Gt(t)).toLowerCase();
|
|
1444
1558
|
}
|
|
1445
|
-
const
|
|
1559
|
+
const ee = (e) => e.type === "brand" || x(e) && e.pageType.toLowerCase() === "brand", ge = (e) => x(e) && e.pageType.toLowerCase() === "collection", oe = (e) => ee(e) || ge(e) ? nn(e.name) : x(e) ? new URL(`https://${e.url}`).pathname.slice(1).toLowerCase() : new URL(e.url).pathname.slice(1).toLowerCase(), tn = {
|
|
1446
1560
|
id: ({ id: e }) => e.toString(),
|
|
1447
|
-
slug: (e) =>
|
|
1448
|
-
seo: (e) =>
|
|
1561
|
+
slug: (e) => oe(e),
|
|
1562
|
+
seo: (e) => ee(e) || x(e) ? {
|
|
1449
1563
|
title: e.title ?? e.name,
|
|
1450
1564
|
description: e.metaTagDescription
|
|
1451
1565
|
} : {
|
|
1452
1566
|
title: e.Title,
|
|
1453
1567
|
description: e.MetaTagDescription
|
|
1454
1568
|
},
|
|
1455
|
-
type: (e) =>
|
|
1569
|
+
type: (e) => ee(e) ? "Brand" : x(e) ? e.pageType : e.level === 0 ? "Department" : "Category",
|
|
1456
1570
|
meta: (e) => {
|
|
1457
|
-
const n =
|
|
1458
|
-
return
|
|
1571
|
+
const n = oe(e);
|
|
1572
|
+
return ee(e) ? {
|
|
1459
1573
|
selectedFacets: [{ key: "brand", value: n }]
|
|
1460
|
-
} :
|
|
1574
|
+
} : ge(e) ? {
|
|
1461
1575
|
selectedFacets: [{ key: "productclusterids", value: e.id }]
|
|
1462
1576
|
} : {
|
|
1463
1577
|
selectedFacets: n.split("/").map((t, r) => ({
|
|
@@ -1469,21 +1583,21 @@ const K = (e) => e.type === "brand" || z(e) && e.pageType.toLowerCase() === "bra
|
|
|
1469
1583
|
breadcrumbList: async (e, n, t) => {
|
|
1470
1584
|
const {
|
|
1471
1585
|
loaders: { collectionLoader: r }
|
|
1472
|
-
} = t, a =
|
|
1473
|
-
(
|
|
1586
|
+
} = t, a = oe(e).split("/").filter((c) => !!c), o = a.map(
|
|
1587
|
+
(c, l) => a.slice(0, l + 1).join("/")
|
|
1474
1588
|
), s = await Promise.all(
|
|
1475
|
-
o.map(async (
|
|
1476
|
-
const
|
|
1477
|
-
return { slug:
|
|
1589
|
+
o.map(async (c) => {
|
|
1590
|
+
const l = await r.load(c);
|
|
1591
|
+
return { slug: c, ...l };
|
|
1478
1592
|
})
|
|
1479
1593
|
);
|
|
1480
1594
|
return {
|
|
1481
|
-
itemListElement: s.map((
|
|
1482
|
-
item:
|
|
1483
|
-
`https://${
|
|
1595
|
+
itemListElement: s.map((c, l) => ({
|
|
1596
|
+
item: ge(c) ? `/${c.slug}` : new URL(
|
|
1597
|
+
`https://${c.url}`
|
|
1484
1598
|
).pathname.toLowerCase(),
|
|
1485
|
-
name:
|
|
1486
|
-
position:
|
|
1599
|
+
name: c.name,
|
|
1600
|
+
position: l + 1
|
|
1487
1601
|
})),
|
|
1488
1602
|
numberOfItems: s.length
|
|
1489
1603
|
};
|
|
@@ -1511,58 +1625,58 @@ const K = (e) => e.type === "brand" || z(e) && e.pageType.toLowerCase() === "bra
|
|
|
1511
1625
|
default:
|
|
1512
1626
|
return { key: e, value: n };
|
|
1513
1627
|
}
|
|
1514
|
-
},
|
|
1628
|
+
}, Re = (e) => {
|
|
1515
1629
|
const n = e.split(":").map(Number);
|
|
1516
1630
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1517
|
-
},
|
|
1631
|
+
}, Xt = (e) => typeof rn[e] == "string", Yt = (e) => {
|
|
1518
1632
|
const n = e?.filter(
|
|
1519
|
-
(t) =>
|
|
1633
|
+
(t) => Xt(t.key)
|
|
1520
1634
|
);
|
|
1521
1635
|
if (Array.isArray(n) && n.length > 1)
|
|
1522
|
-
throw new
|
|
1636
|
+
throw new T(
|
|
1523
1637
|
`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(",")}`
|
|
1524
1638
|
);
|
|
1525
1639
|
return n?.[0] ?? null;
|
|
1526
|
-
},
|
|
1640
|
+
}, Jt = (e) => e?.find((n) => n.key === "slug")?.value ?? null, Qt = (e) => e?.find((n) => n.key === "id")?.value ?? null, ke = (e) => e?.find((n) => n.key === "locale")?.value ?? null, Fe = (e) => e?.find((n) => n.key === "channel")?.value ?? null, me = (e, n) => {
|
|
1527
1641
|
let t = 0;
|
|
1528
1642
|
for (let r = 1; r < e.length; r++)
|
|
1529
1643
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1530
1644
|
return e[t];
|
|
1531
|
-
},
|
|
1645
|
+
}, Kt = {
|
|
1532
1646
|
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1533
|
-
},
|
|
1647
|
+
}, Zt = {
|
|
1534
1648
|
key: ({ key: e }) => e,
|
|
1535
1649
|
label: ({ name: e }) => e,
|
|
1536
1650
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1537
|
-
},
|
|
1651
|
+
}, er = {
|
|
1538
1652
|
key: ({ key: e }) => e,
|
|
1539
1653
|
label: ({ name: e }) => e,
|
|
1540
1654
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1541
|
-
const i =
|
|
1655
|
+
const i = Re(
|
|
1542
1656
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1543
|
-
), o =
|
|
1657
|
+
), o = me(e, (s, c) => s.range.from - c.range.from)?.range?.from ?? 0;
|
|
1544
1658
|
return {
|
|
1545
1659
|
selected: i?.[0] ?? o,
|
|
1546
1660
|
absolute: o
|
|
1547
1661
|
};
|
|
1548
1662
|
},
|
|
1549
1663
|
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1550
|
-
const i =
|
|
1664
|
+
const i = Re(
|
|
1551
1665
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1552
|
-
), o =
|
|
1666
|
+
), o = me(e, (s, c) => c.range.to - s.range.to)?.range?.to ?? 0;
|
|
1553
1667
|
return {
|
|
1554
1668
|
selected: i?.[1] ?? o,
|
|
1555
1669
|
absolute: o
|
|
1556
1670
|
};
|
|
1557
1671
|
}
|
|
1558
|
-
},
|
|
1672
|
+
}, nr = {
|
|
1559
1673
|
value: ({ value: e }) => e,
|
|
1560
1674
|
label: ({ name: e }) => e || "unknown",
|
|
1561
1675
|
selected: ({ selected: e }) => e,
|
|
1562
1676
|
quantity: ({ quantity: e }) => e
|
|
1563
|
-
},
|
|
1677
|
+
}, tr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1564
1678
|
if (!n?.orderId)
|
|
1565
|
-
throw new
|
|
1679
|
+
throw new T("Missing orderId");
|
|
1566
1680
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1567
1681
|
};
|
|
1568
1682
|
function an(e) {
|
|
@@ -1583,47 +1697,53 @@ function an(e) {
|
|
|
1583
1697
|
}
|
|
1584
1698
|
return null;
|
|
1585
1699
|
}
|
|
1586
|
-
function
|
|
1700
|
+
function rr(e) {
|
|
1587
1701
|
if (!e || e.status !== "pending") return !1;
|
|
1588
1702
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1589
1703
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1590
1704
|
}
|
|
1591
|
-
const
|
|
1705
|
+
const ir = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1592
1706
|
const r = await t.oms.processOrderAuthorization(n), i = an(r);
|
|
1593
1707
|
return {
|
|
1594
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1708
|
+
isPendingForOtherAuthorizer: !i && rr(r),
|
|
1595
1709
|
ruleForAuthorization: i
|
|
1596
1710
|
};
|
|
1597
|
-
},
|
|
1711
|
+
}, ar = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1598
1712
|
if (!n?.objectKey)
|
|
1599
|
-
throw new
|
|
1713
|
+
throw new T("Missing objectKey");
|
|
1600
1714
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
1601
1715
|
return t.orderEntry.startOperation({
|
|
1602
1716
|
objectKey: n.objectKey,
|
|
1603
1717
|
orderFormId: r,
|
|
1604
1718
|
sessionToken: n.sessionToken ?? void 0
|
|
1605
1719
|
});
|
|
1606
|
-
},
|
|
1720
|
+
}, or = async (e, n, t) => {
|
|
1721
|
+
if (!(await t.clients.commerce.recommendation.startRecommendationSession())?.recommendationsUserId)
|
|
1722
|
+
throw new Error(
|
|
1723
|
+
"Failed to start recommendation session: no session data returned"
|
|
1724
|
+
);
|
|
1725
|
+
return !0;
|
|
1726
|
+
}, sr = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), cr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1607
1727
|
const { fileContent: r, fileName: i, mimeType: a } = n;
|
|
1608
1728
|
if (!r || !i || !a)
|
|
1609
|
-
throw new
|
|
1729
|
+
throw new T(
|
|
1610
1730
|
"Missing required fields: fileContent, fileName, mimeType"
|
|
1611
1731
|
);
|
|
1612
1732
|
const o = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
|
|
1613
1733
|
if (Math.floor(o.length * 3 / 4) > s)
|
|
1614
|
-
throw new
|
|
1734
|
+
throw new T("File exceeds maximum allowed size of 5MB");
|
|
1615
1735
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
|
|
1616
1736
|
o
|
|
1617
1737
|
))
|
|
1618
|
-
throw new
|
|
1619
|
-
const
|
|
1738
|
+
throw new T("Invalid Base64 fileContent");
|
|
1739
|
+
const p = Buffer.from(o, "base64");
|
|
1620
1740
|
return await t.orderEntry.uploadFile({
|
|
1621
|
-
fileBuffer:
|
|
1741
|
+
fileBuffer: p,
|
|
1622
1742
|
fileName: i,
|
|
1623
1743
|
mimeType: a
|
|
1624
1744
|
});
|
|
1625
1745
|
};
|
|
1626
|
-
class
|
|
1746
|
+
class ne {
|
|
1627
1747
|
static parse(n) {
|
|
1628
1748
|
try {
|
|
1629
1749
|
const t = JSON.parse(n);
|
|
@@ -1641,11 +1761,11 @@ class ee {
|
|
|
1641
1761
|
return JSON.stringify(n);
|
|
1642
1762
|
}
|
|
1643
1763
|
}
|
|
1644
|
-
const
|
|
1645
|
-
e.storage.channel =
|
|
1646
|
-
},
|
|
1764
|
+
const he = (e, n) => {
|
|
1765
|
+
e.storage.channel = ne.parse(n);
|
|
1766
|
+
}, fe = (e, n) => {
|
|
1647
1767
|
e.storage.locale = n;
|
|
1648
|
-
}, on = (e) => En.createHash("md5").update(e).digest("hex"),
|
|
1768
|
+
}, on = (e) => En.createHash("md5").update(e).digest("hex"), K = {
|
|
1649
1769
|
attachment: "ATTACHMENT",
|
|
1650
1770
|
specification: "SPECIFICATION",
|
|
1651
1771
|
attribute: "ATTRIBUTE"
|
|
@@ -1654,16 +1774,16 @@ function sn(e) {
|
|
|
1654
1774
|
return {
|
|
1655
1775
|
name: e.name,
|
|
1656
1776
|
value: e.content,
|
|
1657
|
-
valueReference:
|
|
1777
|
+
valueReference: K.attachment
|
|
1658
1778
|
};
|
|
1659
1779
|
}
|
|
1660
|
-
function
|
|
1780
|
+
function lr(e) {
|
|
1661
1781
|
return {
|
|
1662
1782
|
propertyID: e.id,
|
|
1663
1783
|
name: e.name,
|
|
1664
1784
|
value: e.value,
|
|
1665
1785
|
valueReference: {
|
|
1666
|
-
valueReference:
|
|
1786
|
+
valueReference: K.attribute,
|
|
1667
1787
|
visible: e.visible
|
|
1668
1788
|
}
|
|
1669
1789
|
};
|
|
@@ -1673,7 +1793,7 @@ function cn(e) {
|
|
|
1673
1793
|
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
1674
1794
|
);
|
|
1675
1795
|
}
|
|
1676
|
-
const
|
|
1796
|
+
const dr = (e) => {
|
|
1677
1797
|
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
1678
1798
|
addressType: e.addressType || null,
|
|
1679
1799
|
postalCode: n || null,
|
|
@@ -1692,7 +1812,7 @@ const rr = (e) => {
|
|
|
1692
1812
|
r.geoCoordinates = i !== null && a !== null ? [a, i] : [];
|
|
1693
1813
|
}
|
|
1694
1814
|
return [r];
|
|
1695
|
-
},
|
|
1815
|
+
}, ur = (e, n, t) => {
|
|
1696
1816
|
const r = n.postalCode, i = n.geoCoordinates, a = e?.shippingData?.availableAddresses ?? [], o = e?.shippingData?.selectedAddresses ?? [];
|
|
1697
1817
|
if (!t && o.length > 0)
|
|
1698
1818
|
return [o[0]];
|
|
@@ -1707,31 +1827,31 @@ const rr = (e) => {
|
|
|
1707
1827
|
}
|
|
1708
1828
|
return null;
|
|
1709
1829
|
}, ln = (e, n) => {
|
|
1710
|
-
if (!
|
|
1830
|
+
if (!pr(n))
|
|
1711
1831
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1712
|
-
if (!
|
|
1832
|
+
if (!fr(e))
|
|
1713
1833
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1714
1834
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
1715
|
-
if (
|
|
1835
|
+
if (gr(t, n.postalCode) || mr(t, n.geoCoordinates) || hr(t, n.addressType))
|
|
1716
1836
|
return { updateShipping: !0, addressChanged: !0 };
|
|
1717
1837
|
const { logisticsInfo: r } = e.shippingData;
|
|
1718
|
-
return
|
|
1719
|
-
},
|
|
1838
|
+
return Sr(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
1839
|
+
}, pr = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, gr = (e, n) => typeof n == "string" && e?.postalCode !== n, mr = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), hr = (e, n) => typeof n == "string" && e?.addressType !== n, fr = (e) => e.items.length !== 0, Sr = (e, n) => {
|
|
1720
1840
|
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
|
|
1721
1841
|
return e.some(
|
|
1722
|
-
({ selectedDeliveryChannel: o, selectedSla: s, slas:
|
|
1723
|
-
const
|
|
1724
|
-
return
|
|
1725
|
-
(
|
|
1842
|
+
({ selectedDeliveryChannel: o, selectedSla: s, slas: c }) => {
|
|
1843
|
+
const l = t && o !== t, p = r && s !== r;
|
|
1844
|
+
return c?.some((u) => l && u.deliveryChannel === t || p && u.id === r ? !0 : i && a && u.deliveryChannel === t && u.id === r && (!u?.deliveryWindow || u?.deliveryWindow?.startDateUtc !== i || u?.deliveryWindow?.endDateUtc !== a) && u.availableDeliveryWindows?.some(
|
|
1845
|
+
(h) => h?.startDateUtc === i && h?.endDateUtc === a
|
|
1726
1846
|
));
|
|
1727
1847
|
}
|
|
1728
1848
|
);
|
|
1729
|
-
}, dn = (e) => e.valueReference ===
|
|
1849
|
+
}, dn = (e) => e.valueReference === K.attachment, Se = (e) => [
|
|
1730
1850
|
e.itemOffered.sku,
|
|
1731
1851
|
e.seller.identifier,
|
|
1732
1852
|
e.price < 0.01 ? "Gift" : void 0,
|
|
1733
1853
|
e.itemOffered.additionalProperty?.filter(dn).map(cn).join("-")
|
|
1734
|
-
].filter(Boolean).join("::"),
|
|
1854
|
+
].filter(Boolean).join("::"), te = (e, n) => ({
|
|
1735
1855
|
listPrice: e.listPrice / 100,
|
|
1736
1856
|
price: e.sellingPrice / 100,
|
|
1737
1857
|
quantity: e.quantity,
|
|
@@ -1743,7 +1863,7 @@ const rr = (e) => {
|
|
|
1743
1863
|
additionalProperty: e.attachments.map(sn)
|
|
1744
1864
|
},
|
|
1745
1865
|
index: n
|
|
1746
|
-
}),
|
|
1866
|
+
}), yr = (e) => ({
|
|
1747
1867
|
quantity: e.quantity,
|
|
1748
1868
|
seller: e.seller.identifier,
|
|
1749
1869
|
id: e.itemOffered.sku,
|
|
@@ -1752,17 +1872,17 @@ const rr = (e) => {
|
|
|
1752
1872
|
name: n.name,
|
|
1753
1873
|
content: n.value
|
|
1754
1874
|
}))
|
|
1755
|
-
}),
|
|
1756
|
-
const r =
|
|
1875
|
+
}), Ne = (e) => e.reduce((n, t) => {
|
|
1876
|
+
const r = Se(t);
|
|
1757
1877
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
1758
|
-
}, /* @__PURE__ */ new Map()),
|
|
1759
|
-
const t = (s,
|
|
1878
|
+
}, /* @__PURE__ */ new Map()), Ir = (e, n) => {
|
|
1879
|
+
const t = (s, c) => ({
|
|
1760
1880
|
...s,
|
|
1761
1881
|
itemOffered: {
|
|
1762
1882
|
sku: s.itemOffered.sku
|
|
1763
1883
|
},
|
|
1764
|
-
index:
|
|
1765
|
-
}), r = n.items.map(
|
|
1884
|
+
index: c
|
|
1885
|
+
}), r = n.items.map(te).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = ve(r, i);
|
|
1766
1886
|
return a && o;
|
|
1767
1887
|
};
|
|
1768
1888
|
function un(e, n) {
|
|
@@ -1775,10 +1895,10 @@ function pn(e, n) {
|
|
|
1775
1895
|
(t) => t.id === n && t.parentItemIndex !== null
|
|
1776
1896
|
);
|
|
1777
1897
|
}
|
|
1778
|
-
const
|
|
1898
|
+
const Be = (e) => {
|
|
1779
1899
|
const n = e.items.reduce(
|
|
1780
1900
|
(t, r, i) => {
|
|
1781
|
-
const a = pn(e.items, r.id) || un(e.items, r.id) ? `${
|
|
1901
|
+
const a = pn(e.items, r.id) || un(e.items, r.id) ? `${Se(te(r))}::${i}` : Se(te(r));
|
|
1782
1902
|
return t[a] || (t[a] = []), t[a].push(r), t;
|
|
1783
1903
|
},
|
|
1784
1904
|
{}
|
|
@@ -1821,7 +1941,7 @@ const Ne = (e) => {
|
|
|
1821
1941
|
return on(
|
|
1822
1942
|
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
1823
1943
|
);
|
|
1824
|
-
},
|
|
1944
|
+
}, Me = async (e, n, t) => {
|
|
1825
1945
|
try {
|
|
1826
1946
|
return await n.checkout.setCustomData({
|
|
1827
1947
|
id: e.orderFormId,
|
|
@@ -1837,14 +1957,14 @@ const Ne = (e) => {
|
|
|
1837
1957
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
1838
1958
|
), r;
|
|
1839
1959
|
}
|
|
1840
|
-
},
|
|
1960
|
+
}, vr = (e, n) => {
|
|
1841
1961
|
const r = e.customData?.customApps.find(
|
|
1842
1962
|
(a) => a.id === "faststore"
|
|
1843
1963
|
)?.fields?.cartEtag;
|
|
1844
1964
|
return r == null ? !0 : gn(e, n) !== r;
|
|
1845
|
-
},
|
|
1965
|
+
}, Or = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
1846
1966
|
id: e
|
|
1847
|
-
}),
|
|
1967
|
+
}), $e = async (e, n, { clients: { commerce: t } }) => {
|
|
1848
1968
|
if (!n)
|
|
1849
1969
|
return e;
|
|
1850
1970
|
const { updateShipping: r, addressChanged: i } = ln(
|
|
@@ -1852,7 +1972,7 @@ const Ne = (e) => {
|
|
|
1852
1972
|
n
|
|
1853
1973
|
);
|
|
1854
1974
|
if (r) {
|
|
1855
|
-
const a =
|
|
1975
|
+
const a = ur(e, n, i), s = a || dr(n);
|
|
1856
1976
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
1857
1977
|
{
|
|
1858
1978
|
id: e.orderFormId,
|
|
@@ -1872,95 +1992,116 @@ const Ne = (e) => {
|
|
|
1872
1992
|
);
|
|
1873
1993
|
}
|
|
1874
1994
|
return e;
|
|
1875
|
-
},
|
|
1995
|
+
}, Cr = (e, n) => {
|
|
1876
1996
|
if (!e)
|
|
1877
1997
|
return "";
|
|
1878
|
-
const r =
|
|
1998
|
+
const r = J(e)[n];
|
|
1879
1999
|
return r ? r.split("=")[1] : "";
|
|
1880
|
-
},
|
|
1881
|
-
const i =
|
|
2000
|
+
}, br = async (e, { cart: { order: n }, session: t }, r) => {
|
|
2001
|
+
const i = Cr(
|
|
1882
2002
|
r.headers.cookie,
|
|
1883
2003
|
"checkout.vtex.com"
|
|
1884
2004
|
), {
|
|
1885
2005
|
clients: { commerce: a },
|
|
1886
2006
|
loaders: { skuLoader: o }
|
|
1887
|
-
} = r, s = t?.channel,
|
|
1888
|
-
s &&
|
|
1889
|
-
const
|
|
2007
|
+
} = r, s = t?.channel, c = t?.locale;
|
|
2008
|
+
s && he(r, s), c && fe(r, c);
|
|
2009
|
+
const l = await a.checkout.orderForm({
|
|
1890
2010
|
id: i || void 0,
|
|
1891
2011
|
channel: r.storage.channel
|
|
1892
|
-
}),
|
|
1893
|
-
|
|
1894
|
-
const
|
|
1895
|
-
if (
|
|
1896
|
-
const
|
|
1897
|
-
|
|
2012
|
+
}), p = l.orderFormId;
|
|
2013
|
+
l.messages.length !== 0 && await Or(p, r);
|
|
2014
|
+
const u = J(r?.headers?.cookie ?? "")?.vtex_session, h = X(u), { acceptedOffer: S, shouldSplitItem: b } = n;
|
|
2015
|
+
if (vr(l, h)) {
|
|
2016
|
+
const O = await Me(
|
|
2017
|
+
l,
|
|
1898
2018
|
a,
|
|
1899
|
-
|
|
1900
|
-
).then(
|
|
1901
|
-
if (
|
|
1902
|
-
return Le(
|
|
2019
|
+
h
|
|
2020
|
+
).then(Be);
|
|
2021
|
+
if (p)
|
|
2022
|
+
return Le(O, o, b);
|
|
1903
2023
|
}
|
|
1904
|
-
const
|
|
1905
|
-
(
|
|
1906
|
-
const
|
|
1907
|
-
if (!
|
|
1908
|
-
return _.forEach((
|
|
1909
|
-
const [
|
|
1910
|
-
if (pn(
|
|
1911
|
-
return
|
|
1912
|
-
const
|
|
1913
|
-
return
|
|
1914
|
-
...
|
|
1915
|
-
quantity:
|
|
1916
|
-
}),
|
|
2024
|
+
const g = Ne(S), m = Ne(l.items.map(te)), y = Array.from(m.entries()), C = Array.from(g.entries()), { itemsToAdd: w, itemsToUpdate: v } = C.reduce(
|
|
2025
|
+
(O, [E, _]) => {
|
|
2026
|
+
const q = m.get(E);
|
|
2027
|
+
if (!q)
|
|
2028
|
+
return _.forEach((j) => O.itemsToAdd.push(j)), O;
|
|
2029
|
+
const [R, ...Oe] = q;
|
|
2030
|
+
if (pn(l.items, R.itemOffered.sku) || un(l.items, R.itemOffered.sku))
|
|
2031
|
+
return O.itemsToUpdate.push(R), O;
|
|
2032
|
+
const ae = _.reduce((j, vn) => j + vn.quantity, 0);
|
|
2033
|
+
return O.itemsToUpdate.push({
|
|
2034
|
+
...R,
|
|
2035
|
+
quantity: ae
|
|
2036
|
+
}), Oe.forEach((j) => O.itemsToUpdate.push({ ...j, quantity: 0 })), O;
|
|
1917
2037
|
},
|
|
1918
2038
|
{
|
|
1919
2039
|
itemsToAdd: [],
|
|
1920
2040
|
itemsToUpdate: []
|
|
1921
2041
|
}
|
|
1922
|
-
), P =
|
|
1923
|
-
|
|
1924
|
-
), { updateShipping:
|
|
1925
|
-
if (
|
|
2042
|
+
), P = y.filter(([O]) => !g.has(O)).flatMap(([, O]) => O.map((E) => ({ ...E, quantity: 0 }))), f = [...w, ...v, ...P].map(
|
|
2043
|
+
yr
|
|
2044
|
+
), { updateShipping: D } = t ? ln(l, t) : { updateShipping: !1 };
|
|
2045
|
+
if (f.length === 0 && !D)
|
|
1926
2046
|
return null;
|
|
1927
|
-
let
|
|
1928
|
-
|
|
1929
|
-
id:
|
|
1930
|
-
orderItems:
|
|
1931
|
-
shouldSplitItem:
|
|
2047
|
+
let A;
|
|
2048
|
+
f.length > 0 ? A = await a.checkout.updateOrderFormItems({
|
|
2049
|
+
id: l.orderFormId,
|
|
2050
|
+
orderItems: f,
|
|
2051
|
+
shouldSplitItem: b
|
|
1932
2052
|
}).then(
|
|
1933
|
-
(
|
|
1934
|
-
) :
|
|
1935
|
-
|
|
2053
|
+
(O) => $e(O, t, r)
|
|
2054
|
+
) : A = await $e(
|
|
2055
|
+
l,
|
|
1936
2056
|
t,
|
|
1937
2057
|
r
|
|
1938
|
-
),
|
|
2058
|
+
), A = await Promise.resolve(A).then((O) => {
|
|
1939
2059
|
if (t?.marketingData) {
|
|
1940
|
-
const
|
|
1941
|
-
...
|
|
2060
|
+
const E = {
|
|
2061
|
+
...O.marketingData,
|
|
1942
2062
|
...t.marketingData
|
|
1943
2063
|
};
|
|
1944
2064
|
return a.checkout.marketingData({
|
|
1945
|
-
id:
|
|
1946
|
-
marketingData:
|
|
2065
|
+
id: l.orderFormId,
|
|
2066
|
+
marketingData: E
|
|
1947
2067
|
});
|
|
1948
2068
|
}
|
|
1949
|
-
return
|
|
1950
|
-
}).then((
|
|
1951
|
-
id:
|
|
2069
|
+
return O;
|
|
2070
|
+
}).then((O) => c && O.clientPreferencesData?.locale !== c ? a.checkout.clientPreferencesData({
|
|
2071
|
+
id: O.orderFormId,
|
|
1952
2072
|
clientPreferencesData: {
|
|
1953
|
-
...
|
|
1954
|
-
locale:
|
|
2073
|
+
...O.clientPreferencesData,
|
|
2074
|
+
locale: c
|
|
1955
2075
|
}
|
|
1956
|
-
}) :
|
|
1957
|
-
const
|
|
1958
|
-
|
|
1959
|
-
|
|
2076
|
+
}) : O).then((O) => Me(O, a, h)).then(Be);
|
|
2077
|
+
const U = ve(
|
|
2078
|
+
l.messages,
|
|
2079
|
+
A.messages
|
|
1960
2080
|
);
|
|
1961
|
-
return
|
|
2081
|
+
return Ir(n, A) && U ? null : Le(A, o, b);
|
|
2082
|
+
}, wr = (e) => {
|
|
2083
|
+
const n = (e?.corporateName ?? "").trim();
|
|
2084
|
+
return n || (e?.firstName ?? "").trim();
|
|
2085
|
+
}, Dr = (e) => {
|
|
2086
|
+
if (!e || typeof e != "object")
|
|
2087
|
+
return !1;
|
|
2088
|
+
const n = e;
|
|
2089
|
+
return typeof n.customerId == "string" && n.customerId.trim() !== "" && typeof n.contractName == "string" && typeof n.isActive == "boolean" && typeof n.isCurrent == "boolean";
|
|
2090
|
+
}, Ar = (e) => {
|
|
2091
|
+
const n = e?.availableContracts?.value;
|
|
2092
|
+
return Array.isArray(n) ? n.filter(Dr) : [];
|
|
2093
|
+
}, Pr = (e) => e?.customerId ? !!((e.contractName ?? "").trim() && e.isActive) : !1, Ur = (e) => e?.namespaces?.shopper?.activeContractId?.value?.trim() ?? e?.namespaces?.authentication?.customerId?.value?.trim() ?? e?.namespaces?.profile?.id?.value?.trim() ?? "", Er = (e, n = "") => {
|
|
2094
|
+
const t = n.trim();
|
|
2095
|
+
return e.filter(Pr).map((r) => ({
|
|
2096
|
+
id: r.customerId,
|
|
2097
|
+
corporateName: r.contractName.trim(),
|
|
2098
|
+
isActive: t ? r.customerId === t : r.isCurrent
|
|
2099
|
+
}));
|
|
2100
|
+
}, mn = (e, n) => {
|
|
2101
|
+
const t = wr(e);
|
|
2102
|
+
return t || (n?.firstName?.value ?? "").trim();
|
|
1962
2103
|
};
|
|
1963
|
-
async function
|
|
2104
|
+
async function _r(e, n, t) {
|
|
1964
2105
|
try {
|
|
1965
2106
|
const r = await e.commerce.checkout.address({
|
|
1966
2107
|
postalCode: t,
|
|
@@ -1977,45 +2118,45 @@ async function Sr(e, n, t) {
|
|
|
1977
2118
|
), r;
|
|
1978
2119
|
}
|
|
1979
2120
|
}
|
|
1980
|
-
const
|
|
1981
|
-
const o =
|
|
1982
|
-
let
|
|
1983
|
-
if ((!
|
|
1984
|
-
const
|
|
2121
|
+
const Tr = async (e, { session: n, search: t }, { clients: r, headers: i, account: a }) => {
|
|
2122
|
+
const o = ne.parse(n.channel ?? ""), s = String(n.postalCode ?? ""), c = n.country ?? "";
|
|
2123
|
+
let l = n.city ?? null, p = n.geoCoordinates ?? null;
|
|
2124
|
+
if ((!l || !p) && s !== "" && c !== "") {
|
|
2125
|
+
const R = await _r(
|
|
1985
2126
|
r,
|
|
1986
|
-
|
|
2127
|
+
c,
|
|
1987
2128
|
s
|
|
1988
2129
|
);
|
|
1989
|
-
|
|
2130
|
+
l = R.city, p = R.geoCoordinates;
|
|
1990
2131
|
}
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1993
|
-
const
|
|
1994
|
-
|
|
2132
|
+
const h = new URLSearchParams(t);
|
|
2133
|
+
h.has("facets") && h.delete("facets");
|
|
2134
|
+
const S = h.get("sc") ?? o.salesChannel;
|
|
2135
|
+
h.set("sc", S), s && h.set("postalCode", s), c && h.set("country", c), p && h.set(
|
|
1995
2136
|
"geoCoordinates",
|
|
1996
|
-
`${
|
|
2137
|
+
`${p.longitude},${p.latitude}`
|
|
1997
2138
|
// long,lat is the format expected
|
|
1998
|
-
),
|
|
1999
|
-
const { marketingData:
|
|
2000
|
-
utmCampaign:
|
|
2001
|
-
utmMedium:
|
|
2002
|
-
utmSource:
|
|
2003
|
-
utmiCampaign:
|
|
2004
|
-
utmiPage:
|
|
2005
|
-
utmiPart:
|
|
2006
|
-
},
|
|
2007
|
-
let
|
|
2008
|
-
if (
|
|
2139
|
+
), h.set("locale", n.locale);
|
|
2140
|
+
const { marketingData: b } = n, d = {
|
|
2141
|
+
utmCampaign: h.get("utm_campaign") ?? b?.utmCampaign ?? "",
|
|
2142
|
+
utmMedium: h.get("utm_medium") ?? b?.utmMedium ?? "",
|
|
2143
|
+
utmSource: h.get("utm_source") ?? b?.utmSource ?? "",
|
|
2144
|
+
utmiCampaign: h.get("utmi_cp") ?? b?.utmiCampaign ?? "",
|
|
2145
|
+
utmiPage: h.get("utmi_p") ?? b?.utmiPage ?? "",
|
|
2146
|
+
utmiPart: h.get("utmi_pc") ?? b?.utmiPart ?? ""
|
|
2147
|
+
}, g = X(z(i?.cookie ?? "", a));
|
|
2148
|
+
let m = !1;
|
|
2149
|
+
if (g)
|
|
2009
2150
|
try {
|
|
2010
|
-
|
|
2011
|
-
} catch (
|
|
2012
|
-
console.warn("JWT validation failed:",
|
|
2151
|
+
m = (await r.commerce.vtexid.validate())?.authStatus?.toLowerCase() === "success";
|
|
2152
|
+
} catch (R) {
|
|
2153
|
+
console.warn("JWT validation failed:", R), m = !1;
|
|
2013
2154
|
}
|
|
2014
|
-
const
|
|
2015
|
-
let
|
|
2016
|
-
if (
|
|
2155
|
+
const y = m ? g?.isRepresentative : !1, C = m ? g?.customerId : void 0, w = m ? g?.unitId : void 0, v = await r.commerce.session(h.toString()).catch(() => null), P = v?.namespaces.profile ?? null, f = v?.namespaces.shopper ?? null, D = v?.namespaces.store ?? null, A = v?.namespaces.authentication ?? null, U = v?.namespaces.checkout ?? null, O = v?.namespaces.public ?? null;
|
|
2156
|
+
let E = null;
|
|
2157
|
+
if (y && P?.id?.value)
|
|
2017
2158
|
try {
|
|
2018
|
-
|
|
2159
|
+
E = await r.commerce.masterData.getContractById({
|
|
2019
2160
|
contractId: P.id.value
|
|
2020
2161
|
});
|
|
2021
2162
|
} catch {
|
|
@@ -2025,24 +2166,24 @@ const yr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2025
2166
|
);
|
|
2026
2167
|
}
|
|
2027
2168
|
let _;
|
|
2028
|
-
o.seller && (s ||
|
|
2169
|
+
o.seller && (s || p) && (_ = (await r.commerce.checkout.region({
|
|
2029
2170
|
postalCode: s,
|
|
2030
|
-
geoCoordinates:
|
|
2031
|
-
country:
|
|
2032
|
-
salesChannel:
|
|
2033
|
-
}))?.[0]?.sellers.find((
|
|
2034
|
-
const
|
|
2171
|
+
geoCoordinates: p,
|
|
2172
|
+
country: c,
|
|
2173
|
+
salesChannel: S
|
|
2174
|
+
}))?.[0]?.sellers.find((ae) => o.seller === ae.id));
|
|
2175
|
+
const q = {
|
|
2035
2176
|
...n,
|
|
2036
2177
|
currency: {
|
|
2037
|
-
code:
|
|
2038
|
-
symbol:
|
|
2178
|
+
code: D?.currencyCode?.value ?? n.currency.code,
|
|
2179
|
+
symbol: D?.currencySymbol?.value ?? n.currency.symbol
|
|
2039
2180
|
},
|
|
2040
|
-
country:
|
|
2041
|
-
channel:
|
|
2042
|
-
salesChannel:
|
|
2043
|
-
regionId:
|
|
2181
|
+
country: D?.countryCode?.value ?? c,
|
|
2182
|
+
channel: ne.stringify({
|
|
2183
|
+
salesChannel: D?.channel?.value ?? o.salesChannel,
|
|
2184
|
+
regionId: U?.regionId?.value ?? o.regionId,
|
|
2044
2185
|
seller: _?.id,
|
|
2045
|
-
hasOnlyDefaultSalesChannel: !
|
|
2186
|
+
hasOnlyDefaultSalesChannel: !D?.channel?.value
|
|
2046
2187
|
}),
|
|
2047
2188
|
/**
|
|
2048
2189
|
* B2B data structure in Session:
|
|
@@ -2050,60 +2191,61 @@ const yr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2050
2191
|
* - Unit data: `authentication` namespace
|
|
2051
2192
|
* - Contract data: `profile` namespace (those info will be available inside Faststore's Session `person` object)
|
|
2052
2193
|
*/
|
|
2053
|
-
b2b:
|
|
2054
|
-
isRepresentative:
|
|
2055
|
-
customerId:
|
|
2056
|
-
unitName:
|
|
2057
|
-
unitId:
|
|
2058
|
-
firstName: typeof
|
|
2059
|
-
lastName: typeof
|
|
2060
|
-
userName: `${typeof
|
|
2061
|
-
userEmail:
|
|
2062
|
-
savedPostalCode:
|
|
2063
|
-
contractName:
|
|
2064
|
-
organizationManager:
|
|
2194
|
+
b2b: y ? {
|
|
2195
|
+
isRepresentative: y ?? !1,
|
|
2196
|
+
customerId: A?.customerId?.value ?? C ?? "",
|
|
2197
|
+
unitName: A?.unitName?.value ?? "",
|
|
2198
|
+
unitId: A?.unitId?.value ?? w ?? "",
|
|
2199
|
+
firstName: typeof f?.firstName?.value == "string" ? f.firstName.value : "",
|
|
2200
|
+
lastName: typeof f?.lastName?.value == "string" ? f.lastName.value : "",
|
|
2201
|
+
userName: `${typeof f?.firstName?.value == "string" ? f.firstName.value : ""} ${typeof f?.lastName?.value == "string" ? f.lastName.value : ""}`.trim(),
|
|
2202
|
+
userEmail: A?.storeUserEmail.value ?? "",
|
|
2203
|
+
savedPostalCode: O?.postalCode?.value ?? "",
|
|
2204
|
+
contractName: mn(E, P),
|
|
2205
|
+
organizationManager: f?.organizationManager?.value ?? !1
|
|
2065
2206
|
} : null,
|
|
2066
|
-
marketingData:
|
|
2207
|
+
marketingData: d,
|
|
2067
2208
|
person: P?.id ? {
|
|
2068
2209
|
id: P.id?.value ?? "",
|
|
2069
2210
|
email: P.email?.value ?? "",
|
|
2070
2211
|
givenName: P.firstName?.value ?? "",
|
|
2071
2212
|
familyName: P.lastName?.value ?? ""
|
|
2072
2213
|
} : null,
|
|
2073
|
-
geoCoordinates:
|
|
2074
|
-
city:
|
|
2214
|
+
geoCoordinates: p?.latitude && p?.longitude && p || null,
|
|
2215
|
+
city: l
|
|
2075
2216
|
};
|
|
2076
|
-
return
|
|
2077
|
-
},
|
|
2078
|
-
validateCart:
|
|
2079
|
-
validateSession:
|
|
2080
|
-
subscribeToNewsletter:
|
|
2081
|
-
cancelOrder:
|
|
2082
|
-
processOrderAuthorization:
|
|
2083
|
-
uploadFileToOrderEntry:
|
|
2084
|
-
startOrderEntryOperation:
|
|
2217
|
+
return ve(n, q) ? null : q;
|
|
2218
|
+
}, Rr = {
|
|
2219
|
+
validateCart: br,
|
|
2220
|
+
validateSession: Tr,
|
|
2221
|
+
subscribeToNewsletter: sr,
|
|
2222
|
+
cancelOrder: tr,
|
|
2223
|
+
processOrderAuthorization: ir,
|
|
2224
|
+
uploadFileToOrderEntry: cr,
|
|
2225
|
+
startOrderEntryOperation: ar,
|
|
2226
|
+
startRecommendationSession: or
|
|
2085
2227
|
};
|
|
2086
|
-
var
|
|
2228
|
+
var ye;
|
|
2087
2229
|
(function(e) {
|
|
2088
2230
|
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";
|
|
2089
|
-
})(
|
|
2090
|
-
const
|
|
2091
|
-
function
|
|
2231
|
+
})(ye || (ye = {}));
|
|
2232
|
+
const kr = (e) => typeof e == "string" ? hn(e) : null;
|
|
2233
|
+
function hn(e) {
|
|
2092
2234
|
try {
|
|
2093
2235
|
return JSON.parse(e);
|
|
2094
2236
|
} catch {
|
|
2095
2237
|
return e;
|
|
2096
2238
|
}
|
|
2097
2239
|
}
|
|
2098
|
-
const
|
|
2240
|
+
const Fr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Nr = new bn({
|
|
2099
2241
|
name: "ObjectOrString",
|
|
2100
2242
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2101
|
-
parseValue:
|
|
2102
|
-
serialize:
|
|
2243
|
+
parseValue: kr,
|
|
2244
|
+
serialize: Fr,
|
|
2103
2245
|
parseLiteral(e) {
|
|
2104
|
-
return e.kind ===
|
|
2246
|
+
return e.kind === ye.STRING ? hn(e.value) : null;
|
|
2105
2247
|
}
|
|
2106
|
-
}),
|
|
2248
|
+
}), F = (e) => "Price" in e && "seller" in e && "product" in e, k = (e) => "skuName" in e, Br = {
|
|
2107
2249
|
priceCurrency: async (e, n, t) => {
|
|
2108
2250
|
const {
|
|
2109
2251
|
loaders: { salesChannelLoader: r },
|
|
@@ -2111,34 +2253,34 @@ const Or = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2111
2253
|
} = t;
|
|
2112
2254
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
2113
2255
|
},
|
|
2114
|
-
priceValidUntil: (e) =>
|
|
2256
|
+
priceValidUntil: (e) => F(e) ? e.PriceValidUntil ?? "" : k(e) ? e.priceValidUntil ?? "" : null,
|
|
2115
2257
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2116
|
-
availability: async (e) =>
|
|
2117
|
-
seller: (e, n, t) =>
|
|
2258
|
+
availability: async (e) => F(e) ? Ue(M(e)) : k(e) ? Ue(xt(e.availability)) : null,
|
|
2259
|
+
seller: (e, n, t) => F(e) ? {
|
|
2118
2260
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2119
|
-
} :
|
|
2261
|
+
} : k(e) ? {
|
|
2120
2262
|
identifier: e.seller
|
|
2121
2263
|
} : null,
|
|
2122
|
-
price: (e) =>
|
|
2123
|
-
priceWithTaxes: (e) =>
|
|
2264
|
+
price: (e) => F(e) ? V(e) : k(e) ? e.sellingPrice / 100 : null,
|
|
2265
|
+
priceWithTaxes: (e) => F(e) ? $(V(e), e?.Tax, e.product.unitMultiplier) : k(e) ? $(
|
|
2124
2266
|
e.sellingPrice / 100,
|
|
2125
2267
|
e.tax / 100,
|
|
2126
2268
|
e.unitMultiplier
|
|
2127
2269
|
) : null,
|
|
2128
|
-
sellingPrice: (e) =>
|
|
2129
|
-
listPrice: (e) =>
|
|
2130
|
-
listPriceWithTaxes: (e) =>
|
|
2270
|
+
sellingPrice: (e) => F(e) ? zt(e) : k(e) ? e.sellingPrice / 100 : null,
|
|
2271
|
+
listPrice: (e) => F(e) ? e.ListPrice ?? 0 : k(e) ? e.listPrice / 100 : null,
|
|
2272
|
+
listPriceWithTaxes: (e) => F(e) ? $(
|
|
2131
2273
|
e.ListPrice ?? 0,
|
|
2132
2274
|
e?.Tax,
|
|
2133
2275
|
e.product.unitMultiplier
|
|
2134
|
-
) :
|
|
2135
|
-
itemOffered: (e) =>
|
|
2276
|
+
) : k(e) ? $(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
|
|
2277
|
+
itemOffered: (e) => F(e) ? e.product : k(e) ? {
|
|
2136
2278
|
...e.product,
|
|
2137
2279
|
attachmentsValues: e.attachments
|
|
2138
2280
|
} : null,
|
|
2139
|
-
quantity: (e) =>
|
|
2140
|
-
isGift: (e) =>
|
|
2141
|
-
},
|
|
2281
|
+
quantity: (e) => F(e) ? e.AvailableQuantity ?? 0 : k(e) ? e.quantity : null,
|
|
2282
|
+
isGift: (e) => k(e) ? e.isGift ?? !1 : null
|
|
2283
|
+
}, Lr = ({ linkText: e }) => `/${e}/p`, Mr = ({
|
|
2142
2284
|
offer: e,
|
|
2143
2285
|
seller: n,
|
|
2144
2286
|
product: t
|
|
@@ -2146,26 +2288,26 @@ const Or = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2146
2288
|
...e,
|
|
2147
2289
|
product: t,
|
|
2148
2290
|
seller: n
|
|
2149
|
-
}),
|
|
2291
|
+
}), $r = {
|
|
2150
2292
|
imageText: "image",
|
|
2151
2293
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2152
2294
|
imageLabel: "label"
|
|
2153
|
-
},
|
|
2154
|
-
function
|
|
2295
|
+
}, fn = (e, n) => `${e}-${n}`, zr = (e, n) => `/${fn(e, n)}/p`, xr = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2296
|
+
function Sn(e) {
|
|
2155
2297
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2156
2298
|
}
|
|
2157
|
-
const
|
|
2158
|
-
const t = e.findIndex((r) =>
|
|
2299
|
+
const Vr = (e, n) => {
|
|
2300
|
+
const t = e.findIndex((r) => Sn(r).split("/").at(-1) === n);
|
|
2159
2301
|
return t < 0 ? 0 : t;
|
|
2160
|
-
},
|
|
2302
|
+
}, qr = {
|
|
2161
2303
|
productID: ({ itemId: e }) => e,
|
|
2162
2304
|
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2163
|
-
slug: ({ isVariantOf: { linkText: e }, itemId: n }) =>
|
|
2305
|
+
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => fn(e, n),
|
|
2164
2306
|
description: ({ isVariantOf: { description: e } }) => e,
|
|
2165
2307
|
seo: ({ isVariantOf: e }) => ({
|
|
2166
2308
|
title: e.productTitle || e.productName,
|
|
2167
2309
|
description: e.metaTagDescription || e.description,
|
|
2168
|
-
canonical:
|
|
2310
|
+
canonical: Lr(e)
|
|
2169
2311
|
}),
|
|
2170
2312
|
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2171
2313
|
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
@@ -2179,32 +2321,32 @@ const Ur = (e, n) => {
|
|
|
2179
2321
|
},
|
|
2180
2322
|
itemId: a
|
|
2181
2323
|
}) => {
|
|
2182
|
-
const o =
|
|
2324
|
+
const o = Vr(i, r), s = e[o], c = Sn(s).split("/");
|
|
2183
2325
|
return {
|
|
2184
2326
|
itemListElement: [
|
|
2185
|
-
...
|
|
2186
|
-
const
|
|
2327
|
+
...c.map((l, p) => {
|
|
2328
|
+
const u = `/${c.slice(0, p + 1).map(nn).join("/")}/`;
|
|
2187
2329
|
return {
|
|
2188
|
-
name:
|
|
2189
|
-
item:
|
|
2190
|
-
position:
|
|
2330
|
+
name: l,
|
|
2331
|
+
item: u,
|
|
2332
|
+
position: p + 1
|
|
2191
2333
|
};
|
|
2192
2334
|
}),
|
|
2193
2335
|
{
|
|
2194
2336
|
name: n,
|
|
2195
|
-
item:
|
|
2196
|
-
position:
|
|
2337
|
+
item: zr(t, a),
|
|
2338
|
+
position: c.length + 1
|
|
2197
2339
|
}
|
|
2198
2340
|
],
|
|
2199
|
-
numberOfItems:
|
|
2341
|
+
numberOfItems: c.length
|
|
2200
2342
|
};
|
|
2201
2343
|
},
|
|
2202
2344
|
image: ({ images: e }, n) => {
|
|
2203
|
-
const t = (
|
|
2204
|
-
({ imageUrl: s, imageText:
|
|
2205
|
-
alternateName:
|
|
2345
|
+
const t = (xr(e) ?? [$r]).map(
|
|
2346
|
+
({ imageUrl: s, imageText: c, imageLabel: l }) => ({
|
|
2347
|
+
alternateName: c ?? "",
|
|
2206
2348
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
2207
|
-
keywords:
|
|
2349
|
+
keywords: l
|
|
2208
2350
|
})
|
|
2209
2351
|
);
|
|
2210
2352
|
if (typeof n != "object")
|
|
@@ -2223,7 +2365,7 @@ const Ur = (e, n) => {
|
|
|
2223
2365
|
review: () => [],
|
|
2224
2366
|
aggregateRating: () => ({}),
|
|
2225
2367
|
offers: (e) => e.sellers.map(
|
|
2226
|
-
(n) =>
|
|
2368
|
+
(n) => Mr({
|
|
2227
2369
|
offer: n.commertialOffer,
|
|
2228
2370
|
seller: n,
|
|
2229
2371
|
product: e
|
|
@@ -2237,14 +2379,14 @@ const Ur = (e, n) => {
|
|
|
2237
2379
|
attributes: t = []
|
|
2238
2380
|
}) => {
|
|
2239
2381
|
const r = e.flatMap(
|
|
2240
|
-
({ name: o, values: s }) => s.map((
|
|
2382
|
+
({ name: o, values: s }) => s.map((c) => ({
|
|
2241
2383
|
name: o,
|
|
2242
|
-
value:
|
|
2243
|
-
valueReference:
|
|
2384
|
+
value: c,
|
|
2385
|
+
valueReference: K.specification
|
|
2244
2386
|
}))
|
|
2245
2387
|
), i = n.map(
|
|
2246
2388
|
sn
|
|
2247
|
-
), a = t.map(
|
|
2389
|
+
), a = t.map(lr);
|
|
2248
2390
|
return [
|
|
2249
2391
|
...r,
|
|
2250
2392
|
...i,
|
|
@@ -2257,34 +2399,34 @@ const Ur = (e, n) => {
|
|
|
2257
2399
|
releaseDate: ({ isVariantOf: { releaseDate: e } }) => e ?? "",
|
|
2258
2400
|
advertisement: ({ isVariantOf: { advertisement: e } }) => e,
|
|
2259
2401
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e
|
|
2260
|
-
},
|
|
2261
|
-
hasVariant: (e) => e.isVariantOf.items.map((n) =>
|
|
2402
|
+
}, jr = /* @__PURE__ */ new Set(["allSpecifications"]), Wr = {
|
|
2403
|
+
hasVariant: (e) => e.isVariantOf.items.map((n) => N(n, e.isVariantOf)),
|
|
2262
2404
|
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
2263
2405
|
name: (e) => e.isVariantOf.productName,
|
|
2264
2406
|
skuVariants: (e) => e,
|
|
2265
2407
|
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
2266
|
-
(n) => !
|
|
2408
|
+
(n) => !jr.has(n.name)
|
|
2267
2409
|
).flatMap(
|
|
2268
2410
|
({ specifications: n }) => n.flatMap(
|
|
2269
2411
|
({ name: t, values: r }) => r.map((i) => ({
|
|
2270
2412
|
name: t,
|
|
2271
2413
|
value: i,
|
|
2272
|
-
valueReference:
|
|
2414
|
+
valueReference: K.specification
|
|
2273
2415
|
}))
|
|
2274
2416
|
)
|
|
2275
2417
|
)
|
|
2276
|
-
},
|
|
2418
|
+
}, Gr = {
|
|
2277
2419
|
propertyID: (e) => e.propertyID || cn(e),
|
|
2278
2420
|
name: ({ name: e }) => e,
|
|
2279
2421
|
value: ({ value: e }) => e,
|
|
2280
2422
|
valueReference: ({ valueReference: e }) => e
|
|
2281
|
-
},
|
|
2423
|
+
}, Hr = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
2282
2424
|
if (!n)
|
|
2283
|
-
throw new
|
|
2425
|
+
throw new T("Missing operationId");
|
|
2284
2426
|
return t.orderEntry.getOperation({ operationId: n });
|
|
2285
|
-
},
|
|
2427
|
+
}, Xr = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
2286
2428
|
if (!n)
|
|
2287
|
-
throw new
|
|
2429
|
+
throw new T("Missing orderFormId");
|
|
2288
2430
|
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
2289
2431
|
return (r ?? []).map((i) => ({
|
|
2290
2432
|
id: i.id,
|
|
@@ -2297,18 +2439,46 @@ const Ur = (e, n) => {
|
|
|
2297
2439
|
seller: i.seller,
|
|
2298
2440
|
unitMultiplier: i.unitMultiplier ?? 1
|
|
2299
2441
|
}));
|
|
2300
|
-
},
|
|
2442
|
+
}, re = (e) => {
|
|
2301
2443
|
const n = e.flatMap(
|
|
2302
2444
|
(r) => r.sellers.map((i) => ({
|
|
2303
2445
|
offer: i.commertialOffer,
|
|
2304
2446
|
sku: r
|
|
2305
2447
|
}))
|
|
2306
|
-
), t =
|
|
2448
|
+
), t = me(
|
|
2307
2449
|
n,
|
|
2308
2450
|
({ offer: r }, { offer: i }) => en(r, i)
|
|
2309
2451
|
);
|
|
2310
2452
|
return t ? t.sku : e[0];
|
|
2311
|
-
},
|
|
2453
|
+
}, Yr = (e) => e !== "" && !Number.isNaN(Number(e)), Jr = /^vrn:recommendations:[^:]+:[^:]+:[^:]+$/, Qr = async (e, { campaignVrn: n, userId: t, products: r }, i) => {
|
|
2454
|
+
const {
|
|
2455
|
+
clients: { commerce: a }
|
|
2456
|
+
} = i, { salesChannel: o } = i.storage.channel, s = n?.trim();
|
|
2457
|
+
if (!s || !Jr.test(s))
|
|
2458
|
+
throw new T(`Invalid campaignVrn: "${n}"`);
|
|
2459
|
+
const c = t?.trim();
|
|
2460
|
+
if (t != null && !c)
|
|
2461
|
+
throw new T("Invalid userId: must be a non-empty string");
|
|
2462
|
+
if (r != null && (!Array.isArray(r) || r.some((S) => !S?.trim())))
|
|
2463
|
+
throw new T(
|
|
2464
|
+
"Invalid products: must be an array of non-empty strings"
|
|
2465
|
+
);
|
|
2466
|
+
const l = await a.recommendation.recommendations({
|
|
2467
|
+
campaignVrn: s,
|
|
2468
|
+
userId: c || void 0,
|
|
2469
|
+
products: r ?? [],
|
|
2470
|
+
salesChannel: o ?? void 0,
|
|
2471
|
+
locale: i.storage.locale
|
|
2472
|
+
}), { campaign: p, correlationId: u } = l;
|
|
2473
|
+
return {
|
|
2474
|
+
products: (l.products ?? []).map((S) => {
|
|
2475
|
+
const b = re(S.items);
|
|
2476
|
+
return b ? N(b, S) : null;
|
|
2477
|
+
}).filter((S) => !!S),
|
|
2478
|
+
correlationId: u,
|
|
2479
|
+
campaign: p
|
|
2480
|
+
};
|
|
2481
|
+
}, ze = {
|
|
2312
2482
|
price_desc: "price:desc",
|
|
2313
2483
|
price_asc: "price:asc",
|
|
2314
2484
|
orders_desc: "orders:desc",
|
|
@@ -2317,40 +2487,40 @@ const Ur = (e, n) => {
|
|
|
2317
2487
|
release_desc: "release:desc",
|
|
2318
2488
|
discount_desc: "discount:desc",
|
|
2319
2489
|
score_desc: ""
|
|
2320
|
-
},
|
|
2490
|
+
}, yn = "Invalid SkuId", Kr = "Slug was set but the fetched sku does not satisfy the slug condition.", Zr = (e) => Xe(e) || e instanceof Error && (e.message === yn || e.message.startsWith(Kr)), ei = {
|
|
2321
2491
|
product: async (e, { locator: n }, t) => {
|
|
2322
|
-
const r = Fe(n), i =
|
|
2323
|
-
r &&
|
|
2492
|
+
const r = Fe(n), i = ke(n), a = Qt(n), o = Jt(n);
|
|
2493
|
+
r && he(t, r), i && fe(t, i);
|
|
2324
2494
|
const {
|
|
2325
2495
|
loaders: { skuLoader: s },
|
|
2326
|
-
clients: { commerce:
|
|
2496
|
+
clients: { commerce: c, search: l }
|
|
2327
2497
|
} = t;
|
|
2328
2498
|
try {
|
|
2329
|
-
const
|
|
2330
|
-
if (!
|
|
2331
|
-
throw new Error(
|
|
2332
|
-
const
|
|
2333
|
-
if (o &&
|
|
2499
|
+
const p = a ?? o?.split("-").pop() ?? "";
|
|
2500
|
+
if (!Yr(p))
|
|
2501
|
+
throw new Error(yn);
|
|
2502
|
+
const u = await s.load(p);
|
|
2503
|
+
if (o && u.isVariantOf.linkText && !o.startsWith(u.isVariantOf.linkText))
|
|
2334
2504
|
throw new Error(
|
|
2335
|
-
`Slug was set but the fetched sku does not satisfy the slug condition. slug: ${o}, linkText: ${
|
|
2505
|
+
`Slug was set but the fetched sku does not satisfy the slug condition. slug: ${o}, linkText: ${u.isVariantOf.linkText}`
|
|
2336
2506
|
);
|
|
2337
|
-
return
|
|
2338
|
-
} catch (
|
|
2339
|
-
if (!
|
|
2340
|
-
throw
|
|
2507
|
+
return u;
|
|
2508
|
+
} catch (p) {
|
|
2509
|
+
if (!Zr(p))
|
|
2510
|
+
throw p;
|
|
2341
2511
|
if (o == null)
|
|
2342
|
-
throw new
|
|
2343
|
-
const
|
|
2344
|
-
if (
|
|
2345
|
-
throw new
|
|
2346
|
-
const
|
|
2512
|
+
throw new T("Missing slug or id");
|
|
2513
|
+
const u = await c.catalog.portal.pagetype(`${o}/p`);
|
|
2514
|
+
if (u.pageType !== "Product" || !u.id)
|
|
2515
|
+
throw new L(`No product found for slug ${o}`);
|
|
2516
|
+
const h = await l.fetchProduct({
|
|
2347
2517
|
field: "id",
|
|
2348
|
-
value: String(
|
|
2518
|
+
value: String(u.id)
|
|
2349
2519
|
}).catch(() => null);
|
|
2350
|
-
if (!
|
|
2351
|
-
throw new
|
|
2352
|
-
const
|
|
2353
|
-
return
|
|
2520
|
+
if (!h)
|
|
2521
|
+
throw new L(`No product found for id ${u.id}`);
|
|
2522
|
+
const S = re(h.items);
|
|
2523
|
+
return N(S, h);
|
|
2354
2524
|
}
|
|
2355
2525
|
},
|
|
2356
2526
|
collection: (e, { slug: n }, t) => {
|
|
@@ -2367,25 +2537,25 @@ const Ur = (e, n) => {
|
|
|
2367
2537
|
selectedFacets: a,
|
|
2368
2538
|
sponsoredCount: o
|
|
2369
2539
|
}, s) => {
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2372
|
-
const
|
|
2373
|
-
page: Math.ceil(
|
|
2540
|
+
const c = Fe(a), l = ke(a), p = Yt(a);
|
|
2541
|
+
c && he(s, c), l && fe(s, l);
|
|
2542
|
+
const u = t ? Number(t) : 0, h = {
|
|
2543
|
+
page: Math.ceil(u / n) || 0,
|
|
2374
2544
|
count: n,
|
|
2375
2545
|
query: i ?? void 0,
|
|
2376
|
-
sort:
|
|
2546
|
+
sort: ze[r ?? "score_desc"] ?? ze.score_desc,
|
|
2377
2547
|
selectedFacets: a?.flatMap(Te) ?? [],
|
|
2378
2548
|
sponsoredCount: o ?? void 0
|
|
2379
2549
|
};
|
|
2380
|
-
if (
|
|
2381
|
-
const
|
|
2382
|
-
type: rn[
|
|
2383
|
-
productId:
|
|
2384
|
-
})).map((
|
|
2385
|
-
products:
|
|
2386
|
-
recordsFiltered:
|
|
2550
|
+
if (p) {
|
|
2551
|
+
const d = (await s.clients.commerce.catalog.products.crossselling({
|
|
2552
|
+
type: rn[p.key],
|
|
2553
|
+
productId: p.value
|
|
2554
|
+
})).map((m) => m.productId).slice(0, n), g = s.clients.search.productsByIdentifier({ field: "id", values: d }).then((m) => ({
|
|
2555
|
+
products: m,
|
|
2556
|
+
recordsFiltered: m.length,
|
|
2387
2557
|
pagination: {
|
|
2388
|
-
count:
|
|
2558
|
+
count: m.length,
|
|
2389
2559
|
current: { index: 0, proxyURL: "" },
|
|
2390
2560
|
before: [],
|
|
2391
2561
|
after: [],
|
|
@@ -2404,10 +2574,10 @@ const Ur = (e, n) => {
|
|
|
2404
2574
|
fuzzy: "0",
|
|
2405
2575
|
searchId: ""
|
|
2406
2576
|
}));
|
|
2407
|
-
return { searchArgs:
|
|
2577
|
+
return { searchArgs: h, productSearchPromise: g };
|
|
2408
2578
|
}
|
|
2409
|
-
const
|
|
2410
|
-
return { searchArgs:
|
|
2579
|
+
const S = s.clients.search.products(h);
|
|
2580
|
+
return { searchArgs: h, productSearchPromise: S };
|
|
2411
2581
|
},
|
|
2412
2582
|
allProducts: async (e, { first: n, after: t }, r) => {
|
|
2413
2583
|
const {
|
|
@@ -2416,8 +2586,8 @@ const Ur = (e, n) => {
|
|
|
2416
2586
|
page: Math.ceil(a / n),
|
|
2417
2587
|
count: n
|
|
2418
2588
|
}), s = o.products.flatMap(
|
|
2419
|
-
(
|
|
2420
|
-
).filter((
|
|
2589
|
+
(c) => c.items.map((l) => N(l, c))
|
|
2590
|
+
).filter((c) => c.sellers.length > 0);
|
|
2421
2591
|
return {
|
|
2422
2592
|
pageInfo: {
|
|
2423
2593
|
hasNextPage: o.pagination.after.length > 0,
|
|
@@ -2427,9 +2597,9 @@ const Ur = (e, n) => {
|
|
|
2427
2597
|
totalCount: o.recordsFiltered
|
|
2428
2598
|
},
|
|
2429
2599
|
// after + index is bigger than after+first itself because of the array flat() above
|
|
2430
|
-
edges: s.map((
|
|
2431
|
-
node:
|
|
2432
|
-
cursor: (a +
|
|
2600
|
+
edges: s.map((c, l) => ({
|
|
2601
|
+
node: c,
|
|
2602
|
+
cursor: (a + l).toString()
|
|
2433
2603
|
}))
|
|
2434
2604
|
};
|
|
2435
2605
|
},
|
|
@@ -2441,7 +2611,7 @@ const Ur = (e, n) => {
|
|
|
2441
2611
|
field: "id",
|
|
2442
2612
|
values: n
|
|
2443
2613
|
})).flatMap(
|
|
2444
|
-
(a) => a.items.map((o) =>
|
|
2614
|
+
(a) => a.items.map((o) => N(o, a))
|
|
2445
2615
|
).filter(
|
|
2446
2616
|
(a) => n.includes(a.itemId) && a.sellers.length > 0
|
|
2447
2617
|
) : [];
|
|
@@ -2452,28 +2622,28 @@ const Ur = (e, n) => {
|
|
|
2452
2622
|
} = r, a = t ? Number(t) : 0, [o, s] = await Promise.all([
|
|
2453
2623
|
i.catalog.brand.list(),
|
|
2454
2624
|
i.catalog.category.tree()
|
|
2455
|
-
]),
|
|
2456
|
-
|
|
2457
|
-
for (const
|
|
2458
|
-
|
|
2625
|
+
]), c = [], l = (h, S) => {
|
|
2626
|
+
c.push({ ...h, level: S });
|
|
2627
|
+
for (const b of h.children)
|
|
2628
|
+
l(b, S + 1);
|
|
2459
2629
|
};
|
|
2460
|
-
for (const
|
|
2461
|
-
|
|
2462
|
-
const
|
|
2463
|
-
...o.filter((
|
|
2464
|
-
...
|
|
2465
|
-
].filter((
|
|
2630
|
+
for (const h of s)
|
|
2631
|
+
l(h, 0);
|
|
2632
|
+
const u = [
|
|
2633
|
+
...o.filter((h) => h.isActive).map((h) => ({ ...h, type: "brand" })),
|
|
2634
|
+
...c
|
|
2635
|
+
].filter((h) => !!tn.slug(h, null, r, null));
|
|
2466
2636
|
return {
|
|
2467
2637
|
pageInfo: {
|
|
2468
|
-
hasNextPage:
|
|
2638
|
+
hasNextPage: u.length - a > n,
|
|
2469
2639
|
hasPreviousPage: a > 0,
|
|
2470
2640
|
startCursor: "0",
|
|
2471
|
-
endCursor: (Math.min(n,
|
|
2472
|
-
totalCount:
|
|
2641
|
+
endCursor: (Math.min(n, u.length - a) - 1).toString(),
|
|
2642
|
+
totalCount: u.length
|
|
2473
2643
|
},
|
|
2474
|
-
edges:
|
|
2475
|
-
node:
|
|
2476
|
-
cursor: (a +
|
|
2644
|
+
edges: u.slice(a, a + n).map((h, S) => ({
|
|
2645
|
+
node: h,
|
|
2646
|
+
cursor: (a + S).toString()
|
|
2477
2647
|
}))
|
|
2478
2648
|
};
|
|
2479
2649
|
},
|
|
@@ -2481,13 +2651,13 @@ const Ur = (e, n) => {
|
|
|
2481
2651
|
const {
|
|
2482
2652
|
loaders: { simulationLoader: a },
|
|
2483
2653
|
clients: { commerce: o }
|
|
2484
|
-
} = i, [s,
|
|
2654
|
+
} = i, [s, c] = await Promise.all([
|
|
2485
2655
|
a.load({ country: n, items: t, postalCode: r }),
|
|
2486
2656
|
o.checkout.address({ postalCode: r, country: n })
|
|
2487
2657
|
]);
|
|
2488
2658
|
return {
|
|
2489
2659
|
...s,
|
|
2490
|
-
address:
|
|
2660
|
+
address: c
|
|
2491
2661
|
};
|
|
2492
2662
|
},
|
|
2493
2663
|
redirect: async (e, { term: n, selectedFacets: t }, r) => {
|
|
@@ -2507,15 +2677,15 @@ const Ur = (e, n) => {
|
|
|
2507
2677
|
sellers: async (e, { postalCode: n, geoCoordinates: t, country: r, salesChannel: i }, a) => {
|
|
2508
2678
|
const {
|
|
2509
2679
|
clients: { commerce: o }
|
|
2510
|
-
} = a,
|
|
2680
|
+
} = a, c = (await o.checkout.region({
|
|
2511
2681
|
postalCode: n,
|
|
2512
2682
|
geoCoordinates: t,
|
|
2513
2683
|
country: r,
|
|
2514
2684
|
salesChannel: i
|
|
2515
|
-
}))?.[0], { id:
|
|
2685
|
+
}))?.[0], { id: l, sellers: p } = c;
|
|
2516
2686
|
return {
|
|
2517
|
-
id:
|
|
2518
|
-
sellers:
|
|
2687
|
+
id: l,
|
|
2688
|
+
sellers: p
|
|
2519
2689
|
};
|
|
2520
2690
|
},
|
|
2521
2691
|
profile: async (e, { id: n }, t) => {
|
|
@@ -2524,7 +2694,7 @@ const Ur = (e, n) => {
|
|
|
2524
2694
|
} = t, i = await r.profile.addresses(n);
|
|
2525
2695
|
function a(s) {
|
|
2526
2696
|
return !s || Object.keys(s).length === 0 ? [] : Object.values(s).map(
|
|
2527
|
-
(
|
|
2697
|
+
(c) => JSON.parse(c)
|
|
2528
2698
|
);
|
|
2529
2699
|
}
|
|
2530
2700
|
return { addresses: a(i) };
|
|
@@ -2540,16 +2710,16 @@ const Ur = (e, n) => {
|
|
|
2540
2710
|
userOrder: async (e, { orderId: n }, t) => {
|
|
2541
2711
|
try {
|
|
2542
2712
|
if (!n)
|
|
2543
|
-
throw new
|
|
2713
|
+
throw new T("Missing orderId");
|
|
2544
2714
|
const {
|
|
2545
2715
|
clients: { commerce: r }
|
|
2546
2716
|
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
2547
2717
|
if (!i)
|
|
2548
|
-
throw new
|
|
2718
|
+
throw new L(`No order found for id ${n}`);
|
|
2549
2719
|
let a = null;
|
|
2550
2720
|
try {
|
|
2551
|
-
const
|
|
2552
|
-
a = an(
|
|
2721
|
+
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
2722
|
+
a = an(c);
|
|
2553
2723
|
} catch {
|
|
2554
2724
|
}
|
|
2555
2725
|
const s = (await r.masterData.getShopperById({
|
|
@@ -2588,7 +2758,7 @@ const Ur = (e, n) => {
|
|
|
2588
2758
|
a = { message: i };
|
|
2589
2759
|
}
|
|
2590
2760
|
const o = a?.message || i;
|
|
2591
|
-
throw
|
|
2761
|
+
throw Xe(r) ? new L(`No order found for id ${n}. ${o}.`) : Wn(r) ? new Y(
|
|
2592
2762
|
`You are forbidden to interact with order with id ${n}. ${o}.`
|
|
2593
2763
|
) : r;
|
|
2594
2764
|
}
|
|
@@ -2613,27 +2783,69 @@ const Ur = (e, n) => {
|
|
|
2613
2783
|
paging: i.paging
|
|
2614
2784
|
};
|
|
2615
2785
|
},
|
|
2786
|
+
listUserQuotes: async (e, n, t) => {
|
|
2787
|
+
const {
|
|
2788
|
+
clients: { commerce: r }
|
|
2789
|
+
} = t, i = await r.quotes.listUserQuotes(n), a = [
|
|
2790
|
+
...new Set(i.items.map((c) => c.createdBy).filter(Boolean))
|
|
2791
|
+
], o = /* @__PURE__ */ new Map();
|
|
2792
|
+
return await Promise.all(
|
|
2793
|
+
a.map(async (c) => {
|
|
2794
|
+
try {
|
|
2795
|
+
const [l] = await r.masterData.getShopperById({
|
|
2796
|
+
userId: c
|
|
2797
|
+
});
|
|
2798
|
+
if (l) {
|
|
2799
|
+
const p = [l.firstName, l.lastName].filter(Boolean).join(" ");
|
|
2800
|
+
p && o.set(c, p);
|
|
2801
|
+
}
|
|
2802
|
+
} catch {
|
|
2803
|
+
}
|
|
2804
|
+
})
|
|
2805
|
+
), {
|
|
2806
|
+
list: i.items.map((c) => ({
|
|
2807
|
+
id: c.id,
|
|
2808
|
+
status: c.status,
|
|
2809
|
+
label: c.label ?? null,
|
|
2810
|
+
createdAt: c.createdAt,
|
|
2811
|
+
expiresAt: c.expiresAt,
|
|
2812
|
+
amount: c.amount,
|
|
2813
|
+
createdBy: c.createdBy ? o.get(c.createdBy) ?? c.createdBy : null
|
|
2814
|
+
})),
|
|
2815
|
+
paging: {
|
|
2816
|
+
total: i.totalItems,
|
|
2817
|
+
currentPage: i.pageNumber,
|
|
2818
|
+
perPage: i.pageSize
|
|
2819
|
+
}
|
|
2820
|
+
};
|
|
2821
|
+
},
|
|
2616
2822
|
validateUser: async (e, n, t) => ({
|
|
2617
2823
|
isValid: !0
|
|
2618
2824
|
}),
|
|
2825
|
+
isOrganizationMember: async (e, n, t) => {
|
|
2826
|
+
const {
|
|
2827
|
+
clients: { commerce: r }
|
|
2828
|
+
} = t;
|
|
2829
|
+
return !!(await r.session("").catch(() => null))?.namespaces.authentication?.unitId?.value;
|
|
2830
|
+
},
|
|
2619
2831
|
// only b2b users
|
|
2620
2832
|
userDetails: async (e, n, t) => {
|
|
2621
2833
|
const {
|
|
2622
2834
|
account: r,
|
|
2623
2835
|
headers: i,
|
|
2624
2836
|
clients: { commerce: a }
|
|
2625
|
-
} = t, s =
|
|
2837
|
+
} = t, s = X(z(i?.cookie ?? "", r))?.userId ?? "", [c, l, p] = await Promise.all([
|
|
2626
2838
|
a.session("").catch(() => null),
|
|
2627
2839
|
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
2628
2840
|
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
2629
|
-
]),
|
|
2841
|
+
]), u = l?.[0], h = c?.namespaces.authentication ?? null, S = `${(u?.firstName ?? "").trim()} ${(u?.lastName ?? "").trim()}`.trim();
|
|
2630
2842
|
return {
|
|
2631
|
-
username:
|
|
2632
|
-
name:
|
|
2633
|
-
email:
|
|
2634
|
-
phone:
|
|
2635
|
-
role:
|
|
2636
|
-
orgUnit:
|
|
2843
|
+
username: h?.storeUserEmail?.value ?? "",
|
|
2844
|
+
name: S,
|
|
2845
|
+
email: h?.storeUserEmail?.value ?? "",
|
|
2846
|
+
phone: u?.phone ?? "",
|
|
2847
|
+
role: p?.Roles?.map((b) => b.Name) ?? [],
|
|
2848
|
+
orgUnit: h?.unitName?.value ?? ""
|
|
2637
2849
|
};
|
|
2638
2850
|
},
|
|
2639
2851
|
// If isRepresentative, return b2b information.
|
|
@@ -2643,20 +2855,20 @@ const Ur = (e, n) => {
|
|
|
2643
2855
|
account: r,
|
|
2644
2856
|
headers: i,
|
|
2645
2857
|
clients: { commerce: a }
|
|
2646
|
-
} = t, o =
|
|
2858
|
+
} = t, o = X(z(i?.cookie ?? "", r));
|
|
2647
2859
|
if (!o?.userId)
|
|
2648
2860
|
return null;
|
|
2649
2861
|
if (o?.isRepresentative) {
|
|
2650
|
-
const
|
|
2651
|
-
if (!
|
|
2862
|
+
const c = await a.session("").catch(() => null);
|
|
2863
|
+
if (!c)
|
|
2652
2864
|
return null;
|
|
2653
|
-
const
|
|
2865
|
+
const l = c.namespaces.profile ?? null, p = await a.masterData.getContractById({
|
|
2866
|
+
contractId: l?.id?.value ?? ""
|
|
2867
|
+
});
|
|
2654
2868
|
return {
|
|
2655
|
-
name: (
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
email: d?.email?.value || "",
|
|
2659
|
-
id: d?.id?.value || ""
|
|
2869
|
+
name: mn(p, l) || "",
|
|
2870
|
+
email: l?.email?.value || "",
|
|
2871
|
+
id: l?.id?.value || ""
|
|
2660
2872
|
// createdAt: '',
|
|
2661
2873
|
};
|
|
2662
2874
|
}
|
|
@@ -2670,6 +2882,32 @@ const Ur = (e, n) => {
|
|
|
2670
2882
|
// createdAt: '',
|
|
2671
2883
|
};
|
|
2672
2884
|
},
|
|
2885
|
+
// only b2b users
|
|
2886
|
+
// Contract list from VTEX session `shopper.availableContracts`.
|
|
2887
|
+
availableContracts: async (e, { orgUnitId: n }, t) => {
|
|
2888
|
+
if (!n)
|
|
2889
|
+
throw new T("Missing orgUnitId");
|
|
2890
|
+
const {
|
|
2891
|
+
account: r,
|
|
2892
|
+
headers: i,
|
|
2893
|
+
clients: { commerce: a }
|
|
2894
|
+
} = t, o = await a.session("").catch(() => null), s = z(i?.cookie ?? "", r);
|
|
2895
|
+
let c = null;
|
|
2896
|
+
try {
|
|
2897
|
+
c = s ? X(s) : null;
|
|
2898
|
+
} catch {
|
|
2899
|
+
c = null;
|
|
2900
|
+
}
|
|
2901
|
+
const l = o?.namespaces.authentication?.unitId?.value?.trim() ?? c?.unitId?.trim() ?? "";
|
|
2902
|
+
if (!l || l !== n)
|
|
2903
|
+
throw new Y(
|
|
2904
|
+
"You are not allowed to list contracts for this organization unit"
|
|
2905
|
+
);
|
|
2906
|
+
const p = Ar(
|
|
2907
|
+
o?.namespaces.shopper
|
|
2908
|
+
), u = Ur(o) || c?.customerId?.trim() || "";
|
|
2909
|
+
return Er(p, u);
|
|
2910
|
+
},
|
|
2673
2911
|
pickupPoints: async (e, { geoCoordinates: n }, t) => {
|
|
2674
2912
|
const {
|
|
2675
2913
|
clients: { commerce: r }
|
|
@@ -2678,9 +2916,10 @@ const Ur = (e, n) => {
|
|
|
2678
2916
|
geoCoordinates: n
|
|
2679
2917
|
});
|
|
2680
2918
|
},
|
|
2681
|
-
orderEntryOperation:
|
|
2682
|
-
orderFormItems:
|
|
2683
|
-
|
|
2919
|
+
orderEntryOperation: Hr,
|
|
2920
|
+
orderFormItems: Xr,
|
|
2921
|
+
recommendations: Qr
|
|
2922
|
+
}, ni = {
|
|
2684
2923
|
reviewRating: () => ({
|
|
2685
2924
|
ratingValue: 5,
|
|
2686
2925
|
bestRating: 5
|
|
@@ -2688,35 +2927,35 @@ const Ur = (e, n) => {
|
|
|
2688
2927
|
author: () => ({
|
|
2689
2928
|
name: ""
|
|
2690
2929
|
})
|
|
2691
|
-
},
|
|
2930
|
+
}, ti = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, ri = {
|
|
2692
2931
|
suggestions: async (e, n, t) => {
|
|
2693
2932
|
const {
|
|
2694
2933
|
clients: { search: r }
|
|
2695
2934
|
} = t, { searchArgs: i } = e;
|
|
2696
2935
|
if (!i.query)
|
|
2697
2936
|
return {
|
|
2698
|
-
terms: (await r.topSearches()).searches.map((
|
|
2699
|
-
value:
|
|
2700
|
-
count:
|
|
2937
|
+
terms: (await r.topSearches()).searches.map((u) => ({
|
|
2938
|
+
value: u.term,
|
|
2939
|
+
count: u.count
|
|
2701
2940
|
})),
|
|
2702
2941
|
products: []
|
|
2703
2942
|
};
|
|
2704
2943
|
const { productSearchPromise: a } = e, [o, s] = await Promise.all([
|
|
2705
2944
|
r.suggestedTerms(i),
|
|
2706
2945
|
a
|
|
2707
|
-
]),
|
|
2708
|
-
const
|
|
2709
|
-
return
|
|
2710
|
-
}).filter((
|
|
2946
|
+
]), c = s.products.map((p) => {
|
|
2947
|
+
const u = re(p.items);
|
|
2948
|
+
return u && N(u, p);
|
|
2949
|
+
}).filter((p) => !!p), { searches: l } = o;
|
|
2711
2950
|
return {
|
|
2712
|
-
terms:
|
|
2713
|
-
products:
|
|
2951
|
+
terms: l.map((p) => ({ value: p.term, count: p.count })),
|
|
2952
|
+
products: c
|
|
2714
2953
|
};
|
|
2715
2954
|
},
|
|
2716
2955
|
products: async ({ productSearchPromise: e }) => {
|
|
2717
2956
|
const n = await e, t = n.products.map((r) => {
|
|
2718
|
-
const i =
|
|
2719
|
-
return i &&
|
|
2957
|
+
const i = re(r.items);
|
|
2958
|
+
return i && N(i, r);
|
|
2720
2959
|
}).filter((r) => !!r);
|
|
2721
2960
|
return {
|
|
2722
2961
|
pageInfo: {
|
|
@@ -2739,7 +2978,7 @@ const Ur = (e, n) => {
|
|
|
2739
2978
|
t.storage.searchArgs = e;
|
|
2740
2979
|
const { facets: i = [] } = await r.facets(e), a = !e.query, o = e.selectedFacets?.length ? e.selectedFacets[0].key === "category-1" : !1, s = e.selectedFacets?.length ? e.selectedFacets[0].key === "brand" : !1;
|
|
2741
2980
|
return i.filter(
|
|
2742
|
-
(
|
|
2981
|
+
(l) => !a || !ti(l, o, s)
|
|
2743
2982
|
);
|
|
2744
2983
|
},
|
|
2745
2984
|
metadata: async ({ productSearchPromise: e }) => {
|
|
@@ -2751,12 +2990,12 @@ const Ur = (e, n) => {
|
|
|
2751
2990
|
};
|
|
2752
2991
|
},
|
|
2753
2992
|
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
2754
|
-
},
|
|
2993
|
+
}, ii = {
|
|
2755
2994
|
title: ({ title: e }) => e ?? "",
|
|
2756
2995
|
description: ({ description: e }) => e ?? "",
|
|
2757
2996
|
canonical: ({ canonical: e }) => e ?? "",
|
|
2758
2997
|
titleTemplate: () => ""
|
|
2759
|
-
},
|
|
2998
|
+
}, ai = ["bd", "d", "h", "m"], oi = (e) => ai.includes(e), si = {
|
|
2760
2999
|
bd: {
|
|
2761
3000
|
0: "Today",
|
|
2762
3001
|
1: "In 1 business day",
|
|
@@ -2777,178 +3016,178 @@ const Ur = (e, n) => {
|
|
|
2777
3016
|
1: "In 1 minute",
|
|
2778
3017
|
other: "Up to # minutes"
|
|
2779
3018
|
}
|
|
2780
|
-
},
|
|
2781
|
-
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i =
|
|
3019
|
+
}, In = (e) => {
|
|
3020
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = oi(t);
|
|
2782
3021
|
if (!r || !i)
|
|
2783
3022
|
return "";
|
|
2784
3023
|
const a = Number(n) < 2 ? Number(n) : "other";
|
|
2785
|
-
return
|
|
2786
|
-
},
|
|
3024
|
+
return si[t][a].replace("#", n) ?? "";
|
|
3025
|
+
}, ci = {
|
|
2787
3026
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
2788
3027
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
2789
|
-
localizedEstimates: (e) => e?.shippingEstimate ?
|
|
2790
|
-
},
|
|
3028
|
+
localizedEstimates: (e) => e?.shippingEstimate ? In(e.shippingEstimate) : ""
|
|
3029
|
+
}, xe = "skuvariation";
|
|
2791
3030
|
function Ve(e, n) {
|
|
2792
|
-
const t = `${
|
|
3031
|
+
const t = `${xe}${n}`.toLowerCase(), r = e.find(
|
|
2793
3032
|
(a) => a.imageLabel === t
|
|
2794
3033
|
);
|
|
2795
3034
|
if (r)
|
|
2796
3035
|
return r;
|
|
2797
3036
|
const i = e.find(
|
|
2798
|
-
(a) => a.imageLabel ===
|
|
3037
|
+
(a) => a.imageLabel === xe
|
|
2799
3038
|
);
|
|
2800
3039
|
return i || e[0];
|
|
2801
3040
|
}
|
|
2802
|
-
function
|
|
3041
|
+
function li(e, n, t) {
|
|
2803
3042
|
const r = {};
|
|
2804
3043
|
return e.forEach((i) => {
|
|
2805
3044
|
const a = i.variations;
|
|
2806
3045
|
if (a.length === 0)
|
|
2807
3046
|
return;
|
|
2808
3047
|
const o = `${n}-${a.find(
|
|
2809
|
-
(
|
|
2810
|
-
)?.values[0] ?? ""}`, s = a.reduce((
|
|
3048
|
+
(c) => c.name === n
|
|
3049
|
+
)?.values[0] ?? ""}`, s = a.reduce((c, l) => l.name === n ? c : c + `-${l.name}-${l.values[0]}`, o);
|
|
2811
3050
|
r[s] = `${t}-${i.itemId}`;
|
|
2812
3051
|
}), r;
|
|
2813
3052
|
}
|
|
2814
|
-
function
|
|
3053
|
+
function qe(e) {
|
|
2815
3054
|
const n = {};
|
|
2816
3055
|
return e.forEach((t) => {
|
|
2817
3056
|
n[t.name] = t.values[0];
|
|
2818
3057
|
}), n;
|
|
2819
3058
|
}
|
|
2820
|
-
function
|
|
3059
|
+
function di(e) {
|
|
2821
3060
|
const n = {};
|
|
2822
3061
|
return e?.forEach((t) => {
|
|
2823
3062
|
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
2824
3063
|
}), n;
|
|
2825
3064
|
}
|
|
2826
|
-
function
|
|
3065
|
+
function ui(e, n) {
|
|
2827
3066
|
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
2828
3067
|
}
|
|
2829
|
-
function
|
|
3068
|
+
function pi(e) {
|
|
2830
3069
|
const n = e;
|
|
2831
3070
|
for (const t in e)
|
|
2832
3071
|
e[t].every(
|
|
2833
3072
|
(i) => !Number.isNaN(Number(i.value))
|
|
2834
|
-
) && e[t].sort((i, a) =>
|
|
3073
|
+
) && e[t].sort((i, a) => ui(i.value, a.value));
|
|
2835
3074
|
return n;
|
|
2836
3075
|
}
|
|
2837
|
-
function
|
|
3076
|
+
function gi(e, n, t) {
|
|
2838
3077
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
2839
3078
|
return e.forEach((a) => {
|
|
2840
3079
|
if (a.variations.length === 0)
|
|
2841
3080
|
return;
|
|
2842
3081
|
const o = a.variations.find(
|
|
2843
|
-
(
|
|
3082
|
+
(c) => c.name === n
|
|
2844
3083
|
);
|
|
2845
3084
|
if (!(o?.values[0] === t)) {
|
|
2846
|
-
const
|
|
2847
|
-
if (!o || i.has(
|
|
3085
|
+
const c = `${n}-${o?.values[0]}`;
|
|
3086
|
+
if (!o || i.has(c))
|
|
2848
3087
|
return;
|
|
2849
|
-
i.add(
|
|
2850
|
-
const
|
|
3088
|
+
i.add(c);
|
|
3089
|
+
const l = Ve(
|
|
2851
3090
|
a.images,
|
|
2852
3091
|
n
|
|
2853
|
-
),
|
|
2854
|
-
src:
|
|
2855
|
-
alt:
|
|
3092
|
+
), p = {
|
|
3093
|
+
src: l.imageUrl,
|
|
3094
|
+
alt: l.imageLabel ?? "",
|
|
2856
3095
|
label: `${n}: ${o.values[0]}`,
|
|
2857
3096
|
value: o.values[0]
|
|
2858
3097
|
};
|
|
2859
|
-
r[o.name] ? r[o.name].push(
|
|
3098
|
+
r[o.name] ? r[o.name].push(p) : r[o.name] = [p];
|
|
2860
3099
|
return;
|
|
2861
3100
|
}
|
|
2862
|
-
a.variations.forEach((
|
|
2863
|
-
const
|
|
2864
|
-
if (i.has(
|
|
3101
|
+
a.variations.forEach((c) => {
|
|
3102
|
+
const l = `${c.name}-${c.values[0]}`;
|
|
3103
|
+
if (i.has(l))
|
|
2865
3104
|
return;
|
|
2866
|
-
i.add(
|
|
2867
|
-
const
|
|
3105
|
+
i.add(l);
|
|
3106
|
+
const p = Ve(
|
|
2868
3107
|
a.images,
|
|
2869
|
-
|
|
2870
|
-
),
|
|
2871
|
-
src:
|
|
2872
|
-
alt:
|
|
2873
|
-
label: `${
|
|
2874
|
-
value:
|
|
3108
|
+
c.name
|
|
3109
|
+
), u = {
|
|
3110
|
+
src: p.imageUrl,
|
|
3111
|
+
alt: p.imageText ?? "",
|
|
3112
|
+
label: `${c.name}: ${c.values[0]}`,
|
|
3113
|
+
value: c.values[0]
|
|
2875
3114
|
};
|
|
2876
|
-
r[
|
|
3115
|
+
r[c.name] ? r[c.name].push(u) : r[c.name] = [u];
|
|
2877
3116
|
});
|
|
2878
|
-
}),
|
|
3117
|
+
}), pi(r);
|
|
2879
3118
|
}
|
|
2880
|
-
const
|
|
2881
|
-
activeVariations: (e) =>
|
|
2882
|
-
allVariantsByName: (e) =>
|
|
2883
|
-
slugsMap: (e, n) =>
|
|
3119
|
+
const mi = {
|
|
3120
|
+
activeVariations: (e) => qe(e.variations),
|
|
3121
|
+
allVariantsByName: (e) => di(e.isVariantOf.skuSpecifications),
|
|
3122
|
+
slugsMap: (e, n) => li(
|
|
2884
3123
|
e.isVariantOf.items,
|
|
2885
3124
|
n.dominantVariantName ?? e.variations[0]?.name,
|
|
2886
3125
|
e.isVariantOf.linkText
|
|
2887
3126
|
),
|
|
2888
3127
|
availableVariations: (e, n) => {
|
|
2889
|
-
const t = n.dominantVariantName ?? e.variations[0]?.name, i =
|
|
2890
|
-
return
|
|
3128
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = qe(e.variations)[t];
|
|
3129
|
+
return gi(
|
|
2891
3130
|
e.isVariantOf.items,
|
|
2892
3131
|
t,
|
|
2893
3132
|
i
|
|
2894
3133
|
);
|
|
2895
3134
|
},
|
|
2896
|
-
allVariantProducts: (e) => e.isVariantOf.items.map((n) =>
|
|
2897
|
-
},
|
|
3135
|
+
allVariantProducts: (e) => e.isVariantOf.items.map((n) => N(n, e.isVariantOf))
|
|
3136
|
+
}, hi = {
|
|
2898
3137
|
"pickup-in-point": "Pickup",
|
|
2899
3138
|
delivery: "Delivery",
|
|
2900
3139
|
pickup: "Pickup",
|
|
2901
3140
|
"take-away": "Take away",
|
|
2902
3141
|
"": ""
|
|
2903
|
-
},
|
|
3142
|
+
}, fi = {
|
|
2904
3143
|
deliveryOptionsData: (e) => {
|
|
2905
3144
|
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
|
|
2906
|
-
(
|
|
2907
|
-
const
|
|
2908
|
-
(_) => _?.addressId ===
|
|
2909
|
-
),
|
|
2910
|
-
|
|
2911
|
-
),
|
|
2912
|
-
return
|
|
3145
|
+
(l, p) => {
|
|
3146
|
+
const u = p?.selectedSla || "", h = p?.selectedDeliveryChannel || p?.deliveryChannel || "", S = p?.deliveryCompany || "", b = p?.deliveryWindow, d = p?.pickupStoreInfo, g = p?.shippingEstimate || "", m = p?.shippingEstimate ? In(p?.shippingEstimate) : "", y = p?.shippingEstimateDate || "", C = p?.addressId || "", w = p?.itemIndex ?? 0, v = t?.[w], P = v?.seller || "", f = `${u}|${h}|${S}|${P}|${g}|${y}|${C}|${b?.startDateUtc}|${b?.endDateUtc}`, D = i?.find(
|
|
3147
|
+
(_) => _?.addressId === C
|
|
3148
|
+
), A = `${hi[h] || ""} ${m} ${D?.neighborhood ? `to ${D?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: U, taxPriceTags: O } = Si(
|
|
3149
|
+
v?.priceTags ?? []
|
|
3150
|
+
), E = (v?.sellingPrice ?? 0) * (v?.quantity ?? 0) + (v?.tax ?? 0) + (U ?? 0);
|
|
3151
|
+
return l[f] || (l[f] = {
|
|
2913
3152
|
// static fields
|
|
2914
|
-
selectedSla:
|
|
2915
|
-
deliveryChannel:
|
|
2916
|
-
deliveryCompany:
|
|
2917
|
-
deliveryWindow:
|
|
2918
|
-
shippingEstimate:
|
|
2919
|
-
shippingEstimateDate:
|
|
3153
|
+
selectedSla: u,
|
|
3154
|
+
deliveryChannel: h,
|
|
3155
|
+
deliveryCompany: S,
|
|
3156
|
+
deliveryWindow: b,
|
|
3157
|
+
shippingEstimate: g,
|
|
3158
|
+
shippingEstimateDate: y,
|
|
2920
3159
|
seller: P,
|
|
2921
|
-
friendlyShippingEstimate:
|
|
2922
|
-
friendlyDeliveryOptionName:
|
|
2923
|
-
address:
|
|
2924
|
-
pickupStoreInfo:
|
|
3160
|
+
friendlyShippingEstimate: m,
|
|
3161
|
+
friendlyDeliveryOptionName: A,
|
|
3162
|
+
address: D,
|
|
3163
|
+
pickupStoreInfo: d,
|
|
2925
3164
|
// dynamic fields
|
|
2926
3165
|
quantityOfDifferentItems: 0,
|
|
2927
3166
|
total: 0,
|
|
2928
3167
|
items: []
|
|
2929
|
-
}),
|
|
2930
|
-
id:
|
|
2931
|
-
uniqueId:
|
|
2932
|
-
name:
|
|
2933
|
-
quantity:
|
|
2934
|
-
price:
|
|
2935
|
-
sellingPrice:
|
|
2936
|
-
imageUrl:
|
|
2937
|
-
taxPriceTags:
|
|
2938
|
-
taxPriceTagsTotal:
|
|
2939
|
-
tax:
|
|
2940
|
-
total:
|
|
2941
|
-
}),
|
|
3168
|
+
}), l[f] && (l[f].items?.push({
|
|
3169
|
+
id: v?.id || "",
|
|
3170
|
+
uniqueId: v?.uniqueId || "",
|
|
3171
|
+
name: v?.name || "",
|
|
3172
|
+
quantity: v?.quantity || 0,
|
|
3173
|
+
price: v?.price || 0,
|
|
3174
|
+
sellingPrice: v?.sellingPrice || 0,
|
|
3175
|
+
imageUrl: v?.imageUrl || "",
|
|
3176
|
+
taxPriceTags: O ?? [],
|
|
3177
|
+
taxPriceTagsTotal: U ?? 0,
|
|
3178
|
+
tax: v?.tax || 0,
|
|
3179
|
+
total: E
|
|
3180
|
+
}), l[f].quantityOfDifferentItems = (l[f].quantityOfDifferentItems ?? 0) + 1, l[f].total = (l[f].total ?? 0) + E), l;
|
|
2942
3181
|
},
|
|
2943
3182
|
{}
|
|
2944
|
-
), o = Object.values(a), s = n?.contactInformation?.[0],
|
|
3183
|
+
), o = Object.values(a), s = n?.contactInformation?.[0], c = {
|
|
2945
3184
|
name: `${s?.firstName ?? ""} ${s?.lastName ?? ""}`.trim() || o?.[0]?.address?.receiverName || "",
|
|
2946
3185
|
email: s?.email || "",
|
|
2947
3186
|
phone: s?.phone || ""
|
|
2948
3187
|
};
|
|
2949
3188
|
return {
|
|
2950
3189
|
deliveryOptions: o,
|
|
2951
|
-
contact:
|
|
3190
|
+
contact: c
|
|
2952
3191
|
};
|
|
2953
3192
|
},
|
|
2954
3193
|
customFields: (e) => {
|
|
@@ -2964,7 +3203,7 @@ const Zr = {
|
|
|
2964
3203
|
) || [];
|
|
2965
3204
|
}
|
|
2966
3205
|
};
|
|
2967
|
-
function
|
|
3206
|
+
function Si(e) {
|
|
2968
3207
|
const t = e.filter(
|
|
2969
3208
|
(i) => i?.name?.includes("TAX")
|
|
2970
3209
|
), r = t.reduce(
|
|
@@ -2976,28 +3215,28 @@ function ti(e) {
|
|
|
2976
3215
|
taxPriceTagsTotal: r
|
|
2977
3216
|
};
|
|
2978
3217
|
}
|
|
2979
|
-
const
|
|
3218
|
+
const yi = {
|
|
2980
3219
|
StoreCollection: tn,
|
|
2981
|
-
StoreAggregateOffer:
|
|
2982
|
-
StoreProduct:
|
|
2983
|
-
StoreSeo:
|
|
2984
|
-
StoreFacet:
|
|
2985
|
-
StoreFacetBoolean:
|
|
2986
|
-
StoreFacetRange:
|
|
2987
|
-
StoreFacetValueBoolean:
|
|
2988
|
-
StoreOffer:
|
|
2989
|
-
StoreAggregateRating:
|
|
2990
|
-
StoreReview:
|
|
2991
|
-
StoreProductGroup:
|
|
2992
|
-
StoreSearchResult:
|
|
2993
|
-
StorePropertyValue:
|
|
2994
|
-
SkuVariants:
|
|
2995
|
-
ShippingSLA:
|
|
2996
|
-
UserOrderResult:
|
|
2997
|
-
ObjectOrString:
|
|
2998
|
-
Query:
|
|
2999
|
-
Mutation:
|
|
3000
|
-
},
|
|
3220
|
+
StoreAggregateOffer: qt,
|
|
3221
|
+
StoreProduct: qr,
|
|
3222
|
+
StoreSeo: ii,
|
|
3223
|
+
StoreFacet: Kt,
|
|
3224
|
+
StoreFacetBoolean: Zt,
|
|
3225
|
+
StoreFacetRange: er,
|
|
3226
|
+
StoreFacetValueBoolean: nr,
|
|
3227
|
+
StoreOffer: Br,
|
|
3228
|
+
StoreAggregateRating: jt,
|
|
3229
|
+
StoreReview: ni,
|
|
3230
|
+
StoreProductGroup: Wr,
|
|
3231
|
+
StoreSearchResult: ri,
|
|
3232
|
+
StorePropertyValue: Gr,
|
|
3233
|
+
SkuVariants: mi,
|
|
3234
|
+
ShippingSLA: ci,
|
|
3235
|
+
UserOrderResult: fi,
|
|
3236
|
+
ObjectOrString: Nr,
|
|
3237
|
+
Query: ei,
|
|
3238
|
+
Mutation: Rr
|
|
3239
|
+
}, Ii = () => yi, vi = `"""
|
|
3001
3240
|
Address information.
|
|
3002
3241
|
"""
|
|
3003
3242
|
type Address {
|
|
@@ -3042,7 +3281,7 @@ type Address {
|
|
|
3042
3281
|
"""
|
|
3043
3282
|
geoCoordinates: [Float]
|
|
3044
3283
|
}
|
|
3045
|
-
`,
|
|
3284
|
+
`, Oi = `"""
|
|
3046
3285
|
Advertisement information about a specific product in a campaign
|
|
3047
3286
|
"""
|
|
3048
3287
|
type Advertisement {
|
|
@@ -3067,7 +3306,7 @@ type Advertisement {
|
|
|
3067
3306
|
"""
|
|
3068
3307
|
adResponseId: String!
|
|
3069
3308
|
}
|
|
3070
|
-
`,
|
|
3309
|
+
`, Ci = `"""
|
|
3071
3310
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
3072
3311
|
"""
|
|
3073
3312
|
type StoreAggregateOffer {
|
|
@@ -3096,7 +3335,7 @@ type StoreAggregateOffer {
|
|
|
3096
3335
|
"""
|
|
3097
3336
|
offers: [StoreOffer!]!
|
|
3098
3337
|
}
|
|
3099
|
-
`,
|
|
3338
|
+
`, bi = `"""
|
|
3100
3339
|
Average rating, based on multiple ratings or reviews.
|
|
3101
3340
|
"""
|
|
3102
3341
|
type StoreAggregateRating {
|
|
@@ -3109,7 +3348,7 @@ type StoreAggregateRating {
|
|
|
3109
3348
|
"""
|
|
3110
3349
|
reviewCount: Int!
|
|
3111
3350
|
}
|
|
3112
|
-
`,
|
|
3351
|
+
`, wi = `"""
|
|
3113
3352
|
information about the author of a product review or rating.
|
|
3114
3353
|
"""
|
|
3115
3354
|
type StoreAuthor {
|
|
@@ -3118,7 +3357,7 @@ type StoreAuthor {
|
|
|
3118
3357
|
"""
|
|
3119
3358
|
name: String!
|
|
3120
3359
|
}
|
|
3121
|
-
`,
|
|
3360
|
+
`, Di = `"""
|
|
3122
3361
|
Brand of a given product.
|
|
3123
3362
|
"""
|
|
3124
3363
|
type StoreBrand {
|
|
@@ -3127,7 +3366,7 @@ type StoreBrand {
|
|
|
3127
3366
|
"""
|
|
3128
3367
|
name: String!
|
|
3129
3368
|
}
|
|
3130
|
-
`,
|
|
3369
|
+
`, Ai = `"""
|
|
3131
3370
|
Item of a list.
|
|
3132
3371
|
"""
|
|
3133
3372
|
type StoreListItem {
|
|
@@ -3158,7 +3397,7 @@ type StoreBreadcrumbList {
|
|
|
3158
3397
|
"""
|
|
3159
3398
|
numberOfItems: Int!
|
|
3160
3399
|
}
|
|
3161
|
-
`,
|
|
3400
|
+
`, Pi = `"""
|
|
3162
3401
|
Shopping cart message.
|
|
3163
3402
|
"""
|
|
3164
3403
|
type StoreCartMessage {
|
|
@@ -3195,7 +3434,7 @@ input IStoreCart {
|
|
|
3195
3434
|
"""
|
|
3196
3435
|
order: IStoreOrder!
|
|
3197
3436
|
}
|
|
3198
|
-
`,
|
|
3437
|
+
`, Ui = `"""
|
|
3199
3438
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\`, \`Cluster\`, \`SubCategory\` or \`Collection\`.
|
|
3200
3439
|
"""
|
|
3201
3440
|
enum StoreCollectionType {
|
|
@@ -3278,7 +3517,7 @@ type StoreCollection {
|
|
|
3278
3517
|
"""
|
|
3279
3518
|
type: StoreCollectionType!
|
|
3280
3519
|
}
|
|
3281
|
-
`,
|
|
3520
|
+
`, Ei = `"""
|
|
3282
3521
|
Delivery Promise badge.
|
|
3283
3522
|
"""
|
|
3284
3523
|
type DeliveryPromiseBadge {
|
|
@@ -3287,7 +3526,7 @@ type DeliveryPromiseBadge {
|
|
|
3287
3526
|
"""
|
|
3288
3527
|
typeName: String
|
|
3289
3528
|
}
|
|
3290
|
-
`,
|
|
3529
|
+
`, _i = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
3291
3530
|
|
|
3292
3531
|
"""
|
|
3293
3532
|
Search facet range information.
|
|
@@ -3364,7 +3603,7 @@ type StoreFacetValueBoolean {
|
|
|
3364
3603
|
"""
|
|
3365
3604
|
quantity: Int
|
|
3366
3605
|
}
|
|
3367
|
-
`,
|
|
3606
|
+
`, Ti = `"""
|
|
3368
3607
|
Image.
|
|
3369
3608
|
"""
|
|
3370
3609
|
type StoreImage {
|
|
@@ -3391,7 +3630,7 @@ input IStoreImage {
|
|
|
3391
3630
|
"""
|
|
3392
3631
|
alternateName: String!
|
|
3393
3632
|
}
|
|
3394
|
-
`,
|
|
3633
|
+
`, Ri = `type Mutation {
|
|
3395
3634
|
"""
|
|
3396
3635
|
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\`.
|
|
3397
3636
|
"""
|
|
@@ -3428,8 +3667,12 @@ input IStoreImage {
|
|
|
3428
3667
|
startOrderEntryOperation(
|
|
3429
3668
|
data: IOrderEntryOperation!
|
|
3430
3669
|
): StoreOrderEntryOperationResult @auth
|
|
3670
|
+
"""
|
|
3671
|
+
Starts an anonymous personalization session for the current shopper.
|
|
3672
|
+
"""
|
|
3673
|
+
startRecommendationSession: Boolean!
|
|
3431
3674
|
}
|
|
3432
|
-
`,
|
|
3675
|
+
`, ki = `"""
|
|
3433
3676
|
Newsletter information.
|
|
3434
3677
|
"""
|
|
3435
3678
|
type PersonNewsletter {
|
|
@@ -3452,8 +3695,8 @@ input IPersonNewsletter {
|
|
|
3452
3695
|
"""
|
|
3453
3696
|
email: String!
|
|
3454
3697
|
}
|
|
3455
|
-
`,
|
|
3456
|
-
`,
|
|
3698
|
+
`, Fi = `scalar ObjectOrString
|
|
3699
|
+
`, Ni = `"""
|
|
3457
3700
|
Offer information.
|
|
3458
3701
|
"""
|
|
3459
3702
|
type StoreOffer {
|
|
@@ -3536,7 +3779,7 @@ input IStoreOffer {
|
|
|
3536
3779
|
"""
|
|
3537
3780
|
quantity: Int!
|
|
3538
3781
|
}
|
|
3539
|
-
`,
|
|
3782
|
+
`, Bi = `"""
|
|
3540
3783
|
Information of a specific order.
|
|
3541
3784
|
"""
|
|
3542
3785
|
type StoreOrder {
|
|
@@ -3571,7 +3814,7 @@ input IStoreOrder {
|
|
|
3571
3814
|
"""
|
|
3572
3815
|
shouldSplitItem: Boolean
|
|
3573
3816
|
}
|
|
3574
|
-
`,
|
|
3817
|
+
`, Li = `"""
|
|
3575
3818
|
Commercial Authorization response.
|
|
3576
3819
|
"""
|
|
3577
3820
|
type CommercialAuthorizationResponse {
|
|
@@ -3970,7 +4213,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
3970
4213
|
"""
|
|
3971
4214
|
rule: CommercialAuthorizationRule!
|
|
3972
4215
|
}
|
|
3973
|
-
`,
|
|
4216
|
+
`, Mi = `"""
|
|
3974
4217
|
Input for uploading a file to the Order Entry Service.
|
|
3975
4218
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
3976
4219
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -4031,7 +4274,7 @@ type StoreOrderFormCartItem {
|
|
|
4031
4274
|
seller: String!
|
|
4032
4275
|
unitMultiplier: Float
|
|
4033
4276
|
}
|
|
4034
|
-
`,
|
|
4277
|
+
`, $i = `"""
|
|
4035
4278
|
Organization.
|
|
4036
4279
|
"""
|
|
4037
4280
|
type StoreOrganization {
|
|
@@ -4050,7 +4293,25 @@ input IStoreOrganization {
|
|
|
4050
4293
|
"""
|
|
4051
4294
|
identifier: String!
|
|
4052
4295
|
}
|
|
4053
|
-
|
|
4296
|
+
|
|
4297
|
+
"""
|
|
4298
|
+
A commercial contract available to a buyer's Organization Unit.
|
|
4299
|
+
"""
|
|
4300
|
+
type StoreContract {
|
|
4301
|
+
"""
|
|
4302
|
+
Contract identifier (the contract/scope ID associated with the Organization Unit).
|
|
4303
|
+
"""
|
|
4304
|
+
id: ID!
|
|
4305
|
+
"""
|
|
4306
|
+
Human-readable corporate name of the contract (resolved from MasterData).
|
|
4307
|
+
"""
|
|
4308
|
+
corporateName: String!
|
|
4309
|
+
"""
|
|
4310
|
+
Indicates whether this contract is the one currently active in the session.
|
|
4311
|
+
"""
|
|
4312
|
+
isActive: Boolean!
|
|
4313
|
+
}
|
|
4314
|
+
`, zi = `"""
|
|
4054
4315
|
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.
|
|
4055
4316
|
"""
|
|
4056
4317
|
type StorePageInfo {
|
|
@@ -4075,7 +4336,7 @@ type StorePageInfo {
|
|
|
4075
4336
|
"""
|
|
4076
4337
|
totalCount: Int!
|
|
4077
4338
|
}
|
|
4078
|
-
`,
|
|
4339
|
+
`, xi = `"""
|
|
4079
4340
|
Input type for setting a new password.
|
|
4080
4341
|
"""
|
|
4081
4342
|
input ISetPassword {
|
|
@@ -4118,7 +4379,7 @@ type SetPasswordResponse {
|
|
|
4118
4379
|
"""
|
|
4119
4380
|
message: String
|
|
4120
4381
|
}
|
|
4121
|
-
`,
|
|
4382
|
+
`, Vi = `"""
|
|
4122
4383
|
Client profile data.
|
|
4123
4384
|
"""
|
|
4124
4385
|
type StorePerson {
|
|
@@ -4161,7 +4422,7 @@ input IStorePerson {
|
|
|
4161
4422
|
"""
|
|
4162
4423
|
familyName: String!
|
|
4163
4424
|
}
|
|
4164
|
-
`,
|
|
4425
|
+
`, qi = `type PickupPointAddress {
|
|
4165
4426
|
"""
|
|
4166
4427
|
Address city.
|
|
4167
4428
|
"""
|
|
@@ -4240,7 +4501,7 @@ type PickupPoints {
|
|
|
4240
4501
|
"""
|
|
4241
4502
|
pickupPointsHash: String
|
|
4242
4503
|
}
|
|
4243
|
-
`,
|
|
4504
|
+
`, ji = `"""
|
|
4244
4505
|
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.
|
|
4245
4506
|
"""
|
|
4246
4507
|
type StoreProduct {
|
|
@@ -4389,7 +4650,7 @@ input IStoreProduct {
|
|
|
4389
4650
|
"""
|
|
4390
4651
|
additionalProperty: [IStorePropertyValue!]
|
|
4391
4652
|
}
|
|
4392
|
-
`,
|
|
4653
|
+
`, Wi = `"""
|
|
4393
4654
|
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.
|
|
4394
4655
|
"""
|
|
4395
4656
|
type StoreProductGroup {
|
|
@@ -4416,7 +4677,7 @@ type StoreProductGroup {
|
|
|
4416
4677
|
"""
|
|
4417
4678
|
skuVariants: SkuVariants
|
|
4418
4679
|
}
|
|
4419
|
-
`,
|
|
4680
|
+
`, Gi = `type Profile {
|
|
4420
4681
|
"""
|
|
4421
4682
|
Collection of user's address
|
|
4422
4683
|
"""
|
|
@@ -4477,7 +4738,7 @@ type ProfileAddress {
|
|
|
4477
4738
|
"""
|
|
4478
4739
|
geoCoordinate: [Float]
|
|
4479
4740
|
}
|
|
4480
|
-
`,
|
|
4741
|
+
`, Hi = `"""
|
|
4481
4742
|
Properties that can be associated with products and products groups.
|
|
4482
4743
|
"""
|
|
4483
4744
|
type StorePropertyValue {
|
|
@@ -4517,7 +4778,7 @@ input IStorePropertyValue {
|
|
|
4517
4778
|
"""
|
|
4518
4779
|
valueReference: ObjectOrString!
|
|
4519
4780
|
}
|
|
4520
|
-
`,
|
|
4781
|
+
`, Xi = `"""
|
|
4521
4782
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
4522
4783
|
"""
|
|
4523
4784
|
type StoreProductEdge {
|
|
@@ -4949,6 +5210,46 @@ type Query {
|
|
|
4949
5210
|
@auth
|
|
4950
5211
|
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
4951
5212
|
|
|
5213
|
+
"""
|
|
5214
|
+
Returns the list of Quotes that the authenticated Buyer can view.
|
|
5215
|
+
"""
|
|
5216
|
+
listUserQuotes(
|
|
5217
|
+
"""
|
|
5218
|
+
Page number (1-based).
|
|
5219
|
+
"""
|
|
5220
|
+
page: Int
|
|
5221
|
+
"""
|
|
5222
|
+
Number of items per page.
|
|
5223
|
+
"""
|
|
5224
|
+
perPage: Int
|
|
5225
|
+
"""
|
|
5226
|
+
Filter by quote status values.
|
|
5227
|
+
"""
|
|
5228
|
+
status: [String]
|
|
5229
|
+
"""
|
|
5230
|
+
Filter quotes created on or after this ISO 8601 date-time.
|
|
5231
|
+
"""
|
|
5232
|
+
createdAtFrom: String
|
|
5233
|
+
"""
|
|
5234
|
+
Filter quotes created on or before this ISO 8601 date-time.
|
|
5235
|
+
"""
|
|
5236
|
+
createdAtTo: String
|
|
5237
|
+
"""
|
|
5238
|
+
Filter quotes expiring on or after this ISO 8601 date-time.
|
|
5239
|
+
"""
|
|
5240
|
+
expiresAtFrom: String
|
|
5241
|
+
"""
|
|
5242
|
+
Filter quotes expiring on or before this ISO 8601 date-time.
|
|
5243
|
+
"""
|
|
5244
|
+
expiresAtTo: String
|
|
5245
|
+
"""
|
|
5246
|
+
Filter quotes by label (partial match).
|
|
5247
|
+
"""
|
|
5248
|
+
label: String
|
|
5249
|
+
): UserQuoteListResult
|
|
5250
|
+
@auth
|
|
5251
|
+
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
5252
|
+
|
|
4952
5253
|
"""
|
|
4953
5254
|
Returns information about the current user details.
|
|
4954
5255
|
"""
|
|
@@ -4970,6 +5271,25 @@ type Query {
|
|
|
4970
5271
|
@auth
|
|
4971
5272
|
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
4972
5273
|
|
|
5274
|
+
"""
|
|
5275
|
+
Lists the commercial contracts associated with the given Organization Unit,
|
|
5276
|
+
resolved to human-readable corporate names. Governed: only contracts associated
|
|
5277
|
+
with the authenticated buyer's Organization Unit are returned.
|
|
5278
|
+
"""
|
|
5279
|
+
availableContracts(
|
|
5280
|
+
"""
|
|
5281
|
+
The Organization Unit identifier whose contracts will be listed.
|
|
5282
|
+
"""
|
|
5283
|
+
orgUnitId: String!
|
|
5284
|
+
): [StoreContract!]! @auth @cacheControl(scope: "private", sMaxAge: 0)
|
|
5285
|
+
|
|
5286
|
+
"""
|
|
5287
|
+
Returns whether the current authenticated user belongs to a B2B organization unit.
|
|
5288
|
+
"""
|
|
5289
|
+
isOrganizationMember: Boolean!
|
|
5290
|
+
@auth
|
|
5291
|
+
@cacheControl(scope: "private", sMaxAge: 300, staleWhileRevalidate: 3600)
|
|
5292
|
+
|
|
4973
5293
|
"""
|
|
4974
5294
|
Returns a list of pickup points near to the given geo coordinates.
|
|
4975
5295
|
"""
|
|
@@ -4989,6 +5309,15 @@ type Query {
|
|
|
4989
5309
|
Returns the items in an orderForm by its ID.
|
|
4990
5310
|
"""
|
|
4991
5311
|
orderFormItems(orderFormId: String!): [StoreOrderFormCartItem!]! @auth
|
|
5312
|
+
"""
|
|
5313
|
+
Returns personalized product recommendations for a given campaign.
|
|
5314
|
+
"""
|
|
5315
|
+
recommendations(
|
|
5316
|
+
campaignVrn: String!
|
|
5317
|
+
userId: String
|
|
5318
|
+
products: [String!]
|
|
5319
|
+
): RecommendationResponse!
|
|
5320
|
+
@cacheControl(scope: "private", sMaxAge: 120, staleWhileRevalidate: 3600)
|
|
4992
5321
|
}
|
|
4993
5322
|
|
|
4994
5323
|
type ValidateUserData {
|
|
@@ -5079,7 +5408,83 @@ type StoreAccountProfile {
|
|
|
5079
5408
|
email: String
|
|
5080
5409
|
id: String
|
|
5081
5410
|
}
|
|
5082
|
-
`,
|
|
5411
|
+
`, Yi = `"""
|
|
5412
|
+
Summary of a quote returned in list results.
|
|
5413
|
+
"""
|
|
5414
|
+
type UserQuoteSummary {
|
|
5415
|
+
"""
|
|
5416
|
+
Unique identifier of the quote.
|
|
5417
|
+
"""
|
|
5418
|
+
id: String!
|
|
5419
|
+
"""
|
|
5420
|
+
Status of the quote.
|
|
5421
|
+
"""
|
|
5422
|
+
status: String!
|
|
5423
|
+
"""
|
|
5424
|
+
Optional label assigned to the quote.
|
|
5425
|
+
"""
|
|
5426
|
+
label: String
|
|
5427
|
+
"""
|
|
5428
|
+
ISO 8601 date-time when the quote was created.
|
|
5429
|
+
"""
|
|
5430
|
+
createdAt: String!
|
|
5431
|
+
"""
|
|
5432
|
+
ISO 8601 date-time when the quote expires.
|
|
5433
|
+
"""
|
|
5434
|
+
expiresAt: String!
|
|
5435
|
+
"""
|
|
5436
|
+
Total amount of the quote.
|
|
5437
|
+
"""
|
|
5438
|
+
amount: Float!
|
|
5439
|
+
"""
|
|
5440
|
+
Name or email of the user who created the quote.
|
|
5441
|
+
"""
|
|
5442
|
+
createdBy: String
|
|
5443
|
+
}
|
|
5444
|
+
|
|
5445
|
+
"""
|
|
5446
|
+
Result returned by the listUserQuotes query.
|
|
5447
|
+
"""
|
|
5448
|
+
type UserQuoteListResult {
|
|
5449
|
+
"""
|
|
5450
|
+
Array of quote summaries for the current page.
|
|
5451
|
+
"""
|
|
5452
|
+
list: [UserQuoteSummary!]!
|
|
5453
|
+
"""
|
|
5454
|
+
Pagination information.
|
|
5455
|
+
"""
|
|
5456
|
+
paging: UserQuoteListPaging!
|
|
5457
|
+
}
|
|
5458
|
+
|
|
5459
|
+
"""
|
|
5460
|
+
Pagination metadata for the quotes list.
|
|
5461
|
+
"""
|
|
5462
|
+
type UserQuoteListPaging {
|
|
5463
|
+
"""
|
|
5464
|
+
Total number of quotes matching the query.
|
|
5465
|
+
"""
|
|
5466
|
+
total: Int!
|
|
5467
|
+
"""
|
|
5468
|
+
Current page number (1-based).
|
|
5469
|
+
"""
|
|
5470
|
+
currentPage: Int!
|
|
5471
|
+
"""
|
|
5472
|
+
Number of items per page.
|
|
5473
|
+
"""
|
|
5474
|
+
perPage: Int!
|
|
5475
|
+
}
|
|
5476
|
+
`, Ji = `type RecommendationResponse {
|
|
5477
|
+
products: [StoreProduct!]!
|
|
5478
|
+
correlationId: String!
|
|
5479
|
+
campaign: RecommendationCampaign!
|
|
5480
|
+
}
|
|
5481
|
+
|
|
5482
|
+
type RecommendationCampaign {
|
|
5483
|
+
id: String!
|
|
5484
|
+
title: String
|
|
5485
|
+
type: String!
|
|
5486
|
+
}
|
|
5487
|
+
`, Qi = `"""
|
|
5083
5488
|
Information of a given review rating.
|
|
5084
5489
|
"""
|
|
5085
5490
|
type StoreReviewRating {
|
|
@@ -5106,7 +5511,7 @@ type StoreReview {
|
|
|
5106
5511
|
"""
|
|
5107
5512
|
author: StoreAuthor!
|
|
5108
5513
|
}
|
|
5109
|
-
`,
|
|
5514
|
+
`, Ki = `"""
|
|
5110
5515
|
Search Engine Optimization (SEO) tags data.
|
|
5111
5516
|
"""
|
|
5112
5517
|
type StoreSeo {
|
|
@@ -5127,7 +5532,7 @@ type StoreSeo {
|
|
|
5127
5532
|
"""
|
|
5128
5533
|
canonical: String!
|
|
5129
5534
|
}
|
|
5130
|
-
`,
|
|
5535
|
+
`, Zi = `"""
|
|
5131
5536
|
Currency information.
|
|
5132
5537
|
"""
|
|
5133
5538
|
type StoreCurrency {
|
|
@@ -5402,7 +5807,7 @@ input IStoreSession {
|
|
|
5402
5807
|
"""
|
|
5403
5808
|
refreshAfter: String
|
|
5404
5809
|
}
|
|
5405
|
-
`,
|
|
5810
|
+
`, ea = `"""
|
|
5406
5811
|
Shipping Simulation item input.
|
|
5407
5812
|
"""
|
|
5408
5813
|
input IShippingItem {
|
|
@@ -5733,7 +6138,7 @@ type MessageFields {
|
|
|
5733
6138
|
"""
|
|
5734
6139
|
skuName: String
|
|
5735
6140
|
}
|
|
5736
|
-
`,
|
|
6141
|
+
`, na = `type SkuVariants {
|
|
5737
6142
|
"""
|
|
5738
6143
|
SKU property values for the current SKU.
|
|
5739
6144
|
"""
|
|
@@ -5828,7 +6233,7 @@ Example:
|
|
|
5828
6233
|
\`\`\`
|
|
5829
6234
|
"""
|
|
5830
6235
|
scalar FormattedVariants
|
|
5831
|
-
`,
|
|
6236
|
+
`, ta = `"""
|
|
5832
6237
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
5833
6238
|
"""
|
|
5834
6239
|
enum StoreStatus {
|
|
@@ -5836,7 +6241,7 @@ enum StoreStatus {
|
|
|
5836
6241
|
WARNING
|
|
5837
6242
|
ERROR
|
|
5838
6243
|
}
|
|
5839
|
-
`,
|
|
6244
|
+
`, ra = `scalar JSONObject
|
|
5840
6245
|
|
|
5841
6246
|
type UserOrder {
|
|
5842
6247
|
orderId: String
|
|
@@ -6660,95 +7065,97 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
6660
7065
|
type: String
|
|
6661
7066
|
id: String
|
|
6662
7067
|
}
|
|
6663
|
-
`,
|
|
6664
|
-
"./address.graphql":
|
|
6665
|
-
"./advertisement.graphql":
|
|
6666
|
-
"./aggregateOffer.graphql":
|
|
6667
|
-
"./aggregateRating.graphql":
|
|
6668
|
-
"./author.graphql":
|
|
6669
|
-
"./brand.graphql":
|
|
6670
|
-
"./breadcrumb.graphql":
|
|
6671
|
-
"./cart.graphql":
|
|
6672
|
-
"./collection.graphql":
|
|
6673
|
-
"./deliveryPromisesBadge.graphql":
|
|
6674
|
-
"./facet.graphql":
|
|
6675
|
-
"./image.graphql":
|
|
6676
|
-
"./mutation.graphql":
|
|
6677
|
-
"./newsletter.graphql":
|
|
6678
|
-
"./objectOrString.graphql":
|
|
6679
|
-
"./offer.graphql":
|
|
6680
|
-
"./order.graphql":
|
|
6681
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
6682
|
-
"./orderEntry.graphql":
|
|
6683
|
-
"./organization.graphql":
|
|
6684
|
-
"./pageInfo.graphql":
|
|
6685
|
-
"./password.graphql":
|
|
6686
|
-
"./person.graphql":
|
|
6687
|
-
"./pickupPoints.graphql":
|
|
6688
|
-
"./product.graphql":
|
|
6689
|
-
"./productGroup.graphql":
|
|
6690
|
-
"./profile.graphql":
|
|
6691
|
-
"./propertyValue.graphql":
|
|
6692
|
-
"./query.graphql":
|
|
6693
|
-
"./
|
|
6694
|
-
"./
|
|
6695
|
-
"./
|
|
6696
|
-
"./
|
|
6697
|
-
"./
|
|
6698
|
-
"./
|
|
6699
|
-
"./
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
7068
|
+
`, ia = /* @__PURE__ */ Object.assign({
|
|
7069
|
+
"./address.graphql": vi,
|
|
7070
|
+
"./advertisement.graphql": Oi,
|
|
7071
|
+
"./aggregateOffer.graphql": Ci,
|
|
7072
|
+
"./aggregateRating.graphql": bi,
|
|
7073
|
+
"./author.graphql": wi,
|
|
7074
|
+
"./brand.graphql": Di,
|
|
7075
|
+
"./breadcrumb.graphql": Ai,
|
|
7076
|
+
"./cart.graphql": Pi,
|
|
7077
|
+
"./collection.graphql": Ui,
|
|
7078
|
+
"./deliveryPromisesBadge.graphql": Ei,
|
|
7079
|
+
"./facet.graphql": _i,
|
|
7080
|
+
"./image.graphql": Ti,
|
|
7081
|
+
"./mutation.graphql": Ri,
|
|
7082
|
+
"./newsletter.graphql": ki,
|
|
7083
|
+
"./objectOrString.graphql": Fi,
|
|
7084
|
+
"./offer.graphql": Ni,
|
|
7085
|
+
"./order.graphql": Bi,
|
|
7086
|
+
"./orderCommercialAuthorizaton.graphql": Li,
|
|
7087
|
+
"./orderEntry.graphql": Mi,
|
|
7088
|
+
"./organization.graphql": $i,
|
|
7089
|
+
"./pageInfo.graphql": zi,
|
|
7090
|
+
"./password.graphql": xi,
|
|
7091
|
+
"./person.graphql": Vi,
|
|
7092
|
+
"./pickupPoints.graphql": qi,
|
|
7093
|
+
"./product.graphql": ji,
|
|
7094
|
+
"./productGroup.graphql": Wi,
|
|
7095
|
+
"./profile.graphql": Gi,
|
|
7096
|
+
"./propertyValue.graphql": Hi,
|
|
7097
|
+
"./query.graphql": Xi,
|
|
7098
|
+
"./quote.graphql": Yi,
|
|
7099
|
+
"./recommendation.graphql": Ji,
|
|
7100
|
+
"./review.graphql": Qi,
|
|
7101
|
+
"./seo.graphql": Ki,
|
|
7102
|
+
"./session.graphql": Zi,
|
|
7103
|
+
"./shipping.graphql": ea,
|
|
7104
|
+
"./skuVariants.graphql": na,
|
|
7105
|
+
"./status.graphql": ta,
|
|
7106
|
+
"./userOrder.graphql": ra
|
|
7107
|
+
}), aa = wn(
|
|
7108
|
+
Object.values(ia).map((e) => Dn(e)).reduce(
|
|
7109
|
+
(e, n) => je([e, n], { sort: !0 })
|
|
6703
7110
|
)
|
|
6704
|
-
),
|
|
6705
|
-
|
|
7111
|
+
), oa = aa, wa = async (e) => B.context.with(
|
|
7112
|
+
B.propagation.extract(B.context.active(), e.OTEL),
|
|
6706
7113
|
() => (n) => (n.storage = {
|
|
6707
|
-
channel:
|
|
7114
|
+
channel: ne.parse(e.channel),
|
|
6708
7115
|
flags: e.flags ?? {},
|
|
6709
7116
|
locale: e.locale,
|
|
6710
7117
|
cookies: /* @__PURE__ */ new Map()
|
|
6711
|
-
}, n.clients =
|
|
7118
|
+
}, n.clients = Et(e, n), n.loaders = $t(e, n), n.account = e.account, n.OTEL = e.OTEL, n.discoveryConfig = e.discoveryConfig, n)
|
|
6712
7119
|
);
|
|
6713
|
-
function
|
|
6714
|
-
const e =
|
|
7120
|
+
function sa() {
|
|
7121
|
+
const e = Ii(), n = {};
|
|
6715
7122
|
for (const [t, r] of Object.entries(e))
|
|
6716
7123
|
n[t] = Object.fromEntries(
|
|
6717
|
-
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i,
|
|
7124
|
+
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, jn(a, `${t}(${i})`)])
|
|
6718
7125
|
);
|
|
6719
7126
|
return n;
|
|
6720
7127
|
}
|
|
6721
|
-
function
|
|
6722
|
-
const t =
|
|
7128
|
+
function Da(e) {
|
|
7129
|
+
const t = qn([
|
|
6723
7130
|
Vn,
|
|
6724
|
-
|
|
6725
|
-
])(
|
|
6726
|
-
return e &&
|
|
7131
|
+
$n
|
|
7132
|
+
])(sa(), oa);
|
|
7133
|
+
return e && An(e) ? Cn({
|
|
6727
7134
|
schemas: [t, e]
|
|
6728
7135
|
}) : t;
|
|
6729
7136
|
}
|
|
6730
7137
|
export {
|
|
6731
|
-
|
|
6732
|
-
|
|
7138
|
+
$n as AuthDirective,
|
|
7139
|
+
T as BadRequestError,
|
|
6733
7140
|
Vn as CacheControlDirective,
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
7141
|
+
_n as CommercialAuthorizationStatus,
|
|
7142
|
+
Q as FastStoreError,
|
|
7143
|
+
Y as ForbiddenError,
|
|
7144
|
+
wa as GraphqlVtexContextFactory,
|
|
7145
|
+
Da as GraphqlVtexSchema,
|
|
7146
|
+
L as NotFoundError,
|
|
6740
7147
|
Tn as StoreCollectionType,
|
|
6741
|
-
|
|
6742
|
-
|
|
7148
|
+
Rn as StoreFacetType,
|
|
7149
|
+
kn as StoreSort,
|
|
6743
7150
|
Fn as StoreStatus,
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
7151
|
+
Z as UnauthorizedError,
|
|
7152
|
+
Nn as UserOrderInvoiceType,
|
|
7153
|
+
Ca as isBadRequestError,
|
|
7154
|
+
Oa as isFastStoreError,
|
|
7155
|
+
Wn as isForbiddenError,
|
|
7156
|
+
Xe as isNotFoundError,
|
|
7157
|
+
ba as isUnauthorizedError,
|
|
7158
|
+
va as stringifyCacheControl,
|
|
7159
|
+
oa as typeDefs,
|
|
7160
|
+
qn as withDirectives
|
|
6754
7161
|
};
|