@faststore/api 4.3.1-dev.0 → 4.4.0-dev.0
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 +41 -41
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +1705 -1429
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/platforms/vtex/clients/index.d.ts +3 -1
- package/dist/src/platforms/vtex/clients/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/clients/search/index.d.ts +18 -3
- package/dist/src/platforms/vtex/clients/search/index.d.ts.map +1 -1
- package/dist/src/platforms/vtex/loaders/sku.d.ts.map +1 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts +2 -1
- package/dist/src/platforms/vtex/resolvers/query.d.ts.map +1 -1
- package/dist/src/platforms/vtex/utils/intelligentSearchRequest.d.ts +52 -0
- package/dist/src/platforms/vtex/utils/intelligentSearchRequest.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/platforms/vtex/clients/search/index.ts +132 -205
- package/src/platforms/vtex/loaders/sku.ts +3 -4
- package/src/platforms/vtex/resolvers/query.ts +70 -39
- package/src/platforms/vtex/utils/intelligentSearchRequest.ts +642 -0
package/dist/es/index.mjs
CHANGED
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
import { mergeTypeDefs as
|
|
2
|
-
import { makeExecutableSchema as
|
|
3
|
-
import { mapSchema as
|
|
4
|
-
import { OTELAPI as
|
|
5
|
-
import { GraphQLScalarType as
|
|
6
|
-
import { parse as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const
|
|
1
|
+
import { mergeTypeDefs as qe } from "@graphql-tools/merge";
|
|
2
|
+
import { makeExecutableSchema as vn, mergeSchemas as On } from "@graphql-tools/schema";
|
|
3
|
+
import { mapSchema as je, MapperKind as We, getDirective as Ge } from "@graphql-tools/utils";
|
|
4
|
+
import { OTELAPI as N } from "@faststore/diagnostics";
|
|
5
|
+
import { GraphQLScalarType as Cn, print as bn, parse as Dn, isSchema as wn } from "graphql";
|
|
6
|
+
import { parse as H } from "cookie";
|
|
7
|
+
import Pn from "isomorphic-unfetch";
|
|
8
|
+
import ye from "p-limit";
|
|
9
|
+
import te from "dataloader";
|
|
10
|
+
import An from "sanitize-html";
|
|
11
|
+
import Ie from "fast-deep-equal";
|
|
12
|
+
import En from "node:crypto";
|
|
13
|
+
var Un = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(Un || {}), Tn = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))(Tn || {}), kn = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(kn || {}), _n = /* @__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))(_n || {}), Fn = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(Fn || {}), Rn = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(Rn || {});
|
|
14
|
+
const Nn = () => 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
|
+
}, Ln = async (e) => {
|
|
24
24
|
const {
|
|
25
|
-
clients: { commerce:
|
|
26
|
-
} =
|
|
25
|
+
clients: { commerce: n }
|
|
26
|
+
} = e;
|
|
27
27
|
try {
|
|
28
|
-
if ((await
|
|
28
|
+
if ((await n.vtexid.validate())?.authStatus?.toLowerCase() !== "success")
|
|
29
29
|
throw new J("Authentication required");
|
|
30
30
|
} catch (t) {
|
|
31
31
|
const r = t.extensions?.status ?? t.status;
|
|
32
|
-
throw r === 401 ? new J("Authentication required") : r === 403 ? new
|
|
32
|
+
throw r === 401 ? new J("Authentication required") : r === 403 ? new re("You are not allowed to access this resource") : new J("Authentication required");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, Bn = "auth", Mn = {
|
|
35
35
|
typeDefs: "directive @auth on FIELD_DEFINITION",
|
|
36
|
-
transformer: (
|
|
37
|
-
[
|
|
38
|
-
if (
|
|
39
|
-
const r =
|
|
40
|
-
|
|
36
|
+
transformer: (e) => je(e, {
|
|
37
|
+
[We.OBJECT_FIELD]: (n) => {
|
|
38
|
+
if (Ge(e, n, Bn)?.[0]) {
|
|
39
|
+
const r = n.resolve;
|
|
40
|
+
n.resolve = async (i, a, o, s) => (await Ln(o), r?.(i, a, o, s));
|
|
41
41
|
}
|
|
42
|
-
return
|
|
42
|
+
return n;
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
},
|
|
45
|
+
}, $n = "cacheControl", ra = (e, n) => {
|
|
46
46
|
const {
|
|
47
47
|
scope: t = "private",
|
|
48
48
|
sMaxAge: r = 0,
|
|
49
49
|
staleWhileRevalidate: i = 0
|
|
50
|
-
} =
|
|
51
|
-
return `${
|
|
52
|
-
},
|
|
50
|
+
} = e;
|
|
51
|
+
return `${n ? "private" : t}, s-maxage=${r}, stale-while-revalidate=${i}`;
|
|
52
|
+
}, Oe = (e, n) => typeof e == "number" && typeof n == "number" ? e > n ? n : e : typeof e == "number" ? e : n, zn = (e, n) => typeof e == "string" && typeof n == "string" ? e === "public" && n === "public" ? "public" : "private" : e || n, Vn = {
|
|
53
53
|
typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
|
|
54
|
-
transformer: (
|
|
55
|
-
[
|
|
56
|
-
const t =
|
|
54
|
+
transformer: (e) => je(e, {
|
|
55
|
+
[We.OBJECT_FIELD]: (n) => {
|
|
56
|
+
const t = Ge(e, n, $n)?.[0];
|
|
57
57
|
if (t) {
|
|
58
|
-
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t,
|
|
59
|
-
|
|
60
|
-
sMaxAge:
|
|
61
|
-
staleWhileRevalidate:
|
|
58
|
+
const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
|
|
59
|
+
n.resolve = (s, l, d, g) => (d.cacheControl = {
|
|
60
|
+
sMaxAge: Oe(d.cacheControl?.sMaxAge, r),
|
|
61
|
+
staleWhileRevalidate: Oe(
|
|
62
62
|
d.cacheControl?.staleWhileRevalidate,
|
|
63
63
|
i
|
|
64
64
|
),
|
|
65
|
-
scope:
|
|
66
|
-
},
|
|
65
|
+
scope: zn(d.cacheControl?.scope, a)
|
|
66
|
+
}, o?.(s, l, d, g));
|
|
67
67
|
}
|
|
68
|
-
return
|
|
68
|
+
return n;
|
|
69
69
|
}
|
|
70
70
|
})
|
|
71
|
-
},
|
|
72
|
-
const r =
|
|
73
|
-
...(
|
|
71
|
+
}, xn = (e) => (n, t) => {
|
|
72
|
+
const r = qe([
|
|
73
|
+
...(e ?? []).map(({ typeDefs: i }) => i),
|
|
74
74
|
t
|
|
75
75
|
]);
|
|
76
|
-
return (
|
|
76
|
+
return (e ?? []).reduce(
|
|
77
77
|
(i, { transformer: a }) => a?.(i) ?? i,
|
|
78
|
-
|
|
78
|
+
vn({
|
|
79
79
|
typeDefs: r,
|
|
80
|
-
resolvers:
|
|
80
|
+
resolvers: n
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
},
|
|
84
|
-
name:
|
|
85
|
-
version:
|
|
86
|
-
},
|
|
83
|
+
}, oe = "@faststore/api", se = "4.3.1-dev.0", Ce = {
|
|
84
|
+
name: oe,
|
|
85
|
+
version: se
|
|
86
|
+
}, qn = (e, n) => (t, r, i, a) => {
|
|
87
87
|
if ((i?.OTEL?.enabled ?? !1) === !1)
|
|
88
|
-
return
|
|
89
|
-
const
|
|
90
|
-
|
|
88
|
+
return e(t, r, i, a);
|
|
89
|
+
const o = N.trace.getTracer(oe, se), s = N.propagation.extract(
|
|
90
|
+
N.context.active(),
|
|
91
91
|
i.OTEL
|
|
92
92
|
);
|
|
93
|
-
return
|
|
94
|
-
const l =
|
|
93
|
+
return N.context.with(s, () => {
|
|
94
|
+
const l = o.startSpan(n ?? "Unknown Graphql Resolver", {
|
|
95
95
|
startTime: Date.now(),
|
|
96
|
-
kind:
|
|
96
|
+
kind: N.SpanKind.INTERNAL,
|
|
97
97
|
attributes: {
|
|
98
98
|
timestamp: Date.now(),
|
|
99
|
-
"@faststore_version":
|
|
100
|
-
"@faststore_package_name":
|
|
99
|
+
"@faststore_version": se,
|
|
100
|
+
"@faststore_package_name": oe,
|
|
101
101
|
"@faststore_account_name": i.account,
|
|
102
102
|
"@faststore_environment": process.env.NODE_ENV
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
|
-
if (!l) return
|
|
105
|
+
if (!l) return e(t, r, i, a);
|
|
106
106
|
try {
|
|
107
|
-
const d =
|
|
107
|
+
const d = e(t, r, i, a);
|
|
108
108
|
return d instanceof Promise ? d.then((g) => (l.end(), g)) : (l.end(), d);
|
|
109
109
|
} catch (d) {
|
|
110
|
-
throw l.end(), console.error(`Error when executing resolver: ${
|
|
110
|
+
throw l.end(), console.error(`Error when executing resolver: ${n}`, d), d;
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
};
|
|
114
114
|
class X extends Error {
|
|
115
|
-
constructor(
|
|
116
|
-
super(t), this.extensions =
|
|
115
|
+
constructor(n, t) {
|
|
116
|
+
super(t), this.extensions = n, this.name = "FastStoreError";
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
class
|
|
120
|
-
constructor(
|
|
121
|
-
super({ status: 400, type: "BadRequestError" },
|
|
119
|
+
class U extends X {
|
|
120
|
+
constructor(n) {
|
|
121
|
+
super({ status: 400, type: "BadRequestError" }, n);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
class J extends X {
|
|
125
|
-
constructor(
|
|
126
|
-
super({ status: 401, type: "UnauthorizedError" },
|
|
125
|
+
constructor(n) {
|
|
126
|
+
super({ status: 401, type: "UnauthorizedError" }, n);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
class
|
|
130
|
-
constructor(
|
|
131
|
-
super({ status: 403, type: "ForbiddenError" },
|
|
129
|
+
class re extends X {
|
|
130
|
+
constructor(n) {
|
|
131
|
+
super({ status: 403, type: "ForbiddenError" }, n);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
class
|
|
135
|
-
constructor(
|
|
136
|
-
super({ status: 404, type: "NotFoundError" },
|
|
134
|
+
class B extends X {
|
|
135
|
+
constructor(n) {
|
|
136
|
+
super({ status: 404, type: "NotFoundError" }, n);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const
|
|
140
|
-
const r = await
|
|
141
|
-
...
|
|
139
|
+
const ia = (e) => e?.name === "FastStoreError", aa = (e) => e?.extensions?.type === "BadRequestError", oa = (e) => e?.extensions?.type === "UnauthorizedError", jn = (e) => e?.extensions?.type === "ForbiddenError", He = (e) => e?.extensions?.type === "NotFoundError", Wn = `${Ce.name}@${Ce.version}`, y = async (e, n, t) => {
|
|
140
|
+
const r = await Pn(e, {
|
|
141
|
+
...n,
|
|
142
142
|
headers: {
|
|
143
|
-
...
|
|
144
|
-
"User-Agent":
|
|
143
|
+
...n?.headers ?? {},
|
|
144
|
+
"User-Agent": Wn
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
if (r.ok)
|
|
148
148
|
return t?.storeCookies && t.storeCookies(r.headers), r.status !== 204 ? r.json() : void 0;
|
|
149
|
-
console.error(
|
|
149
|
+
console.error(e, n, r);
|
|
150
150
|
const i = await r.text();
|
|
151
151
|
if (typeof r?.status == "number")
|
|
152
152
|
switch (r.status) {
|
|
153
153
|
case 400:
|
|
154
|
-
throw new
|
|
154
|
+
throw new U(i);
|
|
155
155
|
case 401:
|
|
156
156
|
throw new J(i);
|
|
157
157
|
case 403:
|
|
158
|
-
throw new
|
|
158
|
+
throw new re(i);
|
|
159
159
|
case 404:
|
|
160
|
-
throw new
|
|
160
|
+
throw new B(i);
|
|
161
161
|
default:
|
|
162
162
|
throw new X(
|
|
163
163
|
{ status: r.status, type: "UnknownError" },
|
|
@@ -165,340 +165,340 @@ const ki = (n) => n?.name === "FastStoreError", Fi = (n) => n?.extensions?.type
|
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
throw new Error(i);
|
|
168
|
-
},
|
|
169
|
-
if (!
|
|
170
|
-
return
|
|
171
|
-
const
|
|
168
|
+
}, Xe = (e) => {
|
|
169
|
+
if (!e)
|
|
170
|
+
return e;
|
|
171
|
+
const n = /* @__PURE__ */ new Map(), t = e.split(";"), r = [];
|
|
172
172
|
return t.forEach((i) => {
|
|
173
173
|
const a = i.trim();
|
|
174
174
|
if (a) {
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
const s = a.substring(0,
|
|
178
|
-
|
|
175
|
+
const o = a.indexOf("=");
|
|
176
|
+
if (o > 0) {
|
|
177
|
+
const s = a.substring(0, o), l = a.substring(o + 1);
|
|
178
|
+
n.has(s) || r.push(s), n.set(s, l);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
}), r.map((i) => `${i}=${
|
|
182
|
-
},
|
|
183
|
-
const t =
|
|
181
|
+
}), r.map((i) => `${i}=${n.get(i)}`).join("; ");
|
|
182
|
+
}, Gn = /^([^=]+)=([^;]*)/, Hn = (e, n) => {
|
|
183
|
+
const t = n.match(Gn);
|
|
184
184
|
if (t) {
|
|
185
185
|
const r = t[1], i = t[2];
|
|
186
|
-
|
|
186
|
+
e.storage.cookies.set(r, {
|
|
187
187
|
value: i,
|
|
188
|
-
setCookie:
|
|
188
|
+
setCookie: n
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
(t) =>
|
|
191
|
+
}, Xn = (e, n) => {
|
|
192
|
+
n.getSetCookie().forEach(
|
|
193
|
+
(t) => Hn(e, t)
|
|
194
194
|
);
|
|
195
|
-
},
|
|
196
|
-
if (!
|
|
195
|
+
}, Yn = (e) => (n) => Xn(e, n), Ye = (e) => {
|
|
196
|
+
if (!e.headers?.cookie)
|
|
197
197
|
return null;
|
|
198
|
-
const
|
|
199
|
-
return t.length === 0 ?
|
|
200
|
-
(r, [i, { value: a }]) =>
|
|
198
|
+
const n = Xe(e.headers.cookie), t = Array.from(e.storage.cookies.entries());
|
|
199
|
+
return t.length === 0 ? n : t.reduce(
|
|
200
|
+
(r, [i, { value: a }]) => Jn(
|
|
201
201
|
r,
|
|
202
202
|
i,
|
|
203
203
|
a
|
|
204
204
|
),
|
|
205
|
-
|
|
205
|
+
n
|
|
206
206
|
);
|
|
207
|
-
},
|
|
208
|
-
const r =
|
|
207
|
+
}, Je = (e) => function(t) {
|
|
208
|
+
const r = Ye(e);
|
|
209
209
|
return r ? {
|
|
210
210
|
...t,
|
|
211
211
|
cookie: r
|
|
212
212
|
} : t;
|
|
213
|
-
}, Q = (
|
|
214
|
-
const t =
|
|
215
|
-
return
|
|
216
|
-
},
|
|
217
|
-
const r = new RegExp(`(${
|
|
218
|
-
return i ?
|
|
213
|
+
}, Q = (e, n) => {
|
|
214
|
+
const t = Xe(e);
|
|
215
|
+
return H(t)[`VtexIdclientAutCookie_${n}`] || "";
|
|
216
|
+
}, Jn = (e, n, t) => {
|
|
217
|
+
const r = new RegExp(`(${n})=([^;]*)`), i = e.match(r);
|
|
218
|
+
return i ? e.replace(
|
|
219
219
|
i[0],
|
|
220
220
|
`${i[1]}=${t}`
|
|
221
|
-
) : `${
|
|
221
|
+
) : `${e};${n}=${t}`;
|
|
222
222
|
};
|
|
223
|
-
function Z(
|
|
224
|
-
return
|
|
223
|
+
function Z(e) {
|
|
224
|
+
return e ? JSON.parse(Buffer.from(e.split(".")[1], "base64").toString()) : null;
|
|
225
225
|
}
|
|
226
|
-
const
|
|
226
|
+
const j = {
|
|
227
227
|
method: "POST",
|
|
228
228
|
headers: {
|
|
229
229
|
"content-type": "application/json"
|
|
230
230
|
}
|
|
231
|
-
},
|
|
232
|
-
const a = `https://${
|
|
231
|
+
}, Kn = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix: r }, i) => {
|
|
232
|
+
const a = `https://${e}.${n}.com.br`, o = Yn(i), s = Je(i), l = Nn(), d = new Headers(i.headers).get("x-forwarded-host") ?? i.headers?.host ?? "", g = r && r.map((c) => c + ".").find((c) => d.includes(c)) || "", p = d.replace(g, "");
|
|
233
233
|
return {
|
|
234
234
|
catalog: {
|
|
235
|
-
salesChannel: (
|
|
236
|
-
`${a}/api/catalog_system/pub/saleschannel/${
|
|
235
|
+
salesChannel: (c) => y(
|
|
236
|
+
`${a}/api/catalog_system/pub/saleschannel/${c}`,
|
|
237
237
|
void 0,
|
|
238
|
-
{ storeCookies:
|
|
238
|
+
{ storeCookies: o }
|
|
239
239
|
),
|
|
240
240
|
brand: {
|
|
241
|
-
list: () =>
|
|
242
|
-
storeCookies:
|
|
241
|
+
list: () => y(`${a}/api/catalog_system/pub/brand/list`, void 0, {
|
|
242
|
+
storeCookies: o
|
|
243
243
|
})
|
|
244
244
|
},
|
|
245
245
|
category: {
|
|
246
|
-
tree: (
|
|
247
|
-
`${a}/api/catalog_system/pub/category/tree/${
|
|
246
|
+
tree: (c = 3) => y(
|
|
247
|
+
`${a}/api/catalog_system/pub/category/tree/${c}`,
|
|
248
248
|
void 0,
|
|
249
|
-
{ storeCookies:
|
|
249
|
+
{ storeCookies: o }
|
|
250
250
|
)
|
|
251
251
|
},
|
|
252
252
|
portal: {
|
|
253
|
-
pagetype: (
|
|
254
|
-
`${a}/api/catalog_system/pub/portal/pagetype/${
|
|
253
|
+
pagetype: (c) => y(
|
|
254
|
+
`${a}/api/catalog_system/pub/portal/pagetype/${c}`,
|
|
255
255
|
void 0,
|
|
256
|
-
{ storeCookies:
|
|
256
|
+
{ storeCookies: o }
|
|
257
257
|
)
|
|
258
258
|
},
|
|
259
259
|
products: {
|
|
260
260
|
crossselling: ({
|
|
261
|
-
type:
|
|
262
|
-
productId:
|
|
261
|
+
type: c,
|
|
262
|
+
productId: u,
|
|
263
263
|
groupByProduct: m = !0
|
|
264
264
|
}) => {
|
|
265
265
|
const S = new URLSearchParams({
|
|
266
266
|
sc: i.storage.channel.salesChannel,
|
|
267
267
|
groupByProduct: m.toString()
|
|
268
268
|
});
|
|
269
|
-
return
|
|
270
|
-
`${a}/api/catalog_system/pub/products/crossselling/${
|
|
269
|
+
return y(
|
|
270
|
+
`${a}/api/catalog_system/pub/products/crossselling/${c}/${u}?${S}`,
|
|
271
271
|
void 0,
|
|
272
|
-
{ storeCookies:
|
|
272
|
+
{ storeCookies: o }
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
},
|
|
277
277
|
checkout: {
|
|
278
|
-
simulation: (
|
|
278
|
+
simulation: (c, { salesChannel: u } = i.storage.channel) => {
|
|
279
279
|
const m = new URLSearchParams({
|
|
280
|
-
sc:
|
|
280
|
+
sc: u
|
|
281
281
|
}), S = s({
|
|
282
282
|
"content-type": "application/json",
|
|
283
|
-
"X-FORWARDED-HOST":
|
|
283
|
+
"X-FORWARDED-HOST": p
|
|
284
284
|
});
|
|
285
|
-
return
|
|
285
|
+
return y(
|
|
286
286
|
`${a}/api/checkout/pub/orderForms/simulation?${m.toString()}`,
|
|
287
287
|
{
|
|
288
|
-
...
|
|
288
|
+
...j,
|
|
289
289
|
headers: S,
|
|
290
|
-
body: JSON.stringify(
|
|
290
|
+
body: JSON.stringify(c)
|
|
291
291
|
},
|
|
292
|
-
{ storeCookies:
|
|
292
|
+
{ storeCookies: o }
|
|
293
293
|
);
|
|
294
294
|
},
|
|
295
295
|
shippingData: ({
|
|
296
|
-
id:
|
|
297
|
-
index:
|
|
296
|
+
id: c,
|
|
297
|
+
index: u,
|
|
298
298
|
deliveryMode: m,
|
|
299
299
|
selectedAddresses: S
|
|
300
|
-
},
|
|
301
|
-
const
|
|
300
|
+
}, f) => {
|
|
301
|
+
const I = f ? {
|
|
302
302
|
startDateUtc: m?.deliveryWindow?.startDate,
|
|
303
303
|
endDateUtc: m?.deliveryWindow?.endDate
|
|
304
|
-
} : null,
|
|
305
|
-
logisticsInfo: Array.from({ length:
|
|
306
|
-
itemIndex:
|
|
304
|
+
} : null, D = {
|
|
305
|
+
logisticsInfo: Array.from({ length: u }, (w, O) => ({
|
|
306
|
+
itemIndex: O,
|
|
307
307
|
selectedDeliveryChannel: m?.deliveryChannel || null,
|
|
308
308
|
selectedSla: m?.deliveryMethod || null,
|
|
309
|
-
deliveryWindow:
|
|
309
|
+
deliveryWindow: I
|
|
310
310
|
})),
|
|
311
311
|
selectedAddresses: S,
|
|
312
312
|
clearAddressIfPostalCodeNotFound: t
|
|
313
|
-
},
|
|
313
|
+
}, E = s({
|
|
314
314
|
"content-type": "application/json",
|
|
315
|
-
"X-FORWARDED-HOST":
|
|
315
|
+
"X-FORWARDED-HOST": p
|
|
316
316
|
});
|
|
317
|
-
return
|
|
318
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
317
|
+
return y(
|
|
318
|
+
`${a}/api/checkout/pub/orderForm/${c}/attachments/shippingData`,
|
|
319
319
|
{
|
|
320
|
-
...
|
|
321
|
-
headers:
|
|
322
|
-
body: JSON.stringify(
|
|
320
|
+
...j,
|
|
321
|
+
headers: E,
|
|
322
|
+
body: JSON.stringify(D)
|
|
323
323
|
},
|
|
324
|
-
{ storeCookies:
|
|
324
|
+
{ storeCookies: o }
|
|
325
325
|
);
|
|
326
326
|
},
|
|
327
327
|
marketingData: ({
|
|
328
|
-
id:
|
|
329
|
-
marketingData:
|
|
328
|
+
id: c,
|
|
329
|
+
marketingData: u
|
|
330
330
|
}) => {
|
|
331
331
|
const m = s({
|
|
332
332
|
"content-type": "application/json",
|
|
333
|
-
"X-FORWARDED-HOST":
|
|
333
|
+
"X-FORWARDED-HOST": p
|
|
334
334
|
});
|
|
335
|
-
return
|
|
336
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
335
|
+
return y(
|
|
336
|
+
`${a}/api/checkout/pub/orderForm/${c}/attachments/marketingData`,
|
|
337
337
|
{
|
|
338
338
|
headers: m,
|
|
339
|
-
body: JSON.stringify(
|
|
339
|
+
body: JSON.stringify(u),
|
|
340
340
|
method: "POST"
|
|
341
341
|
},
|
|
342
|
-
{ storeCookies:
|
|
342
|
+
{ storeCookies: o }
|
|
343
343
|
);
|
|
344
344
|
},
|
|
345
345
|
clientPreferencesData: ({
|
|
346
|
-
id:
|
|
347
|
-
clientPreferencesData:
|
|
346
|
+
id: c,
|
|
347
|
+
clientPreferencesData: u
|
|
348
348
|
}) => {
|
|
349
349
|
const m = s({
|
|
350
350
|
"content-type": "application/json",
|
|
351
|
-
"X-FORWARDED-HOST":
|
|
351
|
+
"X-FORWARDED-HOST": p
|
|
352
352
|
});
|
|
353
|
-
return
|
|
354
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
353
|
+
return y(
|
|
354
|
+
`${a}/api/checkout/pub/orderForm/${c}/attachments/clientPreferencesData`,
|
|
355
355
|
{
|
|
356
356
|
headers: m,
|
|
357
|
-
body: JSON.stringify(
|
|
357
|
+
body: JSON.stringify(u),
|
|
358
358
|
method: "POST"
|
|
359
359
|
},
|
|
360
|
-
{ storeCookies:
|
|
360
|
+
{ storeCookies: o }
|
|
361
361
|
);
|
|
362
362
|
},
|
|
363
363
|
orderForm: ({
|
|
364
|
-
id:
|
|
365
|
-
refreshOutdatedData:
|
|
364
|
+
id: c,
|
|
365
|
+
refreshOutdatedData: u = !0,
|
|
366
366
|
channel: m = i.storage.channel
|
|
367
367
|
}) => {
|
|
368
|
-
const { salesChannel: S } = m,
|
|
368
|
+
const { salesChannel: S } = m, f = s({
|
|
369
369
|
"content-type": "application/json",
|
|
370
|
-
"X-FORWARDED-HOST":
|
|
371
|
-
}),
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
return
|
|
375
|
-
|
|
370
|
+
"X-FORWARDED-HOST": p
|
|
371
|
+
}), I = new URLSearchParams({ sc: S });
|
|
372
|
+
c && I.set("refreshOutdatedData", u.toString());
|
|
373
|
+
const D = `${a}/api/checkout/pub/orderForm${c ? `/${c}` : ""}?${I.toString()}`;
|
|
374
|
+
return y(
|
|
375
|
+
D,
|
|
376
376
|
{
|
|
377
|
-
...
|
|
378
|
-
headers:
|
|
379
|
-
...
|
|
377
|
+
...j,
|
|
378
|
+
headers: f,
|
|
379
|
+
...c ? {} : { body: "{}" }
|
|
380
380
|
},
|
|
381
|
-
{ storeCookies:
|
|
381
|
+
{ storeCookies: o }
|
|
382
382
|
);
|
|
383
383
|
},
|
|
384
|
-
clearOrderFormMessages: ({ id:
|
|
385
|
-
const
|
|
384
|
+
clearOrderFormMessages: ({ id: c }) => {
|
|
385
|
+
const u = s({
|
|
386
386
|
"content-type": "application/json",
|
|
387
|
-
"X-FORWARDED-HOST":
|
|
387
|
+
"X-FORWARDED-HOST": p
|
|
388
388
|
});
|
|
389
|
-
return
|
|
390
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
389
|
+
return y(
|
|
390
|
+
`${a}/api/checkout/pub/orderForm/${c}/messages/clear`,
|
|
391
391
|
{
|
|
392
|
-
...
|
|
393
|
-
headers:
|
|
392
|
+
...j,
|
|
393
|
+
headers: u,
|
|
394
394
|
body: "{}"
|
|
395
395
|
}
|
|
396
396
|
);
|
|
397
397
|
},
|
|
398
398
|
updateOrderFormItems: ({
|
|
399
|
-
id:
|
|
400
|
-
orderItems:
|
|
399
|
+
id: c,
|
|
400
|
+
orderItems: u,
|
|
401
401
|
allowOutdatedData: m = "paymentData",
|
|
402
402
|
salesChannel: S = i.storage.channel.salesChannel,
|
|
403
|
-
shouldSplitItem:
|
|
403
|
+
shouldSplitItem: f = !0
|
|
404
404
|
}) => {
|
|
405
|
-
const
|
|
405
|
+
const I = new URLSearchParams({
|
|
406
406
|
allowOutdatedData: m,
|
|
407
407
|
sc: S
|
|
408
|
-
}),
|
|
408
|
+
}), D = s({
|
|
409
409
|
"content-type": "application/json",
|
|
410
|
-
"X-FORWARDED-HOST":
|
|
410
|
+
"X-FORWARDED-HOST": p
|
|
411
411
|
});
|
|
412
|
-
return
|
|
413
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
412
|
+
return y(
|
|
413
|
+
`${a}/api/checkout/pub/orderForm/${c}/items?${I}`,
|
|
414
414
|
{
|
|
415
|
-
headers:
|
|
415
|
+
headers: D,
|
|
416
416
|
body: JSON.stringify({
|
|
417
|
-
orderItems:
|
|
418
|
-
noSplitItem: !
|
|
417
|
+
orderItems: u,
|
|
418
|
+
noSplitItem: !f
|
|
419
419
|
}),
|
|
420
420
|
method: "PATCH"
|
|
421
421
|
},
|
|
422
|
-
{ storeCookies:
|
|
422
|
+
{ storeCookies: o }
|
|
423
423
|
);
|
|
424
424
|
},
|
|
425
425
|
setCustomData: ({
|
|
426
|
-
id:
|
|
427
|
-
appId:
|
|
426
|
+
id: c,
|
|
427
|
+
appId: u,
|
|
428
428
|
key: m,
|
|
429
429
|
value: S
|
|
430
430
|
}) => {
|
|
431
|
-
const
|
|
431
|
+
const f = s({
|
|
432
432
|
"content-type": "application/json",
|
|
433
|
-
"X-FORWARDED-HOST":
|
|
433
|
+
"X-FORWARDED-HOST": p
|
|
434
434
|
});
|
|
435
|
-
return
|
|
436
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
435
|
+
return y(
|
|
436
|
+
`${a}/api/checkout/pub/orderForm/${c}/customData/${u}/${m}`,
|
|
437
437
|
{
|
|
438
|
-
headers:
|
|
438
|
+
headers: f,
|
|
439
439
|
body: JSON.stringify({ value: S }),
|
|
440
440
|
method: "PUT"
|
|
441
441
|
}
|
|
442
442
|
);
|
|
443
443
|
},
|
|
444
444
|
region: async ({
|
|
445
|
-
postalCode:
|
|
446
|
-
geoCoordinates:
|
|
445
|
+
postalCode: c,
|
|
446
|
+
geoCoordinates: u,
|
|
447
447
|
country: m,
|
|
448
448
|
salesChannel: S
|
|
449
449
|
}) => {
|
|
450
|
-
const
|
|
450
|
+
const f = new URLSearchParams({
|
|
451
451
|
country: m,
|
|
452
452
|
sc: S ?? ""
|
|
453
453
|
});
|
|
454
|
-
|
|
454
|
+
c ? f.append("postalCode", c) : f.append(
|
|
455
455
|
"geoCoordinates",
|
|
456
|
-
`${
|
|
456
|
+
`${u?.longitude};${u?.latitude}`
|
|
457
457
|
);
|
|
458
|
-
const
|
|
458
|
+
const I = `${a}/api/checkout/pub/regions/?${f.toString()}`, D = s({
|
|
459
459
|
"content-type": "application/json",
|
|
460
|
-
"X-FORWARDED-HOST":
|
|
460
|
+
"X-FORWARDED-HOST": p
|
|
461
461
|
});
|
|
462
|
-
return
|
|
463
|
-
|
|
462
|
+
return y(
|
|
463
|
+
I,
|
|
464
464
|
{
|
|
465
|
-
headers:
|
|
465
|
+
headers: D
|
|
466
466
|
},
|
|
467
|
-
{ storeCookies:
|
|
467
|
+
{ storeCookies: o }
|
|
468
468
|
);
|
|
469
469
|
},
|
|
470
470
|
address: async ({
|
|
471
|
-
postalCode:
|
|
472
|
-
country:
|
|
471
|
+
postalCode: c,
|
|
472
|
+
country: u
|
|
473
473
|
}) => {
|
|
474
474
|
const m = s({
|
|
475
475
|
"content-type": "application/json",
|
|
476
|
-
"X-FORWARDED-HOST":
|
|
476
|
+
"X-FORWARDED-HOST": p
|
|
477
477
|
});
|
|
478
|
-
return
|
|
479
|
-
`${a}/api/checkout/pub/postal-code/${
|
|
478
|
+
return y(
|
|
479
|
+
`${a}/api/checkout/pub/postal-code/${u}/${c}`,
|
|
480
480
|
{
|
|
481
481
|
headers: m
|
|
482
482
|
},
|
|
483
|
-
{ storeCookies:
|
|
483
|
+
{ storeCookies: o }
|
|
484
484
|
);
|
|
485
485
|
},
|
|
486
486
|
cancelOrder: ({
|
|
487
|
-
orderId:
|
|
488
|
-
customerEmail:
|
|
487
|
+
orderId: c,
|
|
488
|
+
customerEmail: u,
|
|
489
489
|
reason: m
|
|
490
490
|
}) => {
|
|
491
491
|
const S = s({
|
|
492
492
|
"content-type": "application/json",
|
|
493
|
-
"X-FORWARDED-HOST":
|
|
493
|
+
"X-FORWARDED-HOST": p
|
|
494
494
|
});
|
|
495
|
-
return
|
|
496
|
-
`${a}/api/checkout/pub/orders/${
|
|
495
|
+
return y(
|
|
496
|
+
`${a}/api/checkout/pub/orders/${c}/user-cancel-request`,
|
|
497
497
|
{
|
|
498
498
|
method: "POST",
|
|
499
499
|
headers: S,
|
|
500
500
|
body: JSON.stringify({
|
|
501
|
-
customerEmail:
|
|
501
|
+
customerEmail: u,
|
|
502
502
|
reason: m
|
|
503
503
|
})
|
|
504
504
|
},
|
|
@@ -506,217 +506,217 @@ const H = {
|
|
|
506
506
|
);
|
|
507
507
|
},
|
|
508
508
|
pickupPoints: ({
|
|
509
|
-
geoCoordinates:
|
|
509
|
+
geoCoordinates: c
|
|
510
510
|
}) => {
|
|
511
|
-
if (!
|
|
511
|
+
if (!c)
|
|
512
512
|
throw new Error(
|
|
513
513
|
"Missing required parameter for listing pickup points."
|
|
514
514
|
);
|
|
515
|
-
const
|
|
515
|
+
const u = s({
|
|
516
516
|
"content-type": "application/json",
|
|
517
|
-
"X-FORWARDED-HOST":
|
|
517
|
+
"X-FORWARDED-HOST": p
|
|
518
518
|
});
|
|
519
|
-
return
|
|
519
|
+
return y(
|
|
520
520
|
`${a}/api/logistics-shipping/pickuppoints/_search`,
|
|
521
521
|
{
|
|
522
522
|
method: "POST",
|
|
523
|
-
headers:
|
|
524
|
-
body: JSON.stringify({ coordinate:
|
|
523
|
+
headers: u,
|
|
524
|
+
body: JSON.stringify({ coordinate: c })
|
|
525
525
|
},
|
|
526
|
-
{ storeCookies:
|
|
526
|
+
{ storeCookies: o }
|
|
527
527
|
);
|
|
528
528
|
}
|
|
529
529
|
},
|
|
530
|
-
session: (
|
|
531
|
-
const
|
|
532
|
-
|
|
530
|
+
session: (c) => {
|
|
531
|
+
const u = new URLSearchParams(c);
|
|
532
|
+
u.set(
|
|
533
533
|
"items",
|
|
534
534
|
"profile.id,profile.email,profile.firstName,profile.lastName,profile.phone,shopper.firstName,shopper.lastName,shopper.organizationManager,store.channel,store.countryCode,store.cultureInfo,store.currencyCode,store.currencySymbol,authentication.customerId,authentication.storeUserId,authentication.storeUserEmail,authentication.unitId,authentication.unitName,checkout.regionId,public.postalCode"
|
|
535
535
|
);
|
|
536
536
|
const m = s({
|
|
537
537
|
"content-type": "application/json"
|
|
538
|
-
}), S =
|
|
539
|
-
return
|
|
540
|
-
`${a}/api/sessions?${
|
|
538
|
+
}), S = H(i?.headers?.cookie ?? "")?.vtex_session;
|
|
539
|
+
return y(
|
|
540
|
+
`${a}/api/sessions?${u.toString()}`,
|
|
541
541
|
{
|
|
542
542
|
method: S ? "PATCH" : "POST",
|
|
543
543
|
headers: m,
|
|
544
544
|
body: "{}"
|
|
545
545
|
},
|
|
546
|
-
{ storeCookies:
|
|
546
|
+
{ storeCookies: o }
|
|
547
547
|
);
|
|
548
548
|
},
|
|
549
|
-
subscribeToNewsletter: (
|
|
549
|
+
subscribeToNewsletter: (c) => y(
|
|
550
550
|
`${a}/api/dataentities/NL/documents/`,
|
|
551
551
|
{
|
|
552
|
-
...
|
|
553
|
-
body: JSON.stringify({ ...
|
|
552
|
+
...j,
|
|
553
|
+
body: JSON.stringify({ ...c, isNewsletterOptIn: !0 }),
|
|
554
554
|
method: "PATCH"
|
|
555
555
|
},
|
|
556
|
-
{ storeCookies:
|
|
556
|
+
{ storeCookies: o }
|
|
557
557
|
),
|
|
558
558
|
profile: {
|
|
559
|
-
addresses: async (
|
|
560
|
-
const
|
|
559
|
+
addresses: async (c) => {
|
|
560
|
+
const u = s({
|
|
561
561
|
"content-type": "application/json",
|
|
562
|
-
"X-FORWARDED-HOST":
|
|
562
|
+
"X-FORWARDED-HOST": p
|
|
563
563
|
});
|
|
564
|
-
return
|
|
565
|
-
`${a}/api/profile-system/pvt/profiles/${
|
|
566
|
-
{ headers:
|
|
567
|
-
{ storeCookies:
|
|
564
|
+
return y(
|
|
565
|
+
`${a}/api/profile-system/pvt/profiles/${c}/addresses`,
|
|
566
|
+
{ headers: u },
|
|
567
|
+
{ storeCookies: o }
|
|
568
568
|
);
|
|
569
569
|
}
|
|
570
570
|
},
|
|
571
571
|
oms: {
|
|
572
|
-
userOrder: ({ orderId:
|
|
573
|
-
const
|
|
572
|
+
userOrder: ({ orderId: c }) => {
|
|
573
|
+
const u = s({
|
|
574
574
|
"content-type": "application/json",
|
|
575
|
-
"X-FORWARDED-HOST":
|
|
575
|
+
"X-FORWARDED-HOST": p
|
|
576
576
|
});
|
|
577
|
-
return
|
|
578
|
-
`${a}/api/oms/user/orders/${
|
|
577
|
+
return y(
|
|
578
|
+
`${a}/api/oms/user/orders/${c}`,
|
|
579
579
|
{
|
|
580
580
|
method: "GET",
|
|
581
|
-
headers:
|
|
581
|
+
headers: u
|
|
582
582
|
},
|
|
583
|
-
{ storeCookies:
|
|
583
|
+
{ storeCookies: o }
|
|
584
584
|
);
|
|
585
585
|
},
|
|
586
586
|
listUserOrders: ({
|
|
587
|
-
page:
|
|
588
|
-
status:
|
|
587
|
+
page: c,
|
|
588
|
+
status: u,
|
|
589
589
|
dateInitial: m,
|
|
590
590
|
dateFinal: S,
|
|
591
|
-
text:
|
|
592
|
-
clientEmail:
|
|
593
|
-
perPage:
|
|
594
|
-
pendingMyApproval:
|
|
591
|
+
text: f,
|
|
592
|
+
clientEmail: I,
|
|
593
|
+
perPage: D,
|
|
594
|
+
pendingMyApproval: E
|
|
595
595
|
}) => {
|
|
596
|
-
const
|
|
596
|
+
const w = new URLSearchParams();
|
|
597
597
|
if (m) {
|
|
598
|
-
const
|
|
598
|
+
const P = new Date(m).setHours(
|
|
599
599
|
0,
|
|
600
600
|
0,
|
|
601
601
|
0,
|
|
602
602
|
0
|
|
603
603
|
);
|
|
604
|
-
m = new Date(
|
|
604
|
+
m = new Date(P).toISOString();
|
|
605
605
|
}
|
|
606
606
|
if (S) {
|
|
607
|
-
const
|
|
607
|
+
const P = new Date(S).setHours(
|
|
608
608
|
23,
|
|
609
609
|
59,
|
|
610
610
|
59,
|
|
611
611
|
999
|
|
612
612
|
);
|
|
613
|
-
S = new Date(
|
|
613
|
+
S = new Date(P).toISOString();
|
|
614
614
|
}
|
|
615
|
-
|
|
615
|
+
f && w.append("text", f), u && u.length > 0 && w.append("status", u.filter(Boolean).join(",")), m && S ? w.append(
|
|
616
616
|
"creation_date",
|
|
617
617
|
`creationDate:[${m} TO ${S}]`
|
|
618
|
-
) : m ?
|
|
619
|
-
const
|
|
618
|
+
) : m ? w.append("creation_date", `creationDate:[${m} TO *]`) : S && w.append("creation_date", `creationDate:[* TO ${S}]`), I && w.append("clientEmail", I), c && w.append("page", c.toString()), D && w.append("per_page", D.toString()), E && w.append("my_pending_approvals", String(!0));
|
|
619
|
+
const O = s({
|
|
620
620
|
"content-type": "application/json",
|
|
621
|
-
"X-FORWARDED-HOST":
|
|
621
|
+
"X-FORWARDED-HOST": p
|
|
622
622
|
});
|
|
623
|
-
return
|
|
624
|
-
`${a}/api/oms/user/orders?${
|
|
623
|
+
return y(
|
|
624
|
+
`${a}/api/oms/user/orders?${w.toString()}`,
|
|
625
625
|
{
|
|
626
626
|
method: "GET",
|
|
627
|
-
headers:
|
|
627
|
+
headers: O
|
|
628
628
|
},
|
|
629
|
-
{ storeCookies:
|
|
629
|
+
{ storeCookies: o }
|
|
630
630
|
);
|
|
631
631
|
},
|
|
632
632
|
getCommercialAuthorizationsByOrderId: ({
|
|
633
|
-
orderId:
|
|
633
|
+
orderId: c
|
|
634
634
|
}) => {
|
|
635
|
-
const
|
|
635
|
+
const u = s({
|
|
636
636
|
"content-type": "application/json",
|
|
637
|
-
"X-FORWARDED-HOST":
|
|
637
|
+
"X-FORWARDED-HOST": p
|
|
638
638
|
});
|
|
639
|
-
return
|
|
640
|
-
`${a}/${
|
|
639
|
+
return y(
|
|
640
|
+
`${a}/${e}/commercial-authorizations/order/${c}`,
|
|
641
641
|
{
|
|
642
642
|
method: "GET",
|
|
643
|
-
headers:
|
|
643
|
+
headers: u
|
|
644
644
|
},
|
|
645
|
-
{ storeCookies:
|
|
645
|
+
{ storeCookies: o }
|
|
646
646
|
);
|
|
647
647
|
},
|
|
648
648
|
processOrderAuthorization: async ({
|
|
649
|
-
orderAuthorizationId:
|
|
650
|
-
dimensionId:
|
|
649
|
+
orderAuthorizationId: c,
|
|
650
|
+
dimensionId: u,
|
|
651
651
|
ruleId: m,
|
|
652
652
|
approved: S
|
|
653
653
|
}) => {
|
|
654
|
-
const
|
|
654
|
+
const f = s({
|
|
655
655
|
"content-type": "application/json",
|
|
656
|
-
"X-FORWARDED-HOST":
|
|
657
|
-
}),
|
|
656
|
+
"X-FORWARDED-HOST": p
|
|
657
|
+
}), E = {
|
|
658
658
|
params: {
|
|
659
659
|
ruleId: m,
|
|
660
|
-
dimensionId:
|
|
660
|
+
dimensionId: u,
|
|
661
661
|
score: S ? 100 : 0
|
|
662
662
|
}
|
|
663
663
|
};
|
|
664
|
-
return
|
|
665
|
-
`${a}/${
|
|
664
|
+
return y(
|
|
665
|
+
`${a}/${e}/commercial-authorizations/${c}/callback`,
|
|
666
666
|
{
|
|
667
667
|
method: "POST",
|
|
668
|
-
headers:
|
|
669
|
-
body: JSON.stringify(
|
|
668
|
+
headers: f,
|
|
669
|
+
body: JSON.stringify(E)
|
|
670
670
|
},
|
|
671
|
-
{ storeCookies:
|
|
671
|
+
{ storeCookies: o }
|
|
672
672
|
);
|
|
673
673
|
}
|
|
674
674
|
},
|
|
675
675
|
units: {
|
|
676
676
|
getUnitByUserId: ({
|
|
677
|
-
userId:
|
|
677
|
+
userId: c
|
|
678
678
|
}) => {
|
|
679
|
-
const
|
|
679
|
+
const u = s({
|
|
680
680
|
"content-type": "application/json",
|
|
681
|
-
"X-FORWARDED-HOST":
|
|
681
|
+
"X-FORWARDED-HOST": p
|
|
682
682
|
});
|
|
683
|
-
return
|
|
684
|
-
`${a}/api/units/v1/${
|
|
683
|
+
return y(
|
|
684
|
+
`${a}/api/units/v1/${c}/unit`,
|
|
685
685
|
{
|
|
686
686
|
method: "GET",
|
|
687
|
-
headers:
|
|
687
|
+
headers: u
|
|
688
688
|
},
|
|
689
689
|
{}
|
|
690
690
|
);
|
|
691
691
|
},
|
|
692
692
|
getOrgUnitById: ({
|
|
693
|
-
orgUnitId:
|
|
693
|
+
orgUnitId: c
|
|
694
694
|
}) => {
|
|
695
|
-
const
|
|
695
|
+
const u = s({
|
|
696
696
|
"content-type": "application/json",
|
|
697
|
-
"X-FORWARDED-HOST":
|
|
697
|
+
"X-FORWARDED-HOST": p
|
|
698
698
|
});
|
|
699
|
-
return
|
|
700
|
-
`${a}/api/units/v1/${
|
|
699
|
+
return y(
|
|
700
|
+
`${a}/api/units/v1/${c}`,
|
|
701
701
|
{
|
|
702
702
|
method: "GET",
|
|
703
|
-
headers:
|
|
703
|
+
headers: u
|
|
704
704
|
},
|
|
705
705
|
{}
|
|
706
706
|
);
|
|
707
707
|
},
|
|
708
708
|
getScopesByOrgUnit: ({
|
|
709
|
-
orgUnitId:
|
|
709
|
+
orgUnitId: c
|
|
710
710
|
}) => {
|
|
711
|
-
const
|
|
711
|
+
const u = s({
|
|
712
712
|
"content-type": "application/json",
|
|
713
|
-
"X-FORWARDED-HOST":
|
|
713
|
+
"X-FORWARDED-HOST": p
|
|
714
714
|
});
|
|
715
|
-
return
|
|
716
|
-
`${a}/api/units/v1/${
|
|
715
|
+
return y(
|
|
716
|
+
`${a}/api/units/v1/${c}/scopes`,
|
|
717
717
|
{
|
|
718
718
|
method: "GET",
|
|
719
|
-
headers:
|
|
719
|
+
headers: u
|
|
720
720
|
},
|
|
721
721
|
{}
|
|
722
722
|
);
|
|
@@ -724,49 +724,49 @@ const H = {
|
|
|
724
724
|
},
|
|
725
725
|
licenseManager: {
|
|
726
726
|
getUserById: ({
|
|
727
|
-
userId:
|
|
727
|
+
userId: c
|
|
728
728
|
}) => {
|
|
729
|
-
const
|
|
729
|
+
const u = s({
|
|
730
730
|
"content-type": "application/json",
|
|
731
|
-
"X-FORWARDED-HOST":
|
|
731
|
+
"X-FORWARDED-HOST": p
|
|
732
732
|
});
|
|
733
|
-
return
|
|
734
|
-
`${a}/api/license-manager/users/${
|
|
733
|
+
return y(
|
|
734
|
+
`${a}/api/license-manager/users/${c}`,
|
|
735
735
|
{
|
|
736
736
|
method: "GET",
|
|
737
|
-
headers:
|
|
737
|
+
headers: u
|
|
738
738
|
},
|
|
739
739
|
{}
|
|
740
740
|
);
|
|
741
741
|
},
|
|
742
742
|
getUserByEmail: ({
|
|
743
|
-
email:
|
|
743
|
+
email: c
|
|
744
744
|
}) => {
|
|
745
|
-
const
|
|
745
|
+
const u = s({
|
|
746
746
|
"content-type": "application/json",
|
|
747
|
-
"X-FORWARDED-HOST":
|
|
747
|
+
"X-FORWARDED-HOST": p
|
|
748
748
|
});
|
|
749
|
-
return
|
|
750
|
-
`${a}/api/license-manager/pvt/users/${
|
|
749
|
+
return y(
|
|
750
|
+
`${a}/api/license-manager/pvt/users/${c}`,
|
|
751
751
|
{
|
|
752
752
|
method: "GET",
|
|
753
|
-
headers:
|
|
753
|
+
headers: u
|
|
754
754
|
},
|
|
755
755
|
{}
|
|
756
756
|
);
|
|
757
757
|
},
|
|
758
758
|
getUserRoles: ({
|
|
759
|
-
userId:
|
|
759
|
+
userId: c
|
|
760
760
|
}) => {
|
|
761
|
-
const
|
|
761
|
+
const u = s({
|
|
762
762
|
"content-type": "application/json",
|
|
763
|
-
"X-FORWARDED-HOST":
|
|
763
|
+
"X-FORWARDED-HOST": p
|
|
764
764
|
});
|
|
765
|
-
return
|
|
766
|
-
`${a}/api/license-manager/storefront/users/${
|
|
765
|
+
return y(
|
|
766
|
+
`${a}/api/license-manager/storefront/users/${c}/roles`,
|
|
767
767
|
{
|
|
768
768
|
method: "GET",
|
|
769
|
-
headers:
|
|
769
|
+
headers: u
|
|
770
770
|
},
|
|
771
771
|
{}
|
|
772
772
|
);
|
|
@@ -774,39 +774,39 @@ const H = {
|
|
|
774
774
|
},
|
|
775
775
|
masterData: {
|
|
776
776
|
getContractById: ({
|
|
777
|
-
contractId:
|
|
777
|
+
contractId: c
|
|
778
778
|
}) => {
|
|
779
|
-
if (!
|
|
780
|
-
throw new
|
|
781
|
-
const
|
|
779
|
+
if (!c)
|
|
780
|
+
throw new U("Missing contractId to fetch CL fields.");
|
|
781
|
+
const u = l({
|
|
782
782
|
Accept: "application/json",
|
|
783
783
|
"content-type": "application/json",
|
|
784
|
-
"X-FORWARDED-HOST":
|
|
784
|
+
"X-FORWARDED-HOST": p
|
|
785
785
|
});
|
|
786
|
-
return
|
|
787
|
-
`${a}/api/dataentities/CL/documents/${
|
|
786
|
+
return y(
|
|
787
|
+
`${a}/api/dataentities/CL/documents/${c}?_fields=_all`,
|
|
788
788
|
{
|
|
789
789
|
method: "GET",
|
|
790
|
-
headers:
|
|
790
|
+
headers: u
|
|
791
791
|
},
|
|
792
792
|
{}
|
|
793
793
|
);
|
|
794
794
|
},
|
|
795
795
|
getShopperById: ({
|
|
796
|
-
userId:
|
|
796
|
+
userId: c
|
|
797
797
|
}) => {
|
|
798
|
-
if (!
|
|
799
|
-
throw new
|
|
800
|
-
const
|
|
798
|
+
if (!c)
|
|
799
|
+
throw new U("Missing userId to fetch shopper name.");
|
|
800
|
+
const u = l({
|
|
801
801
|
Accept: "application/json",
|
|
802
802
|
"content-type": "application/json",
|
|
803
|
-
"X-FORWARDED-HOST":
|
|
804
|
-
}), m =
|
|
805
|
-
return
|
|
806
|
-
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${
|
|
803
|
+
"X-FORWARDED-HOST": p
|
|
804
|
+
}), m = c.replace(/-/g, "");
|
|
805
|
+
return y(
|
|
806
|
+
`${a}/api/dataentities/shopper/search?_where=(userId=${m} OR userId=${c})&_fields=_all&_schema=v1`,
|
|
807
807
|
{
|
|
808
808
|
method: "GET",
|
|
809
|
-
headers:
|
|
809
|
+
headers: u
|
|
810
810
|
},
|
|
811
811
|
{}
|
|
812
812
|
);
|
|
@@ -814,48 +814,48 @@ const H = {
|
|
|
814
814
|
},
|
|
815
815
|
vtexid: {
|
|
816
816
|
validate: () => {
|
|
817
|
-
const
|
|
817
|
+
const c = s({
|
|
818
818
|
"content-type": "application/json",
|
|
819
|
-
"X-FORWARDED-HOST":
|
|
820
|
-
}),
|
|
821
|
-
return
|
|
819
|
+
"X-FORWARDED-HOST": p
|
|
820
|
+
}), u = Q(Ye(i) ?? "", e);
|
|
821
|
+
return y(
|
|
822
822
|
`${a}/api/vtexid/credential/validate`,
|
|
823
823
|
{
|
|
824
|
-
headers:
|
|
825
|
-
body: JSON.stringify({ token:
|
|
824
|
+
headers: c,
|
|
825
|
+
body: JSON.stringify({ token: u }),
|
|
826
826
|
method: "POST"
|
|
827
827
|
},
|
|
828
|
-
{ storeCookies:
|
|
828
|
+
{ storeCookies: o }
|
|
829
829
|
);
|
|
830
830
|
}
|
|
831
831
|
},
|
|
832
832
|
orderEntry: {
|
|
833
833
|
uploadFile: ({
|
|
834
|
-
fileBuffer:
|
|
835
|
-
fileName:
|
|
834
|
+
fileBuffer: c,
|
|
835
|
+
fileName: u,
|
|
836
836
|
mimeType: m
|
|
837
837
|
}) => {
|
|
838
838
|
const S = s({
|
|
839
839
|
"content-type": "application/json",
|
|
840
|
-
"X-FORWARDED-HOST":
|
|
841
|
-
}),
|
|
842
|
-
`,
|
|
843
|
-
`--${
|
|
844
|
-
`Content-Disposition: form-data; name="file"; filename="${
|
|
845
|
-
`Content-Type: ${
|
|
840
|
+
"X-FORWARDED-HOST": p
|
|
841
|
+
}), f = `----FastStoreUploadBoundary${Date.now()}`, I = `\r
|
|
842
|
+
`, E = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", w = u.replaceAll(/[\r\n"]/g, "_"), O = [
|
|
843
|
+
`--${f}`,
|
|
844
|
+
`Content-Disposition: form-data; name="file"; filename="${w}"`,
|
|
845
|
+
`Content-Type: ${E}`,
|
|
846
846
|
"",
|
|
847
847
|
""
|
|
848
|
-
].join(
|
|
849
|
-
h.byteLength +
|
|
848
|
+
].join(I), P = `${I}--${f}--${I}`, h = Buffer.from(O), b = Buffer.from(P), C = new Uint8Array(
|
|
849
|
+
h.byteLength + c.byteLength + b.byteLength
|
|
850
850
|
);
|
|
851
|
-
let
|
|
852
|
-
return C.set(h,
|
|
853
|
-
`${a}/api/order-entry/upload?an=${
|
|
851
|
+
let A = 0;
|
|
852
|
+
return C.set(h, A), A += h.byteLength, C.set(c, A), A += c.byteLength, C.set(b, A), y(
|
|
853
|
+
`${a}/api/order-entry/upload?an=${e}`,
|
|
854
854
|
{
|
|
855
855
|
method: "POST",
|
|
856
856
|
headers: {
|
|
857
857
|
...S,
|
|
858
|
-
"content-type": `multipart/form-data; boundary=${
|
|
858
|
+
"content-type": `multipart/form-data; boundary=${f}`
|
|
859
859
|
},
|
|
860
860
|
body: C.buffer
|
|
861
861
|
},
|
|
@@ -863,362 +863,622 @@ const H = {
|
|
|
863
863
|
);
|
|
864
864
|
},
|
|
865
865
|
startOperation: ({
|
|
866
|
-
objectKey:
|
|
867
|
-
orderFormId:
|
|
866
|
+
objectKey: c,
|
|
867
|
+
orderFormId: u,
|
|
868
868
|
sessionToken: m
|
|
869
869
|
}) => {
|
|
870
870
|
const S = s({
|
|
871
871
|
"content-type": "application/json",
|
|
872
|
-
"X-FORWARDED-HOST":
|
|
873
|
-
}),
|
|
874
|
-
objectKey:
|
|
875
|
-
orderFormId:
|
|
872
|
+
"X-FORWARDED-HOST": p
|
|
873
|
+
}), f = JSON.stringify({
|
|
874
|
+
objectKey: c,
|
|
875
|
+
orderFormId: u,
|
|
876
876
|
operation: "CreateCart",
|
|
877
877
|
...m ? { sessionToken: m } : {}
|
|
878
878
|
});
|
|
879
|
-
return
|
|
880
|
-
`${a}/api/order-entry/operation?an=${
|
|
879
|
+
return y(
|
|
880
|
+
`${a}/api/order-entry/operation?an=${e}`,
|
|
881
881
|
{
|
|
882
882
|
method: "POST",
|
|
883
883
|
headers: S,
|
|
884
|
-
body:
|
|
884
|
+
body: f
|
|
885
885
|
},
|
|
886
886
|
{}
|
|
887
887
|
);
|
|
888
888
|
},
|
|
889
889
|
getOperation: ({
|
|
890
|
-
operationId:
|
|
890
|
+
operationId: c
|
|
891
891
|
}) => {
|
|
892
|
-
const
|
|
892
|
+
const u = s({
|
|
893
893
|
"content-type": "application/json",
|
|
894
|
-
"X-FORWARDED-HOST":
|
|
894
|
+
"X-FORWARDED-HOST": p
|
|
895
895
|
});
|
|
896
|
-
return
|
|
897
|
-
`${a}/api/order-entry/operation/${
|
|
896
|
+
return y(
|
|
897
|
+
`${a}/api/order-entry/operation/${c}?an=${e}`,
|
|
898
898
|
{
|
|
899
899
|
method: "GET",
|
|
900
|
-
headers:
|
|
900
|
+
headers: u
|
|
901
901
|
},
|
|
902
902
|
{}
|
|
903
903
|
);
|
|
904
904
|
},
|
|
905
905
|
createOrderForm: () => {
|
|
906
|
-
const
|
|
906
|
+
const c = s({
|
|
907
907
|
"content-type": "application/json",
|
|
908
|
-
"X-FORWARDED-HOST":
|
|
908
|
+
"X-FORWARDED-HOST": p
|
|
909
909
|
});
|
|
910
|
-
return
|
|
910
|
+
return y(
|
|
911
911
|
`${a}/api/checkout/pub/orderForm?sc=${i.storage.channel.salesChannel}`,
|
|
912
912
|
{
|
|
913
913
|
method: "POST",
|
|
914
|
-
headers:
|
|
914
|
+
headers: c,
|
|
915
915
|
body: "{}"
|
|
916
916
|
},
|
|
917
917
|
{}
|
|
918
918
|
);
|
|
919
919
|
},
|
|
920
920
|
getOrderFormItems: ({
|
|
921
|
-
orderFormId:
|
|
921
|
+
orderFormId: c
|
|
922
922
|
}) => {
|
|
923
|
-
const
|
|
923
|
+
const u = s({
|
|
924
924
|
"content-type": "application/json",
|
|
925
|
-
"X-FORWARDED-HOST":
|
|
925
|
+
"X-FORWARDED-HOST": p
|
|
926
926
|
});
|
|
927
|
-
return
|
|
928
|
-
`${a}/api/checkout/pub/orderForm/${
|
|
927
|
+
return y(
|
|
928
|
+
`${a}/api/checkout/pub/orderForm/${c}`,
|
|
929
929
|
{
|
|
930
930
|
method: "GET",
|
|
931
|
-
headers:
|
|
931
|
+
headers: u
|
|
932
932
|
},
|
|
933
933
|
{}
|
|
934
934
|
);
|
|
935
935
|
}
|
|
936
936
|
}
|
|
937
937
|
};
|
|
938
|
-
},
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
938
|
+
}, ce = "fuzzy", le = "operator", de = "pickupPoint", be = "shipping", De = "delivery-options", Qn = "in-stock", Zn = "trade-policy", et = "region-id", nt = /* @__PURE__ */ new Set([
|
|
939
|
+
Zn,
|
|
940
|
+
et,
|
|
941
|
+
ce,
|
|
942
|
+
le,
|
|
943
|
+
de
|
|
944
|
+
]), tt = /* @__PURE__ */ new Set([
|
|
945
|
+
"zip-code",
|
|
946
|
+
"pickupPoint",
|
|
947
|
+
"country",
|
|
948
|
+
"coordinates",
|
|
949
|
+
"deliveryZonesHash",
|
|
950
|
+
"pickupPointsHash"
|
|
951
|
+
]), rt = /* @__PURE__ */ new Set(["productClusterIds"]), we = (e) => encodeURI(decodeURI(e)), it = (e) => encodeURIComponent(
|
|
952
|
+
decodeURIComponent(e).normalize("NFD").replaceAll(/[\u0300-\u036f]/g, "")
|
|
953
|
+
), at = /^pickup-in-point-(.+)$/;
|
|
954
|
+
function Ke(e) {
|
|
955
|
+
if (!e)
|
|
956
|
+
return {};
|
|
957
|
+
try {
|
|
958
|
+
const t = H(e).vtex_segment;
|
|
959
|
+
if (!t)
|
|
960
|
+
return {};
|
|
961
|
+
const r = Buffer.from(t, "base64").toString("utf-8");
|
|
962
|
+
return JSON.parse(r);
|
|
963
|
+
} catch {
|
|
964
|
+
return {};
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
function ot(e) {
|
|
968
|
+
const n = {}, t = {}, r = [];
|
|
969
|
+
for (const i of e.split(";")) {
|
|
970
|
+
const a = i.indexOf("=");
|
|
971
|
+
if (a < 0) continue;
|
|
972
|
+
const o = i.slice(0, a), s = i.slice(a + 1);
|
|
973
|
+
!o || !s || (tt.has(o) ? n[o] = s : rt.has(o) ? t[o] = s : r.push({ key: o, value: s }));
|
|
974
|
+
}
|
|
975
|
+
return { shipping: n, queryParams: t, extraFacets: r };
|
|
976
|
+
}
|
|
977
|
+
function st(e) {
|
|
978
|
+
const n = typeof e.facets == "string" ? e.facets : "", { shipping: t, queryParams: r, extraFacets: i } = ot(n);
|
|
979
|
+
return {
|
|
980
|
+
segmentParams: {
|
|
981
|
+
sc: e.channel,
|
|
982
|
+
regionId: e.regionId,
|
|
983
|
+
country: e.countryCode ?? t.country,
|
|
984
|
+
locale: e.cultureInfo,
|
|
985
|
+
"zip-code": t["zip-code"],
|
|
986
|
+
coordinates: t.coordinates,
|
|
987
|
+
pickupPoint: t.pickupPoint,
|
|
988
|
+
deliveryZonesHash: t.deliveryZonesHash,
|
|
989
|
+
pickupPointHash: t.pickupPointsHash,
|
|
990
|
+
utmSource: e.utm_source ?? void 0,
|
|
991
|
+
utmCampaign: e.utm_campaign ?? void 0,
|
|
992
|
+
utmiCampaign: e.utmi_campaign ?? void 0,
|
|
993
|
+
campaigns: typeof e.campaigns == "string" ? e.campaigns : void 0,
|
|
994
|
+
priceTables: e.priceTables ?? void 0,
|
|
995
|
+
productClusterIds: r.productClusterIds
|
|
996
|
+
},
|
|
997
|
+
extraFacets: i
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
function Qe(e, n) {
|
|
1001
|
+
const t = [
|
|
1002
|
+
["sc", n.sc],
|
|
1003
|
+
["regionId", n.regionId],
|
|
1004
|
+
["country", n.country],
|
|
1005
|
+
["locale", n.locale],
|
|
1006
|
+
["zip-code", n["zip-code"]],
|
|
1007
|
+
["coordinates", n.coordinates],
|
|
1008
|
+
["pickupPoint", n.pickupPoint],
|
|
1009
|
+
["deliveryZonesHash", n.deliveryZonesHash],
|
|
1010
|
+
["pickupPointHash", n.pickupPointHash],
|
|
1011
|
+
["utmSource", n.utmSource],
|
|
1012
|
+
["utmCampaign", n.utmCampaign],
|
|
1013
|
+
["utmiCampaign", n.utmiCampaign],
|
|
1014
|
+
["campaigns", n.campaigns],
|
|
1015
|
+
["priceTables", n.priceTables],
|
|
1016
|
+
["productClusterId", n.productClusterIds]
|
|
1017
|
+
];
|
|
1018
|
+
for (const [r, i] of t)
|
|
1019
|
+
i != null && i !== "" && e.append(r, String(i));
|
|
1020
|
+
}
|
|
1021
|
+
function Ze(e) {
|
|
1022
|
+
return at.exec(e)?.[1];
|
|
1023
|
+
}
|
|
1024
|
+
function ct(e) {
|
|
1025
|
+
const n = e.find((r) => r.key === "shipping"), t = n ? Ze(n.value) : void 0;
|
|
1026
|
+
if (t !== void 0)
|
|
1027
|
+
try {
|
|
1028
|
+
return decodeURIComponent(t);
|
|
1029
|
+
} catch {
|
|
1030
|
+
return t;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
function lt(e, n) {
|
|
1034
|
+
const t = ct(
|
|
1035
|
+
n
|
|
1036
|
+
);
|
|
1037
|
+
return t === void 0 ? e : {
|
|
1038
|
+
...e,
|
|
1039
|
+
pickupPoint: t
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
function dt(e) {
|
|
1043
|
+
return e.map((n) => n.key !== "shipping" || Ze(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
|
|
1044
|
+
}
|
|
1045
|
+
function ut(e, n) {
|
|
1046
|
+
let t = [...e];
|
|
1047
|
+
const r = t.some((i) => i.key === "shipping");
|
|
1048
|
+
for (const i of n)
|
|
1049
|
+
(!r || i.key !== "shipping") && t.push(i);
|
|
1050
|
+
return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), dt(t);
|
|
1051
|
+
}
|
|
1052
|
+
function pt(e) {
|
|
1053
|
+
return e.reduce((n, t) => {
|
|
1054
|
+
let { key: r, value: i } = t;
|
|
1055
|
+
return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${we(r)}/${it(we(i)).replaceAll(/ |%20/g, "-")}/`;
|
|
1056
|
+
}, "");
|
|
1057
|
+
}
|
|
1058
|
+
const gt = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), mt = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
|
|
1059
|
+
function ht(e, n) {
|
|
1060
|
+
const { segmentParams: t, extraFacets: r } = st(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
|
|
1061
|
+
return {
|
|
1062
|
+
segmentParams: {
|
|
1063
|
+
...t,
|
|
1064
|
+
...i ? { sc: i } : {},
|
|
1065
|
+
...a ? { regionId: a } : {},
|
|
1066
|
+
locale: o
|
|
1067
|
+
},
|
|
1068
|
+
extraFacets: r
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
function ft(e, n) {
|
|
1072
|
+
const t = e.filter(({ key: l }) => !nt.has(l)), r = e.find(
|
|
1073
|
+
({ key: l, value: d }) => l === be && d !== "all-delivery-methods"
|
|
1074
|
+
) ?? null, i = e.find(
|
|
1075
|
+
({ key: l, value: d }) => l === De && d !== "all-delivery-options"
|
|
1076
|
+
) ?? null, a = [...t], o = a.some(
|
|
1077
|
+
({ key: l }) => l === be
|
|
1078
|
+
), s = a.some(
|
|
1079
|
+
({ key: l }) => l === De
|
|
1080
|
+
);
|
|
1081
|
+
return r !== null && !o && a.push(r), i !== null && !s && a.push(i), ut(a, n);
|
|
1082
|
+
}
|
|
1083
|
+
function St(e, n) {
|
|
1084
|
+
const t = e.find(({ key: a }) => a === ce) ?? null, r = e.find(({ key: a }) => a === le) ?? null, i = e.find(({ key: a }) => a === de) ?? null;
|
|
1085
|
+
t && gt(t) && n.append(ce, t.value), r && mt(r) && n.append(le, r.value), i && n.append(de, i.value);
|
|
1086
|
+
}
|
|
1087
|
+
function Pe(e, n, t, r) {
|
|
1088
|
+
const {
|
|
1089
|
+
query: i = "",
|
|
1090
|
+
page: a,
|
|
1091
|
+
count: o,
|
|
1092
|
+
sort: s,
|
|
1093
|
+
selectedFacets: l = [],
|
|
1094
|
+
showInvisibleItems: d,
|
|
1095
|
+
sponsoredCount: g,
|
|
1096
|
+
hideUnavailableItems: p,
|
|
1097
|
+
allowRedirect: c = !1
|
|
1098
|
+
} = e, u = new URLSearchParams();
|
|
1099
|
+
if (r.includePagination && a !== void 0 && o !== void 0) {
|
|
1100
|
+
const f = a * o, I = o === 0 ? f : f + o - 1;
|
|
1101
|
+
u.append("from", f.toString()), u.append("to", I.toString());
|
|
1102
|
+
}
|
|
1103
|
+
i && u.append("query", i), r.includeSort && s && u.append("sort", s);
|
|
1104
|
+
const m = lt(
|
|
1105
|
+
t.segmentParams,
|
|
1106
|
+
l
|
|
1107
|
+
);
|
|
1108
|
+
if (Qe(u, m ?? t.segmentParams), St(l, u), d && u.append("show-invisible-items", "true"), n?.hideUnavailableItems !== void 0) {
|
|
1109
|
+
const f = l.find(({ key: D }) => D === Qn), I = f ? f.value : p?.toString() ?? n.hideUnavailableItems.toString();
|
|
1110
|
+
u.append("hideUnavailableItems", I);
|
|
1111
|
+
}
|
|
1112
|
+
n?.simulationBehavior !== void 0 && u.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && u.append("showSponsored", n.showSponsored.toString()), g !== void 0 && u.append("sponsoredCount", g.toString()), c !== void 0 && u.append("allowRedirect", c.toString());
|
|
1113
|
+
const S = pt(
|
|
1114
|
+
ft(l, t.extraFacets)
|
|
1115
|
+
);
|
|
1116
|
+
return { params: u, path: S };
|
|
1117
|
+
}
|
|
1118
|
+
function yt(e, n) {
|
|
1119
|
+
const { field: t, value: r, hideUnavailableItems: i, showInvisibleItems: a } = e, o = new URLSearchParams({
|
|
1120
|
+
field: t ?? "",
|
|
1121
|
+
value: r ?? ""
|
|
1122
|
+
});
|
|
1123
|
+
return Qe(o, n), i && o.append("hideUnavailableItems", "true"), a && o.append("show-invisible-items", "true"), o;
|
|
1124
|
+
}
|
|
1125
|
+
function W(e, n) {
|
|
1126
|
+
return {
|
|
1127
|
+
path: e,
|
|
1128
|
+
params: n,
|
|
1129
|
+
toString() {
|
|
1130
|
+
const t = n.toString();
|
|
1131
|
+
return e ? t ? `${e}?${t}` : e : t ? `?${t}` : "";
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
function G(e) {
|
|
1136
|
+
const { endpoint: n, segment: t, defaults: r, args: i = {} } = e, a = ht(t, r);
|
|
1137
|
+
switch (n) {
|
|
1138
|
+
case "product-search":
|
|
1139
|
+
case "facets": {
|
|
1140
|
+
const { params: o, path: s } = Pe(
|
|
1141
|
+
i,
|
|
1142
|
+
r,
|
|
1143
|
+
a,
|
|
1144
|
+
{ includePagination: !0, includeSort: !0 }
|
|
1145
|
+
);
|
|
1146
|
+
return W(s, o);
|
|
1147
|
+
}
|
|
1148
|
+
case "catalog-count": {
|
|
1149
|
+
const { params: o, path: s } = Pe(
|
|
1150
|
+
i,
|
|
1151
|
+
r,
|
|
1152
|
+
a,
|
|
1153
|
+
{ includePagination: !1, includeSort: !1 }
|
|
1154
|
+
);
|
|
1155
|
+
return W(s, o);
|
|
1156
|
+
}
|
|
1157
|
+
case "products": {
|
|
1158
|
+
const o = yt(i, a.segmentParams);
|
|
1159
|
+
return W("", o);
|
|
1160
|
+
}
|
|
1161
|
+
case "search-suggestions": {
|
|
1162
|
+
const o = new URLSearchParams({
|
|
1163
|
+
query: i.query?.toString() ?? "",
|
|
1164
|
+
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1165
|
+
});
|
|
1166
|
+
return W("", o);
|
|
1167
|
+
}
|
|
1168
|
+
case "top-searches": {
|
|
1169
|
+
const o = new URLSearchParams({
|
|
1170
|
+
locale: r?.locale ?? a.segmentParams.locale ?? ""
|
|
1171
|
+
});
|
|
1172
|
+
return W("", o);
|
|
1173
|
+
}
|
|
1174
|
+
default: {
|
|
1175
|
+
const o = n;
|
|
1176
|
+
throw new Error(`Unknown intelligent-search endpoint: ${o}`);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
const It = 10;
|
|
1181
|
+
function vt(e) {
|
|
1182
|
+
const { regionId: n, seller: t } = e.storage.channel;
|
|
1183
|
+
return (t ? Buffer.from(`SW#${t}`).toString("base64") : void 0) ?? (n || void 0);
|
|
1184
|
+
}
|
|
1185
|
+
function Ot(e) {
|
|
1186
|
+
return Ke(e.headers?.cookie).cultureInfo ?? e.storage.locale;
|
|
1187
|
+
}
|
|
1188
|
+
const Ct = ({
|
|
1189
|
+
account: e,
|
|
1190
|
+
environment: n,
|
|
950
1191
|
hideUnavailableItems: t,
|
|
951
1192
|
simulationBehavior: r,
|
|
952
1193
|
showSponsored: i,
|
|
953
1194
|
subDomainPrefix: a
|
|
954
|
-
},
|
|
955
|
-
const s = `https://${
|
|
1195
|
+
}, o) => {
|
|
1196
|
+
const s = `https://${e}.${n}.com.br`, l = Je(o), d = Ke(o.headers?.cookie), g = () => ({
|
|
1197
|
+
salesChannel: o.storage.channel.salesChannel,
|
|
1198
|
+
regionId: vt(o),
|
|
1199
|
+
locale: Ot(o),
|
|
1200
|
+
hideUnavailableItems: t,
|
|
1201
|
+
simulationBehavior: r,
|
|
1202
|
+
showSponsored: i
|
|
1203
|
+
}), p = new Headers(o.headers).get("x-forwarded-host") ?? o.headers?.host ?? "", c = a && a.map((h) => h + ".").find((h) => p.includes(h)) || "", u = p.replace(c, ""), m = l({
|
|
956
1204
|
"content-type": "application/json",
|
|
957
1205
|
"X-FORWARDED-HOST": u
|
|
958
|
-
}),
|
|
959
|
-
const
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
({ key: T, value: F }) => T === Xn && F !== "all-delivery-methods"
|
|
975
|
-
) ?? null, D = h.find(
|
|
976
|
-
({ key: T, value: F }) => T === Yn && F !== "all-delivery-options"
|
|
977
|
-
) ?? null, y = h.find(({ key: T }) => T === dn) ?? p(), A = h.find(({ key: T }) => T === un) ?? m();
|
|
978
|
-
return C !== null && v.push(C), D !== null && v.push(D), y !== null && v.push(y), A !== null && v.push(A), v;
|
|
979
|
-
}, I = (h, v) => {
|
|
980
|
-
const C = h.find(({ key: A }) => A === pn) ?? null, D = h.find(({ key: A }) => A === gn) ?? null, y = h.find(({ key: A }) => A === mn) ?? null;
|
|
981
|
-
C && Ye(C) && v.append(pn, C.value), D && Je(D) && v.append(gn, D.value), y && v.append(mn, y.value);
|
|
982
|
-
}, O = ({
|
|
983
|
-
query: h = "",
|
|
984
|
-
page: v,
|
|
985
|
-
count: C,
|
|
986
|
-
sort: D = "",
|
|
987
|
-
selectedFacets: y = [],
|
|
988
|
-
type: A,
|
|
989
|
-
showInvisibleItems: T,
|
|
990
|
-
sponsoredCount: F,
|
|
991
|
-
hideUnavailableItems: U,
|
|
992
|
-
allowRedirect: G = !1
|
|
1206
|
+
}), S = ({ type: h, ...b }) => {
|
|
1207
|
+
const C = h === "facets" ? "facets" : "product-search", A = G({
|
|
1208
|
+
endpoint: C,
|
|
1209
|
+
segment: d,
|
|
1210
|
+
defaults: g(),
|
|
1211
|
+
args: b
|
|
1212
|
+
});
|
|
1213
|
+
return y(
|
|
1214
|
+
`${s}/api/intelligent-search/v1/${C}/${A.path}?${A.params.toString()}`,
|
|
1215
|
+
{ headers: m }
|
|
1216
|
+
);
|
|
1217
|
+
}, f = (h) => S({ ...h, type: "product_search" }), I = ({
|
|
1218
|
+
field: h,
|
|
1219
|
+
value: b,
|
|
1220
|
+
hideUnavailableItems: C,
|
|
1221
|
+
showInvisibleItems: A
|
|
993
1222
|
}) => {
|
|
994
|
-
const
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1223
|
+
const v = G({
|
|
1224
|
+
endpoint: "products",
|
|
1225
|
+
segment: d,
|
|
1226
|
+
defaults: g(),
|
|
1227
|
+
args: {
|
|
1228
|
+
field: h,
|
|
1229
|
+
value: b,
|
|
1230
|
+
hideUnavailableItems: C,
|
|
1231
|
+
showInvisibleItems: A
|
|
1232
|
+
}
|
|
1000
1233
|
});
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
), on = x ? x.value : U?.toString() ?? t.toString();
|
|
1005
|
-
N.append("hideUnavailableItems", on);
|
|
1006
|
-
}
|
|
1007
|
-
r !== void 0 && N.append("simulationBehavior", r.toString()), i !== void 0 && N.append("showSponsored", i.toString()), F !== void 0 && N.append("sponsoredCount", F.toString()), G !== void 0 && N.append("allowRedirect", G.toString());
|
|
1008
|
-
const $ = S(y).map(({ key: x, value: on }) => `${x}/${on}`).join("/");
|
|
1009
|
-
return f(
|
|
1010
|
-
`${s}/_v/api/intelligent-search/${A}/${$}?${N.toString()}`,
|
|
1011
|
-
{ headers: o }
|
|
1234
|
+
return y(
|
|
1235
|
+
`${s}/api/intelligent-search/v1/products?${v.params.toString()}`,
|
|
1236
|
+
{ headers: m }
|
|
1012
1237
|
);
|
|
1013
1238
|
};
|
|
1014
1239
|
return {
|
|
1015
|
-
facets: (h) =>
|
|
1016
|
-
products:
|
|
1240
|
+
facets: (h) => S({ ...h, type: "facets" }),
|
|
1241
|
+
products: f,
|
|
1242
|
+
fetchProduct: I,
|
|
1243
|
+
productsByIdentifier: async ({
|
|
1244
|
+
field: h,
|
|
1245
|
+
values: b,
|
|
1246
|
+
showInvisibleItems: C,
|
|
1247
|
+
hideUnavailableItems: A
|
|
1248
|
+
}) => {
|
|
1249
|
+
const v = ye(It);
|
|
1250
|
+
return (await Promise.all(
|
|
1251
|
+
b.map(
|
|
1252
|
+
(_) => v(async () => {
|
|
1253
|
+
try {
|
|
1254
|
+
return await I({
|
|
1255
|
+
field: h,
|
|
1256
|
+
value: _,
|
|
1257
|
+
hideUnavailableItems: A,
|
|
1258
|
+
showInvisibleItems: C
|
|
1259
|
+
});
|
|
1260
|
+
} catch {
|
|
1261
|
+
return null;
|
|
1262
|
+
}
|
|
1263
|
+
})
|
|
1264
|
+
)
|
|
1265
|
+
)).filter(
|
|
1266
|
+
(_) => _ !== null
|
|
1267
|
+
);
|
|
1268
|
+
},
|
|
1017
1269
|
suggestedTerms: (h) => {
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1020
|
-
|
|
1270
|
+
const b = G({
|
|
1271
|
+
endpoint: "search-suggestions",
|
|
1272
|
+
segment: d,
|
|
1273
|
+
defaults: g(),
|
|
1274
|
+
args: { query: h.query }
|
|
1021
1275
|
});
|
|
1022
|
-
return
|
|
1023
|
-
`${s}/
|
|
1024
|
-
{ headers:
|
|
1276
|
+
return y(
|
|
1277
|
+
`${s}/api/intelligent-search/v1/search-suggestions?${b.params.toString()}`,
|
|
1278
|
+
{ headers: m }
|
|
1025
1279
|
);
|
|
1026
1280
|
},
|
|
1027
1281
|
topSearches: () => {
|
|
1028
|
-
const h =
|
|
1029
|
-
|
|
1282
|
+
const h = G({
|
|
1283
|
+
endpoint: "top-searches",
|
|
1284
|
+
segment: d,
|
|
1285
|
+
defaults: g()
|
|
1030
1286
|
});
|
|
1031
|
-
return
|
|
1032
|
-
`${s}/
|
|
1033
|
-
{ headers:
|
|
1287
|
+
return y(
|
|
1288
|
+
`${s}/api/intelligent-search/v1/top-searches?${h.params.toString()}`,
|
|
1289
|
+
{ headers: m }
|
|
1034
1290
|
);
|
|
1035
1291
|
},
|
|
1036
1292
|
productCount: (h) => {
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1293
|
+
const b = G({
|
|
1294
|
+
endpoint: "catalog-count",
|
|
1295
|
+
segment: d,
|
|
1296
|
+
defaults: g(),
|
|
1297
|
+
args: h
|
|
1298
|
+
});
|
|
1299
|
+
return y(
|
|
1300
|
+
`${s}/api/intelligent-search/v1/catalog-count/${b.path}?${b.params.toString()}`,
|
|
1301
|
+
{ headers: m }
|
|
1041
1302
|
);
|
|
1042
1303
|
}
|
|
1043
1304
|
};
|
|
1044
|
-
},
|
|
1045
|
-
const t =
|
|
1305
|
+
}, bt = (e, n) => {
|
|
1306
|
+
const t = Ct(e, n), r = Kn(e, n);
|
|
1046
1307
|
return {
|
|
1047
1308
|
search: t,
|
|
1048
1309
|
commerce: r
|
|
1049
1310
|
};
|
|
1050
|
-
},
|
|
1311
|
+
}, Dt = 20, wt = /* @__PURE__ */ new Set([
|
|
1051
1312
|
"brand",
|
|
1052
1313
|
"category",
|
|
1053
1314
|
"department",
|
|
1054
1315
|
"subcategory",
|
|
1055
1316
|
"collection",
|
|
1056
1317
|
"cluster"
|
|
1057
|
-
]),
|
|
1058
|
-
const t =
|
|
1318
|
+
]), z = (e) => typeof e.pageType == "string" && wt.has(e.pageType.toLowerCase()), Pt = (e, n) => {
|
|
1319
|
+
const t = ye(Dt), r = async (i) => Promise.all(
|
|
1059
1320
|
i.map(
|
|
1060
1321
|
(a) => t(async () => {
|
|
1061
|
-
const
|
|
1062
|
-
if (
|
|
1063
|
-
return
|
|
1064
|
-
throw new
|
|
1065
|
-
`Catalog returned ${
|
|
1322
|
+
const o = await n.commerce.catalog.portal.pagetype(a);
|
|
1323
|
+
if (z(o))
|
|
1324
|
+
return o;
|
|
1325
|
+
throw new B(
|
|
1326
|
+
`Catalog returned ${o.pageType} for slug: ${a}. This usually happens when there is more than one category with the same name in the same category tree level.`
|
|
1066
1327
|
);
|
|
1067
1328
|
})
|
|
1068
1329
|
)
|
|
1069
1330
|
);
|
|
1070
|
-
return new
|
|
1331
|
+
return new te(r, {
|
|
1071
1332
|
// DataLoader is being used to cache requests, not to batch them
|
|
1072
1333
|
batch: !1
|
|
1073
1334
|
});
|
|
1074
|
-
},
|
|
1075
|
-
const t = async (r) => Promise.all(r.map((i) =>
|
|
1076
|
-
return new
|
|
1077
|
-
},
|
|
1078
|
-
const t =
|
|
1079
|
-
const
|
|
1335
|
+
}, At = (e, n) => {
|
|
1336
|
+
const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
|
|
1337
|
+
return new te(t);
|
|
1338
|
+
}, Et = 1, Ut = (e, n) => {
|
|
1339
|
+
const t = ye(Et), r = async (a) => {
|
|
1340
|
+
const o = a.reduce((p, { items: c }) => [...p, c], []), s = [...o.flat()], l = await n.commerce.checkout.simulation({
|
|
1080
1341
|
country: a[0].country,
|
|
1081
1342
|
postalCode: a[0].postalCode,
|
|
1082
1343
|
items: s
|
|
1083
1344
|
}), d = l.items.reduce(
|
|
1084
|
-
(
|
|
1085
|
-
const
|
|
1086
|
-
return typeof
|
|
1345
|
+
(p, c) => {
|
|
1346
|
+
const u = c.requestIndex;
|
|
1347
|
+
return typeof u == "number" && u < p.length && (p[u] = c), p;
|
|
1087
1348
|
},
|
|
1088
1349
|
Array(s.length).fill(null)
|
|
1089
|
-
), g =
|
|
1090
|
-
(
|
|
1350
|
+
), g = o.reduce(
|
|
1351
|
+
(p, c) => [...p, c.length + p[p.length - 1]],
|
|
1091
1352
|
[0]
|
|
1092
1353
|
);
|
|
1093
|
-
return
|
|
1354
|
+
return o.map((p, c) => ({
|
|
1094
1355
|
...l,
|
|
1095
|
-
items: d.slice(g[
|
|
1356
|
+
items: d.slice(g[c], g[c + 1]).filter((u) => !!u)
|
|
1096
1357
|
}));
|
|
1097
1358
|
}, i = async (a) => t(r, a);
|
|
1098
|
-
return new
|
|
1359
|
+
return new te(i, {
|
|
1099
1360
|
maxBatchSize: 50
|
|
1100
1361
|
});
|
|
1101
|
-
},
|
|
1102
|
-
function
|
|
1362
|
+
}, Tt = (e, n) => An(e, n);
|
|
1363
|
+
function kt(e) {
|
|
1103
1364
|
return {
|
|
1104
|
-
...
|
|
1105
|
-
description:
|
|
1365
|
+
...e,
|
|
1366
|
+
description: e.description ? Tt(e.description) : e.description
|
|
1106
1367
|
};
|
|
1107
1368
|
}
|
|
1108
|
-
const
|
|
1109
|
-
...
|
|
1110
|
-
isVariantOf:
|
|
1111
|
-
}),
|
|
1369
|
+
const L = (e, n) => ({
|
|
1370
|
+
...e,
|
|
1371
|
+
isVariantOf: kt(n)
|
|
1372
|
+
}), _t = ({ flags: e }, n) => {
|
|
1112
1373
|
const t = async (r) => {
|
|
1113
1374
|
const i = r.map((g) => g.split("-")[0]), a = r.some(
|
|
1114
1375
|
(g) => g.split("-")[1] === "invisibleItems"
|
|
1115
|
-
),
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
count: i.length,
|
|
1376
|
+
), s = (await n.search.productsByIdentifier({
|
|
1377
|
+
field: "sku",
|
|
1378
|
+
values: i,
|
|
1119
1379
|
showInvisibleItems: a,
|
|
1120
|
-
...
|
|
1380
|
+
...e?.enableUnavailableItemsOnCart && {
|
|
1121
1381
|
hideUnavailableItems: !1
|
|
1122
1382
|
}
|
|
1123
|
-
})
|
|
1124
|
-
(g,
|
|
1125
|
-
for (const
|
|
1126
|
-
g[
|
|
1383
|
+
})).reduce(
|
|
1384
|
+
(g, p) => {
|
|
1385
|
+
for (const c of p.items)
|
|
1386
|
+
g[c.itemId] = L(c, p);
|
|
1127
1387
|
return g;
|
|
1128
1388
|
},
|
|
1129
1389
|
{}
|
|
1130
1390
|
), l = i.map((g) => s[g]), d = i.filter((g) => !s[g]);
|
|
1131
1391
|
if (d.length > 0)
|
|
1132
|
-
throw new
|
|
1392
|
+
throw new B(
|
|
1133
1393
|
`Search API did not found the following skus: ${d.join(",")}`
|
|
1134
1394
|
);
|
|
1135
1395
|
return l;
|
|
1136
1396
|
};
|
|
1137
|
-
return new
|
|
1397
|
+
return new te(t, {
|
|
1138
1398
|
maxBatchSize: 99
|
|
1139
1399
|
// Max allowed batch size of Search API
|
|
1140
1400
|
});
|
|
1141
|
-
},
|
|
1142
|
-
const t =
|
|
1401
|
+
}, Ft = (e, { clients: n }) => {
|
|
1402
|
+
const t = _t(e, n), r = Ut(e, n), i = Pt(e, n), a = At(e, n);
|
|
1143
1403
|
return {
|
|
1144
1404
|
skuLoader: t,
|
|
1145
1405
|
simulationLoader: r,
|
|
1146
1406
|
collectionLoader: i,
|
|
1147
1407
|
salesChannelLoader: a
|
|
1148
1408
|
};
|
|
1149
|
-
},
|
|
1150
|
-
const r =
|
|
1151
|
-
return Math.round((
|
|
1152
|
-
},
|
|
1153
|
-
const t =
|
|
1154
|
-
return
|
|
1155
|
-
},
|
|
1156
|
-
const [t] =
|
|
1157
|
-
return
|
|
1158
|
-
},
|
|
1159
|
-
highPrice: (
|
|
1160
|
-
lowPrice: (
|
|
1161
|
-
lowPriceWithTaxes: (
|
|
1162
|
-
offerCount: (
|
|
1163
|
-
priceCurrency: async (
|
|
1409
|
+
}, M = (e) => e.AvailableQuantity > 0, V = (e) => e.spotPrice ?? 0, Rt = (e) => e.Price ?? 0, Ae = (e) => e ? "https://schema.org/InStock" : "https://schema.org/OutOfStock", en = (e, n) => M(e) && !M(n) ? -1 : !M(e) && M(n) ? 1 : V(e) - V(n), Nt = (e) => e === "available", $ = (e, n = 0, t = 1) => {
|
|
1410
|
+
const r = n / t;
|
|
1411
|
+
return Math.round((e + r) * 100) / 100;
|
|
1412
|
+
}, Lt = (e, n = { includeTaxes: !1 }) => {
|
|
1413
|
+
const t = e.filter(M), r = t[t.length - 1], i = r ? V(r) : 0;
|
|
1414
|
+
return n.includeTaxes ? $(i, r?.Tax, r?.product?.unitMultiplier) : i;
|
|
1415
|
+
}, Ee = (e, n = { includeTaxes: !1 }) => {
|
|
1416
|
+
const [t] = e.filter(M), r = t ? V(t) : 0;
|
|
1417
|
+
return n.includeTaxes ? $(r, t?.Tax, t?.product?.unitMultiplier) : r;
|
|
1418
|
+
}, Bt = {
|
|
1419
|
+
highPrice: (e) => Lt(e),
|
|
1420
|
+
lowPrice: (e) => Ee(e),
|
|
1421
|
+
lowPriceWithTaxes: (e) => Ee(e, { includeTaxes: !0 }),
|
|
1422
|
+
offerCount: (e) => e.length,
|
|
1423
|
+
priceCurrency: async (e, n, t) => {
|
|
1164
1424
|
const {
|
|
1165
1425
|
loaders: { salesChannelLoader: r },
|
|
1166
1426
|
storage: { channel: i }
|
|
1167
1427
|
} = t;
|
|
1168
1428
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1169
1429
|
},
|
|
1170
|
-
offers: (
|
|
1171
|
-
},
|
|
1430
|
+
offers: (e) => e
|
|
1431
|
+
}, Mt = {
|
|
1172
1432
|
ratingValue: () => 5,
|
|
1173
1433
|
reviewCount: () => 0
|
|
1174
|
-
},
|
|
1175
|
-
let
|
|
1176
|
-
for (let t = 0; t <
|
|
1177
|
-
|
|
1178
|
-
return
|
|
1179
|
-
},
|
|
1180
|
-
function
|
|
1181
|
-
const t =
|
|
1182
|
-
return
|
|
1183
|
-
}
|
|
1184
|
-
const K = (
|
|
1185
|
-
id: ({ id:
|
|
1186
|
-
slug: (
|
|
1187
|
-
seo: (
|
|
1188
|
-
title:
|
|
1189
|
-
description:
|
|
1434
|
+
}, Ue = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a", $t = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa", zt = (e) => {
|
|
1435
|
+
let n = e.slice(0);
|
|
1436
|
+
for (let t = 0; t < Ue.length; t++)
|
|
1437
|
+
n = n.replace(new RegExp(Ue.charAt(t), "g"), $t.charAt(t));
|
|
1438
|
+
return n;
|
|
1439
|
+
}, Vt = (e) => e.replace(/[·/_,:]/, "-");
|
|
1440
|
+
function nn(e) {
|
|
1441
|
+
const t = e.replace(/,/g, "").replace(/[*+~.()'"!:@&\[\]`/ %$#?{}><=_^]/g, "-");
|
|
1442
|
+
return Vt(zt(t)).toLowerCase();
|
|
1443
|
+
}
|
|
1444
|
+
const K = (e) => e.type === "brand" || z(e) && e.pageType.toLowerCase() === "brand", ue = (e) => z(e) && e.pageType.toLowerCase() === "collection", ae = (e) => K(e) || ue(e) ? nn(e.name) : z(e) ? new URL(`https://${e.url}`).pathname.slice(1).toLowerCase() : new URL(e.url).pathname.slice(1).toLowerCase(), tn = {
|
|
1445
|
+
id: ({ id: e }) => e.toString(),
|
|
1446
|
+
slug: (e) => ae(e),
|
|
1447
|
+
seo: (e) => K(e) || z(e) ? {
|
|
1448
|
+
title: e.title ?? e.name,
|
|
1449
|
+
description: e.metaTagDescription
|
|
1190
1450
|
} : {
|
|
1191
|
-
title:
|
|
1192
|
-
description:
|
|
1451
|
+
title: e.Title,
|
|
1452
|
+
description: e.MetaTagDescription
|
|
1193
1453
|
},
|
|
1194
|
-
type: (
|
|
1195
|
-
meta: (
|
|
1196
|
-
const
|
|
1197
|
-
return K(
|
|
1198
|
-
selectedFacets: [{ key: "brand", value:
|
|
1199
|
-
} :
|
|
1200
|
-
selectedFacets: [{ key: "productclusterids", value:
|
|
1454
|
+
type: (e) => K(e) ? "Brand" : z(e) ? e.pageType : e.level === 0 ? "Department" : "Category",
|
|
1455
|
+
meta: (e) => {
|
|
1456
|
+
const n = ae(e);
|
|
1457
|
+
return K(e) ? {
|
|
1458
|
+
selectedFacets: [{ key: "brand", value: n }]
|
|
1459
|
+
} : ue(e) ? {
|
|
1460
|
+
selectedFacets: [{ key: "productclusterids", value: e.id }]
|
|
1201
1461
|
} : {
|
|
1202
|
-
selectedFacets:
|
|
1462
|
+
selectedFacets: n.split("/").map((t, r) => ({
|
|
1203
1463
|
key: `category-${r + 1}`,
|
|
1204
1464
|
value: t
|
|
1205
1465
|
}))
|
|
1206
1466
|
};
|
|
1207
1467
|
},
|
|
1208
|
-
breadcrumbList: async (
|
|
1468
|
+
breadcrumbList: async (e, n, t) => {
|
|
1209
1469
|
const {
|
|
1210
1470
|
loaders: { collectionLoader: r }
|
|
1211
|
-
} = t, a =
|
|
1471
|
+
} = t, a = ae(e).split("/").filter((l) => !!l), o = a.map(
|
|
1212
1472
|
(l, d) => a.slice(0, d + 1).join("/")
|
|
1213
1473
|
), s = await Promise.all(
|
|
1214
|
-
|
|
1474
|
+
o.map(async (l) => {
|
|
1215
1475
|
const d = await r.load(l);
|
|
1216
1476
|
return { slug: l, ...d };
|
|
1217
1477
|
})
|
|
1218
1478
|
);
|
|
1219
1479
|
return {
|
|
1220
1480
|
itemListElement: s.map((l, d) => ({
|
|
1221
|
-
item:
|
|
1481
|
+
item: ue(l) ? `/${l.slug}` : new URL(
|
|
1222
1482
|
`https://${l.url}`
|
|
1223
1483
|
).pathname.toLowerCase(),
|
|
1224
1484
|
name: l.name,
|
|
@@ -1227,17 +1487,17 @@ const K = (n) => n.type === "brand" || j(n) && n.pageType.toLowerCase() === "bra
|
|
|
1227
1487
|
numberOfItems: s.length
|
|
1228
1488
|
};
|
|
1229
1489
|
}
|
|
1230
|
-
},
|
|
1490
|
+
}, rn = {
|
|
1231
1491
|
buy: "whoboughtalsobought",
|
|
1232
1492
|
view: "whosawalsosaw",
|
|
1233
1493
|
similars: "similars",
|
|
1234
1494
|
viewAndBought: "whosawalsobought",
|
|
1235
1495
|
accessories: "accessories",
|
|
1236
1496
|
suggestions: "suggestions"
|
|
1237
|
-
},
|
|
1238
|
-
switch (
|
|
1497
|
+
}, Te = ({ key: e, value: n }) => {
|
|
1498
|
+
switch (e) {
|
|
1239
1499
|
case "price":
|
|
1240
|
-
return { key:
|
|
1500
|
+
return { key: e, value: n.replace("-to-", ":") };
|
|
1241
1501
|
case "channel":
|
|
1242
1502
|
case "locale":
|
|
1243
1503
|
case "buy":
|
|
@@ -1248,124 +1508,124 @@ const K = (n) => n.type === "brand" || j(n) && n.pageType.toLowerCase() === "bra
|
|
|
1248
1508
|
case "suggestions":
|
|
1249
1509
|
return [];
|
|
1250
1510
|
default:
|
|
1251
|
-
return { key:
|
|
1511
|
+
return { key: e, value: n };
|
|
1252
1512
|
}
|
|
1253
|
-
},
|
|
1254
|
-
const
|
|
1255
|
-
return
|
|
1256
|
-
},
|
|
1257
|
-
const
|
|
1258
|
-
(t) =>
|
|
1513
|
+
}, ke = (e) => {
|
|
1514
|
+
const n = e.split(":").map(Number);
|
|
1515
|
+
return n.length !== 2 || Number.isNaN(n[0]) || Number.isNaN(n[1]) ? null : n;
|
|
1516
|
+
}, xt = (e) => typeof rn[e] == "string", qt = (e) => {
|
|
1517
|
+
const n = e?.filter(
|
|
1518
|
+
(t) => xt(t.key)
|
|
1259
1519
|
);
|
|
1260
|
-
if (Array.isArray(
|
|
1261
|
-
throw new
|
|
1262
|
-
`You passed ${
|
|
1520
|
+
if (Array.isArray(n) && n.length > 1)
|
|
1521
|
+
throw new U(
|
|
1522
|
+
`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(",")}`
|
|
1263
1523
|
);
|
|
1264
|
-
return
|
|
1265
|
-
},
|
|
1524
|
+
return n?.[0] ?? null;
|
|
1525
|
+
}, jt = (e) => e?.find((n) => n.key === "slug")?.value ?? null, Wt = (e) => e?.find((n) => n.key === "id")?.value ?? null, _e = (e) => e?.find((n) => n.key === "locale")?.value ?? null, Fe = (e) => e?.find((n) => n.key === "channel")?.value ?? null, pe = (e, n) => {
|
|
1266
1526
|
let t = 0;
|
|
1267
|
-
for (let r = 1; r <
|
|
1268
|
-
e
|
|
1269
|
-
return
|
|
1270
|
-
},
|
|
1271
|
-
__resolveType: ({ type:
|
|
1272
|
-
},
|
|
1273
|
-
key: ({ key:
|
|
1274
|
-
label: ({ name:
|
|
1275
|
-
values: ({ values:
|
|
1276
|
-
},
|
|
1277
|
-
key: ({ key:
|
|
1278
|
-
label: ({ name:
|
|
1279
|
-
min: ({ values:
|
|
1280
|
-
const i =
|
|
1281
|
-
r?.selectedFacets?.find((s) => s.key ===
|
|
1282
|
-
),
|
|
1527
|
+
for (let r = 1; r < e.length; r++)
|
|
1528
|
+
n(e[t], e[r]) > 0 && (t = r);
|
|
1529
|
+
return e[t];
|
|
1530
|
+
}, Gt = {
|
|
1531
|
+
__resolveType: ({ type: e, values: n }) => e !== "TEXT" && e !== "DELIVERY" ? "StoreFacetRange" : !n || n.length === 0 ? "StoreFacetBoolean" : n.every((t) => t.range) ? "StoreFacetRange" : "StoreFacetBoolean"
|
|
1532
|
+
}, Ht = {
|
|
1533
|
+
key: ({ key: e }) => e,
|
|
1534
|
+
label: ({ name: e }) => e,
|
|
1535
|
+
values: ({ values: e }) => e.sort((n, t) => n.name.localeCompare(t.name))
|
|
1536
|
+
}, Xt = {
|
|
1537
|
+
key: ({ key: e }) => e,
|
|
1538
|
+
label: ({ name: e }) => e,
|
|
1539
|
+
min: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1540
|
+
const i = ke(
|
|
1541
|
+
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1542
|
+
), o = pe(e, (s, l) => s.range.from - l.range.from)?.range?.from ?? 0;
|
|
1283
1543
|
return {
|
|
1284
|
-
selected: i?.[0] ??
|
|
1285
|
-
absolute:
|
|
1544
|
+
selected: i?.[0] ?? o,
|
|
1545
|
+
absolute: o
|
|
1286
1546
|
};
|
|
1287
1547
|
},
|
|
1288
|
-
max: ({ values:
|
|
1289
|
-
const i =
|
|
1290
|
-
r?.selectedFacets?.find((s) => s.key ===
|
|
1291
|
-
),
|
|
1548
|
+
max: ({ values: e, key: n }, t, { storage: { searchArgs: r } }) => {
|
|
1549
|
+
const i = ke(
|
|
1550
|
+
r?.selectedFacets?.find((s) => s.key === n)?.value ?? ""
|
|
1551
|
+
), o = pe(e, (s, l) => l.range.to - s.range.to)?.range?.to ?? 0;
|
|
1292
1552
|
return {
|
|
1293
|
-
selected: i?.[1] ??
|
|
1294
|
-
absolute:
|
|
1553
|
+
selected: i?.[1] ?? o,
|
|
1554
|
+
absolute: o
|
|
1295
1555
|
};
|
|
1296
1556
|
}
|
|
1297
|
-
},
|
|
1298
|
-
value: ({ value:
|
|
1299
|
-
label: ({ name:
|
|
1300
|
-
selected: ({ selected:
|
|
1301
|
-
quantity: ({ quantity:
|
|
1302
|
-
},
|
|
1303
|
-
if (!
|
|
1304
|
-
throw new
|
|
1305
|
-
return { data: (await t.checkout.cancelOrder(
|
|
1557
|
+
}, Yt = {
|
|
1558
|
+
value: ({ value: e }) => e,
|
|
1559
|
+
label: ({ name: e }) => e || "unknown",
|
|
1560
|
+
selected: ({ selected: e }) => e,
|
|
1561
|
+
quantity: ({ quantity: e }) => e
|
|
1562
|
+
}, Jt = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1563
|
+
if (!n?.orderId)
|
|
1564
|
+
throw new U("Missing orderId");
|
|
1565
|
+
return { data: (await t.checkout.cancelOrder(n))?.data };
|
|
1306
1566
|
};
|
|
1307
|
-
function
|
|
1308
|
-
if (!
|
|
1567
|
+
function an(e) {
|
|
1568
|
+
if (!e || e.status !== "pending")
|
|
1309
1569
|
return null;
|
|
1310
|
-
for (const
|
|
1311
|
-
if (
|
|
1570
|
+
for (const n of e.dimensionStatus) {
|
|
1571
|
+
if (n.status !== "pending")
|
|
1312
1572
|
continue;
|
|
1313
|
-
const t =
|
|
1573
|
+
const t = n.ruleCollection.find(
|
|
1314
1574
|
(r) => r.status === "pending" && r.isUserNextAuthorizer
|
|
1315
1575
|
);
|
|
1316
1576
|
if (t)
|
|
1317
1577
|
return {
|
|
1318
1578
|
rule: t,
|
|
1319
|
-
orderAuthorizationId:
|
|
1320
|
-
dimensionId:
|
|
1579
|
+
orderAuthorizationId: e.id,
|
|
1580
|
+
dimensionId: n.id
|
|
1321
1581
|
};
|
|
1322
1582
|
}
|
|
1323
1583
|
return null;
|
|
1324
1584
|
}
|
|
1325
|
-
function
|
|
1326
|
-
if (!
|
|
1327
|
-
const
|
|
1328
|
-
return
|
|
1585
|
+
function Kt(e) {
|
|
1586
|
+
if (!e || e.status !== "pending") return !1;
|
|
1587
|
+
const n = e.dimensionStatus.filter((t) => t.status === "pending").flatMap((t) => t.ruleCollection).filter((t) => t.status === "pending");
|
|
1588
|
+
return n.length === 0 ? !1 : n.every((t) => !t.isUserNextAuthorizer);
|
|
1329
1589
|
}
|
|
1330
|
-
const
|
|
1331
|
-
const r = await t.oms.processOrderAuthorization(
|
|
1590
|
+
const Qt = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1591
|
+
const r = await t.oms.processOrderAuthorization(n), i = an(r);
|
|
1332
1592
|
return {
|
|
1333
|
-
isPendingForOtherAuthorizer: !i &&
|
|
1593
|
+
isPendingForOtherAuthorizer: !i && Kt(r),
|
|
1334
1594
|
ruleForAuthorization: i
|
|
1335
1595
|
};
|
|
1336
|
-
},
|
|
1337
|
-
if (!
|
|
1338
|
-
throw new
|
|
1339
|
-
const r =
|
|
1596
|
+
}, Zt = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1597
|
+
if (!n?.objectKey)
|
|
1598
|
+
throw new U("Missing objectKey");
|
|
1599
|
+
const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
|
|
1340
1600
|
return t.orderEntry.startOperation({
|
|
1341
|
-
objectKey:
|
|
1601
|
+
objectKey: n.objectKey,
|
|
1342
1602
|
orderFormId: r,
|
|
1343
|
-
sessionToken:
|
|
1603
|
+
sessionToken: n.sessionToken ?? void 0
|
|
1344
1604
|
});
|
|
1345
|
-
},
|
|
1346
|
-
const { fileContent: r, fileName: i, mimeType: a } =
|
|
1605
|
+
}, er = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), nr = async (e, { data: n }, { clients: { commerce: t } }) => {
|
|
1606
|
+
const { fileContent: r, fileName: i, mimeType: a } = n;
|
|
1347
1607
|
if (!r || !i || !a)
|
|
1348
|
-
throw new
|
|
1608
|
+
throw new U(
|
|
1349
1609
|
"Missing required fields: fileContent, fileName, mimeType"
|
|
1350
1610
|
);
|
|
1351
|
-
const
|
|
1352
|
-
if (Math.floor(
|
|
1353
|
-
throw new
|
|
1611
|
+
const o = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
|
|
1612
|
+
if (Math.floor(o.length * 3 / 4) > s)
|
|
1613
|
+
throw new U("File exceeds maximum allowed size of 5MB");
|
|
1354
1614
|
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
|
|
1355
|
-
|
|
1615
|
+
o
|
|
1356
1616
|
))
|
|
1357
|
-
throw new
|
|
1358
|
-
const g = Buffer.from(
|
|
1617
|
+
throw new U("Invalid Base64 fileContent");
|
|
1618
|
+
const g = Buffer.from(o, "base64");
|
|
1359
1619
|
return await t.orderEntry.uploadFile({
|
|
1360
1620
|
fileBuffer: g,
|
|
1361
1621
|
fileName: i,
|
|
1362
1622
|
mimeType: a
|
|
1363
1623
|
});
|
|
1364
1624
|
};
|
|
1365
|
-
class
|
|
1366
|
-
static parse(
|
|
1625
|
+
class ee {
|
|
1626
|
+
static parse(n) {
|
|
1367
1627
|
try {
|
|
1368
|
-
const t = JSON.parse(
|
|
1628
|
+
const t = JSON.parse(n);
|
|
1369
1629
|
return {
|
|
1370
1630
|
seller: t.seller ?? "",
|
|
1371
1631
|
regionId: t.regionId ?? "",
|
|
@@ -1376,49 +1636,49 @@ class nn {
|
|
|
1376
1636
|
throw console.error(t), new Error("Malformed channel string");
|
|
1377
1637
|
}
|
|
1378
1638
|
}
|
|
1379
|
-
static stringify(
|
|
1380
|
-
return JSON.stringify(
|
|
1639
|
+
static stringify(n) {
|
|
1640
|
+
return JSON.stringify(n);
|
|
1381
1641
|
}
|
|
1382
1642
|
}
|
|
1383
|
-
const
|
|
1384
|
-
|
|
1385
|
-
},
|
|
1386
|
-
|
|
1387
|
-
},
|
|
1643
|
+
const ge = (e, n) => {
|
|
1644
|
+
e.storage.channel = ee.parse(n);
|
|
1645
|
+
}, me = (e, n) => {
|
|
1646
|
+
e.storage.locale = n;
|
|
1647
|
+
}, on = (e) => En.createHash("md5").update(e).digest("hex"), Y = {
|
|
1388
1648
|
attachment: "ATTACHMENT",
|
|
1389
1649
|
specification: "SPECIFICATION",
|
|
1390
1650
|
attribute: "ATTRIBUTE"
|
|
1391
1651
|
};
|
|
1392
|
-
function
|
|
1652
|
+
function sn(e) {
|
|
1393
1653
|
return {
|
|
1394
|
-
name:
|
|
1395
|
-
value:
|
|
1654
|
+
name: e.name,
|
|
1655
|
+
value: e.content,
|
|
1396
1656
|
valueReference: Y.attachment
|
|
1397
1657
|
};
|
|
1398
1658
|
}
|
|
1399
|
-
function
|
|
1659
|
+
function tr(e) {
|
|
1400
1660
|
return {
|
|
1401
|
-
propertyID:
|
|
1402
|
-
name:
|
|
1403
|
-
value:
|
|
1661
|
+
propertyID: e.id,
|
|
1662
|
+
name: e.name,
|
|
1663
|
+
value: e.value,
|
|
1404
1664
|
valueReference: {
|
|
1405
1665
|
valueReference: Y.attribute,
|
|
1406
|
-
visible:
|
|
1666
|
+
visible: e.visible
|
|
1407
1667
|
}
|
|
1408
1668
|
};
|
|
1409
1669
|
}
|
|
1410
|
-
function
|
|
1411
|
-
return
|
|
1412
|
-
`${
|
|
1670
|
+
function cn(e) {
|
|
1671
|
+
return on(
|
|
1672
|
+
`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`
|
|
1413
1673
|
);
|
|
1414
1674
|
}
|
|
1415
|
-
const
|
|
1416
|
-
const
|
|
1417
|
-
addressType:
|
|
1418
|
-
postalCode:
|
|
1675
|
+
const rr = (e) => {
|
|
1676
|
+
const n = e.postalCode, t = e.geoCoordinates, r = {
|
|
1677
|
+
addressType: e.addressType || null,
|
|
1678
|
+
postalCode: n || null,
|
|
1419
1679
|
city: null,
|
|
1420
1680
|
state: null,
|
|
1421
|
-
country:
|
|
1681
|
+
country: e.country || null,
|
|
1422
1682
|
street: null,
|
|
1423
1683
|
number: null,
|
|
1424
1684
|
neighborhood: null,
|
|
@@ -1431,10 +1691,10 @@ const kt = (n) => {
|
|
|
1431
1691
|
r.geoCoordinates = i !== null && a !== null ? [a, i] : [];
|
|
1432
1692
|
}
|
|
1433
1693
|
return [r];
|
|
1434
|
-
},
|
|
1435
|
-
const r =
|
|
1436
|
-
if (!t &&
|
|
1437
|
-
return [
|
|
1694
|
+
}, ir = (e, n, t) => {
|
|
1695
|
+
const r = n.postalCode, i = n.geoCoordinates, a = e?.shippingData?.availableAddresses ?? [], o = e?.shippingData?.selectedAddresses ?? [];
|
|
1696
|
+
if (!t && o.length > 0)
|
|
1697
|
+
return [o[0]];
|
|
1438
1698
|
if (t && a.length > 0)
|
|
1439
1699
|
for (const s of a) {
|
|
1440
1700
|
if (r && i && (s.postalCode === r || s.geoCoordinates[0] === i.longitude && s.geoCoordinates[1] === i.latitude))
|
|
@@ -1445,88 +1705,88 @@ const kt = (n) => {
|
|
|
1445
1705
|
return [s];
|
|
1446
1706
|
}
|
|
1447
1707
|
return null;
|
|
1448
|
-
},
|
|
1449
|
-
if (!
|
|
1708
|
+
}, ln = (e, n) => {
|
|
1709
|
+
if (!ar(n))
|
|
1450
1710
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1451
|
-
if (!
|
|
1711
|
+
if (!lr(e))
|
|
1452
1712
|
return { updateShipping: !1, addressChanged: !1 };
|
|
1453
|
-
const [t] =
|
|
1454
|
-
if (
|
|
1713
|
+
const [t] = e?.shippingData?.selectedAddresses ?? [];
|
|
1714
|
+
if (or(t, n.postalCode) || sr(t, n.geoCoordinates) || cr(t, n.addressType))
|
|
1455
1715
|
return { updateShipping: !0, addressChanged: !0 };
|
|
1456
|
-
const { logisticsInfo: r } =
|
|
1457
|
-
return
|
|
1458
|
-
},
|
|
1459
|
-
const t =
|
|
1460
|
-
return
|
|
1461
|
-
({ selectedDeliveryChannel:
|
|
1462
|
-
const d = t &&
|
|
1463
|
-
return l?.some((
|
|
1464
|
-
(
|
|
1716
|
+
const { logisticsInfo: r } = e.shippingData;
|
|
1717
|
+
return dr(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
|
|
1718
|
+
}, ar = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, or = (e, n) => typeof n == "string" && e?.postalCode !== n, sr = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), cr = (e, n) => typeof n == "string" && e?.addressType !== n, lr = (e) => e.items.length !== 0, dr = (e, n) => {
|
|
1719
|
+
const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
|
|
1720
|
+
return e.some(
|
|
1721
|
+
({ selectedDeliveryChannel: o, selectedSla: s, slas: l }) => {
|
|
1722
|
+
const d = t && o !== t, g = r && s !== r;
|
|
1723
|
+
return l?.some((p) => d && p.deliveryChannel === t || g && p.id === r ? !0 : i && a && p.deliveryChannel === t && p.id === r && (!p?.deliveryWindow || p?.deliveryWindow?.startDateUtc !== i || p?.deliveryWindow?.endDateUtc !== a) && p.availableDeliveryWindows?.some(
|
|
1724
|
+
(c) => c?.startDateUtc === i && c?.endDateUtc === a
|
|
1465
1725
|
));
|
|
1466
1726
|
}
|
|
1467
1727
|
);
|
|
1468
|
-
},
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
].filter(Boolean).join("::"),
|
|
1474
|
-
listPrice:
|
|
1475
|
-
price:
|
|
1476
|
-
quantity:
|
|
1477
|
-
seller: { identifier:
|
|
1728
|
+
}, dn = (e) => e.valueReference === Y.attachment, he = (e) => [
|
|
1729
|
+
e.itemOffered.sku,
|
|
1730
|
+
e.seller.identifier,
|
|
1731
|
+
e.price < 0.01 ? "Gift" : void 0,
|
|
1732
|
+
e.itemOffered.additionalProperty?.filter(dn).map(cn).join("-")
|
|
1733
|
+
].filter(Boolean).join("::"), ne = (e, n) => ({
|
|
1734
|
+
listPrice: e.listPrice / 100,
|
|
1735
|
+
price: e.sellingPrice / 100,
|
|
1736
|
+
quantity: e.quantity,
|
|
1737
|
+
seller: { identifier: e.seller },
|
|
1478
1738
|
itemOffered: {
|
|
1479
|
-
sku:
|
|
1739
|
+
sku: e.id,
|
|
1480
1740
|
image: [],
|
|
1481
|
-
name: n.name,
|
|
1482
|
-
additionalProperty: n.attachments.map(re)
|
|
1483
|
-
},
|
|
1484
|
-
index: e
|
|
1485
|
-
}), zt = (n) => ({
|
|
1486
|
-
quantity: n.quantity,
|
|
1487
|
-
seller: n.seller.identifier,
|
|
1488
|
-
id: n.itemOffered.sku,
|
|
1489
|
-
index: n.index,
|
|
1490
|
-
attachments: (n.itemOffered.additionalProperty?.filter(oe) ?? []).map((e) => ({
|
|
1491
1741
|
name: e.name,
|
|
1492
|
-
|
|
1742
|
+
additionalProperty: e.attachments.map(sn)
|
|
1743
|
+
},
|
|
1744
|
+
index: n
|
|
1745
|
+
}), ur = (e) => ({
|
|
1746
|
+
quantity: e.quantity,
|
|
1747
|
+
seller: e.seller.identifier,
|
|
1748
|
+
id: e.itemOffered.sku,
|
|
1749
|
+
index: e.index,
|
|
1750
|
+
attachments: (e.itemOffered.additionalProperty?.filter(dn) ?? []).map((n) => ({
|
|
1751
|
+
name: n.name,
|
|
1752
|
+
content: n.value
|
|
1493
1753
|
}))
|
|
1494
|
-
}),
|
|
1495
|
-
const r =
|
|
1496
|
-
return
|
|
1497
|
-
}, /* @__PURE__ */ new Map()),
|
|
1754
|
+
}), Re = (e) => e.reduce((n, t) => {
|
|
1755
|
+
const r = he(t);
|
|
1756
|
+
return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
|
|
1757
|
+
}, /* @__PURE__ */ new Map()), pr = (e, n) => {
|
|
1498
1758
|
const t = (s, l) => ({
|
|
1499
1759
|
...s,
|
|
1500
1760
|
itemOffered: {
|
|
1501
1761
|
sku: s.itemOffered.sku
|
|
1502
1762
|
},
|
|
1503
1763
|
index: l
|
|
1504
|
-
}), r =
|
|
1505
|
-
return a &&
|
|
1764
|
+
}), r = n.items.map(ne).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = Ie(r, i);
|
|
1765
|
+
return a && o;
|
|
1506
1766
|
};
|
|
1507
|
-
function
|
|
1508
|
-
return
|
|
1509
|
-
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 &&
|
|
1767
|
+
function un(e, n) {
|
|
1768
|
+
return e?.some(
|
|
1769
|
+
(t) => t.parentItemIndex !== null && t.parentItemIndex !== void 0 && e[t.parentItemIndex]?.id === n
|
|
1510
1770
|
);
|
|
1511
1771
|
}
|
|
1512
|
-
function
|
|
1513
|
-
return
|
|
1514
|
-
(t) => t.id ===
|
|
1772
|
+
function pn(e, n) {
|
|
1773
|
+
return e?.some(
|
|
1774
|
+
(t) => t.id === n && t.parentItemIndex !== null
|
|
1515
1775
|
);
|
|
1516
1776
|
}
|
|
1517
|
-
const
|
|
1518
|
-
const
|
|
1777
|
+
const Ne = (e) => {
|
|
1778
|
+
const n = e.items.reduce(
|
|
1519
1779
|
(t, r, i) => {
|
|
1520
|
-
const a =
|
|
1780
|
+
const a = pn(e.items, r.id) || un(e.items, r.id) ? `${he(ne(r))}::${i}` : he(ne(r));
|
|
1521
1781
|
return t[a] || (t[a] = []), t[a].push(r), t;
|
|
1522
1782
|
},
|
|
1523
1783
|
{}
|
|
1524
1784
|
);
|
|
1525
1785
|
return {
|
|
1526
|
-
...
|
|
1527
|
-
items: Object.values(
|
|
1528
|
-
const [r] = t, i = t.reduce((
|
|
1529
|
-
(
|
|
1786
|
+
...e,
|
|
1787
|
+
items: Object.values(n).map((t) => {
|
|
1788
|
+
const [r] = t, i = t.reduce((o, s) => o + s.quantity, 0), a = t.reduce(
|
|
1789
|
+
(o, s) => o + (s?.priceDefinition?.total ?? (s?.quantity ?? 0) * (s?.sellingPrice ?? 0)),
|
|
1530
1790
|
0
|
|
1531
1791
|
);
|
|
1532
1792
|
return {
|
|
@@ -1536,37 +1796,37 @@ const Fn = (n) => {
|
|
|
1536
1796
|
};
|
|
1537
1797
|
})
|
|
1538
1798
|
};
|
|
1539
|
-
},
|
|
1799
|
+
}, Le = async (e, n, t) => ({
|
|
1540
1800
|
order: {
|
|
1541
|
-
orderNumber:
|
|
1542
|
-
acceptedOffer:
|
|
1801
|
+
orderNumber: e.orderFormId,
|
|
1802
|
+
acceptedOffer: e.items.map(async (r) => ({
|
|
1543
1803
|
...r,
|
|
1544
|
-
product: await
|
|
1804
|
+
product: await n.load(`${r.id}-invisibleItems`)
|
|
1545
1805
|
})),
|
|
1546
1806
|
shouldSplitItem: t
|
|
1547
1807
|
},
|
|
1548
|
-
messages:
|
|
1808
|
+
messages: e.messages.map(({ text: r, status: i }) => ({
|
|
1549
1809
|
text: r,
|
|
1550
1810
|
status: i.toUpperCase()
|
|
1551
1811
|
}))
|
|
1552
|
-
}),
|
|
1553
|
-
const t =
|
|
1812
|
+
}), gn = ({ items: e }, n) => {
|
|
1813
|
+
const t = e.map((r) => ({
|
|
1554
1814
|
id: r.id,
|
|
1555
1815
|
quantity: r.quantity,
|
|
1556
1816
|
seller: r.seller,
|
|
1557
1817
|
attachments: r.attachments
|
|
1558
1818
|
// customizations
|
|
1559
1819
|
}));
|
|
1560
|
-
return
|
|
1561
|
-
JSON.stringify({ sessionId:
|
|
1820
|
+
return on(
|
|
1821
|
+
JSON.stringify({ sessionId: n?.id ?? "", items: t })
|
|
1562
1822
|
);
|
|
1563
|
-
},
|
|
1823
|
+
}, Be = async (e, n, t) => {
|
|
1564
1824
|
try {
|
|
1565
|
-
return await
|
|
1566
|
-
id:
|
|
1825
|
+
return await n.checkout.setCustomData({
|
|
1826
|
+
id: e.orderFormId,
|
|
1567
1827
|
appId: "faststore",
|
|
1568
1828
|
key: "cartEtag",
|
|
1569
|
-
value:
|
|
1829
|
+
value: gn(e, t)
|
|
1570
1830
|
});
|
|
1571
1831
|
} catch (r) {
|
|
1572
1832
|
throw console.error(
|
|
@@ -1576,92 +1836,92 @@ const Fn = (n) => {
|
|
|
1576
1836
|
More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
|
|
1577
1837
|
), r;
|
|
1578
1838
|
}
|
|
1579
|
-
},
|
|
1580
|
-
const r =
|
|
1839
|
+
}, gr = (e, n) => {
|
|
1840
|
+
const r = e.customData?.customApps.find(
|
|
1581
1841
|
(a) => a.id === "faststore"
|
|
1582
1842
|
)?.fields?.cartEtag;
|
|
1583
|
-
return r == null ? !0 :
|
|
1584
|
-
},
|
|
1585
|
-
id:
|
|
1586
|
-
}),
|
|
1587
|
-
if (!
|
|
1588
|
-
return
|
|
1589
|
-
const { updateShipping: r, addressChanged: i } =
|
|
1590
|
-
|
|
1591
|
-
|
|
1843
|
+
return r == null ? !0 : gn(e, n) !== r;
|
|
1844
|
+
}, mr = async (e, { clients: { commerce: n } }) => n.checkout.clearOrderFormMessages({
|
|
1845
|
+
id: e
|
|
1846
|
+
}), Me = async (e, n, { clients: { commerce: t } }) => {
|
|
1847
|
+
if (!n)
|
|
1848
|
+
return e;
|
|
1849
|
+
const { updateShipping: r, addressChanged: i } = ln(
|
|
1850
|
+
e,
|
|
1851
|
+
n
|
|
1592
1852
|
);
|
|
1593
1853
|
if (r) {
|
|
1594
|
-
const a =
|
|
1595
|
-
return !!
|
|
1854
|
+
const a = ir(e, n, i), s = a || rr(n);
|
|
1855
|
+
return !!n.deliveryMode?.deliveryWindow && await t.checkout.shippingData(
|
|
1596
1856
|
{
|
|
1597
|
-
id:
|
|
1598
|
-
index:
|
|
1599
|
-
deliveryMode:
|
|
1857
|
+
id: e.orderFormId,
|
|
1858
|
+
index: e.items.length,
|
|
1859
|
+
deliveryMode: n.deliveryMode,
|
|
1600
1860
|
selectedAddresses: s
|
|
1601
1861
|
},
|
|
1602
1862
|
!1
|
|
1603
1863
|
), t.checkout.shippingData(
|
|
1604
1864
|
{
|
|
1605
|
-
id:
|
|
1606
|
-
index:
|
|
1607
|
-
deliveryMode:
|
|
1865
|
+
id: e.orderFormId,
|
|
1866
|
+
index: e.items.length,
|
|
1867
|
+
deliveryMode: n.deliveryMode,
|
|
1608
1868
|
selectedAddresses: s
|
|
1609
1869
|
},
|
|
1610
1870
|
!0
|
|
1611
1871
|
);
|
|
1612
1872
|
}
|
|
1613
|
-
return
|
|
1614
|
-
},
|
|
1615
|
-
if (!
|
|
1873
|
+
return e;
|
|
1874
|
+
}, hr = (e, n) => {
|
|
1875
|
+
if (!e)
|
|
1616
1876
|
return "";
|
|
1617
|
-
const r =
|
|
1877
|
+
const r = H(e)[n];
|
|
1618
1878
|
return r ? r.split("=")[1] : "";
|
|
1619
|
-
},
|
|
1620
|
-
const i =
|
|
1879
|
+
}, fr = async (e, { cart: { order: n }, session: t }, r) => {
|
|
1880
|
+
const i = hr(
|
|
1621
1881
|
r.headers.cookie,
|
|
1622
1882
|
"checkout.vtex.com"
|
|
1623
1883
|
), {
|
|
1624
1884
|
clients: { commerce: a },
|
|
1625
|
-
loaders: { skuLoader:
|
|
1885
|
+
loaders: { skuLoader: o }
|
|
1626
1886
|
} = r, s = t?.channel, l = t?.locale;
|
|
1627
|
-
s &&
|
|
1887
|
+
s && ge(r, s), l && me(r, l);
|
|
1628
1888
|
const d = await a.checkout.orderForm({
|
|
1629
1889
|
id: i || void 0,
|
|
1630
1890
|
channel: r.storage.channel
|
|
1631
1891
|
}), g = d.orderFormId;
|
|
1632
|
-
d.messages.length !== 0 && await
|
|
1633
|
-
const
|
|
1634
|
-
if (
|
|
1635
|
-
const
|
|
1892
|
+
d.messages.length !== 0 && await mr(g, r);
|
|
1893
|
+
const p = H(r?.headers?.cookie ?? "")?.vtex_session, c = Z(p), { acceptedOffer: u, shouldSplitItem: m } = n;
|
|
1894
|
+
if (gr(d, c)) {
|
|
1895
|
+
const v = await Be(
|
|
1636
1896
|
d,
|
|
1637
1897
|
a,
|
|
1638
|
-
|
|
1639
|
-
).then(
|
|
1898
|
+
c
|
|
1899
|
+
).then(Ne);
|
|
1640
1900
|
if (g)
|
|
1641
|
-
return
|
|
1901
|
+
return Le(v, o, m);
|
|
1642
1902
|
}
|
|
1643
|
-
const
|
|
1644
|
-
(
|
|
1645
|
-
const
|
|
1646
|
-
if (!
|
|
1647
|
-
return
|
|
1648
|
-
const [
|
|
1649
|
-
if (
|
|
1650
|
-
return
|
|
1651
|
-
const
|
|
1652
|
-
return
|
|
1653
|
-
...
|
|
1654
|
-
quantity:
|
|
1655
|
-
}),
|
|
1903
|
+
const f = Re(u), I = Re(d.items.map(ne)), D = Array.from(I.entries()), E = Array.from(f.entries()), { itemsToAdd: w, itemsToUpdate: O } = E.reduce(
|
|
1904
|
+
(v, [T, _]) => {
|
|
1905
|
+
const x = I.get(T);
|
|
1906
|
+
if (!x)
|
|
1907
|
+
return _.forEach((q) => v.itemsToAdd.push(q)), v;
|
|
1908
|
+
const [k, ...ve] = x;
|
|
1909
|
+
if (pn(d.items, k.itemOffered.sku) || un(d.items, k.itemOffered.sku))
|
|
1910
|
+
return v.itemsToUpdate.push(k), v;
|
|
1911
|
+
const ie = _.reduce((q, In) => q + In.quantity, 0);
|
|
1912
|
+
return v.itemsToUpdate.push({
|
|
1913
|
+
...k,
|
|
1914
|
+
quantity: ie
|
|
1915
|
+
}), ve.forEach((q) => v.itemsToUpdate.push({ ...q, quantity: 0 })), v;
|
|
1656
1916
|
},
|
|
1657
1917
|
{
|
|
1658
1918
|
itemsToAdd: [],
|
|
1659
1919
|
itemsToUpdate: []
|
|
1660
1920
|
}
|
|
1661
|
-
),
|
|
1662
|
-
|
|
1663
|
-
), { updateShipping:
|
|
1664
|
-
if (h.length === 0 && !
|
|
1921
|
+
), P = D.filter(([v]) => !f.has(v)).flatMap(([, v]) => v.map((T) => ({ ...T, quantity: 0 }))), h = [...w, ...O, ...P].map(
|
|
1922
|
+
ur
|
|
1923
|
+
), { updateShipping: b } = t ? ln(d, t) : { updateShipping: !1 };
|
|
1924
|
+
if (h.length === 0 && !b)
|
|
1665
1925
|
return null;
|
|
1666
1926
|
let C;
|
|
1667
1927
|
h.length > 0 ? C = await a.checkout.updateOrderFormItems({
|
|
@@ -1669,41 +1929,41 @@ const Fn = (n) => {
|
|
|
1669
1929
|
orderItems: h,
|
|
1670
1930
|
shouldSplitItem: m
|
|
1671
1931
|
}).then(
|
|
1672
|
-
(
|
|
1673
|
-
) : C = await
|
|
1932
|
+
(v) => Me(v, t, r)
|
|
1933
|
+
) : C = await Me(
|
|
1674
1934
|
d,
|
|
1675
1935
|
t,
|
|
1676
1936
|
r
|
|
1677
|
-
), C = await Promise.resolve(C).then((
|
|
1937
|
+
), C = await Promise.resolve(C).then((v) => {
|
|
1678
1938
|
if (t?.marketingData) {
|
|
1679
|
-
const
|
|
1680
|
-
...
|
|
1939
|
+
const T = {
|
|
1940
|
+
...v.marketingData,
|
|
1681
1941
|
...t.marketingData
|
|
1682
1942
|
};
|
|
1683
1943
|
return a.checkout.marketingData({
|
|
1684
1944
|
id: d.orderFormId,
|
|
1685
|
-
marketingData:
|
|
1945
|
+
marketingData: T
|
|
1686
1946
|
});
|
|
1687
1947
|
}
|
|
1688
|
-
return
|
|
1689
|
-
}).then((
|
|
1690
|
-
id:
|
|
1948
|
+
return v;
|
|
1949
|
+
}).then((v) => l && v.clientPreferencesData?.locale !== l ? a.checkout.clientPreferencesData({
|
|
1950
|
+
id: v.orderFormId,
|
|
1691
1951
|
clientPreferencesData: {
|
|
1692
|
-
...
|
|
1952
|
+
...v.clientPreferencesData,
|
|
1693
1953
|
locale: l
|
|
1694
1954
|
}
|
|
1695
|
-
}) :
|
|
1696
|
-
const
|
|
1955
|
+
}) : v).then((v) => Be(v, a, c)).then(Ne);
|
|
1956
|
+
const A = Ie(
|
|
1697
1957
|
d.messages,
|
|
1698
1958
|
C.messages
|
|
1699
1959
|
);
|
|
1700
|
-
return
|
|
1960
|
+
return pr(n, C) && A ? null : Le(C, o, m);
|
|
1701
1961
|
};
|
|
1702
|
-
async function
|
|
1962
|
+
async function Sr(e, n, t) {
|
|
1703
1963
|
try {
|
|
1704
|
-
const r = await
|
|
1964
|
+
const r = await e.commerce.checkout.address({
|
|
1705
1965
|
postalCode: t,
|
|
1706
|
-
country:
|
|
1966
|
+
country: n
|
|
1707
1967
|
}), i = r.geoCoordinates ? {
|
|
1708
1968
|
latitude: r.geoCoordinates[1],
|
|
1709
1969
|
longitude: r.geoCoordinates[0]
|
|
@@ -1711,77 +1971,77 @@ async function Gt(n, e, t) {
|
|
|
1711
1971
|
return { city: r.city, geoCoordinates: i };
|
|
1712
1972
|
} catch (r) {
|
|
1713
1973
|
throw console.error(
|
|
1714
|
-
`Error while getting geo coordinates for the current postal code (${t}) and country (${
|
|
1974
|
+
`Error while getting geo coordinates for the current postal code (${t}) and country (${n}).
|
|
1715
1975
|
`
|
|
1716
1976
|
), r;
|
|
1717
1977
|
}
|
|
1718
1978
|
}
|
|
1719
|
-
const
|
|
1720
|
-
const
|
|
1721
|
-
let d =
|
|
1979
|
+
const yr = async (e, { session: n, search: t }, { clients: r, headers: i, account: a }) => {
|
|
1980
|
+
const o = ee.parse(n.channel ?? ""), s = String(n.postalCode ?? ""), l = n.country ?? "";
|
|
1981
|
+
let d = n.city ?? null, g = n.geoCoordinates ?? null;
|
|
1722
1982
|
if ((!d || !g) && s !== "" && l !== "") {
|
|
1723
|
-
const
|
|
1983
|
+
const k = await Sr(
|
|
1724
1984
|
r,
|
|
1725
1985
|
l,
|
|
1726
1986
|
s
|
|
1727
1987
|
);
|
|
1728
|
-
d =
|
|
1988
|
+
d = k.city, g = k.geoCoordinates;
|
|
1729
1989
|
}
|
|
1730
|
-
const
|
|
1731
|
-
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1990
|
+
const c = new URLSearchParams(t);
|
|
1991
|
+
c.has("facets") && c.delete("facets");
|
|
1992
|
+
const u = c.get("sc") ?? o.salesChannel;
|
|
1993
|
+
c.set("sc", u), s && c.set("postalCode", s), l && c.set("country", l), g && c.set(
|
|
1734
1994
|
"geoCoordinates",
|
|
1735
1995
|
`${g.longitude},${g.latitude}`
|
|
1736
1996
|
// long,lat is the format expected
|
|
1737
|
-
),
|
|
1738
|
-
const { marketingData: m } =
|
|
1739
|
-
utmCampaign:
|
|
1740
|
-
utmMedium:
|
|
1741
|
-
utmSource:
|
|
1742
|
-
utmiCampaign:
|
|
1743
|
-
utmiPage:
|
|
1744
|
-
utmiPart:
|
|
1745
|
-
},
|
|
1746
|
-
let
|
|
1747
|
-
if (
|
|
1997
|
+
), c.set("locale", n.locale);
|
|
1998
|
+
const { marketingData: m } = n, S = {
|
|
1999
|
+
utmCampaign: c.get("utm_campaign") ?? m?.utmCampaign ?? "",
|
|
2000
|
+
utmMedium: c.get("utm_medium") ?? m?.utmMedium ?? "",
|
|
2001
|
+
utmSource: c.get("utm_source") ?? m?.utmSource ?? "",
|
|
2002
|
+
utmiCampaign: c.get("utmi_cp") ?? m?.utmiCampaign ?? "",
|
|
2003
|
+
utmiPage: c.get("utmi_p") ?? m?.utmiPage ?? "",
|
|
2004
|
+
utmiPart: c.get("utmi_pc") ?? m?.utmiPart ?? ""
|
|
2005
|
+
}, f = Z(Q(i?.cookie ?? "", a));
|
|
2006
|
+
let I = !1;
|
|
2007
|
+
if (f)
|
|
1748
2008
|
try {
|
|
1749
|
-
|
|
1750
|
-
} catch (
|
|
1751
|
-
console.warn("JWT validation failed:",
|
|
2009
|
+
I = (await r.commerce.vtexid.validate())?.authStatus?.toLowerCase() === "success";
|
|
2010
|
+
} catch (k) {
|
|
2011
|
+
console.warn("JWT validation failed:", k), I = !1;
|
|
1752
2012
|
}
|
|
1753
|
-
const
|
|
1754
|
-
let
|
|
1755
|
-
if (
|
|
2013
|
+
const D = I ? f?.isRepresentative : !1, E = I ? f?.customerId : void 0, w = I ? f?.unitId : void 0, O = await r.commerce.session(c.toString()).catch(() => null), P = O?.namespaces.profile ?? null, h = O?.namespaces.shopper ?? null, b = O?.namespaces.store ?? null, C = O?.namespaces.authentication ?? null, A = O?.namespaces.checkout ?? null, v = O?.namespaces.public ?? null;
|
|
2014
|
+
let T = null;
|
|
2015
|
+
if (D && P?.id?.value)
|
|
1756
2016
|
try {
|
|
1757
|
-
|
|
1758
|
-
contractId:
|
|
2017
|
+
T = await r.commerce.masterData.getContractById({
|
|
2018
|
+
contractId: P.id.value
|
|
1759
2019
|
});
|
|
1760
2020
|
} catch {
|
|
1761
2021
|
console.error(
|
|
1762
|
-
`Error while getting contract data for profile ID (${
|
|
2022
|
+
`Error while getting contract data for profile ID (${P.id.value}).
|
|
1763
2023
|
`
|
|
1764
2024
|
);
|
|
1765
2025
|
}
|
|
1766
|
-
let
|
|
1767
|
-
|
|
2026
|
+
let _;
|
|
2027
|
+
o.seller && (s || g) && (_ = (await r.commerce.checkout.region({
|
|
1768
2028
|
postalCode: s,
|
|
1769
2029
|
geoCoordinates: g,
|
|
1770
2030
|
country: l,
|
|
1771
|
-
salesChannel:
|
|
1772
|
-
}))?.[0]?.sellers.find((
|
|
1773
|
-
const
|
|
1774
|
-
...
|
|
2031
|
+
salesChannel: u
|
|
2032
|
+
}))?.[0]?.sellers.find((ie) => o.seller === ie.id));
|
|
2033
|
+
const x = {
|
|
2034
|
+
...n,
|
|
1775
2035
|
currency: {
|
|
1776
|
-
code:
|
|
1777
|
-
symbol:
|
|
2036
|
+
code: b?.currencyCode?.value ?? n.currency.code,
|
|
2037
|
+
symbol: b?.currencySymbol?.value ?? n.currency.symbol
|
|
1778
2038
|
},
|
|
1779
|
-
country:
|
|
1780
|
-
channel:
|
|
1781
|
-
salesChannel:
|
|
1782
|
-
regionId:
|
|
1783
|
-
seller:
|
|
1784
|
-
hasOnlyDefaultSalesChannel: !
|
|
2039
|
+
country: b?.countryCode?.value ?? l,
|
|
2040
|
+
channel: ee.stringify({
|
|
2041
|
+
salesChannel: b?.channel?.value ?? o.salesChannel,
|
|
2042
|
+
regionId: A?.regionId?.value ?? o.regionId,
|
|
2043
|
+
seller: _?.id,
|
|
2044
|
+
hasOnlyDefaultSalesChannel: !b?.channel?.value
|
|
1785
2045
|
}),
|
|
1786
2046
|
/**
|
|
1787
2047
|
* B2B data structure in Session:
|
|
@@ -1789,222 +2049,222 @@ const Ht = async (n, { session: e, search: t }, { clients: r, headers: i, accoun
|
|
|
1789
2049
|
* - Unit data: `authentication` namespace
|
|
1790
2050
|
* - Contract data: `profile` namespace (those info will be available inside Faststore's Session `person` object)
|
|
1791
2051
|
*/
|
|
1792
|
-
b2b:
|
|
1793
|
-
isRepresentative:
|
|
1794
|
-
customerId: C?.customerId?.value ??
|
|
2052
|
+
b2b: D ? {
|
|
2053
|
+
isRepresentative: D ?? !1,
|
|
2054
|
+
customerId: C?.customerId?.value ?? E ?? "",
|
|
1795
2055
|
unitName: C?.unitName?.value ?? "",
|
|
1796
|
-
unitId: C?.unitId?.value ??
|
|
2056
|
+
unitId: C?.unitId?.value ?? w ?? "",
|
|
1797
2057
|
firstName: typeof h?.firstName?.value == "string" ? h.firstName.value : "",
|
|
1798
2058
|
lastName: typeof h?.lastName?.value == "string" ? h.lastName.value : "",
|
|
1799
2059
|
userName: `${typeof h?.firstName?.value == "string" ? h.firstName.value : ""} ${typeof h?.lastName?.value == "string" ? h.lastName.value : ""}`.trim(),
|
|
1800
2060
|
userEmail: C?.storeUserEmail.value ?? "",
|
|
1801
|
-
savedPostalCode:
|
|
1802
|
-
contractName:
|
|
2061
|
+
savedPostalCode: v?.postalCode?.value ?? "",
|
|
2062
|
+
contractName: T?.corporateName ?? "",
|
|
1803
2063
|
organizationManager: h?.organizationManager?.value ?? !1
|
|
1804
2064
|
} : null,
|
|
1805
2065
|
marketingData: S,
|
|
1806
|
-
person:
|
|
1807
|
-
id:
|
|
1808
|
-
email:
|
|
1809
|
-
givenName:
|
|
1810
|
-
familyName:
|
|
2066
|
+
person: P?.id ? {
|
|
2067
|
+
id: P.id?.value ?? "",
|
|
2068
|
+
email: P.email?.value ?? "",
|
|
2069
|
+
givenName: P.firstName?.value ?? "",
|
|
2070
|
+
familyName: P.lastName?.value ?? ""
|
|
1811
2071
|
} : null,
|
|
1812
2072
|
geoCoordinates: g?.latitude && g?.longitude && g || null,
|
|
1813
2073
|
city: d
|
|
1814
2074
|
};
|
|
1815
|
-
return
|
|
1816
|
-
},
|
|
1817
|
-
validateCart:
|
|
1818
|
-
validateSession:
|
|
1819
|
-
subscribeToNewsletter:
|
|
1820
|
-
cancelOrder:
|
|
1821
|
-
processOrderAuthorization:
|
|
1822
|
-
uploadFileToOrderEntry:
|
|
1823
|
-
startOrderEntryOperation:
|
|
2075
|
+
return Ie(n, x) ? null : x;
|
|
2076
|
+
}, Ir = {
|
|
2077
|
+
validateCart: fr,
|
|
2078
|
+
validateSession: yr,
|
|
2079
|
+
subscribeToNewsletter: er,
|
|
2080
|
+
cancelOrder: Jt,
|
|
2081
|
+
processOrderAuthorization: Qt,
|
|
2082
|
+
uploadFileToOrderEntry: nr,
|
|
2083
|
+
startOrderEntryOperation: Zt
|
|
1824
2084
|
};
|
|
1825
|
-
var
|
|
1826
|
-
(function(
|
|
1827
|
-
|
|
1828
|
-
})(
|
|
1829
|
-
const
|
|
1830
|
-
function
|
|
2085
|
+
var fe;
|
|
2086
|
+
(function(e) {
|
|
2087
|
+
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";
|
|
2088
|
+
})(fe || (fe = {}));
|
|
2089
|
+
const vr = (e) => typeof e == "string" ? mn(e) : null;
|
|
2090
|
+
function mn(e) {
|
|
1831
2091
|
try {
|
|
1832
|
-
return JSON.parse(
|
|
2092
|
+
return JSON.parse(e);
|
|
1833
2093
|
} catch {
|
|
1834
|
-
return
|
|
2094
|
+
return e;
|
|
1835
2095
|
}
|
|
1836
2096
|
}
|
|
1837
|
-
const
|
|
2097
|
+
const Or = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Cr = new Cn({
|
|
1838
2098
|
name: "ObjectOrString",
|
|
1839
2099
|
description: "A string or the string representation of an object (a stringified object).",
|
|
1840
|
-
parseValue:
|
|
1841
|
-
serialize:
|
|
1842
|
-
parseLiteral(
|
|
1843
|
-
return
|
|
2100
|
+
parseValue: vr,
|
|
2101
|
+
serialize: Or,
|
|
2102
|
+
parseLiteral(e) {
|
|
2103
|
+
return e.kind === fe.STRING ? mn(e.value) : null;
|
|
1844
2104
|
}
|
|
1845
|
-
}),
|
|
1846
|
-
priceCurrency: async (
|
|
2105
|
+
}), R = (e) => "Price" in e && "seller" in e && "product" in e, F = (e) => "skuName" in e, br = {
|
|
2106
|
+
priceCurrency: async (e, n, t) => {
|
|
1847
2107
|
const {
|
|
1848
2108
|
loaders: { salesChannelLoader: r },
|
|
1849
2109
|
storage: { channel: i }
|
|
1850
2110
|
} = t;
|
|
1851
2111
|
return (await r.load(i.salesChannel)).CurrencyCode ?? "";
|
|
1852
2112
|
},
|
|
1853
|
-
priceValidUntil: (
|
|
2113
|
+
priceValidUntil: (e) => R(e) ? e.PriceValidUntil ?? "" : F(e) ? e.priceValidUntil ?? "" : null,
|
|
1854
2114
|
itemCondition: () => "https://schema.org/NewCondition",
|
|
1855
|
-
availability: async (
|
|
1856
|
-
seller: (
|
|
1857
|
-
identifier: t.storage.channel?.seller ||
|
|
1858
|
-
} :
|
|
1859
|
-
identifier:
|
|
2115
|
+
availability: async (e) => R(e) ? Ae(M(e)) : F(e) ? Ae(Nt(e.availability)) : null,
|
|
2116
|
+
seller: (e, n, t) => R(e) ? {
|
|
2117
|
+
identifier: t.storage.channel?.seller || e.seller.sellerId || ""
|
|
2118
|
+
} : F(e) ? {
|
|
2119
|
+
identifier: e.seller
|
|
1860
2120
|
} : null,
|
|
1861
|
-
price: (
|
|
1862
|
-
priceWithTaxes: (
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
2121
|
+
price: (e) => R(e) ? V(e) : F(e) ? e.sellingPrice / 100 : null,
|
|
2122
|
+
priceWithTaxes: (e) => R(e) ? $(V(e), e?.Tax, e.product.unitMultiplier) : F(e) ? $(
|
|
2123
|
+
e.sellingPrice / 100,
|
|
2124
|
+
e.tax / 100,
|
|
2125
|
+
e.unitMultiplier
|
|
1866
2126
|
) : null,
|
|
1867
|
-
sellingPrice: (
|
|
1868
|
-
listPrice: (
|
|
1869
|
-
listPriceWithTaxes: (
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
) :
|
|
1874
|
-
itemOffered: (
|
|
1875
|
-
...
|
|
1876
|
-
attachmentsValues:
|
|
2127
|
+
sellingPrice: (e) => R(e) ? Rt(e) : F(e) ? e.sellingPrice / 100 : null,
|
|
2128
|
+
listPrice: (e) => R(e) ? e.ListPrice ?? 0 : F(e) ? e.listPrice / 100 : null,
|
|
2129
|
+
listPriceWithTaxes: (e) => R(e) ? $(
|
|
2130
|
+
e.ListPrice ?? 0,
|
|
2131
|
+
e?.Tax,
|
|
2132
|
+
e.product.unitMultiplier
|
|
2133
|
+
) : F(e) ? $(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
|
|
2134
|
+
itemOffered: (e) => R(e) ? e.product : F(e) ? {
|
|
2135
|
+
...e.product,
|
|
2136
|
+
attachmentsValues: e.attachments
|
|
1877
2137
|
} : null,
|
|
1878
|
-
quantity: (
|
|
1879
|
-
isGift: (
|
|
1880
|
-
},
|
|
1881
|
-
offer:
|
|
1882
|
-
seller:
|
|
2138
|
+
quantity: (e) => R(e) ? e.AvailableQuantity ?? 0 : F(e) ? e.quantity : null,
|
|
2139
|
+
isGift: (e) => F(e) ? e.isGift ?? !1 : null
|
|
2140
|
+
}, Dr = ({ linkText: e }) => `/${e}/p`, wr = ({
|
|
2141
|
+
offer: e,
|
|
2142
|
+
seller: n,
|
|
1883
2143
|
product: t
|
|
1884
2144
|
}) => ({
|
|
1885
|
-
...
|
|
2145
|
+
...e,
|
|
1886
2146
|
product: t,
|
|
1887
|
-
seller:
|
|
1888
|
-
}),
|
|
2147
|
+
seller: n
|
|
2148
|
+
}), Pr = {
|
|
1889
2149
|
imageText: "image",
|
|
1890
2150
|
imageUrl: "https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",
|
|
1891
2151
|
imageLabel: "label"
|
|
1892
|
-
},
|
|
1893
|
-
function
|
|
1894
|
-
return
|
|
2152
|
+
}, hn = (e, n) => `${e}-${n}`, Ar = (e, n) => `/${hn(e, n)}/p`, Er = (e) => Array.isArray(e) && e.length > 0 ? e : null;
|
|
2153
|
+
function fn(e) {
|
|
2154
|
+
return e.replace(/^\/+|\/+$/g, "");
|
|
1895
2155
|
}
|
|
1896
|
-
const
|
|
1897
|
-
const t =
|
|
2156
|
+
const Ur = (e, n) => {
|
|
2157
|
+
const t = e.findIndex((r) => fn(r).split("/").at(-1) === n);
|
|
1898
2158
|
return t < 0 ? 0 : t;
|
|
1899
|
-
},
|
|
1900
|
-
productID: ({ itemId:
|
|
1901
|
-
name: ({ isVariantOf:
|
|
1902
|
-
slug: ({ isVariantOf: { linkText:
|
|
1903
|
-
description: ({ isVariantOf: { description:
|
|
1904
|
-
seo: ({ isVariantOf:
|
|
1905
|
-
title:
|
|
1906
|
-
description:
|
|
1907
|
-
canonical:
|
|
2159
|
+
}, Tr = {
|
|
2160
|
+
productID: ({ itemId: e }) => e,
|
|
2161
|
+
name: ({ isVariantOf: e, name: n }) => n ?? e.productName,
|
|
2162
|
+
slug: ({ isVariantOf: { linkText: e }, itemId: n }) => hn(e, n),
|
|
2163
|
+
description: ({ isVariantOf: { description: e } }) => e,
|
|
2164
|
+
seo: ({ isVariantOf: e }) => ({
|
|
2165
|
+
title: e.productTitle || e.productName,
|
|
2166
|
+
description: e.metaTagDescription || e.description,
|
|
2167
|
+
canonical: Dr(e)
|
|
1908
2168
|
}),
|
|
1909
|
-
brand: ({ isVariantOf: { brand:
|
|
1910
|
-
unitMultiplier: ({ unitMultiplier:
|
|
2169
|
+
brand: ({ isVariantOf: { brand: e } }) => ({ name: e }),
|
|
2170
|
+
unitMultiplier: ({ unitMultiplier: e }) => e,
|
|
1911
2171
|
breadcrumbList: ({
|
|
1912
2172
|
isVariantOf: {
|
|
1913
|
-
categories:
|
|
1914
|
-
productName:
|
|
2173
|
+
categories: e,
|
|
2174
|
+
productName: n,
|
|
1915
2175
|
linkText: t,
|
|
1916
2176
|
categoryId: r,
|
|
1917
2177
|
categoriesIds: i
|
|
1918
2178
|
},
|
|
1919
2179
|
itemId: a
|
|
1920
2180
|
}) => {
|
|
1921
|
-
const
|
|
2181
|
+
const o = Ur(i, r), s = e[o], l = fn(s).split("/");
|
|
1922
2182
|
return {
|
|
1923
2183
|
itemListElement: [
|
|
1924
2184
|
...l.map((d, g) => {
|
|
1925
|
-
const
|
|
2185
|
+
const p = `/${l.slice(0, g + 1).map(nn).join("/")}/`;
|
|
1926
2186
|
return {
|
|
1927
2187
|
name: d,
|
|
1928
|
-
item:
|
|
2188
|
+
item: p,
|
|
1929
2189
|
position: g + 1
|
|
1930
2190
|
};
|
|
1931
2191
|
}),
|
|
1932
2192
|
{
|
|
1933
|
-
name:
|
|
1934
|
-
item:
|
|
2193
|
+
name: n,
|
|
2194
|
+
item: Ar(t, a),
|
|
1935
2195
|
position: l.length + 1
|
|
1936
2196
|
}
|
|
1937
2197
|
],
|
|
1938
2198
|
numberOfItems: l.length
|
|
1939
2199
|
};
|
|
1940
2200
|
},
|
|
1941
|
-
image: ({ images:
|
|
1942
|
-
const t = (
|
|
2201
|
+
image: ({ images: e }, n) => {
|
|
2202
|
+
const t = (Er(e) ?? [Pr]).map(
|
|
1943
2203
|
({ imageUrl: s, imageText: l, imageLabel: d }) => ({
|
|
1944
2204
|
alternateName: l ?? "",
|
|
1945
2205
|
url: s.replace("vteximg.com.br", "vtexassets.com"),
|
|
1946
2206
|
keywords: d
|
|
1947
2207
|
})
|
|
1948
2208
|
);
|
|
1949
|
-
if (typeof
|
|
2209
|
+
if (typeof n != "object")
|
|
1950
2210
|
return t;
|
|
1951
|
-
let { context: r, limit: i } =
|
|
2211
|
+
let { context: r, limit: i } = n;
|
|
1952
2212
|
const a = r !== "generic";
|
|
1953
2213
|
i = i || -1, i = i <= -1 ? void 0 : i;
|
|
1954
|
-
let
|
|
2214
|
+
let o = a ? t.filter(
|
|
1955
2215
|
({ keywords: s }) => s === r
|
|
1956
2216
|
) : t;
|
|
1957
|
-
return
|
|
2217
|
+
return o = o.length === 0 ? t : o, o.slice(0, i);
|
|
1958
2218
|
},
|
|
1959
|
-
sku: ({ itemId:
|
|
1960
|
-
gtin: ({ ean:
|
|
1961
|
-
mpn: ({ isVariantOf: { manufacturerCode:
|
|
2219
|
+
sku: ({ itemId: e }) => e,
|
|
2220
|
+
gtin: ({ ean: e, referenceId: n }) => e || (n[0]?.Value ?? ""),
|
|
2221
|
+
mpn: ({ isVariantOf: { manufacturerCode: e } }) => e ?? "",
|
|
1962
2222
|
review: () => [],
|
|
1963
2223
|
aggregateRating: () => ({}),
|
|
1964
|
-
offers: (
|
|
1965
|
-
(
|
|
1966
|
-
offer:
|
|
1967
|
-
seller:
|
|
1968
|
-
product:
|
|
2224
|
+
offers: (e) => e.sellers.map(
|
|
2225
|
+
(n) => wr({
|
|
2226
|
+
offer: n.commertialOffer,
|
|
2227
|
+
seller: n,
|
|
2228
|
+
product: e
|
|
1969
2229
|
})
|
|
1970
|
-
).sort(
|
|
1971
|
-
isVariantOf: (
|
|
2230
|
+
).sort(en),
|
|
2231
|
+
isVariantOf: (e) => e,
|
|
1972
2232
|
additionalProperty: ({
|
|
1973
2233
|
// Search uses the name variations for specifications
|
|
1974
|
-
variations:
|
|
1975
|
-
attachmentsValues:
|
|
2234
|
+
variations: e = [],
|
|
2235
|
+
attachmentsValues: n = [],
|
|
1976
2236
|
attributes: t = []
|
|
1977
2237
|
}) => {
|
|
1978
|
-
const r =
|
|
1979
|
-
({ name:
|
|
1980
|
-
name:
|
|
2238
|
+
const r = e.flatMap(
|
|
2239
|
+
({ name: o, values: s }) => s.map((l) => ({
|
|
2240
|
+
name: o,
|
|
1981
2241
|
value: l,
|
|
1982
2242
|
valueReference: Y.specification
|
|
1983
2243
|
}))
|
|
1984
|
-
), i =
|
|
1985
|
-
|
|
1986
|
-
), a = t.map(
|
|
2244
|
+
), i = n.map(
|
|
2245
|
+
sn
|
|
2246
|
+
), a = t.map(tr);
|
|
1987
2247
|
return [
|
|
1988
2248
|
...r,
|
|
1989
2249
|
...i,
|
|
1990
2250
|
...a
|
|
1991
2251
|
];
|
|
1992
2252
|
},
|
|
1993
|
-
hasSpecifications: ({ isVariantOf:
|
|
1994
|
-
skuSpecifications: ({ isVariantOf: { skuSpecifications:
|
|
1995
|
-
specificationGroups: ({ isVariantOf: { specificationGroups:
|
|
1996
|
-
releaseDate: ({ isVariantOf: { releaseDate:
|
|
1997
|
-
advertisement: ({ isVariantOf: { advertisement:
|
|
1998
|
-
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges:
|
|
1999
|
-
},
|
|
2000
|
-
hasVariant: (
|
|
2001
|
-
productGroupID: ({ isVariantOf:
|
|
2002
|
-
name: (
|
|
2003
|
-
skuVariants: (
|
|
2004
|
-
additionalProperty: ({ isVariantOf: { specificationGroups:
|
|
2005
|
-
(
|
|
2253
|
+
hasSpecifications: ({ isVariantOf: e }) => !!e.skuSpecifications?.length,
|
|
2254
|
+
skuSpecifications: ({ isVariantOf: { skuSpecifications: e } }) => e ?? [],
|
|
2255
|
+
specificationGroups: ({ isVariantOf: { specificationGroups: e } }) => e,
|
|
2256
|
+
releaseDate: ({ isVariantOf: { releaseDate: e } }) => e ?? "",
|
|
2257
|
+
advertisement: ({ isVariantOf: { advertisement: e } }) => e,
|
|
2258
|
+
deliveryPromiseBadges: ({ isVariantOf: { deliveryPromisesBadges: e } }) => e
|
|
2259
|
+
}, kr = /* @__PURE__ */ new Set(["allSpecifications"]), _r = {
|
|
2260
|
+
hasVariant: (e) => e.isVariantOf.items.map((n) => L(n, e.isVariantOf)),
|
|
2261
|
+
productGroupID: ({ isVariantOf: e }) => e.productId,
|
|
2262
|
+
name: (e) => e.isVariantOf.productName,
|
|
2263
|
+
skuVariants: (e) => e,
|
|
2264
|
+
additionalProperty: ({ isVariantOf: { specificationGroups: e } }) => e.filter(
|
|
2265
|
+
(n) => !kr.has(n.name)
|
|
2006
2266
|
).flatMap(
|
|
2007
|
-
({ specifications:
|
|
2267
|
+
({ specifications: n }) => n.flatMap(
|
|
2008
2268
|
({ name: t, values: r }) => r.map((i) => ({
|
|
2009
2269
|
name: t,
|
|
2010
2270
|
value: i,
|
|
@@ -2012,19 +2272,19 @@ const ir = (n, e) => {
|
|
|
2012
2272
|
}))
|
|
2013
2273
|
)
|
|
2014
2274
|
)
|
|
2015
|
-
},
|
|
2016
|
-
propertyID: (
|
|
2017
|
-
name: ({ name:
|
|
2018
|
-
value: ({ value:
|
|
2019
|
-
valueReference: ({ valueReference:
|
|
2020
|
-
},
|
|
2021
|
-
if (!
|
|
2022
|
-
throw new
|
|
2023
|
-
return t.orderEntry.getOperation({ operationId:
|
|
2024
|
-
},
|
|
2025
|
-
if (!
|
|
2026
|
-
throw new
|
|
2027
|
-
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId:
|
|
2275
|
+
}, Fr = {
|
|
2276
|
+
propertyID: (e) => e.propertyID || cn(e),
|
|
2277
|
+
name: ({ name: e }) => e,
|
|
2278
|
+
value: ({ value: e }) => e,
|
|
2279
|
+
valueReference: ({ valueReference: e }) => e
|
|
2280
|
+
}, Rr = async (e, { operationId: n }, { clients: { commerce: t } }) => {
|
|
2281
|
+
if (!n)
|
|
2282
|
+
throw new U("Missing operationId");
|
|
2283
|
+
return t.orderEntry.getOperation({ operationId: n });
|
|
2284
|
+
}, Nr = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
|
|
2285
|
+
if (!n)
|
|
2286
|
+
throw new U("Missing orderFormId");
|
|
2287
|
+
const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
|
|
2028
2288
|
return (r ?? []).map((i) => ({
|
|
2029
2289
|
id: i.id,
|
|
2030
2290
|
name: i.name,
|
|
@@ -2036,18 +2296,18 @@ const ir = (n, e) => {
|
|
|
2036
2296
|
seller: i.seller,
|
|
2037
2297
|
unitMultiplier: i.unitMultiplier ?? 1
|
|
2038
2298
|
}));
|
|
2039
|
-
},
|
|
2040
|
-
const
|
|
2299
|
+
}, Se = (e) => {
|
|
2300
|
+
const n = e.flatMap(
|
|
2041
2301
|
(r) => r.sellers.map((i) => ({
|
|
2042
2302
|
offer: i.commertialOffer,
|
|
2043
2303
|
sku: r
|
|
2044
2304
|
}))
|
|
2045
|
-
), t =
|
|
2046
|
-
|
|
2047
|
-
({ offer: r }, { offer: i }) =>
|
|
2305
|
+
), t = pe(
|
|
2306
|
+
n,
|
|
2307
|
+
({ offer: r }, { offer: i }) => en(r, i)
|
|
2048
2308
|
);
|
|
2049
|
-
return t ? t.sku :
|
|
2050
|
-
},
|
|
2309
|
+
return t ? t.sku : e[0];
|
|
2310
|
+
}, Lr = (e) => e !== "" && !Number.isNaN(Number(e)), $e = {
|
|
2051
2311
|
price_desc: "price:desc",
|
|
2052
2312
|
price_asc: "price:asc",
|
|
2053
2313
|
orders_desc: "orders:desc",
|
|
@@ -2056,94 +2316,114 @@ const ir = (n, e) => {
|
|
|
2056
2316
|
release_desc: "release:desc",
|
|
2057
2317
|
discount_desc: "discount:desc",
|
|
2058
2318
|
score_desc: ""
|
|
2059
|
-
},
|
|
2060
|
-
product: async (
|
|
2061
|
-
const r =
|
|
2062
|
-
r &&
|
|
2319
|
+
}, Sn = "Invalid SkuId", Br = "Slug was set but the fetched sku does not satisfy the slug condition.", Mr = (e) => He(e) || e instanceof Error && (e.message === Sn || e.message.startsWith(Br)), $r = {
|
|
2320
|
+
product: async (e, { locator: n }, t) => {
|
|
2321
|
+
const r = Fe(n), i = _e(n), a = Wt(n), o = jt(n);
|
|
2322
|
+
r && ge(t, r), i && me(t, i);
|
|
2063
2323
|
const {
|
|
2064
2324
|
loaders: { skuLoader: s },
|
|
2065
2325
|
clients: { commerce: l, search: d }
|
|
2066
2326
|
} = t;
|
|
2067
2327
|
try {
|
|
2068
|
-
const g = a ??
|
|
2069
|
-
if (!
|
|
2070
|
-
throw new Error(
|
|
2071
|
-
const
|
|
2072
|
-
if (
|
|
2328
|
+
const g = a ?? o?.split("-").pop() ?? "";
|
|
2329
|
+
if (!Lr(g))
|
|
2330
|
+
throw new Error(Sn);
|
|
2331
|
+
const p = await s.load(g);
|
|
2332
|
+
if (o && p.isVariantOf.linkText && !o.startsWith(p.isVariantOf.linkText))
|
|
2073
2333
|
throw new Error(
|
|
2074
|
-
`Slug was set but the fetched sku does not satisfy the slug condition. slug: ${
|
|
2334
|
+
`Slug was set but the fetched sku does not satisfy the slug condition. slug: ${o}, linkText: ${p.isVariantOf.linkText}`
|
|
2075
2335
|
);
|
|
2076
|
-
return
|
|
2077
|
-
} catch {
|
|
2078
|
-
if (
|
|
2079
|
-
throw
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
throw new z(`No product found for id ${u.id}`);
|
|
2094
|
-
const p = On(o.items);
|
|
2095
|
-
return B(p, o);
|
|
2336
|
+
return p;
|
|
2337
|
+
} catch (g) {
|
|
2338
|
+
if (!Mr(g))
|
|
2339
|
+
throw g;
|
|
2340
|
+
if (o == null)
|
|
2341
|
+
throw new U("Missing slug or id");
|
|
2342
|
+
const p = await l.catalog.portal.pagetype(`${o}/p`);
|
|
2343
|
+
if (p.pageType !== "Product" || !p.id)
|
|
2344
|
+
throw new B(`No product found for slug ${o}`);
|
|
2345
|
+
const c = await d.fetchProduct({
|
|
2346
|
+
field: "id",
|
|
2347
|
+
value: String(p.id)
|
|
2348
|
+
}).catch(() => null);
|
|
2349
|
+
if (!c)
|
|
2350
|
+
throw new B(`No product found for id ${p.id}`);
|
|
2351
|
+
const u = Se(c.items);
|
|
2352
|
+
return L(u, c);
|
|
2096
2353
|
}
|
|
2097
2354
|
},
|
|
2098
|
-
collection: (
|
|
2355
|
+
collection: (e, { slug: n }, t) => {
|
|
2099
2356
|
const {
|
|
2100
2357
|
loaders: { collectionLoader: r }
|
|
2101
2358
|
} = t;
|
|
2102
|
-
return r.load(
|
|
2359
|
+
return r.load(n);
|
|
2103
2360
|
},
|
|
2104
|
-
search: async (
|
|
2105
|
-
first:
|
|
2361
|
+
search: async (e, {
|
|
2362
|
+
first: n,
|
|
2106
2363
|
after: t,
|
|
2107
2364
|
sort: r,
|
|
2108
2365
|
term: i,
|
|
2109
2366
|
selectedFacets: a,
|
|
2110
|
-
sponsoredCount:
|
|
2367
|
+
sponsoredCount: o
|
|
2111
2368
|
}, s) => {
|
|
2112
|
-
const l =
|
|
2113
|
-
l &&
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2369
|
+
const l = Fe(a), d = _e(a), g = qt(a);
|
|
2370
|
+
l && ge(s, l), d && me(s, d);
|
|
2371
|
+
const p = t ? Number(t) : 0, c = {
|
|
2372
|
+
page: Math.ceil(p / n) || 0,
|
|
2373
|
+
count: n,
|
|
2374
|
+
query: i ?? void 0,
|
|
2375
|
+
sort: $e[r ?? "score_desc"] ?? $e.score_desc,
|
|
2376
|
+
selectedFacets: a?.flatMap(Te) ?? [],
|
|
2377
|
+
sponsoredCount: o ?? void 0
|
|
2378
|
+
};
|
|
2379
|
+
if (g) {
|
|
2380
|
+
const S = (await s.clients.commerce.catalog.products.crossselling({
|
|
2381
|
+
type: rn[g.key],
|
|
2118
2382
|
productId: g.value
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2383
|
+
})).map((I) => I.productId).slice(0, n), f = s.clients.search.productsByIdentifier({ field: "id", values: S }).then((I) => ({
|
|
2384
|
+
products: I,
|
|
2385
|
+
recordsFiltered: I.length,
|
|
2386
|
+
pagination: {
|
|
2387
|
+
count: I.length,
|
|
2388
|
+
current: { index: 0, proxyURL: "" },
|
|
2389
|
+
before: [],
|
|
2390
|
+
after: [],
|
|
2391
|
+
perPage: n,
|
|
2392
|
+
next: { index: 0, proxyURL: "" },
|
|
2393
|
+
previous: { index: 0, proxyURL: "" },
|
|
2394
|
+
first: { index: 0, proxyURL: "" },
|
|
2395
|
+
last: { index: 0, proxyURL: "" }
|
|
2396
|
+
},
|
|
2397
|
+
sampling: !1,
|
|
2398
|
+
options: { sorts: [], counts: [] },
|
|
2399
|
+
translated: !1,
|
|
2400
|
+
locale: "",
|
|
2401
|
+
query: "",
|
|
2402
|
+
operator: "and",
|
|
2403
|
+
fuzzy: "0",
|
|
2404
|
+
searchId: ""
|
|
2405
|
+
}));
|
|
2406
|
+
return { searchArgs: c, productSearchPromise: f };
|
|
2407
|
+
}
|
|
2408
|
+
const u = s.clients.search.products(c);
|
|
2409
|
+
return { searchArgs: c, productSearchPromise: u };
|
|
2130
2410
|
},
|
|
2131
|
-
allProducts: async (
|
|
2411
|
+
allProducts: async (e, { first: n, after: t }, r) => {
|
|
2132
2412
|
const {
|
|
2133
2413
|
clients: { search: i }
|
|
2134
|
-
} = r, a = t ? Number(t) : 0,
|
|
2135
|
-
page: Math.ceil(a /
|
|
2136
|
-
count:
|
|
2137
|
-
}), s =
|
|
2138
|
-
(l) => l.items.map((d) =>
|
|
2414
|
+
} = r, a = t ? Number(t) : 0, o = await i.products({
|
|
2415
|
+
page: Math.ceil(a / n),
|
|
2416
|
+
count: n
|
|
2417
|
+
}), s = o.products.flatMap(
|
|
2418
|
+
(l) => l.items.map((d) => L(d, l))
|
|
2139
2419
|
).filter((l) => l.sellers.length > 0);
|
|
2140
2420
|
return {
|
|
2141
2421
|
pageInfo: {
|
|
2142
|
-
hasNextPage:
|
|
2143
|
-
hasPreviousPage:
|
|
2422
|
+
hasNextPage: o.pagination.after.length > 0,
|
|
2423
|
+
hasPreviousPage: o.pagination.before.length > 0,
|
|
2144
2424
|
startCursor: "0",
|
|
2145
|
-
endCursor:
|
|
2146
|
-
totalCount:
|
|
2425
|
+
endCursor: o.recordsFiltered.toString(),
|
|
2426
|
+
totalCount: o.recordsFiltered
|
|
2147
2427
|
},
|
|
2148
2428
|
// after + index is bigger than after+first itself because of the array flat() above
|
|
2149
2429
|
edges: s.map((l, d) => ({
|
|
@@ -2152,86 +2432,82 @@ const ir = (n, e) => {
|
|
|
2152
2432
|
}))
|
|
2153
2433
|
};
|
|
2154
2434
|
},
|
|
2155
|
-
products: async (
|
|
2435
|
+
products: async (e, { productIds: n }, t) => {
|
|
2156
2436
|
const {
|
|
2157
2437
|
clients: { search: r }
|
|
2158
2438
|
} = t;
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
count: e.length,
|
|
2165
|
-
query: i
|
|
2166
|
-
})).products.flatMap(
|
|
2167
|
-
(c) => c.items.map((s) => B(s, c))
|
|
2439
|
+
return n.length ? (await r.productsByIdentifier({
|
|
2440
|
+
field: "id",
|
|
2441
|
+
values: n
|
|
2442
|
+
})).flatMap(
|
|
2443
|
+
(a) => a.items.map((o) => L(o, a))
|
|
2168
2444
|
).filter(
|
|
2169
|
-
(
|
|
2170
|
-
);
|
|
2445
|
+
(a) => n.includes(a.itemId) && a.sellers.length > 0
|
|
2446
|
+
) : [];
|
|
2171
2447
|
},
|
|
2172
|
-
allCollections: async (
|
|
2448
|
+
allCollections: async (e, { first: n, after: t }, r) => {
|
|
2173
2449
|
const {
|
|
2174
2450
|
clients: { commerce: i }
|
|
2175
|
-
} = r, a = t ? Number(t) : 0, [
|
|
2451
|
+
} = r, a = t ? Number(t) : 0, [o, s] = await Promise.all([
|
|
2176
2452
|
i.catalog.brand.list(),
|
|
2177
2453
|
i.catalog.category.tree()
|
|
2178
|
-
]), l = [], d = (
|
|
2179
|
-
l.push({ ...
|
|
2180
|
-
for (const m of
|
|
2181
|
-
d(m,
|
|
2454
|
+
]), l = [], d = (c, u) => {
|
|
2455
|
+
l.push({ ...c, level: u });
|
|
2456
|
+
for (const m of c.children)
|
|
2457
|
+
d(m, u + 1);
|
|
2182
2458
|
};
|
|
2183
|
-
for (const
|
|
2184
|
-
d(
|
|
2185
|
-
const
|
|
2186
|
-
...
|
|
2459
|
+
for (const c of s)
|
|
2460
|
+
d(c, 0);
|
|
2461
|
+
const p = [
|
|
2462
|
+
...o.filter((c) => c.isActive).map((c) => ({ ...c, type: "brand" })),
|
|
2187
2463
|
...l
|
|
2188
|
-
].filter((
|
|
2464
|
+
].filter((c) => !!tn.slug(c, null, r, null));
|
|
2189
2465
|
return {
|
|
2190
2466
|
pageInfo: {
|
|
2191
|
-
hasNextPage:
|
|
2467
|
+
hasNextPage: p.length - a > n,
|
|
2192
2468
|
hasPreviousPage: a > 0,
|
|
2193
2469
|
startCursor: "0",
|
|
2194
|
-
endCursor: (Math.min(
|
|
2195
|
-
totalCount:
|
|
2470
|
+
endCursor: (Math.min(n, p.length - a) - 1).toString(),
|
|
2471
|
+
totalCount: p.length
|
|
2196
2472
|
},
|
|
2197
|
-
edges:
|
|
2198
|
-
node:
|
|
2199
|
-
cursor: (a +
|
|
2473
|
+
edges: p.slice(a, a + n).map((c, u) => ({
|
|
2474
|
+
node: c,
|
|
2475
|
+
cursor: (a + u).toString()
|
|
2200
2476
|
}))
|
|
2201
2477
|
};
|
|
2202
2478
|
},
|
|
2203
|
-
shipping: async (
|
|
2479
|
+
shipping: async (e, { country: n, items: t, postalCode: r }, i) => {
|
|
2204
2480
|
const {
|
|
2205
2481
|
loaders: { simulationLoader: a },
|
|
2206
|
-
clients: { commerce:
|
|
2482
|
+
clients: { commerce: o }
|
|
2207
2483
|
} = i, [s, l] = await Promise.all([
|
|
2208
|
-
a.load({ country:
|
|
2209
|
-
|
|
2484
|
+
a.load({ country: n, items: t, postalCode: r }),
|
|
2485
|
+
o.checkout.address({ postalCode: r, country: n })
|
|
2210
2486
|
]);
|
|
2211
2487
|
return {
|
|
2212
2488
|
...s,
|
|
2213
2489
|
address: l
|
|
2214
2490
|
};
|
|
2215
2491
|
},
|
|
2216
|
-
redirect: async (
|
|
2217
|
-
if (!
|
|
2492
|
+
redirect: async (e, { term: n, selectedFacets: t }, r) => {
|
|
2493
|
+
if (!n && (!t || !t.length))
|
|
2218
2494
|
return null;
|
|
2219
2495
|
const { redirect: i } = await r.clients.search.products({
|
|
2220
2496
|
page: 1,
|
|
2221
2497
|
count: 1,
|
|
2222
|
-
query:
|
|
2223
|
-
selectedFacets: t?.flatMap(
|
|
2498
|
+
query: n ?? void 0,
|
|
2499
|
+
selectedFacets: t?.flatMap(Te) ?? [],
|
|
2224
2500
|
allowRedirect: !0
|
|
2225
2501
|
});
|
|
2226
2502
|
return {
|
|
2227
2503
|
url: i
|
|
2228
2504
|
};
|
|
2229
2505
|
},
|
|
2230
|
-
sellers: async (
|
|
2506
|
+
sellers: async (e, { postalCode: n, geoCoordinates: t, country: r, salesChannel: i }, a) => {
|
|
2231
2507
|
const {
|
|
2232
|
-
clients: { commerce:
|
|
2233
|
-
} = a, l = (await
|
|
2234
|
-
postalCode:
|
|
2508
|
+
clients: { commerce: o }
|
|
2509
|
+
} = a, l = (await o.checkout.region({
|
|
2510
|
+
postalCode: n,
|
|
2235
2511
|
geoCoordinates: t,
|
|
2236
2512
|
country: r,
|
|
2237
2513
|
salesChannel: i
|
|
@@ -2241,10 +2517,10 @@ const ir = (n, e) => {
|
|
|
2241
2517
|
sellers: g
|
|
2242
2518
|
};
|
|
2243
2519
|
},
|
|
2244
|
-
profile: async (
|
|
2520
|
+
profile: async (e, { id: n }, t) => {
|
|
2245
2521
|
const {
|
|
2246
2522
|
clients: { commerce: r }
|
|
2247
|
-
} = t, i = await r.profile.addresses(
|
|
2523
|
+
} = t, i = await r.profile.addresses(n);
|
|
2248
2524
|
function a(s) {
|
|
2249
2525
|
return !s || Object.keys(s).length === 0 ? [] : Object.values(s).map(
|
|
2250
2526
|
(l) => JSON.parse(l)
|
|
@@ -2252,27 +2528,27 @@ const ir = (n, e) => {
|
|
|
2252
2528
|
}
|
|
2253
2529
|
return { addresses: a(i) };
|
|
2254
2530
|
},
|
|
2255
|
-
productCount: async (
|
|
2531
|
+
productCount: async (e, { term: n }, t) => {
|
|
2256
2532
|
const {
|
|
2257
2533
|
clients: { search: r }
|
|
2258
2534
|
} = t;
|
|
2259
2535
|
return await r.productCount({
|
|
2260
|
-
query:
|
|
2536
|
+
query: n ?? void 0
|
|
2261
2537
|
});
|
|
2262
2538
|
},
|
|
2263
|
-
userOrder: async (
|
|
2539
|
+
userOrder: async (e, { orderId: n }, t) => {
|
|
2264
2540
|
try {
|
|
2265
|
-
if (!
|
|
2266
|
-
throw new
|
|
2541
|
+
if (!n)
|
|
2542
|
+
throw new U("Missing orderId");
|
|
2267
2543
|
const {
|
|
2268
2544
|
clients: { commerce: r }
|
|
2269
|
-
} = t, i = await r.oms.userOrder({ orderId:
|
|
2545
|
+
} = t, i = await r.oms.userOrder({ orderId: n });
|
|
2270
2546
|
if (!i)
|
|
2271
|
-
throw new
|
|
2547
|
+
throw new B(`No order found for id ${n}`);
|
|
2272
2548
|
let a = null;
|
|
2273
2549
|
try {
|
|
2274
|
-
const l = await r.oms.getCommercialAuthorizationsByOrderId({ orderId:
|
|
2275
|
-
a =
|
|
2550
|
+
const l = await r.oms.getCommercialAuthorizationsByOrderId({ orderId: n });
|
|
2551
|
+
a = an(l);
|
|
2276
2552
|
} catch {
|
|
2277
2553
|
}
|
|
2278
2554
|
const s = (await r.masterData.getShopperById({
|
|
@@ -2310,16 +2586,16 @@ const ir = (n, e) => {
|
|
|
2310
2586
|
} catch {
|
|
2311
2587
|
a = { message: i };
|
|
2312
2588
|
}
|
|
2313
|
-
const
|
|
2314
|
-
throw
|
|
2315
|
-
`You are forbidden to interact with order with id ${
|
|
2589
|
+
const o = a?.message || i;
|
|
2590
|
+
throw He(r) ? new B(`No order found for id ${n}. ${o}.`) : jn(r) ? new re(
|
|
2591
|
+
`You are forbidden to interact with order with id ${n}. ${o}.`
|
|
2316
2592
|
) : r;
|
|
2317
2593
|
}
|
|
2318
2594
|
},
|
|
2319
|
-
listUserOrders: async (
|
|
2595
|
+
listUserOrders: async (e, n, t) => {
|
|
2320
2596
|
const {
|
|
2321
2597
|
clients: { commerce: r }
|
|
2322
|
-
} = t, i = await r.oms.listUserOrders(
|
|
2598
|
+
} = t, i = await r.oms.listUserOrders(n);
|
|
2323
2599
|
return {
|
|
2324
2600
|
list: i.list?.map((a) => ({
|
|
2325
2601
|
orderId: a.orderId,
|
|
@@ -2336,11 +2612,11 @@ const ir = (n, e) => {
|
|
|
2336
2612
|
paging: i.paging
|
|
2337
2613
|
};
|
|
2338
2614
|
},
|
|
2339
|
-
validateUser: async (
|
|
2615
|
+
validateUser: async (e, n, t) => ({
|
|
2340
2616
|
isValid: !0
|
|
2341
2617
|
}),
|
|
2342
2618
|
// only b2b users
|
|
2343
|
-
userDetails: async (
|
|
2619
|
+
userDetails: async (e, n, t) => {
|
|
2344
2620
|
const {
|
|
2345
2621
|
account: r,
|
|
2346
2622
|
headers: i,
|
|
@@ -2349,27 +2625,27 @@ const ir = (n, e) => {
|
|
|
2349
2625
|
a.session("").catch(() => null),
|
|
2350
2626
|
s ? a.masterData.getShopperById({ userId: s }).catch(() => null) : Promise.resolve(null),
|
|
2351
2627
|
s ? a.licenseManager.getUserRoles({ userId: s }).catch(() => null) : Promise.resolve(null)
|
|
2352
|
-
]),
|
|
2628
|
+
]), p = d?.[0], c = l?.namespaces.authentication ?? null, u = `${(p?.firstName ?? "").trim()} ${(p?.lastName ?? "").trim()}`.trim();
|
|
2353
2629
|
return {
|
|
2354
|
-
username:
|
|
2355
|
-
name:
|
|
2356
|
-
email:
|
|
2357
|
-
phone:
|
|
2630
|
+
username: c?.storeUserEmail?.value ?? "",
|
|
2631
|
+
name: u,
|
|
2632
|
+
email: c?.storeUserEmail?.value ?? "",
|
|
2633
|
+
phone: p?.phone ?? "",
|
|
2358
2634
|
role: g?.Roles?.map((m) => m.Name) ?? [],
|
|
2359
|
-
orgUnit:
|
|
2635
|
+
orgUnit: c?.unitName?.value ?? ""
|
|
2360
2636
|
};
|
|
2361
2637
|
},
|
|
2362
2638
|
// If isRepresentative, return b2b information.
|
|
2363
2639
|
// If not, return b2c user information
|
|
2364
|
-
accountProfile: async (
|
|
2640
|
+
accountProfile: async (e, n, t) => {
|
|
2365
2641
|
const {
|
|
2366
2642
|
account: r,
|
|
2367
2643
|
headers: i,
|
|
2368
2644
|
clients: { commerce: a }
|
|
2369
|
-
} = t,
|
|
2370
|
-
if (!
|
|
2645
|
+
} = t, o = Z(Q(i?.cookie ?? "", r));
|
|
2646
|
+
if (!o?.userId)
|
|
2371
2647
|
return null;
|
|
2372
|
-
if (
|
|
2648
|
+
if (o?.isRepresentative) {
|
|
2373
2649
|
const l = await a.session("").catch(() => null);
|
|
2374
2650
|
if (!l)
|
|
2375
2651
|
return null;
|
|
@@ -2384,7 +2660,7 @@ const ir = (n, e) => {
|
|
|
2384
2660
|
};
|
|
2385
2661
|
}
|
|
2386
2662
|
const s = await a.licenseManager.getUserById({
|
|
2387
|
-
userId:
|
|
2663
|
+
userId: o?.userId
|
|
2388
2664
|
}).catch(() => null);
|
|
2389
2665
|
return {
|
|
2390
2666
|
name: s?.name || "",
|
|
@@ -2393,17 +2669,17 @@ const ir = (n, e) => {
|
|
|
2393
2669
|
// createdAt: '',
|
|
2394
2670
|
};
|
|
2395
2671
|
},
|
|
2396
|
-
pickupPoints: async (
|
|
2672
|
+
pickupPoints: async (e, { geoCoordinates: n }, t) => {
|
|
2397
2673
|
const {
|
|
2398
2674
|
clients: { commerce: r }
|
|
2399
2675
|
} = t;
|
|
2400
2676
|
return await r.checkout.pickupPoints({
|
|
2401
|
-
geoCoordinates:
|
|
2677
|
+
geoCoordinates: n
|
|
2402
2678
|
});
|
|
2403
2679
|
},
|
|
2404
|
-
orderEntryOperation:
|
|
2405
|
-
orderFormItems:
|
|
2406
|
-
},
|
|
2680
|
+
orderEntryOperation: Rr,
|
|
2681
|
+
orderFormItems: Nr
|
|
2682
|
+
}, zr = {
|
|
2407
2683
|
reviewRating: () => ({
|
|
2408
2684
|
ratingValue: 5,
|
|
2409
2685
|
bestRating: 5
|
|
@@ -2411,43 +2687,43 @@ const ir = (n, e) => {
|
|
|
2411
2687
|
author: () => ({
|
|
2412
2688
|
name: ""
|
|
2413
2689
|
})
|
|
2414
|
-
},
|
|
2415
|
-
suggestions: async (
|
|
2690
|
+
}, Vr = (e, n, t) => n ? e.key === "category-1" : t ? e.key === "brand" : !1, xr = {
|
|
2691
|
+
suggestions: async (e, n, t) => {
|
|
2416
2692
|
const {
|
|
2417
2693
|
clients: { search: r }
|
|
2418
|
-
} = t, { searchArgs: i } =
|
|
2694
|
+
} = t, { searchArgs: i } = e;
|
|
2419
2695
|
if (!i.query)
|
|
2420
2696
|
return {
|
|
2421
|
-
terms: (await r.topSearches()).searches.map((
|
|
2422
|
-
value:
|
|
2423
|
-
count:
|
|
2697
|
+
terms: (await r.topSearches()).searches.map((p) => ({
|
|
2698
|
+
value: p.term,
|
|
2699
|
+
count: p.count
|
|
2424
2700
|
})),
|
|
2425
2701
|
products: []
|
|
2426
2702
|
};
|
|
2427
|
-
const { productSearchPromise: a } =
|
|
2703
|
+
const { productSearchPromise: a } = e, [o, s] = await Promise.all([
|
|
2428
2704
|
r.suggestedTerms(i),
|
|
2429
2705
|
a
|
|
2430
2706
|
]), l = s.products.map((g) => {
|
|
2431
|
-
const
|
|
2432
|
-
return
|
|
2433
|
-
}).filter((g) => !!g), { searches: d } =
|
|
2707
|
+
const p = Se(g.items);
|
|
2708
|
+
return p && L(p, g);
|
|
2709
|
+
}).filter((g) => !!g), { searches: d } = o;
|
|
2434
2710
|
return {
|
|
2435
2711
|
terms: d.map((g) => ({ value: g.term, count: g.count })),
|
|
2436
2712
|
products: l
|
|
2437
2713
|
};
|
|
2438
2714
|
},
|
|
2439
|
-
products: async ({ productSearchPromise:
|
|
2440
|
-
const
|
|
2441
|
-
const i =
|
|
2442
|
-
return i &&
|
|
2715
|
+
products: async ({ productSearchPromise: e }) => {
|
|
2716
|
+
const n = await e, t = n.products.map((r) => {
|
|
2717
|
+
const i = Se(r.items);
|
|
2718
|
+
return i && L(i, r);
|
|
2443
2719
|
}).filter((r) => !!r);
|
|
2444
2720
|
return {
|
|
2445
2721
|
pageInfo: {
|
|
2446
|
-
hasNextPage:
|
|
2447
|
-
hasPreviousPage:
|
|
2722
|
+
hasNextPage: n.pagination.after.length > 0,
|
|
2723
|
+
hasPreviousPage: n.pagination.before.length > 0,
|
|
2448
2724
|
startCursor: "0",
|
|
2449
|
-
endCursor:
|
|
2450
|
-
totalCount:
|
|
2725
|
+
endCursor: n.recordsFiltered.toString(),
|
|
2726
|
+
totalCount: n.recordsFiltered
|
|
2451
2727
|
},
|
|
2452
2728
|
edges: t.map((r, i) => ({
|
|
2453
2729
|
node: r,
|
|
@@ -2455,31 +2731,31 @@ const ir = (n, e) => {
|
|
|
2455
2731
|
}))
|
|
2456
2732
|
};
|
|
2457
2733
|
},
|
|
2458
|
-
facets: async ({ searchArgs:
|
|
2734
|
+
facets: async ({ searchArgs: e }, n, t) => {
|
|
2459
2735
|
const {
|
|
2460
2736
|
clients: { search: r }
|
|
2461
2737
|
} = t;
|
|
2462
|
-
t.storage.searchArgs =
|
|
2463
|
-
const { facets: i = [] } = await r.facets(
|
|
2738
|
+
t.storage.searchArgs = e;
|
|
2739
|
+
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;
|
|
2464
2740
|
return i.filter(
|
|
2465
|
-
(d) => !a || !
|
|
2741
|
+
(d) => !a || !Vr(d, o, s)
|
|
2466
2742
|
);
|
|
2467
2743
|
},
|
|
2468
|
-
metadata: async ({ productSearchPromise:
|
|
2469
|
-
const
|
|
2744
|
+
metadata: async ({ productSearchPromise: e }) => {
|
|
2745
|
+
const n = await e;
|
|
2470
2746
|
return {
|
|
2471
|
-
isTermMisspelled:
|
|
2472
|
-
logicalOperator:
|
|
2473
|
-
fuzzy:
|
|
2747
|
+
isTermMisspelled: n.correction?.misspelled ?? !1,
|
|
2748
|
+
logicalOperator: n.operator,
|
|
2749
|
+
fuzzy: n.fuzzy
|
|
2474
2750
|
};
|
|
2475
2751
|
},
|
|
2476
|
-
searchId: async ({ productSearchPromise:
|
|
2477
|
-
},
|
|
2478
|
-
title: ({ title:
|
|
2479
|
-
description: ({ description:
|
|
2480
|
-
canonical: ({ canonical:
|
|
2752
|
+
searchId: async ({ productSearchPromise: e }) => (await e).searchId
|
|
2753
|
+
}, qr = {
|
|
2754
|
+
title: ({ title: e }) => e ?? "",
|
|
2755
|
+
description: ({ description: e }) => e ?? "",
|
|
2756
|
+
canonical: ({ canonical: e }) => e ?? "",
|
|
2481
2757
|
titleTemplate: () => ""
|
|
2482
|
-
},
|
|
2758
|
+
}, jr = ["bd", "d", "h", "m"], Wr = (e) => jr.includes(e), Gr = {
|
|
2483
2759
|
bd: {
|
|
2484
2760
|
0: "Today",
|
|
2485
2761
|
1: "In 1 business day",
|
|
@@ -2500,86 +2776,86 @@ const ir = (n, e) => {
|
|
|
2500
2776
|
1: "In 1 minute",
|
|
2501
2777
|
other: "Up to # minutes"
|
|
2502
2778
|
}
|
|
2503
|
-
},
|
|
2504
|
-
const [
|
|
2779
|
+
}, yn = (e) => {
|
|
2780
|
+
const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = Wr(t);
|
|
2505
2781
|
if (!r || !i)
|
|
2506
2782
|
return "";
|
|
2507
|
-
const a = Number(
|
|
2508
|
-
return
|
|
2509
|
-
},
|
|
2510
|
-
carrier: (
|
|
2511
|
-
price: (
|
|
2512
|
-
localizedEstimates: (
|
|
2513
|
-
},
|
|
2514
|
-
function
|
|
2515
|
-
const t = `${
|
|
2783
|
+
const a = Number(n) < 2 ? Number(n) : "other";
|
|
2784
|
+
return Gr[t][a].replace("#", n) ?? "";
|
|
2785
|
+
}, Hr = {
|
|
2786
|
+
carrier: (e) => e?.friendlyName ?? e?.name ?? "",
|
|
2787
|
+
price: (e) => e?.price ? e.price / 100 : e?.price,
|
|
2788
|
+
localizedEstimates: (e) => e?.shippingEstimate ? yn(e.shippingEstimate) : ""
|
|
2789
|
+
}, ze = "skuvariation";
|
|
2790
|
+
function Ve(e, n) {
|
|
2791
|
+
const t = `${ze}${n}`.toLowerCase(), r = e.find(
|
|
2516
2792
|
(a) => a.imageLabel === t
|
|
2517
2793
|
);
|
|
2518
2794
|
if (r)
|
|
2519
2795
|
return r;
|
|
2520
|
-
const i =
|
|
2521
|
-
(a) => a.imageLabel ===
|
|
2796
|
+
const i = e.find(
|
|
2797
|
+
(a) => a.imageLabel === ze
|
|
2522
2798
|
);
|
|
2523
|
-
return i ||
|
|
2799
|
+
return i || e[0];
|
|
2524
2800
|
}
|
|
2525
|
-
function
|
|
2801
|
+
function Xr(e, n, t) {
|
|
2526
2802
|
const r = {};
|
|
2527
|
-
return
|
|
2803
|
+
return e.forEach((i) => {
|
|
2528
2804
|
const a = i.variations;
|
|
2529
2805
|
if (a.length === 0)
|
|
2530
2806
|
return;
|
|
2531
|
-
const
|
|
2532
|
-
(l) => l.name ===
|
|
2533
|
-
)?.values[0] ?? ""}`, s = a.reduce((l, d) => d.name ===
|
|
2807
|
+
const o = `${n}-${a.find(
|
|
2808
|
+
(l) => l.name === n
|
|
2809
|
+
)?.values[0] ?? ""}`, s = a.reduce((l, d) => d.name === n ? l : l + `-${d.name}-${d.values[0]}`, o);
|
|
2534
2810
|
r[s] = `${t}-${i.itemId}`;
|
|
2535
2811
|
}), r;
|
|
2536
2812
|
}
|
|
2537
|
-
function
|
|
2538
|
-
const
|
|
2539
|
-
return
|
|
2540
|
-
|
|
2541
|
-
}),
|
|
2542
|
-
}
|
|
2543
|
-
function
|
|
2544
|
-
const
|
|
2545
|
-
return
|
|
2546
|
-
|
|
2547
|
-
}),
|
|
2548
|
-
}
|
|
2549
|
-
function
|
|
2550
|
-
return Number.isNaN(Number(
|
|
2551
|
-
}
|
|
2552
|
-
function
|
|
2553
|
-
const
|
|
2554
|
-
for (const t in
|
|
2555
|
-
|
|
2813
|
+
function xe(e) {
|
|
2814
|
+
const n = {};
|
|
2815
|
+
return e.forEach((t) => {
|
|
2816
|
+
n[t.name] = t.values[0];
|
|
2817
|
+
}), n;
|
|
2818
|
+
}
|
|
2819
|
+
function Yr(e) {
|
|
2820
|
+
const n = {};
|
|
2821
|
+
return e?.forEach((t) => {
|
|
2822
|
+
n[t.field.originalName ?? t.field.name] = t.values.map((r) => r.originalName ?? r.name);
|
|
2823
|
+
}), n;
|
|
2824
|
+
}
|
|
2825
|
+
function Jr(e, n) {
|
|
2826
|
+
return Number.isNaN(Number(e) - Number(n)) ? e < n ? -1 : e > n ? 1 : 0 : Number(e) - Number(n);
|
|
2827
|
+
}
|
|
2828
|
+
function Kr(e) {
|
|
2829
|
+
const n = e;
|
|
2830
|
+
for (const t in e)
|
|
2831
|
+
e[t].every(
|
|
2556
2832
|
(i) => !Number.isNaN(Number(i.value))
|
|
2557
|
-
) &&
|
|
2558
|
-
return
|
|
2833
|
+
) && e[t].sort((i, a) => Jr(i.value, a.value));
|
|
2834
|
+
return n;
|
|
2559
2835
|
}
|
|
2560
|
-
function
|
|
2836
|
+
function Qr(e, n, t) {
|
|
2561
2837
|
const r = {}, i = /* @__PURE__ */ new Set();
|
|
2562
|
-
return
|
|
2838
|
+
return e.forEach((a) => {
|
|
2563
2839
|
if (a.variations.length === 0)
|
|
2564
2840
|
return;
|
|
2565
|
-
const
|
|
2566
|
-
(l) => l.name ===
|
|
2841
|
+
const o = a.variations.find(
|
|
2842
|
+
(l) => l.name === n
|
|
2567
2843
|
);
|
|
2568
|
-
if (!(
|
|
2569
|
-
const l = `${
|
|
2570
|
-
if (!
|
|
2844
|
+
if (!(o?.values[0] === t)) {
|
|
2845
|
+
const l = `${n}-${o?.values[0]}`;
|
|
2846
|
+
if (!o || i.has(l))
|
|
2571
2847
|
return;
|
|
2572
2848
|
i.add(l);
|
|
2573
|
-
const d =
|
|
2849
|
+
const d = Ve(
|
|
2574
2850
|
a.images,
|
|
2575
|
-
|
|
2851
|
+
n
|
|
2576
2852
|
), g = {
|
|
2577
2853
|
src: d.imageUrl,
|
|
2578
2854
|
alt: d.imageLabel ?? "",
|
|
2579
|
-
label: `${
|
|
2580
|
-
value:
|
|
2855
|
+
label: `${n}: ${o.values[0]}`,
|
|
2856
|
+
value: o.values[0]
|
|
2581
2857
|
};
|
|
2582
|
-
r[
|
|
2858
|
+
r[o.name] ? r[o.name].push(g) : r[o.name] = [g];
|
|
2583
2859
|
return;
|
|
2584
2860
|
}
|
|
2585
2861
|
a.variations.forEach((l) => {
|
|
@@ -2587,108 +2863,108 @@ function Ar(n, e, t) {
|
|
|
2587
2863
|
if (i.has(d))
|
|
2588
2864
|
return;
|
|
2589
2865
|
i.add(d);
|
|
2590
|
-
const g =
|
|
2866
|
+
const g = Ve(
|
|
2591
2867
|
a.images,
|
|
2592
2868
|
l.name
|
|
2593
|
-
),
|
|
2869
|
+
), p = {
|
|
2594
2870
|
src: g.imageUrl,
|
|
2595
2871
|
alt: g.imageText ?? "",
|
|
2596
2872
|
label: `${l.name}: ${l.values[0]}`,
|
|
2597
2873
|
value: l.values[0]
|
|
2598
2874
|
};
|
|
2599
|
-
r[l.name] ? r[l.name].push(
|
|
2875
|
+
r[l.name] ? r[l.name].push(p) : r[l.name] = [p];
|
|
2600
2876
|
});
|
|
2601
|
-
}),
|
|
2602
|
-
}
|
|
2603
|
-
const
|
|
2604
|
-
activeVariations: (
|
|
2605
|
-
allVariantsByName: (
|
|
2606
|
-
slugsMap: (
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2877
|
+
}), Kr(r);
|
|
2878
|
+
}
|
|
2879
|
+
const Zr = {
|
|
2880
|
+
activeVariations: (e) => xe(e.variations),
|
|
2881
|
+
allVariantsByName: (e) => Yr(e.isVariantOf.skuSpecifications),
|
|
2882
|
+
slugsMap: (e, n) => Xr(
|
|
2883
|
+
e.isVariantOf.items,
|
|
2884
|
+
n.dominantVariantName ?? e.variations[0]?.name,
|
|
2885
|
+
e.isVariantOf.linkText
|
|
2610
2886
|
),
|
|
2611
|
-
availableVariations: (
|
|
2612
|
-
const t =
|
|
2613
|
-
return
|
|
2614
|
-
|
|
2887
|
+
availableVariations: (e, n) => {
|
|
2888
|
+
const t = n.dominantVariantName ?? e.variations[0]?.name, i = xe(e.variations)[t];
|
|
2889
|
+
return Qr(
|
|
2890
|
+
e.isVariantOf.items,
|
|
2615
2891
|
t,
|
|
2616
2892
|
i
|
|
2617
2893
|
);
|
|
2618
2894
|
},
|
|
2619
|
-
allVariantProducts: (
|
|
2620
|
-
},
|
|
2895
|
+
allVariantProducts: (e) => e.isVariantOf.items.map((n) => L(n, e.isVariantOf))
|
|
2896
|
+
}, ei = {
|
|
2621
2897
|
"pickup-in-point": "Pickup",
|
|
2622
2898
|
delivery: "Delivery",
|
|
2623
2899
|
pickup: "Pickup",
|
|
2624
2900
|
"take-away": "Take away",
|
|
2625
2901
|
"": ""
|
|
2626
|
-
},
|
|
2627
|
-
deliveryOptionsData: (
|
|
2628
|
-
const { shippingData:
|
|
2902
|
+
}, ni = {
|
|
2903
|
+
deliveryOptionsData: (e) => {
|
|
2904
|
+
const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
|
|
2629
2905
|
(d, g) => {
|
|
2630
|
-
const
|
|
2631
|
-
(
|
|
2632
|
-
), C = `${
|
|
2633
|
-
|
|
2634
|
-
),
|
|
2906
|
+
const p = g?.selectedSla || "", c = g?.selectedDeliveryChannel || g?.deliveryChannel || "", u = g?.deliveryCompany || "", m = g?.deliveryWindow, S = g?.pickupStoreInfo, f = g?.shippingEstimate || "", I = g?.shippingEstimate ? yn(g?.shippingEstimate) : "", D = g?.shippingEstimateDate || "", E = g?.addressId || "", w = g?.itemIndex ?? 0, O = t?.[w], P = O?.seller || "", h = `${p}|${c}|${u}|${P}|${f}|${D}|${E}|${m?.startDateUtc}|${m?.endDateUtc}`, b = i?.find(
|
|
2907
|
+
(_) => _?.addressId === E
|
|
2908
|
+
), C = `${ei[c] || ""} ${I} ${b?.neighborhood ? `to ${b?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: A, taxPriceTags: v } = ti(
|
|
2909
|
+
O?.priceTags ?? []
|
|
2910
|
+
), T = (O?.sellingPrice ?? 0) * (O?.quantity ?? 0) + (O?.tax ?? 0) + (A ?? 0);
|
|
2635
2911
|
return d[h] || (d[h] = {
|
|
2636
2912
|
// static fields
|
|
2637
|
-
selectedSla:
|
|
2638
|
-
deliveryChannel:
|
|
2639
|
-
deliveryCompany:
|
|
2913
|
+
selectedSla: p,
|
|
2914
|
+
deliveryChannel: c,
|
|
2915
|
+
deliveryCompany: u,
|
|
2640
2916
|
deliveryWindow: m,
|
|
2641
|
-
shippingEstimate:
|
|
2642
|
-
shippingEstimateDate:
|
|
2643
|
-
seller:
|
|
2644
|
-
friendlyShippingEstimate:
|
|
2917
|
+
shippingEstimate: f,
|
|
2918
|
+
shippingEstimateDate: D,
|
|
2919
|
+
seller: P,
|
|
2920
|
+
friendlyShippingEstimate: I,
|
|
2645
2921
|
friendlyDeliveryOptionName: C,
|
|
2646
|
-
address:
|
|
2922
|
+
address: b,
|
|
2647
2923
|
pickupStoreInfo: S,
|
|
2648
2924
|
// dynamic fields
|
|
2649
2925
|
quantityOfDifferentItems: 0,
|
|
2650
2926
|
total: 0,
|
|
2651
2927
|
items: []
|
|
2652
2928
|
}), d[h] && (d[h].items?.push({
|
|
2653
|
-
id:
|
|
2654
|
-
uniqueId:
|
|
2655
|
-
name:
|
|
2656
|
-
quantity:
|
|
2657
|
-
price:
|
|
2658
|
-
sellingPrice:
|
|
2659
|
-
imageUrl:
|
|
2660
|
-
taxPriceTags:
|
|
2661
|
-
taxPriceTagsTotal:
|
|
2662
|
-
tax:
|
|
2663
|
-
total:
|
|
2664
|
-
}), d[h].quantityOfDifferentItems = (d[h].quantityOfDifferentItems ?? 0) + 1, d[h].total = (d[h].total ?? 0) +
|
|
2929
|
+
id: O?.id || "",
|
|
2930
|
+
uniqueId: O?.uniqueId || "",
|
|
2931
|
+
name: O?.name || "",
|
|
2932
|
+
quantity: O?.quantity || 0,
|
|
2933
|
+
price: O?.price || 0,
|
|
2934
|
+
sellingPrice: O?.sellingPrice || 0,
|
|
2935
|
+
imageUrl: O?.imageUrl || "",
|
|
2936
|
+
taxPriceTags: v ?? [],
|
|
2937
|
+
taxPriceTagsTotal: A ?? 0,
|
|
2938
|
+
tax: O?.tax || 0,
|
|
2939
|
+
total: T
|
|
2940
|
+
}), d[h].quantityOfDifferentItems = (d[h].quantityOfDifferentItems ?? 0) + 1, d[h].total = (d[h].total ?? 0) + T), d;
|
|
2665
2941
|
},
|
|
2666
2942
|
{}
|
|
2667
|
-
),
|
|
2668
|
-
name: `${s?.firstName ?? ""} ${s?.lastName ?? ""}`.trim() ||
|
|
2943
|
+
), o = Object.values(a), s = n?.contactInformation?.[0], l = {
|
|
2944
|
+
name: `${s?.firstName ?? ""} ${s?.lastName ?? ""}`.trim() || o?.[0]?.address?.receiverName || "",
|
|
2669
2945
|
email: s?.email || "",
|
|
2670
2946
|
phone: s?.phone || ""
|
|
2671
2947
|
};
|
|
2672
2948
|
return {
|
|
2673
|
-
deliveryOptions:
|
|
2949
|
+
deliveryOptions: o,
|
|
2674
2950
|
contact: l
|
|
2675
2951
|
};
|
|
2676
2952
|
},
|
|
2677
|
-
customFields: (
|
|
2678
|
-
const
|
|
2953
|
+
customFields: (e) => {
|
|
2954
|
+
const n = e?.customData?.customFields || [];
|
|
2679
2955
|
return Object.values(
|
|
2680
|
-
|
|
2956
|
+
n.reduce(
|
|
2681
2957
|
(t, r) => {
|
|
2682
|
-
const i = r?.linkedEntity?.type || "", a = r?.linkedEntity?.id || "",
|
|
2683
|
-
return t[
|
|
2958
|
+
const i = r?.linkedEntity?.type || "", a = r?.linkedEntity?.id || "", o = `${i}|${a || ""}`;
|
|
2959
|
+
return t[o] || (t[o] = { type: i, id: a, fields: [] }), t[o].fields.push(...r?.fields || []), t;
|
|
2684
2960
|
},
|
|
2685
2961
|
{}
|
|
2686
2962
|
)
|
|
2687
2963
|
) || [];
|
|
2688
2964
|
}
|
|
2689
2965
|
};
|
|
2690
|
-
function
|
|
2691
|
-
const t =
|
|
2966
|
+
function ti(e) {
|
|
2967
|
+
const t = e.filter(
|
|
2692
2968
|
(i) => i?.name?.includes("TAX")
|
|
2693
2969
|
), r = t.reduce(
|
|
2694
2970
|
(i, a) => i + (a.rawValue ? a.rawValue * 100 : 0),
|
|
@@ -2699,28 +2975,28 @@ function _r(n) {
|
|
|
2699
2975
|
taxPriceTagsTotal: r
|
|
2700
2976
|
};
|
|
2701
2977
|
}
|
|
2702
|
-
const
|
|
2703
|
-
StoreCollection:
|
|
2704
|
-
StoreAggregateOffer:
|
|
2705
|
-
StoreProduct:
|
|
2706
|
-
StoreSeo:
|
|
2707
|
-
StoreFacet:
|
|
2708
|
-
StoreFacetBoolean:
|
|
2709
|
-
StoreFacetRange:
|
|
2710
|
-
StoreFacetValueBoolean:
|
|
2711
|
-
StoreOffer:
|
|
2712
|
-
StoreAggregateRating:
|
|
2713
|
-
StoreReview:
|
|
2714
|
-
StoreProductGroup:
|
|
2715
|
-
StoreSearchResult:
|
|
2716
|
-
StorePropertyValue:
|
|
2717
|
-
SkuVariants:
|
|
2718
|
-
ShippingSLA:
|
|
2719
|
-
UserOrderResult:
|
|
2720
|
-
ObjectOrString:
|
|
2721
|
-
Query:
|
|
2722
|
-
Mutation:
|
|
2723
|
-
},
|
|
2978
|
+
const ri = {
|
|
2979
|
+
StoreCollection: tn,
|
|
2980
|
+
StoreAggregateOffer: Bt,
|
|
2981
|
+
StoreProduct: Tr,
|
|
2982
|
+
StoreSeo: qr,
|
|
2983
|
+
StoreFacet: Gt,
|
|
2984
|
+
StoreFacetBoolean: Ht,
|
|
2985
|
+
StoreFacetRange: Xt,
|
|
2986
|
+
StoreFacetValueBoolean: Yt,
|
|
2987
|
+
StoreOffer: br,
|
|
2988
|
+
StoreAggregateRating: Mt,
|
|
2989
|
+
StoreReview: zr,
|
|
2990
|
+
StoreProductGroup: _r,
|
|
2991
|
+
StoreSearchResult: xr,
|
|
2992
|
+
StorePropertyValue: Fr,
|
|
2993
|
+
SkuVariants: Zr,
|
|
2994
|
+
ShippingSLA: Hr,
|
|
2995
|
+
UserOrderResult: ni,
|
|
2996
|
+
ObjectOrString: Cr,
|
|
2997
|
+
Query: $r,
|
|
2998
|
+
Mutation: Ir
|
|
2999
|
+
}, ii = () => ri, ai = `"""
|
|
2724
3000
|
Address information.
|
|
2725
3001
|
"""
|
|
2726
3002
|
type Address {
|
|
@@ -2765,7 +3041,7 @@ type Address {
|
|
|
2765
3041
|
"""
|
|
2766
3042
|
geoCoordinates: [Float]
|
|
2767
3043
|
}
|
|
2768
|
-
`,
|
|
3044
|
+
`, oi = `"""
|
|
2769
3045
|
Advertisement information about a specific product in a campaign
|
|
2770
3046
|
"""
|
|
2771
3047
|
type Advertisement {
|
|
@@ -2790,7 +3066,7 @@ type Advertisement {
|
|
|
2790
3066
|
"""
|
|
2791
3067
|
adResponseId: String!
|
|
2792
3068
|
}
|
|
2793
|
-
`,
|
|
3069
|
+
`, si = `"""
|
|
2794
3070
|
Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.
|
|
2795
3071
|
"""
|
|
2796
3072
|
type StoreAggregateOffer {
|
|
@@ -2819,7 +3095,7 @@ type StoreAggregateOffer {
|
|
|
2819
3095
|
"""
|
|
2820
3096
|
offers: [StoreOffer!]!
|
|
2821
3097
|
}
|
|
2822
|
-
`,
|
|
3098
|
+
`, ci = `"""
|
|
2823
3099
|
Average rating, based on multiple ratings or reviews.
|
|
2824
3100
|
"""
|
|
2825
3101
|
type StoreAggregateRating {
|
|
@@ -2832,7 +3108,7 @@ type StoreAggregateRating {
|
|
|
2832
3108
|
"""
|
|
2833
3109
|
reviewCount: Int!
|
|
2834
3110
|
}
|
|
2835
|
-
`,
|
|
3111
|
+
`, li = `"""
|
|
2836
3112
|
information about the author of a product review or rating.
|
|
2837
3113
|
"""
|
|
2838
3114
|
type StoreAuthor {
|
|
@@ -2841,7 +3117,7 @@ type StoreAuthor {
|
|
|
2841
3117
|
"""
|
|
2842
3118
|
name: String!
|
|
2843
3119
|
}
|
|
2844
|
-
`,
|
|
3120
|
+
`, di = `"""
|
|
2845
3121
|
Brand of a given product.
|
|
2846
3122
|
"""
|
|
2847
3123
|
type StoreBrand {
|
|
@@ -2850,7 +3126,7 @@ type StoreBrand {
|
|
|
2850
3126
|
"""
|
|
2851
3127
|
name: String!
|
|
2852
3128
|
}
|
|
2853
|
-
`,
|
|
3129
|
+
`, ui = `"""
|
|
2854
3130
|
Item of a list.
|
|
2855
3131
|
"""
|
|
2856
3132
|
type StoreListItem {
|
|
@@ -2881,7 +3157,7 @@ type StoreBreadcrumbList {
|
|
|
2881
3157
|
"""
|
|
2882
3158
|
numberOfItems: Int!
|
|
2883
3159
|
}
|
|
2884
|
-
`,
|
|
3160
|
+
`, pi = `"""
|
|
2885
3161
|
Shopping cart message.
|
|
2886
3162
|
"""
|
|
2887
3163
|
type StoreCartMessage {
|
|
@@ -2918,7 +3194,7 @@ input IStoreCart {
|
|
|
2918
3194
|
"""
|
|
2919
3195
|
order: IStoreOrder!
|
|
2920
3196
|
}
|
|
2921
|
-
`,
|
|
3197
|
+
`, gi = `"""
|
|
2922
3198
|
Product collection type. Possible values are \`Department\`, \`Category\`, \`Brand\`, \`Cluster\`, \`SubCategory\` or \`Collection\`.
|
|
2923
3199
|
"""
|
|
2924
3200
|
enum StoreCollectionType {
|
|
@@ -3001,7 +3277,7 @@ type StoreCollection {
|
|
|
3001
3277
|
"""
|
|
3002
3278
|
type: StoreCollectionType!
|
|
3003
3279
|
}
|
|
3004
|
-
`,
|
|
3280
|
+
`, mi = `"""
|
|
3005
3281
|
Delivery Promise badge.
|
|
3006
3282
|
"""
|
|
3007
3283
|
type DeliveryPromiseBadge {
|
|
@@ -3010,7 +3286,7 @@ type DeliveryPromiseBadge {
|
|
|
3010
3286
|
"""
|
|
3011
3287
|
typeName: String
|
|
3012
3288
|
}
|
|
3013
|
-
`,
|
|
3289
|
+
`, hi = `union StoreFacet = StoreFacetRange | StoreFacetBoolean
|
|
3014
3290
|
|
|
3015
3291
|
"""
|
|
3016
3292
|
Search facet range information.
|
|
@@ -3087,7 +3363,7 @@ type StoreFacetValueBoolean {
|
|
|
3087
3363
|
"""
|
|
3088
3364
|
quantity: Int
|
|
3089
3365
|
}
|
|
3090
|
-
`,
|
|
3366
|
+
`, fi = `"""
|
|
3091
3367
|
Image.
|
|
3092
3368
|
"""
|
|
3093
3369
|
type StoreImage {
|
|
@@ -3114,7 +3390,7 @@ input IStoreImage {
|
|
|
3114
3390
|
"""
|
|
3115
3391
|
alternateName: String!
|
|
3116
3392
|
}
|
|
3117
|
-
`,
|
|
3393
|
+
`, Si = `type Mutation {
|
|
3118
3394
|
"""
|
|
3119
3395
|
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\`.
|
|
3120
3396
|
"""
|
|
@@ -3152,7 +3428,7 @@ input IStoreImage {
|
|
|
3152
3428
|
data: IOrderEntryOperation!
|
|
3153
3429
|
): StoreOrderEntryOperationResult @auth
|
|
3154
3430
|
}
|
|
3155
|
-
`,
|
|
3431
|
+
`, yi = `"""
|
|
3156
3432
|
Newsletter information.
|
|
3157
3433
|
"""
|
|
3158
3434
|
type PersonNewsletter {
|
|
@@ -3175,8 +3451,8 @@ input IPersonNewsletter {
|
|
|
3175
3451
|
"""
|
|
3176
3452
|
email: String!
|
|
3177
3453
|
}
|
|
3178
|
-
`,
|
|
3179
|
-
`,
|
|
3454
|
+
`, Ii = `scalar ObjectOrString
|
|
3455
|
+
`, vi = `"""
|
|
3180
3456
|
Offer information.
|
|
3181
3457
|
"""
|
|
3182
3458
|
type StoreOffer {
|
|
@@ -3259,7 +3535,7 @@ input IStoreOffer {
|
|
|
3259
3535
|
"""
|
|
3260
3536
|
quantity: Int!
|
|
3261
3537
|
}
|
|
3262
|
-
`,
|
|
3538
|
+
`, Oi = `"""
|
|
3263
3539
|
Information of a specific order.
|
|
3264
3540
|
"""
|
|
3265
3541
|
type StoreOrder {
|
|
@@ -3294,7 +3570,7 @@ input IStoreOrder {
|
|
|
3294
3570
|
"""
|
|
3295
3571
|
shouldSplitItem: Boolean
|
|
3296
3572
|
}
|
|
3297
|
-
`,
|
|
3573
|
+
`, Ci = `"""
|
|
3298
3574
|
Commercial Authorization response.
|
|
3299
3575
|
"""
|
|
3300
3576
|
type CommercialAuthorizationResponse {
|
|
@@ -3693,7 +3969,7 @@ type ProcessOrderAuthorizationRule {
|
|
|
3693
3969
|
"""
|
|
3694
3970
|
rule: CommercialAuthorizationRule!
|
|
3695
3971
|
}
|
|
3696
|
-
`,
|
|
3972
|
+
`, bi = `"""
|
|
3697
3973
|
Input for uploading a file to the Order Entry Service.
|
|
3698
3974
|
The file is transmitted as a Base64-encoded string so it can travel
|
|
3699
3975
|
through the standard GraphQL JSON pipeline without multipart support.
|
|
@@ -3754,7 +4030,7 @@ type StoreOrderFormCartItem {
|
|
|
3754
4030
|
seller: String!
|
|
3755
4031
|
unitMultiplier: Float
|
|
3756
4032
|
}
|
|
3757
|
-
`,
|
|
4033
|
+
`, Di = `"""
|
|
3758
4034
|
Organization.
|
|
3759
4035
|
"""
|
|
3760
4036
|
type StoreOrganization {
|
|
@@ -3773,7 +4049,7 @@ input IStoreOrganization {
|
|
|
3773
4049
|
"""
|
|
3774
4050
|
identifier: String!
|
|
3775
4051
|
}
|
|
3776
|
-
`,
|
|
4052
|
+
`, wi = `"""
|
|
3777
4053
|
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.
|
|
3778
4054
|
"""
|
|
3779
4055
|
type StorePageInfo {
|
|
@@ -3798,7 +4074,7 @@ type StorePageInfo {
|
|
|
3798
4074
|
"""
|
|
3799
4075
|
totalCount: Int!
|
|
3800
4076
|
}
|
|
3801
|
-
`,
|
|
4077
|
+
`, Pi = `"""
|
|
3802
4078
|
Input type for setting a new password.
|
|
3803
4079
|
"""
|
|
3804
4080
|
input ISetPassword {
|
|
@@ -3841,7 +4117,7 @@ type SetPasswordResponse {
|
|
|
3841
4117
|
"""
|
|
3842
4118
|
message: String
|
|
3843
4119
|
}
|
|
3844
|
-
`,
|
|
4120
|
+
`, Ai = `"""
|
|
3845
4121
|
Client profile data.
|
|
3846
4122
|
"""
|
|
3847
4123
|
type StorePerson {
|
|
@@ -3884,7 +4160,7 @@ input IStorePerson {
|
|
|
3884
4160
|
"""
|
|
3885
4161
|
familyName: String!
|
|
3886
4162
|
}
|
|
3887
|
-
`,
|
|
4163
|
+
`, Ei = `type PickupPointAddress {
|
|
3888
4164
|
"""
|
|
3889
4165
|
Address city.
|
|
3890
4166
|
"""
|
|
@@ -3963,7 +4239,7 @@ type PickupPoints {
|
|
|
3963
4239
|
"""
|
|
3964
4240
|
pickupPointsHash: String
|
|
3965
4241
|
}
|
|
3966
|
-
`,
|
|
4242
|
+
`, Ui = `"""
|
|
3967
4243
|
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.
|
|
3968
4244
|
"""
|
|
3969
4245
|
type StoreProduct {
|
|
@@ -4112,7 +4388,7 @@ input IStoreProduct {
|
|
|
4112
4388
|
"""
|
|
4113
4389
|
additionalProperty: [IStorePropertyValue!]
|
|
4114
4390
|
}
|
|
4115
|
-
`,
|
|
4391
|
+
`, Ti = `"""
|
|
4116
4392
|
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.
|
|
4117
4393
|
"""
|
|
4118
4394
|
type StoreProductGroup {
|
|
@@ -4139,7 +4415,7 @@ type StoreProductGroup {
|
|
|
4139
4415
|
"""
|
|
4140
4416
|
skuVariants: SkuVariants
|
|
4141
4417
|
}
|
|
4142
|
-
`,
|
|
4418
|
+
`, ki = `type Profile {
|
|
4143
4419
|
"""
|
|
4144
4420
|
Collection of user's address
|
|
4145
4421
|
"""
|
|
@@ -4200,7 +4476,7 @@ type ProfileAddress {
|
|
|
4200
4476
|
"""
|
|
4201
4477
|
geoCoordinate: [Float]
|
|
4202
4478
|
}
|
|
4203
|
-
`,
|
|
4479
|
+
`, _i = `"""
|
|
4204
4480
|
Properties that can be associated with products and products groups.
|
|
4205
4481
|
"""
|
|
4206
4482
|
type StorePropertyValue {
|
|
@@ -4240,7 +4516,7 @@ input IStorePropertyValue {
|
|
|
4240
4516
|
"""
|
|
4241
4517
|
valueReference: ObjectOrString!
|
|
4242
4518
|
}
|
|
4243
|
-
`,
|
|
4519
|
+
`, Fi = `"""
|
|
4244
4520
|
Each product edge contains a \`node\`, with product information, and a \`cursor\`, that can be used as a reference for pagination.
|
|
4245
4521
|
"""
|
|
4246
4522
|
type StoreProductEdge {
|
|
@@ -4802,7 +5078,7 @@ type StoreAccountProfile {
|
|
|
4802
5078
|
email: String
|
|
4803
5079
|
id: String
|
|
4804
5080
|
}
|
|
4805
|
-
`,
|
|
5081
|
+
`, Ri = `"""
|
|
4806
5082
|
Information of a given review rating.
|
|
4807
5083
|
"""
|
|
4808
5084
|
type StoreReviewRating {
|
|
@@ -4829,7 +5105,7 @@ type StoreReview {
|
|
|
4829
5105
|
"""
|
|
4830
5106
|
author: StoreAuthor!
|
|
4831
5107
|
}
|
|
4832
|
-
`,
|
|
5108
|
+
`, Ni = `"""
|
|
4833
5109
|
Search Engine Optimization (SEO) tags data.
|
|
4834
5110
|
"""
|
|
4835
5111
|
type StoreSeo {
|
|
@@ -4850,7 +5126,7 @@ type StoreSeo {
|
|
|
4850
5126
|
"""
|
|
4851
5127
|
canonical: String!
|
|
4852
5128
|
}
|
|
4853
|
-
`,
|
|
5129
|
+
`, Li = `"""
|
|
4854
5130
|
Currency information.
|
|
4855
5131
|
"""
|
|
4856
5132
|
type StoreCurrency {
|
|
@@ -5125,7 +5401,7 @@ input IStoreSession {
|
|
|
5125
5401
|
"""
|
|
5126
5402
|
refreshAfter: String
|
|
5127
5403
|
}
|
|
5128
|
-
`,
|
|
5404
|
+
`, Bi = `"""
|
|
5129
5405
|
Shipping Simulation item input.
|
|
5130
5406
|
"""
|
|
5131
5407
|
input IShippingItem {
|
|
@@ -5456,7 +5732,7 @@ type MessageFields {
|
|
|
5456
5732
|
"""
|
|
5457
5733
|
skuName: String
|
|
5458
5734
|
}
|
|
5459
|
-
`,
|
|
5735
|
+
`, Mi = `type SkuVariants {
|
|
5460
5736
|
"""
|
|
5461
5737
|
SKU property values for the current SKU.
|
|
5462
5738
|
"""
|
|
@@ -5551,7 +5827,7 @@ Example:
|
|
|
5551
5827
|
\`\`\`
|
|
5552
5828
|
"""
|
|
5553
5829
|
scalar FormattedVariants
|
|
5554
|
-
`,
|
|
5830
|
+
`, $i = `"""
|
|
5555
5831
|
Status used to indicate a message type. For instance, a shopping cart informative or error message.
|
|
5556
5832
|
"""
|
|
5557
5833
|
enum StoreStatus {
|
|
@@ -5559,7 +5835,7 @@ enum StoreStatus {
|
|
|
5559
5835
|
WARNING
|
|
5560
5836
|
ERROR
|
|
5561
5837
|
}
|
|
5562
|
-
`,
|
|
5838
|
+
`, zi = `scalar JSONObject
|
|
5563
5839
|
|
|
5564
5840
|
type UserOrder {
|
|
5565
5841
|
orderId: String
|
|
@@ -6383,95 +6659,95 @@ type UserOrderBudgetAllocationLinkedEntity {
|
|
|
6383
6659
|
type: String
|
|
6384
6660
|
id: String
|
|
6385
6661
|
}
|
|
6386
|
-
`,
|
|
6387
|
-
"./address.graphql":
|
|
6388
|
-
"./advertisement.graphql":
|
|
6389
|
-
"./aggregateOffer.graphql":
|
|
6390
|
-
"./aggregateRating.graphql":
|
|
6391
|
-
"./author.graphql":
|
|
6392
|
-
"./brand.graphql":
|
|
6393
|
-
"./breadcrumb.graphql":
|
|
6394
|
-
"./cart.graphql":
|
|
6395
|
-
"./collection.graphql":
|
|
6396
|
-
"./deliveryPromisesBadge.graphql":
|
|
6397
|
-
"./facet.graphql":
|
|
6398
|
-
"./image.graphql":
|
|
6399
|
-
"./mutation.graphql":
|
|
6400
|
-
"./newsletter.graphql":
|
|
6401
|
-
"./objectOrString.graphql":
|
|
6402
|
-
"./offer.graphql":
|
|
6403
|
-
"./order.graphql":
|
|
6404
|
-
"./orderCommercialAuthorizaton.graphql":
|
|
6405
|
-
"./orderEntry.graphql":
|
|
6406
|
-
"./organization.graphql":
|
|
6407
|
-
"./pageInfo.graphql":
|
|
6408
|
-
"./password.graphql":
|
|
6409
|
-
"./person.graphql":
|
|
6410
|
-
"./pickupPoints.graphql":
|
|
6411
|
-
"./product.graphql":
|
|
6412
|
-
"./productGroup.graphql":
|
|
6413
|
-
"./profile.graphql":
|
|
6414
|
-
"./propertyValue.graphql":
|
|
6415
|
-
"./query.graphql":
|
|
6416
|
-
"./review.graphql":
|
|
6417
|
-
"./seo.graphql":
|
|
6418
|
-
"./session.graphql":
|
|
6419
|
-
"./shipping.graphql":
|
|
6420
|
-
"./skuVariants.graphql":
|
|
6421
|
-
"./status.graphql":
|
|
6422
|
-
"./userOrder.graphql":
|
|
6423
|
-
}),
|
|
6424
|
-
Object.values(
|
|
6425
|
-
(
|
|
6662
|
+
`, Vi = /* @__PURE__ */ Object.assign({
|
|
6663
|
+
"./address.graphql": ai,
|
|
6664
|
+
"./advertisement.graphql": oi,
|
|
6665
|
+
"./aggregateOffer.graphql": si,
|
|
6666
|
+
"./aggregateRating.graphql": ci,
|
|
6667
|
+
"./author.graphql": li,
|
|
6668
|
+
"./brand.graphql": di,
|
|
6669
|
+
"./breadcrumb.graphql": ui,
|
|
6670
|
+
"./cart.graphql": pi,
|
|
6671
|
+
"./collection.graphql": gi,
|
|
6672
|
+
"./deliveryPromisesBadge.graphql": mi,
|
|
6673
|
+
"./facet.graphql": hi,
|
|
6674
|
+
"./image.graphql": fi,
|
|
6675
|
+
"./mutation.graphql": Si,
|
|
6676
|
+
"./newsletter.graphql": yi,
|
|
6677
|
+
"./objectOrString.graphql": Ii,
|
|
6678
|
+
"./offer.graphql": vi,
|
|
6679
|
+
"./order.graphql": Oi,
|
|
6680
|
+
"./orderCommercialAuthorizaton.graphql": Ci,
|
|
6681
|
+
"./orderEntry.graphql": bi,
|
|
6682
|
+
"./organization.graphql": Di,
|
|
6683
|
+
"./pageInfo.graphql": wi,
|
|
6684
|
+
"./password.graphql": Pi,
|
|
6685
|
+
"./person.graphql": Ai,
|
|
6686
|
+
"./pickupPoints.graphql": Ei,
|
|
6687
|
+
"./product.graphql": Ui,
|
|
6688
|
+
"./productGroup.graphql": Ti,
|
|
6689
|
+
"./profile.graphql": ki,
|
|
6690
|
+
"./propertyValue.graphql": _i,
|
|
6691
|
+
"./query.graphql": Fi,
|
|
6692
|
+
"./review.graphql": Ri,
|
|
6693
|
+
"./seo.graphql": Ni,
|
|
6694
|
+
"./session.graphql": Li,
|
|
6695
|
+
"./shipping.graphql": Bi,
|
|
6696
|
+
"./skuVariants.graphql": Mi,
|
|
6697
|
+
"./status.graphql": $i,
|
|
6698
|
+
"./userOrder.graphql": zi
|
|
6699
|
+
}), xi = bn(
|
|
6700
|
+
Object.values(Vi).map((e) => Dn(e)).reduce(
|
|
6701
|
+
(e, n) => qe([e, n], { sort: !0 })
|
|
6426
6702
|
)
|
|
6427
|
-
),
|
|
6428
|
-
|
|
6429
|
-
() => (
|
|
6430
|
-
channel:
|
|
6431
|
-
flags:
|
|
6432
|
-
locale:
|
|
6703
|
+
), qi = xi, sa = async (e) => N.context.with(
|
|
6704
|
+
N.propagation.extract(N.context.active(), e.OTEL),
|
|
6705
|
+
() => (n) => (n.storage = {
|
|
6706
|
+
channel: ee.parse(e.channel),
|
|
6707
|
+
flags: e.flags ?? {},
|
|
6708
|
+
locale: e.locale,
|
|
6433
6709
|
cookies: /* @__PURE__ */ new Map()
|
|
6434
|
-
},
|
|
6710
|
+
}, n.clients = bt(e, n), n.loaders = Ft(e, n), n.account = e.account, n.OTEL = e.OTEL, n.discoveryConfig = e.discoveryConfig, n)
|
|
6435
6711
|
);
|
|
6436
|
-
function
|
|
6437
|
-
const
|
|
6438
|
-
for (const [t, r] of Object.entries(
|
|
6439
|
-
|
|
6440
|
-
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i,
|
|
6712
|
+
function ji() {
|
|
6713
|
+
const e = ii(), n = {};
|
|
6714
|
+
for (const [t, r] of Object.entries(e))
|
|
6715
|
+
n[t] = Object.fromEntries(
|
|
6716
|
+
Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, qn(a, `${t}(${i})`)])
|
|
6441
6717
|
);
|
|
6442
|
-
return
|
|
6718
|
+
return n;
|
|
6443
6719
|
}
|
|
6444
|
-
function
|
|
6445
|
-
const t =
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
])(
|
|
6449
|
-
return
|
|
6450
|
-
schemas: [t,
|
|
6720
|
+
function ca(e) {
|
|
6721
|
+
const t = xn([
|
|
6722
|
+
Vn,
|
|
6723
|
+
Mn
|
|
6724
|
+
])(ji(), qi);
|
|
6725
|
+
return e && wn(e) ? On({
|
|
6726
|
+
schemas: [t, e]
|
|
6451
6727
|
}) : t;
|
|
6452
6728
|
}
|
|
6453
6729
|
export {
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6730
|
+
Mn as AuthDirective,
|
|
6731
|
+
U as BadRequestError,
|
|
6732
|
+
Vn as CacheControlDirective,
|
|
6733
|
+
Un as CommercialAuthorizationStatus,
|
|
6458
6734
|
X as FastStoreError,
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6735
|
+
re as ForbiddenError,
|
|
6736
|
+
sa as GraphqlVtexContextFactory,
|
|
6737
|
+
ca as GraphqlVtexSchema,
|
|
6738
|
+
B as NotFoundError,
|
|
6739
|
+
Tn as StoreCollectionType,
|
|
6740
|
+
kn as StoreFacetType,
|
|
6741
|
+
_n as StoreSort,
|
|
6742
|
+
Fn as StoreStatus,
|
|
6467
6743
|
J as UnauthorizedError,
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6744
|
+
Rn as UserOrderInvoiceType,
|
|
6745
|
+
aa as isBadRequestError,
|
|
6746
|
+
ia as isFastStoreError,
|
|
6747
|
+
jn as isForbiddenError,
|
|
6748
|
+
He as isNotFoundError,
|
|
6749
|
+
oa as isUnauthorizedError,
|
|
6750
|
+
ra as stringifyCacheControl,
|
|
6751
|
+
qi as typeDefs,
|
|
6752
|
+
xn as withDirectives
|
|
6477
6753
|
};
|