@faststore/api 4.9.0-dev.7 → 4.9.0-dev.8
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 +46 -46
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +763 -697
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/platforms/vtex/clients/commerce/types/OrderForm.d.ts +14 -0
- package/dist/src/platforms/vtex/clients/commerce/types/OrderForm.d.ts.map +1 -1
- package/dist/src/platforms/vtex/index.d.ts +1 -0
- package/dist/src/platforms/vtex/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/index.d.ts +1 -0
- package/dist/src/platforms/vtex/resolvers/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/mutation.d.ts +1 -0
- package/dist/src/platforms/vtex/resolvers/mutation.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/offer.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/product.d.ts +3 -1
- package/dist/src/platforms/vtex/resolvers/product.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/validateCart.d.ts +1 -0
- package/dist/src/platforms/vtex/resolvers/validateCart.d.ts.map +1 -1
- package/dist/src/platforms/vtex/utils/propertyValue.d.ts +25 -1
- package/dist/src/platforms/vtex/utils/propertyValue.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/platforms/vtex/clients/commerce/types/OrderForm.ts +15 -0
- package/src/platforms/vtex/resolvers/offer.ts +1 -0
- package/src/platforms/vtex/resolvers/product.ts +11 -1
- package/src/platforms/vtex/resolvers/validateCart.ts +49 -7
- package/src/platforms/vtex/utils/propertyValue.ts +130 -1
package/dist/es/index.mjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
4
|
-
import { GraphQLScalarType as
|
|
5
|
-
import { logger as
|
|
6
|
-
import
|
|
7
|
-
import { parse as
|
|
1
|
+
import { mergeTypeDefs as sn } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as xn, mergeSchemas as qn } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as cn, MapperKind as ln, getDirective as dn } from "@graphql-tools/utils";
|
|
4
|
+
import { GraphQLScalarType as jn, print as Wn, parse as Hn, isSchema as Gn } from "graphql";
|
|
5
|
+
import { logger as Xn, OTELAPI as V } from "@faststore/diagnostics";
|
|
6
|
+
import Yn from "isomorphic-unfetch";
|
|
7
|
+
import { parse as Z } from "cookie";
|
|
8
8
|
import De from "p-limit";
|
|
9
9
|
import ue from "dataloader";
|
|
10
|
-
import
|
|
10
|
+
import Jn from "sanitize-html";
|
|
11
11
|
import Ae from "fast-deep-equal";
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const
|
|
12
|
+
import Kn from "node:crypto";
|
|
13
|
+
var Qn = /* @__PURE__ */ ((e) => (e.Personal = "personal", e.Shared = "shared", e))(Qn || {}), Zn = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(Zn || {}), et = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(et || {}), nt = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(nt || {}), tt = /* @__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))(tt || {}), rt = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(rt || {}), it = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(it || {});
|
|
14
|
+
const at = () => 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 K("No authentication AppKey and AppToken passed.");
|
|
18
18
|
return {
|
|
19
19
|
...n,
|
|
20
20
|
"X-VTEX-API-AppKey": t,
|
|
21
21
|
"X-VTEX-API-AppToken": r
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, ot = async (e) => {
|
|
24
24
|
const {
|
|
25
25
|
clients: { commerce: n }
|
|
26
26
|
} = e;
|
|
@@ -29,124 +29,124 @@ const et = () => function(n = {}) {
|
|
|
29
29
|
throw new ie("Authentication required");
|
|
30
30
|
} catch (t) {
|
|
31
31
|
const r = t.extensions?.status ?? t.status;
|
|
32
|
-
throw r === 401 ? new ie("Authentication required") : r === 403 ? new
|
|
32
|
+
throw r === 401 ? new ie("Authentication required") : r === 403 ? new K("You are not allowed to access this resource") : new ie("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, st = "auth", ct = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (e) =>
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
36
|
+
transformer: (e) => cn(e, {
|
|
37
|
+
[ln.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (dn(e, n, st)?.[0]) {
|
|
39
39
|
const r = n.resolve;
|
|
40
|
-
n.resolve = async (i, a, o, s) => (await
|
|
40
|
+
n.resolve = async (i, a, o, s) => (await ot(o), r?.(i, a, o, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, lt = "cacheControl", vo = (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
|
+
}, Te = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, dt = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, ut = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (e) =>
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (e) => cn(e, {
|
|
55
|
+
[ln.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = dn(e, n, lt)?.[0];
|
|
57
57
|
if (t) {
|
|
58
58
|
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
|
|
59
59
|
n.resolve = (s, c, u, d) => (u.cacheControl = {
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
60
|
+
sMaxAge: Te(u.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: Te(
|
|
62
62
|
u.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
65
|
+
scope: dt(u.cacheControl?.scope, a)
|
|
66
66
|
}, o?.(s, c, u, d));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
71
|
+
}, pt = (e) => (n, t) => {
|
|
72
|
+
const r = sn([
|
|
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
|
+
xn({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
},
|
|
84
|
-
name:
|
|
85
|
-
version:
|
|
86
|
-
},
|
|
83
|
+
}, un = "@faststore/api", pn = "4.9.0-dev.7", Ue = {
|
|
84
|
+
name: un,
|
|
85
|
+
version: pn
|
|
86
|
+
}, gt = Xn("@faststore/api"), mt = (e, n = "Unknown Graphql Resolver") => (t, r, i, a) => {
|
|
87
87
|
if (!i?.OTEL_ENABLED)
|
|
88
88
|
return e(t, r, i, a);
|
|
89
|
-
const o =
|
|
90
|
-
kind:
|
|
89
|
+
const o = V.trace.getTracer("Graphql").startSpan(n, {
|
|
90
|
+
kind: V.SpanKind.INTERNAL,
|
|
91
91
|
attributes: {
|
|
92
92
|
timestamp: Date.now(),
|
|
93
|
-
"@faststore_version":
|
|
94
|
-
"@faststore_package_name":
|
|
93
|
+
"@faststore_version": pn,
|
|
94
|
+
"@faststore_package_name": un,
|
|
95
95
|
"@faststore_account_name": i.account,
|
|
96
96
|
"@faststore_environment": process.env.NODE_ENV,
|
|
97
97
|
"@faststore_resolver_parent_type": a?.parentType?.name,
|
|
98
98
|
"@faststore_resolver_field_name": a?.fieldName
|
|
99
99
|
}
|
|
100
|
-
}), s =
|
|
100
|
+
}), s = V.trace.setSpan(V.context.active(), o);
|
|
101
101
|
try {
|
|
102
|
-
const c =
|
|
102
|
+
const c = V.context.with(
|
|
103
103
|
s,
|
|
104
104
|
() => e(t, r, i, a)
|
|
105
105
|
);
|
|
106
106
|
return c instanceof Promise ? c.then(
|
|
107
107
|
(u) => (o.end(), u),
|
|
108
|
-
(u) =>
|
|
108
|
+
(u) => Re(u, o, n)
|
|
109
109
|
) : (o.end(), c);
|
|
110
110
|
} catch (c) {
|
|
111
|
-
return
|
|
111
|
+
return Re(c, o, n);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
function
|
|
115
|
-
throw n.setStatus({ code:
|
|
116
|
-
%o`, e),
|
|
114
|
+
function Re(e, n, t) {
|
|
115
|
+
throw n.setStatus({ code: V.SpanStatusCode.ERROR }), n.recordException(e), n.end(), console.error(`Error at resolver: ${t}:
|
|
116
|
+
%o`, e), gt("error", `Error at resolver: %s
|
|
117
117
|
%o`, t, e), e;
|
|
118
118
|
}
|
|
119
|
-
class
|
|
119
|
+
class ee extends Error {
|
|
120
120
|
constructor(n, t) {
|
|
121
121
|
super(t), this.extensions = n, this.name = "FastStoreError";
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
class
|
|
124
|
+
class _ extends ee {
|
|
125
125
|
constructor(n) {
|
|
126
126
|
super({ status: 400, type: "BadRequestError" }, n);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
class ie extends
|
|
129
|
+
class ie extends ee {
|
|
130
130
|
constructor(n) {
|
|
131
131
|
super({ status: 401, type: "UnauthorizedError" }, n);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
class
|
|
134
|
+
class K extends ee {
|
|
135
135
|
constructor(n) {
|
|
136
136
|
super({ status: 403, type: "ForbiddenError" }, n);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
class $ extends
|
|
139
|
+
class $ extends ee {
|
|
140
140
|
constructor(n) {
|
|
141
141
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
const r = await
|
|
144
|
+
const Oo = (e) => e?.name === "FastStoreError", bo = (e) => e?.extensions?.type === "BadRequestError", Co = (e) => e?.extensions?.type === "UnauthorizedError", ht = (e) => e?.extensions?.type === "ForbiddenError", J = (e) => e?.extensions?.type === "NotFoundError", ft = `${Ue.name}@${Ue.version}`, y = async (e, n, t) => {
|
|
145
|
+
const r = await Yn(e, {
|
|
146
146
|
...n,
|
|
147
147
|
headers: {
|
|
148
148
|
...n?.headers ?? {},
|
|
149
|
-
"User-Agent":
|
|
149
|
+
"User-Agent": ft
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
if (r.ok)
|
|
@@ -156,21 +156,21 @@ const ao = (e) => e?.name === "FastStoreError", oo = (e) => e?.extensions?.type
|
|
|
156
156
|
if (typeof r?.status == "number")
|
|
157
157
|
switch (r.status) {
|
|
158
158
|
case 400:
|
|
159
|
-
throw new
|
|
159
|
+
throw new _(i);
|
|
160
160
|
case 401:
|
|
161
161
|
throw new ie(i);
|
|
162
162
|
case 403:
|
|
163
|
-
throw new
|
|
163
|
+
throw new K(i);
|
|
164
164
|
case 404:
|
|
165
165
|
throw new $(i);
|
|
166
166
|
default:
|
|
167
|
-
throw new
|
|
167
|
+
throw new ee(
|
|
168
168
|
{ status: r.status, type: "UnknownError" },
|
|
169
169
|
i
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
throw new Error(i);
|
|
173
|
-
},
|
|
173
|
+
}, St = ({ account: e, environment: n }) => {
|
|
174
174
|
const t = `https://${e}.${n}.com.br`;
|
|
175
175
|
return {
|
|
176
176
|
getLocalizedProduct: (r, i) => y(`${t}/api/catalog-dataplane/product/${r}`, {
|
|
@@ -181,7 +181,7 @@ const ao = (e) => e?.name === "FastStoreError", oo = (e) => e?.extensions?.type
|
|
|
181
181
|
}
|
|
182
182
|
})
|
|
183
183
|
};
|
|
184
|
-
},
|
|
184
|
+
}, gn = (e) => {
|
|
185
185
|
if (!e)
|
|
186
186
|
return e;
|
|
187
187
|
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
@@ -195,8 +195,8 @@ const ao = (e) => e?.name === "FastStoreError", oo = (e) => e?.extensions?.type
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
198
|
-
},
|
|
199
|
-
const t = n.match(
|
|
198
|
+
}, yt = /^([^=]+)=([^;]*)/, It = (e, n) => {
|
|
199
|
+
const t = n.match(yt);
|
|
200
200
|
if (t) {
|
|
201
201
|
const r = t[1], i = t[2];
|
|
202
202
|
e.storage.cookies.set(r, {
|
|
@@ -204,39 +204,39 @@ const ao = (e) => e?.name === "FastStoreError", oo = (e) => e?.extensions?.type
|
|
|
204
204
|
setCookie: n
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
},
|
|
207
|
+
}, vt = (e, n) => {
|
|
208
208
|
n.getSetCookie().forEach(
|
|
209
|
-
(t) =>
|
|
209
|
+
(t) => It(e, t)
|
|
210
210
|
);
|
|
211
|
-
},
|
|
211
|
+
}, Ot = (e) => (n) => vt(e, n), me = (e) => {
|
|
212
212
|
if (!e.headers?.cookie)
|
|
213
213
|
return null;
|
|
214
|
-
const n =
|
|
214
|
+
const n = gn(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
215
215
|
return t.length === 0 ? n : t.reduce(
|
|
216
|
-
(r, [i, { value: a }]) =>
|
|
216
|
+
(r, [i, { value: a }]) => bt(
|
|
217
217
|
r,
|
|
218
218
|
i,
|
|
219
219
|
a
|
|
220
220
|
),
|
|
221
221
|
n
|
|
222
222
|
);
|
|
223
|
-
},
|
|
223
|
+
}, mn = (e) => function(t) {
|
|
224
224
|
const r = me(e);
|
|
225
225
|
return r ? {
|
|
226
226
|
...t,
|
|
227
227
|
cookie: r
|
|
228
228
|
} : t;
|
|
229
229
|
}, L = (e, n) => {
|
|
230
|
-
const t =
|
|
231
|
-
return
|
|
232
|
-
},
|
|
230
|
+
const t = gn(e);
|
|
231
|
+
return Z(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
232
|
+
}, bt = (e, n, t) => {
|
|
233
233
|
const r = new RegExp(`(${n})=([^;]*)`), i = e.match(r);
|
|
234
234
|
return i ? e.replace(
|
|
235
235
|
i[0],
|
|
236
236
|
`${i[1]}=${t}`
|
|
237
237
|
) : `${e};${n}=${t}`;
|
|
238
238
|
};
|
|
239
|
-
function
|
|
239
|
+
function x(e) {
|
|
240
240
|
if (!e)
|
|
241
241
|
return null;
|
|
242
242
|
try {
|
|
@@ -245,12 +245,12 @@ function V(e) {
|
|
|
245
245
|
return null;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
const
|
|
248
|
+
const Ct = "storefront/faststore.recommendation-shelf@v4", G = {
|
|
249
249
|
method: "POST",
|
|
250
250
|
headers: {
|
|
251
251
|
"content-type": "application/json"
|
|
252
252
|
}
|
|
253
|
-
},
|
|
253
|
+
}, wt = (e) => e.split("/").map(encodeURIComponent).join("/"), pe = (e) => e ? { headers: { "Accept-Language": e } } : void 0, Dt = /^\d{4}-\d{2}-\d{2}$/, At = /* @__PURE__ */ new Set([
|
|
254
254
|
"Draft",
|
|
255
255
|
"Requested",
|
|
256
256
|
"InReview",
|
|
@@ -261,7 +261,7 @@ const yt = "storefront/faststore.recommendation-shelf@v4", H = {
|
|
|
261
261
|
"ConvertedToCart",
|
|
262
262
|
"ConvertedToOrder"
|
|
263
263
|
]);
|
|
264
|
-
function
|
|
264
|
+
function Pt({
|
|
265
265
|
page: e,
|
|
266
266
|
perPage: n,
|
|
267
267
|
status: t,
|
|
@@ -284,19 +284,19 @@ function Ct({
|
|
|
284
284
|
["expiresAtFrom", a],
|
|
285
285
|
["expiresAtTo", o]
|
|
286
286
|
])
|
|
287
|
-
if (c && !
|
|
287
|
+
if (c && !Dt.test(c))
|
|
288
288
|
throw new Error(
|
|
289
289
|
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
290
290
|
);
|
|
291
291
|
if (t && t.length > 0) {
|
|
292
|
-
const s = t.filter((c) => !
|
|
292
|
+
const s = t.filter((c) => !At.has(c));
|
|
293
293
|
if (s.length > 0)
|
|
294
294
|
throw new Error(
|
|
295
295
|
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
296
296
|
);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function Et({
|
|
300
300
|
page: e,
|
|
301
301
|
perPage: n,
|
|
302
302
|
status: t,
|
|
@@ -309,11 +309,11 @@ function bt({
|
|
|
309
309
|
const c = new URLSearchParams();
|
|
310
310
|
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((u) => c.append("status", u)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i), a && c.append("expiresAtFrom", a), o && c.append("expiresAtTo", o), s?.trim() && c.append("label", s.trim()), c;
|
|
311
311
|
}
|
|
312
|
-
const
|
|
313
|
-
const a = `https://${e}.${n}.com.br`, o =
|
|
312
|
+
const _t = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
313
|
+
const a = `https://${e}.${n}.com.br`, o = Ot(i), s = mn(i), c = at(), u = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", d = r && r.map((l) => l + ".").find((l) => u.includes(l)) || "", g = u.replace(d, ""), f = `${a}/api/recommend-bff/v2`, h = s({
|
|
314
314
|
accept: "application/json",
|
|
315
315
|
"content-type": "application/json",
|
|
316
|
-
"x-vtex-rec-origin": `${e}/${
|
|
316
|
+
"x-vtex-rec-origin": `${e}/${Ct}`
|
|
317
317
|
}), v = (l = {}) => {
|
|
318
318
|
const p = L(me(i) ?? "", e);
|
|
319
319
|
return s({
|
|
@@ -355,11 +355,11 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
355
355
|
category: async (l, p) => {
|
|
356
356
|
try {
|
|
357
357
|
return await y(
|
|
358
|
-
`${a}/api/catalog_system/pub/category/by-linkid/${
|
|
358
|
+
`${a}/api/catalog_system/pub/category/by-linkid/${wt(l)}`,
|
|
359
359
|
pe(p)
|
|
360
360
|
);
|
|
361
361
|
} catch (m) {
|
|
362
|
-
if (
|
|
362
|
+
if (J(m)) return null;
|
|
363
363
|
throw m;
|
|
364
364
|
}
|
|
365
365
|
},
|
|
@@ -370,7 +370,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
370
370
|
pe(p)
|
|
371
371
|
);
|
|
372
372
|
} catch (m) {
|
|
373
|
-
if (
|
|
373
|
+
if (J(m)) return null;
|
|
374
374
|
throw m;
|
|
375
375
|
}
|
|
376
376
|
},
|
|
@@ -381,7 +381,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
381
381
|
pe(p)
|
|
382
382
|
);
|
|
383
383
|
} catch (m) {
|
|
384
|
-
if (
|
|
384
|
+
if (J(m)) return null;
|
|
385
385
|
throw m;
|
|
386
386
|
}
|
|
387
387
|
}
|
|
@@ -415,7 +415,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
415
415
|
return y(
|
|
416
416
|
`${a}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
417
417
|
{
|
|
418
|
-
...
|
|
418
|
+
...G,
|
|
419
419
|
headers: S,
|
|
420
420
|
body: JSON.stringify(l)
|
|
421
421
|
},
|
|
@@ -431,7 +431,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
431
431
|
const w = O ? {
|
|
432
432
|
startDateUtc: m?.deliveryWindow?.startDate,
|
|
433
433
|
endDateUtc: m?.deliveryWindow?.endDate
|
|
434
|
-
} : null,
|
|
434
|
+
} : null, C = {
|
|
435
435
|
logisticsInfo: Array.from({ length: p }, (I, D) => ({
|
|
436
436
|
itemIndex: D,
|
|
437
437
|
selectedDeliveryChannel: m?.deliveryChannel || null,
|
|
@@ -440,16 +440,16 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
440
440
|
})),
|
|
441
441
|
selectedAddresses: S,
|
|
442
442
|
clearAddressIfPostalCodeNotFound: t
|
|
443
|
-
},
|
|
443
|
+
}, k = s({
|
|
444
444
|
"content-type": "application/json",
|
|
445
445
|
"X-FORWARDED-HOST": g
|
|
446
446
|
});
|
|
447
447
|
return y(
|
|
448
448
|
`${a}/api/checkout/pub/orderForm/${l}/attachments/shippingData`,
|
|
449
449
|
{
|
|
450
|
-
...
|
|
451
|
-
headers:
|
|
452
|
-
body: JSON.stringify(
|
|
450
|
+
...G,
|
|
451
|
+
headers: k,
|
|
452
|
+
body: JSON.stringify(C)
|
|
453
453
|
},
|
|
454
454
|
{ storeCookies: o }
|
|
455
455
|
);
|
|
@@ -499,13 +499,13 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
499
499
|
const { salesChannel: O } = m, w = s({
|
|
500
500
|
"content-type": "application/json",
|
|
501
501
|
"X-FORWARDED-HOST": g
|
|
502
|
-
}),
|
|
503
|
-
(!S || !l) &&
|
|
504
|
-
const
|
|
502
|
+
}), C = new URLSearchParams();
|
|
503
|
+
(!S || !l) && C.set("sc", O), l && C.set("refreshOutdatedData", p.toString());
|
|
504
|
+
const k = l ? `/${l}` : "", I = `${a}/api/checkout/pub/orderForm${k}?${C}`;
|
|
505
505
|
return y(
|
|
506
506
|
I,
|
|
507
507
|
{
|
|
508
|
-
...
|
|
508
|
+
...G,
|
|
509
509
|
headers: w,
|
|
510
510
|
...l ? {} : { body: "{}" }
|
|
511
511
|
},
|
|
@@ -520,7 +520,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
520
520
|
return y(
|
|
521
521
|
`${a}/api/checkout/pub/orderForm/${l}/messages/clear`,
|
|
522
522
|
{
|
|
523
|
-
...
|
|
523
|
+
...G,
|
|
524
524
|
headers: p,
|
|
525
525
|
body: "{}"
|
|
526
526
|
}
|
|
@@ -536,14 +536,14 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
536
536
|
const w = new URLSearchParams({
|
|
537
537
|
allowOutdatedData: m,
|
|
538
538
|
sc: S
|
|
539
|
-
}),
|
|
539
|
+
}), C = s({
|
|
540
540
|
"content-type": "application/json",
|
|
541
541
|
"X-FORWARDED-HOST": g
|
|
542
542
|
});
|
|
543
543
|
return y(
|
|
544
544
|
`${a}/api/checkout/pub/orderForm/${l}/items?${w}`,
|
|
545
545
|
{
|
|
546
|
-
headers:
|
|
546
|
+
headers: C,
|
|
547
547
|
body: JSON.stringify({
|
|
548
548
|
orderItems: p,
|
|
549
549
|
noSplitItem: !O
|
|
@@ -586,14 +586,14 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
586
586
|
"geoCoordinates",
|
|
587
587
|
`${p?.longitude};${p?.latitude}`
|
|
588
588
|
);
|
|
589
|
-
const w = `${a}/api/checkout/pub/regions/?${O.toString()}`,
|
|
589
|
+
const w = `${a}/api/checkout/pub/regions/?${O.toString()}`, C = s({
|
|
590
590
|
"content-type": "application/json",
|
|
591
591
|
"X-FORWARDED-HOST": g
|
|
592
592
|
});
|
|
593
593
|
return y(
|
|
594
594
|
w,
|
|
595
595
|
{
|
|
596
|
-
headers:
|
|
596
|
+
headers: C
|
|
597
597
|
},
|
|
598
598
|
{ storeCookies: o }
|
|
599
599
|
);
|
|
@@ -666,7 +666,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
666
666
|
);
|
|
667
667
|
const m = s({
|
|
668
668
|
"content-type": "application/json"
|
|
669
|
-
}), S =
|
|
669
|
+
}), S = Z(i?.headers?.cookie ?? "")?.vtex_session;
|
|
670
670
|
return y(
|
|
671
671
|
`${a}/api/sessions?${p.toString()}`,
|
|
672
672
|
{
|
|
@@ -699,7 +699,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
699
699
|
subscribeToNewsletter: (l) => y(
|
|
700
700
|
`${a}/api/dataentities/NL/documents/`,
|
|
701
701
|
{
|
|
702
|
-
...
|
|
702
|
+
...G,
|
|
703
703
|
body: JSON.stringify({ ...l, isNewsletterOptIn: !0 }),
|
|
704
704
|
method: "PATCH"
|
|
705
705
|
},
|
|
@@ -740,8 +740,8 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
740
740
|
dateFinal: S,
|
|
741
741
|
text: O,
|
|
742
742
|
clientEmail: w,
|
|
743
|
-
perPage:
|
|
744
|
-
pendingMyApproval:
|
|
743
|
+
perPage: C,
|
|
744
|
+
pendingMyApproval: k
|
|
745
745
|
}) => {
|
|
746
746
|
const I = new URLSearchParams();
|
|
747
747
|
if (m) {
|
|
@@ -765,7 +765,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
765
765
|
O && I.append("text", O), p && p.length > 0 && I.append("status", p.filter(Boolean).join(",")), m && S ? I.append(
|
|
766
766
|
"creation_date",
|
|
767
767
|
`creationDate:[${m} TO ${S}]`
|
|
768
|
-
) : m ? I.append("creation_date", `creationDate:[${m} TO *]`) : S && I.append("creation_date", `creationDate:[* TO ${S}]`), w && I.append("clientEmail", w), l && I.append("page", l.toString()),
|
|
768
|
+
) : m ? I.append("creation_date", `creationDate:[${m} TO *]`) : S && I.append("creation_date", `creationDate:[* TO ${S}]`), w && I.append("clientEmail", w), l && I.append("page", l.toString()), C && I.append("per_page", C.toString()), k && I.append("my_pending_approvals", String(!0));
|
|
769
769
|
const D = s({
|
|
770
770
|
"content-type": "application/json",
|
|
771
771
|
"X-FORWARDED-HOST": g
|
|
@@ -804,7 +804,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
804
804
|
const O = s({
|
|
805
805
|
"content-type": "application/json",
|
|
806
806
|
"X-FORWARDED-HOST": g
|
|
807
|
-
}),
|
|
807
|
+
}), k = {
|
|
808
808
|
params: {
|
|
809
809
|
ruleId: m,
|
|
810
810
|
dimensionId: p,
|
|
@@ -816,7 +816,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
816
816
|
{
|
|
817
817
|
method: "POST",
|
|
818
818
|
headers: O,
|
|
819
|
-
body: JSON.stringify(
|
|
819
|
+
body: JSON.stringify(k)
|
|
820
820
|
},
|
|
821
821
|
{ storeCookies: o }
|
|
822
822
|
);
|
|
@@ -966,7 +966,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
966
966
|
contractId: l
|
|
967
967
|
}) => {
|
|
968
968
|
if (!l)
|
|
969
|
-
throw new
|
|
969
|
+
throw new _("Missing contractId to fetch CL fields.");
|
|
970
970
|
const p = v({
|
|
971
971
|
Accept: "application/json",
|
|
972
972
|
"content-type": "application/json"
|
|
@@ -984,7 +984,7 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
984
984
|
userId: l
|
|
985
985
|
}) => {
|
|
986
986
|
if (!l)
|
|
987
|
-
throw new
|
|
987
|
+
throw new _("Missing userId to fetch shopper name.");
|
|
988
988
|
const p = c({
|
|
989
989
|
Accept: "application/json",
|
|
990
990
|
"content-type": "application/json",
|
|
@@ -1002,8 +1002,8 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1002
1002
|
},
|
|
1003
1003
|
quotes: {
|
|
1004
1004
|
listUserQuotes: (l) => {
|
|
1005
|
-
|
|
1006
|
-
const p =
|
|
1005
|
+
Pt(l);
|
|
1006
|
+
const p = Et(l), m = s({
|
|
1007
1007
|
"content-type": "application/json",
|
|
1008
1008
|
"X-FORWARDED-HOST": g
|
|
1009
1009
|
});
|
|
@@ -1044,17 +1044,17 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1044
1044
|
"content-type": "application/json",
|
|
1045
1045
|
"X-FORWARDED-HOST": g
|
|
1046
1046
|
}), O = `----FastStoreUploadBoundary${Date.now()}`, w = `\r
|
|
1047
|
-
`,
|
|
1047
|
+
`, k = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", I = p.replaceAll(/[\r\n"]/g, "_"), D = [
|
|
1048
1048
|
`--${O}`,
|
|
1049
1049
|
`Content-Disposition: form-data; name="file"; filename="${I}"`,
|
|
1050
|
-
`Content-Type: ${
|
|
1050
|
+
`Content-Type: ${k}`,
|
|
1051
1051
|
"",
|
|
1052
1052
|
""
|
|
1053
|
-
].join(w), A = `${w}--${O}--${w}`,
|
|
1054
|
-
|
|
1053
|
+
].join(w), A = `${w}--${O}--${w}`, E = Buffer.from(D), P = Buffer.from(A), R = new Uint8Array(
|
|
1054
|
+
E.byteLength + l.byteLength + P.byteLength
|
|
1055
1055
|
);
|
|
1056
|
-
let
|
|
1057
|
-
return R.set(
|
|
1056
|
+
let b = 0;
|
|
1057
|
+
return R.set(E, b), b += E.byteLength, R.set(l, b), b += l.byteLength, R.set(P, b), y(
|
|
1058
1058
|
`${a}/api/order-entry/upload?an=${e}`,
|
|
1059
1059
|
{
|
|
1060
1060
|
method: "POST",
|
|
@@ -1168,27 +1168,27 @@ const wt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1168
1168
|
}
|
|
1169
1169
|
}
|
|
1170
1170
|
};
|
|
1171
|
-
},
|
|
1172
|
-
|
|
1173
|
-
|
|
1171
|
+
}, Q = (e) => e.discoveryConfig?.localization ?? {}, j = (e) => Q(e).enabled === !0, kt = (e) => Object.keys(Q(e).locales ?? {}), Tt = (e) => Q(e).defaultLocale, hn = (e) => j(e) && e.storage.locale || void 0, he = "fuzzy", fe = "operator", Se = "pickupPoint", Fe = "shipping", Ne = "delivery-options", Ut = "in-stock", Rt = "trade-policy", Ft = "region-id", Nt = /* @__PURE__ */ new Set([
|
|
1172
|
+
Rt,
|
|
1173
|
+
Ft,
|
|
1174
1174
|
he,
|
|
1175
1175
|
fe,
|
|
1176
1176
|
Se
|
|
1177
|
-
]),
|
|
1177
|
+
]), Lt = /* @__PURE__ */ new Set([
|
|
1178
1178
|
"zip-code",
|
|
1179
1179
|
"pickupPoint",
|
|
1180
1180
|
"country",
|
|
1181
1181
|
"coordinates",
|
|
1182
1182
|
"deliveryZonesHash",
|
|
1183
1183
|
"pickupPointsHash"
|
|
1184
|
-
]),
|
|
1184
|
+
]), Le = (e) => encodeURI(decodeURI(e)), Bt = (e) => encodeURIComponent(
|
|
1185
1185
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
1186
|
-
),
|
|
1187
|
-
function
|
|
1186
|
+
), $t = /^pickup-in-point-(.+)$/;
|
|
1187
|
+
function fn(e) {
|
|
1188
1188
|
if (!e)
|
|
1189
1189
|
return {};
|
|
1190
1190
|
try {
|
|
1191
|
-
const t =
|
|
1191
|
+
const t = Z(e).vtex_segment;
|
|
1192
1192
|
if (!t)
|
|
1193
1193
|
return {};
|
|
1194
1194
|
const r = Buffer.from(t, "base64").toString("utf-8");
|
|
@@ -1197,18 +1197,18 @@ function gn(e) {
|
|
|
1197
1197
|
return {};
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
|
-
function
|
|
1200
|
+
function Mt(e) {
|
|
1201
1201
|
const n = {}, t = [];
|
|
1202
1202
|
for (const r of e.split(";")) {
|
|
1203
1203
|
const i = r.indexOf("=");
|
|
1204
1204
|
if (i < 0) continue;
|
|
1205
1205
|
const a = r.slice(0, i), o = r.slice(i + 1);
|
|
1206
|
-
!a || !o || (
|
|
1206
|
+
!a || !o || (Lt.has(a) ? n[a] = o : t.push({ key: a, value: o }));
|
|
1207
1207
|
}
|
|
1208
1208
|
return { shipping: n, extraFacets: t };
|
|
1209
1209
|
}
|
|
1210
|
-
function
|
|
1211
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } =
|
|
1210
|
+
function zt(e) {
|
|
1211
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } = Mt(n);
|
|
1212
1212
|
return {
|
|
1213
1213
|
segmentParams: {
|
|
1214
1214
|
sc: e.channel,
|
|
@@ -1229,7 +1229,7 @@ function Nt(e) {
|
|
|
1229
1229
|
extraFacets: r
|
|
1230
1230
|
};
|
|
1231
1231
|
}
|
|
1232
|
-
function
|
|
1232
|
+
function Sn(e, n) {
|
|
1233
1233
|
const t = [
|
|
1234
1234
|
["sc", n.sc],
|
|
1235
1235
|
["regionId", n.regionId],
|
|
@@ -1249,11 +1249,11 @@ function mn(e, n) {
|
|
|
1249
1249
|
for (const [r, i] of t)
|
|
1250
1250
|
i != null && i !== "" && e.append(r, String(i));
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1253
|
-
return
|
|
1252
|
+
function yn(e) {
|
|
1253
|
+
return $t.exec(e)?.[1];
|
|
1254
1254
|
}
|
|
1255
|
-
function
|
|
1256
|
-
const n = e.find((r) => r.key === "shipping"), t = n ?
|
|
1255
|
+
function Vt(e) {
|
|
1256
|
+
const n = e.find((r) => r.key === "shipping"), t = n ? yn(n.value) : void 0;
|
|
1257
1257
|
if (t !== void 0)
|
|
1258
1258
|
try {
|
|
1259
1259
|
return decodeURIComponent(t);
|
|
@@ -1261,8 +1261,8 @@ function Lt(e) {
|
|
|
1261
1261
|
return t;
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
|
-
function
|
|
1265
|
-
const t =
|
|
1264
|
+
function xt(e, n) {
|
|
1265
|
+
const t = Vt(
|
|
1266
1266
|
n
|
|
1267
1267
|
);
|
|
1268
1268
|
return t === void 0 ? e : {
|
|
@@ -1270,25 +1270,25 @@ function Bt(e, n) {
|
|
|
1270
1270
|
pickupPoint: t
|
|
1271
1271
|
};
|
|
1272
1272
|
}
|
|
1273
|
-
function
|
|
1274
|
-
return e.map((n) => n.key !== "shipping" ||
|
|
1273
|
+
function qt(e) {
|
|
1274
|
+
return e.map((n) => n.key !== "shipping" || yn(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1275
1275
|
}
|
|
1276
|
-
function
|
|
1276
|
+
function jt(e, n) {
|
|
1277
1277
|
let t = [...e];
|
|
1278
1278
|
const r = t.some((i) => i.key === "shipping");
|
|
1279
1279
|
for (const i of n)
|
|
1280
1280
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1281
|
-
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")),
|
|
1281
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), qt(t);
|
|
1282
1282
|
}
|
|
1283
|
-
function
|
|
1283
|
+
function Wt(e) {
|
|
1284
1284
|
return e.reduce((n, t) => {
|
|
1285
1285
|
let { key: r, value: i } = t;
|
|
1286
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${
|
|
1286
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Le(r)}/${Bt(Le(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1287
1287
|
}, "");
|
|
1288
1288
|
}
|
|
1289
|
-
const
|
|
1290
|
-
function
|
|
1291
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1289
|
+
const Ht = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), Gt = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1290
|
+
function Xt(e, n) {
|
|
1291
|
+
const { segmentParams: t, extraFacets: r } = zt(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
|
|
1292
1292
|
return {
|
|
1293
1293
|
segmentParams: {
|
|
1294
1294
|
...t,
|
|
@@ -1299,23 +1299,23 @@ function qt(e, n) {
|
|
|
1299
1299
|
extraFacets: r
|
|
1300
1300
|
};
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1303
|
-
const t = e.filter(({ key: c }) => !
|
|
1304
|
-
({ key: c, value: u }) => c ===
|
|
1302
|
+
function Yt(e, n) {
|
|
1303
|
+
const t = e.filter(({ key: c }) => !Nt.has(c)), r = e.find(
|
|
1304
|
+
({ key: c, value: u }) => c === Fe && u !== "all-delivery-methods"
|
|
1305
1305
|
) ?? null, i = e.find(
|
|
1306
|
-
({ key: c, value: u }) => c ===
|
|
1306
|
+
({ key: c, value: u }) => c === Ne && u !== "all-delivery-options"
|
|
1307
1307
|
) ?? null, a = [...t], o = a.some(
|
|
1308
|
-
({ key: c }) => c ===
|
|
1308
|
+
({ key: c }) => c === Fe
|
|
1309
1309
|
), s = a.some(
|
|
1310
|
-
({ key: c }) => c ===
|
|
1310
|
+
({ key: c }) => c === Ne
|
|
1311
1311
|
);
|
|
1312
|
-
return r !== null && !o && a.push(r), i !== null && !s && a.push(i),
|
|
1312
|
+
return r !== null && !o && a.push(r), i !== null && !s && a.push(i), jt(a, n);
|
|
1313
1313
|
}
|
|
1314
|
-
function
|
|
1314
|
+
function Jt(e, n) {
|
|
1315
1315
|
const t = e.find(({ key: a }) => a === he) ?? null, r = e.find(({ key: a }) => a === fe) ?? null, i = e.find(({ key: a }) => a === Se) ?? null;
|
|
1316
|
-
t &&
|
|
1316
|
+
t && Ht(t) && n.append(he, t.value), r && Gt(r) && n.append(fe, r.value), i && n.append(Se, i.value);
|
|
1317
1317
|
}
|
|
1318
|
-
function
|
|
1318
|
+
function Be(e, n, t, r) {
|
|
1319
1319
|
const {
|
|
1320
1320
|
query: i = "",
|
|
1321
1321
|
page: a,
|
|
@@ -1332,28 +1332,28 @@ function Ne(e, n, t, r) {
|
|
|
1332
1332
|
h.append("from", p.toString()), h.append("to", m.toString());
|
|
1333
1333
|
}
|
|
1334
1334
|
i && h.append("query", i), r.includeSort && s && h.append("sort", s);
|
|
1335
|
-
const v =
|
|
1335
|
+
const v = xt(
|
|
1336
1336
|
t.segmentParams,
|
|
1337
1337
|
c
|
|
1338
1338
|
);
|
|
1339
|
-
if (
|
|
1340
|
-
const p = c.find(({ key: S }) => S ===
|
|
1339
|
+
if (Sn(h, v ?? t.segmentParams), Jt(c, h), u && h.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1340
|
+
const p = c.find(({ key: S }) => S === Ut), m = p ? p.value : g?.toString() ?? n.hideUnavailableItems.toString();
|
|
1341
1341
|
h.append("hideUnavailableItems", m);
|
|
1342
1342
|
}
|
|
1343
1343
|
n?.simulationBehavior !== void 0 && h.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && h.append("showSponsored", n.showSponsored.toString()), d !== void 0 && h.append("sponsoredCount", d.toString()), f !== void 0 && h.append("allowRedirect", f.toString());
|
|
1344
|
-
const l =
|
|
1345
|
-
|
|
1344
|
+
const l = Wt(
|
|
1345
|
+
Yt(c, t.extraFacets)
|
|
1346
1346
|
);
|
|
1347
1347
|
return { params: h, path: l };
|
|
1348
1348
|
}
|
|
1349
|
-
function
|
|
1349
|
+
function Kt(e, n) {
|
|
1350
1350
|
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: a } = e, o = new URLSearchParams({
|
|
1351
1351
|
field: t ?? "",
|
|
1352
1352
|
value: r ?? ""
|
|
1353
1353
|
});
|
|
1354
|
-
return
|
|
1354
|
+
return Sn(o, n), i && o.append("hideUnavailableItems", "true"), a && o.append("show-invisible-items", "true"), o;
|
|
1355
1355
|
}
|
|
1356
|
-
function
|
|
1356
|
+
function X(e, n) {
|
|
1357
1357
|
return {
|
|
1358
1358
|
path: e,
|
|
1359
1359
|
params: n,
|
|
@@ -1363,44 +1363,44 @@ function G(e, n) {
|
|
|
1363
1363
|
}
|
|
1364
1364
|
};
|
|
1365
1365
|
}
|
|
1366
|
-
function
|
|
1367
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a =
|
|
1366
|
+
function Y(e) {
|
|
1367
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a = Xt(t, r);
|
|
1368
1368
|
switch (n) {
|
|
1369
1369
|
case "product-search":
|
|
1370
1370
|
case "facets": {
|
|
1371
|
-
const { params: o, path: s } =
|
|
1371
|
+
const { params: o, path: s } = Be(
|
|
1372
1372
|
i,
|
|
1373
1373
|
r,
|
|
1374
1374
|
a,
|
|
1375
1375
|
{ includePagination: !0, includeSort: !0 }
|
|
1376
1376
|
);
|
|
1377
|
-
return
|
|
1377
|
+
return X(s, o);
|
|
1378
1378
|
}
|
|
1379
1379
|
case "catalog-count": {
|
|
1380
|
-
const { params: o, path: s } =
|
|
1380
|
+
const { params: o, path: s } = Be(
|
|
1381
1381
|
i,
|
|
1382
1382
|
r,
|
|
1383
1383
|
a,
|
|
1384
1384
|
{ includePagination: !1, includeSort: !1 }
|
|
1385
1385
|
);
|
|
1386
|
-
return
|
|
1386
|
+
return X(s, o);
|
|
1387
1387
|
}
|
|
1388
1388
|
case "products": {
|
|
1389
|
-
const o =
|
|
1390
|
-
return
|
|
1389
|
+
const o = Kt(i, a.segmentParams);
|
|
1390
|
+
return X("", o);
|
|
1391
1391
|
}
|
|
1392
1392
|
case "search-suggestions": {
|
|
1393
1393
|
const o = new URLSearchParams({
|
|
1394
1394
|
query: i.query?.toString() ?? "",
|
|
1395
1395
|
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1396
1396
|
});
|
|
1397
|
-
return
|
|
1397
|
+
return X("", o);
|
|
1398
1398
|
}
|
|
1399
1399
|
case "top-searches": {
|
|
1400
1400
|
const o = new URLSearchParams({
|
|
1401
1401
|
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1402
1402
|
});
|
|
1403
|
-
return
|
|
1403
|
+
return X("", o);
|
|
1404
1404
|
}
|
|
1405
1405
|
default: {
|
|
1406
1406
|
const o = n;
|
|
@@ -1408,16 +1408,16 @@ function X(e) {
|
|
|
1408
1408
|
}
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
-
const
|
|
1412
|
-
function
|
|
1411
|
+
const Qt = 10;
|
|
1412
|
+
function Zt(e) {
|
|
1413
1413
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1414
1414
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1415
1415
|
}
|
|
1416
|
-
function
|
|
1417
|
-
const t =
|
|
1418
|
-
return
|
|
1416
|
+
function er(e) {
|
|
1417
|
+
const t = fn(e.headers?.cookie).cultureInfo || "";
|
|
1418
|
+
return j(e) ? e.storage.locale || t : t || e.storage.locale || "";
|
|
1419
1419
|
}
|
|
1420
|
-
const
|
|
1420
|
+
const nr = ({
|
|
1421
1421
|
account: e,
|
|
1422
1422
|
environment: n,
|
|
1423
1423
|
hideUnavailableItems: t,
|
|
@@ -1425,10 +1425,10 @@ const Jt = ({
|
|
|
1425
1425
|
showSponsored: i,
|
|
1426
1426
|
subDomainPrefix: a
|
|
1427
1427
|
}, o) => {
|
|
1428
|
-
const s = `https://${e}.${n}.com.br`, c =
|
|
1428
|
+
const s = `https://${e}.${n}.com.br`, c = mn(o), u = fn(o.headers?.cookie), d = () => ({
|
|
1429
1429
|
salesChannel: o.storage.channel.salesChannel,
|
|
1430
|
-
regionId:
|
|
1431
|
-
locale:
|
|
1430
|
+
regionId: Zt(o),
|
|
1431
|
+
locale: er(o),
|
|
1432
1432
|
hideUnavailableItems: t,
|
|
1433
1433
|
simulationBehavior: r,
|
|
1434
1434
|
showSponsored: i
|
|
@@ -1436,23 +1436,23 @@ const Jt = ({
|
|
|
1436
1436
|
"content-type": "application/json",
|
|
1437
1437
|
"X-FORWARDED-HOST": h
|
|
1438
1438
|
}), l = ({ type: I, ...D }) => {
|
|
1439
|
-
const A = I === "facets" ? "facets" : "product-search",
|
|
1439
|
+
const A = I === "facets" ? "facets" : "product-search", E = Y({
|
|
1440
1440
|
endpoint: A,
|
|
1441
1441
|
segment: u,
|
|
1442
1442
|
defaults: d(),
|
|
1443
1443
|
args: D
|
|
1444
1444
|
});
|
|
1445
1445
|
return y(
|
|
1446
|
-
`${s}/api/intelligent-search/v1/${A}/${
|
|
1446
|
+
`${s}/api/intelligent-search/v1/${A}/${E.path}?${E.params.toString()}`,
|
|
1447
1447
|
{ headers: v }
|
|
1448
1448
|
);
|
|
1449
1449
|
}, p = (I) => l({ ...I, type: "product_search" }), m = ({
|
|
1450
1450
|
field: I,
|
|
1451
1451
|
value: D,
|
|
1452
1452
|
hideUnavailableItems: A,
|
|
1453
|
-
showInvisibleItems:
|
|
1453
|
+
showInvisibleItems: E
|
|
1454
1454
|
}) => {
|
|
1455
|
-
const P =
|
|
1455
|
+
const P = Y({
|
|
1456
1456
|
endpoint: "products",
|
|
1457
1457
|
segment: u,
|
|
1458
1458
|
defaults: d(),
|
|
@@ -1460,7 +1460,7 @@ const Jt = ({
|
|
|
1460
1460
|
field: I,
|
|
1461
1461
|
value: D,
|
|
1462
1462
|
hideUnavailableItems: A,
|
|
1463
|
-
showInvisibleItems:
|
|
1463
|
+
showInvisibleItems: E
|
|
1464
1464
|
}
|
|
1465
1465
|
});
|
|
1466
1466
|
return y(
|
|
@@ -1476,17 +1476,17 @@ const Jt = ({
|
|
|
1476
1476
|
field: I,
|
|
1477
1477
|
values: D,
|
|
1478
1478
|
showInvisibleItems: A,
|
|
1479
|
-
hideUnavailableItems:
|
|
1479
|
+
hideUnavailableItems: E
|
|
1480
1480
|
}) => {
|
|
1481
|
-
const P = De(
|
|
1481
|
+
const P = De(Qt);
|
|
1482
1482
|
return (await Promise.all(
|
|
1483
1483
|
D.map(
|
|
1484
|
-
(
|
|
1484
|
+
(b) => P(async () => {
|
|
1485
1485
|
try {
|
|
1486
1486
|
return await m({
|
|
1487
1487
|
field: I,
|
|
1488
|
-
value:
|
|
1489
|
-
hideUnavailableItems:
|
|
1488
|
+
value: b,
|
|
1489
|
+
hideUnavailableItems: E,
|
|
1490
1490
|
showInvisibleItems: A
|
|
1491
1491
|
});
|
|
1492
1492
|
} catch {
|
|
@@ -1495,11 +1495,11 @@ const Jt = ({
|
|
|
1495
1495
|
})
|
|
1496
1496
|
)
|
|
1497
1497
|
)).filter(
|
|
1498
|
-
(
|
|
1498
|
+
(b) => b !== null
|
|
1499
1499
|
);
|
|
1500
1500
|
},
|
|
1501
1501
|
suggestedTerms: (I) => {
|
|
1502
|
-
const D =
|
|
1502
|
+
const D = Y({
|
|
1503
1503
|
endpoint: "search-suggestions",
|
|
1504
1504
|
segment: u,
|
|
1505
1505
|
defaults: d(),
|
|
@@ -1511,7 +1511,7 @@ const Jt = ({
|
|
|
1511
1511
|
);
|
|
1512
1512
|
},
|
|
1513
1513
|
topSearches: () => {
|
|
1514
|
-
const I =
|
|
1514
|
+
const I = Y({
|
|
1515
1515
|
endpoint: "top-searches",
|
|
1516
1516
|
segment: u,
|
|
1517
1517
|
defaults: d()
|
|
@@ -1522,7 +1522,7 @@ const Jt = ({
|
|
|
1522
1522
|
);
|
|
1523
1523
|
},
|
|
1524
1524
|
productCount: (I) => {
|
|
1525
|
-
const D =
|
|
1525
|
+
const D = Y({
|
|
1526
1526
|
endpoint: "catalog-count",
|
|
1527
1527
|
segment: u,
|
|
1528
1528
|
defaults: d(),
|
|
@@ -1534,15 +1534,15 @@ const Jt = ({
|
|
|
1534
1534
|
);
|
|
1535
1535
|
}
|
|
1536
1536
|
};
|
|
1537
|
-
},
|
|
1538
|
-
const t =
|
|
1537
|
+
}, tr = (e, n) => {
|
|
1538
|
+
const t = nr(e, n), r = _t(e, n), i = St(e);
|
|
1539
1539
|
return {
|
|
1540
1540
|
search: t,
|
|
1541
1541
|
commerce: r,
|
|
1542
1542
|
catalog: i
|
|
1543
1543
|
};
|
|
1544
|
-
},
|
|
1545
|
-
const t = De(
|
|
1544
|
+
}, rr = 20, ir = (e) => e.entityType === "category", ye = (e) => e.entityType === "brand", $e = (e) => e.entityType === "collection", ar = (e, n) => {
|
|
1545
|
+
const t = De(rr), r = async (i) => Promise.all(
|
|
1546
1546
|
i.map(
|
|
1547
1547
|
(a) => t(async () => {
|
|
1548
1548
|
const o = a.slug.toLowerCase(), s = a.locale, c = await n.commerce.catalog.byLinkId.category(
|
|
@@ -1580,11 +1580,11 @@ const Jt = ({
|
|
|
1580
1580
|
// entry while same-slug / different-locale loads stay isolated.
|
|
1581
1581
|
cacheKeyFn: ({ slug: i, locale: a }) => `${i.toLowerCase()}::${a ?? ""}`
|
|
1582
1582
|
});
|
|
1583
|
-
},
|
|
1583
|
+
}, or = (e, n) => {
|
|
1584
1584
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1585
1585
|
return new ue(t);
|
|
1586
|
-
},
|
|
1587
|
-
const t = De(
|
|
1586
|
+
}, sr = 1, cr = (e, n) => {
|
|
1587
|
+
const t = De(sr), r = async (a) => {
|
|
1588
1588
|
const o = a.reduce((g, { items: f }) => [...g, f], []), s = [...o.flat()], c = await n.commerce.checkout.simulation({
|
|
1589
1589
|
country: a[0].country,
|
|
1590
1590
|
postalCode: a[0].postalCode,
|
|
@@ -1607,17 +1607,17 @@ const Jt = ({
|
|
|
1607
1607
|
return new ue(i, {
|
|
1608
1608
|
maxBatchSize: 50
|
|
1609
1609
|
});
|
|
1610
|
-
},
|
|
1611
|
-
function
|
|
1610
|
+
}, lr = (e, n) => Jn(e, n);
|
|
1611
|
+
function dr(e) {
|
|
1612
1612
|
return {
|
|
1613
1613
|
...e,
|
|
1614
|
-
description: e.description ?
|
|
1614
|
+
description: e.description ? lr(e.description) : e.description
|
|
1615
1615
|
};
|
|
1616
1616
|
}
|
|
1617
1617
|
const F = (e, n) => ({
|
|
1618
1618
|
...e,
|
|
1619
|
-
isVariantOf:
|
|
1620
|
-
}),
|
|
1619
|
+
isVariantOf: dr(n)
|
|
1620
|
+
}), ur = ({ flags: e }, n) => {
|
|
1621
1621
|
const t = async (r) => {
|
|
1622
1622
|
const i = r.map((d) => d.split("-")[0]), a = r.some(
|
|
1623
1623
|
(d) => d.split("-")[1] === "invisibleItems"
|
|
@@ -1646,27 +1646,27 @@ const F = (e, n) => ({
|
|
|
1646
1646
|
maxBatchSize: 99
|
|
1647
1647
|
// Max allowed batch size of Search API
|
|
1648
1648
|
});
|
|
1649
|
-
},
|
|
1650
|
-
const { clients: t } = n, r =
|
|
1649
|
+
}, pr = (e, n) => {
|
|
1650
|
+
const { clients: t } = n, r = ur(e, t), i = cr(e, t), a = ar(e, t), o = or(e, t);
|
|
1651
1651
|
return {
|
|
1652
1652
|
skuLoader: r,
|
|
1653
1653
|
simulationLoader: i,
|
|
1654
1654
|
collectionLoader: a,
|
|
1655
1655
|
salesChannelLoader: o
|
|
1656
1656
|
};
|
|
1657
|
-
}, B = (e) => e.AvailableQuantity > 0,
|
|
1657
|
+
}, B = (e) => e.AvailableQuantity > 0, W = (e) => e.spotPrice ?? 0, gr = (e) => e.Price ?? 0, Me = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", In = (e, n) => B(e) && !B(n) ? -1 : !B(e) && B(n) ? 1 : W(e) - W(n), mr = (e) => e === "available", q = (e, n = 0, t = 1) => {
|
|
1658
1658
|
const r = n / t;
|
|
1659
1659
|
return Math.round((e + r) * 100) / 100;
|
|
1660
|
-
},
|
|
1661
|
-
const t = e.filter(B), r = t[t.length - 1], i = r ?
|
|
1662
|
-
return n.includeTaxes ?
|
|
1663
|
-
},
|
|
1664
|
-
const [t] = e.filter(B), r = t ?
|
|
1665
|
-
return n.includeTaxes ?
|
|
1666
|
-
},
|
|
1667
|
-
highPrice: (e) =>
|
|
1668
|
-
lowPrice: (e) =>
|
|
1669
|
-
lowPriceWithTaxes: (e) =>
|
|
1660
|
+
}, hr = (e, n = { includeTaxes: !1 }) => {
|
|
1661
|
+
const t = e.filter(B), r = t[t.length - 1], i = r ? W(r) : 0;
|
|
1662
|
+
return n.includeTaxes ? q(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1663
|
+
}, ze = (e, n = { includeTaxes: !1 }) => {
|
|
1664
|
+
const [t] = e.filter(B), r = t ? W(t) : 0;
|
|
1665
|
+
return n.includeTaxes ? q(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1666
|
+
}, fr = {
|
|
1667
|
+
highPrice: (e) => hr(e),
|
|
1668
|
+
lowPrice: (e) => ze(e),
|
|
1669
|
+
lowPriceWithTaxes: (e) => ze(e, { includeTaxes: !0 }),
|
|
1670
1670
|
offerCount: (e) => e.length,
|
|
1671
1671
|
priceCurrency: async (e, n, t) => {
|
|
1672
1672
|
const {
|
|
@@ -1676,18 +1676,18 @@ const F = (e, n) => ({
|
|
|
1676
1676
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1677
1677
|
},
|
|
1678
1678
|
offers: (e) => e
|
|
1679
|
-
},
|
|
1679
|
+
}, Sr = {
|
|
1680
1680
|
ratingValue: () => 5,
|
|
1681
1681
|
reviewCount: () => 0
|
|
1682
|
-
},
|
|
1682
|
+
}, Ve = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", yr = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", Ir = (e) => {
|
|
1683
1683
|
let n = e.slice(0);
|
|
1684
|
-
for (let t = 0; t <
|
|
1685
|
-
n = n.replace(new RegExp(
|
|
1684
|
+
for (let t = 0; t < Ve.length; t++)
|
|
1685
|
+
n = n.replace(new RegExp(Ve.charAt(t), "g"), yr.charAt(t));
|
|
1686
1686
|
return n;
|
|
1687
|
-
},
|
|
1687
|
+
}, vr = (e) => e.replace(/[·/_,:]/, "-");
|
|
1688
1688
|
function se(e) {
|
|
1689
1689
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1690
|
-
return
|
|
1690
|
+
return vr(Ir(t)).toLowerCase();
|
|
1691
1691
|
}
|
|
1692
1692
|
const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
1693
1693
|
const t = n.split("/").filter(Boolean), {
|
|
@@ -1697,13 +1697,13 @@ const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
|
1697
1697
|
t.map(
|
|
1698
1698
|
(i, a) => r.load({
|
|
1699
1699
|
slug: t.slice(0, a + 1).join("/"),
|
|
1700
|
-
locale:
|
|
1700
|
+
locale: hn(e)
|
|
1701
1701
|
})
|
|
1702
1702
|
)
|
|
1703
1703
|
);
|
|
1704
|
-
},
|
|
1704
|
+
}, z = (e) => ir(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? se(e.name), vn = {
|
|
1705
1705
|
id: ({ id: e }) => e.toString(),
|
|
1706
|
-
slug: (e) =>
|
|
1706
|
+
slug: (e) => z(e),
|
|
1707
1707
|
seo: (e) => ({
|
|
1708
1708
|
title: e.title ?? e.name,
|
|
1709
1709
|
// pagetype.metaTagDescription and catalog `description` share the same
|
|
@@ -1711,14 +1711,14 @@ const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
|
1711
1711
|
// for forward-compat; fall back to description for by-linkid parity.
|
|
1712
1712
|
description: e.metaTagDescription ?? e.description
|
|
1713
1713
|
}),
|
|
1714
|
-
type: (e) => ye(e) ? "Brand" :
|
|
1714
|
+
type: (e) => ye(e) ? "Brand" : $e(e) ? "Collection" : e.fatherCategoryId === null ? "Department" : "Category",
|
|
1715
1715
|
meta: async (e, n, t) => {
|
|
1716
|
-
const r =
|
|
1716
|
+
const r = z(e);
|
|
1717
1717
|
if (ye(e))
|
|
1718
1718
|
return { selectedFacets: [{ key: "brand", value: r }] };
|
|
1719
|
-
if (
|
|
1719
|
+
if ($e(e))
|
|
1720
1720
|
return { selectedFacets: [{ key: "productclusterids", value: e.id }] };
|
|
1721
|
-
const { defaultLocale: i } =
|
|
1721
|
+
const { defaultLocale: i } = Q(t);
|
|
1722
1722
|
return {
|
|
1723
1723
|
selectedFacets: (await re(t, r)).map((o, s) => ({
|
|
1724
1724
|
key: `category-${s + 1}`,
|
|
@@ -1727,10 +1727,10 @@ const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
|
1727
1727
|
};
|
|
1728
1728
|
},
|
|
1729
1729
|
breadcrumbList: async (e, n, t) => {
|
|
1730
|
-
const r = await re(t,
|
|
1730
|
+
const r = await re(t, z(e));
|
|
1731
1731
|
return {
|
|
1732
1732
|
itemListElement: r.map((i, a) => ({
|
|
1733
|
-
item: `/${
|
|
1733
|
+
item: `/${z(i)}`,
|
|
1734
1734
|
name: i.name,
|
|
1735
1735
|
position: a + 1
|
|
1736
1736
|
})),
|
|
@@ -1738,11 +1738,11 @@ const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
|
1738
1738
|
};
|
|
1739
1739
|
},
|
|
1740
1740
|
otherLocales: async (e, n, t) => {
|
|
1741
|
-
const r =
|
|
1741
|
+
const r = Q(t);
|
|
1742
1742
|
if (!r.enabled) return null;
|
|
1743
1743
|
const i = Object.keys(r.locales ?? {});
|
|
1744
1744
|
if (i.length === 0) return null;
|
|
1745
|
-
const a =
|
|
1745
|
+
const a = z(e);
|
|
1746
1746
|
if (a.split("/").filter(Boolean).length === 0) return null;
|
|
1747
1747
|
let o;
|
|
1748
1748
|
try {
|
|
@@ -1764,7 +1764,7 @@ const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
|
1764
1764
|
}).filter((s) => s !== null);
|
|
1765
1765
|
},
|
|
1766
1766
|
canonicalSlug: async (e, n, t) => {
|
|
1767
|
-
const r =
|
|
1767
|
+
const r = z(e);
|
|
1768
1768
|
if (r.split("/").filter(Boolean).length === 0) return null;
|
|
1769
1769
|
let i;
|
|
1770
1770
|
try {
|
|
@@ -1775,14 +1775,14 @@ const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
|
1775
1775
|
const a = i.map((o) => o.linkId);
|
|
1776
1776
|
return a.every((o) => !!o) ? ge(a.join("/")) : ge(r);
|
|
1777
1777
|
}
|
|
1778
|
-
},
|
|
1778
|
+
}, On = {
|
|
1779
1779
|
buy: "whoboughtalsobought",
|
|
1780
1780
|
view: "whosawalsosaw",
|
|
1781
1781
|
similars: "similars",
|
|
1782
1782
|
viewAndBought: "whosawalsobought",
|
|
1783
1783
|
accessories: "accessories",
|
|
1784
1784
|
suggestions: "suggestions"
|
|
1785
|
-
},
|
|
1785
|
+
}, xe = ({ key: e, value: n }) => {
|
|
1786
1786
|
switch (e) {
|
|
1787
1787
|
case "price":
|
|
1788
1788
|
return { key: e, value: n.replace("-to-", ":") };
|
|
@@ -1798,34 +1798,34 @@ const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
|
1798
1798
|
default:
|
|
1799
1799
|
return { key: e, value: n };
|
|
1800
1800
|
}
|
|
1801
|
-
},
|
|
1801
|
+
}, qe = (e) => {
|
|
1802
1802
|
const n = e.split(":").map(Number);
|
|
1803
1803
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1804
|
-
},
|
|
1804
|
+
}, Or = (e) => typeof On[e] == "string", br = (e) => {
|
|
1805
1805
|
const n = e?.filter(
|
|
1806
|
-
(t) =>
|
|
1806
|
+
(t) => Or(t.key)
|
|
1807
1807
|
);
|
|
1808
1808
|
if (Array.isArray(n) && n.length > 1)
|
|
1809
|
-
throw new
|
|
1809
|
+
throw new _(
|
|
1810
1810
|
`You passed ${n.length} cross selling facets but only one is allowed. Please leave one of the following facet: ${n.map((t) => t.key).join(",")}`
|
|
1811
1811
|
);
|
|
1812
1812
|
return n?.[0] ?? null;
|
|
1813
|
-
},
|
|
1813
|
+
}, Cr = (e) => e?.find((n) => n.key === "slug")?.value ?? null, wr = (e) => e?.find((n) => n.key === "id")?.value ?? null, je = (e) => e?.find((n) => n.key === "locale")?.value ?? null, We = (e) => e?.find((n) => n.key === "channel")?.value ?? null, Ie = (e, n) => {
|
|
1814
1814
|
let t = 0;
|
|
1815
1815
|
for (let r = 1; r < e.length; r++)
|
|
1816
1816
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1817
1817
|
return e[t];
|
|
1818
|
-
},
|
|
1818
|
+
}, Dr = {
|
|
1819
1819
|
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1820
|
-
},
|
|
1820
|
+
}, Ar = {
|
|
1821
1821
|
key: ({ key: e }) => e,
|
|
1822
1822
|
label: ({ name: e }) => e,
|
|
1823
1823
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1824
|
-
},
|
|
1824
|
+
}, Pr = {
|
|
1825
1825
|
key: ({ key: e }) => e,
|
|
1826
1826
|
label: ({ name: e }) => e,
|
|
1827
1827
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1828
|
-
const i =
|
|
1828
|
+
const i = qe(
|
|
1829
1829
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1830
1830
|
), o = Ie(e, (s, c) => s.range.from - c.range.from)?.range?.from ?? 0;
|
|
1831
1831
|
return {
|
|
@@ -1834,7 +1834,7 @@ const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
|
1834
1834
|
};
|
|
1835
1835
|
},
|
|
1836
1836
|
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1837
|
-
const i =
|
|
1837
|
+
const i = qe(
|
|
1838
1838
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1839
1839
|
), o = Ie(e, (s, c) => c.range.to - s.range.to)?.range?.to ?? 0;
|
|
1840
1840
|
return {
|
|
@@ -1842,17 +1842,17 @@ const ge = (e) => e.toLowerCase(), re = (e, n) => {
|
|
|
1842
1842
|
absolute: o
|
|
1843
1843
|
};
|
|
1844
1844
|
}
|
|
1845
|
-
},
|
|
1845
|
+
}, Er = {
|
|
1846
1846
|
value: ({ value: e }) => e,
|
|
1847
1847
|
label: ({ name: e }) => e || "unknown",
|
|
1848
1848
|
selected: ({ selected: e }) => e,
|
|
1849
1849
|
quantity: ({ quantity: e }) => e
|
|
1850
|
-
},
|
|
1850
|
+
}, _r = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1851
1851
|
if (!n?.orderId)
|
|
1852
|
-
throw new
|
|
1852
|
+
throw new _("Missing orderId");
|
|
1853
1853
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1854
1854
|
};
|
|
1855
|
-
function
|
|
1855
|
+
function bn(e) {
|
|
1856
1856
|
if (!e || e.status !== "pending")
|
|
1857
1857
|
return null;
|
|
1858
1858
|
for (const n of e.dimensionStatus) {
|
|
@@ -1870,45 +1870,45 @@ function In(e) {
|
|
|
1870
1870
|
}
|
|
1871
1871
|
return null;
|
|
1872
1872
|
}
|
|
1873
|
-
function
|
|
1873
|
+
function kr(e) {
|
|
1874
1874
|
if (!e || e.status !== "pending") return !1;
|
|
1875
1875
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1876
1876
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1877
1877
|
}
|
|
1878
|
-
const
|
|
1879
|
-
const r = await t.oms.processOrderAuthorization(n), i =
|
|
1878
|
+
const Tr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1879
|
+
const r = await t.oms.processOrderAuthorization(n), i = bn(r);
|
|
1880
1880
|
return {
|
|
1881
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1881
|
+
isPendingForOtherAuthorizer: !i && kr(r),
|
|
1882
1882
|
ruleForAuthorization: i
|
|
1883
1883
|
};
|
|
1884
|
-
},
|
|
1884
|
+
}, Ur = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1885
1885
|
if (!n?.objectKey)
|
|
1886
|
-
throw new
|
|
1886
|
+
throw new _("Missing objectKey");
|
|
1887
1887
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
1888
1888
|
return t.orderEntry.startOperation({
|
|
1889
1889
|
objectKey: n.objectKey,
|
|
1890
1890
|
orderFormId: r,
|
|
1891
1891
|
sessionToken: n.sessionToken ?? void 0
|
|
1892
1892
|
});
|
|
1893
|
-
},
|
|
1893
|
+
}, Rr = async (e, n, t) => {
|
|
1894
1894
|
if (!(await t.clients.commerce.recommendation.startRecommendationSession())?.recommendationsUserId)
|
|
1895
1895
|
throw new Error(
|
|
1896
1896
|
"Failed to start recommendation session: no session data returned"
|
|
1897
1897
|
);
|
|
1898
1898
|
return !0;
|
|
1899
|
-
},
|
|
1899
|
+
}, Fr = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), Nr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1900
1900
|
const { fileContent: r, fileName: i, mimeType: a } = n;
|
|
1901
1901
|
if (!r || !i || !a)
|
|
1902
|
-
throw new
|
|
1902
|
+
throw new _(
|
|
1903
1903
|
"Missing required fields: fileContent, fileName, mimeType"
|
|
1904
1904
|
);
|
|
1905
1905
|
const o = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
|
|
1906
1906
|
if (Math.floor(o.length * 3 / 4) > s)
|
|
1907
|
-
throw new
|
|
1907
|
+
throw new _("File exceeds maximum allowed size of 5MB");
|
|
1908
1908
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
|
|
1909
1909
|
o
|
|
1910
1910
|
))
|
|
1911
|
-
throw new
|
|
1911
|
+
throw new _("Invalid Base64 fileContent");
|
|
1912
1912
|
const d = Buffer.from(o, "base64");
|
|
1913
1913
|
return await t.orderEntry.uploadFile({
|
|
1914
1914
|
fileBuffer: d,
|
|
@@ -1916,7 +1916,7 @@ const Ar = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
|
1916
1916
|
mimeType: a
|
|
1917
1917
|
});
|
|
1918
1918
|
};
|
|
1919
|
-
class
|
|
1919
|
+
class ne {
|
|
1920
1920
|
static parse(n) {
|
|
1921
1921
|
try {
|
|
1922
1922
|
const t = JSON.parse(n);
|
|
@@ -1934,46 +1934,97 @@ class ee {
|
|
|
1934
1934
|
return JSON.stringify(n);
|
|
1935
1935
|
}
|
|
1936
1936
|
}
|
|
1937
|
-
function
|
|
1938
|
-
return n == null || n === "" || String(n) === String(e.salesChannel ?? "") ? null :
|
|
1937
|
+
function Lr(e, n) {
|
|
1938
|
+
return n == null || n === "" || String(n) === String(e.salesChannel ?? "") ? null : ne.stringify({
|
|
1939
1939
|
...e,
|
|
1940
1940
|
salesChannel: String(n),
|
|
1941
1941
|
hasOnlyDefaultSalesChannel: !1
|
|
1942
1942
|
});
|
|
1943
1943
|
}
|
|
1944
1944
|
const ce = (e, n) => {
|
|
1945
|
-
e.storage.channel =
|
|
1945
|
+
e.storage.channel = ne.parse(n);
|
|
1946
1946
|
}, ve = (e, n) => {
|
|
1947
1947
|
e.storage.locale = n;
|
|
1948
|
-
},
|
|
1948
|
+
}, Pe = (e) => Kn.createHash("md5").update(e).digest("hex"), M = {
|
|
1949
1949
|
attachment: "ATTACHMENT",
|
|
1950
1950
|
specification: "SPECIFICATION",
|
|
1951
|
-
attribute: "ATTRIBUTE"
|
|
1951
|
+
attribute: "ATTRIBUTE",
|
|
1952
|
+
/**
|
|
1953
|
+
* A VTEX Service (Checkout "offering") applied to a cart line. Mirrors one
|
|
1954
|
+
* entry of the orderForm item's `bundleItems`; the item's `offerings` field
|
|
1955
|
+
* lists the services *available* for the line, not the applied ones.
|
|
1956
|
+
*/
|
|
1957
|
+
service: "SERVICE"
|
|
1952
1958
|
};
|
|
1953
|
-
function
|
|
1959
|
+
function Cn(e) {
|
|
1954
1960
|
return {
|
|
1955
1961
|
name: e.name,
|
|
1956
1962
|
value: e.content,
|
|
1957
|
-
valueReference:
|
|
1963
|
+
valueReference: M.attachment
|
|
1958
1964
|
};
|
|
1959
1965
|
}
|
|
1960
|
-
function
|
|
1966
|
+
function Br(e) {
|
|
1961
1967
|
return {
|
|
1962
1968
|
propertyID: e.id,
|
|
1963
1969
|
name: e.name,
|
|
1964
1970
|
value: e.value,
|
|
1965
1971
|
valueReference: {
|
|
1966
|
-
valueReference:
|
|
1972
|
+
valueReference: M.attribute,
|
|
1967
1973
|
visible: e.visible
|
|
1968
1974
|
}
|
|
1969
1975
|
};
|
|
1970
1976
|
}
|
|
1971
|
-
function
|
|
1972
|
-
return
|
|
1977
|
+
function wn(e) {
|
|
1978
|
+
return Pe(
|
|
1973
1979
|
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
1974
1980
|
);
|
|
1975
1981
|
}
|
|
1976
|
-
const
|
|
1982
|
+
const Dn = (e, n) => e < n ? -1 : e > n ? 1 : 0, $r = (e, n) => Dn(e.name, n.name), Mr = (e) => [...e ?? []].sort($r), He = (e) => e !== null && typeof e == "object" && !Array.isArray(e), zr = (e) => He(e) && typeof e.name == "string" && He(e.content), Vr = (e) => ({
|
|
1983
|
+
name: e.name,
|
|
1984
|
+
content: Object.fromEntries(
|
|
1985
|
+
Object.keys(e.content).sort(Dn).map((n) => [n, e.content[n]])
|
|
1986
|
+
)
|
|
1987
|
+
}), An = (e, n) => Pe(
|
|
1988
|
+
`SERVICE:${e}:${JSON.stringify(
|
|
1989
|
+
Mr((n ?? []).filter(zr)).map(
|
|
1990
|
+
Vr
|
|
1991
|
+
)
|
|
1992
|
+
)}`
|
|
1993
|
+
), xr = "SERVICE:unreadable";
|
|
1994
|
+
function Ee(e) {
|
|
1995
|
+
const n = e.attachments ?? [];
|
|
1996
|
+
return {
|
|
1997
|
+
propertyID: An(e.id, n),
|
|
1998
|
+
name: e.name,
|
|
1999
|
+
value: {
|
|
2000
|
+
id: e.id,
|
|
2001
|
+
price: e.sellingPrice / 100,
|
|
2002
|
+
attachments: n
|
|
2003
|
+
},
|
|
2004
|
+
valueReference: M.service
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
const qr = (e) => {
|
|
2008
|
+
try {
|
|
2009
|
+
return JSON.parse(e);
|
|
2010
|
+
} catch {
|
|
2011
|
+
return null;
|
|
2012
|
+
}
|
|
2013
|
+
}, jr = (e) => {
|
|
2014
|
+
const n = typeof e == "string" ? qr(e) : e;
|
|
2015
|
+
if (n === null || typeof n != "object")
|
|
2016
|
+
return null;
|
|
2017
|
+
const { id: t, attachments: r } = n;
|
|
2018
|
+
return typeof t != "string" && typeof t != "number" ? null : { id: String(t), attachments: r };
|
|
2019
|
+
};
|
|
2020
|
+
function Wr(e) {
|
|
2021
|
+
const n = jr(e.value);
|
|
2022
|
+
return n ? An(
|
|
2023
|
+
n.id,
|
|
2024
|
+
Array.isArray(n.attachments) ? n.attachments : []
|
|
2025
|
+
) : xr;
|
|
2026
|
+
}
|
|
2027
|
+
const Hr = (e) => {
|
|
1977
2028
|
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
1978
2029
|
addressType: e.addressType || null,
|
|
1979
2030
|
postalCode: n || null,
|
|
@@ -1992,7 +2043,7 @@ const Rr = (e) => {
|
|
|
1992
2043
|
r.geoCoordinates = i !== null && a !== null ? [a, i] : [];
|
|
1993
2044
|
}
|
|
1994
2045
|
return [r];
|
|
1995
|
-
},
|
|
2046
|
+
}, Gr = (e, n, t) => {
|
|
1996
2047
|
const r = n.postalCode, i = n.geoCoordinates, a = e?.shippingData?.availableAddresses ?? [], o = e?.shippingData?.selectedAddresses ?? [];
|
|
1997
2048
|
if (!t && o.length > 0)
|
|
1998
2049
|
return [o[0]];
|
|
@@ -2006,17 +2057,17 @@ const Rr = (e) => {
|
|
|
2006
2057
|
return [s];
|
|
2007
2058
|
}
|
|
2008
2059
|
return null;
|
|
2009
|
-
},
|
|
2010
|
-
if (!
|
|
2060
|
+
}, Pn = (e, n) => {
|
|
2061
|
+
if (!Xr(n))
|
|
2011
2062
|
return { updateShipping: !1, addressChanged: !1 };
|
|
2012
|
-
if (!
|
|
2063
|
+
if (!Qr(e))
|
|
2013
2064
|
return { updateShipping: !1, addressChanged: !1 };
|
|
2014
2065
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
2015
|
-
if (
|
|
2066
|
+
if (Yr(t, n.postalCode) || Jr(t, n.geoCoordinates) || Kr(t, n.addressType))
|
|
2016
2067
|
return { updateShipping: !0, addressChanged: !0 };
|
|
2017
2068
|
const { logisticsInfo: r } = e.shippingData;
|
|
2018
|
-
return
|
|
2019
|
-
},
|
|
2069
|
+
return Zr(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
2070
|
+
}, Xr = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, Yr = (e, n) => typeof n == "string" && e?.postalCode !== n, Jr = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), Kr = (e, n) => typeof n == "string" && e?.addressType !== n, Qr = (e) => e.items.length !== 0, Zr = (e, n) => {
|
|
2020
2071
|
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
|
|
2021
2072
|
return e.some(
|
|
2022
2073
|
({ selectedDeliveryChannel: o, selectedSla: s, slas: c }) => {
|
|
@@ -2026,11 +2077,15 @@ const Rr = (e) => {
|
|
|
2026
2077
|
));
|
|
2027
2078
|
}
|
|
2028
2079
|
);
|
|
2029
|
-
},
|
|
2080
|
+
}, En = (e) => e.valueReference === M.attachment, ei = (e) => e.valueReference === M.service, ni = (e) => (e.itemOffered.additionalProperty ?? []).filter(ei).map(Wr).sort((n, t) => n.localeCompare(t)), _n = (e) => {
|
|
2081
|
+
const n = ni(e);
|
|
2082
|
+
return n.length > 0 ? `services:${n.join("-")}` : void 0;
|
|
2083
|
+
}, Oe = (e) => [
|
|
2030
2084
|
e.itemOffered.sku,
|
|
2031
2085
|
e.seller.identifier,
|
|
2032
2086
|
e.price < 0.01 ? "Gift" : void 0,
|
|
2033
|
-
e.itemOffered.additionalProperty?.filter(
|
|
2087
|
+
e.itemOffered.additionalProperty?.filter(En).map(wn).join("-"),
|
|
2088
|
+
_n(e)
|
|
2034
2089
|
].filter(Boolean).join("::"), le = (e, n) => ({
|
|
2035
2090
|
listPrice: e.listPrice / 100,
|
|
2036
2091
|
price: e.sellingPrice / 100,
|
|
@@ -2040,46 +2095,50 @@ const Rr = (e) => {
|
|
|
2040
2095
|
sku: e.id,
|
|
2041
2096
|
image: [],
|
|
2042
2097
|
name: e.name,
|
|
2043
|
-
additionalProperty:
|
|
2098
|
+
additionalProperty: [
|
|
2099
|
+
...e.attachments.map(Cn),
|
|
2100
|
+
...(e.bundleItems ?? []).map(Ee)
|
|
2101
|
+
]
|
|
2044
2102
|
},
|
|
2045
2103
|
index: n
|
|
2046
|
-
}),
|
|
2104
|
+
}), ti = (e) => ({
|
|
2047
2105
|
quantity: e.quantity,
|
|
2048
2106
|
seller: e.seller.identifier,
|
|
2049
2107
|
id: e.itemOffered.sku,
|
|
2050
2108
|
index: e.index,
|
|
2051
|
-
attachments: (e.itemOffered.additionalProperty?.filter(
|
|
2109
|
+
attachments: (e.itemOffered.additionalProperty?.filter(En) ?? []).map((n) => ({
|
|
2052
2110
|
name: n.name,
|
|
2053
2111
|
content: n.value
|
|
2054
2112
|
})),
|
|
2055
2113
|
...e.priceToken ? { priceToken: e.priceToken } : {}
|
|
2056
|
-
}),
|
|
2114
|
+
}), Ge = (e) => e.reduce((n, t) => {
|
|
2057
2115
|
const r = Oe(t);
|
|
2058
2116
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
2059
|
-
}, /* @__PURE__ */ new Map()),
|
|
2117
|
+
}, /* @__PURE__ */ new Map()), ri = (e, n) => {
|
|
2060
2118
|
const t = ({ priceToken: s, ...c }, u) => ({
|
|
2061
2119
|
...c,
|
|
2062
2120
|
itemOffered: {
|
|
2063
2121
|
sku: c.itemOffered.sku
|
|
2064
2122
|
},
|
|
2123
|
+
services: _n(c),
|
|
2065
2124
|
index: u
|
|
2066
2125
|
}), r = n.items.map(le).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = Ae(r, i);
|
|
2067
2126
|
return a && o;
|
|
2068
2127
|
};
|
|
2069
|
-
function
|
|
2128
|
+
function kn(e, n) {
|
|
2070
2129
|
return e?.some(
|
|
2071
2130
|
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 && e[t.parentItemIndex]?.id === n
|
|
2072
2131
|
);
|
|
2073
2132
|
}
|
|
2074
|
-
function
|
|
2133
|
+
function Tn(e, n) {
|
|
2075
2134
|
return e?.some(
|
|
2076
2135
|
(t) => t.id === n && t.parentItemIndex !== null
|
|
2077
2136
|
);
|
|
2078
2137
|
}
|
|
2079
|
-
const
|
|
2138
|
+
const Xe = (e) => {
|
|
2080
2139
|
const n = e.items.reduce(
|
|
2081
2140
|
(t, r, i) => {
|
|
2082
|
-
const a =
|
|
2141
|
+
const a = Tn(e.items, r.id) || kn(e.items, r.id) ? `${Oe(le(r))}::${i}` : Oe(le(r));
|
|
2083
2142
|
return t[a] || (t[a] = []), t[a].push(r), t;
|
|
2084
2143
|
},
|
|
2085
2144
|
{}
|
|
@@ -2098,7 +2157,7 @@ const We = (e) => {
|
|
|
2098
2157
|
};
|
|
2099
2158
|
})
|
|
2100
2159
|
};
|
|
2101
|
-
},
|
|
2160
|
+
}, be = async (e, n, t, r) => ({
|
|
2102
2161
|
order: {
|
|
2103
2162
|
orderNumber: e.orderFormId,
|
|
2104
2163
|
acceptedOffer: e.items.map(async (i) => ({
|
|
@@ -2112,24 +2171,28 @@ const We = (e) => {
|
|
|
2112
2171
|
text: i,
|
|
2113
2172
|
status: a.toUpperCase()
|
|
2114
2173
|
}))
|
|
2115
|
-
}),
|
|
2116
|
-
const t = e.map((r) =>
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2174
|
+
}), Un = ({ items: e }, n) => {
|
|
2175
|
+
const t = e.map((r) => {
|
|
2176
|
+
const i = (r.bundleItems ?? []).map(Ee).map(({ propertyID: a }) => a).sort((a, o) => a.localeCompare(o));
|
|
2177
|
+
return {
|
|
2178
|
+
id: r.id,
|
|
2179
|
+
quantity: r.quantity,
|
|
2180
|
+
seller: r.seller,
|
|
2181
|
+
attachments: r.attachments,
|
|
2182
|
+
// customizations
|
|
2183
|
+
...i.length > 0 ? { services: i } : {}
|
|
2184
|
+
};
|
|
2185
|
+
});
|
|
2186
|
+
return Pe(
|
|
2124
2187
|
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
2125
2188
|
);
|
|
2126
|
-
},
|
|
2189
|
+
}, Ye = async (e, n, t) => {
|
|
2127
2190
|
try {
|
|
2128
2191
|
return await n.checkout.setCustomData({
|
|
2129
2192
|
id: e.orderFormId,
|
|
2130
2193
|
appId: "faststore",
|
|
2131
2194
|
key: "cartEtag",
|
|
2132
|
-
value:
|
|
2195
|
+
value: Un(e, t)
|
|
2133
2196
|
});
|
|
2134
2197
|
} catch (r) {
|
|
2135
2198
|
throw console.error(
|
|
@@ -2139,22 +2202,22 @@ const We = (e) => {
|
|
|
2139
2202
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
2140
2203
|
), r;
|
|
2141
2204
|
}
|
|
2142
|
-
},
|
|
2205
|
+
}, ii = (e, n) => {
|
|
2143
2206
|
const r = e.customData?.customApps.find(
|
|
2144
2207
|
(a) => a.id === "faststore"
|
|
2145
2208
|
)?.fields?.cartEtag;
|
|
2146
|
-
return r == null ? !0 :
|
|
2147
|
-
},
|
|
2209
|
+
return r == null ? !0 : Un(e, n) !== r;
|
|
2210
|
+
}, ai = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
2148
2211
|
id: e
|
|
2149
|
-
}),
|
|
2212
|
+
}), Je = async (e, n, { clients: { commerce: t } }) => {
|
|
2150
2213
|
if (!n)
|
|
2151
2214
|
return e;
|
|
2152
|
-
const { updateShipping: r, addressChanged: i } =
|
|
2215
|
+
const { updateShipping: r, addressChanged: i } = Pn(
|
|
2153
2216
|
e,
|
|
2154
2217
|
n
|
|
2155
2218
|
);
|
|
2156
2219
|
if (r) {
|
|
2157
|
-
const a =
|
|
2220
|
+
const a = Gr(e, n, i), s = a || Hr(n);
|
|
2158
2221
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
2159
2222
|
{
|
|
2160
2223
|
id: e.orderFormId,
|
|
@@ -2174,19 +2237,19 @@ const We = (e) => {
|
|
|
2174
2237
|
);
|
|
2175
2238
|
}
|
|
2176
2239
|
return e;
|
|
2177
|
-
},
|
|
2240
|
+
}, oi = (e, n) => {
|
|
2178
2241
|
if (!e)
|
|
2179
2242
|
return "";
|
|
2180
|
-
const r =
|
|
2243
|
+
const r = Z(e)[n];
|
|
2181
2244
|
return r ? r.split("=")[1] : "";
|
|
2182
|
-
},
|
|
2183
|
-
const t =
|
|
2245
|
+
}, Ke = (e, n) => {
|
|
2246
|
+
const t = Lr(
|
|
2184
2247
|
e.storage.channel,
|
|
2185
2248
|
n.salesChannel
|
|
2186
2249
|
);
|
|
2187
2250
|
return t ? (ce(e, t), n.salesChannel ? String(n.salesChannel) : null) : null;
|
|
2188
|
-
},
|
|
2189
|
-
const i =
|
|
2251
|
+
}, Qe = (e, n, t, r) => r ? be(e, n, t, r) : null, si = async (e, { cart: { order: n }, session: t }, r) => {
|
|
2252
|
+
const i = oi(
|
|
2190
2253
|
r.headers.cookie,
|
|
2191
2254
|
"checkout.vtex.com"
|
|
2192
2255
|
), {
|
|
@@ -2199,51 +2262,51 @@ const We = (e) => {
|
|
|
2199
2262
|
channel: r.storage.channel,
|
|
2200
2263
|
preserveSalesChannel: !!u
|
|
2201
2264
|
}), g = d.orderFormId;
|
|
2202
|
-
d.messages.length !== 0 && await
|
|
2203
|
-
const f =
|
|
2204
|
-
if (
|
|
2205
|
-
const
|
|
2265
|
+
d.messages.length !== 0 && await ai(g, r);
|
|
2266
|
+
const f = Z(r?.headers?.cookie ?? "")?.vtex_session, h = x(f), { acceptedOffer: v, shouldSplitItem: l } = n;
|
|
2267
|
+
if (ii(d, h)) {
|
|
2268
|
+
const b = Ke(
|
|
2206
2269
|
r,
|
|
2207
2270
|
d
|
|
2208
|
-
), N = await
|
|
2271
|
+
), N = await Ye(
|
|
2209
2272
|
d,
|
|
2210
2273
|
a,
|
|
2211
2274
|
h
|
|
2212
|
-
).then(
|
|
2275
|
+
).then(Xe);
|
|
2213
2276
|
if (g)
|
|
2214
|
-
return
|
|
2277
|
+
return be(
|
|
2215
2278
|
N,
|
|
2216
2279
|
o,
|
|
2217
2280
|
l,
|
|
2218
|
-
|
|
2281
|
+
b
|
|
2219
2282
|
);
|
|
2220
2283
|
}
|
|
2221
|
-
const m =
|
|
2284
|
+
const m = Ke(
|
|
2222
2285
|
r,
|
|
2223
2286
|
d
|
|
2224
|
-
), S =
|
|
2225
|
-
(
|
|
2226
|
-
const
|
|
2227
|
-
if (!
|
|
2228
|
-
return
|
|
2229
|
-
const [te, ...
|
|
2230
|
-
if (
|
|
2231
|
-
return
|
|
2232
|
-
const
|
|
2233
|
-
return
|
|
2287
|
+
), S = Ge(v), O = Ge(d.items.map(le)), w = Array.from(O.entries()), C = Array.from(S.entries()), { itemsToAdd: k, itemsToUpdate: I } = C.reduce(
|
|
2288
|
+
(b, [N, _e]) => {
|
|
2289
|
+
const ke = O.get(N);
|
|
2290
|
+
if (!ke)
|
|
2291
|
+
return _e.forEach((H) => b.itemsToAdd.push(H)), b;
|
|
2292
|
+
const [te, ...Mn] = ke;
|
|
2293
|
+
if (Tn(d.items, te.itemOffered.sku) || kn(d.items, te.itemOffered.sku))
|
|
2294
|
+
return b.itemsToUpdate.push(te), b;
|
|
2295
|
+
const zn = _e.reduce((H, Vn) => H + Vn.quantity, 0);
|
|
2296
|
+
return b.itemsToUpdate.push({
|
|
2234
2297
|
...te,
|
|
2235
|
-
quantity:
|
|
2236
|
-
}),
|
|
2298
|
+
quantity: zn
|
|
2299
|
+
}), Mn.forEach((H) => b.itemsToUpdate.push({ ...H, quantity: 0 })), b;
|
|
2237
2300
|
},
|
|
2238
2301
|
{
|
|
2239
2302
|
itemsToAdd: [],
|
|
2240
2303
|
itemsToUpdate: []
|
|
2241
2304
|
}
|
|
2242
|
-
), D = w.filter(([
|
|
2243
|
-
|
|
2244
|
-
), { updateShipping:
|
|
2245
|
-
if (A.length === 0 && !
|
|
2246
|
-
return
|
|
2305
|
+
), D = w.filter(([b]) => !S.has(b)).flatMap(([, b]) => b.map((N) => ({ ...N, quantity: 0 }))), A = [...k, ...I, ...D].map(
|
|
2306
|
+
ti
|
|
2307
|
+
), { updateShipping: E } = t ? Pn(d, t) : { updateShipping: !1 };
|
|
2308
|
+
if (A.length === 0 && !E)
|
|
2309
|
+
return Qe(
|
|
2247
2310
|
d,
|
|
2248
2311
|
o,
|
|
2249
2312
|
l,
|
|
@@ -2255,15 +2318,15 @@ const We = (e) => {
|
|
|
2255
2318
|
orderItems: A,
|
|
2256
2319
|
shouldSplitItem: l
|
|
2257
2320
|
}).then(
|
|
2258
|
-
(
|
|
2259
|
-
) : P = await
|
|
2321
|
+
(b) => Je(b, t, r)
|
|
2322
|
+
) : P = await Je(
|
|
2260
2323
|
d,
|
|
2261
2324
|
t,
|
|
2262
2325
|
r
|
|
2263
|
-
), P = await Promise.resolve(P).then((
|
|
2326
|
+
), P = await Promise.resolve(P).then((b) => {
|
|
2264
2327
|
if (t?.marketingData) {
|
|
2265
2328
|
const N = {
|
|
2266
|
-
...
|
|
2329
|
+
...b.marketingData,
|
|
2267
2330
|
...t.marketingData
|
|
2268
2331
|
};
|
|
2269
2332
|
return a.checkout.marketingData({
|
|
@@ -2271,67 +2334,67 @@ const We = (e) => {
|
|
|
2271
2334
|
marketingData: N
|
|
2272
2335
|
});
|
|
2273
2336
|
}
|
|
2274
|
-
return
|
|
2275
|
-
}).then((
|
|
2276
|
-
id:
|
|
2337
|
+
return b;
|
|
2338
|
+
}).then((b) => c && b.clientPreferencesData?.locale !== c ? a.checkout.clientPreferencesData({
|
|
2339
|
+
id: b.orderFormId,
|
|
2277
2340
|
clientPreferencesData: {
|
|
2278
|
-
...
|
|
2341
|
+
...b.clientPreferencesData,
|
|
2279
2342
|
locale: c
|
|
2280
2343
|
}
|
|
2281
|
-
}) :
|
|
2344
|
+
}) : b).then((b) => Ye(b, a, h)).then(Xe);
|
|
2282
2345
|
const R = Ae(
|
|
2283
2346
|
d.messages,
|
|
2284
2347
|
P.messages
|
|
2285
2348
|
);
|
|
2286
|
-
return
|
|
2349
|
+
return ri(n, P) && R ? Qe(
|
|
2287
2350
|
P,
|
|
2288
2351
|
o,
|
|
2289
2352
|
l,
|
|
2290
2353
|
m
|
|
2291
|
-
) :
|
|
2354
|
+
) : be(
|
|
2292
2355
|
P,
|
|
2293
2356
|
o,
|
|
2294
2357
|
l,
|
|
2295
2358
|
m
|
|
2296
2359
|
);
|
|
2297
2360
|
};
|
|
2298
|
-
function
|
|
2361
|
+
function ci(e, n, t, r) {
|
|
2299
2362
|
const i = e.hasOnlyDefaultSalesChannel === !1, a = n ?? void 0, o = t ?? e.regionId;
|
|
2300
|
-
return
|
|
2363
|
+
return ne.stringify({
|
|
2301
2364
|
salesChannel: i ? e.salesChannel || a : a ?? e.salesChannel,
|
|
2302
2365
|
regionId: o ?? void 0,
|
|
2303
2366
|
seller: r,
|
|
2304
2367
|
hasOnlyDefaultSalesChannel: i ? !1 : !a
|
|
2305
2368
|
});
|
|
2306
2369
|
}
|
|
2307
|
-
const
|
|
2370
|
+
const li = (e) => {
|
|
2308
2371
|
const n = (e?.corporateName ?? "").trim();
|
|
2309
2372
|
return n || (e?.firstName ?? "").trim();
|
|
2310
|
-
},
|
|
2373
|
+
}, di = (e) => {
|
|
2311
2374
|
if (!e || typeof e != "object")
|
|
2312
2375
|
return !1;
|
|
2313
2376
|
const n = e;
|
|
2314
2377
|
return typeof n.customerId == "string" && n.customerId.trim() !== "" && typeof n.contractName == "string" && typeof n.isActive == "boolean" && typeof n.isCurrent == "boolean";
|
|
2315
|
-
},
|
|
2378
|
+
}, ui = (e) => {
|
|
2316
2379
|
const n = e?.availableContracts?.value;
|
|
2317
|
-
return Array.isArray(n) ? n.filter(
|
|
2318
|
-
},
|
|
2380
|
+
return Array.isArray(n) ? n.filter(di) : [];
|
|
2381
|
+
}, pi = (e) => e?.customerId ? !!((e.contractName ?? "").trim() && e.isActive) : !1, Ze = (e) => e?.namespaces?.shopper?.activeContractId?.value?.trim() ?? e?.namespaces?.authentication?.customerId?.value?.trim() ?? e?.namespaces?.profile?.id?.value?.trim() ?? "", gi = (e) => {
|
|
2319
2382
|
if (!Array.isArray(e) || e.length === 0) return "";
|
|
2320
2383
|
const n = e.find((t) => t?.isDefault === !0) ?? e[0];
|
|
2321
2384
|
return String(n?.id ?? "").trim();
|
|
2322
|
-
},
|
|
2385
|
+
}, mi = (e, n = "", t = "") => {
|
|
2323
2386
|
const r = n.trim(), i = t.trim();
|
|
2324
|
-
return e.filter(
|
|
2387
|
+
return e.filter(pi).map((a) => ({
|
|
2325
2388
|
id: a.customerId,
|
|
2326
2389
|
corporateName: a.contractName.trim(),
|
|
2327
2390
|
isActive: r ? a.customerId === r : a.isCurrent,
|
|
2328
2391
|
isDefault: i !== "" && a.customerId === i
|
|
2329
2392
|
}));
|
|
2330
|
-
},
|
|
2331
|
-
const t =
|
|
2393
|
+
}, Rn = (e, n) => {
|
|
2394
|
+
const t = li(e);
|
|
2332
2395
|
return t || (n?.firstName?.value ?? "").trim();
|
|
2333
2396
|
};
|
|
2334
|
-
async function
|
|
2397
|
+
async function hi(e, n, t) {
|
|
2335
2398
|
try {
|
|
2336
2399
|
const r = await e.commerce.checkout.address({
|
|
2337
2400
|
postalCode: t,
|
|
@@ -2348,7 +2411,7 @@ async function ei(e, n, t) {
|
|
|
2348
2411
|
), r;
|
|
2349
2412
|
}
|
|
2350
2413
|
}
|
|
2351
|
-
function
|
|
2414
|
+
function fi(e, n, t, r, i, a) {
|
|
2352
2415
|
const o = new URLSearchParams(e);
|
|
2353
2416
|
return o.has("facets") && o.delete("facets"), o.set("sc", o.get("sc") ?? n.salesChannel), t && o.set("postalCode", t), r && o.set("country", r), i && o.set(
|
|
2354
2417
|
"geoCoordinates",
|
|
@@ -2356,7 +2419,7 @@ function ni(e, n, t, r, i, a) {
|
|
|
2356
2419
|
// long,lat is the format expected
|
|
2357
2420
|
), o.set("locale", a), o;
|
|
2358
2421
|
}
|
|
2359
|
-
function
|
|
2422
|
+
function Si(e, n) {
|
|
2360
2423
|
return {
|
|
2361
2424
|
utmCampaign: e.get("utm_campaign") ?? n?.utmCampaign ?? "",
|
|
2362
2425
|
utmMedium: e.get("utm_medium") ?? n?.utmMedium ?? "",
|
|
@@ -2366,8 +2429,8 @@ function ti(e, n) {
|
|
|
2366
2429
|
utmiPart: e.get("utmi_pc") ?? n?.utmiPart ?? ""
|
|
2367
2430
|
};
|
|
2368
2431
|
}
|
|
2369
|
-
async function
|
|
2370
|
-
const r =
|
|
2432
|
+
async function yi(e, n, t) {
|
|
2433
|
+
const r = x(L(n ?? "", t));
|
|
2371
2434
|
let i = !1;
|
|
2372
2435
|
if (r)
|
|
2373
2436
|
try {
|
|
@@ -2381,7 +2444,7 @@ async function ri(e, n, t) {
|
|
|
2381
2444
|
unitId: i ? r?.unitId : void 0
|
|
2382
2445
|
};
|
|
2383
2446
|
}
|
|
2384
|
-
async function
|
|
2447
|
+
async function Ii(e, n, t, r, i, a) {
|
|
2385
2448
|
return !n.seller || !(t || r) ? void 0 : (await e.commerce.checkout.region({
|
|
2386
2449
|
postalCode: t,
|
|
2387
2450
|
geoCoordinates: r,
|
|
@@ -2389,13 +2452,13 @@ async function ii(e, n, t, r, i, a) {
|
|
|
2389
2452
|
salesChannel: a
|
|
2390
2453
|
}))?.[0]?.sellers.find((c) => n.seller === c.id)?.id;
|
|
2391
2454
|
}
|
|
2392
|
-
function
|
|
2455
|
+
function en(e) {
|
|
2393
2456
|
return typeof e?.value == "string" ? e.value : "";
|
|
2394
2457
|
}
|
|
2395
|
-
function
|
|
2458
|
+
function vi(e) {
|
|
2396
2459
|
if (!e.isRepresentative)
|
|
2397
2460
|
return null;
|
|
2398
|
-
const n =
|
|
2461
|
+
const n = en(e.shopper?.firstName), t = en(e.shopper?.lastName);
|
|
2399
2462
|
return {
|
|
2400
2463
|
isRepresentative: !0,
|
|
2401
2464
|
customerId: e.authentication?.customerId?.value ?? e.customerId ?? "",
|
|
@@ -2406,11 +2469,11 @@ function ai(e) {
|
|
|
2406
2469
|
userName: `${n} ${t}`.trim(),
|
|
2407
2470
|
userEmail: e.authentication?.storeUserEmail?.value ?? "",
|
|
2408
2471
|
savedPostalCode: e.publicData?.postalCode?.value ?? "",
|
|
2409
|
-
contractName:
|
|
2472
|
+
contractName: Rn(e.contract, e.profile),
|
|
2410
2473
|
organizationManager: e.shopper?.organizationManager?.value ?? !1
|
|
2411
2474
|
};
|
|
2412
2475
|
}
|
|
2413
|
-
function
|
|
2476
|
+
function Oi(e) {
|
|
2414
2477
|
return e?.id ? {
|
|
2415
2478
|
id: e.id?.value ?? "",
|
|
2416
2479
|
email: e.email?.value ?? "",
|
|
@@ -2418,29 +2481,29 @@ function oi(e) {
|
|
|
2418
2481
|
familyName: e.lastName?.value ?? ""
|
|
2419
2482
|
} : null;
|
|
2420
2483
|
}
|
|
2421
|
-
const
|
|
2422
|
-
const o =
|
|
2484
|
+
const bi = async (e, { session: n, search: t }, { clients: r, headers: i, account: a }) => {
|
|
2485
|
+
const o = ne.parse(n.channel ?? ""), s = String(n.postalCode ?? ""), c = n.country ?? "";
|
|
2423
2486
|
let u = n.city ?? null, d = n.geoCoordinates ?? null;
|
|
2424
2487
|
if ((!u || !d) && s !== "" && c !== "") {
|
|
2425
|
-
const P = await
|
|
2488
|
+
const P = await hi(
|
|
2426
2489
|
r,
|
|
2427
2490
|
c,
|
|
2428
2491
|
s
|
|
2429
2492
|
);
|
|
2430
2493
|
u = P.city, d = P.geoCoordinates;
|
|
2431
2494
|
}
|
|
2432
|
-
const f =
|
|
2495
|
+
const f = fi(
|
|
2433
2496
|
t,
|
|
2434
2497
|
o,
|
|
2435
2498
|
s,
|
|
2436
2499
|
c,
|
|
2437
2500
|
d,
|
|
2438
2501
|
n.locale
|
|
2439
|
-
), h =
|
|
2502
|
+
), h = Si(f, n.marketingData), { isRepresentative: v, customerId: l, unitId: p } = await yi(
|
|
2440
2503
|
r,
|
|
2441
2504
|
i?.cookie,
|
|
2442
2505
|
a
|
|
2443
|
-
), m = await r.commerce.session(f.toString()).catch(() => null), S = m?.namespaces.profile ?? null, O = m?.namespaces.shopper ?? null, w = m?.namespaces.store ?? null,
|
|
2506
|
+
), m = await r.commerce.session(f.toString()).catch(() => null), S = m?.namespaces.profile ?? null, O = m?.namespaces.shopper ?? null, w = m?.namespaces.store ?? null, C = m?.namespaces.authentication ?? null, k = m?.namespaces.checkout ?? null, I = m?.namespaces.public ?? null;
|
|
2444
2507
|
let D = null;
|
|
2445
2508
|
if (v && S?.id?.value)
|
|
2446
2509
|
try {
|
|
@@ -2453,24 +2516,24 @@ const si = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2453
2516
|
`
|
|
2454
2517
|
);
|
|
2455
2518
|
}
|
|
2456
|
-
const A = await
|
|
2519
|
+
const A = await Ii(
|
|
2457
2520
|
r,
|
|
2458
2521
|
o,
|
|
2459
2522
|
s,
|
|
2460
2523
|
d,
|
|
2461
2524
|
c,
|
|
2462
2525
|
f.get("sc") ?? o.salesChannel
|
|
2463
|
-
),
|
|
2526
|
+
), E = {
|
|
2464
2527
|
...n,
|
|
2465
2528
|
currency: {
|
|
2466
2529
|
code: w?.currencyCode?.value ?? n.currency.code,
|
|
2467
2530
|
symbol: w?.currencySymbol?.value ?? n.currency.symbol
|
|
2468
2531
|
},
|
|
2469
2532
|
country: w?.countryCode?.value ?? c,
|
|
2470
|
-
channel:
|
|
2533
|
+
channel: ci(
|
|
2471
2534
|
o,
|
|
2472
2535
|
w?.channel?.value,
|
|
2473
|
-
|
|
2536
|
+
k?.regionId?.value,
|
|
2474
2537
|
A
|
|
2475
2538
|
),
|
|
2476
2539
|
/**
|
|
@@ -2479,9 +2542,9 @@ const si = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2479
2542
|
* - Unit data: `authentication` namespace
|
|
2480
2543
|
* - Contract data: `profile` namespace (those info will be available inside Faststore's Session `person` object)
|
|
2481
2544
|
*/
|
|
2482
|
-
b2b:
|
|
2545
|
+
b2b: vi({
|
|
2483
2546
|
isRepresentative: v,
|
|
2484
|
-
authentication:
|
|
2547
|
+
authentication: C,
|
|
2485
2548
|
shopper: O,
|
|
2486
2549
|
publicData: I,
|
|
2487
2550
|
profile: S,
|
|
@@ -2490,42 +2553,42 @@ const si = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
|
|
|
2490
2553
|
unitId: p
|
|
2491
2554
|
}),
|
|
2492
2555
|
marketingData: h,
|
|
2493
|
-
person:
|
|
2556
|
+
person: Oi(S),
|
|
2494
2557
|
geoCoordinates: d?.latitude && d?.longitude && d || null,
|
|
2495
2558
|
city: u
|
|
2496
2559
|
};
|
|
2497
|
-
return Ae(n,
|
|
2498
|
-
},
|
|
2499
|
-
validateCart:
|
|
2500
|
-
validateSession:
|
|
2501
|
-
subscribeToNewsletter:
|
|
2502
|
-
cancelOrder:
|
|
2503
|
-
processOrderAuthorization:
|
|
2504
|
-
uploadFileToOrderEntry:
|
|
2505
|
-
startOrderEntryOperation:
|
|
2506
|
-
startRecommendationSession:
|
|
2560
|
+
return Ae(n, E) ? null : E;
|
|
2561
|
+
}, Ci = {
|
|
2562
|
+
validateCart: si,
|
|
2563
|
+
validateSession: bi,
|
|
2564
|
+
subscribeToNewsletter: Fr,
|
|
2565
|
+
cancelOrder: _r,
|
|
2566
|
+
processOrderAuthorization: Tr,
|
|
2567
|
+
uploadFileToOrderEntry: Nr,
|
|
2568
|
+
startOrderEntryOperation: Ur,
|
|
2569
|
+
startRecommendationSession: Rr
|
|
2507
2570
|
};
|
|
2508
|
-
var
|
|
2571
|
+
var Ce;
|
|
2509
2572
|
(function(e) {
|
|
2510
2573
|
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";
|
|
2511
|
-
})(
|
|
2512
|
-
const
|
|
2513
|
-
function
|
|
2574
|
+
})(Ce || (Ce = {}));
|
|
2575
|
+
const wi = (e) => typeof e == "string" ? Fn(e) : null;
|
|
2576
|
+
function Fn(e) {
|
|
2514
2577
|
try {
|
|
2515
2578
|
return JSON.parse(e);
|
|
2516
2579
|
} catch {
|
|
2517
2580
|
return e;
|
|
2518
2581
|
}
|
|
2519
2582
|
}
|
|
2520
|
-
const
|
|
2583
|
+
const Di = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Ai = new jn({
|
|
2521
2584
|
name: "ObjectOrString",
|
|
2522
2585
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2523
|
-
parseValue:
|
|
2524
|
-
serialize:
|
|
2586
|
+
parseValue: wi,
|
|
2587
|
+
serialize: Di,
|
|
2525
2588
|
parseLiteral(e) {
|
|
2526
|
-
return e.kind ===
|
|
2589
|
+
return e.kind === Ce.STRING ? Fn(e.value) : null;
|
|
2527
2590
|
}
|
|
2528
|
-
}), T = (e) => "Price" in e && "seller" in e && "product" in e, U = (e) => "skuName" in e,
|
|
2591
|
+
}), T = (e) => "Price" in e && "seller" in e && "product" in e, U = (e) => "skuName" in e, Pi = {
|
|
2529
2592
|
priceCurrency: async (e, n, t) => {
|
|
2530
2593
|
const {
|
|
2531
2594
|
loaders: { salesChannelLoader: r },
|
|
@@ -2535,33 +2598,34 @@ const di = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2535
2598
|
},
|
|
2536
2599
|
priceValidUntil: (e) => T(e) ? e.PriceValidUntil ?? "" : U(e) ? e.priceValidUntil ?? "" : null,
|
|
2537
2600
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2538
|
-
availability: async (e) => T(e) ?
|
|
2601
|
+
availability: async (e) => T(e) ? Me(B(e)) : U(e) ? Me(mr(e.availability)) : null,
|
|
2539
2602
|
seller: (e, n, t) => T(e) ? {
|
|
2540
2603
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2541
2604
|
} : U(e) ? {
|
|
2542
2605
|
identifier: e.seller
|
|
2543
2606
|
} : null,
|
|
2544
|
-
price: (e) => T(e) ?
|
|
2545
|
-
priceWithTaxes: (e) => T(e) ?
|
|
2607
|
+
price: (e) => T(e) ? W(e) : U(e) ? e.sellingPrice / 100 : null,
|
|
2608
|
+
priceWithTaxes: (e) => T(e) ? q(W(e), e?.Tax, e.product.unitMultiplier) : U(e) ? q(
|
|
2546
2609
|
e.sellingPrice / 100,
|
|
2547
2610
|
e.tax / 100,
|
|
2548
2611
|
e.unitMultiplier
|
|
2549
2612
|
) : null,
|
|
2550
|
-
sellingPrice: (e) => T(e) ?
|
|
2613
|
+
sellingPrice: (e) => T(e) ? gr(e) : U(e) ? e.sellingPrice / 100 : null,
|
|
2551
2614
|
listPrice: (e) => T(e) ? e.ListPrice ?? 0 : U(e) ? e.listPrice / 100 : null,
|
|
2552
|
-
listPriceWithTaxes: (e) => T(e) ?
|
|
2615
|
+
listPriceWithTaxes: (e) => T(e) ? q(
|
|
2553
2616
|
e.ListPrice ?? 0,
|
|
2554
2617
|
e?.Tax,
|
|
2555
2618
|
e.product.unitMultiplier
|
|
2556
|
-
) : U(e) ?
|
|
2619
|
+
) : U(e) ? q(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
|
|
2557
2620
|
itemOffered: (e) => T(e) ? e.product : U(e) ? {
|
|
2558
2621
|
...e.product,
|
|
2559
|
-
attachmentsValues: e.attachments
|
|
2622
|
+
attachmentsValues: e.attachments,
|
|
2623
|
+
servicesValues: e.bundleItems ?? []
|
|
2560
2624
|
} : null,
|
|
2561
2625
|
quantity: (e) => T(e) ? e.AvailableQuantity ?? 0 : U(e) ? e.quantity : null,
|
|
2562
2626
|
isGift: (e) => U(e) ? e.isGift ?? !1 : null,
|
|
2563
2627
|
priceToken: (e) => T(e) ? e.PriceToken ?? null : null
|
|
2564
|
-
},
|
|
2628
|
+
}, Ei = ({ linkText: e }) => `/${e}/p`, _i = ({
|
|
2565
2629
|
offer: e,
|
|
2566
2630
|
seller: n,
|
|
2567
2631
|
product: t
|
|
@@ -2569,26 +2633,26 @@ const di = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2569
2633
|
...e,
|
|
2570
2634
|
product: t,
|
|
2571
2635
|
seller: n
|
|
2572
|
-
}),
|
|
2573
|
-
if (!
|
|
2636
|
+
}), ki = 1e11, Ti = (e) => /^\d+$/.test(e), Ui = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/, Ri = (e) => {
|
|
2637
|
+
if (!Ti(e))
|
|
2574
2638
|
return new Date(
|
|
2575
|
-
|
|
2639
|
+
Ui.test(e) ? `${e}Z` : e
|
|
2576
2640
|
);
|
|
2577
2641
|
const n = Number(e);
|
|
2578
|
-
return new Date(n >=
|
|
2579
|
-
},
|
|
2642
|
+
return new Date(n >= ki ? n : n * 1e3);
|
|
2643
|
+
}, Fi = (e) => {
|
|
2580
2644
|
if (e == null)
|
|
2581
2645
|
return "";
|
|
2582
2646
|
const n = String(e).trim();
|
|
2583
2647
|
if (n === "")
|
|
2584
2648
|
return "";
|
|
2585
|
-
const t =
|
|
2649
|
+
const t = Ri(n);
|
|
2586
2650
|
return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
|
|
2587
|
-
},
|
|
2651
|
+
}, Ni = {
|
|
2588
2652
|
imageText: "image",
|
|
2589
2653
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2590
2654
|
imageLabel: "label"
|
|
2591
|
-
}, ae = (e, n) => `${e}-${n}`,
|
|
2655
|
+
}, ae = (e, n) => `${e}-${n}`, nn = (e, n) => `/${ae(e, n)}/p`, Li = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2592
2656
|
function we(e) {
|
|
2593
2657
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2594
2658
|
}
|
|
@@ -2617,10 +2681,10 @@ async function oe(e, n, t) {
|
|
|
2617
2681
|
})();
|
|
2618
2682
|
return i.set(r, o), o;
|
|
2619
2683
|
}
|
|
2620
|
-
const
|
|
2684
|
+
const Bi = (e, n) => {
|
|
2621
2685
|
const t = e.findIndex((r) => we(r).split("/").at(-1) === n);
|
|
2622
2686
|
return t < 0 ? 0 : t;
|
|
2623
|
-
},
|
|
2687
|
+
}, $i = {
|
|
2624
2688
|
productID: ({ itemId: e }) => e,
|
|
2625
2689
|
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2626
2690
|
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => ae(e, n),
|
|
@@ -2628,7 +2692,7 @@ const Ci = (e, n) => {
|
|
|
2628
2692
|
seo: ({ isVariantOf: e }) => ({
|
|
2629
2693
|
title: e.productTitle || e.productName,
|
|
2630
2694
|
description: e.metaTagDescription || e.description,
|
|
2631
|
-
canonical:
|
|
2695
|
+
canonical: Ei(e)
|
|
2632
2696
|
}),
|
|
2633
2697
|
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2634
2698
|
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
@@ -2643,8 +2707,8 @@ const Ci = (e, n) => {
|
|
|
2643
2707
|
productId: c
|
|
2644
2708
|
},
|
|
2645
2709
|
itemId: u
|
|
2646
|
-
} = e, d =
|
|
2647
|
-
if (
|
|
2710
|
+
} = e, d = Bi(s, o), g = r[d], f = we(g).split("/"), h = t.storage.locale;
|
|
2711
|
+
if (j(t) && h) {
|
|
2648
2712
|
const v = await oe(t, c, h);
|
|
2649
2713
|
if (v) {
|
|
2650
2714
|
const l = new Set(
|
|
@@ -2664,7 +2728,7 @@ const Ci = (e, n) => {
|
|
|
2664
2728
|
})),
|
|
2665
2729
|
{
|
|
2666
2730
|
name: i,
|
|
2667
|
-
item:
|
|
2731
|
+
item: nn(v.linkId, u),
|
|
2668
2732
|
position: f.length + 1
|
|
2669
2733
|
}
|
|
2670
2734
|
],
|
|
@@ -2684,7 +2748,7 @@ const Ci = (e, n) => {
|
|
|
2684
2748
|
}),
|
|
2685
2749
|
{
|
|
2686
2750
|
name: i,
|
|
2687
|
-
item:
|
|
2751
|
+
item: nn(a, u),
|
|
2688
2752
|
position: f.length + 1
|
|
2689
2753
|
}
|
|
2690
2754
|
],
|
|
@@ -2692,7 +2756,7 @@ const Ci = (e, n) => {
|
|
|
2692
2756
|
};
|
|
2693
2757
|
},
|
|
2694
2758
|
image: ({ images: e }, n) => {
|
|
2695
|
-
const t = (
|
|
2759
|
+
const t = (Li(e) ?? [Ni]).map(
|
|
2696
2760
|
({ imageUrl: s, imageText: c, imageLabel: u }) => ({
|
|
2697
2761
|
alternateName: c ?? "",
|
|
2698
2762
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
@@ -2715,43 +2779,45 @@ const Ci = (e, n) => {
|
|
|
2715
2779
|
review: () => [],
|
|
2716
2780
|
aggregateRating: () => ({}),
|
|
2717
2781
|
offers: (e) => e.sellers.map(
|
|
2718
|
-
(n) =>
|
|
2782
|
+
(n) => _i({
|
|
2719
2783
|
offer: n.commertialOffer,
|
|
2720
2784
|
seller: n,
|
|
2721
2785
|
product: e
|
|
2722
2786
|
})
|
|
2723
|
-
).sort(
|
|
2787
|
+
).sort(In),
|
|
2724
2788
|
isVariantOf: (e) => e,
|
|
2725
2789
|
additionalProperty: ({
|
|
2726
2790
|
// Search uses the name variations for specifications
|
|
2727
2791
|
variations: e = [],
|
|
2728
2792
|
attachmentsValues: n = [],
|
|
2729
|
-
attributes: t = []
|
|
2793
|
+
attributes: t = [],
|
|
2794
|
+
servicesValues: r = []
|
|
2730
2795
|
}) => {
|
|
2731
|
-
const
|
|
2732
|
-
({ name:
|
|
2733
|
-
name:
|
|
2734
|
-
value:
|
|
2735
|
-
valueReference:
|
|
2796
|
+
const i = e.flatMap(
|
|
2797
|
+
({ name: c, values: u }) => u.map((d) => ({
|
|
2798
|
+
name: c,
|
|
2799
|
+
value: d,
|
|
2800
|
+
valueReference: M.specification
|
|
2736
2801
|
}))
|
|
2737
|
-
),
|
|
2738
|
-
|
|
2739
|
-
),
|
|
2802
|
+
), a = n.map(
|
|
2803
|
+
Cn
|
|
2804
|
+
), o = t.map(Br), s = r.map(Ee);
|
|
2740
2805
|
return [
|
|
2741
|
-
...r,
|
|
2742
2806
|
...i,
|
|
2743
|
-
...a
|
|
2807
|
+
...a,
|
|
2808
|
+
...o,
|
|
2809
|
+
...s
|
|
2744
2810
|
];
|
|
2745
2811
|
},
|
|
2746
2812
|
hasSpecifications: ({ isVariantOf: e }) => !!e.skuSpecifications?.length,
|
|
2747
2813
|
skuSpecifications: ({ isVariantOf: { skuSpecifications: e } }) => e ?? [],
|
|
2748
2814
|
specificationGroups: ({ isVariantOf: { specificationGroups: e } }) => e,
|
|
2749
|
-
releaseDate: ({ isVariantOf: { releaseDate: e } }) =>
|
|
2815
|
+
releaseDate: ({ isVariantOf: { releaseDate: e } }) => Fi(e),
|
|
2750
2816
|
advertisement: ({ isVariantOf: { advertisement: e } }) => e,
|
|
2751
2817
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e,
|
|
2752
2818
|
otherLocales: async (e, n, t) => {
|
|
2753
|
-
if (!
|
|
2754
|
-
const r =
|
|
2819
|
+
if (!j(t)) return null;
|
|
2820
|
+
const r = kt(t);
|
|
2755
2821
|
if (r.length === 0) return null;
|
|
2756
2822
|
const i = e.isVariantOf.productId, a = e.itemId, o = t.storage.locale, s = await oe(t, i, o);
|
|
2757
2823
|
if (!s?.availableLinkIds) return null;
|
|
@@ -2762,8 +2828,8 @@ const Ci = (e, n) => {
|
|
|
2762
2828
|
}).filter((u) => u !== null);
|
|
2763
2829
|
},
|
|
2764
2830
|
defaultLocaleSlug: async (e, n, t) => {
|
|
2765
|
-
if (!
|
|
2766
|
-
const r =
|
|
2831
|
+
if (!j(t)) return null;
|
|
2832
|
+
const r = Tt(t);
|
|
2767
2833
|
if (!r) return null;
|
|
2768
2834
|
const { productId: i, linkText: a } = e.isVariantOf, o = e.itemId, c = (await oe(
|
|
2769
2835
|
t,
|
|
@@ -2772,25 +2838,25 @@ const Ci = (e, n) => {
|
|
|
2772
2838
|
))?.availableLinkIds?.[r] ?? a;
|
|
2773
2839
|
return ae(c, o);
|
|
2774
2840
|
}
|
|
2775
|
-
},
|
|
2841
|
+
}, Mi = /* @__PURE__ */ new Set(["allSpecifications"]), zi = {
|
|
2776
2842
|
hasVariant: (e) => e.isVariantOf.items.map((n) => F(n, e.isVariantOf)),
|
|
2777
2843
|
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
2778
2844
|
productClusters: ({ isVariantOf: e }) => e.productClusters ?? [],
|
|
2779
2845
|
name: (e) => e.isVariantOf.productName,
|
|
2780
2846
|
skuVariants: (e) => e,
|
|
2781
2847
|
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
2782
|
-
(n) => !
|
|
2848
|
+
(n) => !Mi.has(n.name)
|
|
2783
2849
|
).flatMap(
|
|
2784
2850
|
({ specifications: n }) => n.flatMap(
|
|
2785
2851
|
({ name: t, values: r }) => r.map((i) => ({
|
|
2786
2852
|
name: t,
|
|
2787
2853
|
value: i,
|
|
2788
|
-
valueReference:
|
|
2854
|
+
valueReference: M.specification
|
|
2789
2855
|
}))
|
|
2790
2856
|
)
|
|
2791
2857
|
)
|
|
2792
|
-
},
|
|
2793
|
-
propertyID: (e) => e.propertyID ||
|
|
2858
|
+
}, Vi = {
|
|
2859
|
+
propertyID: (e) => e.propertyID || wn(e),
|
|
2794
2860
|
name: ({ name: e }) => e,
|
|
2795
2861
|
value: ({ value: e }) => e,
|
|
2796
2862
|
valueReference: ({ valueReference: e }) => e
|
|
@@ -2802,20 +2868,20 @@ const Ci = (e, n) => {
|
|
|
2802
2868
|
}))
|
|
2803
2869
|
), t = Ie(
|
|
2804
2870
|
n,
|
|
2805
|
-
({ offer: r }, { offer: i }) =>
|
|
2871
|
+
({ offer: r }, { offer: i }) => In(r, i)
|
|
2806
2872
|
);
|
|
2807
2873
|
return t ? t.sku : e[0];
|
|
2808
|
-
},
|
|
2874
|
+
}, Nn = (e) => e !== "" && !Number.isNaN(Number(e)), xi = /^vrn:recommendations:[^:]+:[^:]+:[^:]+$/, qi = async (e, { campaignVrn: n, userId: t, products: r }, i) => {
|
|
2809
2875
|
const {
|
|
2810
2876
|
clients: { commerce: a }
|
|
2811
2877
|
} = i, { salesChannel: o } = i.storage.channel, s = n?.trim();
|
|
2812
|
-
if (!s || !
|
|
2813
|
-
throw new
|
|
2878
|
+
if (!s || !xi.test(s))
|
|
2879
|
+
throw new _(`Invalid campaignVrn: "${n}"`);
|
|
2814
2880
|
const c = t?.trim();
|
|
2815
2881
|
if (t != null && !c)
|
|
2816
|
-
throw new
|
|
2882
|
+
throw new _("Invalid userId: must be a non-empty string");
|
|
2817
2883
|
if (r != null && (!Array.isArray(r) || r.some((h) => !h?.trim())))
|
|
2818
|
-
throw new
|
|
2884
|
+
throw new _(
|
|
2819
2885
|
"Invalid products: must be an array of non-empty strings"
|
|
2820
2886
|
);
|
|
2821
2887
|
const u = await a.recommendation.recommendations({
|
|
@@ -2833,7 +2899,7 @@ const Ci = (e, n) => {
|
|
|
2833
2899
|
correlationId: g,
|
|
2834
2900
|
campaign: d
|
|
2835
2901
|
};
|
|
2836
|
-
},
|
|
2902
|
+
}, tn = {
|
|
2837
2903
|
price_desc: "price:desc",
|
|
2838
2904
|
price_asc: "price:asc",
|
|
2839
2905
|
orders_desc: "orders:desc",
|
|
@@ -2843,19 +2909,19 @@ const Ci = (e, n) => {
|
|
|
2843
2909
|
discount_desc: "discount:desc",
|
|
2844
2910
|
score_desc: ""
|
|
2845
2911
|
};
|
|
2846
|
-
function
|
|
2912
|
+
function ji(e, n) {
|
|
2847
2913
|
let t;
|
|
2848
|
-
if (Object.hasOwn(n, e) ? t = n[e] : Object.hasOwn(
|
|
2849
|
-
throw new
|
|
2914
|
+
if (Object.hasOwn(n, e) ? t = n[e] : Object.hasOwn(tn, e) && (t = tn[e]), t === void 0)
|
|
2915
|
+
throw new _(`Unknown sort value: ${e}`);
|
|
2850
2916
|
return t;
|
|
2851
2917
|
}
|
|
2852
|
-
const
|
|
2918
|
+
const Wi = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
2853
2919
|
if (!n)
|
|
2854
|
-
throw new
|
|
2920
|
+
throw new _("Missing operationId");
|
|
2855
2921
|
return t.orderEntry.getOperation({ operationId: n });
|
|
2856
|
-
},
|
|
2922
|
+
}, Hi = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
2857
2923
|
if (!n)
|
|
2858
|
-
throw new
|
|
2924
|
+
throw new _("Missing orderFormId");
|
|
2859
2925
|
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
2860
2926
|
return (r ?? []).map((i) => ({
|
|
2861
2927
|
id: i.id,
|
|
@@ -2869,19 +2935,19 @@ const Ei = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
|
2869
2935
|
unitMultiplier: i.unitMultiplier ?? 1
|
|
2870
2936
|
}));
|
|
2871
2937
|
};
|
|
2872
|
-
async function
|
|
2938
|
+
async function Gi(e, n, t, r) {
|
|
2873
2939
|
const i = n.slice(0, n.lastIndexOf("-"));
|
|
2874
2940
|
return (await oe(e, t, r))?.linkId === i;
|
|
2875
2941
|
}
|
|
2876
|
-
const
|
|
2877
|
-
async function
|
|
2942
|
+
const Ln = "Invalid SkuId", Bn = "Slug was set but the fetched sku does not satisfy the slug condition.", Xi = "UseAdHocCard", Yi = (e) => J(e) || e instanceof Error && (e.message === Ln || e.message.startsWith(Bn));
|
|
2943
|
+
async function Ji(e, n, t, r) {
|
|
2878
2944
|
const { linkText: i, productId: a } = n.isVariantOf;
|
|
2879
|
-
if (!(!t || !i || t.startsWith(i) ||
|
|
2880
|
-
throw new Error(`${
|
|
2945
|
+
if (!(!t || !i || t.startsWith(i) || j(e) && r && Nn(t.split("-").pop() ?? "") && await Gi(e, t, a, r)))
|
|
2946
|
+
throw new Error(`${Bn} slug: ${t}, linkText: ${i}`);
|
|
2881
2947
|
}
|
|
2882
|
-
async function
|
|
2948
|
+
async function Ki(e, n) {
|
|
2883
2949
|
if (n == null)
|
|
2884
|
-
throw new
|
|
2950
|
+
throw new _("Missing slug or id");
|
|
2885
2951
|
const {
|
|
2886
2952
|
clients: { commerce: t, search: r }
|
|
2887
2953
|
} = e, i = await t.catalog.portal.pagetype(`${n}/p`);
|
|
@@ -2895,23 +2961,23 @@ async function Li(e, n) {
|
|
|
2895
2961
|
throw new $(`No product found for id ${i.id}`);
|
|
2896
2962
|
return F(de(a.items), a);
|
|
2897
2963
|
}
|
|
2898
|
-
const
|
|
2964
|
+
const Qi = {
|
|
2899
2965
|
product: async (e, { locator: n }, t) => {
|
|
2900
|
-
const r =
|
|
2966
|
+
const r = We(n), i = je(n), a = wr(n), o = Cr(n);
|
|
2901
2967
|
r && ce(t, r), i && ve(t, i);
|
|
2902
2968
|
const {
|
|
2903
2969
|
loaders: { skuLoader: s }
|
|
2904
2970
|
} = t;
|
|
2905
2971
|
try {
|
|
2906
2972
|
const c = a ?? o?.split("-").pop() ?? "";
|
|
2907
|
-
if (!
|
|
2908
|
-
throw new Error(
|
|
2973
|
+
if (!Nn(c))
|
|
2974
|
+
throw new Error(Ln);
|
|
2909
2975
|
const u = await s.load(c);
|
|
2910
|
-
return await
|
|
2976
|
+
return await Ji(t, u, o, i), u;
|
|
2911
2977
|
} catch (c) {
|
|
2912
|
-
if (!
|
|
2978
|
+
if (!Yi(c))
|
|
2913
2979
|
throw c;
|
|
2914
|
-
return
|
|
2980
|
+
return Ki(t, o);
|
|
2915
2981
|
}
|
|
2916
2982
|
},
|
|
2917
2983
|
collection: (e, { slug: n }, t) => {
|
|
@@ -2920,7 +2986,7 @@ const Bi = {
|
|
|
2920
2986
|
} = t;
|
|
2921
2987
|
return r.load({
|
|
2922
2988
|
slug: n,
|
|
2923
|
-
locale:
|
|
2989
|
+
locale: hn(t)
|
|
2924
2990
|
});
|
|
2925
2991
|
},
|
|
2926
2992
|
search: async (e, {
|
|
@@ -2931,19 +2997,19 @@ const Bi = {
|
|
|
2931
2997
|
selectedFacets: a,
|
|
2932
2998
|
sponsoredCount: o
|
|
2933
2999
|
}, s) => {
|
|
2934
|
-
const c =
|
|
3000
|
+
const c = We(a), u = je(a), d = br(a);
|
|
2935
3001
|
c && ce(s, c), u && ve(s, u);
|
|
2936
3002
|
const g = t ? Number(t) : 0, f = {
|
|
2937
3003
|
page: Math.ceil(g / n) || 0,
|
|
2938
3004
|
count: n,
|
|
2939
3005
|
query: i ?? void 0,
|
|
2940
|
-
sort:
|
|
2941
|
-
selectedFacets: a?.flatMap(
|
|
3006
|
+
sort: ji(r ?? "score_desc", s.storage.customSortMap),
|
|
3007
|
+
selectedFacets: a?.flatMap(xe) ?? [],
|
|
2942
3008
|
sponsoredCount: o ?? void 0
|
|
2943
3009
|
};
|
|
2944
3010
|
if (d) {
|
|
2945
3011
|
const l = (await s.clients.commerce.catalog.products.crossselling({
|
|
2946
|
-
type:
|
|
3012
|
+
type: On[d.key],
|
|
2947
3013
|
productId: d.value
|
|
2948
3014
|
})).map((m) => m.productId).slice(0, n), p = s.clients.search.productsByIdentifier({ field: "id", values: l }).then((m) => ({
|
|
2949
3015
|
products: m,
|
|
@@ -3043,7 +3109,7 @@ const Bi = {
|
|
|
3043
3109
|
metaTagDescription: h.metaTagDescription,
|
|
3044
3110
|
availableLinkIds: null,
|
|
3045
3111
|
entityType: "brand"
|
|
3046
|
-
})), ...c].filter((h) => !!
|
|
3112
|
+
})), ...c].filter((h) => !!vn.slug(h, null, r, null));
|
|
3047
3113
|
return {
|
|
3048
3114
|
pageInfo: {
|
|
3049
3115
|
hasNextPage: f.length - a > n,
|
|
@@ -3078,7 +3144,7 @@ const Bi = {
|
|
|
3078
3144
|
page: 1,
|
|
3079
3145
|
count: 1,
|
|
3080
3146
|
query: n ?? void 0,
|
|
3081
|
-
selectedFacets: t?.flatMap(
|
|
3147
|
+
selectedFacets: t?.flatMap(xe) ?? [],
|
|
3082
3148
|
allowRedirect: !0
|
|
3083
3149
|
});
|
|
3084
3150
|
return {
|
|
@@ -3121,7 +3187,7 @@ const Bi = {
|
|
|
3121
3187
|
userOrder: async (e, { orderId: n }, t) => {
|
|
3122
3188
|
try {
|
|
3123
3189
|
if (!n)
|
|
3124
|
-
throw new
|
|
3190
|
+
throw new _("Missing orderId");
|
|
3125
3191
|
const {
|
|
3126
3192
|
clients: { commerce: r }
|
|
3127
3193
|
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
@@ -3130,7 +3196,7 @@ const Bi = {
|
|
|
3130
3196
|
let a = null;
|
|
3131
3197
|
try {
|
|
3132
3198
|
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
3133
|
-
a =
|
|
3199
|
+
a = bn(c);
|
|
3134
3200
|
} catch {
|
|
3135
3201
|
}
|
|
3136
3202
|
const s = (await r.masterData.getShopperById({
|
|
@@ -3169,7 +3235,7 @@ const Bi = {
|
|
|
3169
3235
|
a = { message: i };
|
|
3170
3236
|
}
|
|
3171
3237
|
const o = a?.message || i;
|
|
3172
|
-
throw
|
|
3238
|
+
throw J(r) ? new $(`No order found for id ${n}. ${o}.`) : ht(r) ? new K(
|
|
3173
3239
|
`You are forbidden to interact with order with id ${n}. ${o}.`
|
|
3174
3240
|
) : r;
|
|
3175
3241
|
}
|
|
@@ -3217,10 +3283,10 @@ const Bi = {
|
|
|
3217
3283
|
account: r,
|
|
3218
3284
|
headers: i,
|
|
3219
3285
|
clients: { commerce: a }
|
|
3220
|
-
} = t, s =
|
|
3286
|
+
} = t, s = x(L(i?.cookie ?? "", r))?.userId ?? "";
|
|
3221
3287
|
if (!s)
|
|
3222
3288
|
return !0;
|
|
3223
|
-
const c = await a.licenseManager.isResourceGranted({ userId: s, resourceKey:
|
|
3289
|
+
const c = await a.licenseManager.isResourceGranted({ userId: s, resourceKey: Xi }).catch(() => null);
|
|
3224
3290
|
return typeof c == "boolean" ? c : !0;
|
|
3225
3291
|
},
|
|
3226
3292
|
listUserQuotes: async (e, n, t) => {
|
|
@@ -3274,7 +3340,7 @@ const Bi = {
|
|
|
3274
3340
|
account: r,
|
|
3275
3341
|
headers: i,
|
|
3276
3342
|
clients: { commerce: a }
|
|
3277
|
-
} = t, s =
|
|
3343
|
+
} = t, s = x(L(i?.cookie ?? "", r))?.userId ?? "", [c, u, d] = await Promise.all([
|
|
3278
3344
|
a.session("").catch(() => null),
|
|
3279
3345
|
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
3280
3346
|
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
@@ -3295,14 +3361,14 @@ const Bi = {
|
|
|
3295
3361
|
account: r,
|
|
3296
3362
|
headers: i,
|
|
3297
3363
|
clients: { commerce: a }
|
|
3298
|
-
} = t, o =
|
|
3364
|
+
} = t, o = x(L(i?.cookie ?? "", r));
|
|
3299
3365
|
if (!o?.userId)
|
|
3300
3366
|
return null;
|
|
3301
3367
|
if (o?.isRepresentative) {
|
|
3302
3368
|
const c = await a.session("").catch(() => null);
|
|
3303
3369
|
if (!c)
|
|
3304
3370
|
return null;
|
|
3305
|
-
const u = c.namespaces.profile ?? null, d = c.namespaces.shopper ?? null, g = c.namespaces.authentication ?? null, f =
|
|
3371
|
+
const u = c.namespaces.profile ?? null, d = c.namespaces.shopper ?? null, g = c.namespaces.authentication ?? null, f = Ze(c) || o?.customerId?.trim() || "";
|
|
3306
3372
|
let h = null;
|
|
3307
3373
|
if (f)
|
|
3308
3374
|
try {
|
|
@@ -3315,7 +3381,7 @@ const Bi = {
|
|
|
3315
3381
|
}
|
|
3316
3382
|
const v = `${(d?.firstName?.value ?? "").trim()} ${(d?.lastName?.value ?? "").trim()}`.trim();
|
|
3317
3383
|
return {
|
|
3318
|
-
name:
|
|
3384
|
+
name: Rn(h, u) || v || "",
|
|
3319
3385
|
email: u?.email?.value || g?.storeUserEmail?.value || "",
|
|
3320
3386
|
id: u?.id?.value || g?.customerId?.value || o?.customerId?.trim() || ""
|
|
3321
3387
|
// createdAt: '',
|
|
@@ -3335,7 +3401,7 @@ const Bi = {
|
|
|
3335
3401
|
// Contract list from VTEX session `shopper.availableContracts`.
|
|
3336
3402
|
availableContracts: async (e, { orgUnitId: n }, t) => {
|
|
3337
3403
|
if (!n)
|
|
3338
|
-
throw new
|
|
3404
|
+
throw new _("Missing orgUnitId");
|
|
3339
3405
|
const {
|
|
3340
3406
|
account: r,
|
|
3341
3407
|
headers: i,
|
|
@@ -3343,22 +3409,22 @@ const Bi = {
|
|
|
3343
3409
|
} = t, o = await a.session("").catch(() => null), s = L(i?.cookie ?? "", r);
|
|
3344
3410
|
let c = null;
|
|
3345
3411
|
try {
|
|
3346
|
-
c = s ?
|
|
3412
|
+
c = s ? x(s) : null;
|
|
3347
3413
|
} catch {
|
|
3348
3414
|
c = null;
|
|
3349
3415
|
}
|
|
3350
3416
|
const u = o?.namespaces.authentication?.unitId?.value?.trim() ?? c?.unitId?.trim() ?? "";
|
|
3351
3417
|
if (!u || u !== n)
|
|
3352
|
-
throw new
|
|
3418
|
+
throw new K(
|
|
3353
3419
|
"You are not allowed to list contracts for this organization unit"
|
|
3354
3420
|
);
|
|
3355
|
-
const d =
|
|
3421
|
+
const d = ui(
|
|
3356
3422
|
o?.namespaces.shopper
|
|
3357
|
-
), g =
|
|
3423
|
+
), g = Ze(o) || c?.customerId?.trim() || "", f = await a.storeFront.attachedContracts(n).catch((v) => (console.warn(
|
|
3358
3424
|
"availableContracts: default contract lookup failed",
|
|
3359
3425
|
v
|
|
3360
|
-
), null)), h =
|
|
3361
|
-
return
|
|
3426
|
+
), null)), h = gi(f?.contracts);
|
|
3427
|
+
return mi(
|
|
3362
3428
|
d,
|
|
3363
3429
|
g,
|
|
3364
3430
|
h
|
|
@@ -3372,10 +3438,10 @@ const Bi = {
|
|
|
3372
3438
|
geoCoordinates: n
|
|
3373
3439
|
});
|
|
3374
3440
|
},
|
|
3375
|
-
orderEntryOperation:
|
|
3376
|
-
orderFormItems:
|
|
3377
|
-
recommendations:
|
|
3378
|
-
},
|
|
3441
|
+
orderEntryOperation: Wi,
|
|
3442
|
+
orderFormItems: Hi,
|
|
3443
|
+
recommendations: qi
|
|
3444
|
+
}, Zi = {
|
|
3379
3445
|
reviewRating: () => ({
|
|
3380
3446
|
ratingValue: 5,
|
|
3381
3447
|
bestRating: 5
|
|
@@ -3383,7 +3449,7 @@ const Bi = {
|
|
|
3383
3449
|
author: () => ({
|
|
3384
3450
|
name: ""
|
|
3385
3451
|
})
|
|
3386
|
-
},
|
|
3452
|
+
}, ea = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, na = {
|
|
3387
3453
|
suggestions: async (e, n, t) => {
|
|
3388
3454
|
const {
|
|
3389
3455
|
clients: { search: r }
|
|
@@ -3434,7 +3500,7 @@ const Bi = {
|
|
|
3434
3500
|
t.storage.searchArgs = e;
|
|
3435
3501
|
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;
|
|
3436
3502
|
return i.filter(
|
|
3437
|
-
(u) => !a || !
|
|
3503
|
+
(u) => !a || !ea(u, o, s)
|
|
3438
3504
|
);
|
|
3439
3505
|
},
|
|
3440
3506
|
metadata: async ({ productSearchPromise: e }) => {
|
|
@@ -3446,12 +3512,12 @@ const Bi = {
|
|
|
3446
3512
|
};
|
|
3447
3513
|
},
|
|
3448
3514
|
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
3449
|
-
},
|
|
3515
|
+
}, ta = {
|
|
3450
3516
|
title: ({ title: e }) => e ?? "",
|
|
3451
3517
|
description: ({ description: e }) => e ?? "",
|
|
3452
3518
|
canonical: ({ canonical: e }) => e ?? "",
|
|
3453
3519
|
titleTemplate: () => ""
|
|
3454
|
-
},
|
|
3520
|
+
}, ra = ["bd", "d", "h", "m"], ia = (e) => ra.includes(e), aa = {
|
|
3455
3521
|
bd: {
|
|
3456
3522
|
0: "Today",
|
|
3457
3523
|
1: "In 1 business day",
|
|
@@ -3472,29 +3538,29 @@ const Bi = {
|
|
|
3472
3538
|
1: "In 1 minute",
|
|
3473
3539
|
other: "Up to # minutes"
|
|
3474
3540
|
}
|
|
3475
|
-
},
|
|
3476
|
-
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i =
|
|
3541
|
+
}, $n = (e) => {
|
|
3542
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = ia(t);
|
|
3477
3543
|
if (!r || !i)
|
|
3478
3544
|
return "";
|
|
3479
3545
|
const a = Number(n) < 2 ? Number(n) : "other";
|
|
3480
|
-
return
|
|
3481
|
-
},
|
|
3546
|
+
return aa[t][a].replace("#", n) ?? "";
|
|
3547
|
+
}, oa = {
|
|
3482
3548
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
3483
3549
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
3484
|
-
localizedEstimates: (e) => e?.shippingEstimate ?
|
|
3485
|
-
},
|
|
3486
|
-
function
|
|
3487
|
-
const t = `${
|
|
3550
|
+
localizedEstimates: (e) => e?.shippingEstimate ? $n(e.shippingEstimate) : ""
|
|
3551
|
+
}, rn = "skuvariation";
|
|
3552
|
+
function an(e, n) {
|
|
3553
|
+
const t = `${rn}${n}`.toLowerCase(), r = e.find(
|
|
3488
3554
|
(a) => a.imageLabel === t
|
|
3489
3555
|
);
|
|
3490
3556
|
if (r)
|
|
3491
3557
|
return r;
|
|
3492
3558
|
const i = e.find(
|
|
3493
|
-
(a) => a.imageLabel ===
|
|
3559
|
+
(a) => a.imageLabel === rn
|
|
3494
3560
|
);
|
|
3495
3561
|
return i || e[0];
|
|
3496
3562
|
}
|
|
3497
|
-
function
|
|
3563
|
+
function sa(e, n, t) {
|
|
3498
3564
|
const r = {};
|
|
3499
3565
|
return e.forEach((i) => {
|
|
3500
3566
|
const a = i.variations;
|
|
@@ -3506,30 +3572,30 @@ function Hi(e, n, t) {
|
|
|
3506
3572
|
r[s] = `${t}-${i.itemId}`;
|
|
3507
3573
|
}), r;
|
|
3508
3574
|
}
|
|
3509
|
-
function
|
|
3575
|
+
function on(e) {
|
|
3510
3576
|
const n = {};
|
|
3511
3577
|
return e.forEach((t) => {
|
|
3512
3578
|
n[t.name] = t.values[0];
|
|
3513
3579
|
}), n;
|
|
3514
3580
|
}
|
|
3515
|
-
function
|
|
3581
|
+
function ca(e) {
|
|
3516
3582
|
const n = {};
|
|
3517
3583
|
return e?.forEach((t) => {
|
|
3518
3584
|
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
3519
3585
|
}), n;
|
|
3520
3586
|
}
|
|
3521
|
-
function
|
|
3587
|
+
function la(e, n) {
|
|
3522
3588
|
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
3523
3589
|
}
|
|
3524
|
-
function
|
|
3590
|
+
function da(e) {
|
|
3525
3591
|
const n = e;
|
|
3526
3592
|
for (const t in e)
|
|
3527
3593
|
e[t].every(
|
|
3528
3594
|
(i) => !Number.isNaN(Number(i.value))
|
|
3529
|
-
) && e[t].sort((i, a) =>
|
|
3595
|
+
) && e[t].sort((i, a) => la(i.value, a.value));
|
|
3530
3596
|
return n;
|
|
3531
3597
|
}
|
|
3532
|
-
function
|
|
3598
|
+
function ua(e, n, t) {
|
|
3533
3599
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
3534
3600
|
return e.forEach((a) => {
|
|
3535
3601
|
if (a.variations.length === 0)
|
|
@@ -3542,7 +3608,7 @@ function Ji(e, n, t) {
|
|
|
3542
3608
|
if (!o || i.has(c))
|
|
3543
3609
|
return;
|
|
3544
3610
|
i.add(c);
|
|
3545
|
-
const u =
|
|
3611
|
+
const u = an(
|
|
3546
3612
|
a.images,
|
|
3547
3613
|
n
|
|
3548
3614
|
), d = {
|
|
@@ -3559,7 +3625,7 @@ function Ji(e, n, t) {
|
|
|
3559
3625
|
if (i.has(u))
|
|
3560
3626
|
return;
|
|
3561
3627
|
i.add(u);
|
|
3562
|
-
const d =
|
|
3628
|
+
const d = an(
|
|
3563
3629
|
a.images,
|
|
3564
3630
|
c.name
|
|
3565
3631
|
), g = {
|
|
@@ -3570,40 +3636,40 @@ function Ji(e, n, t) {
|
|
|
3570
3636
|
};
|
|
3571
3637
|
r[c.name] ? r[c.name].push(g) : r[c.name] = [g];
|
|
3572
3638
|
});
|
|
3573
|
-
}),
|
|
3639
|
+
}), da(r);
|
|
3574
3640
|
}
|
|
3575
|
-
const
|
|
3576
|
-
activeVariations: (e) =>
|
|
3577
|
-
allVariantsByName: (e) =>
|
|
3578
|
-
slugsMap: (e, n) =>
|
|
3641
|
+
const pa = {
|
|
3642
|
+
activeVariations: (e) => on(e.variations),
|
|
3643
|
+
allVariantsByName: (e) => ca(e.isVariantOf.skuSpecifications),
|
|
3644
|
+
slugsMap: (e, n) => sa(
|
|
3579
3645
|
e.isVariantOf.items,
|
|
3580
3646
|
n.dominantVariantName ?? e.variations[0]?.name,
|
|
3581
3647
|
e.isVariantOf.linkText
|
|
3582
3648
|
),
|
|
3583
3649
|
availableVariations: (e, n) => {
|
|
3584
|
-
const t = n.dominantVariantName ?? e.variations[0]?.name, i =
|
|
3585
|
-
return
|
|
3650
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = on(e.variations)[t];
|
|
3651
|
+
return ua(
|
|
3586
3652
|
e.isVariantOf.items,
|
|
3587
3653
|
t,
|
|
3588
3654
|
i
|
|
3589
3655
|
);
|
|
3590
3656
|
},
|
|
3591
3657
|
allVariantProducts: (e) => e.isVariantOf.items.map((n) => F(n, e.isVariantOf))
|
|
3592
|
-
},
|
|
3658
|
+
}, ga = {
|
|
3593
3659
|
"pickup-in-point": "Pickup",
|
|
3594
3660
|
delivery: "Delivery",
|
|
3595
3661
|
pickup: "Pickup",
|
|
3596
3662
|
"take-away": "Take away",
|
|
3597
3663
|
"": ""
|
|
3598
|
-
},
|
|
3664
|
+
}, ma = {
|
|
3599
3665
|
deliveryOptionsData: (e) => {
|
|
3600
3666
|
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
|
|
3601
3667
|
(u, d) => {
|
|
3602
|
-
const g = d?.selectedSla || "", f = d?.selectedDeliveryChannel || d?.deliveryChannel || "", h = d?.deliveryCompany || "", v = d?.deliveryWindow, l = d?.pickupStoreInfo, p = d?.shippingEstimate || "", m = d?.shippingEstimate ?
|
|
3603
|
-
(
|
|
3604
|
-
), A = `${
|
|
3605
|
-
|
|
3606
|
-
), R = (
|
|
3668
|
+
const g = d?.selectedSla || "", f = d?.selectedDeliveryChannel || d?.deliveryChannel || "", h = d?.deliveryCompany || "", v = d?.deliveryWindow, l = d?.pickupStoreInfo, p = d?.shippingEstimate || "", m = d?.shippingEstimate ? $n(d?.shippingEstimate) : "", S = d?.shippingEstimateDate || "", O = d?.addressId || "", w = d?.itemIndex ?? 0, C = t?.[w], k = C?.seller || "", I = `${g}|${f}|${h}|${k}|${p}|${S}|${O}|${v?.startDateUtc}|${v?.endDateUtc}`, D = i?.find(
|
|
3669
|
+
(b) => b?.addressId === O
|
|
3670
|
+
), A = `${ga[f] || ""} ${m} ${D?.neighborhood ? `to ${D?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: E, taxPriceTags: P } = ha(
|
|
3671
|
+
C?.priceTags ?? []
|
|
3672
|
+
), R = (C?.sellingPrice ?? 0) * (C?.quantity ?? 0) + (C?.tax ?? 0) + (E ?? 0);
|
|
3607
3673
|
return u[I] || (u[I] = {
|
|
3608
3674
|
// static fields
|
|
3609
3675
|
selectedSla: g,
|
|
@@ -3612,7 +3678,7 @@ const Ki = {
|
|
|
3612
3678
|
deliveryWindow: v,
|
|
3613
3679
|
shippingEstimate: p,
|
|
3614
3680
|
shippingEstimateDate: S,
|
|
3615
|
-
seller:
|
|
3681
|
+
seller: k,
|
|
3616
3682
|
friendlyShippingEstimate: m,
|
|
3617
3683
|
friendlyDeliveryOptionName: A,
|
|
3618
3684
|
address: D,
|
|
@@ -3622,16 +3688,16 @@ const Ki = {
|
|
|
3622
3688
|
total: 0,
|
|
3623
3689
|
items: []
|
|
3624
3690
|
}), u[I] && (u[I].items?.push({
|
|
3625
|
-
id:
|
|
3626
|
-
uniqueId:
|
|
3627
|
-
name:
|
|
3628
|
-
quantity:
|
|
3629
|
-
price:
|
|
3630
|
-
sellingPrice:
|
|
3631
|
-
imageUrl:
|
|
3691
|
+
id: C?.id || "",
|
|
3692
|
+
uniqueId: C?.uniqueId || "",
|
|
3693
|
+
name: C?.name || "",
|
|
3694
|
+
quantity: C?.quantity || 0,
|
|
3695
|
+
price: C?.price || 0,
|
|
3696
|
+
sellingPrice: C?.sellingPrice || 0,
|
|
3697
|
+
imageUrl: C?.imageUrl || "",
|
|
3632
3698
|
taxPriceTags: P ?? [],
|
|
3633
|
-
taxPriceTagsTotal:
|
|
3634
|
-
tax:
|
|
3699
|
+
taxPriceTagsTotal: E ?? 0,
|
|
3700
|
+
tax: C?.tax || 0,
|
|
3635
3701
|
total: R
|
|
3636
3702
|
}), u[I].quantityOfDifferentItems = (u[I].quantityOfDifferentItems ?? 0) + 1, u[I].total = (u[I].total ?? 0) + R), u;
|
|
3637
3703
|
},
|
|
@@ -3659,7 +3725,7 @@ const Ki = {
|
|
|
3659
3725
|
) || [];
|
|
3660
3726
|
}
|
|
3661
3727
|
};
|
|
3662
|
-
function
|
|
3728
|
+
function ha(e) {
|
|
3663
3729
|
const t = e.filter(
|
|
3664
3730
|
(i) => i?.name?.includes("TAX")
|
|
3665
3731
|
), r = t.reduce(
|
|
@@ -3671,28 +3737,28 @@ function ea(e) {
|
|
|
3671
3737
|
taxPriceTagsTotal: r
|
|
3672
3738
|
};
|
|
3673
3739
|
}
|
|
3674
|
-
const
|
|
3675
|
-
StoreCollection:
|
|
3676
|
-
StoreAggregateOffer:
|
|
3677
|
-
StoreProduct:
|
|
3678
|
-
StoreSeo:
|
|
3679
|
-
StoreFacet:
|
|
3680
|
-
StoreFacetBoolean:
|
|
3681
|
-
StoreFacetRange:
|
|
3682
|
-
StoreFacetValueBoolean:
|
|
3683
|
-
StoreOffer:
|
|
3684
|
-
StoreAggregateRating:
|
|
3685
|
-
StoreReview:
|
|
3686
|
-
StoreProductGroup:
|
|
3687
|
-
StoreSearchResult:
|
|
3688
|
-
StorePropertyValue:
|
|
3689
|
-
SkuVariants:
|
|
3690
|
-
ShippingSLA:
|
|
3691
|
-
UserOrderResult:
|
|
3692
|
-
ObjectOrString:
|
|
3693
|
-
Query:
|
|
3694
|
-
Mutation:
|
|
3695
|
-
},
|
|
3740
|
+
const fa = {
|
|
3741
|
+
StoreCollection: vn,
|
|
3742
|
+
StoreAggregateOffer: fr,
|
|
3743
|
+
StoreProduct: $i,
|
|
3744
|
+
StoreSeo: ta,
|
|
3745
|
+
StoreFacet: Dr,
|
|
3746
|
+
StoreFacetBoolean: Ar,
|
|
3747
|
+
StoreFacetRange: Pr,
|
|
3748
|
+
StoreFacetValueBoolean: Er,
|
|
3749
|
+
StoreOffer: Pi,
|
|
3750
|
+
StoreAggregateRating: Sr,
|
|
3751
|
+
StoreReview: Zi,
|
|
3752
|
+
StoreProductGroup: zi,
|
|
3753
|
+
StoreSearchResult: na,
|
|
3754
|
+
StorePropertyValue: Vi,
|
|
3755
|
+
SkuVariants: pa,
|
|
3756
|
+
ShippingSLA: oa,
|
|
3757
|
+
UserOrderResult: ma,
|
|
3758
|
+
ObjectOrString: Ai,
|
|
3759
|
+
Query: Qi,
|
|
3760
|
+
Mutation: Ci
|
|
3761
|
+
}, Sa = () => fa, ya = `"""
|
|
3696
3762
|
Address information.
|
|
3697
3763
|
"""
|
|
3698
3764
|
type Address {
|
|
@@ -3737,7 +3803,7 @@ type Address {
|
|
|
3737
3803
|
"""
|
|
3738
3804
|
geoCoordinates: [Float]
|
|
3739
3805
|
}
|
|
3740
|
-
`,
|
|
3806
|
+
`, Ia = `"""
|
|
3741
3807
|
Advertisement information about a specific product in a campaign
|
|
3742
3808
|
"""
|
|
3743
3809
|
type Advertisement {
|
|
@@ -3762,7 +3828,7 @@ type Advertisement {
|
|
|
3762
3828
|
"""
|
|
3763
3829
|
adResponseId: String!
|
|
3764
3830
|
}
|
|
3765
|
-
`,
|
|
3831
|
+
`, va = `"""
|
|
3766
3832
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
3767
3833
|
"""
|
|
3768
3834
|
type StoreAggregateOffer {
|
|
@@ -3791,7 +3857,7 @@ type StoreAggregateOffer {
|
|
|
3791
3857
|
"""
|
|
3792
3858
|
offers: [StoreOffer!]!
|
|
3793
3859
|
}
|
|
3794
|
-
`,
|
|
3860
|
+
`, Oa = `"""
|
|
3795
3861
|
Average rating, based on multiple ratings or reviews.
|
|
3796
3862
|
"""
|
|
3797
3863
|
type StoreAggregateRating {
|
|
@@ -3804,7 +3870,7 @@ type StoreAggregateRating {
|
|
|
3804
3870
|
"""
|
|
3805
3871
|
reviewCount: Int!
|
|
3806
3872
|
}
|
|
3807
|
-
`,
|
|
3873
|
+
`, ba = `"""
|
|
3808
3874
|
information about the author of a product review or rating.
|
|
3809
3875
|
"""
|
|
3810
3876
|
type StoreAuthor {
|
|
@@ -3813,7 +3879,7 @@ type StoreAuthor {
|
|
|
3813
3879
|
"""
|
|
3814
3880
|
name: String!
|
|
3815
3881
|
}
|
|
3816
|
-
`,
|
|
3882
|
+
`, Ca = `"""
|
|
3817
3883
|
Brand of a given product.
|
|
3818
3884
|
"""
|
|
3819
3885
|
type StoreBrand {
|
|
@@ -3822,7 +3888,7 @@ type StoreBrand {
|
|
|
3822
3888
|
"""
|
|
3823
3889
|
name: String!
|
|
3824
3890
|
}
|
|
3825
|
-
`,
|
|
3891
|
+
`, wa = `"""
|
|
3826
3892
|
Item of a list.
|
|
3827
3893
|
"""
|
|
3828
3894
|
type StoreListItem {
|
|
@@ -3853,7 +3919,7 @@ type StoreBreadcrumbList {
|
|
|
3853
3919
|
"""
|
|
3854
3920
|
numberOfItems: Int!
|
|
3855
3921
|
}
|
|
3856
|
-
`,
|
|
3922
|
+
`, Da = `"""
|
|
3857
3923
|
Shopping cart message.
|
|
3858
3924
|
"""
|
|
3859
3925
|
type StoreCartMessage {
|
|
@@ -3890,7 +3956,7 @@ input IStoreCart {
|
|
|
3890
3956
|
"""
|
|
3891
3957
|
order: IStoreOrder!
|
|
3892
3958
|
}
|
|
3893
|
-
`,
|
|
3959
|
+
`, Aa = `"""
|
|
3894
3960
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\` or \`Collection\`.
|
|
3895
3961
|
|
|
3896
3962
|
\`SubCategory\` and \`Cluster\` are still declared for backward compatibility but are
|
|
@@ -4016,7 +4082,7 @@ type StoreCollectionLocale {
|
|
|
4016
4082
|
"""
|
|
4017
4083
|
slug: String!
|
|
4018
4084
|
}
|
|
4019
|
-
`,
|
|
4085
|
+
`, Pa = `"""
|
|
4020
4086
|
Delivery Promise badge.
|
|
4021
4087
|
"""
|
|
4022
4088
|
type DeliveryPromiseBadge {
|
|
@@ -4025,7 +4091,7 @@ type DeliveryPromiseBadge {
|
|
|
4025
4091
|
"""
|
|
4026
4092
|
typeName: String
|
|
4027
4093
|
}
|
|
4028
|
-
`,
|
|
4094
|
+
`, Ea = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
4029
4095
|
|
|
4030
4096
|
"""
|
|
4031
4097
|
Search facet range information.
|
|
@@ -4102,7 +4168,7 @@ type StoreFacetValueBoolean {
|
|
|
4102
4168
|
"""
|
|
4103
4169
|
quantity: Int
|
|
4104
4170
|
}
|
|
4105
|
-
`,
|
|
4171
|
+
`, _a = `"""
|
|
4106
4172
|
Image.
|
|
4107
4173
|
"""
|
|
4108
4174
|
type StoreImage {
|
|
@@ -4129,7 +4195,7 @@ input IStoreImage {
|
|
|
4129
4195
|
"""
|
|
4130
4196
|
alternateName: String!
|
|
4131
4197
|
}
|
|
4132
|
-
`,
|
|
4198
|
+
`, ka = `type Mutation {
|
|
4133
4199
|
"""
|
|
4134
4200
|
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\`.
|
|
4135
4201
|
"""
|
|
@@ -4171,7 +4237,7 @@ input IStoreImage {
|
|
|
4171
4237
|
"""
|
|
4172
4238
|
startRecommendationSession: Boolean!
|
|
4173
4239
|
}
|
|
4174
|
-
`,
|
|
4240
|
+
`, Ta = `"""
|
|
4175
4241
|
Newsletter information.
|
|
4176
4242
|
"""
|
|
4177
4243
|
type PersonNewsletter {
|
|
@@ -4194,8 +4260,8 @@ input IPersonNewsletter {
|
|
|
4194
4260
|
"""
|
|
4195
4261
|
email: String!
|
|
4196
4262
|
}
|
|
4197
|
-
`,
|
|
4198
|
-
`,
|
|
4263
|
+
`, Ua = `scalar ObjectOrString
|
|
4264
|
+
`, Ra = `"""
|
|
4199
4265
|
Offer information.
|
|
4200
4266
|
"""
|
|
4201
4267
|
type StoreOffer {
|
|
@@ -4288,7 +4354,7 @@ input IStoreOffer {
|
|
|
4288
4354
|
"""
|
|
4289
4355
|
priceToken: String
|
|
4290
4356
|
}
|
|
4291
|
-
`,
|
|
4357
|
+
`, Fa = `"""
|
|
4292
4358
|
Information of a specific order.
|
|
4293
4359
|
"""
|
|
4294
4360
|
type StoreOrder {
|
|
@@ -4329,7 +4395,7 @@ input IStoreOrder {
|
|
|
4329
4395
|
"""
|
|
4330
4396
|
shouldSplitItem: Boolean
|
|
4331
4397
|
}
|
|
4332
|
-
`,
|
|
4398
|
+
`, Na = `"""
|
|
4333
4399
|
Commercial Authorization response.
|
|
4334
4400
|
"""
|
|
4335
4401
|
type CommercialAuthorizationResponse {
|
|
@@ -4728,7 +4794,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
4728
4794
|
"""
|
|
4729
4795
|
rule: CommercialAuthorizationRule!
|
|
4730
4796
|
}
|
|
4731
|
-
`,
|
|
4797
|
+
`, La = `"""
|
|
4732
4798
|
Input for uploading a file to the Order Entry Service.
|
|
4733
4799
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
4734
4800
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -4789,7 +4855,7 @@ type StoreOrderFormCartItem {
|
|
|
4789
4855
|
seller: String!
|
|
4790
4856
|
unitMultiplier: Float
|
|
4791
4857
|
}
|
|
4792
|
-
`,
|
|
4858
|
+
`, Ba = `"""
|
|
4793
4859
|
Organization.
|
|
4794
4860
|
"""
|
|
4795
4861
|
type StoreOrganization {
|
|
@@ -4830,7 +4896,7 @@ type StoreContract {
|
|
|
4830
4896
|
"""
|
|
4831
4897
|
isDefault: Boolean!
|
|
4832
4898
|
}
|
|
4833
|
-
`,
|
|
4899
|
+
`, $a = `"""
|
|
4834
4900
|
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.
|
|
4835
4901
|
"""
|
|
4836
4902
|
type StorePageInfo {
|
|
@@ -4855,7 +4921,7 @@ type StorePageInfo {
|
|
|
4855
4921
|
"""
|
|
4856
4922
|
totalCount: Int!
|
|
4857
4923
|
}
|
|
4858
|
-
`,
|
|
4924
|
+
`, Ma = `"""
|
|
4859
4925
|
Input type for setting a new password.
|
|
4860
4926
|
"""
|
|
4861
4927
|
input ISetPassword {
|
|
@@ -4898,7 +4964,7 @@ type SetPasswordResponse {
|
|
|
4898
4964
|
"""
|
|
4899
4965
|
message: String
|
|
4900
4966
|
}
|
|
4901
|
-
`,
|
|
4967
|
+
`, za = `"""
|
|
4902
4968
|
Client profile data.
|
|
4903
4969
|
"""
|
|
4904
4970
|
type StorePerson {
|
|
@@ -4941,7 +5007,7 @@ input IStorePerson {
|
|
|
4941
5007
|
"""
|
|
4942
5008
|
familyName: String!
|
|
4943
5009
|
}
|
|
4944
|
-
`,
|
|
5010
|
+
`, Va = `type PickupPointAddress {
|
|
4945
5011
|
"""
|
|
4946
5012
|
Address city.
|
|
4947
5013
|
"""
|
|
@@ -5020,7 +5086,7 @@ type PickupPoints {
|
|
|
5020
5086
|
"""
|
|
5021
5087
|
pickupPointsHash: String
|
|
5022
5088
|
}
|
|
5023
|
-
`,
|
|
5089
|
+
`, xa = `"""
|
|
5024
5090
|
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.
|
|
5025
5091
|
"""
|
|
5026
5092
|
type StoreProduct {
|
|
@@ -5196,7 +5262,7 @@ input IStoreProduct {
|
|
|
5196
5262
|
"""
|
|
5197
5263
|
additionalProperty: [IStorePropertyValue!]
|
|
5198
5264
|
}
|
|
5199
|
-
`,
|
|
5265
|
+
`, qa = `"""
|
|
5200
5266
|
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.
|
|
5201
5267
|
"""
|
|
5202
5268
|
type StoreProductGroup {
|
|
@@ -5241,7 +5307,7 @@ type StoreProductCluster {
|
|
|
5241
5307
|
"""
|
|
5242
5308
|
name: String!
|
|
5243
5309
|
}
|
|
5244
|
-
`,
|
|
5310
|
+
`, ja = `type Profile {
|
|
5245
5311
|
"""
|
|
5246
5312
|
Collection of user's address
|
|
5247
5313
|
"""
|
|
@@ -5302,7 +5368,7 @@ type ProfileAddress {
|
|
|
5302
5368
|
"""
|
|
5303
5369
|
geoCoordinate: [Float]
|
|
5304
5370
|
}
|
|
5305
|
-
`,
|
|
5371
|
+
`, Wa = `"""
|
|
5306
5372
|
Properties that can be associated with products and products groups.
|
|
5307
5373
|
"""
|
|
5308
5374
|
type StorePropertyValue {
|
|
@@ -5342,7 +5408,7 @@ input IStorePropertyValue {
|
|
|
5342
5408
|
"""
|
|
5343
5409
|
valueReference: ObjectOrString!
|
|
5344
5410
|
}
|
|
5345
|
-
`,
|
|
5411
|
+
`, Ha = `"""
|
|
5346
5412
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
5347
5413
|
"""
|
|
5348
5414
|
type StoreProductEdge {
|
|
@@ -5991,7 +6057,7 @@ type StoreAccountProfile {
|
|
|
5991
6057
|
email: String
|
|
5992
6058
|
id: String
|
|
5993
6059
|
}
|
|
5994
|
-
`,
|
|
6060
|
+
`, Ga = `"""
|
|
5995
6061
|
Summary of a quote returned in list results.
|
|
5996
6062
|
"""
|
|
5997
6063
|
type UserQuoteSummary {
|
|
@@ -6056,7 +6122,7 @@ type UserQuoteListPaging {
|
|
|
6056
6122
|
"""
|
|
6057
6123
|
perPage: Int!
|
|
6058
6124
|
}
|
|
6059
|
-
`,
|
|
6125
|
+
`, Xa = `type RecommendationResponse {
|
|
6060
6126
|
products: [StoreProduct!]!
|
|
6061
6127
|
correlationId: String!
|
|
6062
6128
|
campaign: RecommendationCampaign!
|
|
@@ -6067,7 +6133,7 @@ type RecommendationCampaign {
|
|
|
6067
6133
|
title: String
|
|
6068
6134
|
type: String!
|
|
6069
6135
|
}
|
|
6070
|
-
`,
|
|
6136
|
+
`, Ya = `"""
|
|
6071
6137
|
Information of a given review rating.
|
|
6072
6138
|
"""
|
|
6073
6139
|
type StoreReviewRating {
|
|
@@ -6094,7 +6160,7 @@ type StoreReview {
|
|
|
6094
6160
|
"""
|
|
6095
6161
|
author: StoreAuthor!
|
|
6096
6162
|
}
|
|
6097
|
-
`,
|
|
6163
|
+
`, Ja = `"""
|
|
6098
6164
|
Whether a saved card is personally owned by the buyer or shared by their
|
|
6099
6165
|
Organization/Contract. Resolved server-side by the Saved-cards service from
|
|
6100
6166
|
the buyer's \`useAdHocCard\` role — never inferred client-side.
|
|
@@ -6158,7 +6224,7 @@ type SavedCardListResult {
|
|
|
6158
6224
|
"""
|
|
6159
6225
|
list: [SavedCard!]
|
|
6160
6226
|
}
|
|
6161
|
-
`,
|
|
6227
|
+
`, Ka = `"""
|
|
6162
6228
|
Search Engine Optimization (SEO) tags data.
|
|
6163
6229
|
"""
|
|
6164
6230
|
type StoreSeo {
|
|
@@ -6179,7 +6245,7 @@ type StoreSeo {
|
|
|
6179
6245
|
"""
|
|
6180
6246
|
canonical: String!
|
|
6181
6247
|
}
|
|
6182
|
-
`,
|
|
6248
|
+
`, Qa = `"""
|
|
6183
6249
|
Currency information.
|
|
6184
6250
|
"""
|
|
6185
6251
|
type StoreCurrency {
|
|
@@ -6454,7 +6520,7 @@ input IStoreSession {
|
|
|
6454
6520
|
"""
|
|
6455
6521
|
refreshAfter: String
|
|
6456
6522
|
}
|
|
6457
|
-
`,
|
|
6523
|
+
`, Za = `"""
|
|
6458
6524
|
Shipping Simulation item input.
|
|
6459
6525
|
"""
|
|
6460
6526
|
input IShippingItem {
|
|
@@ -6785,7 +6851,7 @@ type MessageFields {
|
|
|
6785
6851
|
"""
|
|
6786
6852
|
skuName: String
|
|
6787
6853
|
}
|
|
6788
|
-
`,
|
|
6854
|
+
`, eo = `type SkuVariants {
|
|
6789
6855
|
"""
|
|
6790
6856
|
SKU property values for the current SKU.
|
|
6791
6857
|
"""
|
|
@@ -6880,7 +6946,7 @@ Example:
|
|
|
6880
6946
|
\`\`\`
|
|
6881
6947
|
"""
|
|
6882
6948
|
scalar FormattedVariants
|
|
6883
|
-
`,
|
|
6949
|
+
`, no = `"""
|
|
6884
6950
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
6885
6951
|
"""
|
|
6886
6952
|
enum StoreStatus {
|
|
@@ -6888,7 +6954,7 @@ enum StoreStatus {
|
|
|
6888
6954
|
WARNING
|
|
6889
6955
|
ERROR
|
|
6890
6956
|
}
|
|
6891
|
-
`,
|
|
6957
|
+
`, to = `scalar JSONObject
|
|
6892
6958
|
|
|
6893
6959
|
type UserOrder {
|
|
6894
6960
|
orderId: String
|
|
@@ -7712,99 +7778,99 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
7712
7778
|
type: String
|
|
7713
7779
|
id: String
|
|
7714
7780
|
}
|
|
7715
|
-
`,
|
|
7716
|
-
"./address.graphql":
|
|
7717
|
-
"./advertisement.graphql":
|
|
7718
|
-
"./aggregateOffer.graphql":
|
|
7719
|
-
"./aggregateRating.graphql":
|
|
7720
|
-
"./author.graphql":
|
|
7721
|
-
"./brand.graphql":
|
|
7722
|
-
"./breadcrumb.graphql":
|
|
7723
|
-
"./cart.graphql":
|
|
7724
|
-
"./collection.graphql":
|
|
7725
|
-
"./deliveryPromisesBadge.graphql":
|
|
7726
|
-
"./facet.graphql":
|
|
7727
|
-
"./image.graphql":
|
|
7728
|
-
"./mutation.graphql":
|
|
7729
|
-
"./newsletter.graphql":
|
|
7730
|
-
"./objectOrString.graphql":
|
|
7731
|
-
"./offer.graphql":
|
|
7732
|
-
"./order.graphql":
|
|
7733
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
7734
|
-
"./orderEntry.graphql":
|
|
7735
|
-
"./organization.graphql":
|
|
7736
|
-
"./pageInfo.graphql":
|
|
7737
|
-
"./password.graphql":
|
|
7738
|
-
"./person.graphql":
|
|
7739
|
-
"./pickupPoints.graphql":
|
|
7740
|
-
"./product.graphql":
|
|
7741
|
-
"./productGroup.graphql":
|
|
7742
|
-
"./profile.graphql":
|
|
7743
|
-
"./propertyValue.graphql":
|
|
7744
|
-
"./query.graphql":
|
|
7745
|
-
"./quote.graphql":
|
|
7746
|
-
"./recommendation.graphql":
|
|
7747
|
-
"./review.graphql":
|
|
7748
|
-
"./savedCard.graphql":
|
|
7749
|
-
"./seo.graphql":
|
|
7750
|
-
"./session.graphql":
|
|
7751
|
-
"./shipping.graphql":
|
|
7752
|
-
"./skuVariants.graphql":
|
|
7753
|
-
"./status.graphql":
|
|
7754
|
-
"./userOrder.graphql":
|
|
7755
|
-
}),
|
|
7756
|
-
Object.values(
|
|
7757
|
-
(e, n) =>
|
|
7781
|
+
`, ro = /* @__PURE__ */ Object.assign({
|
|
7782
|
+
"./address.graphql": ya,
|
|
7783
|
+
"./advertisement.graphql": Ia,
|
|
7784
|
+
"./aggregateOffer.graphql": va,
|
|
7785
|
+
"./aggregateRating.graphql": Oa,
|
|
7786
|
+
"./author.graphql": ba,
|
|
7787
|
+
"./brand.graphql": Ca,
|
|
7788
|
+
"./breadcrumb.graphql": wa,
|
|
7789
|
+
"./cart.graphql": Da,
|
|
7790
|
+
"./collection.graphql": Aa,
|
|
7791
|
+
"./deliveryPromisesBadge.graphql": Pa,
|
|
7792
|
+
"./facet.graphql": Ea,
|
|
7793
|
+
"./image.graphql": _a,
|
|
7794
|
+
"./mutation.graphql": ka,
|
|
7795
|
+
"./newsletter.graphql": Ta,
|
|
7796
|
+
"./objectOrString.graphql": Ua,
|
|
7797
|
+
"./offer.graphql": Ra,
|
|
7798
|
+
"./order.graphql": Fa,
|
|
7799
|
+
"./orderCommercialAuthorizaton.graphql": Na,
|
|
7800
|
+
"./orderEntry.graphql": La,
|
|
7801
|
+
"./organization.graphql": Ba,
|
|
7802
|
+
"./pageInfo.graphql": $a,
|
|
7803
|
+
"./password.graphql": Ma,
|
|
7804
|
+
"./person.graphql": za,
|
|
7805
|
+
"./pickupPoints.graphql": Va,
|
|
7806
|
+
"./product.graphql": xa,
|
|
7807
|
+
"./productGroup.graphql": qa,
|
|
7808
|
+
"./profile.graphql": ja,
|
|
7809
|
+
"./propertyValue.graphql": Wa,
|
|
7810
|
+
"./query.graphql": Ha,
|
|
7811
|
+
"./quote.graphql": Ga,
|
|
7812
|
+
"./recommendation.graphql": Xa,
|
|
7813
|
+
"./review.graphql": Ya,
|
|
7814
|
+
"./savedCard.graphql": Ja,
|
|
7815
|
+
"./seo.graphql": Ka,
|
|
7816
|
+
"./session.graphql": Qa,
|
|
7817
|
+
"./shipping.graphql": Za,
|
|
7818
|
+
"./skuVariants.graphql": eo,
|
|
7819
|
+
"./status.graphql": no,
|
|
7820
|
+
"./userOrder.graphql": to
|
|
7821
|
+
}), io = Wn(
|
|
7822
|
+
Object.values(ro).map((e) => Hn(e)).reduce(
|
|
7823
|
+
(e, n) => sn([e, n], { sort: !0 })
|
|
7758
7824
|
)
|
|
7759
|
-
),
|
|
7760
|
-
channel:
|
|
7825
|
+
), ao = io, wo = async (e) => (n) => (n.storage = {
|
|
7826
|
+
channel: ne.parse(e.channel),
|
|
7761
7827
|
flags: e.flags ?? {},
|
|
7762
7828
|
locale: e.locale,
|
|
7763
7829
|
customSortMap: e.customSortMap ?? {},
|
|
7764
7830
|
cookies: /* @__PURE__ */ new Map()
|
|
7765
|
-
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients =
|
|
7766
|
-
function
|
|
7767
|
-
const e =
|
|
7831
|
+
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients = tr(e, n), n.loaders = pr(e, n), n);
|
|
7832
|
+
function oo() {
|
|
7833
|
+
const e = Sa(), n = {};
|
|
7768
7834
|
for (const [t, r] of Object.entries(e))
|
|
7769
7835
|
n[t] = Object.fromEntries(
|
|
7770
|
-
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i,
|
|
7836
|
+
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, mt(a, `${t}(${i})`)])
|
|
7771
7837
|
);
|
|
7772
7838
|
return n;
|
|
7773
7839
|
}
|
|
7774
|
-
function
|
|
7775
|
-
const t =
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
])(
|
|
7779
|
-
return e &&
|
|
7840
|
+
function Do(e) {
|
|
7841
|
+
const t = pt([
|
|
7842
|
+
ut,
|
|
7843
|
+
ct
|
|
7844
|
+
])(oo(), ao);
|
|
7845
|
+
return e && Gn(e) ? qn({
|
|
7780
7846
|
schemas: [t, e]
|
|
7781
7847
|
}) : t;
|
|
7782
7848
|
}
|
|
7783
7849
|
export {
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7850
|
+
ct as AuthDirective,
|
|
7851
|
+
_ as BadRequestError,
|
|
7852
|
+
ut as CacheControlDirective,
|
|
7853
|
+
Qn as CardOrigin,
|
|
7854
|
+
Zn as CommercialAuthorizationStatus,
|
|
7855
|
+
ee as FastStoreError,
|
|
7856
|
+
K as ForbiddenError,
|
|
7857
|
+
wo as GraphqlVtexContextFactory,
|
|
7858
|
+
Do as GraphqlVtexSchema,
|
|
7793
7859
|
$ as NotFoundError,
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7860
|
+
et as StoreCollectionType,
|
|
7861
|
+
nt as StoreFacetType,
|
|
7862
|
+
tt as StoreSort,
|
|
7863
|
+
rt as StoreStatus,
|
|
7798
7864
|
ie as UnauthorizedError,
|
|
7799
|
-
|
|
7865
|
+
it as UserOrderInvoiceType,
|
|
7800
7866
|
L as getAuthCookie,
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7867
|
+
bo as isBadRequestError,
|
|
7868
|
+
Oo as isFastStoreError,
|
|
7869
|
+
ht as isForbiddenError,
|
|
7870
|
+
J as isNotFoundError,
|
|
7871
|
+
Co as isUnauthorizedError,
|
|
7872
|
+
vo as stringifyCacheControl,
|
|
7873
|
+
ao as typeDefs,
|
|
7874
|
+
ot as validateUserAuthentication,
|
|
7875
|
+
pt as withDirectives
|
|
7810
7876
|
};
|