@faststore/api 4.5.0-dev.0 → 4.5.0-dev.2

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