@faststore/api 4.10.1-dev.6 → 4.10.1-dev.7
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 +49 -46
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +1115 -1058
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/__generated__/schema.d.ts +1 -0
- package/dist/src/__generated__/schema.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/index.d.ts +1 -1
- package/dist/src/platforms/vtex/clients/search/index.d.ts +7 -1
- package/dist/src/platforms/vtex/clients/search/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/index.d.ts +1 -1
- package/dist/src/platforms/vtex/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/loaders/sku.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/index.d.ts +1 -1
- package/dist/src/platforms/vtex/resolvers/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/validateSession.d.ts.map +1 -1
- package/dist/src/platforms/vtex/utils/contractAssortment.d.ts +22 -0
- package/dist/src/platforms/vtex/utils/contractAssortment.d.ts.map +1 -0
- package/dist/src/platforms/vtex/utils/intelligentSearchRequest.d.ts +5 -0
- package/dist/src/platforms/vtex/utils/intelligentSearchRequest.d.ts.map +1 -1
- package/dist/src/platforms/vtex/utils/validateSessionHelpers.d.ts +29 -2
- package/dist/src/platforms/vtex/utils/validateSessionHelpers.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/__generated__/schema.ts +1 -0
- package/src/platforms/vtex/clients/search/index.ts +13 -1
- package/src/platforms/vtex/loaders/sku.ts +1 -0
- package/src/platforms/vtex/resolvers/query.ts +51 -37
- package/src/platforms/vtex/resolvers/validateSession.ts +3 -3
- package/src/platforms/vtex/typeDefs/session.graphql +3 -0
- package/src/platforms/vtex/utils/contractAssortment.ts +87 -0
- package/src/platforms/vtex/utils/intelligentSearchRequest.ts +10 -0
- package/src/platforms/vtex/utils/validateSessionHelpers.ts +47 -5
package/dist/es/index.mjs
CHANGED
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
4
|
-
import { GraphQLScalarType as
|
|
5
|
-
import { logger as
|
|
6
|
-
import
|
|
7
|
-
import { parse as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const
|
|
1
|
+
import { mergeTypeDefs as Sn } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as it, mergeSchemas as at } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as yn, MapperKind as In, getDirective as vn } from "@graphql-tools/utils";
|
|
4
|
+
import { GraphQLScalarType as ot, print as st, parse as ct, isSchema as lt } from "graphql";
|
|
5
|
+
import { logger as dt, OTELAPI as H } from "@faststore/diagnostics";
|
|
6
|
+
import ut from "isomorphic-unfetch";
|
|
7
|
+
import { parse as ae } from "cookie";
|
|
8
|
+
import _e from "p-limit";
|
|
9
|
+
import fe from "dataloader";
|
|
10
|
+
import pt from "sanitize-html";
|
|
11
|
+
import Te from "fast-deep-equal";
|
|
12
|
+
import gt from "node:crypto";
|
|
13
|
+
var mt = /* @__PURE__ */ ((e) => (e.Personal = "personal", e.Shared = "shared", e))(mt || {}), ht = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(ht || {}), ft = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(ft || {}), St = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(St || {}), yt = /* @__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))(yt || {}), It = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(It || {}), vt = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(vt || {});
|
|
14
|
+
const Ot = () => 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 re("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
|
+
}, Ct = async (e) => {
|
|
24
24
|
const {
|
|
25
25
|
clients: { commerce: n }
|
|
26
26
|
} = e;
|
|
27
27
|
try {
|
|
28
28
|
if ((await n.vtexid.validate())?.authStatus?.toLowerCase() !== "success")
|
|
29
|
-
throw new
|
|
29
|
+
throw new de("Authentication required");
|
|
30
30
|
} catch (t) {
|
|
31
31
|
const r = t.extensions?.status ?? t.status;
|
|
32
|
-
throw r === 401 ? new
|
|
32
|
+
throw r === 401 ? new de("Authentication required") : r === 403 ? new re("You are not allowed to access this resource") : new de("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, bt = "auth", wt = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (e) =>
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
36
|
+
transformer: (e) => yn(e, {
|
|
37
|
+
[In.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (vn(e, n, bt)?.[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 Ct(o), r?.(i, a, o, s));
|
|
41
41
|
}
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, At = "cacheControl", Ho = (e, n) => {
|
|
46
46
|
const {
|
|
47
47
|
scope: t = "private",
|
|
48
48
|
sMaxAge: r = 0,
|
|
49
49
|
staleWhileRevalidate: i = 0
|
|
50
50
|
} = e;
|
|
51
51
|
return `${n ? "private" : t}, s-maxage=${r}, stale-while-revalidate=${i}`;
|
|
52
|
-
},
|
|
52
|
+
}, $e = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, Pt = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, Dt = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (e) =>
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (e) => yn(e, {
|
|
55
|
+
[In.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = vn(e, n, At)?.[0];
|
|
57
57
|
if (t) {
|
|
58
58
|
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
|
|
59
59
|
n.resolve = (s, c, d, g) => (d.cacheControl = {
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
60
|
+
sMaxAge: $e(d.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: $e(
|
|
62
62
|
d.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
65
|
+
scope: Pt(d.cacheControl?.scope, a)
|
|
66
66
|
}, o?.(s, c, d, g));
|
|
67
67
|
}
|
|
68
68
|
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
71
|
+
}, Et = (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
|
+
it({
|
|
79
79
|
typeDefs: r,
|
|
80
80
|
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
},
|
|
84
|
-
name:
|
|
85
|
-
version:
|
|
86
|
-
}, Ue =
|
|
83
|
+
}, On = "@faststore/api", Cn = "4.10.1-dev.6", Me = {
|
|
84
|
+
name: On,
|
|
85
|
+
version: Cn
|
|
86
|
+
}, Ue = dt("@faststore/api"), kt = (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 = H.trace.getTracer("Graphql").startSpan(n, {
|
|
90
|
+
kind: H.SpanKind.INTERNAL,
|
|
91
91
|
attributes: {
|
|
92
92
|
timestamp: Date.now(),
|
|
93
|
-
"@faststore_version":
|
|
94
|
-
"@faststore_package_name":
|
|
93
|
+
"@faststore_version": Cn,
|
|
94
|
+
"@faststore_package_name": On,
|
|
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 = H.trace.setSpan(H.context.active(), o);
|
|
101
101
|
try {
|
|
102
|
-
const c =
|
|
102
|
+
const c = H.context.with(
|
|
103
103
|
s,
|
|
104
104
|
() => e(t, r, i, a)
|
|
105
105
|
);
|
|
106
106
|
return c instanceof Promise ? c.then(
|
|
107
107
|
(d) => (o.end(), d),
|
|
108
|
-
(d) =>
|
|
108
|
+
(d) => ze(d, o, n)
|
|
109
109
|
) : (o.end(), c);
|
|
110
110
|
} catch (c) {
|
|
111
|
-
return
|
|
111
|
+
return ze(c, o, n);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
function
|
|
115
|
-
throw n.setStatus({ code:
|
|
114
|
+
function ze(e, n, t) {
|
|
115
|
+
throw n.setStatus({ code: H.SpanStatusCode.ERROR }), n.recordException(e), n.end(), console.error(`Error at resolver: ${t}:
|
|
116
116
|
%o`, e), Ue("error", `Error at resolver: %s
|
|
117
117
|
%o`, t, e), e;
|
|
118
118
|
}
|
|
119
|
-
class
|
|
119
|
+
class Q extends Error {
|
|
120
120
|
constructor(n, t) {
|
|
121
121
|
super(t), this.extensions = n, this.name = "FastStoreError";
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
class k extends
|
|
124
|
+
class k extends Q {
|
|
125
125
|
constructor(n) {
|
|
126
126
|
super({ status: 400, type: "BadRequestError" }, n);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
class
|
|
129
|
+
class de extends Q {
|
|
130
130
|
constructor(n) {
|
|
131
131
|
super({ status: 401, type: "UnauthorizedError" }, n);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
class
|
|
134
|
+
class re extends Q {
|
|
135
135
|
constructor(n) {
|
|
136
136
|
super({ status: 403, type: "ForbiddenError" }, n);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
class
|
|
139
|
+
class B extends Q {
|
|
140
140
|
constructor(n) {
|
|
141
141
|
super({ status: 404, type: "NotFoundError" }, n);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
144
|
+
const Go = (e) => e?.name === "FastStoreError", Xo = (e) => e?.extensions?.type === "BadRequestError", Yo = (e) => e?.extensions?.type === "UnauthorizedError", _t = (e) => e?.extensions?.type === "ForbiddenError", Y = (e) => e?.extensions?.type === "NotFoundError", Tt = `${Me.name}@${Me.version}`, Ut = /authorization|cookie|token|secret|api-?key|appkey/i, bn = "[redacted]", Ve = (e) => {
|
|
145
145
|
if (!e)
|
|
146
146
|
return;
|
|
147
147
|
const n = {}, t = (r, i) => {
|
|
148
|
-
n[r] =
|
|
148
|
+
n[r] = Ut.test(r) ? bn : i;
|
|
149
149
|
};
|
|
150
150
|
return Array.isArray(e) ? e.forEach(([r, i]) => t(r, i)) : typeof e.forEach == "function" ? e.forEach((i, a) => t(a, i)) : Object.entries(e).forEach(([r, i]) => t(r, i)), n;
|
|
151
151
|
}, y = async (e, n, t) => {
|
|
152
|
-
const r = await
|
|
152
|
+
const r = await ut(e, {
|
|
153
153
|
...n,
|
|
154
154
|
headers: {
|
|
155
155
|
...n?.headers ?? {},
|
|
156
|
-
"User-Agent":
|
|
156
|
+
"User-Agent": Tt
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
if (r.ok)
|
|
@@ -163,13 +163,13 @@ const Mo = (e) => e?.name === "FastStoreError", zo = (e) => e?.extensions?.type
|
|
|
163
163
|
typeof e == "string" ? e : e.url,
|
|
164
164
|
n && {
|
|
165
165
|
...n,
|
|
166
|
-
headers:
|
|
167
|
-
body: n.body ?
|
|
166
|
+
headers: Ve(n.headers),
|
|
167
|
+
body: n.body ? bn : void 0
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
170
|
status: r.status,
|
|
171
171
|
statusText: r.statusText,
|
|
172
|
-
headers:
|
|
172
|
+
headers: Ve(r.headers)
|
|
173
173
|
}
|
|
174
174
|
);
|
|
175
175
|
const i = await r.text();
|
|
@@ -178,19 +178,19 @@ const Mo = (e) => e?.name === "FastStoreError", zo = (e) => e?.extensions?.type
|
|
|
178
178
|
case 400:
|
|
179
179
|
throw new k(i);
|
|
180
180
|
case 401:
|
|
181
|
-
throw new
|
|
181
|
+
throw new de(i);
|
|
182
182
|
case 403:
|
|
183
|
-
throw new
|
|
183
|
+
throw new re(i);
|
|
184
184
|
case 404:
|
|
185
|
-
throw new
|
|
185
|
+
throw new B(i);
|
|
186
186
|
default:
|
|
187
|
-
throw new
|
|
187
|
+
throw new Q(
|
|
188
188
|
{ status: r.status, type: "UnknownError" },
|
|
189
189
|
i
|
|
190
190
|
);
|
|
191
191
|
}
|
|
192
192
|
throw new Error(i);
|
|
193
|
-
},
|
|
193
|
+
}, Rt = ({ account: e, environment: n }) => {
|
|
194
194
|
const t = `https://${e}.${n}.com.br`;
|
|
195
195
|
return {
|
|
196
196
|
getLocalizedProduct: (r, i) => y(`${t}/api/catalog-dataplane/product/${r}`, {
|
|
@@ -201,7 +201,7 @@ const Mo = (e) => e?.name === "FastStoreError", zo = (e) => e?.extensions?.type
|
|
|
201
201
|
}
|
|
202
202
|
})
|
|
203
203
|
};
|
|
204
|
-
},
|
|
204
|
+
}, wn = (e) => {
|
|
205
205
|
if (!e)
|
|
206
206
|
return e;
|
|
207
207
|
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
@@ -215,8 +215,8 @@ const Mo = (e) => e?.name === "FastStoreError", zo = (e) => e?.extensions?.type
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
218
|
-
},
|
|
219
|
-
const t = n.match(
|
|
218
|
+
}, Nt = /^([^=]+)=([^;]*)/, Ft = (e, n) => {
|
|
219
|
+
const t = n.match(Nt);
|
|
220
220
|
if (t) {
|
|
221
221
|
const r = t[1], i = t[2];
|
|
222
222
|
e.storage.cookies.set(r, {
|
|
@@ -224,39 +224,39 @@ const Mo = (e) => e?.name === "FastStoreError", zo = (e) => e?.extensions?.type
|
|
|
224
224
|
setCookie: n
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
|
-
},
|
|
227
|
+
}, Lt = (e, n) => {
|
|
228
228
|
n.getSetCookie().forEach(
|
|
229
|
-
(t) =>
|
|
229
|
+
(t) => Ft(e, t)
|
|
230
230
|
);
|
|
231
|
-
},
|
|
231
|
+
}, Bt = (e) => (n) => Lt(e, n), Ie = (e) => {
|
|
232
232
|
if (!e.headers?.cookie)
|
|
233
233
|
return null;
|
|
234
|
-
const n =
|
|
234
|
+
const n = wn(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
235
235
|
return t.length === 0 ? n : t.reduce(
|
|
236
|
-
(r, [i, { value: a }]) =>
|
|
236
|
+
(r, [i, { value: a }]) => $t(
|
|
237
237
|
r,
|
|
238
238
|
i,
|
|
239
239
|
a
|
|
240
240
|
),
|
|
241
241
|
n
|
|
242
242
|
);
|
|
243
|
-
},
|
|
244
|
-
const r =
|
|
243
|
+
}, An = (e) => function(t) {
|
|
244
|
+
const r = Ie(e);
|
|
245
245
|
return r ? {
|
|
246
246
|
...t,
|
|
247
247
|
cookie: r
|
|
248
248
|
} : t;
|
|
249
|
-
},
|
|
250
|
-
const t =
|
|
251
|
-
return
|
|
252
|
-
},
|
|
249
|
+
}, z = (e, n) => {
|
|
250
|
+
const t = wn(e);
|
|
251
|
+
return ae(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
252
|
+
}, $t = (e, n, t) => {
|
|
253
253
|
const r = new RegExp(`(${n})=([^;]*)`), i = e.match(r);
|
|
254
254
|
return i ? e.replace(
|
|
255
255
|
i[0],
|
|
256
256
|
`${i[1]}=${t}`
|
|
257
257
|
) : `${e};${n}=${t}`;
|
|
258
258
|
};
|
|
259
|
-
function
|
|
259
|
+
function G(e) {
|
|
260
260
|
if (!e)
|
|
261
261
|
return null;
|
|
262
262
|
try {
|
|
@@ -265,12 +265,12 @@ function H(e) {
|
|
|
265
265
|
return null;
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
const
|
|
268
|
+
const Mt = "storefront/faststore.recommendation-shelf@v4", ne = {
|
|
269
269
|
method: "POST",
|
|
270
270
|
headers: {
|
|
271
271
|
"content-type": "application/json"
|
|
272
272
|
}
|
|
273
|
-
},
|
|
273
|
+
}, zt = 100, se = /* @__PURE__ */ new Set(), Vt = (e) => e.split("/").map(encodeURIComponent).join("/"), Se = (e) => e ? { headers: { "Accept-Language": e } } : void 0, xt = /^\d{4}-\d{2}-\d{2}$/, qt = /* @__PURE__ */ new Set([
|
|
274
274
|
"Draft",
|
|
275
275
|
"Requested",
|
|
276
276
|
"InReview",
|
|
@@ -281,7 +281,7 @@ const Lt = "storefront/faststore.recommendation-shelf@v4", Z = {
|
|
|
281
281
|
"ConvertedToCart",
|
|
282
282
|
"ConvertedToOrder"
|
|
283
283
|
]);
|
|
284
|
-
function
|
|
284
|
+
function jt({
|
|
285
285
|
page: e,
|
|
286
286
|
perPage: n,
|
|
287
287
|
status: t,
|
|
@@ -304,19 +304,19 @@ function Vt({
|
|
|
304
304
|
["expiresAtFrom", a],
|
|
305
305
|
["expiresAtTo", o]
|
|
306
306
|
])
|
|
307
|
-
if (c && !
|
|
307
|
+
if (c && !xt.test(c))
|
|
308
308
|
throw new Error(
|
|
309
309
|
`listUserQuotes: invalid ${s} "${c}" — must be YYYY-MM-DD`
|
|
310
310
|
);
|
|
311
311
|
if (t && t.length > 0) {
|
|
312
|
-
const s = t.filter((c) => !
|
|
312
|
+
const s = t.filter((c) => !qt.has(c));
|
|
313
313
|
if (s.length > 0)
|
|
314
314
|
throw new Error(
|
|
315
315
|
`listUserQuotes: invalid status values: ${s.join(", ")}`
|
|
316
316
|
);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Wt({
|
|
320
320
|
page: e,
|
|
321
321
|
perPage: n,
|
|
322
322
|
status: t,
|
|
@@ -329,17 +329,17 @@ function qt({
|
|
|
329
329
|
const c = new URLSearchParams();
|
|
330
330
|
return e && c.append("pageNumber", e.toString()), n && c.append("pageSize", n.toString()), t?.forEach((d) => c.append("status", d)), r && c.append("createdAtFrom", r), i && c.append("createdAtTo", i), a && c.append("expiresAtFrom", a), o && c.append("expiresAtTo", o), s?.trim() && c.append("label", s.trim()), c;
|
|
331
331
|
}
|
|
332
|
-
const
|
|
333
|
-
const a = `https://${e}.${n}.com.br`, o =
|
|
332
|
+
const Ht = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
333
|
+
const a = `https://${e}.${n}.com.br`, o = Bt(i), s = An(i), c = Ot(), d = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", g = r && r.map((l) => l + ".").find((l) => d.includes(l)) || "", u = d.replace(g, ""), f = `${a}/api/recommend-bff/v2`, h = s({
|
|
334
334
|
accept: "application/json",
|
|
335
335
|
"content-type": "application/json",
|
|
336
|
-
"x-vtex-rec-origin": `${e}/${
|
|
336
|
+
"x-vtex-rec-origin": `${e}/${Mt}`
|
|
337
337
|
}), I = (l = {}) => {
|
|
338
|
-
const
|
|
338
|
+
const p = z(Ie(i) ?? "", e);
|
|
339
339
|
return s({
|
|
340
340
|
...l,
|
|
341
|
-
"X-FORWARDED-HOST":
|
|
342
|
-
...
|
|
341
|
+
"X-FORWARDED-HOST": u,
|
|
342
|
+
...p ? { [`VtexIdclientAutCookie_${e}`]: p } : {}
|
|
343
343
|
});
|
|
344
344
|
};
|
|
345
345
|
return {
|
|
@@ -372,36 +372,36 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
372
372
|
// The by-linkid endpoints resolve a slug to a single catalog entity
|
|
373
373
|
// (or 404 when there is no match). We surface a 404 as `null` so the
|
|
374
374
|
// loader can cascade category → brand → collection.
|
|
375
|
-
category: async (l,
|
|
375
|
+
category: async (l, p) => {
|
|
376
376
|
try {
|
|
377
377
|
return await y(
|
|
378
|
-
`${a}/api/catalog_system/pub/category/by-linkid/${
|
|
379
|
-
|
|
378
|
+
`${a}/api/catalog_system/pub/category/by-linkid/${Vt(l)}`,
|
|
379
|
+
Se(p)
|
|
380
380
|
);
|
|
381
381
|
} catch (m) {
|
|
382
|
-
if (
|
|
382
|
+
if (Y(m)) return null;
|
|
383
383
|
throw m;
|
|
384
384
|
}
|
|
385
385
|
},
|
|
386
|
-
brand: async (l,
|
|
386
|
+
brand: async (l, p) => {
|
|
387
387
|
try {
|
|
388
388
|
return await y(
|
|
389
389
|
`${a}/api/catalog_system/pub/brand/by-linkid/${encodeURIComponent(l)}`,
|
|
390
|
-
|
|
390
|
+
Se(p)
|
|
391
391
|
);
|
|
392
392
|
} catch (m) {
|
|
393
|
-
if (
|
|
393
|
+
if (Y(m)) return null;
|
|
394
394
|
throw m;
|
|
395
395
|
}
|
|
396
396
|
},
|
|
397
|
-
collection: async (l,
|
|
397
|
+
collection: async (l, p) => {
|
|
398
398
|
try {
|
|
399
399
|
return await y(
|
|
400
400
|
`${a}/api/catalog_system/pub/collection/by-linkid/${encodeURIComponent(l)}`,
|
|
401
|
-
|
|
401
|
+
Se(p)
|
|
402
402
|
);
|
|
403
403
|
} catch (m) {
|
|
404
|
-
if (
|
|
404
|
+
if (Y(m)) return null;
|
|
405
405
|
throw m;
|
|
406
406
|
}
|
|
407
407
|
}
|
|
@@ -409,7 +409,7 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
409
409
|
products: {
|
|
410
410
|
crossselling: ({
|
|
411
411
|
type: l,
|
|
412
|
-
productId:
|
|
412
|
+
productId: p,
|
|
413
413
|
groupByProduct: m = !0
|
|
414
414
|
}) => {
|
|
415
415
|
const S = new URLSearchParams({
|
|
@@ -417,7 +417,7 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
417
417
|
groupByProduct: m.toString()
|
|
418
418
|
});
|
|
419
419
|
return y(
|
|
420
|
-
`${a}/api/catalog_system/pub/products/crossselling/${l}/${
|
|
420
|
+
`${a}/api/catalog_system/pub/products/crossselling/${l}/${p}?${S}`,
|
|
421
421
|
void 0,
|
|
422
422
|
{ storeCookies: o }
|
|
423
423
|
);
|
|
@@ -425,17 +425,17 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
425
425
|
}
|
|
426
426
|
},
|
|
427
427
|
checkout: {
|
|
428
|
-
simulation: (l, { salesChannel:
|
|
428
|
+
simulation: (l, { salesChannel: p } = i.storage.channel) => {
|
|
429
429
|
const m = new URLSearchParams({
|
|
430
|
-
sc:
|
|
430
|
+
sc: p
|
|
431
431
|
}), S = s({
|
|
432
432
|
"content-type": "application/json",
|
|
433
|
-
"X-FORWARDED-HOST":
|
|
433
|
+
"X-FORWARDED-HOST": u
|
|
434
434
|
});
|
|
435
435
|
return y(
|
|
436
436
|
`${a}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
437
437
|
{
|
|
438
|
-
...
|
|
438
|
+
...ne,
|
|
439
439
|
headers: S,
|
|
440
440
|
body: JSON.stringify(l)
|
|
441
441
|
},
|
|
@@ -444,49 +444,49 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
444
444
|
},
|
|
445
445
|
shippingData: ({
|
|
446
446
|
id: l,
|
|
447
|
-
index:
|
|
447
|
+
index: p,
|
|
448
448
|
deliveryMode: m,
|
|
449
449
|
selectedAddresses: S
|
|
450
450
|
}, v) => {
|
|
451
|
-
const
|
|
451
|
+
const O = v ? {
|
|
452
452
|
startDateUtc: m?.deliveryWindow?.startDate,
|
|
453
453
|
endDateUtc: m?.deliveryWindow?.endDate
|
|
454
|
-
} : null,
|
|
455
|
-
logisticsInfo: Array.from({ length:
|
|
456
|
-
itemIndex:
|
|
454
|
+
} : null, C = {
|
|
455
|
+
logisticsInfo: Array.from({ length: p }, (w, b) => ({
|
|
456
|
+
itemIndex: b,
|
|
457
457
|
selectedDeliveryChannel: m?.deliveryChannel || null,
|
|
458
458
|
selectedSla: m?.deliveryMethod || null,
|
|
459
|
-
deliveryWindow:
|
|
459
|
+
deliveryWindow: O
|
|
460
460
|
})),
|
|
461
461
|
selectedAddresses: S,
|
|
462
462
|
clearAddressIfPostalCodeNotFound: t
|
|
463
463
|
}, T = s({
|
|
464
464
|
"content-type": "application/json",
|
|
465
|
-
"X-FORWARDED-HOST":
|
|
465
|
+
"X-FORWARDED-HOST": u
|
|
466
466
|
});
|
|
467
467
|
return y(
|
|
468
468
|
`${a}/api/checkout/pub/orderForm/${l}/attachments/shippingData`,
|
|
469
469
|
{
|
|
470
|
-
...
|
|
470
|
+
...ne,
|
|
471
471
|
headers: T,
|
|
472
|
-
body: JSON.stringify(
|
|
472
|
+
body: JSON.stringify(C)
|
|
473
473
|
},
|
|
474
474
|
{ storeCookies: o }
|
|
475
475
|
);
|
|
476
476
|
},
|
|
477
477
|
marketingData: ({
|
|
478
478
|
id: l,
|
|
479
|
-
marketingData:
|
|
479
|
+
marketingData: p
|
|
480
480
|
}) => {
|
|
481
481
|
const m = s({
|
|
482
482
|
"content-type": "application/json",
|
|
483
|
-
"X-FORWARDED-HOST":
|
|
483
|
+
"X-FORWARDED-HOST": u
|
|
484
484
|
});
|
|
485
485
|
return y(
|
|
486
486
|
`${a}/api/checkout/pub/orderForm/${l}/attachments/marketingData`,
|
|
487
487
|
{
|
|
488
488
|
headers: m,
|
|
489
|
-
body: JSON.stringify(
|
|
489
|
+
body: JSON.stringify(p),
|
|
490
490
|
method: "POST"
|
|
491
491
|
},
|
|
492
492
|
{ storeCookies: o }
|
|
@@ -494,17 +494,17 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
494
494
|
},
|
|
495
495
|
clientPreferencesData: ({
|
|
496
496
|
id: l,
|
|
497
|
-
clientPreferencesData:
|
|
497
|
+
clientPreferencesData: p
|
|
498
498
|
}) => {
|
|
499
499
|
const m = s({
|
|
500
500
|
"content-type": "application/json",
|
|
501
|
-
"X-FORWARDED-HOST":
|
|
501
|
+
"X-FORWARDED-HOST": u
|
|
502
502
|
});
|
|
503
503
|
return y(
|
|
504
504
|
`${a}/api/checkout/pub/orderForm/${l}/attachments/clientPreferencesData`,
|
|
505
505
|
{
|
|
506
506
|
headers: m,
|
|
507
|
-
body: JSON.stringify(
|
|
507
|
+
body: JSON.stringify(p),
|
|
508
508
|
method: "POST"
|
|
509
509
|
},
|
|
510
510
|
{ storeCookies: o }
|
|
@@ -512,60 +512,60 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
512
512
|
},
|
|
513
513
|
orderForm: ({
|
|
514
514
|
id: l,
|
|
515
|
-
refreshOutdatedData:
|
|
515
|
+
refreshOutdatedData: p = !0,
|
|
516
516
|
channel: m = i.storage.channel,
|
|
517
517
|
preserveSalesChannel: S = !1
|
|
518
518
|
}) => {
|
|
519
|
-
const { salesChannel: v } = m,
|
|
519
|
+
const { salesChannel: v } = m, O = s({
|
|
520
520
|
"content-type": "application/json",
|
|
521
|
-
"X-FORWARDED-HOST":
|
|
522
|
-
}),
|
|
523
|
-
(!S || !l) &&
|
|
524
|
-
const T = l ? `/${l}` : "",
|
|
521
|
+
"X-FORWARDED-HOST": u
|
|
522
|
+
}), C = new URLSearchParams();
|
|
523
|
+
(!S || !l) && C.set("sc", v), l && C.set("refreshOutdatedData", p.toString());
|
|
524
|
+
const T = l ? `/${l}` : "", w = `${a}/api/checkout/pub/orderForm${T}?${C}`;
|
|
525
525
|
return y(
|
|
526
|
-
|
|
526
|
+
w,
|
|
527
527
|
{
|
|
528
|
-
...
|
|
529
|
-
headers:
|
|
528
|
+
...ne,
|
|
529
|
+
headers: O,
|
|
530
530
|
...l ? {} : { body: "{}" }
|
|
531
531
|
},
|
|
532
532
|
{ storeCookies: o }
|
|
533
533
|
);
|
|
534
534
|
},
|
|
535
535
|
clearOrderFormMessages: ({ id: l }) => {
|
|
536
|
-
const
|
|
536
|
+
const p = s({
|
|
537
537
|
"content-type": "application/json",
|
|
538
|
-
"X-FORWARDED-HOST":
|
|
538
|
+
"X-FORWARDED-HOST": u
|
|
539
539
|
});
|
|
540
540
|
return y(
|
|
541
541
|
`${a}/api/checkout/pub/orderForm/${l}/messages/clear`,
|
|
542
542
|
{
|
|
543
|
-
...
|
|
544
|
-
headers:
|
|
543
|
+
...ne,
|
|
544
|
+
headers: p,
|
|
545
545
|
body: "{}"
|
|
546
546
|
}
|
|
547
547
|
);
|
|
548
548
|
},
|
|
549
549
|
updateOrderFormItems: ({
|
|
550
550
|
id: l,
|
|
551
|
-
orderItems:
|
|
551
|
+
orderItems: p,
|
|
552
552
|
allowOutdatedData: m = "paymentData",
|
|
553
553
|
salesChannel: S = i.storage.channel.salesChannel,
|
|
554
554
|
shouldSplitItem: v = !0
|
|
555
555
|
}) => {
|
|
556
|
-
const
|
|
556
|
+
const O = new URLSearchParams({
|
|
557
557
|
allowOutdatedData: m,
|
|
558
558
|
sc: S
|
|
559
|
-
}),
|
|
559
|
+
}), C = s({
|
|
560
560
|
"content-type": "application/json",
|
|
561
|
-
"X-FORWARDED-HOST":
|
|
561
|
+
"X-FORWARDED-HOST": u
|
|
562
562
|
});
|
|
563
563
|
return y(
|
|
564
|
-
`${a}/api/checkout/pub/orderForm/${l}/items?${
|
|
564
|
+
`${a}/api/checkout/pub/orderForm/${l}/items?${O}`,
|
|
565
565
|
{
|
|
566
|
-
headers:
|
|
566
|
+
headers: C,
|
|
567
567
|
body: JSON.stringify({
|
|
568
|
-
orderItems:
|
|
568
|
+
orderItems: p,
|
|
569
569
|
noSplitItem: !v
|
|
570
570
|
}),
|
|
571
571
|
method: "PATCH"
|
|
@@ -575,16 +575,16 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
575
575
|
},
|
|
576
576
|
setCustomData: ({
|
|
577
577
|
id: l,
|
|
578
|
-
appId:
|
|
578
|
+
appId: p,
|
|
579
579
|
key: m,
|
|
580
580
|
value: S
|
|
581
581
|
}) => {
|
|
582
582
|
const v = s({
|
|
583
583
|
"content-type": "application/json",
|
|
584
|
-
"X-FORWARDED-HOST":
|
|
584
|
+
"X-FORWARDED-HOST": u
|
|
585
585
|
});
|
|
586
586
|
return y(
|
|
587
|
-
`${a}/api/checkout/pub/orderForm/${l}/customData/${
|
|
587
|
+
`${a}/api/checkout/pub/orderForm/${l}/customData/${p}/${m}`,
|
|
588
588
|
{
|
|
589
589
|
headers: v,
|
|
590
590
|
body: JSON.stringify({ value: S }),
|
|
@@ -594,7 +594,7 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
594
594
|
},
|
|
595
595
|
region: async ({
|
|
596
596
|
postalCode: l,
|
|
597
|
-
geoCoordinates:
|
|
597
|
+
geoCoordinates: p,
|
|
598
598
|
country: m,
|
|
599
599
|
salesChannel: S
|
|
600
600
|
}) => {
|
|
@@ -604,30 +604,30 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
604
604
|
});
|
|
605
605
|
l ? v.append("postalCode", l) : v.append(
|
|
606
606
|
"geoCoordinates",
|
|
607
|
-
`${
|
|
607
|
+
`${p?.longitude};${p?.latitude}`
|
|
608
608
|
);
|
|
609
|
-
const
|
|
609
|
+
const O = `${a}/api/checkout/pub/regions/?${v.toString()}`, C = s({
|
|
610
610
|
"content-type": "application/json",
|
|
611
|
-
"X-FORWARDED-HOST":
|
|
611
|
+
"X-FORWARDED-HOST": u
|
|
612
612
|
});
|
|
613
613
|
return y(
|
|
614
|
-
|
|
614
|
+
O,
|
|
615
615
|
{
|
|
616
|
-
headers:
|
|
616
|
+
headers: C
|
|
617
617
|
},
|
|
618
618
|
{ storeCookies: o }
|
|
619
619
|
);
|
|
620
620
|
},
|
|
621
621
|
address: async ({
|
|
622
622
|
postalCode: l,
|
|
623
|
-
country:
|
|
623
|
+
country: p
|
|
624
624
|
}) => {
|
|
625
625
|
const m = s({
|
|
626
626
|
"content-type": "application/json",
|
|
627
|
-
"X-FORWARDED-HOST":
|
|
627
|
+
"X-FORWARDED-HOST": u
|
|
628
628
|
});
|
|
629
629
|
return y(
|
|
630
|
-
`${a}/api/checkout/pub/postal-code/${
|
|
630
|
+
`${a}/api/checkout/pub/postal-code/${p}/${l}`,
|
|
631
631
|
{
|
|
632
632
|
headers: m
|
|
633
633
|
},
|
|
@@ -636,12 +636,12 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
636
636
|
},
|
|
637
637
|
cancelOrder: ({
|
|
638
638
|
orderId: l,
|
|
639
|
-
customerEmail:
|
|
639
|
+
customerEmail: p,
|
|
640
640
|
reason: m
|
|
641
641
|
}) => {
|
|
642
642
|
const S = s({
|
|
643
643
|
"content-type": "application/json",
|
|
644
|
-
"X-FORWARDED-HOST":
|
|
644
|
+
"X-FORWARDED-HOST": u
|
|
645
645
|
});
|
|
646
646
|
return y(
|
|
647
647
|
`${a}/api/checkout/pub/orders/${l}/user-cancel-request`,
|
|
@@ -649,7 +649,7 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
649
649
|
method: "POST",
|
|
650
650
|
headers: S,
|
|
651
651
|
body: JSON.stringify({
|
|
652
|
-
customerEmail:
|
|
652
|
+
customerEmail: p,
|
|
653
653
|
reason: m
|
|
654
654
|
})
|
|
655
655
|
},
|
|
@@ -658,16 +658,16 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
658
658
|
}
|
|
659
659
|
},
|
|
660
660
|
session: (l) => {
|
|
661
|
-
const
|
|
662
|
-
|
|
661
|
+
const p = new URLSearchParams(l);
|
|
662
|
+
p.set(
|
|
663
663
|
"items",
|
|
664
664
|
"profile.id,profile.email,profile.firstName,profile.lastName,profile.phone,shopper.firstName,shopper.lastName,shopper.organizationManager,shopper.availableContracts,shopper.activeContractId,store.channel,store.countryCode,store.cultureInfo,store.currencyCode,store.currencySymbol,authentication.customerId,authentication.storeUserId,authentication.storeUserEmail,authentication.unitId,authentication.unitName,checkout.regionId,public.postalCode"
|
|
665
665
|
);
|
|
666
666
|
const m = s({
|
|
667
667
|
"content-type": "application/json"
|
|
668
|
-
}), S =
|
|
668
|
+
}), S = ae(i?.headers?.cookie ?? "")?.vtex_session;
|
|
669
669
|
return y(
|
|
670
|
-
`${a}/api/sessions?${
|
|
670
|
+
`${a}/api/sessions?${p.toString()}`,
|
|
671
671
|
{
|
|
672
672
|
method: S ? "PATCH" : "POST",
|
|
673
673
|
headers: m,
|
|
@@ -683,14 +683,14 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
683
683
|
* no app keys involved.
|
|
684
684
|
*/
|
|
685
685
|
attachedContracts: (l) => {
|
|
686
|
-
const
|
|
686
|
+
const p = s({
|
|
687
687
|
"content-type": "application/json"
|
|
688
688
|
});
|
|
689
689
|
return y(
|
|
690
690
|
`https://${e}.myvtex.com/_v/store-front/units/${encodeURIComponent(
|
|
691
691
|
l
|
|
692
692
|
)}/contracts/attached?details=true`,
|
|
693
|
-
{ headers:
|
|
693
|
+
{ headers: p },
|
|
694
694
|
{ storeCookies: o }
|
|
695
695
|
);
|
|
696
696
|
}
|
|
@@ -709,11 +709,11 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
709
709
|
*/
|
|
710
710
|
subscribeToNewsletter: ({
|
|
711
711
|
name: l,
|
|
712
|
-
email:
|
|
712
|
+
email: p
|
|
713
713
|
}) => {
|
|
714
714
|
const m = JSON.stringify({
|
|
715
715
|
...l ? { name: l } : {},
|
|
716
|
-
email:
|
|
716
|
+
email: p,
|
|
717
717
|
isNewsletterOptIn: !0
|
|
718
718
|
}), S = process.env.FS_NEWSLETTER_APP_KEY, v = process.env.FS_NEWSLETTER_APP_TOKEN;
|
|
719
719
|
if (S && v)
|
|
@@ -727,18 +727,18 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
727
727
|
},
|
|
728
728
|
body: m
|
|
729
729
|
});
|
|
730
|
-
if (!
|
|
731
|
-
|
|
732
|
-
const
|
|
730
|
+
if (!se.has(e)) {
|
|
731
|
+
se.size >= zt && se.clear(), se.add(e);
|
|
732
|
+
const O = [
|
|
733
733
|
!S && "FS_NEWSLETTER_APP_KEY",
|
|
734
734
|
!v && "FS_NEWSLETTER_APP_TOKEN"
|
|
735
|
-
].filter(Boolean),
|
|
736
|
-
console.warn(
|
|
735
|
+
].filter(Boolean), C = `[subscribeToNewsletter] ${O.join(" and ")} ${O.length > 1 ? "are" : "is"} not set. Falling back to an anonymous Master Data request, which requires public fields in the NL entity. Configure both credentials and make the NL fields private.`;
|
|
736
|
+
console.warn(C), Ue("warn", "%s", C);
|
|
737
737
|
}
|
|
738
738
|
return y(
|
|
739
739
|
`${a}/api/dataentities/NL/documents/`,
|
|
740
740
|
{
|
|
741
|
-
...
|
|
741
|
+
...ne,
|
|
742
742
|
body: m,
|
|
743
743
|
method: "PATCH"
|
|
744
744
|
},
|
|
@@ -747,74 +747,74 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
747
747
|
},
|
|
748
748
|
profile: {
|
|
749
749
|
addresses: async (l) => {
|
|
750
|
-
const
|
|
750
|
+
const p = s({
|
|
751
751
|
"content-type": "application/json",
|
|
752
|
-
"X-FORWARDED-HOST":
|
|
752
|
+
"X-FORWARDED-HOST": u
|
|
753
753
|
});
|
|
754
754
|
return y(
|
|
755
755
|
`${a}/api/profile-system/pvt/profiles/${l}/addresses`,
|
|
756
|
-
{ headers:
|
|
756
|
+
{ headers: p },
|
|
757
757
|
{ storeCookies: o }
|
|
758
758
|
);
|
|
759
759
|
}
|
|
760
760
|
},
|
|
761
761
|
oms: {
|
|
762
762
|
userOrder: ({ orderId: l }) => {
|
|
763
|
-
const
|
|
763
|
+
const p = s({
|
|
764
764
|
"content-type": "application/json",
|
|
765
|
-
"X-FORWARDED-HOST":
|
|
765
|
+
"X-FORWARDED-HOST": u
|
|
766
766
|
});
|
|
767
767
|
return y(
|
|
768
768
|
`${a}/api/oms/user/orders/${l}`,
|
|
769
769
|
{
|
|
770
770
|
method: "GET",
|
|
771
|
-
headers:
|
|
771
|
+
headers: p
|
|
772
772
|
},
|
|
773
773
|
{ storeCookies: o }
|
|
774
774
|
);
|
|
775
775
|
},
|
|
776
776
|
listUserOrders: ({
|
|
777
777
|
page: l,
|
|
778
|
-
status:
|
|
778
|
+
status: p,
|
|
779
779
|
dateInitial: m,
|
|
780
780
|
dateFinal: S,
|
|
781
781
|
text: v,
|
|
782
|
-
clientEmail:
|
|
783
|
-
perPage:
|
|
782
|
+
clientEmail: O,
|
|
783
|
+
perPage: C,
|
|
784
784
|
pendingMyApproval: T
|
|
785
785
|
}) => {
|
|
786
|
-
const
|
|
786
|
+
const w = new URLSearchParams();
|
|
787
787
|
if (m) {
|
|
788
|
-
const
|
|
788
|
+
const A = new Date(m).setHours(
|
|
789
789
|
0,
|
|
790
790
|
0,
|
|
791
791
|
0,
|
|
792
792
|
0
|
|
793
793
|
);
|
|
794
|
-
m = new Date(
|
|
794
|
+
m = new Date(A).toISOString();
|
|
795
795
|
}
|
|
796
796
|
if (S) {
|
|
797
|
-
const
|
|
797
|
+
const A = new Date(S).setHours(
|
|
798
798
|
23,
|
|
799
799
|
59,
|
|
800
800
|
59,
|
|
801
801
|
999
|
|
802
802
|
);
|
|
803
|
-
S = new Date(
|
|
803
|
+
S = new Date(A).toISOString();
|
|
804
804
|
}
|
|
805
|
-
v &&
|
|
805
|
+
v && w.append("text", v), p && p.length > 0 && w.append("status", p.filter(Boolean).join(",")), m && S ? w.append(
|
|
806
806
|
"creation_date",
|
|
807
807
|
`creationDate:[${m} TO ${S}]`
|
|
808
|
-
) : m ?
|
|
809
|
-
const
|
|
808
|
+
) : m ? w.append("creation_date", `creationDate:[${m} TO *]`) : S && w.append("creation_date", `creationDate:[* TO ${S}]`), O && w.append("clientEmail", O), l && w.append("page", l.toString()), C && w.append("per_page", C.toString()), T && w.append("my_pending_approvals", String(!0));
|
|
809
|
+
const b = s({
|
|
810
810
|
"content-type": "application/json",
|
|
811
|
-
"X-FORWARDED-HOST":
|
|
811
|
+
"X-FORWARDED-HOST": u
|
|
812
812
|
});
|
|
813
813
|
return y(
|
|
814
|
-
`${a}/api/oms/user/orders?${
|
|
814
|
+
`${a}/api/oms/user/orders?${w.toString()}`,
|
|
815
815
|
{
|
|
816
816
|
method: "GET",
|
|
817
|
-
headers:
|
|
817
|
+
headers: b
|
|
818
818
|
},
|
|
819
819
|
{ storeCookies: o }
|
|
820
820
|
);
|
|
@@ -822,32 +822,32 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
822
822
|
getCommercialAuthorizationsByOrderId: ({
|
|
823
823
|
orderId: l
|
|
824
824
|
}) => {
|
|
825
|
-
const
|
|
825
|
+
const p = s({
|
|
826
826
|
"content-type": "application/json",
|
|
827
|
-
"X-FORWARDED-HOST":
|
|
827
|
+
"X-FORWARDED-HOST": u
|
|
828
828
|
});
|
|
829
829
|
return y(
|
|
830
830
|
`${a}/${e}/commercial-authorizations/order/${l}`,
|
|
831
831
|
{
|
|
832
832
|
method: "GET",
|
|
833
|
-
headers:
|
|
833
|
+
headers: p
|
|
834
834
|
},
|
|
835
835
|
{ storeCookies: o }
|
|
836
836
|
);
|
|
837
837
|
},
|
|
838
838
|
processOrderAuthorization: async ({
|
|
839
839
|
orderAuthorizationId: l,
|
|
840
|
-
dimensionId:
|
|
840
|
+
dimensionId: p,
|
|
841
841
|
ruleId: m,
|
|
842
842
|
approved: S
|
|
843
843
|
}) => {
|
|
844
844
|
const v = s({
|
|
845
845
|
"content-type": "application/json",
|
|
846
|
-
"X-FORWARDED-HOST":
|
|
846
|
+
"X-FORWARDED-HOST": u
|
|
847
847
|
}), T = {
|
|
848
848
|
params: {
|
|
849
849
|
ruleId: m,
|
|
850
|
-
dimensionId:
|
|
850
|
+
dimensionId: p,
|
|
851
851
|
score: S ? 100 : 0
|
|
852
852
|
}
|
|
853
853
|
};
|
|
@@ -866,7 +866,7 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
866
866
|
listCreditCards: () => {
|
|
867
867
|
const l = s({
|
|
868
868
|
"content-type": "application/json",
|
|
869
|
-
"X-FORWARDED-HOST":
|
|
869
|
+
"X-FORWARDED-HOST": u
|
|
870
870
|
});
|
|
871
871
|
return y(
|
|
872
872
|
`${a}/api/saved-cards/credit-card?an=${e}`,
|
|
@@ -882,15 +882,15 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
882
882
|
getUnitByUserId: ({
|
|
883
883
|
userId: l
|
|
884
884
|
}) => {
|
|
885
|
-
const
|
|
885
|
+
const p = s({
|
|
886
886
|
"content-type": "application/json",
|
|
887
|
-
"X-FORWARDED-HOST":
|
|
887
|
+
"X-FORWARDED-HOST": u
|
|
888
888
|
});
|
|
889
889
|
return y(
|
|
890
890
|
`${a}/api/units/v1/${l}/unit`,
|
|
891
891
|
{
|
|
892
892
|
method: "GET",
|
|
893
|
-
headers:
|
|
893
|
+
headers: p
|
|
894
894
|
},
|
|
895
895
|
{}
|
|
896
896
|
);
|
|
@@ -898,15 +898,15 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
898
898
|
getOrgUnitById: ({
|
|
899
899
|
orgUnitId: l
|
|
900
900
|
}) => {
|
|
901
|
-
const
|
|
901
|
+
const p = s({
|
|
902
902
|
"content-type": "application/json",
|
|
903
|
-
"X-FORWARDED-HOST":
|
|
903
|
+
"X-FORWARDED-HOST": u
|
|
904
904
|
});
|
|
905
905
|
return y(
|
|
906
906
|
`${a}/api/units/v1/${l}`,
|
|
907
907
|
{
|
|
908
908
|
method: "GET",
|
|
909
|
-
headers:
|
|
909
|
+
headers: p
|
|
910
910
|
},
|
|
911
911
|
{}
|
|
912
912
|
);
|
|
@@ -914,15 +914,15 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
914
914
|
getScopesByOrgUnit: ({
|
|
915
915
|
orgUnitId: l
|
|
916
916
|
}) => {
|
|
917
|
-
const
|
|
917
|
+
const p = s({
|
|
918
918
|
"content-type": "application/json",
|
|
919
|
-
"X-FORWARDED-HOST":
|
|
919
|
+
"X-FORWARDED-HOST": u
|
|
920
920
|
});
|
|
921
921
|
return y(
|
|
922
922
|
`${a}/api/units/v1/${l}/scopes`,
|
|
923
923
|
{
|
|
924
924
|
method: "GET",
|
|
925
|
-
headers:
|
|
925
|
+
headers: p
|
|
926
926
|
},
|
|
927
927
|
{}
|
|
928
928
|
);
|
|
@@ -932,15 +932,15 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
932
932
|
getUserById: ({
|
|
933
933
|
userId: l
|
|
934
934
|
}) => {
|
|
935
|
-
const
|
|
935
|
+
const p = s({
|
|
936
936
|
"content-type": "application/json",
|
|
937
|
-
"X-FORWARDED-HOST":
|
|
937
|
+
"X-FORWARDED-HOST": u
|
|
938
938
|
});
|
|
939
939
|
return y(
|
|
940
940
|
`${a}/api/license-manager/users/${l}`,
|
|
941
941
|
{
|
|
942
942
|
method: "GET",
|
|
943
|
-
headers:
|
|
943
|
+
headers: p
|
|
944
944
|
},
|
|
945
945
|
{}
|
|
946
946
|
);
|
|
@@ -948,15 +948,15 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
948
948
|
getUserByEmail: ({
|
|
949
949
|
email: l
|
|
950
950
|
}) => {
|
|
951
|
-
const
|
|
951
|
+
const p = s({
|
|
952
952
|
"content-type": "application/json",
|
|
953
|
-
"X-FORWARDED-HOST":
|
|
953
|
+
"X-FORWARDED-HOST": u
|
|
954
954
|
});
|
|
955
955
|
return y(
|
|
956
956
|
`${a}/api/license-manager/pvt/users/${l}`,
|
|
957
957
|
{
|
|
958
958
|
method: "GET",
|
|
959
|
-
headers:
|
|
959
|
+
headers: p
|
|
960
960
|
},
|
|
961
961
|
{}
|
|
962
962
|
);
|
|
@@ -964,15 +964,15 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
964
964
|
getUserRoles: ({
|
|
965
965
|
userId: l
|
|
966
966
|
}) => {
|
|
967
|
-
const
|
|
967
|
+
const p = s({
|
|
968
968
|
"content-type": "application/json",
|
|
969
|
-
"X-FORWARDED-HOST":
|
|
969
|
+
"X-FORWARDED-HOST": u
|
|
970
970
|
});
|
|
971
971
|
return y(
|
|
972
972
|
`${a}/api/license-manager/storefront/users/${l}/roles`,
|
|
973
973
|
{
|
|
974
974
|
method: "GET",
|
|
975
|
-
headers:
|
|
975
|
+
headers: p
|
|
976
976
|
},
|
|
977
977
|
{}
|
|
978
978
|
);
|
|
@@ -985,14 +985,14 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
985
985
|
*/
|
|
986
986
|
isResourceGranted: ({
|
|
987
987
|
userId: l,
|
|
988
|
-
resourceKey:
|
|
988
|
+
resourceKey: p
|
|
989
989
|
}) => {
|
|
990
990
|
const m = s({
|
|
991
991
|
"content-type": "application/json",
|
|
992
|
-
"X-FORWARDED-HOST":
|
|
992
|
+
"X-FORWARDED-HOST": u
|
|
993
993
|
});
|
|
994
994
|
return y(
|
|
995
|
-
`${a}/api/license-manager/storefront/bff/users/${l}/resources/${
|
|
995
|
+
`${a}/api/license-manager/storefront/bff/users/${l}/resources/${p}/granted?an=${e}`,
|
|
996
996
|
{
|
|
997
997
|
method: "GET",
|
|
998
998
|
headers: m
|
|
@@ -1007,7 +1007,7 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1007
1007
|
}) => {
|
|
1008
1008
|
if (!l)
|
|
1009
1009
|
throw new k("Missing contractId to fetch CL fields.");
|
|
1010
|
-
const
|
|
1010
|
+
const p = I({
|
|
1011
1011
|
Accept: "application/json",
|
|
1012
1012
|
"content-type": "application/json"
|
|
1013
1013
|
});
|
|
@@ -1015,7 +1015,7 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1015
1015
|
`${a}/api/dataentities/CL/documents/${l}?_fields=_all`,
|
|
1016
1016
|
{
|
|
1017
1017
|
method: "GET",
|
|
1018
|
-
headers:
|
|
1018
|
+
headers: p
|
|
1019
1019
|
},
|
|
1020
1020
|
{}
|
|
1021
1021
|
);
|
|
@@ -1025,16 +1025,16 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1025
1025
|
}) => {
|
|
1026
1026
|
if (!l)
|
|
1027
1027
|
throw new k("Missing userId to fetch shopper name.");
|
|
1028
|
-
const
|
|
1028
|
+
const p = c({
|
|
1029
1029
|
Accept: "application/json",
|
|
1030
1030
|
"content-type": "application/json",
|
|
1031
|
-
"X-FORWARDED-HOST":
|
|
1031
|
+
"X-FORWARDED-HOST": u
|
|
1032
1032
|
}), m = l.replace(/-/g, "");
|
|
1033
1033
|
return y(
|
|
1034
1034
|
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${l})&_fields=_all&_schema=v1`,
|
|
1035
1035
|
{
|
|
1036
1036
|
method: "GET",
|
|
1037
|
-
headers:
|
|
1037
|
+
headers: p
|
|
1038
1038
|
},
|
|
1039
1039
|
{}
|
|
1040
1040
|
);
|
|
@@ -1042,13 +1042,13 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1042
1042
|
},
|
|
1043
1043
|
quotes: {
|
|
1044
1044
|
listUserQuotes: (l) => {
|
|
1045
|
-
|
|
1046
|
-
const
|
|
1045
|
+
jt(l);
|
|
1046
|
+
const p = Wt(l), m = s({
|
|
1047
1047
|
"content-type": "application/json",
|
|
1048
|
-
"X-FORWARDED-HOST":
|
|
1048
|
+
"X-FORWARDED-HOST": u
|
|
1049
1049
|
});
|
|
1050
1050
|
return y(
|
|
1051
|
-
`${a}/api/quoting/quotes?${
|
|
1051
|
+
`${a}/api/quoting/quotes?${p.toString()}`,
|
|
1052
1052
|
{
|
|
1053
1053
|
method: "GET",
|
|
1054
1054
|
headers: m
|
|
@@ -1061,13 +1061,13 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1061
1061
|
validate: () => {
|
|
1062
1062
|
const l = s({
|
|
1063
1063
|
"content-type": "application/json",
|
|
1064
|
-
"X-FORWARDED-HOST":
|
|
1065
|
-
}),
|
|
1064
|
+
"X-FORWARDED-HOST": u
|
|
1065
|
+
}), p = z(Ie(i) ?? "", e);
|
|
1066
1066
|
return y(
|
|
1067
1067
|
`${a}/api/vtexid/credential/validate`,
|
|
1068
1068
|
{
|
|
1069
1069
|
headers: l,
|
|
1070
|
-
body: JSON.stringify({ token:
|
|
1070
|
+
body: JSON.stringify({ token: p }),
|
|
1071
1071
|
method: "POST"
|
|
1072
1072
|
},
|
|
1073
1073
|
{ storeCookies: o }
|
|
@@ -1077,24 +1077,24 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1077
1077
|
orderEntry: {
|
|
1078
1078
|
uploadFile: ({
|
|
1079
1079
|
fileBuffer: l,
|
|
1080
|
-
fileName:
|
|
1080
|
+
fileName: p,
|
|
1081
1081
|
mimeType: m
|
|
1082
1082
|
}) => {
|
|
1083
1083
|
const S = s({
|
|
1084
1084
|
"content-type": "application/json",
|
|
1085
|
-
"X-FORWARDED-HOST":
|
|
1086
|
-
}), v = `----FastStoreUploadBoundary${Date.now()}`,
|
|
1087
|
-
`, T = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream",
|
|
1085
|
+
"X-FORWARDED-HOST": u
|
|
1086
|
+
}), v = `----FastStoreUploadBoundary${Date.now()}`, O = `\r
|
|
1087
|
+
`, T = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", w = p.replaceAll(/[\r\n"]/g, "_"), b = [
|
|
1088
1088
|
`--${v}`,
|
|
1089
|
-
`Content-Disposition: form-data; name="file"; filename="${
|
|
1089
|
+
`Content-Disposition: form-data; name="file"; filename="${w}"`,
|
|
1090
1090
|
`Content-Type: ${T}`,
|
|
1091
1091
|
"",
|
|
1092
1092
|
""
|
|
1093
|
-
].join(
|
|
1094
|
-
|
|
1093
|
+
].join(O), A = `${O}--${v}--${O}`, E = Buffer.from(b), _ = Buffer.from(A), D = new Uint8Array(
|
|
1094
|
+
E.byteLength + l.byteLength + _.byteLength
|
|
1095
1095
|
);
|
|
1096
|
-
let
|
|
1097
|
-
return
|
|
1096
|
+
let U = 0;
|
|
1097
|
+
return D.set(E, U), U += E.byteLength, D.set(l, U), U += l.byteLength, D.set(_, U), y(
|
|
1098
1098
|
`${a}/api/order-entry/upload?an=${e}`,
|
|
1099
1099
|
{
|
|
1100
1100
|
method: "POST",
|
|
@@ -1102,22 +1102,22 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1102
1102
|
...S,
|
|
1103
1103
|
"content-type": `multipart/form-data; boundary=${v}`
|
|
1104
1104
|
},
|
|
1105
|
-
body:
|
|
1105
|
+
body: D.buffer
|
|
1106
1106
|
},
|
|
1107
1107
|
{}
|
|
1108
1108
|
);
|
|
1109
1109
|
},
|
|
1110
1110
|
startOperation: ({
|
|
1111
1111
|
objectKey: l,
|
|
1112
|
-
orderFormId:
|
|
1112
|
+
orderFormId: p,
|
|
1113
1113
|
sessionToken: m
|
|
1114
1114
|
}) => {
|
|
1115
1115
|
const S = s({
|
|
1116
1116
|
"content-type": "application/json",
|
|
1117
|
-
"X-FORWARDED-HOST":
|
|
1117
|
+
"X-FORWARDED-HOST": u
|
|
1118
1118
|
}), v = JSON.stringify({
|
|
1119
1119
|
objectKey: l,
|
|
1120
|
-
orderFormId:
|
|
1120
|
+
orderFormId: p,
|
|
1121
1121
|
operation: "CreateCart",
|
|
1122
1122
|
...m ? { sessionToken: m } : {}
|
|
1123
1123
|
});
|
|
@@ -1134,15 +1134,15 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1134
1134
|
getOperation: ({
|
|
1135
1135
|
operationId: l
|
|
1136
1136
|
}) => {
|
|
1137
|
-
const
|
|
1137
|
+
const p = s({
|
|
1138
1138
|
"content-type": "application/json",
|
|
1139
|
-
"X-FORWARDED-HOST":
|
|
1139
|
+
"X-FORWARDED-HOST": u
|
|
1140
1140
|
});
|
|
1141
1141
|
return y(
|
|
1142
1142
|
`${a}/api/order-entry/operation/${l}?an=${e}`,
|
|
1143
1143
|
{
|
|
1144
1144
|
method: "GET",
|
|
1145
|
-
headers:
|
|
1145
|
+
headers: p
|
|
1146
1146
|
},
|
|
1147
1147
|
{}
|
|
1148
1148
|
);
|
|
@@ -1150,7 +1150,7 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1150
1150
|
createOrderForm: () => {
|
|
1151
1151
|
const l = s({
|
|
1152
1152
|
"content-type": "application/json",
|
|
1153
|
-
"X-FORWARDED-HOST":
|
|
1153
|
+
"X-FORWARDED-HOST": u
|
|
1154
1154
|
});
|
|
1155
1155
|
return y(
|
|
1156
1156
|
`${a}/api/checkout/pub/orderForm?sc=${i.storage.channel.salesChannel}`,
|
|
@@ -1165,15 +1165,15 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1165
1165
|
getOrderFormItems: ({
|
|
1166
1166
|
orderFormId: l
|
|
1167
1167
|
}) => {
|
|
1168
|
-
const
|
|
1168
|
+
const p = s({
|
|
1169
1169
|
"content-type": "application/json",
|
|
1170
|
-
"X-FORWARDED-HOST":
|
|
1170
|
+
"X-FORWARDED-HOST": u
|
|
1171
1171
|
});
|
|
1172
1172
|
return y(
|
|
1173
1173
|
`${a}/api/checkout/pub/orderForm/${l}`,
|
|
1174
1174
|
{
|
|
1175
1175
|
method: "GET",
|
|
1176
|
-
headers:
|
|
1176
|
+
headers: p
|
|
1177
1177
|
},
|
|
1178
1178
|
{}
|
|
1179
1179
|
);
|
|
@@ -1186,14 +1186,14 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1186
1186
|
recommendation: {
|
|
1187
1187
|
recommendations: ({
|
|
1188
1188
|
campaignVrn: l,
|
|
1189
|
-
userId:
|
|
1189
|
+
userId: p,
|
|
1190
1190
|
products: m = [],
|
|
1191
1191
|
salesChannel: S,
|
|
1192
1192
|
locale: v
|
|
1193
1193
|
}) => {
|
|
1194
|
-
const
|
|
1195
|
-
return
|
|
1196
|
-
`${f}/recommendations?${
|
|
1194
|
+
const O = new URLSearchParams({ an: e, campaignVrn: l });
|
|
1195
|
+
return p && O.append("userId", p), m.length > 0 && O.append("products", m.join(",")), S && O.append("salesChannel", S), v && O.append("locale", v), y(
|
|
1196
|
+
`${f}/recommendations?${O.toString()}`,
|
|
1197
1197
|
{ headers: h },
|
|
1198
1198
|
{ storeCookies: o }
|
|
1199
1199
|
);
|
|
@@ -1208,27 +1208,27 @@ const xt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
|
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
1210
1210
|
};
|
|
1211
|
-
},
|
|
1212
|
-
|
|
1213
|
-
|
|
1211
|
+
}, ie = (e) => e.discoveryConfig?.localization ?? {}, K = (e) => ie(e).enabled === !0, Gt = (e) => Object.keys(ie(e).locales ?? {}), Xt = (e) => ie(e).defaultLocale, Pn = (e) => K(e) && e.storage.locale || void 0, ve = "fuzzy", Oe = "operator", Ce = "pickupPoint", xe = "shipping", qe = "delivery-options", Yt = "in-stock", Kt = "trade-policy", Jt = "region-id", Qt = /* @__PURE__ */ new Set([
|
|
1212
|
+
Kt,
|
|
1213
|
+
Jt,
|
|
1214
|
+
ve,
|
|
1214
1215
|
Oe,
|
|
1215
|
-
Ce
|
|
1216
|
-
|
|
1217
|
-
]), Kt = /* @__PURE__ */ new Set([
|
|
1216
|
+
Ce
|
|
1217
|
+
]), Zt = /* @__PURE__ */ new Set([
|
|
1218
1218
|
"zip-code",
|
|
1219
1219
|
"pickupPoint",
|
|
1220
1220
|
"country",
|
|
1221
1221
|
"coordinates",
|
|
1222
1222
|
"deliveryZonesHash",
|
|
1223
1223
|
"pickupPointsHash"
|
|
1224
|
-
]),
|
|
1224
|
+
]), je = (e) => encodeURI(decodeURI(e)), er = (e) => encodeURIComponent(
|
|
1225
1225
|
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
1226
|
-
),
|
|
1227
|
-
function
|
|
1226
|
+
), nr = /^pickup-in-point-(.+)$/;
|
|
1227
|
+
function Re(e) {
|
|
1228
1228
|
if (!e)
|
|
1229
1229
|
return {};
|
|
1230
1230
|
try {
|
|
1231
|
-
const t =
|
|
1231
|
+
const t = ae(e).vtex_segment;
|
|
1232
1232
|
if (!t)
|
|
1233
1233
|
return {};
|
|
1234
1234
|
const r = Buffer.from(t, "base64").toString("utf-8");
|
|
@@ -1237,18 +1237,18 @@ function An(e) {
|
|
|
1237
1237
|
return {};
|
|
1238
1238
|
}
|
|
1239
1239
|
}
|
|
1240
|
-
function
|
|
1240
|
+
function tr(e) {
|
|
1241
1241
|
const n = {}, t = [];
|
|
1242
1242
|
for (const r of e.split(";")) {
|
|
1243
1243
|
const i = r.indexOf("=");
|
|
1244
1244
|
if (i < 0) continue;
|
|
1245
1245
|
const a = r.slice(0, i), o = r.slice(i + 1);
|
|
1246
|
-
!a || !o || (
|
|
1246
|
+
!a || !o || (Zt.has(a) ? n[a] = o : t.push({ key: a, value: o }));
|
|
1247
1247
|
}
|
|
1248
1248
|
return { shipping: n, extraFacets: t };
|
|
1249
1249
|
}
|
|
1250
|
-
function
|
|
1251
|
-
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } =
|
|
1250
|
+
function Dn(e) {
|
|
1251
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, extraFacets: r } = tr(n);
|
|
1252
1252
|
return {
|
|
1253
1253
|
segmentParams: {
|
|
1254
1254
|
sc: e.channel,
|
|
@@ -1269,7 +1269,10 @@ function er(e) {
|
|
|
1269
1269
|
extraFacets: r
|
|
1270
1270
|
};
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1272
|
+
function rr(e) {
|
|
1273
|
+
return Dn(e).extraFacets;
|
|
1274
|
+
}
|
|
1275
|
+
function En(e, n) {
|
|
1273
1276
|
const t = [
|
|
1274
1277
|
["sc", n.sc],
|
|
1275
1278
|
["regionId", n.regionId],
|
|
@@ -1289,11 +1292,11 @@ function Pn(e, n) {
|
|
|
1289
1292
|
for (const [r, i] of t)
|
|
1290
1293
|
i != null && i !== "" && e.append(r, String(i));
|
|
1291
1294
|
}
|
|
1292
|
-
function
|
|
1293
|
-
return
|
|
1295
|
+
function kn(e) {
|
|
1296
|
+
return nr.exec(e)?.[1];
|
|
1294
1297
|
}
|
|
1295
|
-
function
|
|
1296
|
-
const n = e.find((r) => r.key === "shipping"), t = n ?
|
|
1298
|
+
function ir(e) {
|
|
1299
|
+
const n = e.find((r) => r.key === "shipping"), t = n ? kn(n.value) : void 0;
|
|
1297
1300
|
if (t !== void 0)
|
|
1298
1301
|
try {
|
|
1299
1302
|
return decodeURIComponent(t);
|
|
@@ -1301,8 +1304,8 @@ function nr(e) {
|
|
|
1301
1304
|
return t;
|
|
1302
1305
|
}
|
|
1303
1306
|
}
|
|
1304
|
-
function
|
|
1305
|
-
const t =
|
|
1307
|
+
function ar(e, n) {
|
|
1308
|
+
const t = ir(
|
|
1306
1309
|
n
|
|
1307
1310
|
);
|
|
1308
1311
|
return t === void 0 ? e : {
|
|
@@ -1310,25 +1313,25 @@ function tr(e, n) {
|
|
|
1310
1313
|
pickupPoint: t
|
|
1311
1314
|
};
|
|
1312
1315
|
}
|
|
1313
|
-
function
|
|
1314
|
-
return e.map((n) => n.key !== "shipping" ||
|
|
1316
|
+
function or(e) {
|
|
1317
|
+
return e.map((n) => n.key !== "shipping" || kn(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1315
1318
|
}
|
|
1316
|
-
function
|
|
1319
|
+
function sr(e, n) {
|
|
1317
1320
|
let t = [...e];
|
|
1318
1321
|
const r = t.some((i) => i.key === "shipping");
|
|
1319
1322
|
for (const i of n)
|
|
1320
1323
|
(!r || i.key !== "shipping") && t.push(i);
|
|
1321
|
-
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")),
|
|
1324
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), or(t);
|
|
1322
1325
|
}
|
|
1323
|
-
function
|
|
1326
|
+
function _n(e) {
|
|
1324
1327
|
return e.reduce((n, t) => {
|
|
1325
1328
|
let { key: r, value: i } = t;
|
|
1326
|
-
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${
|
|
1329
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${je(r)}/${er(je(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1327
1330
|
}, "");
|
|
1328
1331
|
}
|
|
1329
|
-
const
|
|
1330
|
-
function
|
|
1331
|
-
const { segmentParams: t, extraFacets: r } =
|
|
1332
|
+
const cr = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), lr = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1333
|
+
function dr(e, n) {
|
|
1334
|
+
const { segmentParams: t, extraFacets: r } = Dn(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
|
|
1332
1335
|
return {
|
|
1333
1336
|
segmentParams: {
|
|
1334
1337
|
...t,
|
|
@@ -1339,23 +1342,23 @@ function sr(e, n) {
|
|
|
1339
1342
|
extraFacets: r
|
|
1340
1343
|
};
|
|
1341
1344
|
}
|
|
1342
|
-
function
|
|
1343
|
-
const t = e.filter(({ key: c }) => !
|
|
1344
|
-
({ key: c, value: d }) => c ===
|
|
1345
|
+
function ur(e, n) {
|
|
1346
|
+
const t = e.filter(({ key: c }) => !Qt.has(c)), r = e.find(
|
|
1347
|
+
({ key: c, value: d }) => c === xe && d !== "all-delivery-methods"
|
|
1345
1348
|
) ?? null, i = e.find(
|
|
1346
|
-
({ key: c, value: d }) => c ===
|
|
1349
|
+
({ key: c, value: d }) => c === qe && d !== "all-delivery-options"
|
|
1347
1350
|
) ?? null, a = [...t], o = a.some(
|
|
1348
|
-
({ key: c }) => c ===
|
|
1351
|
+
({ key: c }) => c === xe
|
|
1349
1352
|
), s = a.some(
|
|
1350
|
-
({ key: c }) => c ===
|
|
1353
|
+
({ key: c }) => c === qe
|
|
1351
1354
|
);
|
|
1352
|
-
return r !== null && !o && a.push(r), i !== null && !s && a.push(i),
|
|
1355
|
+
return r !== null && !o && a.push(r), i !== null && !s && a.push(i), sr(a, n);
|
|
1353
1356
|
}
|
|
1354
|
-
function
|
|
1355
|
-
const t = e.find(({ key: a }) => a ===
|
|
1356
|
-
t &&
|
|
1357
|
+
function pr(e, n) {
|
|
1358
|
+
const t = e.find(({ key: a }) => a === ve) ?? null, r = e.find(({ key: a }) => a === Oe) ?? null, i = e.find(({ key: a }) => a === Ce) ?? null;
|
|
1359
|
+
t && cr(t) && n.append(ve, t.value), r && lr(r) && n.append(Oe, r.value), i && n.append(Ce, i.value);
|
|
1357
1360
|
}
|
|
1358
|
-
function
|
|
1361
|
+
function We(e, n, t, r) {
|
|
1359
1362
|
const {
|
|
1360
1363
|
query: i = "",
|
|
1361
1364
|
page: a,
|
|
@@ -1364,48 +1367,48 @@ function xe(e, n, t, r) {
|
|
|
1364
1367
|
selectedFacets: c = [],
|
|
1365
1368
|
showInvisibleItems: d,
|
|
1366
1369
|
sponsoredCount: g,
|
|
1367
|
-
hideUnavailableItems:
|
|
1370
|
+
hideUnavailableItems: u,
|
|
1368
1371
|
allowRedirect: f = !1
|
|
1369
1372
|
} = e, h = new URLSearchParams();
|
|
1370
1373
|
if (r.includePagination && a !== void 0 && o !== void 0) {
|
|
1371
|
-
const
|
|
1372
|
-
h.append("from",
|
|
1374
|
+
const p = a * o, m = o === 0 ? p : p + o - 1;
|
|
1375
|
+
h.append("from", p.toString()), h.append("to", m.toString());
|
|
1373
1376
|
}
|
|
1374
1377
|
i && h.append("query", i), r.includeSort && s && h.append("sort", s);
|
|
1375
|
-
const I =
|
|
1378
|
+
const I = ar(
|
|
1376
1379
|
t.segmentParams,
|
|
1377
1380
|
c
|
|
1378
1381
|
);
|
|
1379
|
-
if (
|
|
1380
|
-
const
|
|
1382
|
+
if (En(h, I ?? t.segmentParams), pr(c, h), d && h.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1383
|
+
const p = c.find(({ key: S }) => S === Yt), m = p ? p.value : u?.toString() ?? n.hideUnavailableItems.toString();
|
|
1381
1384
|
h.append("hideUnavailableItems", m);
|
|
1382
1385
|
}
|
|
1383
1386
|
n?.simulationBehavior !== void 0 && h.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && h.append("showSponsored", n.showSponsored.toString()), g !== void 0 && h.append("sponsoredCount", g.toString()), f !== void 0 && h.append("allowRedirect", f.toString());
|
|
1384
|
-
const l =
|
|
1385
|
-
|
|
1387
|
+
const l = _n(
|
|
1388
|
+
ur(c, t.extraFacets)
|
|
1386
1389
|
);
|
|
1387
1390
|
return { params: h, path: l };
|
|
1388
1391
|
}
|
|
1389
|
-
function
|
|
1392
|
+
function gr(e, n) {
|
|
1390
1393
|
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: a } = e, o = new URLSearchParams({
|
|
1391
1394
|
field: t ?? "",
|
|
1392
1395
|
value: r ?? ""
|
|
1393
1396
|
});
|
|
1394
|
-
return
|
|
1397
|
+
return En(o, n), i && o.append("hideUnavailableItems", "true"), a && o.append("show-invisible-items", "true"), o;
|
|
1395
1398
|
}
|
|
1396
|
-
function
|
|
1399
|
+
function ce(e) {
|
|
1397
1400
|
return (e ?? "").replaceAll(/[\s-]/g, "").toUpperCase();
|
|
1398
1401
|
}
|
|
1399
|
-
function
|
|
1400
|
-
const { segmentParams: t, extraFacets: r } = n, { postalCode: i, country: a, coordinates: o } = e, s = !!i, c = a || t.country, d = s &&
|
|
1401
|
-
if ((!g || !
|
|
1402
|
+
function mr(e, n) {
|
|
1403
|
+
const { segmentParams: t, extraFacets: r } = n, { postalCode: i, country: a, coordinates: o } = e, s = !!i, c = a || t.country, d = s && ce(i) === ce(t["zip-code"]) && ce(c) === ce(t.country), g = s ? i : t["zip-code"], u = s ? c : t.country, f = d ? t.coordinates : void 0, h = s ? o ?? f : o || t.coordinates, I = !s || d, l = !!(t.deliveryZonesHash && t.pickupPointHash);
|
|
1404
|
+
if ((!g || !u) && !!!h && !(I && l))
|
|
1402
1405
|
throw new Error(
|
|
1403
1406
|
"Missing delivery location for pickup point availability. Provide postalCode and country, coordinates, or a segment with zip-code."
|
|
1404
1407
|
);
|
|
1405
|
-
const m = new URLSearchParams(), S = (v,
|
|
1406
|
-
|
|
1408
|
+
const m = new URLSearchParams(), S = (v, O) => {
|
|
1409
|
+
O != null && String(O) !== "" && m.append(v, String(O));
|
|
1407
1410
|
};
|
|
1408
|
-
return S("sc", t.sc), S("locale", t.locale), S("country",
|
|
1411
|
+
return S("sc", t.sc), S("locale", t.locale), S("country", u), S("zip-code", g), S("coordinates", h), I && (S("deliveryZonesHash", t.deliveryZonesHash), S("pickupPointsHash", t.pickupPointHash)), { params: m, path: _n(r) };
|
|
1409
1412
|
}
|
|
1410
1413
|
function q(e, n) {
|
|
1411
1414
|
return {
|
|
@@ -1417,12 +1420,12 @@ function q(e, n) {
|
|
|
1417
1420
|
}
|
|
1418
1421
|
};
|
|
1419
1422
|
}
|
|
1420
|
-
function
|
|
1421
|
-
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a =
|
|
1423
|
+
function j(e) {
|
|
1424
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a = dr(t, r);
|
|
1422
1425
|
switch (n) {
|
|
1423
1426
|
case "product-search":
|
|
1424
1427
|
case "facets": {
|
|
1425
|
-
const { params: o, path: s } =
|
|
1428
|
+
const { params: o, path: s } = We(
|
|
1426
1429
|
i,
|
|
1427
1430
|
r,
|
|
1428
1431
|
a,
|
|
@@ -1431,7 +1434,7 @@ function x(e) {
|
|
|
1431
1434
|
return q(s, o);
|
|
1432
1435
|
}
|
|
1433
1436
|
case "catalog-count": {
|
|
1434
|
-
const { params: o, path: s } =
|
|
1437
|
+
const { params: o, path: s } = We(
|
|
1435
1438
|
i,
|
|
1436
1439
|
r,
|
|
1437
1440
|
a,
|
|
@@ -1440,7 +1443,7 @@ function x(e) {
|
|
|
1440
1443
|
return q(s, o);
|
|
1441
1444
|
}
|
|
1442
1445
|
case "products": {
|
|
1443
|
-
const o =
|
|
1446
|
+
const o = gr(i, a.segmentParams);
|
|
1444
1447
|
return q("", o);
|
|
1445
1448
|
}
|
|
1446
1449
|
case "search-suggestions": {
|
|
@@ -1457,7 +1460,7 @@ function x(e) {
|
|
|
1457
1460
|
return q("", o);
|
|
1458
1461
|
}
|
|
1459
1462
|
case "pickup-point-availability": {
|
|
1460
|
-
const { params: o, path: s } =
|
|
1463
|
+
const { params: o, path: s } = mr(
|
|
1461
1464
|
i,
|
|
1462
1465
|
a
|
|
1463
1466
|
);
|
|
@@ -1469,16 +1472,16 @@ function x(e) {
|
|
|
1469
1472
|
}
|
|
1470
1473
|
}
|
|
1471
1474
|
}
|
|
1472
|
-
const
|
|
1473
|
-
function
|
|
1475
|
+
const hr = 10;
|
|
1476
|
+
function fr(e) {
|
|
1474
1477
|
const { regionId: n, seller: t } = e.storage.channel;
|
|
1475
1478
|
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1476
1479
|
}
|
|
1477
|
-
function
|
|
1478
|
-
const t =
|
|
1479
|
-
return
|
|
1480
|
+
function Sr(e) {
|
|
1481
|
+
const t = Re(e.headers?.cookie).cultureInfo || "";
|
|
1482
|
+
return K(e) ? e.storage.locale || t : t || e.storage.locale || "";
|
|
1480
1483
|
}
|
|
1481
|
-
const
|
|
1484
|
+
const yr = ({
|
|
1482
1485
|
account: e,
|
|
1483
1486
|
environment: n,
|
|
1484
1487
|
hideUnavailableItems: t,
|
|
@@ -1486,140 +1489,143 @@ const hr = ({
|
|
|
1486
1489
|
showSponsored: i,
|
|
1487
1490
|
subDomainPrefix: a
|
|
1488
1491
|
}, o) => {
|
|
1489
|
-
const s = `https://${e}.${n}.com.br`, c =
|
|
1492
|
+
const s = `https://${e}.${n}.com.br`, c = An(o), d = Re(o.headers?.cookie), g = () => ({
|
|
1490
1493
|
salesChannel: o.storage.channel.salesChannel,
|
|
1491
|
-
regionId:
|
|
1492
|
-
locale:
|
|
1494
|
+
regionId: fr(o),
|
|
1495
|
+
locale: Sr(o),
|
|
1493
1496
|
hideUnavailableItems: t,
|
|
1494
1497
|
simulationBehavior: r,
|
|
1495
1498
|
showSponsored: i
|
|
1496
|
-
}),
|
|
1499
|
+
}), u = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "", f = a && a.map((b) => b + ".").find((b) => u.includes(b)) || "", h = u.replace(f, ""), I = c({
|
|
1497
1500
|
"content-type": "application/json",
|
|
1498
1501
|
"X-FORWARDED-HOST": h
|
|
1499
|
-
}), l = ({ type:
|
|
1500
|
-
const
|
|
1501
|
-
endpoint:
|
|
1502
|
+
}), l = ({ type: b, ...A }) => {
|
|
1503
|
+
const E = b === "facets" ? "facets" : "product-search", _ = j({
|
|
1504
|
+
endpoint: E,
|
|
1502
1505
|
segment: d,
|
|
1503
1506
|
defaults: g(),
|
|
1504
|
-
args:
|
|
1507
|
+
args: A
|
|
1505
1508
|
});
|
|
1506
1509
|
return y(
|
|
1507
|
-
`${s}/api/intelligent-search/v1/${
|
|
1510
|
+
`${s}/api/intelligent-search/v1/${E}/${_.path}?${_.params.toString()}`,
|
|
1508
1511
|
{ headers: I }
|
|
1509
1512
|
);
|
|
1510
|
-
},
|
|
1511
|
-
field:
|
|
1512
|
-
value:
|
|
1513
|
-
hideUnavailableItems:
|
|
1513
|
+
}, p = (b) => l({ ...b, type: "product_search" }), m = ({
|
|
1514
|
+
field: b,
|
|
1515
|
+
value: A,
|
|
1516
|
+
hideUnavailableItems: E,
|
|
1514
1517
|
showInvisibleItems: _
|
|
1515
1518
|
}) => {
|
|
1516
|
-
const
|
|
1519
|
+
const D = j({
|
|
1517
1520
|
endpoint: "products",
|
|
1518
1521
|
segment: d,
|
|
1519
1522
|
defaults: g(),
|
|
1520
1523
|
args: {
|
|
1521
|
-
field:
|
|
1522
|
-
value:
|
|
1523
|
-
hideUnavailableItems:
|
|
1524
|
+
field: b,
|
|
1525
|
+
value: A,
|
|
1526
|
+
hideUnavailableItems: E,
|
|
1524
1527
|
showInvisibleItems: _
|
|
1525
1528
|
}
|
|
1526
1529
|
});
|
|
1527
1530
|
return y(
|
|
1528
|
-
`${s}/api/intelligent-search/v1/products?${
|
|
1531
|
+
`${s}/api/intelligent-search/v1/products?${D.params.toString()}`,
|
|
1529
1532
|
{ headers: I }
|
|
1530
1533
|
);
|
|
1531
1534
|
};
|
|
1532
1535
|
return {
|
|
1533
|
-
facets: (
|
|
1534
|
-
products:
|
|
1536
|
+
facets: (b) => l({ ...b, type: "facets" }),
|
|
1537
|
+
products: p,
|
|
1535
1538
|
fetchProduct: m,
|
|
1536
1539
|
productsByIdentifier: async ({
|
|
1537
|
-
field:
|
|
1538
|
-
values:
|
|
1539
|
-
showInvisibleItems:
|
|
1540
|
-
hideUnavailableItems: _
|
|
1540
|
+
field: b,
|
|
1541
|
+
values: A,
|
|
1542
|
+
showInvisibleItems: E,
|
|
1543
|
+
hideUnavailableItems: _,
|
|
1544
|
+
throwOnUpstreamError: D = !1
|
|
1541
1545
|
}) => {
|
|
1542
|
-
const
|
|
1546
|
+
const U = _e(hr);
|
|
1543
1547
|
return (await Promise.all(
|
|
1544
|
-
|
|
1545
|
-
(
|
|
1548
|
+
A.map(
|
|
1549
|
+
(R) => U(async () => {
|
|
1546
1550
|
try {
|
|
1547
1551
|
return await m({
|
|
1548
|
-
field:
|
|
1549
|
-
value:
|
|
1552
|
+
field: b,
|
|
1553
|
+
value: R,
|
|
1550
1554
|
hideUnavailableItems: _,
|
|
1551
|
-
showInvisibleItems:
|
|
1555
|
+
showInvisibleItems: E
|
|
1552
1556
|
});
|
|
1553
|
-
} catch {
|
|
1557
|
+
} catch ($) {
|
|
1558
|
+
if (D && !Y($))
|
|
1559
|
+
throw $;
|
|
1554
1560
|
return null;
|
|
1555
1561
|
}
|
|
1556
1562
|
})
|
|
1557
1563
|
)
|
|
1558
1564
|
)).filter(
|
|
1559
|
-
(
|
|
1565
|
+
(R) => R !== null
|
|
1560
1566
|
);
|
|
1561
1567
|
},
|
|
1562
|
-
suggestedTerms: (
|
|
1563
|
-
const
|
|
1568
|
+
suggestedTerms: (b) => {
|
|
1569
|
+
const A = j({
|
|
1564
1570
|
endpoint: "search-suggestions",
|
|
1565
1571
|
segment: d,
|
|
1566
1572
|
defaults: g(),
|
|
1567
|
-
args: { query:
|
|
1573
|
+
args: { query: b.query }
|
|
1568
1574
|
});
|
|
1569
1575
|
return y(
|
|
1570
|
-
`${s}/api/intelligent-search/v1/search-suggestions?${
|
|
1576
|
+
`${s}/api/intelligent-search/v1/search-suggestions?${A.params.toString()}`,
|
|
1571
1577
|
{ headers: I }
|
|
1572
1578
|
);
|
|
1573
1579
|
},
|
|
1574
1580
|
topSearches: () => {
|
|
1575
|
-
const
|
|
1581
|
+
const b = j({
|
|
1576
1582
|
endpoint: "top-searches",
|
|
1577
1583
|
segment: d,
|
|
1578
1584
|
defaults: g()
|
|
1579
1585
|
});
|
|
1580
1586
|
return y(
|
|
1581
|
-
`${s}/api/intelligent-search/v1/top-searches?${
|
|
1587
|
+
`${s}/api/intelligent-search/v1/top-searches?${b.params.toString()}`,
|
|
1582
1588
|
{ headers: I }
|
|
1583
1589
|
);
|
|
1584
1590
|
},
|
|
1585
|
-
productCount: (
|
|
1586
|
-
const
|
|
1591
|
+
productCount: (b) => {
|
|
1592
|
+
const A = j({
|
|
1587
1593
|
endpoint: "catalog-count",
|
|
1588
1594
|
segment: d,
|
|
1589
1595
|
defaults: g(),
|
|
1590
|
-
args:
|
|
1596
|
+
args: b
|
|
1591
1597
|
});
|
|
1592
1598
|
return y(
|
|
1593
|
-
`${s}/api/intelligent-search/v1/catalog-count/${
|
|
1599
|
+
`${s}/api/intelligent-search/v1/catalog-count/${A.path}?${A.params.toString()}`,
|
|
1594
1600
|
{ headers: I }
|
|
1595
1601
|
);
|
|
1596
1602
|
},
|
|
1597
1603
|
pickupPointAvailability: ({
|
|
1598
|
-
postalCode:
|
|
1599
|
-
country:
|
|
1600
|
-
coordinates:
|
|
1604
|
+
postalCode: b,
|
|
1605
|
+
country: A,
|
|
1606
|
+
coordinates: E
|
|
1601
1607
|
}) => {
|
|
1602
|
-
const _ =
|
|
1608
|
+
const _ = j({
|
|
1603
1609
|
endpoint: "pickup-point-availability",
|
|
1604
1610
|
segment: d,
|
|
1605
1611
|
defaults: g(),
|
|
1606
|
-
args: { postalCode:
|
|
1607
|
-
}),
|
|
1612
|
+
args: { postalCode: b, country: A, coordinates: E }
|
|
1613
|
+
}), D = _.path ? `/${_.path}` : "";
|
|
1608
1614
|
return y(
|
|
1609
|
-
`${s}/api/intelligent-search/v1/pickup-point-availability${
|
|
1615
|
+
`${s}/api/intelligent-search/v1/pickup-point-availability${D}?${_.params.toString()}`,
|
|
1610
1616
|
{ headers: I }
|
|
1611
1617
|
);
|
|
1612
1618
|
}
|
|
1613
1619
|
};
|
|
1614
|
-
},
|
|
1615
|
-
const t =
|
|
1620
|
+
}, Ir = (e, n) => {
|
|
1621
|
+
const t = yr(e, n), r = Ht(e, n), i = Rt(e);
|
|
1616
1622
|
return {
|
|
1617
1623
|
search: t,
|
|
1618
1624
|
commerce: r,
|
|
1619
1625
|
catalog: i
|
|
1620
1626
|
};
|
|
1621
|
-
},
|
|
1622
|
-
const t =
|
|
1627
|
+
}, vr = 20, Or = (e) => e.entityType === "category", be = (e) => e.entityType === "brand", He = (e) => e.entityType === "collection", Cr = (e, n) => {
|
|
1628
|
+
const t = _e(vr), r = async (i) => Promise.all(
|
|
1623
1629
|
i.map(
|
|
1624
1630
|
(a) => t(async () => {
|
|
1625
1631
|
const o = a.slug.toLowerCase(), s = a.locale, c = await n.commerce.catalog.byLinkId.category(
|
|
@@ -1644,57 +1650,57 @@ const hr = ({
|
|
|
1644
1650
|
);
|
|
1645
1651
|
if (g)
|
|
1646
1652
|
return { ...g, entityType: "collection" };
|
|
1647
|
-
throw new
|
|
1653
|
+
throw new B(
|
|
1648
1654
|
`No catalog entity found for slug: ${a.slug}. Cascade exhausted (category → brand → collection).`
|
|
1649
1655
|
);
|
|
1650
1656
|
})
|
|
1651
1657
|
)
|
|
1652
1658
|
);
|
|
1653
|
-
return new
|
|
1659
|
+
return new fe(r, {
|
|
1654
1660
|
// DataLoader is used for caching, not batching
|
|
1655
1661
|
batch: !1,
|
|
1656
1662
|
// Dedup by lowercased slug + captured locale so casing variants share an
|
|
1657
1663
|
// entry while same-slug / different-locale loads stay isolated.
|
|
1658
1664
|
cacheKeyFn: ({ slug: i, locale: a }) => `${i.toLowerCase()}::${a ?? ""}`
|
|
1659
1665
|
});
|
|
1660
|
-
},
|
|
1666
|
+
}, br = (e, n) => {
|
|
1661
1667
|
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1662
|
-
return new
|
|
1663
|
-
},
|
|
1664
|
-
const t =
|
|
1665
|
-
const o = a.reduce((
|
|
1668
|
+
return new fe(t);
|
|
1669
|
+
}, wr = 1, Ar = (e, n) => {
|
|
1670
|
+
const t = _e(wr), r = async (a) => {
|
|
1671
|
+
const o = a.reduce((u, { items: f }) => [...u, f], []), s = [...o.flat()], c = await n.commerce.checkout.simulation({
|
|
1666
1672
|
country: a[0].country,
|
|
1667
1673
|
postalCode: a[0].postalCode,
|
|
1668
1674
|
items: s
|
|
1669
1675
|
}), d = c.items.reduce(
|
|
1670
|
-
(
|
|
1676
|
+
(u, f) => {
|
|
1671
1677
|
const h = f.requestIndex;
|
|
1672
|
-
return typeof h == "number" && h <
|
|
1678
|
+
return typeof h == "number" && h < u.length && (u[h] = f), u;
|
|
1673
1679
|
},
|
|
1674
1680
|
Array(s.length).fill(null)
|
|
1675
1681
|
), g = o.reduce(
|
|
1676
|
-
(
|
|
1682
|
+
(u, f) => [...u, f.length + u[u.length - 1]],
|
|
1677
1683
|
[0]
|
|
1678
1684
|
);
|
|
1679
|
-
return o.map((
|
|
1685
|
+
return o.map((u, f) => ({
|
|
1680
1686
|
...c,
|
|
1681
1687
|
items: d.slice(g[f], g[f + 1]).filter((h) => !!h)
|
|
1682
1688
|
}));
|
|
1683
1689
|
}, i = async (a) => t(r, a);
|
|
1684
|
-
return new
|
|
1690
|
+
return new fe(i, {
|
|
1685
1691
|
maxBatchSize: 50
|
|
1686
1692
|
});
|
|
1687
|
-
},
|
|
1688
|
-
function
|
|
1693
|
+
}, Pr = (e, n) => pt(e, n);
|
|
1694
|
+
function Dr(e) {
|
|
1689
1695
|
return {
|
|
1690
1696
|
...e,
|
|
1691
|
-
description: e.description ?
|
|
1697
|
+
description: e.description ? Pr(e.description) : e.description
|
|
1692
1698
|
};
|
|
1693
1699
|
}
|
|
1694
1700
|
const L = (e, n) => ({
|
|
1695
1701
|
...e,
|
|
1696
|
-
isVariantOf:
|
|
1697
|
-
}),
|
|
1702
|
+
isVariantOf: Dr(n)
|
|
1703
|
+
}), Er = ({ flags: e }, n) => {
|
|
1698
1704
|
const t = async (r) => {
|
|
1699
1705
|
const i = r.map((g) => g.split("-")[0]), a = r.some(
|
|
1700
1706
|
(g) => g.split("-")[1] === "invisibleItems"
|
|
@@ -1702,48 +1708,49 @@ const L = (e, n) => ({
|
|
|
1702
1708
|
field: "sku",
|
|
1703
1709
|
values: i,
|
|
1704
1710
|
showInvisibleItems: a,
|
|
1711
|
+
throwOnUpstreamError: !0,
|
|
1705
1712
|
...e?.enableUnavailableItemsOnCart && {
|
|
1706
1713
|
hideUnavailableItems: !1
|
|
1707
1714
|
}
|
|
1708
1715
|
})).reduce(
|
|
1709
|
-
(g,
|
|
1710
|
-
for (const f of
|
|
1711
|
-
g[f.itemId] = L(f,
|
|
1716
|
+
(g, u) => {
|
|
1717
|
+
for (const f of u.items)
|
|
1718
|
+
g[f.itemId] = L(f, u);
|
|
1712
1719
|
return g;
|
|
1713
1720
|
},
|
|
1714
1721
|
{}
|
|
1715
1722
|
), c = i.map((g) => s[g]), d = i.filter((g) => !s[g]);
|
|
1716
1723
|
if (d.length > 0)
|
|
1717
|
-
throw new
|
|
1724
|
+
throw new B(
|
|
1718
1725
|
`Search API did not found the following skus: ${d.join(",")}`
|
|
1719
1726
|
);
|
|
1720
1727
|
return c;
|
|
1721
1728
|
};
|
|
1722
|
-
return new
|
|
1729
|
+
return new fe(t, {
|
|
1723
1730
|
maxBatchSize: 99
|
|
1724
1731
|
// Max allowed batch size of Search API
|
|
1725
1732
|
});
|
|
1726
|
-
},
|
|
1727
|
-
const { clients: t } = n, r =
|
|
1733
|
+
}, kr = (e, n) => {
|
|
1734
|
+
const { clients: t } = n, r = Er(e, t), i = Ar(e, t), a = Cr(e, t), o = br(e, t);
|
|
1728
1735
|
return {
|
|
1729
1736
|
skuLoader: r,
|
|
1730
1737
|
simulationLoader: i,
|
|
1731
1738
|
collectionLoader: a,
|
|
1732
1739
|
salesChannelLoader: o
|
|
1733
1740
|
};
|
|
1734
|
-
},
|
|
1741
|
+
}, V = (e) => e.AvailableQuantity > 0, J = (e) => e.spotPrice ?? 0, _r = (e) => e.Price ?? 0, Ge = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", Tn = (e, n) => V(e) && !V(n) ? -1 : !V(e) && V(n) ? 1 : J(e) - J(n), Tr = (e) => e === "available", X = (e, n = 0, t = 1) => {
|
|
1735
1742
|
const r = n / t;
|
|
1736
1743
|
return Math.round((e + r) * 100) / 100;
|
|
1737
|
-
},
|
|
1738
|
-
const t = e.filter(
|
|
1739
|
-
return n.includeTaxes ?
|
|
1740
|
-
},
|
|
1741
|
-
const [t] = e.filter(
|
|
1742
|
-
return n.includeTaxes ?
|
|
1743
|
-
},
|
|
1744
|
-
highPrice: (e) =>
|
|
1745
|
-
lowPrice: (e) =>
|
|
1746
|
-
lowPriceWithTaxes: (e) =>
|
|
1744
|
+
}, Ur = (e, n = { includeTaxes: !1 }) => {
|
|
1745
|
+
const t = e.filter(V), r = t[t.length - 1], i = r ? J(r) : 0;
|
|
1746
|
+
return n.includeTaxes ? X(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1747
|
+
}, Xe = (e, n = { includeTaxes: !1 }) => {
|
|
1748
|
+
const [t] = e.filter(V), r = t ? J(t) : 0;
|
|
1749
|
+
return n.includeTaxes ? X(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1750
|
+
}, Rr = {
|
|
1751
|
+
highPrice: (e) => Ur(e),
|
|
1752
|
+
lowPrice: (e) => Xe(e),
|
|
1753
|
+
lowPriceWithTaxes: (e) => Xe(e, { includeTaxes: !0 }),
|
|
1747
1754
|
offerCount: (e) => e.length,
|
|
1748
1755
|
priceCurrency: async (e, n, t) => {
|
|
1749
1756
|
const {
|
|
@@ -1753,20 +1760,20 @@ const L = (e, n) => ({
|
|
|
1753
1760
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1754
1761
|
},
|
|
1755
1762
|
offers: (e) => e
|
|
1756
|
-
},
|
|
1763
|
+
}, Nr = {
|
|
1757
1764
|
ratingValue: () => 5,
|
|
1758
1765
|
reviewCount: () => 0
|
|
1759
|
-
},
|
|
1766
|
+
}, Ye = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", Fr = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", Lr = (e) => {
|
|
1760
1767
|
let n = e.slice(0);
|
|
1761
|
-
for (let t = 0; t <
|
|
1762
|
-
n = n.replace(new RegExp(
|
|
1768
|
+
for (let t = 0; t < Ye.length; t++)
|
|
1769
|
+
n = n.replace(new RegExp(Ye.charAt(t), "g"), Fr.charAt(t));
|
|
1763
1770
|
return n;
|
|
1764
|
-
},
|
|
1765
|
-
function
|
|
1771
|
+
}, Br = (e) => e.replace(/[·/_,:]/, "-");
|
|
1772
|
+
function ge(e) {
|
|
1766
1773
|
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1767
|
-
return
|
|
1774
|
+
return Br(Lr(t)).toLowerCase();
|
|
1768
1775
|
}
|
|
1769
|
-
const
|
|
1776
|
+
const ye = (e) => e.toLowerCase(), le = (e, n) => {
|
|
1770
1777
|
const t = n.split("/").filter(Boolean), {
|
|
1771
1778
|
loaders: { collectionLoader: r }
|
|
1772
1779
|
} = e;
|
|
@@ -1774,13 +1781,13 @@ const Ie = (e) => e.toLowerCase(), de = (e, n) => {
|
|
|
1774
1781
|
t.map(
|
|
1775
1782
|
(i, a) => r.load({
|
|
1776
1783
|
slug: t.slice(0, a + 1).join("/"),
|
|
1777
|
-
locale:
|
|
1784
|
+
locale: Pn(e)
|
|
1778
1785
|
})
|
|
1779
1786
|
)
|
|
1780
1787
|
);
|
|
1781
|
-
},
|
|
1788
|
+
}, W = (e) => Or(e) ? e.slug : be(e) ? e.linkId : e.linkId ?? ge(e.name), Un = {
|
|
1782
1789
|
id: ({ id: e }) => e.toString(),
|
|
1783
|
-
slug: (e) =>
|
|
1790
|
+
slug: (e) => W(e),
|
|
1784
1791
|
seo: (e) => ({
|
|
1785
1792
|
title: e.title ?? e.name,
|
|
1786
1793
|
// pagetype.metaTagDescription and catalog `description` share the same
|
|
@@ -1788,26 +1795,26 @@ const Ie = (e) => e.toLowerCase(), de = (e, n) => {
|
|
|
1788
1795
|
// for forward-compat; fall back to description for by-linkid parity.
|
|
1789
1796
|
description: e.metaTagDescription ?? e.description
|
|
1790
1797
|
}),
|
|
1791
|
-
type: (e) =>
|
|
1798
|
+
type: (e) => be(e) ? "Brand" : He(e) ? "Collection" : e.fatherCategoryId === null ? "Department" : "Category",
|
|
1792
1799
|
meta: async (e, n, t) => {
|
|
1793
|
-
const r =
|
|
1794
|
-
if (
|
|
1800
|
+
const r = W(e);
|
|
1801
|
+
if (be(e))
|
|
1795
1802
|
return { selectedFacets: [{ key: "brand", value: r }] };
|
|
1796
|
-
if (
|
|
1803
|
+
if (He(e))
|
|
1797
1804
|
return { selectedFacets: [{ key: "productclusterids", value: e.id }] };
|
|
1798
|
-
const { defaultLocale: i } =
|
|
1805
|
+
const { defaultLocale: i } = ie(t);
|
|
1799
1806
|
return {
|
|
1800
|
-
selectedFacets: (await
|
|
1807
|
+
selectedFacets: (await le(t, r)).map((o, s) => ({
|
|
1801
1808
|
key: `category-${s + 1}`,
|
|
1802
1809
|
value: i && o.availableLinkIds?.[i] || o.linkId
|
|
1803
1810
|
}))
|
|
1804
1811
|
};
|
|
1805
1812
|
},
|
|
1806
1813
|
breadcrumbList: async (e, n, t) => {
|
|
1807
|
-
const r = await
|
|
1814
|
+
const r = await le(t, W(e));
|
|
1808
1815
|
return {
|
|
1809
1816
|
itemListElement: r.map((i, a) => ({
|
|
1810
|
-
item: `/${
|
|
1817
|
+
item: `/${W(i)}`,
|
|
1811
1818
|
name: i.name,
|
|
1812
1819
|
position: a + 1
|
|
1813
1820
|
})),
|
|
@@ -1815,15 +1822,15 @@ const Ie = (e) => e.toLowerCase(), de = (e, n) => {
|
|
|
1815
1822
|
};
|
|
1816
1823
|
},
|
|
1817
1824
|
otherLocales: async (e, n, t) => {
|
|
1818
|
-
const r =
|
|
1825
|
+
const r = ie(t);
|
|
1819
1826
|
if (!r.enabled) return null;
|
|
1820
1827
|
const i = Object.keys(r.locales ?? {});
|
|
1821
1828
|
if (i.length === 0) return null;
|
|
1822
|
-
const a =
|
|
1829
|
+
const a = W(e);
|
|
1823
1830
|
if (a.split("/").filter(Boolean).length === 0) return null;
|
|
1824
1831
|
let o;
|
|
1825
1832
|
try {
|
|
1826
|
-
o = await
|
|
1833
|
+
o = await le(t, a);
|
|
1827
1834
|
} catch (s) {
|
|
1828
1835
|
return console.warn("[otherLocales] failed to load collection entities:", s), null;
|
|
1829
1836
|
}
|
|
@@ -1836,30 +1843,30 @@ const Ie = (e) => e.toLowerCase(), de = (e, n) => {
|
|
|
1836
1843
|
}
|
|
1837
1844
|
return c.length > 0 ? {
|
|
1838
1845
|
locale: s,
|
|
1839
|
-
slug:
|
|
1846
|
+
slug: ye(c.join("/"))
|
|
1840
1847
|
} : null;
|
|
1841
1848
|
}).filter((s) => s !== null);
|
|
1842
1849
|
},
|
|
1843
1850
|
canonicalSlug: async (e, n, t) => {
|
|
1844
|
-
const r =
|
|
1851
|
+
const r = W(e);
|
|
1845
1852
|
if (r.split("/").filter(Boolean).length === 0) return null;
|
|
1846
1853
|
let i;
|
|
1847
1854
|
try {
|
|
1848
|
-
i = await
|
|
1855
|
+
i = await le(t, r);
|
|
1849
1856
|
} catch (o) {
|
|
1850
1857
|
return console.warn("[canonicalSlug] failed to load collection entities:", o), null;
|
|
1851
1858
|
}
|
|
1852
1859
|
const a = i.map((o) => o.linkId);
|
|
1853
|
-
return a.every((o) => !!o) ?
|
|
1860
|
+
return a.every((o) => !!o) ? ye(a.join("/")) : ye(r);
|
|
1854
1861
|
}
|
|
1855
|
-
},
|
|
1862
|
+
}, Rn = {
|
|
1856
1863
|
buy: "whoboughtalsobought",
|
|
1857
1864
|
view: "whosawalsosaw",
|
|
1858
1865
|
similars: "similars",
|
|
1859
1866
|
viewAndBought: "whosawalsobought",
|
|
1860
1867
|
accessories: "accessories",
|
|
1861
1868
|
suggestions: "suggestions"
|
|
1862
|
-
},
|
|
1869
|
+
}, Ke = ({ key: e, value: n }) => {
|
|
1863
1870
|
switch (e) {
|
|
1864
1871
|
case "price":
|
|
1865
1872
|
return { key: e, value: n.replace("-to-", ":") };
|
|
@@ -1875,61 +1882,61 @@ const Ie = (e) => e.toLowerCase(), de = (e, n) => {
|
|
|
1875
1882
|
default:
|
|
1876
1883
|
return { key: e, value: n };
|
|
1877
1884
|
}
|
|
1878
|
-
},
|
|
1885
|
+
}, Je = (e) => {
|
|
1879
1886
|
const n = e.split(":").map(Number);
|
|
1880
1887
|
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1881
|
-
},
|
|
1888
|
+
}, $r = (e) => typeof Rn[e] == "string", Mr = (e) => {
|
|
1882
1889
|
const n = e?.filter(
|
|
1883
|
-
(t) =>
|
|
1890
|
+
(t) => $r(t.key)
|
|
1884
1891
|
);
|
|
1885
1892
|
if (Array.isArray(n) && n.length > 1)
|
|
1886
1893
|
throw new k(
|
|
1887
1894
|
`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(",")}`
|
|
1888
1895
|
);
|
|
1889
1896
|
return n?.[0] ?? null;
|
|
1890
|
-
},
|
|
1897
|
+
}, zr = (e) => e?.find((n) => n.key === "slug")?.value ?? null, Vr = (e) => e?.find((n) => n.key === "id")?.value ?? null, Qe = (e) => e?.find((n) => n.key === "locale")?.value ?? null, Ze = (e) => e?.find((n) => n.key === "channel")?.value ?? null, we = (e, n) => {
|
|
1891
1898
|
let t = 0;
|
|
1892
1899
|
for (let r = 1; r < e.length; r++)
|
|
1893
1900
|
n(e[t], e[r]) > 0 && (t = r);
|
|
1894
1901
|
return e[t];
|
|
1895
|
-
},
|
|
1902
|
+
}, xr = {
|
|
1896
1903
|
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1897
|
-
},
|
|
1904
|
+
}, qr = {
|
|
1898
1905
|
key: ({ key: e }) => e,
|
|
1899
1906
|
label: ({ name: e }) => e,
|
|
1900
1907
|
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1901
|
-
},
|
|
1908
|
+
}, jr = {
|
|
1902
1909
|
key: ({ key: e }) => e,
|
|
1903
1910
|
label: ({ name: e }) => e,
|
|
1904
1911
|
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1905
|
-
const i =
|
|
1912
|
+
const i = Je(
|
|
1906
1913
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1907
|
-
), o =
|
|
1914
|
+
), o = we(e, (s, c) => s.range.from - c.range.from)?.range?.from ?? 0;
|
|
1908
1915
|
return {
|
|
1909
1916
|
selected: i?.[0] ?? o,
|
|
1910
1917
|
absolute: o
|
|
1911
1918
|
};
|
|
1912
1919
|
},
|
|
1913
1920
|
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1914
|
-
const i =
|
|
1921
|
+
const i = Je(
|
|
1915
1922
|
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1916
|
-
), o =
|
|
1923
|
+
), o = we(e, (s, c) => c.range.to - s.range.to)?.range?.to ?? 0;
|
|
1917
1924
|
return {
|
|
1918
1925
|
selected: i?.[1] ?? o,
|
|
1919
1926
|
absolute: o
|
|
1920
1927
|
};
|
|
1921
1928
|
}
|
|
1922
|
-
},
|
|
1929
|
+
}, Wr = {
|
|
1923
1930
|
value: ({ value: e }) => e,
|
|
1924
1931
|
label: ({ name: e }) => e || "unknown",
|
|
1925
1932
|
selected: ({ selected: e }) => e,
|
|
1926
1933
|
quantity: ({ quantity: e }) => e
|
|
1927
|
-
},
|
|
1934
|
+
}, Hr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1928
1935
|
if (!n?.orderId)
|
|
1929
1936
|
throw new k("Missing orderId");
|
|
1930
1937
|
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1931
1938
|
};
|
|
1932
|
-
function
|
|
1939
|
+
function Nn(e) {
|
|
1933
1940
|
if (!e || e.status !== "pending")
|
|
1934
1941
|
return null;
|
|
1935
1942
|
for (const n of e.dimensionStatus) {
|
|
@@ -1947,18 +1954,18 @@ function Rn(e) {
|
|
|
1947
1954
|
}
|
|
1948
1955
|
return null;
|
|
1949
1956
|
}
|
|
1950
|
-
function
|
|
1957
|
+
function Gr(e) {
|
|
1951
1958
|
if (!e || e.status !== "pending") return !1;
|
|
1952
1959
|
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1953
1960
|
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1954
1961
|
}
|
|
1955
|
-
const
|
|
1956
|
-
const r = await t.oms.processOrderAuthorization(n), i =
|
|
1962
|
+
const Xr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1963
|
+
const r = await t.oms.processOrderAuthorization(n), i = Nn(r);
|
|
1957
1964
|
return {
|
|
1958
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1965
|
+
isPendingForOtherAuthorizer: !i && Gr(r),
|
|
1959
1966
|
ruleForAuthorization: i
|
|
1960
1967
|
};
|
|
1961
|
-
},
|
|
1968
|
+
}, Yr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1962
1969
|
if (!n?.objectKey)
|
|
1963
1970
|
throw new k("Missing objectKey");
|
|
1964
1971
|
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
@@ -1967,25 +1974,25 @@ const Wr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
|
1967
1974
|
orderFormId: r,
|
|
1968
1975
|
sessionToken: n.sessionToken ?? void 0
|
|
1969
1976
|
});
|
|
1970
|
-
},
|
|
1977
|
+
}, Kr = async (e, n, t) => {
|
|
1971
1978
|
if (!(await t.clients.commerce.recommendation.startRecommendationSession())?.recommendationsUserId)
|
|
1972
1979
|
throw new Error(
|
|
1973
1980
|
"Failed to start recommendation session: no session data returned"
|
|
1974
1981
|
);
|
|
1975
1982
|
return !0;
|
|
1976
|
-
},
|
|
1983
|
+
}, Jr = 254, en = 100, Qr = /^[^\s@]+@[^\s@.]+(\.[^\s@.]+)+$/, Zr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1977
1984
|
const r = n.email?.trim().toLowerCase() ?? "", i = n.name?.trim() ?? "";
|
|
1978
|
-
if (r.length >
|
|
1985
|
+
if (r.length > Jr || !Qr.test(r))
|
|
1979
1986
|
throw new k("Invalid email");
|
|
1980
|
-
if (i.length >
|
|
1987
|
+
if (i.length > en)
|
|
1981
1988
|
throw new k(
|
|
1982
|
-
`Invalid name: must have at most ${
|
|
1989
|
+
`Invalid name: must have at most ${en} characters`
|
|
1983
1990
|
);
|
|
1984
1991
|
return { id: (await t.subscribeToNewsletter({
|
|
1985
1992
|
email: r,
|
|
1986
1993
|
name: i || void 0
|
|
1987
1994
|
}))?.Id };
|
|
1988
|
-
},
|
|
1995
|
+
}, ei = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1989
1996
|
const { fileContent: r, fileName: i, mimeType: a } = n;
|
|
1990
1997
|
if (!r || !i || !a)
|
|
1991
1998
|
throw new k(
|
|
@@ -2005,7 +2012,7 @@ const Wr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
|
2005
2012
|
mimeType: a
|
|
2006
2013
|
});
|
|
2007
2014
|
};
|
|
2008
|
-
class
|
|
2015
|
+
class oe {
|
|
2009
2016
|
static parse(n) {
|
|
2010
2017
|
try {
|
|
2011
2018
|
const t = JSON.parse(n);
|
|
@@ -2023,35 +2030,35 @@ class ae {
|
|
|
2023
2030
|
return JSON.stringify(n);
|
|
2024
2031
|
}
|
|
2025
2032
|
}
|
|
2026
|
-
function
|
|
2027
|
-
return n == null || n === "" || String(n) === String(e.salesChannel ?? "") ? null :
|
|
2033
|
+
function ni(e, n) {
|
|
2034
|
+
return n == null || n === "" || String(n) === String(e.salesChannel ?? "") ? null : oe.stringify({
|
|
2028
2035
|
...e,
|
|
2029
2036
|
salesChannel: String(n),
|
|
2030
2037
|
hasOnlyDefaultSalesChannel: !1
|
|
2031
2038
|
});
|
|
2032
2039
|
}
|
|
2033
|
-
function
|
|
2040
|
+
function ti(e, n, t) {
|
|
2034
2041
|
return t != null && String(e.salesChannel ?? "") === t && String(n ?? "") !== t ? !1 : e.items.length > 0 ? !0 : e.salesChannel == null || e.salesChannel === "" ? !1 : String(e.salesChannel) === String(n ?? "");
|
|
2035
2042
|
}
|
|
2036
|
-
const
|
|
2043
|
+
const Fn = (e) => {
|
|
2037
2044
|
try {
|
|
2038
2045
|
return JSON.parse(e ?? "") ?? {};
|
|
2039
2046
|
} catch {
|
|
2040
2047
|
return {};
|
|
2041
2048
|
}
|
|
2042
2049
|
};
|
|
2043
|
-
function
|
|
2044
|
-
const t =
|
|
2050
|
+
function Ln(e, { localizationEnabled: n = !0 } = {}) {
|
|
2051
|
+
const t = Fn(e).salesChannelSource;
|
|
2045
2052
|
return t === "url" ? n ? t : void 0 : t === "orderForm" ? t : void 0;
|
|
2046
2053
|
}
|
|
2047
|
-
const
|
|
2048
|
-
function
|
|
2049
|
-
const n =
|
|
2054
|
+
const Bn = (e) => !!e?.localization?.enabled;
|
|
2055
|
+
function $n(e) {
|
|
2056
|
+
const n = Fn(e).rejectedSalesChannel;
|
|
2050
2057
|
return (typeof n == "string" || typeof n == "number") && String(n) || void 0;
|
|
2051
2058
|
}
|
|
2052
|
-
function
|
|
2059
|
+
function ri(e, n, t, r, i, a) {
|
|
2053
2060
|
const o = n ?? void 0, s = t ?? e.regionId, c = i ? e.salesChannel || o : o ?? e.salesChannel, d = a != null && a !== String(c ?? "");
|
|
2054
|
-
return
|
|
2061
|
+
return oe.stringify({
|
|
2055
2062
|
salesChannel: c,
|
|
2056
2063
|
regionId: s ?? void 0,
|
|
2057
2064
|
seller: r,
|
|
@@ -2060,16 +2067,16 @@ function ei(e, n, t, r, i, a) {
|
|
|
2060
2067
|
...d ? { rejectedSalesChannel: a } : {}
|
|
2061
2068
|
});
|
|
2062
2069
|
}
|
|
2063
|
-
const
|
|
2064
|
-
function
|
|
2070
|
+
const nn = "1";
|
|
2071
|
+
function ii(e, n, t, r) {
|
|
2065
2072
|
const i = String(e.salesChannel ?? "");
|
|
2066
|
-
return n === void 0 && i ===
|
|
2073
|
+
return n === void 0 && i === nn && !!t && t !== nn && !new URLSearchParams(r).has("sc") ? t : i;
|
|
2067
2074
|
}
|
|
2068
|
-
const
|
|
2069
|
-
e.storage.channel =
|
|
2070
|
-
},
|
|
2075
|
+
const te = (e, n) => {
|
|
2076
|
+
e.storage.channel = oe.parse(n);
|
|
2077
|
+
}, Ae = (e, n) => {
|
|
2071
2078
|
e.storage.locale = n;
|
|
2072
|
-
}, Ne = (e) =>
|
|
2079
|
+
}, Ne = (e) => gt.createHash("md5").update(e).digest("hex"), x = {
|
|
2073
2080
|
attachment: "ATTACHMENT",
|
|
2074
2081
|
specification: "SPECIFICATION",
|
|
2075
2082
|
attribute: "ATTRIBUTE",
|
|
@@ -2080,75 +2087,75 @@ const ne = (e, n) => {
|
|
|
2080
2087
|
*/
|
|
2081
2088
|
service: "SERVICE"
|
|
2082
2089
|
};
|
|
2083
|
-
function
|
|
2090
|
+
function Mn(e) {
|
|
2084
2091
|
return {
|
|
2085
2092
|
name: e.name,
|
|
2086
2093
|
value: e.content,
|
|
2087
|
-
valueReference:
|
|
2094
|
+
valueReference: x.attachment
|
|
2088
2095
|
};
|
|
2089
2096
|
}
|
|
2090
|
-
function
|
|
2097
|
+
function ai(e) {
|
|
2091
2098
|
return {
|
|
2092
2099
|
propertyID: e.id,
|
|
2093
2100
|
name: e.name,
|
|
2094
2101
|
value: e.value,
|
|
2095
2102
|
valueReference: {
|
|
2096
|
-
valueReference:
|
|
2103
|
+
valueReference: x.attribute,
|
|
2097
2104
|
visible: e.visible
|
|
2098
2105
|
}
|
|
2099
2106
|
};
|
|
2100
2107
|
}
|
|
2101
|
-
function
|
|
2108
|
+
function zn(e) {
|
|
2102
2109
|
return Ne(
|
|
2103
2110
|
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
2104
2111
|
);
|
|
2105
2112
|
}
|
|
2106
|
-
const
|
|
2113
|
+
const Vn = (e, n) => e < n ? -1 : e > n ? 1 : 0, oi = (e, n) => Vn(e.name, n.name), si = (e) => [...e ?? []].sort(oi), tn = (e) => e !== null && typeof e == "object" && !Array.isArray(e), ci = (e) => tn(e) && typeof e.name == "string" && tn(e.content), li = (e) => ({
|
|
2107
2114
|
name: e.name,
|
|
2108
2115
|
content: Object.fromEntries(
|
|
2109
|
-
Object.keys(e.content).sort(
|
|
2116
|
+
Object.keys(e.content).sort(Vn).map((n) => [n, e.content[n]])
|
|
2110
2117
|
)
|
|
2111
|
-
}),
|
|
2118
|
+
}), xn = (e, n) => Ne(
|
|
2112
2119
|
`SERVICE:${e}:${JSON.stringify(
|
|
2113
|
-
|
|
2114
|
-
|
|
2120
|
+
si((n ?? []).filter(ci)).map(
|
|
2121
|
+
li
|
|
2115
2122
|
)
|
|
2116
2123
|
)}`
|
|
2117
|
-
),
|
|
2124
|
+
), di = "SERVICE:unreadable";
|
|
2118
2125
|
function Fe(e) {
|
|
2119
2126
|
const n = e.attachments ?? [];
|
|
2120
2127
|
return {
|
|
2121
|
-
propertyID:
|
|
2128
|
+
propertyID: xn(e.id, n),
|
|
2122
2129
|
name: e.name,
|
|
2123
2130
|
value: {
|
|
2124
2131
|
id: e.id,
|
|
2125
2132
|
price: e.sellingPrice / 100,
|
|
2126
2133
|
attachments: n
|
|
2127
2134
|
},
|
|
2128
|
-
valueReference:
|
|
2135
|
+
valueReference: x.service
|
|
2129
2136
|
};
|
|
2130
2137
|
}
|
|
2131
|
-
const
|
|
2138
|
+
const ui = (e) => {
|
|
2132
2139
|
try {
|
|
2133
2140
|
return JSON.parse(e);
|
|
2134
2141
|
} catch {
|
|
2135
2142
|
return null;
|
|
2136
2143
|
}
|
|
2137
|
-
},
|
|
2138
|
-
const n = typeof e == "string" ?
|
|
2144
|
+
}, pi = (e) => {
|
|
2145
|
+
const n = typeof e == "string" ? ui(e) : e;
|
|
2139
2146
|
if (n === null || typeof n != "object")
|
|
2140
2147
|
return null;
|
|
2141
2148
|
const { id: t, attachments: r } = n;
|
|
2142
2149
|
return typeof t != "string" && typeof t != "number" ? null : { id: String(t), attachments: r };
|
|
2143
2150
|
};
|
|
2144
|
-
function
|
|
2145
|
-
const n =
|
|
2146
|
-
return n ?
|
|
2151
|
+
function gi(e) {
|
|
2152
|
+
const n = pi(e.value);
|
|
2153
|
+
return n ? xn(
|
|
2147
2154
|
n.id,
|
|
2148
2155
|
Array.isArray(n.attachments) ? n.attachments : []
|
|
2149
|
-
) :
|
|
2156
|
+
) : di;
|
|
2150
2157
|
}
|
|
2151
|
-
const
|
|
2158
|
+
const mi = (e) => {
|
|
2152
2159
|
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
2153
2160
|
addressType: e.addressType || null,
|
|
2154
2161
|
postalCode: n || null,
|
|
@@ -2167,7 +2174,7 @@ const ui = (e) => {
|
|
|
2167
2174
|
r.geoCoordinates = i !== null && a !== null ? [a, i] : [];
|
|
2168
2175
|
}
|
|
2169
2176
|
return [r];
|
|
2170
|
-
},
|
|
2177
|
+
}, hi = (e, n, t) => {
|
|
2171
2178
|
const r = n.postalCode, i = n.geoCoordinates, a = e?.shippingData?.availableAddresses ?? [], o = e?.shippingData?.selectedAddresses ?? [];
|
|
2172
2179
|
if (!t && o.length > 0)
|
|
2173
2180
|
return [o[0]];
|
|
@@ -2181,36 +2188,36 @@ const ui = (e) => {
|
|
|
2181
2188
|
return [s];
|
|
2182
2189
|
}
|
|
2183
2190
|
return null;
|
|
2184
|
-
},
|
|
2185
|
-
if (!
|
|
2191
|
+
}, qn = (e, n) => {
|
|
2192
|
+
if (!fi(n))
|
|
2186
2193
|
return { updateShipping: !1, addressChanged: !1 };
|
|
2187
|
-
if (!
|
|
2194
|
+
if (!vi(e))
|
|
2188
2195
|
return { updateShipping: !1, addressChanged: !1 };
|
|
2189
2196
|
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
2190
|
-
if (
|
|
2197
|
+
if (Si(t, n.postalCode) || yi(t, n.geoCoordinates) || Ii(t, n.addressType))
|
|
2191
2198
|
return { updateShipping: !0, addressChanged: !0 };
|
|
2192
2199
|
const { logisticsInfo: r } = e.shippingData;
|
|
2193
|
-
return
|
|
2194
|
-
},
|
|
2200
|
+
return Oi(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
2201
|
+
}, fi = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, Si = (e, n) => typeof n == "string" && e?.postalCode !== n, yi = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), Ii = (e, n) => typeof n == "string" && e?.addressType !== n, vi = (e) => e.items.length !== 0, Oi = (e, n) => {
|
|
2195
2202
|
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
|
|
2196
2203
|
return e.some(
|
|
2197
2204
|
({ selectedDeliveryChannel: o, selectedSla: s, slas: c }) => {
|
|
2198
2205
|
const d = t && o !== t, g = r && s !== r;
|
|
2199
|
-
return c?.some((
|
|
2206
|
+
return c?.some((u) => d && u.deliveryChannel === t || g && u.id === r ? !0 : i && a && u.deliveryChannel === t && u.id === r && (!u?.deliveryWindow || u?.deliveryWindow?.startDateUtc !== i || u?.deliveryWindow?.endDateUtc !== a) && u.availableDeliveryWindows?.some(
|
|
2200
2207
|
(f) => f?.startDateUtc === i && f?.endDateUtc === a
|
|
2201
2208
|
));
|
|
2202
2209
|
}
|
|
2203
2210
|
);
|
|
2204
|
-
},
|
|
2205
|
-
const n =
|
|
2211
|
+
}, jn = (e) => e.valueReference === x.attachment, Ci = (e) => e.valueReference === x.service, bi = (e) => (e.itemOffered.additionalProperty ?? []).filter(Ci).map(gi).sort((n, t) => n.localeCompare(t)), Wn = (e) => {
|
|
2212
|
+
const n = bi(e);
|
|
2206
2213
|
return n.length > 0 ? `services:${n.join("-")}` : void 0;
|
|
2207
|
-
},
|
|
2214
|
+
}, Pe = (e) => [
|
|
2208
2215
|
e.itemOffered.sku,
|
|
2209
2216
|
e.seller.identifier,
|
|
2210
2217
|
e.price < 0.01 ? "Gift" : void 0,
|
|
2211
|
-
e.itemOffered.additionalProperty?.filter(
|
|
2212
|
-
|
|
2213
|
-
].filter(Boolean).join("::"),
|
|
2218
|
+
e.itemOffered.additionalProperty?.filter(jn).map(zn).join("-"),
|
|
2219
|
+
Wn(e)
|
|
2220
|
+
].filter(Boolean).join("::"), me = (e, n) => ({
|
|
2214
2221
|
listPrice: e.listPrice / 100,
|
|
2215
2222
|
price: e.sellingPrice / 100,
|
|
2216
2223
|
quantity: e.quantity,
|
|
@@ -2220,49 +2227,49 @@ const ui = (e) => {
|
|
|
2220
2227
|
image: [],
|
|
2221
2228
|
name: e.name,
|
|
2222
2229
|
additionalProperty: [
|
|
2223
|
-
...e.attachments.map(
|
|
2230
|
+
...e.attachments.map(Mn),
|
|
2224
2231
|
...(e.bundleItems ?? []).map(Fe)
|
|
2225
2232
|
]
|
|
2226
2233
|
},
|
|
2227
2234
|
index: n
|
|
2228
|
-
}),
|
|
2235
|
+
}), wi = (e) => ({
|
|
2229
2236
|
quantity: e.quantity,
|
|
2230
2237
|
seller: e.seller.identifier,
|
|
2231
2238
|
id: e.itemOffered.sku,
|
|
2232
2239
|
index: e.index,
|
|
2233
|
-
attachments: (e.itemOffered.additionalProperty?.filter(
|
|
2240
|
+
attachments: (e.itemOffered.additionalProperty?.filter(jn) ?? []).map((n) => ({
|
|
2234
2241
|
name: n.name,
|
|
2235
2242
|
content: n.value
|
|
2236
2243
|
})),
|
|
2237
2244
|
...e.priceToken ? { priceToken: e.priceToken } : {}
|
|
2238
|
-
}),
|
|
2239
|
-
const r =
|
|
2245
|
+
}), rn = (e) => e.reduce((n, t) => {
|
|
2246
|
+
const r = Pe(t);
|
|
2240
2247
|
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
2241
|
-
}, /* @__PURE__ */ new Map()),
|
|
2248
|
+
}, /* @__PURE__ */ new Map()), Ai = (e, n) => {
|
|
2242
2249
|
const t = ({ priceToken: s, ...c }, d) => ({
|
|
2243
2250
|
...c,
|
|
2244
2251
|
itemOffered: {
|
|
2245
2252
|
sku: c.itemOffered.sku
|
|
2246
2253
|
},
|
|
2247
|
-
services:
|
|
2254
|
+
services: Wn(c),
|
|
2248
2255
|
index: d
|
|
2249
|
-
}), r = n.items.map(
|
|
2256
|
+
}), r = n.items.map(me).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = Te(r, i);
|
|
2250
2257
|
return a && o;
|
|
2251
2258
|
};
|
|
2252
|
-
function
|
|
2259
|
+
function Hn(e, n) {
|
|
2253
2260
|
return e?.some(
|
|
2254
2261
|
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 && e[t.parentItemIndex]?.id === n
|
|
2255
2262
|
);
|
|
2256
2263
|
}
|
|
2257
|
-
function
|
|
2264
|
+
function Gn(e, n) {
|
|
2258
2265
|
return e?.some(
|
|
2259
2266
|
(t) => t.id === n && t.parentItemIndex !== null
|
|
2260
2267
|
);
|
|
2261
2268
|
}
|
|
2262
|
-
const
|
|
2269
|
+
const an = (e) => {
|
|
2263
2270
|
const n = e.items.reduce(
|
|
2264
2271
|
(t, r, i) => {
|
|
2265
|
-
const a =
|
|
2272
|
+
const a = Gn(e.items, r.id) || Hn(e.items, r.id) ? `${Pe(me(r))}::${i}` : Pe(me(r));
|
|
2266
2273
|
return t[a] || (t[a] = []), t[a].push(r), t;
|
|
2267
2274
|
},
|
|
2268
2275
|
{}
|
|
@@ -2281,7 +2288,7 @@ const tn = (e) => {
|
|
|
2281
2288
|
};
|
|
2282
2289
|
})
|
|
2283
2290
|
};
|
|
2284
|
-
},
|
|
2291
|
+
}, De = async (e, n, t, r) => ({
|
|
2285
2292
|
order: {
|
|
2286
2293
|
orderNumber: e.orderFormId,
|
|
2287
2294
|
acceptedOffer: e.items.map(async (i) => ({
|
|
@@ -2295,7 +2302,7 @@ const tn = (e) => {
|
|
|
2295
2302
|
text: i,
|
|
2296
2303
|
status: a.toUpperCase()
|
|
2297
2304
|
}))
|
|
2298
|
-
}),
|
|
2305
|
+
}), Xn = ({ items: e }, n) => {
|
|
2299
2306
|
const t = e.map((r) => {
|
|
2300
2307
|
const i = (r.bundleItems ?? []).map(Fe).map(({ propertyID: a }) => a).sort((a, o) => a.localeCompare(o));
|
|
2301
2308
|
return {
|
|
@@ -2310,13 +2317,13 @@ const tn = (e) => {
|
|
|
2310
2317
|
return Ne(
|
|
2311
2318
|
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
2312
2319
|
);
|
|
2313
|
-
},
|
|
2320
|
+
}, on = async (e, n, t) => {
|
|
2314
2321
|
try {
|
|
2315
2322
|
return await n.checkout.setCustomData({
|
|
2316
2323
|
id: e.orderFormId,
|
|
2317
2324
|
appId: "faststore",
|
|
2318
2325
|
key: "cartEtag",
|
|
2319
|
-
value:
|
|
2326
|
+
value: Xn(e, t)
|
|
2320
2327
|
});
|
|
2321
2328
|
} catch (r) {
|
|
2322
2329
|
throw console.error(
|
|
@@ -2326,22 +2333,22 @@ const tn = (e) => {
|
|
|
2326
2333
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
2327
2334
|
), r;
|
|
2328
2335
|
}
|
|
2329
|
-
},
|
|
2336
|
+
}, Pi = (e, n) => {
|
|
2330
2337
|
const r = e.customData?.customApps.find(
|
|
2331
2338
|
(a) => a.id === "faststore"
|
|
2332
2339
|
)?.fields?.cartEtag;
|
|
2333
|
-
return r == null ? !0 :
|
|
2334
|
-
},
|
|
2340
|
+
return r == null ? !0 : Xn(e, n) !== r;
|
|
2341
|
+
}, Di = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
2335
2342
|
id: e
|
|
2336
|
-
}),
|
|
2343
|
+
}), sn = async (e, n, { clients: { commerce: t } }) => {
|
|
2337
2344
|
if (!n)
|
|
2338
2345
|
return e;
|
|
2339
|
-
const { updateShipping: r, addressChanged: i } =
|
|
2346
|
+
const { updateShipping: r, addressChanged: i } = qn(
|
|
2340
2347
|
e,
|
|
2341
2348
|
n
|
|
2342
2349
|
);
|
|
2343
2350
|
if (r) {
|
|
2344
|
-
const a =
|
|
2351
|
+
const a = hi(e, n, i), s = a || mi(n);
|
|
2345
2352
|
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
2346
2353
|
{
|
|
2347
2354
|
id: e.orderFormId,
|
|
@@ -2361,18 +2368,18 @@ const tn = (e) => {
|
|
|
2361
2368
|
);
|
|
2362
2369
|
}
|
|
2363
2370
|
return e;
|
|
2364
|
-
},
|
|
2371
|
+
}, Ei = (e, n) => {
|
|
2365
2372
|
if (!e)
|
|
2366
2373
|
return "";
|
|
2367
|
-
const r =
|
|
2374
|
+
const r = ae(e)[n];
|
|
2368
2375
|
return r ? r.split("=")[1] : "";
|
|
2369
|
-
},
|
|
2376
|
+
}, ki = async (e, n, t, r) => {
|
|
2370
2377
|
const { commerce: i } = e.clients, a = await i.checkout.orderForm({
|
|
2371
2378
|
id: n,
|
|
2372
2379
|
channel: e.storage.channel,
|
|
2373
2380
|
preserveSalesChannel: !!n && !t
|
|
2374
2381
|
});
|
|
2375
|
-
return !n ||
|
|
2382
|
+
return !n || ti(
|
|
2376
2383
|
a,
|
|
2377
2384
|
e.storage.channel.salesChannel,
|
|
2378
2385
|
r
|
|
@@ -2380,156 +2387,156 @@ const tn = (e) => {
|
|
|
2380
2387
|
id: n,
|
|
2381
2388
|
channel: e.storage.channel
|
|
2382
2389
|
});
|
|
2383
|
-
},
|
|
2390
|
+
}, cn = (e, n, t) => {
|
|
2384
2391
|
if (!t || n.items.length === 0)
|
|
2385
2392
|
return null;
|
|
2386
|
-
const r =
|
|
2393
|
+
const r = ni(
|
|
2387
2394
|
e.storage.channel,
|
|
2388
2395
|
n.salesChannel
|
|
2389
2396
|
);
|
|
2390
|
-
return r ? (
|
|
2391
|
-
},
|
|
2392
|
-
const i =
|
|
2397
|
+
return r ? (te(e, r), n.salesChannel ? String(n.salesChannel) : null) : null;
|
|
2398
|
+
}, ln = (e, n, t, r) => r ? De(e, n, t, r) : null, _i = async (e, { cart: { order: n }, session: t }, r) => {
|
|
2399
|
+
const i = Ei(
|
|
2393
2400
|
r.headers.cookie,
|
|
2394
2401
|
"checkout.vtex.com"
|
|
2395
2402
|
), {
|
|
2396
2403
|
clients: { commerce: a },
|
|
2397
2404
|
loaders: { skuLoader: o }
|
|
2398
|
-
} = r, s = t?.channel, c = t?.locale, d =
|
|
2399
|
-
localizationEnabled:
|
|
2400
|
-
}) === "url", g =
|
|
2401
|
-
s &&
|
|
2402
|
-
const
|
|
2405
|
+
} = r, s = t?.channel, c = t?.locale, d = Ln(s, {
|
|
2406
|
+
localizationEnabled: Bn(r.discoveryConfig)
|
|
2407
|
+
}) === "url", g = $n(s);
|
|
2408
|
+
s && te(r, s), c && Ae(r, c);
|
|
2409
|
+
const u = await ki(
|
|
2403
2410
|
r,
|
|
2404
2411
|
i || void 0,
|
|
2405
2412
|
d,
|
|
2406
2413
|
g
|
|
2407
|
-
), f =
|
|
2408
|
-
|
|
2409
|
-
const h =
|
|
2410
|
-
if (
|
|
2411
|
-
const
|
|
2414
|
+
), f = u.orderFormId;
|
|
2415
|
+
u.messages.length !== 0 && await Di(f, r);
|
|
2416
|
+
const h = ae(r?.headers?.cookie ?? "")?.vtex_session, I = G(h), { acceptedOffer: l, shouldSplitItem: p } = n;
|
|
2417
|
+
if (Pi(u, I)) {
|
|
2418
|
+
const P = cn(
|
|
2412
2419
|
r,
|
|
2413
|
-
|
|
2420
|
+
u,
|
|
2414
2421
|
!d
|
|
2415
|
-
),
|
|
2416
|
-
|
|
2422
|
+
), R = await on(
|
|
2423
|
+
u,
|
|
2417
2424
|
a,
|
|
2418
2425
|
I
|
|
2419
|
-
).then(
|
|
2426
|
+
).then(an);
|
|
2420
2427
|
if (f)
|
|
2421
|
-
return
|
|
2422
|
-
|
|
2428
|
+
return De(
|
|
2429
|
+
R,
|
|
2423
2430
|
o,
|
|
2424
|
-
|
|
2425
|
-
|
|
2431
|
+
p,
|
|
2432
|
+
P
|
|
2426
2433
|
);
|
|
2427
2434
|
}
|
|
2428
|
-
const S =
|
|
2435
|
+
const S = cn(
|
|
2429
2436
|
r,
|
|
2430
|
-
|
|
2437
|
+
u,
|
|
2431
2438
|
!d
|
|
2432
|
-
), v =
|
|
2433
|
-
(
|
|
2434
|
-
const
|
|
2435
|
-
if (!
|
|
2436
|
-
return
|
|
2437
|
-
const [
|
|
2438
|
-
if (
|
|
2439
|
-
return
|
|
2440
|
-
const
|
|
2441
|
-
return
|
|
2442
|
-
...
|
|
2443
|
-
quantity:
|
|
2444
|
-
}),
|
|
2439
|
+
), v = rn(l), O = rn(u.items.map(me)), C = Array.from(O.entries()), T = Array.from(v.entries()), { itemsToAdd: w, itemsToUpdate: b } = T.reduce(
|
|
2440
|
+
(P, [R, $]) => {
|
|
2441
|
+
const Z = O.get(R);
|
|
2442
|
+
if (!Z)
|
|
2443
|
+
return $.forEach((ee) => P.itemsToAdd.push(ee)), P;
|
|
2444
|
+
const [M, ...nt] = Z;
|
|
2445
|
+
if (Gn(u.items, M.itemOffered.sku) || Hn(u.items, M.itemOffered.sku))
|
|
2446
|
+
return P.itemsToUpdate.push(M), P;
|
|
2447
|
+
const tt = $.reduce((ee, rt) => ee + rt.quantity, 0);
|
|
2448
|
+
return P.itemsToUpdate.push({
|
|
2449
|
+
...M,
|
|
2450
|
+
quantity: tt
|
|
2451
|
+
}), nt.forEach((ee) => P.itemsToUpdate.push({ ...ee, quantity: 0 })), P;
|
|
2445
2452
|
},
|
|
2446
2453
|
{
|
|
2447
2454
|
itemsToAdd: [],
|
|
2448
2455
|
itemsToUpdate: []
|
|
2449
2456
|
}
|
|
2450
|
-
),
|
|
2451
|
-
|
|
2452
|
-
), { updateShipping: _ } = t ?
|
|
2453
|
-
if (
|
|
2454
|
-
return
|
|
2455
|
-
p,
|
|
2456
|
-
o,
|
|
2457
|
+
), A = C.filter(([P]) => !v.has(P)).flatMap(([, P]) => P.map((R) => ({ ...R, quantity: 0 }))), E = [...w, ...b, ...A].map(
|
|
2458
|
+
wi
|
|
2459
|
+
), { updateShipping: _ } = t ? qn(u, t) : { updateShipping: !1 };
|
|
2460
|
+
if (E.length === 0 && !_)
|
|
2461
|
+
return ln(
|
|
2457
2462
|
u,
|
|
2463
|
+
o,
|
|
2464
|
+
p,
|
|
2458
2465
|
S
|
|
2459
2466
|
);
|
|
2460
|
-
let
|
|
2461
|
-
|
|
2462
|
-
id:
|
|
2463
|
-
orderItems:
|
|
2464
|
-
shouldSplitItem:
|
|
2467
|
+
let D;
|
|
2468
|
+
E.length > 0 ? D = await a.checkout.updateOrderFormItems({
|
|
2469
|
+
id: u.orderFormId,
|
|
2470
|
+
orderItems: E,
|
|
2471
|
+
shouldSplitItem: p
|
|
2465
2472
|
}).then(
|
|
2466
|
-
(
|
|
2467
|
-
) :
|
|
2468
|
-
|
|
2473
|
+
(P) => sn(P, t, r)
|
|
2474
|
+
) : D = await sn(
|
|
2475
|
+
u,
|
|
2469
2476
|
t,
|
|
2470
2477
|
r
|
|
2471
|
-
),
|
|
2478
|
+
), D = await Promise.resolve(D).then((P) => {
|
|
2472
2479
|
if (t?.marketingData) {
|
|
2473
|
-
const
|
|
2474
|
-
...
|
|
2480
|
+
const R = {
|
|
2481
|
+
...P.marketingData,
|
|
2475
2482
|
...t.marketingData
|
|
2476
2483
|
};
|
|
2477
2484
|
return a.checkout.marketingData({
|
|
2478
|
-
id:
|
|
2479
|
-
marketingData:
|
|
2485
|
+
id: u.orderFormId,
|
|
2486
|
+
marketingData: R
|
|
2480
2487
|
});
|
|
2481
2488
|
}
|
|
2482
|
-
return
|
|
2483
|
-
}).then((
|
|
2484
|
-
id:
|
|
2489
|
+
return P;
|
|
2490
|
+
}).then((P) => c && P.clientPreferencesData?.locale !== c ? a.checkout.clientPreferencesData({
|
|
2491
|
+
id: P.orderFormId,
|
|
2485
2492
|
clientPreferencesData: {
|
|
2486
|
-
...
|
|
2493
|
+
...P.clientPreferencesData,
|
|
2487
2494
|
locale: c
|
|
2488
2495
|
}
|
|
2489
|
-
}) :
|
|
2490
|
-
const
|
|
2491
|
-
|
|
2492
|
-
|
|
2496
|
+
}) : P).then((P) => on(P, a, I)).then(an);
|
|
2497
|
+
const U = Te(
|
|
2498
|
+
u.messages,
|
|
2499
|
+
D.messages
|
|
2493
2500
|
);
|
|
2494
|
-
return
|
|
2495
|
-
|
|
2501
|
+
return Ai(n, D) && U ? ln(
|
|
2502
|
+
D,
|
|
2496
2503
|
o,
|
|
2497
|
-
|
|
2504
|
+
p,
|
|
2498
2505
|
S
|
|
2499
|
-
) :
|
|
2500
|
-
|
|
2506
|
+
) : De(
|
|
2507
|
+
D,
|
|
2501
2508
|
o,
|
|
2502
|
-
|
|
2509
|
+
p,
|
|
2503
2510
|
S
|
|
2504
2511
|
);
|
|
2505
|
-
},
|
|
2512
|
+
}, Ti = (e) => {
|
|
2506
2513
|
const n = (e?.corporateName ?? "").trim();
|
|
2507
2514
|
return n || (e?.firstName ?? "").trim();
|
|
2508
|
-
},
|
|
2515
|
+
}, Ui = (e) => {
|
|
2509
2516
|
if (!e || typeof e != "object")
|
|
2510
2517
|
return !1;
|
|
2511
2518
|
const n = e;
|
|
2512
2519
|
return typeof n.customerId == "string" && n.customerId.trim() !== "" && typeof n.contractName == "string" && typeof n.isActive == "boolean" && typeof n.isCurrent == "boolean";
|
|
2513
|
-
},
|
|
2520
|
+
}, Ri = (e) => {
|
|
2514
2521
|
const n = e?.availableContracts?.value;
|
|
2515
|
-
return Array.isArray(n) ? n.filter(
|
|
2516
|
-
},
|
|
2522
|
+
return Array.isArray(n) ? n.filter(Ui) : [];
|
|
2523
|
+
}, Ni = (e) => e?.customerId ? !!((e.contractName ?? "").trim() && e.isActive) : !1, Fi = (e) => e?.namespaces?.shopper?.activeContractId?.value?.trim() ?? e?.namespaces?.authentication?.customerId?.value?.trim() ?? e?.namespaces?.profile?.id?.value?.trim() ?? "", Li = (e) => {
|
|
2517
2524
|
if (!Array.isArray(e) || e.length === 0) return "";
|
|
2518
2525
|
const n = e.find((t) => t?.isDefault === !0) ?? e[0];
|
|
2519
2526
|
return String(n?.id ?? "").trim();
|
|
2520
|
-
},
|
|
2527
|
+
}, Bi = (e, n = "", t = "") => {
|
|
2521
2528
|
const r = n.trim(), i = t.trim();
|
|
2522
|
-
return e.filter(
|
|
2529
|
+
return e.filter(Ni).map((a) => ({
|
|
2523
2530
|
id: a.customerId,
|
|
2524
2531
|
corporateName: a.contractName.trim(),
|
|
2525
2532
|
isActive: r ? a.customerId === r : a.isCurrent,
|
|
2526
2533
|
isDefault: i !== "" && a.customerId === i
|
|
2527
2534
|
}));
|
|
2528
|
-
},
|
|
2529
|
-
const t =
|
|
2535
|
+
}, Yn = (e, n) => {
|
|
2536
|
+
const t = Ti(e);
|
|
2530
2537
|
return t || (n?.firstName?.value ?? "").trim();
|
|
2531
2538
|
};
|
|
2532
|
-
async function
|
|
2539
|
+
async function $i(e, n, t) {
|
|
2533
2540
|
try {
|
|
2534
2541
|
const r = await e.commerce.checkout.address({
|
|
2535
2542
|
postalCode: t,
|
|
@@ -2546,7 +2553,7 @@ async function Ni(e, n, t) {
|
|
|
2546
2553
|
), r;
|
|
2547
2554
|
}
|
|
2548
2555
|
}
|
|
2549
|
-
function
|
|
2556
|
+
function Mi(e, n, t, r, i, a) {
|
|
2550
2557
|
const o = new URLSearchParams(e);
|
|
2551
2558
|
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(
|
|
2552
2559
|
"geoCoordinates",
|
|
@@ -2554,7 +2561,7 @@ function Fi(e, n, t, r, i, a) {
|
|
|
2554
2561
|
// long,lat is the format expected
|
|
2555
2562
|
), o.set("locale", a), o;
|
|
2556
2563
|
}
|
|
2557
|
-
function
|
|
2564
|
+
function zi(e, n) {
|
|
2558
2565
|
return {
|
|
2559
2566
|
utmCampaign: e.get("utm_campaign") ?? n?.utmCampaign ?? "",
|
|
2560
2567
|
utmMedium: e.get("utm_medium") ?? n?.utmMedium ?? "",
|
|
@@ -2564,8 +2571,8 @@ function Li(e, n) {
|
|
|
2564
2571
|
utmiPart: e.get("utmi_pc") ?? n?.utmiPart ?? ""
|
|
2565
2572
|
};
|
|
2566
2573
|
}
|
|
2567
|
-
async function
|
|
2568
|
-
const r =
|
|
2574
|
+
async function Vi(e, n, t) {
|
|
2575
|
+
const r = G(z(n ?? "", t));
|
|
2569
2576
|
let i = !1;
|
|
2570
2577
|
if (r)
|
|
2571
2578
|
try {
|
|
@@ -2574,12 +2581,11 @@ async function Bi(e, n, t) {
|
|
|
2574
2581
|
console.warn("JWT validation failed:", a), i = !1;
|
|
2575
2582
|
}
|
|
2576
2583
|
return {
|
|
2577
|
-
isRepresentative: i ? !!r?.isRepresentative : !1,
|
|
2578
2584
|
customerId: i ? r?.customerId : void 0,
|
|
2579
2585
|
unitId: i ? r?.unitId : void 0
|
|
2580
2586
|
};
|
|
2581
2587
|
}
|
|
2582
|
-
async function
|
|
2588
|
+
async function xi(e, n, t, r, i, a) {
|
|
2583
2589
|
return !n.seller || !(t || r) ? void 0 : (await e.commerce.checkout.region({
|
|
2584
2590
|
postalCode: t,
|
|
2585
2591
|
geoCoordinates: r,
|
|
@@ -2587,28 +2593,43 @@ async function $i(e, n, t, r, i, a) {
|
|
|
2587
2593
|
salesChannel: a
|
|
2588
2594
|
}))?.[0]?.sellers.find((c) => n.seller === c.id)?.id;
|
|
2589
2595
|
}
|
|
2590
|
-
function
|
|
2596
|
+
function dn(e) {
|
|
2591
2597
|
return typeof e?.value == "string" ? e.value : "";
|
|
2592
2598
|
}
|
|
2593
|
-
function
|
|
2594
|
-
|
|
2599
|
+
function Le(...e) {
|
|
2600
|
+
for (const n of e) {
|
|
2601
|
+
const t = typeof n == "string" ? n.trim() : "";
|
|
2602
|
+
if (t) return t;
|
|
2603
|
+
}
|
|
2604
|
+
return "";
|
|
2605
|
+
}
|
|
2606
|
+
function Be(e, n) {
|
|
2607
|
+
return Le(e?.unitId?.value, n);
|
|
2608
|
+
}
|
|
2609
|
+
function qi(e) {
|
|
2610
|
+
const n = Be(e.authentication, e.unitId), t = Le(
|
|
2611
|
+
e.shopper?.activeContractId?.value,
|
|
2612
|
+
e.authentication?.customerId?.value,
|
|
2613
|
+
e.customerId
|
|
2614
|
+
);
|
|
2615
|
+
if (!n || !t)
|
|
2595
2616
|
return null;
|
|
2596
|
-
const
|
|
2617
|
+
const r = dn(e.shopper?.firstName), i = dn(e.shopper?.lastName);
|
|
2597
2618
|
return {
|
|
2598
2619
|
isRepresentative: !0,
|
|
2599
|
-
customerId:
|
|
2620
|
+
customerId: t,
|
|
2600
2621
|
unitName: e.authentication?.unitName?.value ?? "",
|
|
2601
|
-
unitId:
|
|
2602
|
-
firstName:
|
|
2603
|
-
lastName:
|
|
2604
|
-
userName: `${
|
|
2622
|
+
unitId: n,
|
|
2623
|
+
firstName: r,
|
|
2624
|
+
lastName: i,
|
|
2625
|
+
userName: `${r} ${i}`.trim(),
|
|
2605
2626
|
userEmail: e.authentication?.storeUserEmail?.value ?? "",
|
|
2606
2627
|
savedPostalCode: e.publicData?.postalCode?.value ?? "",
|
|
2607
|
-
contractName:
|
|
2628
|
+
contractName: Yn(e.contract, e.profile),
|
|
2608
2629
|
organizationManager: e.shopper?.organizationManager?.value ?? !1
|
|
2609
2630
|
};
|
|
2610
2631
|
}
|
|
2611
|
-
function
|
|
2632
|
+
function ji(e) {
|
|
2612
2633
|
return e?.id ? {
|
|
2613
2634
|
id: e.id?.value ?? "",
|
|
2614
2635
|
email: e.email?.value ?? "",
|
|
@@ -2616,14 +2637,14 @@ function zi(e) {
|
|
|
2616
2637
|
familyName: e.lastName?.value ?? ""
|
|
2617
2638
|
} : null;
|
|
2618
2639
|
}
|
|
2619
|
-
const
|
|
2640
|
+
const Wi = (e) => e instanceof Q && (e.extensions.status === 401 || e.extensions.status === 403), Hi = (e) => e instanceof Error && /sales\s*channel/i.test(e.message), Gi = (e, n, t, r) => {
|
|
2620
2641
|
if (n !== "orderForm" || t !== r)
|
|
2621
2642
|
return !1;
|
|
2622
|
-
if (
|
|
2643
|
+
if (Hi(e))
|
|
2623
2644
|
return !0;
|
|
2624
2645
|
const i = `[validateSession] Session Manager rejected adopted sales channel ${t} with an unrecognized error; keeping the adoption.`, a = e instanceof Error ? e.message : e;
|
|
2625
2646
|
return console.warn(i, a), Ue("warn", "%s %o", i, a), !1;
|
|
2626
|
-
},
|
|
2647
|
+
}, Xi = async (e, n, t, r) => {
|
|
2627
2648
|
const i = { salesChannelSource: t, rejectedSalesChannel: void 0 };
|
|
2628
2649
|
try {
|
|
2629
2650
|
return {
|
|
@@ -2631,9 +2652,9 @@ const Vi = (e) => e instanceof K && (e.extensions.status === 401 || e.extensions
|
|
|
2631
2652
|
sessionData: await e.commerce.session(n.toString())
|
|
2632
2653
|
};
|
|
2633
2654
|
} catch (a) {
|
|
2634
|
-
if (t === "url" || !
|
|
2655
|
+
if (t === "url" || !Wi(a))
|
|
2635
2656
|
return { ...i, sessionData: null };
|
|
2636
|
-
const o = n.get("sc") ?? void 0, s =
|
|
2657
|
+
const o = n.get("sc") ?? void 0, s = Gi(
|
|
2637
2658
|
a,
|
|
2638
2659
|
t,
|
|
2639
2660
|
o,
|
|
@@ -2647,77 +2668,77 @@ const Vi = (e) => e instanceof K && (e.extensions.status === 401 || e.extensions
|
|
|
2647
2668
|
rejectedSalesChannel: o
|
|
2648
2669
|
};
|
|
2649
2670
|
}
|
|
2650
|
-
},
|
|
2651
|
-
const c =
|
|
2652
|
-
localizationEnabled:
|
|
2671
|
+
}, Yi = async (e, { session: n, search: t }, { clients: r, headers: i, account: a, storage: o, discoveryConfig: s }) => {
|
|
2672
|
+
const c = oe.parse(n.channel ?? ""), d = Ln(n.channel, {
|
|
2673
|
+
localizationEnabled: Bn(s)
|
|
2653
2674
|
}), g = {
|
|
2654
2675
|
...c,
|
|
2655
|
-
salesChannel:
|
|
2676
|
+
salesChannel: ii(
|
|
2656
2677
|
c,
|
|
2657
2678
|
d,
|
|
2658
2679
|
o?.channel?.salesChannel ? String(o.channel.salesChannel) : void 0,
|
|
2659
2680
|
t
|
|
2660
2681
|
)
|
|
2661
|
-
},
|
|
2682
|
+
}, u = String(n.postalCode ?? ""), f = n.country ?? "";
|
|
2662
2683
|
let h = n.city ?? null, I = n.geoCoordinates ?? null;
|
|
2663
|
-
if ((!h || !I) &&
|
|
2664
|
-
const
|
|
2684
|
+
if ((!h || !I) && u !== "" && f !== "") {
|
|
2685
|
+
const M = await $i(
|
|
2665
2686
|
r,
|
|
2666
2687
|
f,
|
|
2667
|
-
|
|
2688
|
+
u
|
|
2668
2689
|
);
|
|
2669
|
-
h =
|
|
2690
|
+
h = M.city, I = M.geoCoordinates;
|
|
2670
2691
|
}
|
|
2671
|
-
const
|
|
2692
|
+
const p = Mi(
|
|
2672
2693
|
t,
|
|
2673
2694
|
g,
|
|
2674
|
-
|
|
2695
|
+
u,
|
|
2675
2696
|
f,
|
|
2676
2697
|
I,
|
|
2677
2698
|
n.locale
|
|
2678
|
-
), m =
|
|
2699
|
+
), m = zi(p, n.marketingData), { customerId: S, unitId: v } = await Vi(
|
|
2679
2700
|
r,
|
|
2680
2701
|
i?.cookie,
|
|
2681
2702
|
a
|
|
2682
|
-
), { sessionData: O, salesChannelSource:
|
|
2703
|
+
), { sessionData: O, salesChannelSource: C, rejectedSalesChannel: T } = await Xi(
|
|
2683
2704
|
r,
|
|
2684
|
-
|
|
2705
|
+
p,
|
|
2685
2706
|
d,
|
|
2686
2707
|
String(g.salesChannel ?? "")
|
|
2687
|
-
),
|
|
2688
|
-
let
|
|
2689
|
-
if (
|
|
2708
|
+
), w = O?.namespaces.profile ?? null, b = O?.namespaces.shopper ?? null, A = O?.namespaces.store ?? null, E = O?.namespaces.authentication ?? null, _ = O?.namespaces.checkout ?? null, D = O?.namespaces.public ?? null;
|
|
2709
|
+
let U = null;
|
|
2710
|
+
if (Be(E, v) && w?.id?.value)
|
|
2690
2711
|
try {
|
|
2691
|
-
|
|
2692
|
-
contractId:
|
|
2712
|
+
U = await r.commerce.masterData.getContractById({
|
|
2713
|
+
contractId: w.id.value
|
|
2693
2714
|
});
|
|
2694
2715
|
} catch {
|
|
2695
2716
|
console.error(
|
|
2696
|
-
`Error while getting contract data for profile ID (${
|
|
2717
|
+
`Error while getting contract data for profile ID (${w.id.value}).
|
|
2697
2718
|
`
|
|
2698
2719
|
);
|
|
2699
2720
|
}
|
|
2700
|
-
const
|
|
2721
|
+
const P = await xi(
|
|
2701
2722
|
r,
|
|
2702
2723
|
g,
|
|
2703
|
-
|
|
2724
|
+
u,
|
|
2704
2725
|
I,
|
|
2705
2726
|
f,
|
|
2706
|
-
|
|
2707
|
-
),
|
|
2727
|
+
p.get("sc") ?? A?.channel?.value ?? g.salesChannel
|
|
2728
|
+
), R = ji(w), $ = (n.person?.id ?? null) === (R?.id ?? null) ? $n(n.channel) : void 0, Z = {
|
|
2708
2729
|
...n,
|
|
2709
2730
|
currency: {
|
|
2710
|
-
code:
|
|
2711
|
-
symbol:
|
|
2731
|
+
code: A?.currencyCode?.value ?? n.currency.code,
|
|
2732
|
+
symbol: A?.currencySymbol?.value ?? n.currency.symbol
|
|
2712
2733
|
},
|
|
2713
|
-
country:
|
|
2714
|
-
channel:
|
|
2734
|
+
country: A?.countryCode?.value ?? f,
|
|
2735
|
+
channel: ri(
|
|
2715
2736
|
g,
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2737
|
+
A?.channel?.value,
|
|
2738
|
+
_?.regionId?.value,
|
|
2739
|
+
P,
|
|
2740
|
+
C,
|
|
2741
|
+
T ?? $
|
|
2721
2742
|
),
|
|
2722
2743
|
/**
|
|
2723
2744
|
* B2B data structure in Session:
|
|
@@ -2725,53 +2746,52 @@ const Vi = (e) => e instanceof K && (e.extensions.status === 401 || e.extensions
|
|
|
2725
2746
|
* - Unit data: `authentication` namespace
|
|
2726
2747
|
* - Contract data: `profile` namespace (those info will be available inside Faststore's Session `person` object)
|
|
2727
2748
|
*/
|
|
2728
|
-
b2b:
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
unitId: b
|
|
2749
|
+
b2b: qi({
|
|
2750
|
+
authentication: E,
|
|
2751
|
+
shopper: b,
|
|
2752
|
+
publicData: D,
|
|
2753
|
+
profile: w,
|
|
2754
|
+
contract: U,
|
|
2755
|
+
customerId: S,
|
|
2756
|
+
unitId: v
|
|
2737
2757
|
}),
|
|
2738
2758
|
marketingData: m,
|
|
2739
|
-
person:
|
|
2759
|
+
person: R,
|
|
2740
2760
|
geoCoordinates: I?.latitude && I?.longitude && I || null,
|
|
2741
2761
|
city: h
|
|
2742
2762
|
};
|
|
2743
|
-
return
|
|
2744
|
-
},
|
|
2745
|
-
validateCart:
|
|
2746
|
-
validateSession:
|
|
2747
|
-
subscribeToNewsletter:
|
|
2748
|
-
cancelOrder:
|
|
2749
|
-
processOrderAuthorization:
|
|
2750
|
-
uploadFileToOrderEntry:
|
|
2751
|
-
startOrderEntryOperation:
|
|
2752
|
-
startRecommendationSession:
|
|
2763
|
+
return Te(n, Z) ? null : Z;
|
|
2764
|
+
}, Ki = {
|
|
2765
|
+
validateCart: _i,
|
|
2766
|
+
validateSession: Yi,
|
|
2767
|
+
subscribeToNewsletter: Zr,
|
|
2768
|
+
cancelOrder: Hr,
|
|
2769
|
+
processOrderAuthorization: Xr,
|
|
2770
|
+
uploadFileToOrderEntry: ei,
|
|
2771
|
+
startOrderEntryOperation: Yr,
|
|
2772
|
+
startRecommendationSession: Kr
|
|
2753
2773
|
};
|
|
2754
|
-
var
|
|
2774
|
+
var Ee;
|
|
2755
2775
|
(function(e) {
|
|
2756
2776
|
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";
|
|
2757
|
-
})(
|
|
2758
|
-
const
|
|
2759
|
-
function
|
|
2777
|
+
})(Ee || (Ee = {}));
|
|
2778
|
+
const Ji = (e) => typeof e == "string" ? Kn(e) : null;
|
|
2779
|
+
function Kn(e) {
|
|
2760
2780
|
try {
|
|
2761
2781
|
return JSON.parse(e);
|
|
2762
2782
|
} catch {
|
|
2763
2783
|
return e;
|
|
2764
2784
|
}
|
|
2765
2785
|
}
|
|
2766
|
-
const
|
|
2786
|
+
const Qi = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Zi = new ot({
|
|
2767
2787
|
name: "ObjectOrString",
|
|
2768
2788
|
description: "A string or the string representation of an object (a stringified object).",
|
|
2769
|
-
parseValue:
|
|
2770
|
-
serialize:
|
|
2789
|
+
parseValue: Ji,
|
|
2790
|
+
serialize: Qi,
|
|
2771
2791
|
parseLiteral(e) {
|
|
2772
|
-
return e.kind ===
|
|
2792
|
+
return e.kind === Ee.STRING ? Kn(e.value) : null;
|
|
2773
2793
|
}
|
|
2774
|
-
}),
|
|
2794
|
+
}), N = (e) => "Price" in e && "seller" in e && "product" in e, F = (e) => "skuName" in e, ea = {
|
|
2775
2795
|
priceCurrency: async (e, n, t) => {
|
|
2776
2796
|
const {
|
|
2777
2797
|
loaders: { salesChannelLoader: r },
|
|
@@ -2779,36 +2799,36 @@ const Xi = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2779
2799
|
} = t;
|
|
2780
2800
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
2781
2801
|
},
|
|
2782
|
-
priceValidUntil: (e) =>
|
|
2802
|
+
priceValidUntil: (e) => N(e) ? e.PriceValidUntil ?? "" : F(e) ? e.priceValidUntil ?? "" : null,
|
|
2783
2803
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
2784
|
-
availability: async (e) =>
|
|
2785
|
-
seller: (e, n, t) =>
|
|
2804
|
+
availability: async (e) => N(e) ? Ge(V(e)) : F(e) ? Ge(Tr(e.availability)) : null,
|
|
2805
|
+
seller: (e, n, t) => N(e) ? {
|
|
2786
2806
|
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2787
|
-
} :
|
|
2807
|
+
} : F(e) ? {
|
|
2788
2808
|
identifier: e.seller
|
|
2789
2809
|
} : null,
|
|
2790
|
-
price: (e) =>
|
|
2791
|
-
priceWithTaxes: (e) =>
|
|
2810
|
+
price: (e) => N(e) ? J(e) : F(e) ? e.sellingPrice / 100 : null,
|
|
2811
|
+
priceWithTaxes: (e) => N(e) ? X(J(e), e?.Tax, e.product.unitMultiplier) : F(e) ? X(
|
|
2792
2812
|
e.sellingPrice / 100,
|
|
2793
2813
|
e.tax / 100,
|
|
2794
2814
|
e.unitMultiplier
|
|
2795
2815
|
) : null,
|
|
2796
|
-
sellingPrice: (e) =>
|
|
2797
|
-
listPrice: (e) =>
|
|
2798
|
-
listPriceWithTaxes: (e) =>
|
|
2816
|
+
sellingPrice: (e) => N(e) ? _r(e) : F(e) ? e.sellingPrice / 100 : null,
|
|
2817
|
+
listPrice: (e) => N(e) ? e.ListPrice ?? 0 : F(e) ? e.listPrice / 100 : null,
|
|
2818
|
+
listPriceWithTaxes: (e) => N(e) ? X(
|
|
2799
2819
|
e.ListPrice ?? 0,
|
|
2800
2820
|
e?.Tax,
|
|
2801
2821
|
e.product.unitMultiplier
|
|
2802
|
-
) :
|
|
2803
|
-
itemOffered: (e) =>
|
|
2822
|
+
) : F(e) ? X(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
|
|
2823
|
+
itemOffered: (e) => N(e) ? e.product : F(e) ? {
|
|
2804
2824
|
...e.product,
|
|
2805
2825
|
attachmentsValues: e.attachments,
|
|
2806
2826
|
servicesValues: e.bundleItems ?? []
|
|
2807
2827
|
} : null,
|
|
2808
|
-
quantity: (e) =>
|
|
2809
|
-
isGift: (e) =>
|
|
2810
|
-
priceToken: (e) =>
|
|
2811
|
-
},
|
|
2828
|
+
quantity: (e) => N(e) ? e.AvailableQuantity ?? 0 : F(e) ? e.quantity : null,
|
|
2829
|
+
isGift: (e) => F(e) ? e.isGift ?? !1 : null,
|
|
2830
|
+
priceToken: (e) => N(e) ? e.PriceToken ?? null : null
|
|
2831
|
+
}, na = ({ linkText: e }) => `/${e}/p`, ta = ({
|
|
2812
2832
|
offer: e,
|
|
2813
2833
|
seller: n,
|
|
2814
2834
|
product: t
|
|
@@ -2816,15 +2836,15 @@ const Xi = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
|
|
|
2816
2836
|
...e,
|
|
2817
2837
|
product: t,
|
|
2818
2838
|
seller: n
|
|
2819
|
-
}),
|
|
2839
|
+
}), ra = {
|
|
2820
2840
|
imageText: "image",
|
|
2821
2841
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
2822
2842
|
imageLabel: "label"
|
|
2823
|
-
},
|
|
2824
|
-
function
|
|
2843
|
+
}, ue = (e, n) => `${e}-${n}`, un = (e, n) => `/${ue(e, n)}/p`, ia = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2844
|
+
function ke(e) {
|
|
2825
2845
|
return e.replace(/^\/+|\/+$/g, "");
|
|
2826
2846
|
}
|
|
2827
|
-
async function
|
|
2847
|
+
async function pe(e, n, t) {
|
|
2828
2848
|
const r = `${n}:${t}`;
|
|
2829
2849
|
e.storage.productTranslationsCache ??= /* @__PURE__ */ new Map();
|
|
2830
2850
|
const i = e.storage.productTranslationsCache, a = i.get(r);
|
|
@@ -2849,18 +2869,18 @@ async function ge(e, n, t) {
|
|
|
2849
2869
|
})();
|
|
2850
2870
|
return i.set(r, o), o;
|
|
2851
2871
|
}
|
|
2852
|
-
const
|
|
2853
|
-
const t = e.findIndex((r) =>
|
|
2872
|
+
const aa = (e, n) => {
|
|
2873
|
+
const t = e.findIndex((r) => ke(r).split("/").at(-1) === n);
|
|
2854
2874
|
return t < 0 ? 0 : t;
|
|
2855
|
-
},
|
|
2875
|
+
}, oa = {
|
|
2856
2876
|
productID: ({ itemId: e }) => e,
|
|
2857
2877
|
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2858
|
-
slug: ({ isVariantOf: { linkText: e }, itemId: n }) =>
|
|
2878
|
+
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => ue(e, n),
|
|
2859
2879
|
description: ({ isVariantOf: { description: e } }) => e,
|
|
2860
2880
|
seo: ({ isVariantOf: e }) => ({
|
|
2861
2881
|
title: e.productTitle || e.productName,
|
|
2862
2882
|
description: e.metaTagDescription || e.description,
|
|
2863
|
-
canonical:
|
|
2883
|
+
canonical: na(e)
|
|
2864
2884
|
}),
|
|
2865
2885
|
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2866
2886
|
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
@@ -2875,28 +2895,28 @@ const na = (e, n) => {
|
|
|
2875
2895
|
productId: c
|
|
2876
2896
|
},
|
|
2877
2897
|
itemId: d
|
|
2878
|
-
} = e, g =
|
|
2879
|
-
if (
|
|
2880
|
-
const I = await
|
|
2898
|
+
} = e, g = aa(s, o), u = r[g], f = ke(u).split("/"), h = t.storage.locale;
|
|
2899
|
+
if (K(t) && h) {
|
|
2900
|
+
const I = await pe(t, c, h);
|
|
2881
2901
|
if (I) {
|
|
2882
2902
|
const l = new Set(
|
|
2883
|
-
|
|
2884
|
-
),
|
|
2903
|
+
ke(s[g]).split("/").filter(Boolean)
|
|
2904
|
+
), p = I.categories.filter((S) => l.has(S.id.toString())).sort(
|
|
2885
2905
|
(S, v) => S.fullPath.split("/").length - v.fullPath.split("/").length
|
|
2886
2906
|
);
|
|
2887
|
-
if (
|
|
2907
|
+
if (p.length === f.length)
|
|
2888
2908
|
return {
|
|
2889
2909
|
itemListElement: [
|
|
2890
2910
|
// Category items: both name and slug come from Catalog Dataplane, ensuring
|
|
2891
2911
|
// they are always consistent with each other for the requested locale.
|
|
2892
|
-
...
|
|
2912
|
+
...p.map((S, v) => ({
|
|
2893
2913
|
name: S.name,
|
|
2894
2914
|
item: `/${S.fullPathUriName}/`,
|
|
2895
2915
|
position: v + 1
|
|
2896
2916
|
})),
|
|
2897
2917
|
{
|
|
2898
2918
|
name: i,
|
|
2899
|
-
item:
|
|
2919
|
+
item: un(I.linkId, d),
|
|
2900
2920
|
position: f.length + 1
|
|
2901
2921
|
}
|
|
2902
2922
|
],
|
|
@@ -2907,16 +2927,16 @@ const na = (e, n) => {
|
|
|
2907
2927
|
return {
|
|
2908
2928
|
itemListElement: [
|
|
2909
2929
|
...f.map((I, l) => {
|
|
2910
|
-
const
|
|
2930
|
+
const p = `/${f.slice(0, l + 1).map(ge).join("/")}/`;
|
|
2911
2931
|
return {
|
|
2912
2932
|
name: I,
|
|
2913
|
-
item:
|
|
2933
|
+
item: p,
|
|
2914
2934
|
position: l + 1
|
|
2915
2935
|
};
|
|
2916
2936
|
}),
|
|
2917
2937
|
{
|
|
2918
2938
|
name: i,
|
|
2919
|
-
item:
|
|
2939
|
+
item: un(a, d),
|
|
2920
2940
|
position: f.length + 1
|
|
2921
2941
|
}
|
|
2922
2942
|
],
|
|
@@ -2924,7 +2944,7 @@ const na = (e, n) => {
|
|
|
2924
2944
|
};
|
|
2925
2945
|
},
|
|
2926
2946
|
image: ({ images: e }, n) => {
|
|
2927
|
-
const t = (
|
|
2947
|
+
const t = (ia(e) ?? [ra]).map(
|
|
2928
2948
|
({ imageUrl: s, imageText: c, imageLabel: d }) => ({
|
|
2929
2949
|
alternateName: c ?? "",
|
|
2930
2950
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
@@ -2947,12 +2967,12 @@ const na = (e, n) => {
|
|
|
2947
2967
|
review: () => [],
|
|
2948
2968
|
aggregateRating: () => ({}),
|
|
2949
2969
|
offers: (e) => e.sellers.map(
|
|
2950
|
-
(n) =>
|
|
2970
|
+
(n) => ta({
|
|
2951
2971
|
offer: n.commertialOffer,
|
|
2952
2972
|
seller: n,
|
|
2953
2973
|
product: e
|
|
2954
2974
|
})
|
|
2955
|
-
).sort(
|
|
2975
|
+
).sort(Tn),
|
|
2956
2976
|
isVariantOf: (e) => e,
|
|
2957
2977
|
additionalProperty: ({
|
|
2958
2978
|
// Search uses the name variations for specifications
|
|
@@ -2965,11 +2985,11 @@ const na = (e, n) => {
|
|
|
2965
2985
|
({ name: c, values: d }) => d.map((g) => ({
|
|
2966
2986
|
name: c,
|
|
2967
2987
|
value: g,
|
|
2968
|
-
valueReference:
|
|
2988
|
+
valueReference: x.specification
|
|
2969
2989
|
}))
|
|
2970
2990
|
), a = n.map(
|
|
2971
|
-
|
|
2972
|
-
), o = t.map(
|
|
2991
|
+
Mn
|
|
2992
|
+
), o = t.map(ai), s = r.map(Fe);
|
|
2973
2993
|
return [
|
|
2974
2994
|
...i,
|
|
2975
2995
|
...a,
|
|
@@ -2987,66 +3007,66 @@ const na = (e, n) => {
|
|
|
2987
3007
|
advertisement: ({ isVariantOf: { advertisement: e } }) => e,
|
|
2988
3008
|
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e,
|
|
2989
3009
|
otherLocales: async (e, n, t) => {
|
|
2990
|
-
if (!
|
|
2991
|
-
const r =
|
|
3010
|
+
if (!K(t)) return null;
|
|
3011
|
+
const r = Gt(t);
|
|
2992
3012
|
if (r.length === 0) return null;
|
|
2993
|
-
const i = e.isVariantOf.productId, a = e.itemId, o = t.storage.locale, s = await
|
|
3013
|
+
const i = e.isVariantOf.productId, a = e.itemId, o = t.storage.locale, s = await pe(t, i, o);
|
|
2994
3014
|
if (!s?.availableLinkIds) return null;
|
|
2995
3015
|
const { availableLinkIds: c } = s;
|
|
2996
3016
|
return r.map((d) => {
|
|
2997
3017
|
const g = c[d];
|
|
2998
|
-
return g ? { locale: d, slug:
|
|
3018
|
+
return g ? { locale: d, slug: ue(g, a) } : null;
|
|
2999
3019
|
}).filter((d) => d !== null);
|
|
3000
3020
|
},
|
|
3001
3021
|
defaultLocaleSlug: async (e, n, t) => {
|
|
3002
|
-
if (!
|
|
3003
|
-
const r =
|
|
3022
|
+
if (!K(t)) return null;
|
|
3023
|
+
const r = Xt(t);
|
|
3004
3024
|
if (!r) return null;
|
|
3005
|
-
const { productId: i, linkText: a } = e.isVariantOf, o = e.itemId, c = (await
|
|
3025
|
+
const { productId: i, linkText: a } = e.isVariantOf, o = e.itemId, c = (await pe(
|
|
3006
3026
|
t,
|
|
3007
3027
|
i,
|
|
3008
3028
|
t.storage.locale
|
|
3009
3029
|
))?.availableLinkIds?.[r] ?? a;
|
|
3010
|
-
return
|
|
3030
|
+
return ue(c, o);
|
|
3011
3031
|
}
|
|
3012
|
-
},
|
|
3032
|
+
}, sa = /* @__PURE__ */ new Set(["allSpecifications"]), ca = {
|
|
3013
3033
|
hasVariant: (e) => e.isVariantOf.items.map((n) => L(n, e.isVariantOf)),
|
|
3014
3034
|
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
3015
3035
|
productClusters: ({ isVariantOf: e }) => e.productClusters ?? [],
|
|
3016
3036
|
name: (e) => e.isVariantOf.productName,
|
|
3017
3037
|
skuVariants: (e) => e,
|
|
3018
3038
|
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
3019
|
-
(n) => !
|
|
3039
|
+
(n) => !sa.has(n.name)
|
|
3020
3040
|
).flatMap(
|
|
3021
3041
|
({ specifications: n }) => n.flatMap(
|
|
3022
3042
|
({ name: t, values: r }) => r.map((i) => ({
|
|
3023
3043
|
name: t,
|
|
3024
3044
|
value: i,
|
|
3025
|
-
valueReference:
|
|
3045
|
+
valueReference: x.specification
|
|
3026
3046
|
}))
|
|
3027
3047
|
)
|
|
3028
3048
|
)
|
|
3029
|
-
},
|
|
3030
|
-
propertyID: (e) => e.propertyID ||
|
|
3049
|
+
}, la = {
|
|
3050
|
+
propertyID: (e) => e.propertyID || zn(e),
|
|
3031
3051
|
name: ({ name: e }) => e,
|
|
3032
3052
|
value: ({ value: e }) => e,
|
|
3033
3053
|
valueReference: ({ valueReference: e }) => e
|
|
3034
|
-
},
|
|
3054
|
+
}, he = (e) => {
|
|
3035
3055
|
const n = e.flatMap(
|
|
3036
3056
|
(r) => r.sellers.map((i) => ({
|
|
3037
3057
|
offer: i.commertialOffer,
|
|
3038
3058
|
sku: r
|
|
3039
3059
|
}))
|
|
3040
|
-
), t =
|
|
3060
|
+
), t = we(
|
|
3041
3061
|
n,
|
|
3042
|
-
({ offer: r }, { offer: i }) =>
|
|
3062
|
+
({ offer: r }, { offer: i }) => Tn(r, i)
|
|
3043
3063
|
);
|
|
3044
3064
|
return t ? t.sku : e[0];
|
|
3045
|
-
},
|
|
3065
|
+
}, Jn = (e) => e !== "" && !Number.isNaN(Number(e)), da = /^vrn:recommendations:[^:]+:[^:]+:[^:]+$/, ua = async (e, { campaignVrn: n, userId: t, products: r }, i) => {
|
|
3046
3066
|
const {
|
|
3047
3067
|
clients: { commerce: a }
|
|
3048
3068
|
} = i, { salesChannel: o } = i.storage.channel, s = n?.trim();
|
|
3049
|
-
if (!s || !
|
|
3069
|
+
if (!s || !da.test(s))
|
|
3050
3070
|
throw new k(`Invalid campaignVrn: "${n}"`);
|
|
3051
3071
|
const c = t?.trim();
|
|
3052
3072
|
if (t != null && !c)
|
|
@@ -3061,16 +3081,43 @@ const na = (e, n) => {
|
|
|
3061
3081
|
products: r ?? [],
|
|
3062
3082
|
salesChannel: o ?? void 0,
|
|
3063
3083
|
locale: i.storage.locale
|
|
3064
|
-
}), { campaign: g, correlationId:
|
|
3084
|
+
}), { campaign: g, correlationId: u } = d;
|
|
3065
3085
|
return {
|
|
3066
3086
|
products: (d.products ?? []).map((h) => {
|
|
3067
|
-
const I =
|
|
3087
|
+
const I = he(h.items);
|
|
3068
3088
|
return I ? L(I, h) : null;
|
|
3069
3089
|
}).filter((h) => !!h),
|
|
3070
|
-
correlationId:
|
|
3090
|
+
correlationId: u,
|
|
3071
3091
|
campaign: g
|
|
3072
3092
|
};
|
|
3073
|
-
},
|
|
3093
|
+
}, pa = "productClusterIds", pn = "not:";
|
|
3094
|
+
function ga(e) {
|
|
3095
|
+
const n = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
|
|
3096
|
+
for (const { key: r, value: i } of rr(e))
|
|
3097
|
+
if (r === pa)
|
|
3098
|
+
for (const a of i.split(",")) {
|
|
3099
|
+
const o = a.trim();
|
|
3100
|
+
if (o.startsWith(pn)) {
|
|
3101
|
+
const s = o.slice(pn.length);
|
|
3102
|
+
s && t.add(s);
|
|
3103
|
+
} else o && n.add(o);
|
|
3104
|
+
}
|
|
3105
|
+
return n.size === 0 && t.size === 0 ? null : { allowed: n, excluded: t };
|
|
3106
|
+
}
|
|
3107
|
+
function ma(e, { allowed: n, excluded: t }) {
|
|
3108
|
+
const r = (e ?? []).map(({ id: i }) => String(i));
|
|
3109
|
+
return r.some((i) => t.has(i)) ? !1 : n.size === 0 || r.some((i) => n.has(i));
|
|
3110
|
+
}
|
|
3111
|
+
function ha(e, n) {
|
|
3112
|
+
const t = ga(
|
|
3113
|
+
Re(e.headers?.cookie)
|
|
3114
|
+
);
|
|
3115
|
+
if (t && !ma(n.isVariantOf.productClusters, t))
|
|
3116
|
+
throw new B(
|
|
3117
|
+
`Product ${n.isVariantOf.productId} is not in the shopper's assortment`
|
|
3118
|
+
);
|
|
3119
|
+
}
|
|
3120
|
+
const gn = {
|
|
3074
3121
|
price_desc: "price:desc",
|
|
3075
3122
|
price_asc: "price:asc",
|
|
3076
3123
|
orders_desc: "orders:desc",
|
|
@@ -3080,17 +3127,17 @@ const na = (e, n) => {
|
|
|
3080
3127
|
discount_desc: "discount:desc",
|
|
3081
3128
|
score_desc: ""
|
|
3082
3129
|
};
|
|
3083
|
-
function
|
|
3130
|
+
function fa(e, n) {
|
|
3084
3131
|
let t;
|
|
3085
|
-
if (Object.hasOwn(n, e) ? t = n[e] : Object.hasOwn(
|
|
3132
|
+
if (Object.hasOwn(n, e) ? t = n[e] : Object.hasOwn(gn, e) && (t = gn[e]), t === void 0)
|
|
3086
3133
|
throw new k(`Unknown sort value: ${e}`);
|
|
3087
3134
|
return t;
|
|
3088
3135
|
}
|
|
3089
|
-
const
|
|
3136
|
+
const Sa = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
3090
3137
|
if (!n)
|
|
3091
3138
|
throw new k("Missing operationId");
|
|
3092
3139
|
return t.orderEntry.getOperation({ operationId: n });
|
|
3093
|
-
},
|
|
3140
|
+
}, ya = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
3094
3141
|
if (!n)
|
|
3095
3142
|
throw new k("Missing orderFormId");
|
|
3096
3143
|
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
@@ -3106,50 +3153,52 @@ const la = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
|
3106
3153
|
unitMultiplier: i.unitMultiplier ?? 1
|
|
3107
3154
|
}));
|
|
3108
3155
|
};
|
|
3109
|
-
async function
|
|
3156
|
+
async function Ia(e, n, t, r) {
|
|
3110
3157
|
const i = n.slice(0, n.lastIndexOf("-"));
|
|
3111
|
-
return (await
|
|
3158
|
+
return (await pe(e, t, r))?.linkId === i;
|
|
3112
3159
|
}
|
|
3113
|
-
const
|
|
3114
|
-
async function
|
|
3160
|
+
const Qn = "Invalid SkuId", Zn = "Slug was set but the fetched sku does not satisfy the slug condition.", va = "UseAdHocCard", Oa = (e) => Y(e) || e instanceof Error && (e.message === Qn || e.message.startsWith(Zn));
|
|
3161
|
+
async function Ca(e, n, t, r) {
|
|
3115
3162
|
const { linkText: i, productId: a } = n.isVariantOf;
|
|
3116
|
-
if (!(!t || !i || t.startsWith(i) ||
|
|
3117
|
-
throw new Error(`${
|
|
3163
|
+
if (!(!t || !i || t.startsWith(i) || K(e) && r && Jn(t.split("-").pop() ?? "") && await Ia(e, t, a, r)))
|
|
3164
|
+
throw new Error(`${Zn} slug: ${t}, linkText: ${i}`);
|
|
3118
3165
|
}
|
|
3119
|
-
async function
|
|
3166
|
+
async function ba(e, n) {
|
|
3120
3167
|
if (n == null)
|
|
3121
3168
|
throw new k("Missing slug or id");
|
|
3122
3169
|
const {
|
|
3123
3170
|
clients: { commerce: t, search: r }
|
|
3124
3171
|
} = e, i = await t.catalog.portal.pagetype(`${n}/p`);
|
|
3125
3172
|
if (i.pageType !== "Product" || !i.id)
|
|
3126
|
-
throw new
|
|
3173
|
+
throw new B(`No product found for slug ${n}`);
|
|
3127
3174
|
const a = await r.fetchProduct({
|
|
3128
3175
|
field: "id",
|
|
3129
3176
|
value: String(i.id)
|
|
3130
3177
|
}).catch(() => null);
|
|
3131
3178
|
if (!a)
|
|
3132
|
-
throw new
|
|
3133
|
-
return L(
|
|
3179
|
+
throw new B(`No product found for id ${i.id}`);
|
|
3180
|
+
return L(he(a.items), a);
|
|
3134
3181
|
}
|
|
3135
|
-
const
|
|
3182
|
+
const wa = {
|
|
3136
3183
|
product: async (e, { locator: n }, t) => {
|
|
3137
|
-
const r =
|
|
3138
|
-
r &&
|
|
3184
|
+
const r = Ze(n), i = Qe(n), a = Vr(n), o = zr(n);
|
|
3185
|
+
r && te(t, r), i && Ae(t, i);
|
|
3139
3186
|
const {
|
|
3140
3187
|
loaders: { skuLoader: s }
|
|
3141
|
-
} = t
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3188
|
+
} = t, d = await (async () => {
|
|
3189
|
+
try {
|
|
3190
|
+
const g = a ?? o?.split("-").pop() ?? "";
|
|
3191
|
+
if (!Jn(g))
|
|
3192
|
+
throw new Error(Qn);
|
|
3193
|
+
const u = await s.load(g);
|
|
3194
|
+
return await Ca(t, u, o, i), u;
|
|
3195
|
+
} catch (g) {
|
|
3196
|
+
if (!Oa(g))
|
|
3197
|
+
throw g;
|
|
3198
|
+
return ba(t, o);
|
|
3199
|
+
}
|
|
3200
|
+
})();
|
|
3201
|
+
return ha(t, d), d;
|
|
3153
3202
|
},
|
|
3154
3203
|
collection: (e, { slug: n }, t) => {
|
|
3155
3204
|
const {
|
|
@@ -3157,7 +3206,7 @@ const fa = {
|
|
|
3157
3206
|
} = t;
|
|
3158
3207
|
return r.load({
|
|
3159
3208
|
slug: n,
|
|
3160
|
-
locale:
|
|
3209
|
+
locale: Pn(t)
|
|
3161
3210
|
});
|
|
3162
3211
|
},
|
|
3163
3212
|
search: async (e, {
|
|
@@ -3168,21 +3217,21 @@ const fa = {
|
|
|
3168
3217
|
selectedFacets: a,
|
|
3169
3218
|
sponsoredCount: o
|
|
3170
3219
|
}, s) => {
|
|
3171
|
-
const c =
|
|
3172
|
-
c &&
|
|
3173
|
-
const
|
|
3174
|
-
page: Math.ceil(
|
|
3220
|
+
const c = Ze(a), d = Qe(a), g = Mr(a);
|
|
3221
|
+
c && te(s, c), d && Ae(s, d);
|
|
3222
|
+
const u = t ? Number(t) : 0, f = {
|
|
3223
|
+
page: Math.ceil(u / n) || 0,
|
|
3175
3224
|
count: n,
|
|
3176
3225
|
query: i ?? void 0,
|
|
3177
|
-
sort:
|
|
3178
|
-
selectedFacets: a?.flatMap(
|
|
3226
|
+
sort: fa(r ?? "score_desc", s.storage.customSortMap),
|
|
3227
|
+
selectedFacets: a?.flatMap(Ke) ?? [],
|
|
3179
3228
|
sponsoredCount: o ?? void 0
|
|
3180
3229
|
};
|
|
3181
3230
|
if (g) {
|
|
3182
3231
|
const l = (await s.clients.commerce.catalog.products.crossselling({
|
|
3183
|
-
type:
|
|
3232
|
+
type: Rn[g.key],
|
|
3184
3233
|
productId: g.value
|
|
3185
|
-
})).map((m) => m.productId).slice(0, n),
|
|
3234
|
+
})).map((m) => m.productId).slice(0, n), p = s.clients.search.productsByIdentifier({ field: "id", values: l }).then((m) => ({
|
|
3186
3235
|
products: m,
|
|
3187
3236
|
recordsFiltered: m.length,
|
|
3188
3237
|
pagination: {
|
|
@@ -3205,7 +3254,7 @@ const fa = {
|
|
|
3205
3254
|
fuzzy: "0",
|
|
3206
3255
|
searchId: ""
|
|
3207
3256
|
}));
|
|
3208
|
-
return { searchArgs: f, productSearchPromise:
|
|
3257
|
+
return { searchArgs: f, productSearchPromise: p };
|
|
3209
3258
|
}
|
|
3210
3259
|
const h = s.clients.search.products(f);
|
|
3211
3260
|
return { searchArgs: f, productSearchPromise: h };
|
|
@@ -3258,7 +3307,7 @@ const fa = {
|
|
|
3258
3307
|
id: h.id,
|
|
3259
3308
|
name: h.name,
|
|
3260
3309
|
fatherCategoryId: I,
|
|
3261
|
-
linkId:
|
|
3310
|
+
linkId: ge(h.name),
|
|
3262
3311
|
title: h.Title,
|
|
3263
3312
|
description: null,
|
|
3264
3313
|
metaTagDescription: h.MetaTagDescription,
|
|
@@ -3274,13 +3323,13 @@ const fa = {
|
|
|
3274
3323
|
const f = [...o.filter((h) => h.isActive).map((h) => ({
|
|
3275
3324
|
id: h.id,
|
|
3276
3325
|
name: h.name,
|
|
3277
|
-
linkId:
|
|
3326
|
+
linkId: ge(h.name),
|
|
3278
3327
|
title: h.title,
|
|
3279
3328
|
description: null,
|
|
3280
3329
|
metaTagDescription: h.metaTagDescription,
|
|
3281
3330
|
availableLinkIds: null,
|
|
3282
3331
|
entityType: "brand"
|
|
3283
|
-
})), ...c].filter((h) => !!
|
|
3332
|
+
})), ...c].filter((h) => !!Un.slug(h, null, r, null));
|
|
3284
3333
|
return {
|
|
3285
3334
|
pageInfo: {
|
|
3286
3335
|
hasNextPage: f.length - a > n,
|
|
@@ -3315,7 +3364,7 @@ const fa = {
|
|
|
3315
3364
|
page: 1,
|
|
3316
3365
|
count: 1,
|
|
3317
3366
|
query: n ?? void 0,
|
|
3318
|
-
selectedFacets: t?.flatMap(
|
|
3367
|
+
selectedFacets: t?.flatMap(Ke) ?? [],
|
|
3319
3368
|
allowRedirect: !0
|
|
3320
3369
|
});
|
|
3321
3370
|
return {
|
|
@@ -3363,11 +3412,11 @@ const fa = {
|
|
|
3363
3412
|
clients: { commerce: r }
|
|
3364
3413
|
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
3365
3414
|
if (!i)
|
|
3366
|
-
throw new
|
|
3415
|
+
throw new B(`No order found for id ${n}`);
|
|
3367
3416
|
let a = null;
|
|
3368
3417
|
try {
|
|
3369
3418
|
const c = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
3370
|
-
a =
|
|
3419
|
+
a = Nn(c);
|
|
3371
3420
|
} catch {
|
|
3372
3421
|
}
|
|
3373
3422
|
const s = (await r.masterData.getShopperById({
|
|
@@ -3406,7 +3455,7 @@ const fa = {
|
|
|
3406
3455
|
a = { message: i };
|
|
3407
3456
|
}
|
|
3408
3457
|
const o = a?.message || i;
|
|
3409
|
-
throw
|
|
3458
|
+
throw Y(r) ? new B(`No order found for id ${n}. ${o}.`) : _t(r) ? new re(
|
|
3410
3459
|
`You are forbidden to interact with order with id ${n}. ${o}.`
|
|
3411
3460
|
) : r;
|
|
3412
3461
|
}
|
|
@@ -3454,10 +3503,10 @@ const fa = {
|
|
|
3454
3503
|
account: r,
|
|
3455
3504
|
headers: i,
|
|
3456
3505
|
clients: { commerce: a }
|
|
3457
|
-
} = t, s =
|
|
3506
|
+
} = t, s = G(z(i?.cookie ?? "", r))?.userId ?? "";
|
|
3458
3507
|
if (!s)
|
|
3459
3508
|
return !0;
|
|
3460
|
-
const c = await a.licenseManager.isResourceGranted({ userId: s, resourceKey:
|
|
3509
|
+
const c = await a.licenseManager.isResourceGranted({ userId: s, resourceKey: va }).catch(() => null);
|
|
3461
3510
|
return typeof c == "boolean" ? c : !0;
|
|
3462
3511
|
},
|
|
3463
3512
|
listUserQuotes: async (e, n, t) => {
|
|
@@ -3511,52 +3560,57 @@ const fa = {
|
|
|
3511
3560
|
account: r,
|
|
3512
3561
|
headers: i,
|
|
3513
3562
|
clients: { commerce: a }
|
|
3514
|
-
} = t, s =
|
|
3563
|
+
} = t, s = G(z(i?.cookie ?? "", r))?.userId ?? "", [c, d, g] = await Promise.all([
|
|
3515
3564
|
a.session("").catch(() => null),
|
|
3516
3565
|
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
3517
3566
|
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
3518
|
-
]),
|
|
3567
|
+
]), u = d?.[0], f = c?.namespaces.authentication ?? null, h = `${(u?.firstName ?? "").trim()} ${(u?.lastName ?? "").trim()}`.trim();
|
|
3519
3568
|
return {
|
|
3520
3569
|
username: f?.storeUserEmail?.value ?? "",
|
|
3521
3570
|
name: h,
|
|
3522
3571
|
email: f?.storeUserEmail?.value ?? "",
|
|
3523
|
-
phone:
|
|
3572
|
+
phone: u?.phone ?? "",
|
|
3524
3573
|
role: g?.Roles?.map((I) => I.Name) ?? [],
|
|
3525
3574
|
orgUnit: f?.unitName?.value ?? ""
|
|
3526
3575
|
};
|
|
3527
3576
|
},
|
|
3528
|
-
//
|
|
3529
|
-
//
|
|
3577
|
+
// Buyers with an organizational unit and a contract get the contract
|
|
3578
|
+
// information. Everyone else gets the b2c user information.
|
|
3530
3579
|
accountProfile: async (e, n, t) => {
|
|
3531
3580
|
const {
|
|
3532
3581
|
account: r,
|
|
3533
3582
|
headers: i,
|
|
3534
3583
|
clients: { commerce: a }
|
|
3535
|
-
} = t, o =
|
|
3584
|
+
} = t, o = G(z(i?.cookie ?? "", r));
|
|
3536
3585
|
if (!o?.userId)
|
|
3537
3586
|
return null;
|
|
3538
|
-
if (o
|
|
3587
|
+
if (Be(null, o.unitId)) {
|
|
3539
3588
|
const c = await a.session("").catch(() => null);
|
|
3540
3589
|
if (!c)
|
|
3541
3590
|
return null;
|
|
3542
|
-
const d = c.namespaces.profile ?? null, g = c.namespaces.shopper ?? null,
|
|
3543
|
-
|
|
3544
|
-
|
|
3591
|
+
const d = c.namespaces.profile ?? null, g = c.namespaces.shopper ?? null, u = c.namespaces.authentication ?? null, f = Le(
|
|
3592
|
+
g?.activeContractId?.value,
|
|
3593
|
+
u?.customerId?.value,
|
|
3594
|
+
o.customerId
|
|
3595
|
+
);
|
|
3596
|
+
if (f) {
|
|
3597
|
+
let h = null;
|
|
3545
3598
|
try {
|
|
3546
3599
|
h = await a.masterData.getContractById({ contractId: f });
|
|
3547
|
-
} catch (
|
|
3600
|
+
} catch (p) {
|
|
3548
3601
|
console.error(
|
|
3549
3602
|
`Error while getting contract data for contract ID (${f}).`,
|
|
3550
|
-
|
|
3603
|
+
p
|
|
3551
3604
|
);
|
|
3552
3605
|
}
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3606
|
+
const I = `${(g?.firstName?.value ?? "").trim()} ${(g?.lastName?.value ?? "").trim()}`.trim();
|
|
3607
|
+
return {
|
|
3608
|
+
name: Yn(h, d) || I || "",
|
|
3609
|
+
email: d?.email?.value || u?.storeUserEmail?.value || "",
|
|
3610
|
+
id: d?.id?.value || f
|
|
3611
|
+
// createdAt: '',
|
|
3612
|
+
};
|
|
3613
|
+
}
|
|
3560
3614
|
}
|
|
3561
3615
|
const s = await a.licenseManager.getUserById({
|
|
3562
3616
|
userId: o?.userId
|
|
@@ -3577,27 +3631,27 @@ const fa = {
|
|
|
3577
3631
|
account: r,
|
|
3578
3632
|
headers: i,
|
|
3579
3633
|
clients: { commerce: a }
|
|
3580
|
-
} = t, o = await a.session("").catch(() => null), s =
|
|
3634
|
+
} = t, o = await a.session("").catch(() => null), s = z(i?.cookie ?? "", r);
|
|
3581
3635
|
let c = null;
|
|
3582
3636
|
try {
|
|
3583
|
-
c = s ?
|
|
3637
|
+
c = s ? G(s) : null;
|
|
3584
3638
|
} catch {
|
|
3585
3639
|
c = null;
|
|
3586
3640
|
}
|
|
3587
3641
|
const d = o?.namespaces.authentication?.unitId?.value?.trim() ?? c?.unitId?.trim() ?? "";
|
|
3588
3642
|
if (!d || d !== n)
|
|
3589
|
-
throw new
|
|
3643
|
+
throw new re(
|
|
3590
3644
|
"You are not allowed to list contracts for this organization unit"
|
|
3591
3645
|
);
|
|
3592
|
-
const g =
|
|
3646
|
+
const g = Ri(
|
|
3593
3647
|
o?.namespaces.shopper
|
|
3594
|
-
),
|
|
3648
|
+
), u = Fi(o) || c?.customerId?.trim() || "", f = await a.storeFront.attachedContracts(n).catch((I) => (console.warn(
|
|
3595
3649
|
"availableContracts: default contract lookup failed",
|
|
3596
3650
|
I
|
|
3597
|
-
), null)), h =
|
|
3598
|
-
return
|
|
3651
|
+
), null)), h = Li(f?.contracts);
|
|
3652
|
+
return Bi(
|
|
3599
3653
|
g,
|
|
3600
|
-
|
|
3654
|
+
u,
|
|
3601
3655
|
h
|
|
3602
3656
|
);
|
|
3603
3657
|
},
|
|
@@ -3605,7 +3659,7 @@ const fa = {
|
|
|
3605
3659
|
const {
|
|
3606
3660
|
clients: { search: o }
|
|
3607
3661
|
} = a;
|
|
3608
|
-
i &&
|
|
3662
|
+
i && te(a, i);
|
|
3609
3663
|
const s = n?.longitude != null && n?.latitude != null ? `${n.longitude},${n.latitude}` : void 0;
|
|
3610
3664
|
return {
|
|
3611
3665
|
pickupPointDistances: (await o.pickupPointAvailability({
|
|
@@ -3616,10 +3670,10 @@ const fa = {
|
|
|
3616
3670
|
pickupPointsHash: null
|
|
3617
3671
|
};
|
|
3618
3672
|
},
|
|
3619
|
-
orderEntryOperation:
|
|
3620
|
-
orderFormItems:
|
|
3621
|
-
recommendations:
|
|
3622
|
-
},
|
|
3673
|
+
orderEntryOperation: Sa,
|
|
3674
|
+
orderFormItems: ya,
|
|
3675
|
+
recommendations: ua
|
|
3676
|
+
}, Aa = {
|
|
3623
3677
|
reviewRating: () => ({
|
|
3624
3678
|
ratingValue: 5,
|
|
3625
3679
|
bestRating: 5
|
|
@@ -3627,16 +3681,16 @@ const fa = {
|
|
|
3627
3681
|
author: () => ({
|
|
3628
3682
|
name: ""
|
|
3629
3683
|
})
|
|
3630
|
-
},
|
|
3684
|
+
}, Pa = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, Da = {
|
|
3631
3685
|
suggestions: async (e, n, t) => {
|
|
3632
3686
|
const {
|
|
3633
3687
|
clients: { search: r }
|
|
3634
3688
|
} = t, { searchArgs: i } = e;
|
|
3635
3689
|
if (!i.query)
|
|
3636
3690
|
return {
|
|
3637
|
-
terms: (await r.topSearches()).searches.map((
|
|
3638
|
-
value:
|
|
3639
|
-
count:
|
|
3691
|
+
terms: (await r.topSearches()).searches.map((u) => ({
|
|
3692
|
+
value: u.term,
|
|
3693
|
+
count: u.count
|
|
3640
3694
|
})),
|
|
3641
3695
|
products: []
|
|
3642
3696
|
};
|
|
@@ -3644,8 +3698,8 @@ const fa = {
|
|
|
3644
3698
|
r.suggestedTerms(i),
|
|
3645
3699
|
a
|
|
3646
3700
|
]), c = s.products.map((g) => {
|
|
3647
|
-
const
|
|
3648
|
-
return
|
|
3701
|
+
const u = he(g.items);
|
|
3702
|
+
return u && L(u, g);
|
|
3649
3703
|
}).filter((g) => !!g), { searches: d } = o;
|
|
3650
3704
|
return {
|
|
3651
3705
|
terms: d.map((g) => ({ value: g.term, count: g.count })),
|
|
@@ -3654,7 +3708,7 @@ const fa = {
|
|
|
3654
3708
|
},
|
|
3655
3709
|
products: async ({ productSearchPromise: e }) => {
|
|
3656
3710
|
const n = await e, t = n.products.map((r) => {
|
|
3657
|
-
const i =
|
|
3711
|
+
const i = he(r.items);
|
|
3658
3712
|
return i && L(i, r);
|
|
3659
3713
|
}).filter((r) => !!r);
|
|
3660
3714
|
return {
|
|
@@ -3678,7 +3732,7 @@ const fa = {
|
|
|
3678
3732
|
t.storage.searchArgs = e;
|
|
3679
3733
|
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;
|
|
3680
3734
|
return i.filter(
|
|
3681
|
-
(d) => !a || !
|
|
3735
|
+
(d) => !a || !Pa(d, o, s)
|
|
3682
3736
|
);
|
|
3683
3737
|
},
|
|
3684
3738
|
metadata: async ({ productSearchPromise: e }) => {
|
|
@@ -3690,12 +3744,12 @@ const fa = {
|
|
|
3690
3744
|
};
|
|
3691
3745
|
},
|
|
3692
3746
|
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
3693
|
-
},
|
|
3747
|
+
}, Ea = {
|
|
3694
3748
|
title: ({ title: e }) => e ?? "",
|
|
3695
3749
|
description: ({ description: e }) => e ?? "",
|
|
3696
3750
|
canonical: ({ canonical: e }) => e ?? "",
|
|
3697
3751
|
titleTemplate: () => ""
|
|
3698
|
-
},
|
|
3752
|
+
}, ka = ["bd", "d", "h", "m"], _a = (e) => ka.includes(e), Ta = {
|
|
3699
3753
|
bd: {
|
|
3700
3754
|
0: "Today",
|
|
3701
3755
|
1: "In 1 business day",
|
|
@@ -3716,29 +3770,29 @@ const fa = {
|
|
|
3716
3770
|
1: "In 1 minute",
|
|
3717
3771
|
other: "Up to # minutes"
|
|
3718
3772
|
}
|
|
3719
|
-
},
|
|
3720
|
-
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i =
|
|
3773
|
+
}, et = (e) => {
|
|
3774
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = _a(t);
|
|
3721
3775
|
if (!r || !i)
|
|
3722
3776
|
return "";
|
|
3723
3777
|
const a = Number(n) < 2 ? Number(n) : "other";
|
|
3724
|
-
return
|
|
3725
|
-
},
|
|
3778
|
+
return Ta[t][a].replace("#", n) ?? "";
|
|
3779
|
+
}, Ua = {
|
|
3726
3780
|
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
3727
3781
|
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
3728
|
-
localizedEstimates: (e) => e?.shippingEstimate ?
|
|
3729
|
-
},
|
|
3730
|
-
function
|
|
3731
|
-
const t = `${
|
|
3782
|
+
localizedEstimates: (e) => e?.shippingEstimate ? et(e.shippingEstimate) : ""
|
|
3783
|
+
}, mn = "skuvariation";
|
|
3784
|
+
function hn(e, n) {
|
|
3785
|
+
const t = `${mn}${n}`.toLowerCase(), r = e.find(
|
|
3732
3786
|
(a) => a.imageLabel === t
|
|
3733
3787
|
);
|
|
3734
3788
|
if (r)
|
|
3735
3789
|
return r;
|
|
3736
3790
|
const i = e.find(
|
|
3737
|
-
(a) => a.imageLabel ===
|
|
3791
|
+
(a) => a.imageLabel === mn
|
|
3738
3792
|
);
|
|
3739
3793
|
return i || e[0];
|
|
3740
3794
|
}
|
|
3741
|
-
function
|
|
3795
|
+
function Ra(e, n, t) {
|
|
3742
3796
|
const r = {};
|
|
3743
3797
|
return e.forEach((i) => {
|
|
3744
3798
|
const a = i.variations;
|
|
@@ -3750,30 +3804,30 @@ function Aa(e, n, t) {
|
|
|
3750
3804
|
r[s] = `${t}-${i.itemId}`;
|
|
3751
3805
|
}), r;
|
|
3752
3806
|
}
|
|
3753
|
-
function
|
|
3807
|
+
function fn(e) {
|
|
3754
3808
|
const n = {};
|
|
3755
3809
|
return e.forEach((t) => {
|
|
3756
3810
|
n[t.name] = t.values[0];
|
|
3757
3811
|
}), n;
|
|
3758
3812
|
}
|
|
3759
|
-
function
|
|
3813
|
+
function Na(e) {
|
|
3760
3814
|
const n = {};
|
|
3761
3815
|
return e?.forEach((t) => {
|
|
3762
3816
|
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
3763
3817
|
}), n;
|
|
3764
3818
|
}
|
|
3765
|
-
function
|
|
3819
|
+
function Fa(e, n) {
|
|
3766
3820
|
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
3767
3821
|
}
|
|
3768
|
-
function
|
|
3822
|
+
function La(e) {
|
|
3769
3823
|
const n = e;
|
|
3770
3824
|
for (const t in e)
|
|
3771
3825
|
e[t].every(
|
|
3772
3826
|
(i) => !Number.isNaN(Number(i.value))
|
|
3773
|
-
) && e[t].sort((i, a) =>
|
|
3827
|
+
) && e[t].sort((i, a) => Fa(i.value, a.value));
|
|
3774
3828
|
return n;
|
|
3775
3829
|
}
|
|
3776
|
-
function
|
|
3830
|
+
function Ba(e, n, t) {
|
|
3777
3831
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
3778
3832
|
return e.forEach((a) => {
|
|
3779
3833
|
if (a.variations.length === 0)
|
|
@@ -3786,7 +3840,7 @@ function ka(e, n, t) {
|
|
|
3786
3840
|
if (!o || i.has(c))
|
|
3787
3841
|
return;
|
|
3788
3842
|
i.add(c);
|
|
3789
|
-
const d =
|
|
3843
|
+
const d = hn(
|
|
3790
3844
|
a.images,
|
|
3791
3845
|
n
|
|
3792
3846
|
), g = {
|
|
@@ -3803,81 +3857,81 @@ function ka(e, n, t) {
|
|
|
3803
3857
|
if (i.has(d))
|
|
3804
3858
|
return;
|
|
3805
3859
|
i.add(d);
|
|
3806
|
-
const g =
|
|
3860
|
+
const g = hn(
|
|
3807
3861
|
a.images,
|
|
3808
3862
|
c.name
|
|
3809
|
-
),
|
|
3863
|
+
), u = {
|
|
3810
3864
|
src: g.imageUrl,
|
|
3811
3865
|
alt: g.imageText ?? "",
|
|
3812
3866
|
label: `${c.name}: ${c.values[0]}`,
|
|
3813
3867
|
value: c.values[0]
|
|
3814
3868
|
};
|
|
3815
|
-
r[c.name] ? r[c.name].push(
|
|
3869
|
+
r[c.name] ? r[c.name].push(u) : r[c.name] = [u];
|
|
3816
3870
|
});
|
|
3817
|
-
}),
|
|
3871
|
+
}), La(r);
|
|
3818
3872
|
}
|
|
3819
|
-
const
|
|
3820
|
-
activeVariations: (e) =>
|
|
3821
|
-
allVariantsByName: (e) =>
|
|
3822
|
-
slugsMap: (e, n) =>
|
|
3873
|
+
const $a = {
|
|
3874
|
+
activeVariations: (e) => fn(e.variations),
|
|
3875
|
+
allVariantsByName: (e) => Na(e.isVariantOf.skuSpecifications),
|
|
3876
|
+
slugsMap: (e, n) => Ra(
|
|
3823
3877
|
e.isVariantOf.items,
|
|
3824
3878
|
n.dominantVariantName ?? e.variations[0]?.name,
|
|
3825
3879
|
e.isVariantOf.linkText
|
|
3826
3880
|
),
|
|
3827
3881
|
availableVariations: (e, n) => {
|
|
3828
|
-
const t = n.dominantVariantName ?? e.variations[0]?.name, i =
|
|
3829
|
-
return
|
|
3882
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = fn(e.variations)[t];
|
|
3883
|
+
return Ba(
|
|
3830
3884
|
e.isVariantOf.items,
|
|
3831
3885
|
t,
|
|
3832
3886
|
i
|
|
3833
3887
|
);
|
|
3834
3888
|
},
|
|
3835
3889
|
allVariantProducts: (e) => e.isVariantOf.items.map((n) => L(n, e.isVariantOf))
|
|
3836
|
-
},
|
|
3890
|
+
}, Ma = {
|
|
3837
3891
|
"pickup-in-point": "Pickup",
|
|
3838
3892
|
delivery: "Delivery",
|
|
3839
3893
|
pickup: "Pickup",
|
|
3840
3894
|
"take-away": "Take away",
|
|
3841
3895
|
"": ""
|
|
3842
|
-
},
|
|
3896
|
+
}, za = {
|
|
3843
3897
|
deliveryOptionsData: (e) => {
|
|
3844
3898
|
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
|
|
3845
3899
|
(d, g) => {
|
|
3846
|
-
const
|
|
3847
|
-
(
|
|
3848
|
-
),
|
|
3849
|
-
|
|
3850
|
-
),
|
|
3851
|
-
return d[
|
|
3900
|
+
const u = g?.selectedSla || "", f = g?.selectedDeliveryChannel || g?.deliveryChannel || "", h = g?.deliveryCompany || "", I = g?.deliveryWindow, l = g?.pickupStoreInfo, p = g?.shippingEstimate || "", m = g?.shippingEstimate ? et(g?.shippingEstimate) : "", S = g?.shippingEstimateDate || "", v = g?.addressId || "", O = g?.itemIndex ?? 0, C = t?.[O], T = C?.seller || "", w = `${u}|${f}|${h}|${T}|${p}|${S}|${v}|${I?.startDateUtc}|${I?.endDateUtc}`, b = i?.find(
|
|
3901
|
+
(U) => U?.addressId === v
|
|
3902
|
+
), A = `${Ma[f] || ""} ${m} ${b?.neighborhood ? `to ${b?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: E, taxPriceTags: _ } = Va(
|
|
3903
|
+
C?.priceTags ?? []
|
|
3904
|
+
), D = (C?.sellingPrice ?? 0) * (C?.quantity ?? 0) + (C?.tax ?? 0) + (E ?? 0);
|
|
3905
|
+
return d[w] || (d[w] = {
|
|
3852
3906
|
// static fields
|
|
3853
|
-
selectedSla:
|
|
3907
|
+
selectedSla: u,
|
|
3854
3908
|
deliveryChannel: f,
|
|
3855
3909
|
deliveryCompany: h,
|
|
3856
3910
|
deliveryWindow: I,
|
|
3857
|
-
shippingEstimate:
|
|
3911
|
+
shippingEstimate: p,
|
|
3858
3912
|
shippingEstimateDate: S,
|
|
3859
3913
|
seller: T,
|
|
3860
3914
|
friendlyShippingEstimate: m,
|
|
3861
|
-
friendlyDeliveryOptionName:
|
|
3862
|
-
address:
|
|
3915
|
+
friendlyDeliveryOptionName: A,
|
|
3916
|
+
address: b,
|
|
3863
3917
|
pickupStoreInfo: l,
|
|
3864
3918
|
// dynamic fields
|
|
3865
3919
|
quantityOfDifferentItems: 0,
|
|
3866
3920
|
total: 0,
|
|
3867
3921
|
items: []
|
|
3868
|
-
}), d[
|
|
3869
|
-
id:
|
|
3870
|
-
uniqueId:
|
|
3871
|
-
name:
|
|
3872
|
-
quantity:
|
|
3873
|
-
price:
|
|
3874
|
-
sellingPrice:
|
|
3875
|
-
imageUrl:
|
|
3922
|
+
}), d[w] && (d[w].items?.push({
|
|
3923
|
+
id: C?.id || "",
|
|
3924
|
+
uniqueId: C?.uniqueId || "",
|
|
3925
|
+
name: C?.name || "",
|
|
3926
|
+
quantity: C?.quantity || 0,
|
|
3927
|
+
price: C?.price || 0,
|
|
3928
|
+
sellingPrice: C?.sellingPrice || 0,
|
|
3929
|
+
imageUrl: C?.imageUrl || "",
|
|
3876
3930
|
taxPriceTags: _ ?? [],
|
|
3877
|
-
taxPriceTagsTotal:
|
|
3878
|
-
tax:
|
|
3879
|
-
total:
|
|
3880
|
-
}), d[
|
|
3931
|
+
taxPriceTagsTotal: E ?? 0,
|
|
3932
|
+
tax: C?.tax || 0,
|
|
3933
|
+
total: D
|
|
3934
|
+
}), d[w].quantityOfDifferentItems = (d[w].quantityOfDifferentItems ?? 0) + 1, d[w].total = (d[w].total ?? 0) + D), d;
|
|
3881
3935
|
},
|
|
3882
3936
|
{}
|
|
3883
3937
|
), o = Object.values(a), s = n?.contactInformation?.[0], c = {
|
|
@@ -3903,7 +3957,7 @@ const _a = {
|
|
|
3903
3957
|
) || [];
|
|
3904
3958
|
}
|
|
3905
3959
|
};
|
|
3906
|
-
function
|
|
3960
|
+
function Va(e) {
|
|
3907
3961
|
const t = e.filter(
|
|
3908
3962
|
(i) => i?.name?.includes("TAX")
|
|
3909
3963
|
), r = t.reduce(
|
|
@@ -3915,28 +3969,28 @@ function Ua(e) {
|
|
|
3915
3969
|
taxPriceTagsTotal: r
|
|
3916
3970
|
};
|
|
3917
3971
|
}
|
|
3918
|
-
const
|
|
3919
|
-
StoreCollection:
|
|
3920
|
-
StoreAggregateOffer:
|
|
3921
|
-
StoreProduct:
|
|
3922
|
-
StoreSeo:
|
|
3923
|
-
StoreFacet:
|
|
3924
|
-
StoreFacetBoolean:
|
|
3925
|
-
StoreFacetRange:
|
|
3926
|
-
StoreFacetValueBoolean:
|
|
3927
|
-
StoreOffer:
|
|
3928
|
-
StoreAggregateRating:
|
|
3929
|
-
StoreReview:
|
|
3930
|
-
StoreProductGroup:
|
|
3931
|
-
StoreSearchResult:
|
|
3932
|
-
StorePropertyValue:
|
|
3933
|
-
SkuVariants:
|
|
3934
|
-
ShippingSLA:
|
|
3935
|
-
UserOrderResult:
|
|
3936
|
-
ObjectOrString:
|
|
3937
|
-
Query:
|
|
3938
|
-
Mutation:
|
|
3939
|
-
},
|
|
3972
|
+
const xa = {
|
|
3973
|
+
StoreCollection: Un,
|
|
3974
|
+
StoreAggregateOffer: Rr,
|
|
3975
|
+
StoreProduct: oa,
|
|
3976
|
+
StoreSeo: Ea,
|
|
3977
|
+
StoreFacet: xr,
|
|
3978
|
+
StoreFacetBoolean: qr,
|
|
3979
|
+
StoreFacetRange: jr,
|
|
3980
|
+
StoreFacetValueBoolean: Wr,
|
|
3981
|
+
StoreOffer: ea,
|
|
3982
|
+
StoreAggregateRating: Nr,
|
|
3983
|
+
StoreReview: Aa,
|
|
3984
|
+
StoreProductGroup: ca,
|
|
3985
|
+
StoreSearchResult: Da,
|
|
3986
|
+
StorePropertyValue: la,
|
|
3987
|
+
SkuVariants: $a,
|
|
3988
|
+
ShippingSLA: Ua,
|
|
3989
|
+
UserOrderResult: za,
|
|
3990
|
+
ObjectOrString: Zi,
|
|
3991
|
+
Query: wa,
|
|
3992
|
+
Mutation: Ki
|
|
3993
|
+
}, qa = () => xa, ja = `"""
|
|
3940
3994
|
Address information.
|
|
3941
3995
|
"""
|
|
3942
3996
|
type Address {
|
|
@@ -3981,7 +4035,7 @@ type Address {
|
|
|
3981
4035
|
"""
|
|
3982
4036
|
geoCoordinates: [Float]
|
|
3983
4037
|
}
|
|
3984
|
-
`,
|
|
4038
|
+
`, Wa = `"""
|
|
3985
4039
|
Advertisement information about a specific product in a campaign
|
|
3986
4040
|
"""
|
|
3987
4041
|
type Advertisement {
|
|
@@ -4006,7 +4060,7 @@ type Advertisement {
|
|
|
4006
4060
|
"""
|
|
4007
4061
|
adResponseId: String!
|
|
4008
4062
|
}
|
|
4009
|
-
`,
|
|
4063
|
+
`, Ha = `"""
|
|
4010
4064
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
4011
4065
|
"""
|
|
4012
4066
|
type StoreAggregateOffer {
|
|
@@ -4035,7 +4089,7 @@ type StoreAggregateOffer {
|
|
|
4035
4089
|
"""
|
|
4036
4090
|
offers: [StoreOffer!]!
|
|
4037
4091
|
}
|
|
4038
|
-
`,
|
|
4092
|
+
`, Ga = `"""
|
|
4039
4093
|
Average rating, based on multiple ratings or reviews.
|
|
4040
4094
|
"""
|
|
4041
4095
|
type StoreAggregateRating {
|
|
@@ -4048,7 +4102,7 @@ type StoreAggregateRating {
|
|
|
4048
4102
|
"""
|
|
4049
4103
|
reviewCount: Int!
|
|
4050
4104
|
}
|
|
4051
|
-
`,
|
|
4105
|
+
`, Xa = `"""
|
|
4052
4106
|
information about the author of a product review or rating.
|
|
4053
4107
|
"""
|
|
4054
4108
|
type StoreAuthor {
|
|
@@ -4057,7 +4111,7 @@ type StoreAuthor {
|
|
|
4057
4111
|
"""
|
|
4058
4112
|
name: String!
|
|
4059
4113
|
}
|
|
4060
|
-
`,
|
|
4114
|
+
`, Ya = `"""
|
|
4061
4115
|
Brand of a given product.
|
|
4062
4116
|
"""
|
|
4063
4117
|
type StoreBrand {
|
|
@@ -4066,7 +4120,7 @@ type StoreBrand {
|
|
|
4066
4120
|
"""
|
|
4067
4121
|
name: String!
|
|
4068
4122
|
}
|
|
4069
|
-
`,
|
|
4123
|
+
`, Ka = `"""
|
|
4070
4124
|
Item of a list.
|
|
4071
4125
|
"""
|
|
4072
4126
|
type StoreListItem {
|
|
@@ -4097,7 +4151,7 @@ type StoreBreadcrumbList {
|
|
|
4097
4151
|
"""
|
|
4098
4152
|
numberOfItems: Int!
|
|
4099
4153
|
}
|
|
4100
|
-
`,
|
|
4154
|
+
`, Ja = `"""
|
|
4101
4155
|
Shopping cart message.
|
|
4102
4156
|
"""
|
|
4103
4157
|
type StoreCartMessage {
|
|
@@ -4134,7 +4188,7 @@ input IStoreCart {
|
|
|
4134
4188
|
"""
|
|
4135
4189
|
order: IStoreOrder!
|
|
4136
4190
|
}
|
|
4137
|
-
`,
|
|
4191
|
+
`, Qa = `"""
|
|
4138
4192
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\` or \`Collection\`.
|
|
4139
4193
|
|
|
4140
4194
|
\`SubCategory\` and \`Cluster\` are still declared for backward compatibility but are
|
|
@@ -4260,7 +4314,7 @@ type StoreCollectionLocale {
|
|
|
4260
4314
|
"""
|
|
4261
4315
|
slug: String!
|
|
4262
4316
|
}
|
|
4263
|
-
`,
|
|
4317
|
+
`, Za = `"""
|
|
4264
4318
|
Delivery Promise badge.
|
|
4265
4319
|
"""
|
|
4266
4320
|
type DeliveryPromiseBadge {
|
|
@@ -4269,7 +4323,7 @@ type DeliveryPromiseBadge {
|
|
|
4269
4323
|
"""
|
|
4270
4324
|
typeName: String
|
|
4271
4325
|
}
|
|
4272
|
-
`,
|
|
4326
|
+
`, eo = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
4273
4327
|
|
|
4274
4328
|
"""
|
|
4275
4329
|
Search facet range information.
|
|
@@ -4346,7 +4400,7 @@ type StoreFacetValueBoolean {
|
|
|
4346
4400
|
"""
|
|
4347
4401
|
quantity: Int
|
|
4348
4402
|
}
|
|
4349
|
-
`,
|
|
4403
|
+
`, no = `"""
|
|
4350
4404
|
Image.
|
|
4351
4405
|
"""
|
|
4352
4406
|
type StoreImage {
|
|
@@ -4373,7 +4427,7 @@ input IStoreImage {
|
|
|
4373
4427
|
"""
|
|
4374
4428
|
alternateName: String!
|
|
4375
4429
|
}
|
|
4376
|
-
`,
|
|
4430
|
+
`, to = `type Mutation {
|
|
4377
4431
|
"""
|
|
4378
4432
|
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\`.
|
|
4379
4433
|
"""
|
|
@@ -4415,7 +4469,7 @@ input IStoreImage {
|
|
|
4415
4469
|
"""
|
|
4416
4470
|
startRecommendationSession: Boolean!
|
|
4417
4471
|
}
|
|
4418
|
-
`,
|
|
4472
|
+
`, ro = `"""
|
|
4419
4473
|
Newsletter information.
|
|
4420
4474
|
"""
|
|
4421
4475
|
type PersonNewsletter {
|
|
@@ -4438,8 +4492,8 @@ input IPersonNewsletter {
|
|
|
4438
4492
|
"""
|
|
4439
4493
|
email: String!
|
|
4440
4494
|
}
|
|
4441
|
-
`,
|
|
4442
|
-
`,
|
|
4495
|
+
`, io = `scalar ObjectOrString
|
|
4496
|
+
`, ao = `"""
|
|
4443
4497
|
Offer information.
|
|
4444
4498
|
"""
|
|
4445
4499
|
type StoreOffer {
|
|
@@ -4532,7 +4586,7 @@ input IStoreOffer {
|
|
|
4532
4586
|
"""
|
|
4533
4587
|
priceToken: String
|
|
4534
4588
|
}
|
|
4535
|
-
`,
|
|
4589
|
+
`, oo = `"""
|
|
4536
4590
|
Information of a specific order.
|
|
4537
4591
|
"""
|
|
4538
4592
|
type StoreOrder {
|
|
@@ -4573,7 +4627,7 @@ input IStoreOrder {
|
|
|
4573
4627
|
"""
|
|
4574
4628
|
shouldSplitItem: Boolean
|
|
4575
4629
|
}
|
|
4576
|
-
`,
|
|
4630
|
+
`, so = `"""
|
|
4577
4631
|
Commercial Authorization response.
|
|
4578
4632
|
"""
|
|
4579
4633
|
type CommercialAuthorizationResponse {
|
|
@@ -4972,7 +5026,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
4972
5026
|
"""
|
|
4973
5027
|
rule: CommercialAuthorizationRule!
|
|
4974
5028
|
}
|
|
4975
|
-
`,
|
|
5029
|
+
`, co = `"""
|
|
4976
5030
|
Input for uploading a file to the Order Entry Service.
|
|
4977
5031
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
4978
5032
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -5033,7 +5087,7 @@ type StoreOrderFormCartItem {
|
|
|
5033
5087
|
seller: String!
|
|
5034
5088
|
unitMultiplier: Float
|
|
5035
5089
|
}
|
|
5036
|
-
`,
|
|
5090
|
+
`, lo = `"""
|
|
5037
5091
|
Organization.
|
|
5038
5092
|
"""
|
|
5039
5093
|
type StoreOrganization {
|
|
@@ -5074,7 +5128,7 @@ type StoreContract {
|
|
|
5074
5128
|
"""
|
|
5075
5129
|
isDefault: Boolean!
|
|
5076
5130
|
}
|
|
5077
|
-
`,
|
|
5131
|
+
`, uo = `"""
|
|
5078
5132
|
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.
|
|
5079
5133
|
"""
|
|
5080
5134
|
type StorePageInfo {
|
|
@@ -5099,7 +5153,7 @@ type StorePageInfo {
|
|
|
5099
5153
|
"""
|
|
5100
5154
|
totalCount: Int!
|
|
5101
5155
|
}
|
|
5102
|
-
`,
|
|
5156
|
+
`, po = `"""
|
|
5103
5157
|
Input type for setting a new password.
|
|
5104
5158
|
"""
|
|
5105
5159
|
input ISetPassword {
|
|
@@ -5142,7 +5196,7 @@ type SetPasswordResponse {
|
|
|
5142
5196
|
"""
|
|
5143
5197
|
message: String
|
|
5144
5198
|
}
|
|
5145
|
-
`,
|
|
5199
|
+
`, go = `"""
|
|
5146
5200
|
Client profile data.
|
|
5147
5201
|
"""
|
|
5148
5202
|
type StorePerson {
|
|
@@ -5185,7 +5239,7 @@ input IStorePerson {
|
|
|
5185
5239
|
"""
|
|
5186
5240
|
familyName: String!
|
|
5187
5241
|
}
|
|
5188
|
-
`,
|
|
5242
|
+
`, mo = `type PickupPointAddress {
|
|
5189
5243
|
"""
|
|
5190
5244
|
Address city.
|
|
5191
5245
|
"""
|
|
@@ -5267,7 +5321,7 @@ type PickupPoints {
|
|
|
5267
5321
|
reason: "Not returned by Intelligent Search pickup-point-availability. Always null."
|
|
5268
5322
|
)
|
|
5269
5323
|
}
|
|
5270
|
-
`,
|
|
5324
|
+
`, ho = `"""
|
|
5271
5325
|
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.
|
|
5272
5326
|
"""
|
|
5273
5327
|
type StoreProduct {
|
|
@@ -5443,7 +5497,7 @@ input IStoreProduct {
|
|
|
5443
5497
|
"""
|
|
5444
5498
|
additionalProperty: [IStorePropertyValue!]
|
|
5445
5499
|
}
|
|
5446
|
-
`,
|
|
5500
|
+
`, fo = `"""
|
|
5447
5501
|
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.
|
|
5448
5502
|
"""
|
|
5449
5503
|
type StoreProductGroup {
|
|
@@ -5488,7 +5542,7 @@ type StoreProductCluster {
|
|
|
5488
5542
|
"""
|
|
5489
5543
|
name: String!
|
|
5490
5544
|
}
|
|
5491
|
-
`,
|
|
5545
|
+
`, So = `type Profile {
|
|
5492
5546
|
"""
|
|
5493
5547
|
Collection of user's address
|
|
5494
5548
|
"""
|
|
@@ -5549,7 +5603,7 @@ type ProfileAddress {
|
|
|
5549
5603
|
"""
|
|
5550
5604
|
geoCoordinate: [Float]
|
|
5551
5605
|
}
|
|
5552
|
-
`,
|
|
5606
|
+
`, yo = `"""
|
|
5553
5607
|
Properties that can be associated with products and products groups.
|
|
5554
5608
|
"""
|
|
5555
5609
|
type StorePropertyValue {
|
|
@@ -5589,7 +5643,7 @@ input IStorePropertyValue {
|
|
|
5589
5643
|
"""
|
|
5590
5644
|
valueReference: ObjectOrString!
|
|
5591
5645
|
}
|
|
5592
|
-
`,
|
|
5646
|
+
`, Io = `"""
|
|
5593
5647
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
5594
5648
|
"""
|
|
5595
5649
|
type StoreProductEdge {
|
|
@@ -6250,7 +6304,7 @@ type StoreAccountProfile {
|
|
|
6250
6304
|
email: String
|
|
6251
6305
|
id: String
|
|
6252
6306
|
}
|
|
6253
|
-
`,
|
|
6307
|
+
`, vo = `"""
|
|
6254
6308
|
Summary of a quote returned in list results.
|
|
6255
6309
|
"""
|
|
6256
6310
|
type UserQuoteSummary {
|
|
@@ -6315,7 +6369,7 @@ type UserQuoteListPaging {
|
|
|
6315
6369
|
"""
|
|
6316
6370
|
perPage: Int!
|
|
6317
6371
|
}
|
|
6318
|
-
`,
|
|
6372
|
+
`, Oo = `type RecommendationResponse {
|
|
6319
6373
|
products: [StoreProduct!]!
|
|
6320
6374
|
correlationId: String!
|
|
6321
6375
|
campaign: RecommendationCampaign!
|
|
@@ -6326,7 +6380,7 @@ type RecommendationCampaign {
|
|
|
6326
6380
|
title: String
|
|
6327
6381
|
type: String!
|
|
6328
6382
|
}
|
|
6329
|
-
`,
|
|
6383
|
+
`, Co = `"""
|
|
6330
6384
|
Information of a given review rating.
|
|
6331
6385
|
"""
|
|
6332
6386
|
type StoreReviewRating {
|
|
@@ -6353,7 +6407,7 @@ type StoreReview {
|
|
|
6353
6407
|
"""
|
|
6354
6408
|
author: StoreAuthor!
|
|
6355
6409
|
}
|
|
6356
|
-
`,
|
|
6410
|
+
`, bo = `"""
|
|
6357
6411
|
Whether a saved card is personally owned by the buyer or shared by their
|
|
6358
6412
|
Organization/Contract. Resolved server-side by the Saved-cards service from
|
|
6359
6413
|
the buyer's \`useAdHocCard\` role — never inferred client-side.
|
|
@@ -6417,7 +6471,7 @@ type SavedCardListResult {
|
|
|
6417
6471
|
"""
|
|
6418
6472
|
list: [SavedCard!]
|
|
6419
6473
|
}
|
|
6420
|
-
`,
|
|
6474
|
+
`, wo = `"""
|
|
6421
6475
|
Search Engine Optimization (SEO) tags data.
|
|
6422
6476
|
"""
|
|
6423
6477
|
type StoreSeo {
|
|
@@ -6438,7 +6492,7 @@ type StoreSeo {
|
|
|
6438
6492
|
"""
|
|
6439
6493
|
canonical: String!
|
|
6440
6494
|
}
|
|
6441
|
-
`,
|
|
6495
|
+
`, Ao = `"""
|
|
6442
6496
|
Currency information.
|
|
6443
6497
|
"""
|
|
6444
6498
|
type StoreCurrency {
|
|
@@ -6631,6 +6685,9 @@ type StoreSession {
|
|
|
6631
6685
|
type StoreB2B {
|
|
6632
6686
|
customerId: String!
|
|
6633
6687
|
isRepresentative: Boolean
|
|
6688
|
+
@deprecated(
|
|
6689
|
+
reason: "Always true when \`b2b\` is set: a B2B session is identified by \`unitId\` and \`customerId\`. Check that \`b2b\` is not null instead. Scheduled for removal in the next major."
|
|
6690
|
+
)
|
|
6634
6691
|
unitName: String
|
|
6635
6692
|
unitId: String
|
|
6636
6693
|
firstName: String
|
|
@@ -6713,7 +6770,7 @@ input IStoreSession {
|
|
|
6713
6770
|
"""
|
|
6714
6771
|
refreshAfter: String
|
|
6715
6772
|
}
|
|
6716
|
-
`,
|
|
6773
|
+
`, Po = `"""
|
|
6717
6774
|
Shipping Simulation item input.
|
|
6718
6775
|
"""
|
|
6719
6776
|
input IShippingItem {
|
|
@@ -7044,7 +7101,7 @@ type MessageFields {
|
|
|
7044
7101
|
"""
|
|
7045
7102
|
skuName: String
|
|
7046
7103
|
}
|
|
7047
|
-
`,
|
|
7104
|
+
`, Do = `type SkuVariants {
|
|
7048
7105
|
"""
|
|
7049
7106
|
SKU property values for the current SKU.
|
|
7050
7107
|
"""
|
|
@@ -7139,7 +7196,7 @@ Example:
|
|
|
7139
7196
|
\`\`\`
|
|
7140
7197
|
"""
|
|
7141
7198
|
scalar FormattedVariants
|
|
7142
|
-
`,
|
|
7199
|
+
`, Eo = `"""
|
|
7143
7200
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
7144
7201
|
"""
|
|
7145
7202
|
enum StoreStatus {
|
|
@@ -7147,7 +7204,7 @@ enum StoreStatus {
|
|
|
7147
7204
|
WARNING
|
|
7148
7205
|
ERROR
|
|
7149
7206
|
}
|
|
7150
|
-
`,
|
|
7207
|
+
`, ko = `scalar JSONObject
|
|
7151
7208
|
|
|
7152
7209
|
type UserOrder {
|
|
7153
7210
|
orderId: String
|
|
@@ -7971,99 +8028,99 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
7971
8028
|
type: String
|
|
7972
8029
|
id: String
|
|
7973
8030
|
}
|
|
7974
|
-
`,
|
|
7975
|
-
"./address.graphql":
|
|
7976
|
-
"./advertisement.graphql":
|
|
7977
|
-
"./aggregateOffer.graphql":
|
|
7978
|
-
"./aggregateRating.graphql":
|
|
7979
|
-
"./author.graphql":
|
|
7980
|
-
"./brand.graphql":
|
|
7981
|
-
"./breadcrumb.graphql":
|
|
7982
|
-
"./cart.graphql":
|
|
7983
|
-
"./collection.graphql":
|
|
7984
|
-
"./deliveryPromisesBadge.graphql":
|
|
7985
|
-
"./facet.graphql":
|
|
7986
|
-
"./image.graphql":
|
|
7987
|
-
"./mutation.graphql":
|
|
7988
|
-
"./newsletter.graphql":
|
|
7989
|
-
"./objectOrString.graphql":
|
|
7990
|
-
"./offer.graphql":
|
|
7991
|
-
"./order.graphql":
|
|
7992
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
7993
|
-
"./orderEntry.graphql":
|
|
7994
|
-
"./organization.graphql":
|
|
7995
|
-
"./pageInfo.graphql":
|
|
7996
|
-
"./password.graphql":
|
|
7997
|
-
"./person.graphql":
|
|
7998
|
-
"./pickupPoints.graphql":
|
|
7999
|
-
"./product.graphql":
|
|
8000
|
-
"./productGroup.graphql":
|
|
8001
|
-
"./profile.graphql":
|
|
8002
|
-
"./propertyValue.graphql":
|
|
8003
|
-
"./query.graphql":
|
|
8004
|
-
"./quote.graphql":
|
|
8005
|
-
"./recommendation.graphql":
|
|
8006
|
-
"./review.graphql":
|
|
8007
|
-
"./savedCard.graphql":
|
|
8008
|
-
"./seo.graphql":
|
|
8009
|
-
"./session.graphql":
|
|
8010
|
-
"./shipping.graphql":
|
|
8011
|
-
"./skuVariants.graphql":
|
|
8012
|
-
"./status.graphql":
|
|
8013
|
-
"./userOrder.graphql":
|
|
8014
|
-
}),
|
|
8015
|
-
Object.values(
|
|
8016
|
-
(e, n) =>
|
|
8031
|
+
`, _o = /* @__PURE__ */ Object.assign({
|
|
8032
|
+
"./address.graphql": ja,
|
|
8033
|
+
"./advertisement.graphql": Wa,
|
|
8034
|
+
"./aggregateOffer.graphql": Ha,
|
|
8035
|
+
"./aggregateRating.graphql": Ga,
|
|
8036
|
+
"./author.graphql": Xa,
|
|
8037
|
+
"./brand.graphql": Ya,
|
|
8038
|
+
"./breadcrumb.graphql": Ka,
|
|
8039
|
+
"./cart.graphql": Ja,
|
|
8040
|
+
"./collection.graphql": Qa,
|
|
8041
|
+
"./deliveryPromisesBadge.graphql": Za,
|
|
8042
|
+
"./facet.graphql": eo,
|
|
8043
|
+
"./image.graphql": no,
|
|
8044
|
+
"./mutation.graphql": to,
|
|
8045
|
+
"./newsletter.graphql": ro,
|
|
8046
|
+
"./objectOrString.graphql": io,
|
|
8047
|
+
"./offer.graphql": ao,
|
|
8048
|
+
"./order.graphql": oo,
|
|
8049
|
+
"./orderCommercialAuthorizaton.graphql": so,
|
|
8050
|
+
"./orderEntry.graphql": co,
|
|
8051
|
+
"./organization.graphql": lo,
|
|
8052
|
+
"./pageInfo.graphql": uo,
|
|
8053
|
+
"./password.graphql": po,
|
|
8054
|
+
"./person.graphql": go,
|
|
8055
|
+
"./pickupPoints.graphql": mo,
|
|
8056
|
+
"./product.graphql": ho,
|
|
8057
|
+
"./productGroup.graphql": fo,
|
|
8058
|
+
"./profile.graphql": So,
|
|
8059
|
+
"./propertyValue.graphql": yo,
|
|
8060
|
+
"./query.graphql": Io,
|
|
8061
|
+
"./quote.graphql": vo,
|
|
8062
|
+
"./recommendation.graphql": Oo,
|
|
8063
|
+
"./review.graphql": Co,
|
|
8064
|
+
"./savedCard.graphql": bo,
|
|
8065
|
+
"./seo.graphql": wo,
|
|
8066
|
+
"./session.graphql": Ao,
|
|
8067
|
+
"./shipping.graphql": Po,
|
|
8068
|
+
"./skuVariants.graphql": Do,
|
|
8069
|
+
"./status.graphql": Eo,
|
|
8070
|
+
"./userOrder.graphql": ko
|
|
8071
|
+
}), To = st(
|
|
8072
|
+
Object.values(_o).map((e) => ct(e)).reduce(
|
|
8073
|
+
(e, n) => Sn([e, n], { sort: !0 })
|
|
8017
8074
|
)
|
|
8018
|
-
),
|
|
8019
|
-
channel:
|
|
8075
|
+
), Uo = To, Ko = async (e) => (n) => (n.storage = {
|
|
8076
|
+
channel: oe.parse(e.channel),
|
|
8020
8077
|
flags: e.flags ?? {},
|
|
8021
8078
|
locale: e.locale,
|
|
8022
8079
|
customSortMap: e.customSortMap ?? {},
|
|
8023
8080
|
cookies: /* @__PURE__ */ new Map()
|
|
8024
|
-
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients =
|
|
8025
|
-
function
|
|
8026
|
-
const e =
|
|
8081
|
+
}, n.account = e.account, n.OTEL_ENABLED = e.OTEL_ENABLED, n.discoveryConfig = e.discoveryConfig, n.clients = Ir(e, n), n.loaders = kr(e, n), n);
|
|
8082
|
+
function Ro() {
|
|
8083
|
+
const e = qa(), n = {};
|
|
8027
8084
|
for (const [t, r] of Object.entries(e))
|
|
8028
8085
|
n[t] = Object.fromEntries(
|
|
8029
|
-
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i,
|
|
8086
|
+
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, kt(a, `${t}(${i})`)])
|
|
8030
8087
|
);
|
|
8031
8088
|
return n;
|
|
8032
8089
|
}
|
|
8033
|
-
function
|
|
8034
|
-
const t =
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
])(
|
|
8038
|
-
return e &&
|
|
8090
|
+
function Jo(e) {
|
|
8091
|
+
const t = Et([
|
|
8092
|
+
Dt,
|
|
8093
|
+
wt
|
|
8094
|
+
])(Ro(), Uo);
|
|
8095
|
+
return e && lt(e) ? at({
|
|
8039
8096
|
schemas: [t, e]
|
|
8040
8097
|
}) : t;
|
|
8041
8098
|
}
|
|
8042
8099
|
export {
|
|
8043
|
-
|
|
8100
|
+
wt as AuthDirective,
|
|
8044
8101
|
k as BadRequestError,
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8102
|
+
Dt as CacheControlDirective,
|
|
8103
|
+
mt as CardOrigin,
|
|
8104
|
+
ht as CommercialAuthorizationStatus,
|
|
8105
|
+
Q as FastStoreError,
|
|
8106
|
+
re as ForbiddenError,
|
|
8107
|
+
Ko as GraphqlVtexContextFactory,
|
|
8108
|
+
Jo as GraphqlVtexSchema,
|
|
8109
|
+
B as NotFoundError,
|
|
8110
|
+
ft as StoreCollectionType,
|
|
8111
|
+
St as StoreFacetType,
|
|
8112
|
+
yt as StoreSort,
|
|
8113
|
+
It as StoreStatus,
|
|
8114
|
+
de as UnauthorizedError,
|
|
8115
|
+
vt as UserOrderInvoiceType,
|
|
8116
|
+
z as getAuthCookie,
|
|
8117
|
+
Xo as isBadRequestError,
|
|
8118
|
+
Go as isFastStoreError,
|
|
8119
|
+
_t as isForbiddenError,
|
|
8120
|
+
Y as isNotFoundError,
|
|
8121
|
+
Yo as isUnauthorizedError,
|
|
8122
|
+
Ho as stringifyCacheControl,
|
|
8123
|
+
Uo as typeDefs,
|
|
8124
|
+
Ct as validateUserAuthentication,
|
|
8125
|
+
Et as withDirectives
|
|
8069
8126
|
};
|