@faststore/api 4.5.0-dev.4 → 4.5.0-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import { mergeTypeDefs as Ze } from "@graphql-tools/merge";
2
- import { makeExecutableSchema as Un, mergeSchemas as kn } from "@graphql-tools/schema";
2
+ import { makeExecutableSchema as kn, mergeSchemas as Un } from "@graphql-tools/schema";
3
3
  import { mapSchema as en, MapperKind as nn, getDirective as tn } from "@graphql-tools/utils";
4
4
  import { OTELAPI as L } from "@faststore/diagnostics";
5
- import { GraphQLScalarType as _n, print as Tn, parse as En, isSchema as Rn } from "graphql";
5
+ import { GraphQLScalarType as Tn, print as _n, parse as En, isSchema as Rn } from "graphql";
6
6
  import Fn from "isomorphic-unfetch";
7
7
  import { parse as Z } from "cookie";
8
- import Ae from "p-limit";
8
+ import Pe from "p-limit";
9
9
  import le from "dataloader";
10
10
  import Nn from "sanitize-html";
11
- import Pe from "fast-deep-equal";
11
+ import Ae from "fast-deep-equal";
12
12
  import Ln from "node:crypto";
13
13
  var Bn = /* @__PURE__ */ ((e) => (e.Accepted = "accepted", e.Denied = "denied", e.Pending = "pending", e))(Bn || {}), $n = /* @__PURE__ */ ((e) => (e.Brand = "Brand", e.Category = "Category", e.Cluster = "Cluster", e.Collection = "Collection", e.Department = "Department", e.SubCategory = "SubCategory", e))($n || {}), Mn = /* @__PURE__ */ ((e) => (e.Boolean = "BOOLEAN", e.Range = "RANGE", e))(Mn || {}), zn = /* @__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))(zn || {}), Vn = /* @__PURE__ */ ((e) => (e.Error = "ERROR", e.Info = "INFO", e.Warning = "WARNING", e))(Vn || {}), xn = /* @__PURE__ */ ((e) => (e.Input = "Input", e.Output = "Output", e))(xn || {});
14
14
  const qn = () => function(n = {}) {
@@ -42,14 +42,14 @@ const qn = () => function(n = {}) {
42
42
  return n;
43
43
  }
44
44
  })
45
- }, Hn = "cacheControl", Ta = (e, n) => {
45
+ }, Hn = "cacheControl", _a = (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
- }, ke = (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, Yn = {
52
+ }, Ue = (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, Yn = {
53
53
  typeDefs: "directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",
54
54
  transformer: (e) => en(e, {
55
55
  [nn.OBJECT_FIELD]: (n) => {
@@ -57,8 +57,8 @@ const qn = () => function(n = {}) {
57
57
  if (t) {
58
58
  const { sMaxAge: r, staleWhileRevalidate: i, scope: a } = t, o = n.resolve;
59
59
  n.resolve = (s, c, l, p) => (l.cacheControl = {
60
- sMaxAge: ke(l.cacheControl?.sMaxAge, r),
61
- staleWhileRevalidate: ke(
60
+ sMaxAge: Ue(l.cacheControl?.sMaxAge, r),
61
+ staleWhileRevalidate: Ue(
62
62
  l.cacheControl?.staleWhileRevalidate,
63
63
  i
64
64
  ),
@@ -75,12 +75,12 @@ const qn = () => function(n = {}) {
75
75
  ]);
76
76
  return (e ?? []).reduce(
77
77
  (i, { transformer: a }) => a?.(i) ?? i,
78
- Un({
78
+ kn({
79
79
  typeDefs: r,
80
80
  resolvers: n
81
81
  })
82
82
  );
83
- }, pe = "@faststore/api", ge = "4.5.0-dev.3", _e = {
83
+ }, pe = "@faststore/api", ge = "4.5.0-dev.4", Te = {
84
84
  name: pe,
85
85
  version: ge
86
86
  }, Kn = (e, n) => (t, r, i, a) => {
@@ -116,7 +116,7 @@ class ee extends Error {
116
116
  super(t), this.extensions = n, this.name = "FastStoreError";
117
117
  }
118
118
  }
119
- class T extends ee {
119
+ class _ extends ee {
120
120
  constructor(n) {
121
121
  super({ status: 400, type: "BadRequestError" }, n);
122
122
  }
@@ -136,7 +136,7 @@ class $ extends ee {
136
136
  super({ status: 404, type: "NotFoundError" }, n);
137
137
  }
138
138
  }
139
- const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type === "BadRequestError", Fa = (e) => e?.extensions?.type === "UnauthorizedError", Qn = (e) => e?.extensions?.type === "ForbiddenError", X = (e) => e?.extensions?.type === "NotFoundError", Zn = `${_e.name}@${_e.version}`, I = async (e, n, t) => {
139
+ const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type === "BadRequestError", Fa = (e) => e?.extensions?.type === "UnauthorizedError", Qn = (e) => e?.extensions?.type === "ForbiddenError", X = (e) => e?.extensions?.type === "NotFoundError", Zn = `${Te.name}@${Te.version}`, I = async (e, n, t) => {
140
140
  const r = await Fn(e, {
141
141
  ...n,
142
142
  headers: {
@@ -151,7 +151,7 @@ const Ea = (e) => e?.name === "FastStoreError", Ra = (e) => e?.extensions?.type
151
151
  if (typeof r?.status == "number")
152
152
  switch (r.status) {
153
153
  case 400:
154
- throw new T(i);
154
+ throw new _(i);
155
155
  case 401:
156
156
  throw new te(i);
157
157
  case 403:
@@ -429,7 +429,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
429
429
  })),
430
430
  selectedAddresses: y,
431
431
  clearAddressIfPostalCodeNotFound: t
432
- }, P = s({
432
+ }, A = s({
433
433
  "content-type": "application/json",
434
434
  "X-FORWARDED-HOST": u
435
435
  });
@@ -437,7 +437,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
437
437
  `${a}/api/checkout/pub/orderForm/${d}/attachments/shippingData`,
438
438
  {
439
439
  ...j,
440
- headers: P,
440
+ headers: A,
441
441
  body: JSON.stringify(C)
442
442
  },
443
443
  { storeCookies: o }
@@ -710,31 +710,31 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
710
710
  text: O,
711
711
  clientEmail: w,
712
712
  perPage: C,
713
- pendingMyApproval: P
713
+ pendingMyApproval: A
714
714
  }) => {
715
715
  const S = new URLSearchParams();
716
716
  if (m) {
717
- const A = new Date(m).setHours(
717
+ const P = new Date(m).setHours(
718
718
  0,
719
719
  0,
720
720
  0,
721
721
  0
722
722
  );
723
- m = new Date(A).toISOString();
723
+ m = new Date(P).toISOString();
724
724
  }
725
725
  if (y) {
726
- const A = new Date(y).setHours(
726
+ const P = new Date(y).setHours(
727
727
  23,
728
728
  59,
729
729
  59,
730
730
  999
731
731
  );
732
- y = new Date(A).toISOString();
732
+ y = new Date(P).toISOString();
733
733
  }
734
734
  O && S.append("text", O), g && g.length > 0 && S.append("status", g.filter(Boolean).join(",")), m && y ? S.append(
735
735
  "creation_date",
736
736
  `creationDate:[${m} TO ${y}]`
737
- ) : m ? S.append("creation_date", `creationDate:[${m} TO *]`) : y && S.append("creation_date", `creationDate:[* TO ${y}]`), w && S.append("clientEmail", w), d && S.append("page", d.toString()), C && S.append("per_page", C.toString()), P && S.append("my_pending_approvals", String(!0));
737
+ ) : m ? S.append("creation_date", `creationDate:[${m} TO *]`) : y && S.append("creation_date", `creationDate:[* TO ${y}]`), w && S.append("clientEmail", w), d && S.append("page", d.toString()), C && S.append("per_page", C.toString()), A && S.append("my_pending_approvals", String(!0));
738
738
  const D = s({
739
739
  "content-type": "application/json",
740
740
  "X-FORWARDED-HOST": u
@@ -773,7 +773,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
773
773
  const O = s({
774
774
  "content-type": "application/json",
775
775
  "X-FORWARDED-HOST": u
776
- }), P = {
776
+ }), A = {
777
777
  params: {
778
778
  ruleId: m,
779
779
  dimensionId: g,
@@ -785,7 +785,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
785
785
  {
786
786
  method: "POST",
787
787
  headers: O,
788
- body: JSON.stringify(P)
788
+ body: JSON.stringify(A)
789
789
  },
790
790
  { storeCookies: o }
791
791
  );
@@ -896,7 +896,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
896
896
  contractId: d
897
897
  }) => {
898
898
  if (!d)
899
- throw new T("Missing contractId to fetch CL fields.");
899
+ throw new _("Missing contractId to fetch CL fields.");
900
900
  const g = v({
901
901
  Accept: "application/json",
902
902
  "content-type": "application/json"
@@ -914,7 +914,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
914
914
  userId: d
915
915
  }) => {
916
916
  if (!d)
917
- throw new T("Missing userId to fetch shopper name.");
917
+ throw new _("Missing userId to fetch shopper name.");
918
918
  const g = c({
919
919
  Accept: "application/json",
920
920
  "content-type": "application/json",
@@ -974,17 +974,17 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
974
974
  "content-type": "application/json",
975
975
  "X-FORWARDED-HOST": u
976
976
  }), O = `----FastStoreUploadBoundary${Date.now()}`, w = `\r
977
- `, P = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", S = g.replaceAll(/[\r\n"]/g, "_"), D = [
977
+ `, A = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-.^_+]*$/.test(m) ? m : "application/octet-stream", S = g.replaceAll(/[\r\n"]/g, "_"), D = [
978
978
  `--${O}`,
979
979
  `Content-Disposition: form-data; name="file"; filename="${S}"`,
980
- `Content-Type: ${P}`,
980
+ `Content-Type: ${A}`,
981
981
  "",
982
982
  ""
983
- ].join(w), A = `${w}--${O}--${w}`, U = Buffer.from(D), b = Buffer.from(A), k = new Uint8Array(
984
- U.byteLength + d.byteLength + b.byteLength
983
+ ].join(w), P = `${w}--${O}--${w}`, k = Buffer.from(D), b = Buffer.from(P), U = new Uint8Array(
984
+ k.byteLength + d.byteLength + b.byteLength
985
985
  );
986
- let _ = 0;
987
- return k.set(U, _), _ += U.byteLength, k.set(d, _), _ += d.byteLength, k.set(b, _), I(
986
+ let T = 0;
987
+ return U.set(k, T), T += k.byteLength, U.set(d, T), T += d.byteLength, U.set(b, T), I(
988
988
  `${a}/api/order-entry/upload?an=${e}`,
989
989
  {
990
990
  method: "POST",
@@ -992,7 +992,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
992
992
  ...y,
993
993
  "content-type": `multipart/form-data; boundary=${O}`
994
994
  },
995
- body: k.buffer
995
+ body: U.buffer
996
996
  },
997
997
  {}
998
998
  );
@@ -1098,7 +1098,7 @@ const pt = ({ account: e, environment: n, incrementAddress: t, subDomainPrefix:
1098
1098
  }
1099
1099
  }
1100
1100
  };
1101
- }, K = (e) => e.discoveryConfig?.localization ?? {}, Q = (e) => K(e).enabled === !0, gt = (e) => Object.keys(K(e).locales ?? {}), mt = (e) => K(e).defaultLocale, re = (e) => Q(e) && e.storage.locale || void 0, he = "fuzzy", fe = "operator", Se = "pickupPoint", Te = "shipping", Ee = "delivery-options", ht = "in-stock", ft = "trade-policy", St = "region-id", yt = /* @__PURE__ */ new Set([
1101
+ }, K = (e) => e.discoveryConfig?.localization ?? {}, Q = (e) => K(e).enabled === !0, gt = (e) => Object.keys(K(e).locales ?? {}), mt = (e) => K(e).defaultLocale, re = (e) => Q(e) && e.storage.locale || void 0, he = "fuzzy", fe = "operator", Se = "pickupPoint", _e = "shipping", Ee = "delivery-options", ht = "in-stock", ft = "trade-policy", St = "region-id", yt = /* @__PURE__ */ new Set([
1102
1102
  ft,
1103
1103
  St,
1104
1104
  he,
@@ -1193,7 +1193,7 @@ function Dt(e) {
1193
1193
  return t;
1194
1194
  }
1195
1195
  }
1196
- function At(e, n) {
1196
+ function Pt(e, n) {
1197
1197
  const t = Dt(
1198
1198
  n
1199
1199
  );
@@ -1202,23 +1202,23 @@ function At(e, n) {
1202
1202
  pickupPoint: t
1203
1203
  };
1204
1204
  }
1205
- function Pt(e) {
1205
+ function At(e) {
1206
1206
  return e.map((n) => n.key !== "shipping" || cn(n.value) === void 0 ? n : { ...n, value: "pickup-in-point" });
1207
1207
  }
1208
- function Ut(e, n) {
1208
+ function kt(e, n) {
1209
1209
  let t = [...e];
1210
1210
  const r = t.some((i) => i.key === "shipping");
1211
1211
  for (const i of n)
1212
1212
  (!r || i.key !== "shipping") && t.push(i);
1213
- return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), Pt(t);
1213
+ return t.some((i) => i.key === "shipping" && i.value === "ignore") && (t = t.filter((i) => i.key !== "shipping")), At(t);
1214
1214
  }
1215
- function kt(e) {
1215
+ function Ut(e) {
1216
1216
  return e.reduce((n, t) => {
1217
1217
  let { key: r, value: i } = t;
1218
1218
  return r === "priceRange" && (r = "price", i = i.replace(" TO ", ":")), r === "ft" ? n : `${n}${Re(r)}/${Ot(Re(i)).replaceAll(/ |%20/g, "-")}/`;
1219
1219
  }, "");
1220
1220
  }
1221
- const _t = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), Tt = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
1221
+ const Tt = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), _t = (e) => e.key === "operator" && (e.value === "and" || e.value === "or");
1222
1222
  function Et(e, n) {
1223
1223
  const { segmentParams: t, extraFacets: r } = wt(e ?? {}), i = n?.salesChannel ?? t.sc, a = n?.regionId ?? t.regionId, o = n?.locale ?? t.locale ?? "";
1224
1224
  return {
@@ -1233,19 +1233,19 @@ function Et(e, n) {
1233
1233
  }
1234
1234
  function Rt(e, n) {
1235
1235
  const t = e.filter(({ key: c }) => !yt.has(c)), r = e.find(
1236
- ({ key: c, value: l }) => c === Te && l !== "all-delivery-methods"
1236
+ ({ key: c, value: l }) => c === _e && l !== "all-delivery-methods"
1237
1237
  ) ?? null, i = e.find(
1238
1238
  ({ key: c, value: l }) => c === Ee && l !== "all-delivery-options"
1239
1239
  ) ?? null, a = [...t], o = a.some(
1240
- ({ key: c }) => c === Te
1240
+ ({ key: c }) => c === _e
1241
1241
  ), s = a.some(
1242
1242
  ({ key: c }) => c === Ee
1243
1243
  );
1244
- return r !== null && !o && a.push(r), i !== null && !s && a.push(i), Ut(a, n);
1244
+ return r !== null && !o && a.push(r), i !== null && !s && a.push(i), kt(a, n);
1245
1245
  }
1246
1246
  function Ft(e, n) {
1247
1247
  const t = e.find(({ key: a }) => a === he) ?? null, r = e.find(({ key: a }) => a === fe) ?? null, i = e.find(({ key: a }) => a === Se) ?? null;
1248
- t && _t(t) && n.append(he, t.value), r && Tt(r) && n.append(fe, r.value), i && n.append(Se, i.value);
1248
+ t && Tt(t) && n.append(he, t.value), r && _t(r) && n.append(fe, r.value), i && n.append(Se, i.value);
1249
1249
  }
1250
1250
  function Fe(e, n, t, r) {
1251
1251
  const {
@@ -1264,7 +1264,7 @@ function Fe(e, n, t, r) {
1264
1264
  f.append("from", g.toString()), f.append("to", m.toString());
1265
1265
  }
1266
1266
  i && f.append("query", i), r.includeSort && s && f.append("sort", s);
1267
- const v = At(
1267
+ const v = Pt(
1268
1268
  t.segmentParams,
1269
1269
  c
1270
1270
  );
@@ -1273,7 +1273,7 @@ function Fe(e, n, t, r) {
1273
1273
  f.append("hideUnavailableItems", m);
1274
1274
  }
1275
1275
  n?.simulationBehavior !== void 0 && f.append("simulationBehavior", n.simulationBehavior.toString()), n?.showSponsored !== void 0 && f.append("showSponsored", n.showSponsored.toString()), p !== void 0 && f.append("sponsoredCount", p.toString()), h !== void 0 && f.append("allowRedirect", h.toString());
1276
- const d = kt(
1276
+ const d = Ut(
1277
1277
  Rt(c, t.extraFacets)
1278
1278
  );
1279
1279
  return { params: f, path: d };
@@ -1368,21 +1368,21 @@ const Mt = ({
1368
1368
  "content-type": "application/json",
1369
1369
  "X-FORWARDED-HOST": f
1370
1370
  }), d = ({ type: S, ...D }) => {
1371
- const A = S === "facets" ? "facets" : "product-search", U = G({
1372
- endpoint: A,
1371
+ const P = S === "facets" ? "facets" : "product-search", k = G({
1372
+ endpoint: P,
1373
1373
  segment: l,
1374
1374
  defaults: p(),
1375
1375
  args: D
1376
1376
  });
1377
1377
  return I(
1378
- `${s}/api/intelligent-search/v1/${A}/${U.path}?${U.params.toString()}`,
1378
+ `${s}/api/intelligent-search/v1/${P}/${k.path}?${k.params.toString()}`,
1379
1379
  { headers: v }
1380
1380
  );
1381
1381
  }, g = (S) => d({ ...S, type: "product_search" }), m = ({
1382
1382
  field: S,
1383
1383
  value: D,
1384
- hideUnavailableItems: A,
1385
- showInvisibleItems: U
1384
+ hideUnavailableItems: P,
1385
+ showInvisibleItems: k
1386
1386
  }) => {
1387
1387
  const b = G({
1388
1388
  endpoint: "products",
@@ -1391,8 +1391,8 @@ const Mt = ({
1391
1391
  args: {
1392
1392
  field: S,
1393
1393
  value: D,
1394
- hideUnavailableItems: A,
1395
- showInvisibleItems: U
1394
+ hideUnavailableItems: P,
1395
+ showInvisibleItems: k
1396
1396
  }
1397
1397
  });
1398
1398
  return I(
@@ -1407,19 +1407,19 @@ const Mt = ({
1407
1407
  productsByIdentifier: async ({
1408
1408
  field: S,
1409
1409
  values: D,
1410
- showInvisibleItems: A,
1411
- hideUnavailableItems: U
1410
+ showInvisibleItems: P,
1411
+ hideUnavailableItems: k
1412
1412
  }) => {
1413
- const b = Ae(Lt);
1413
+ const b = Pe(Lt);
1414
1414
  return (await Promise.all(
1415
1415
  D.map(
1416
- (_) => b(async () => {
1416
+ (T) => b(async () => {
1417
1417
  try {
1418
1418
  return await m({
1419
1419
  field: S,
1420
- value: _,
1421
- hideUnavailableItems: U,
1422
- showInvisibleItems: A
1420
+ value: T,
1421
+ hideUnavailableItems: k,
1422
+ showInvisibleItems: P
1423
1423
  });
1424
1424
  } catch {
1425
1425
  return null;
@@ -1427,7 +1427,7 @@ const Mt = ({
1427
1427
  })
1428
1428
  )
1429
1429
  )).filter(
1430
- (_) => _ !== null
1430
+ (T) => T !== null
1431
1431
  );
1432
1432
  },
1433
1433
  suggestedTerms: (S) => {
@@ -1474,7 +1474,7 @@ const Mt = ({
1474
1474
  catalog: i
1475
1475
  };
1476
1476
  }, Vt = 20, xt = (e) => e.entityType === "category", ye = (e) => e.entityType === "brand", Ne = (e) => e.entityType === "collection", qt = (e, n) => {
1477
- const t = Ae(Vt), r = async (i) => Promise.all(
1477
+ const t = Pe(Vt), r = async (i) => Promise.all(
1478
1478
  i.map(
1479
1479
  (a) => t(async () => {
1480
1480
  const o = a.slug.toLowerCase(), s = a.locale, c = await n.commerce.catalog.byLinkId.category(
@@ -1516,7 +1516,7 @@ const Mt = ({
1516
1516
  const t = async (r) => Promise.all(r.map((i) => n.commerce.catalog.salesChannel(i)));
1517
1517
  return new le(t);
1518
1518
  }, Wt = 1, Gt = (e, n) => {
1519
- const t = Ae(Wt), r = async (a) => {
1519
+ const t = Pe(Wt), r = async (a) => {
1520
1520
  const o = a.reduce((u, { items: h }) => [...u, h], []), s = [...o.flat()], c = await n.commerce.checkout.simulation({
1521
1521
  country: a[0].country,
1522
1522
  postalCode: a[0].postalCode,
@@ -1738,7 +1738,7 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), dn
1738
1738
  (t) => ar(t.key)
1739
1739
  );
1740
1740
  if (Array.isArray(n) && n.length > 1)
1741
- throw new T(
1741
+ throw new _(
1742
1742
  `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(",")}`
1743
1743
  );
1744
1744
  return n?.[0] ?? null;
@@ -1781,7 +1781,7 @@ const H = (e) => xt(e) ? e.slug : ye(e) ? e.linkId : e.linkId ?? ae(e.name), dn
1781
1781
  quantity: ({ quantity: e }) => e
1782
1782
  }, gr = async (e, { data: n }, { clients: { commerce: t } }) => {
1783
1783
  if (!n?.orderId)
1784
- throw new T("Missing orderId");
1784
+ throw new _("Missing orderId");
1785
1785
  return { data: (await t.checkout.cancelOrder(n))?.data };
1786
1786
  };
1787
1787
  function pn(e) {
@@ -1815,7 +1815,7 @@ const hr = async (e, { data: n }, { clients: { commerce: t } }) => {
1815
1815
  };
1816
1816
  }, fr = async (e, { data: n }, { clients: { commerce: t } }) => {
1817
1817
  if (!n?.objectKey)
1818
- throw new T("Missing objectKey");
1818
+ throw new _("Missing objectKey");
1819
1819
  const r = n.orderFormId || (await t.orderEntry.createOrderForm()).orderFormId;
1820
1820
  return t.orderEntry.startOperation({
1821
1821
  objectKey: n.objectKey,
@@ -1831,16 +1831,16 @@ const hr = async (e, { data: n }, { clients: { commerce: t } }) => {
1831
1831
  }, yr = async (e, { data: n }, { clients: { commerce: t } }) => ({ id: (await t.subscribeToNewsletter(n))?.Id }), Ir = async (e, { data: n }, { clients: { commerce: t } }) => {
1832
1832
  const { fileContent: r, fileName: i, mimeType: a } = n;
1833
1833
  if (!r || !i || !a)
1834
- throw new T(
1834
+ throw new _(
1835
1835
  "Missing required fields: fileContent, fileName, mimeType"
1836
1836
  );
1837
1837
  const o = r.replaceAll(/\s/g, ""), s = 5 * 1024 * 1024;
1838
1838
  if (Math.floor(o.length * 3 / 4) > s)
1839
- throw new T("File exceeds maximum allowed size of 5MB");
1839
+ throw new _("File exceeds maximum allowed size of 5MB");
1840
1840
  if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(
1841
1841
  o
1842
1842
  ))
1843
- throw new T("Invalid Base64 fileContent");
1843
+ throw new _("Invalid Base64 fileContent");
1844
1844
  const p = Buffer.from(o, "base64");
1845
1845
  return await t.orderEntry.uploadFile({
1846
1846
  fileBuffer: p,
@@ -1934,14 +1934,14 @@ const Or = (e) => {
1934
1934
  }, fn = (e, n) => {
1935
1935
  if (!br(n))
1936
1936
  return { updateShipping: !1, addressChanged: !1 };
1937
- if (!Pr(e))
1937
+ if (!Ar(e))
1938
1938
  return { updateShipping: !1, addressChanged: !1 };
1939
1939
  const [t] = e?.shippingData?.selectedAddresses ?? [];
1940
- if (wr(t, n.postalCode) || Dr(t, n.geoCoordinates) || Ar(t, n.addressType))
1940
+ if (wr(t, n.postalCode) || Dr(t, n.geoCoordinates) || Pr(t, n.addressType))
1941
1941
  return { updateShipping: !0, addressChanged: !0 };
1942
1942
  const { logisticsInfo: r } = e.shippingData;
1943
- return Ur(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
1944
- }, br = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, wr = (e, n) => typeof n == "string" && e?.postalCode !== n, Dr = (e, n) => typeof n?.latitude == "number" && typeof n?.longitude == "number" && (e?.geoCoordinates[0] !== n?.longitude || e?.geoCoordinates[1] !== n?.latitude), Ar = (e, n) => typeof n == "string" && e?.addressType !== n, Pr = (e) => e.items.length !== 0, Ur = (e, n) => {
1943
+ return kr(r, n) ? { updateShipping: !0, addressChanged: !1 } : { updateShipping: !1, addressChanged: !1 };
1944
+ }, br = (e) => !!e.postalCode || e.geoCoordinates?.latitude && e.geoCoordinates?.longitude, wr = (e, n) => typeof n == "string" && e?.postalCode !== n, Dr = (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, Ar = (e) => e.items.length !== 0, kr = (e, n) => {
1945
1945
  const t = n?.deliveryMode?.deliveryChannel, r = n?.deliveryMode?.deliveryMethod, { startDate: i, endDate: a } = n?.deliveryMode?.deliveryWindow || {};
1946
1946
  return e.some(
1947
1947
  ({ selectedDeliveryChannel: o, selectedSla: s, slas: c }) => {
@@ -1968,7 +1968,7 @@ const Or = (e) => {
1968
1968
  additionalProperty: e.attachments.map(mn)
1969
1969
  },
1970
1970
  index: n
1971
- }), kr = (e) => ({
1971
+ }), Ur = (e) => ({
1972
1972
  quantity: e.quantity,
1973
1973
  seller: e.seller.identifier,
1974
1974
  id: e.itemOffered.sku,
@@ -1976,18 +1976,19 @@ const Or = (e) => {
1976
1976
  attachments: (e.itemOffered.additionalProperty?.filter(Sn) ?? []).map((n) => ({
1977
1977
  name: n.name,
1978
1978
  content: n.value
1979
- }))
1979
+ })),
1980
+ ...e.priceToken ? { priceToken: e.priceToken } : {}
1980
1981
  }), qe = (e) => e.reduce((n, t) => {
1981
1982
  const r = Ce(t);
1982
1983
  return n.has(r) || n.set(r, []), n.get(r)?.push(t), n;
1983
- }, /* @__PURE__ */ new Map()), _r = (e, n) => {
1984
- const t = (s, c) => ({
1985
- ...s,
1984
+ }, /* @__PURE__ */ new Map()), Tr = (e, n) => {
1985
+ const t = ({ priceToken: s, ...c }, l) => ({
1986
+ ...c,
1986
1987
  itemOffered: {
1987
- sku: s.itemOffered.sku
1988
+ sku: c.itemOffered.sku
1988
1989
  },
1989
- index: c
1990
- }), r = n.items.map(se).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = Pe(r, i);
1990
+ index: l
1991
+ }), r = n.items.map(se).map(t), i = e.acceptedOffer.map(t), a = e.orderNumber === n.orderFormId, o = Ae(r, i);
1991
1992
  return a && o;
1992
1993
  };
1993
1994
  function yn(e, n) {
@@ -2062,7 +2063,7 @@ const je = (e) => {
2062
2063
  More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api`
2063
2064
  ), r;
2064
2065
  }
2065
- }, Tr = (e, n) => {
2066
+ }, _r = (e, n) => {
2066
2067
  const r = e.customData?.customApps.find(
2067
2068
  (a) => a.id === "faststore"
2068
2069
  )?.fields?.cartEtag;
@@ -2117,7 +2118,7 @@ const je = (e) => {
2117
2118
  }), p = l.orderFormId;
2118
2119
  l.messages.length !== 0 && await Er(p, r);
2119
2120
  const u = Z(r?.headers?.cookie ?? "")?.vtex_session, h = Y(u), { acceptedOffer: f, shouldSplitItem: v } = n;
2120
- if (Tr(l, h)) {
2121
+ if (_r(l, h)) {
2121
2122
  const b = await Ge(
2122
2123
  l,
2123
2124
  a,
@@ -2127,48 +2128,48 @@ const je = (e) => {
2127
2128
  return We(b, o, v);
2128
2129
  }
2129
2130
  const g = qe(f), m = qe(l.items.map(se)), y = Array.from(m.entries()), O = Array.from(g.entries()), { itemsToAdd: w, itemsToUpdate: C } = O.reduce(
2130
- (b, [k, _]) => {
2131
- const x = m.get(k);
2131
+ (b, [U, T]) => {
2132
+ const x = m.get(U);
2132
2133
  if (!x)
2133
- return _.forEach((q) => b.itemsToAdd.push(q)), b;
2134
- const [E, ...Ue] = x;
2134
+ return T.forEach((q) => b.itemsToAdd.push(q)), b;
2135
+ const [E, ...ke] = x;
2135
2136
  if (In(l.items, E.itemOffered.sku) || yn(l.items, E.itemOffered.sku))
2136
2137
  return b.itemsToUpdate.push(E), b;
2137
- const de = _.reduce((q, Pn) => q + Pn.quantity, 0);
2138
+ const de = T.reduce((q, An) => q + An.quantity, 0);
2138
2139
  return b.itemsToUpdate.push({
2139
2140
  ...E,
2140
2141
  quantity: de
2141
- }), Ue.forEach((q) => b.itemsToUpdate.push({ ...q, quantity: 0 })), b;
2142
+ }), ke.forEach((q) => b.itemsToUpdate.push({ ...q, quantity: 0 })), b;
2142
2143
  },
2143
2144
  {
2144
2145
  itemsToAdd: [],
2145
2146
  itemsToUpdate: []
2146
2147
  }
2147
- ), P = y.filter(([b]) => !g.has(b)).flatMap(([, b]) => b.map((k) => ({ ...k, quantity: 0 }))), S = [...w, ...C, ...P].map(
2148
- kr
2148
+ ), A = y.filter(([b]) => !g.has(b)).flatMap(([, b]) => b.map((U) => ({ ...U, quantity: 0 }))), S = [...w, ...C, ...A].map(
2149
+ Ur
2149
2150
  ), { updateShipping: D } = t ? fn(l, t) : { updateShipping: !1 };
2150
2151
  if (S.length === 0 && !D)
2151
2152
  return null;
2152
- let A;
2153
- S.length > 0 ? A = await a.checkout.updateOrderFormItems({
2153
+ let P;
2154
+ S.length > 0 ? P = await a.checkout.updateOrderFormItems({
2154
2155
  id: l.orderFormId,
2155
2156
  orderItems: S,
2156
2157
  shouldSplitItem: v
2157
2158
  }).then(
2158
2159
  (b) => He(b, t, r)
2159
- ) : A = await He(
2160
+ ) : P = await He(
2160
2161
  l,
2161
2162
  t,
2162
2163
  r
2163
- ), A = await Promise.resolve(A).then((b) => {
2164
+ ), P = await Promise.resolve(P).then((b) => {
2164
2165
  if (t?.marketingData) {
2165
- const k = {
2166
+ const U = {
2166
2167
  ...b.marketingData,
2167
2168
  ...t.marketingData
2168
2169
  };
2169
2170
  return a.checkout.marketingData({
2170
2171
  id: l.orderFormId,
2171
- marketingData: k
2172
+ marketingData: U
2172
2173
  });
2173
2174
  }
2174
2175
  return b;
@@ -2179,11 +2180,11 @@ const je = (e) => {
2179
2180
  locale: c
2180
2181
  }
2181
2182
  }) : b).then((b) => Ge(b, a, h)).then(je);
2182
- const U = Pe(
2183
+ const k = Ae(
2183
2184
  l.messages,
2184
- A.messages
2185
+ P.messages
2185
2186
  );
2186
- return _r(n, A) && U ? null : We(A, o, v);
2187
+ return Tr(n, P) && k ? null : We(P, o, v);
2187
2188
  }, Nr = (e) => {
2188
2189
  const n = (e?.corporateName ?? "").trim();
2189
2190
  return n || (e?.firstName ?? "").trim();
@@ -2257,21 +2258,21 @@ const xr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
2257
2258
  } catch (E) {
2258
2259
  console.warn("JWT validation failed:", E), m = !1;
2259
2260
  }
2260
- const y = m ? g?.isRepresentative : !1, O = m ? g?.customerId : void 0, w = m ? g?.unitId : void 0, C = await r.commerce.session(h.toString()).catch(() => null), P = C?.namespaces.profile ?? null, S = C?.namespaces.shopper ?? null, D = C?.namespaces.store ?? null, A = C?.namespaces.authentication ?? null, U = C?.namespaces.checkout ?? null, b = C?.namespaces.public ?? null;
2261
- let k = null;
2262
- if (y && P?.id?.value)
2261
+ const y = m ? g?.isRepresentative : !1, O = m ? g?.customerId : void 0, w = m ? g?.unitId : void 0, C = await r.commerce.session(h.toString()).catch(() => null), A = C?.namespaces.profile ?? null, S = C?.namespaces.shopper ?? null, D = C?.namespaces.store ?? null, P = C?.namespaces.authentication ?? null, k = C?.namespaces.checkout ?? null, b = C?.namespaces.public ?? null;
2262
+ let U = null;
2263
+ if (y && A?.id?.value)
2263
2264
  try {
2264
- k = await r.commerce.masterData.getContractById({
2265
- contractId: P.id.value
2265
+ U = await r.commerce.masterData.getContractById({
2266
+ contractId: A.id.value
2266
2267
  });
2267
2268
  } catch {
2268
2269
  console.error(
2269
- `Error while getting contract data for profile ID (${P.id.value}).
2270
+ `Error while getting contract data for profile ID (${A.id.value}).
2270
2271
  `
2271
2272
  );
2272
2273
  }
2273
- let _;
2274
- o.seller && (s || p) && (_ = (await r.commerce.checkout.region({
2274
+ let T;
2275
+ o.seller && (s || p) && (T = (await r.commerce.checkout.region({
2275
2276
  postalCode: s,
2276
2277
  geoCoordinates: p,
2277
2278
  country: c,
@@ -2286,8 +2287,8 @@ const xr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
2286
2287
  country: D?.countryCode?.value ?? c,
2287
2288
  channel: oe.stringify({
2288
2289
  salesChannel: D?.channel?.value ?? o.salesChannel,
2289
- regionId: U?.regionId?.value ?? o.regionId,
2290
- seller: _?.id,
2290
+ regionId: k?.regionId?.value ?? o.regionId,
2291
+ seller: T?.id,
2291
2292
  hasOnlyDefaultSalesChannel: !D?.channel?.value
2292
2293
  }),
2293
2294
  /**
@@ -2298,28 +2299,28 @@ const xr = async (e, { session: n, search: t }, { clients: r, headers: i, accoun
2298
2299
  */
2299
2300
  b2b: y ? {
2300
2301
  isRepresentative: y ?? !1,
2301
- customerId: A?.customerId?.value ?? O ?? "",
2302
- unitName: A?.unitName?.value ?? "",
2303
- unitId: A?.unitId?.value ?? w ?? "",
2302
+ customerId: P?.customerId?.value ?? O ?? "",
2303
+ unitName: P?.unitName?.value ?? "",
2304
+ unitId: P?.unitId?.value ?? w ?? "",
2304
2305
  firstName: typeof S?.firstName?.value == "string" ? S.firstName.value : "",
2305
2306
  lastName: typeof S?.lastName?.value == "string" ? S.lastName.value : "",
2306
2307
  userName: `${typeof S?.firstName?.value == "string" ? S.firstName.value : ""} ${typeof S?.lastName?.value == "string" ? S.lastName.value : ""}`.trim(),
2307
- userEmail: A?.storeUserEmail.value ?? "",
2308
+ userEmail: P?.storeUserEmail.value ?? "",
2308
2309
  savedPostalCode: b?.postalCode?.value ?? "",
2309
- contractName: On(k, P),
2310
+ contractName: On(U, A),
2310
2311
  organizationManager: S?.organizationManager?.value ?? !1
2311
2312
  } : null,
2312
2313
  marketingData: d,
2313
- person: P?.id ? {
2314
- id: P.id?.value ?? "",
2315
- email: P.email?.value ?? "",
2316
- givenName: P.firstName?.value ?? "",
2317
- familyName: P.lastName?.value ?? ""
2314
+ person: A?.id ? {
2315
+ id: A.id?.value ?? "",
2316
+ email: A.email?.value ?? "",
2317
+ givenName: A.firstName?.value ?? "",
2318
+ familyName: A.lastName?.value ?? ""
2318
2319
  } : null,
2319
2320
  geoCoordinates: p?.latitude && p?.longitude && p || null,
2320
2321
  city: l
2321
2322
  };
2322
- return Pe(n, x) ? null : x;
2323
+ return Ae(n, x) ? null : x;
2323
2324
  }, qr = {
2324
2325
  validateCart: Fr,
2325
2326
  validateSession: xr,
@@ -2342,7 +2343,7 @@ function Cn(e) {
2342
2343
  return e;
2343
2344
  }
2344
2345
  }
2345
- const Wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Gr = new _n({
2346
+ const Wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string" ? e : null, Gr = new Tn({
2346
2347
  name: "ObjectOrString",
2347
2348
  description: "A string or the string representation of an object (a stringified object).",
2348
2349
  parseValue: jr,
@@ -2350,7 +2351,7 @@ const Wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
2350
2351
  parseLiteral(e) {
2351
2352
  return e.kind === be.STRING ? Cn(e.value) : null;
2352
2353
  }
2353
- }), F = (e) => "Price" in e && "seller" in e && "product" in e, R = (e) => "skuName" in e, Hr = {
2354
+ }), R = (e) => "Price" in e && "seller" in e && "product" in e, F = (e) => "skuName" in e, Hr = {
2354
2355
  priceCurrency: async (e, n, t) => {
2355
2356
  const {
2356
2357
  loaders: { salesChannelLoader: r },
@@ -2358,33 +2359,34 @@ const Wr = (e) => typeof e == "object" ? JSON.stringify(e) : typeof e == "string
2358
2359
  } = t;
2359
2360
  return (await r.load(i.salesChannel)).CurrencyCode ?? "";
2360
2361
  },
2361
- priceValidUntil: (e) => F(e) ? e.PriceValidUntil ?? "" : R(e) ? e.priceValidUntil ?? "" : null,
2362
+ priceValidUntil: (e) => R(e) ? e.PriceValidUntil ?? "" : F(e) ? e.priceValidUntil ?? "" : null,
2362
2363
  itemCondition: () => "https://schema.org/NewCondition",
2363
- availability: async (e) => F(e) ? Le(B(e)) : R(e) ? Le(Qt(e.availability)) : null,
2364
- seller: (e, n, t) => F(e) ? {
2364
+ availability: async (e) => R(e) ? Le(B(e)) : F(e) ? Le(Qt(e.availability)) : null,
2365
+ seller: (e, n, t) => R(e) ? {
2365
2366
  identifier: t.storage.channel?.seller || e.seller.sellerId || ""
2366
- } : R(e) ? {
2367
+ } : F(e) ? {
2367
2368
  identifier: e.seller
2368
2369
  } : null,
2369
- price: (e) => F(e) ? V(e) : R(e) ? e.sellingPrice / 100 : null,
2370
- priceWithTaxes: (e) => F(e) ? M(V(e), e?.Tax, e.product.unitMultiplier) : R(e) ? M(
2370
+ price: (e) => R(e) ? V(e) : F(e) ? e.sellingPrice / 100 : null,
2371
+ priceWithTaxes: (e) => R(e) ? M(V(e), e?.Tax, e.product.unitMultiplier) : F(e) ? M(
2371
2372
  e.sellingPrice / 100,
2372
2373
  e.tax / 100,
2373
2374
  e.unitMultiplier
2374
2375
  ) : null,
2375
- sellingPrice: (e) => F(e) ? Kt(e) : R(e) ? e.sellingPrice / 100 : null,
2376
- listPrice: (e) => F(e) ? e.ListPrice ?? 0 : R(e) ? e.listPrice / 100 : null,
2377
- listPriceWithTaxes: (e) => F(e) ? M(
2376
+ sellingPrice: (e) => R(e) ? Kt(e) : F(e) ? e.sellingPrice / 100 : null,
2377
+ listPrice: (e) => R(e) ? e.ListPrice ?? 0 : F(e) ? e.listPrice / 100 : null,
2378
+ listPriceWithTaxes: (e) => R(e) ? M(
2378
2379
  e.ListPrice ?? 0,
2379
2380
  e?.Tax,
2380
2381
  e.product.unitMultiplier
2381
- ) : R(e) ? M(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
2382
- itemOffered: (e) => F(e) ? e.product : R(e) ? {
2382
+ ) : F(e) ? M(e.listPrice / 100, e.tax / 100, e.unitMultiplier) : null,
2383
+ itemOffered: (e) => R(e) ? e.product : F(e) ? {
2383
2384
  ...e.product,
2384
2385
  attachmentsValues: e.attachments
2385
2386
  } : null,
2386
- quantity: (e) => F(e) ? e.AvailableQuantity ?? 0 : R(e) ? e.quantity : null,
2387
- isGift: (e) => R(e) ? e.isGift ?? !1 : null
2387
+ quantity: (e) => R(e) ? e.AvailableQuantity ?? 0 : F(e) ? e.quantity : null,
2388
+ isGift: (e) => F(e) ? e.isGift ?? !1 : null,
2389
+ priceToken: (e) => R(e) ? e.PriceToken ?? null : null
2388
2390
  }, Xr = ({ linkText: e }) => `/${e}/p`, Yr = ({
2389
2391
  offer: e,
2390
2392
  seller: n,
@@ -2606,12 +2608,12 @@ const Qr = (e, n) => {
2606
2608
  clients: { commerce: a }
2607
2609
  } = i, { salesChannel: o } = i.storage.channel, s = n?.trim();
2608
2610
  if (!s || !ri.test(s))
2609
- throw new T(`Invalid campaignVrn: "${n}"`);
2611
+ throw new _(`Invalid campaignVrn: "${n}"`);
2610
2612
  const c = t?.trim();
2611
2613
  if (t != null && !c)
2612
- throw new T("Invalid userId: must be a non-empty string");
2614
+ throw new _("Invalid userId: must be a non-empty string");
2613
2615
  if (r != null && (!Array.isArray(r) || r.some((f) => !f?.trim())))
2614
- throw new T(
2616
+ throw new _(
2615
2617
  "Invalid products: must be an array of non-empty strings"
2616
2618
  );
2617
2619
  const l = await a.recommendation.recommendations({
@@ -2640,11 +2642,11 @@ const Qr = (e, n) => {
2640
2642
  score_desc: ""
2641
2643
  }, ai = async (e, { operationId: n }, { clients: { commerce: t } }) => {
2642
2644
  if (!n)
2643
- throw new T("Missing operationId");
2645
+ throw new _("Missing operationId");
2644
2646
  return t.orderEntry.getOperation({ operationId: n });
2645
2647
  }, oi = async (e, { orderFormId: n }, { clients: { commerce: t } }) => {
2646
2648
  if (!n)
2647
- throw new T("Missing orderFormId");
2649
+ throw new _("Missing orderFormId");
2648
2650
  const { items: r } = await t.orderEntry.getOrderFormItems({ orderFormId: n });
2649
2651
  return (r ?? []).map((i) => ({
2650
2652
  id: i.id,
@@ -2670,7 +2672,7 @@ async function li(e, n, t, r) {
2670
2672
  }
2671
2673
  async function di(e, n) {
2672
2674
  if (n == null)
2673
- throw new T("Missing slug or id");
2675
+ throw new _("Missing slug or id");
2674
2676
  const {
2675
2677
  clients: { commerce: t, search: r }
2676
2678
  } = e, i = await t.catalog.portal.pagetype(`${n}/p`);
@@ -2910,7 +2912,7 @@ const ui = {
2910
2912
  userOrder: async (e, { orderId: n }, t) => {
2911
2913
  try {
2912
2914
  if (!n)
2913
- throw new T("Missing orderId");
2915
+ throw new _("Missing orderId");
2914
2916
  const {
2915
2917
  clients: { commerce: r }
2916
2918
  } = t, i = await r.oms.userOrder({ orderId: n });
@@ -3086,7 +3088,7 @@ const ui = {
3086
3088
  // Contract list from VTEX session `shopper.availableContracts`.
3087
3089
  availableContracts: async (e, { orgUnitId: n }, t) => {
3088
3090
  if (!n)
3089
- throw new T("Missing orgUnitId");
3091
+ throw new _("Missing orgUnitId");
3090
3092
  const {
3091
3093
  account: r,
3092
3094
  headers: i,
@@ -3216,7 +3218,7 @@ const ui = {
3216
3218
  1: "In 1 minute",
3217
3219
  other: "Up to # minutes"
3218
3220
  }
3219
- }, An = (e) => {
3221
+ }, Pn = (e) => {
3220
3222
  const [n, t] = [e.split(/\D+/)[0], e.split(/[0-9]+/)[1]], r = n !== "" && !Number.isNaN(Number(n)), i = Si(t);
3221
3223
  if (!r || !i)
3222
3224
  return "";
@@ -3225,7 +3227,7 @@ const ui = {
3225
3227
  }, Ii = {
3226
3228
  carrier: (e) => e?.friendlyName ?? e?.name ?? "",
3227
3229
  price: (e) => e?.price ? e.price / 100 : e?.price,
3228
- localizedEstimates: (e) => e?.shippingEstimate ? An(e.shippingEstimate) : ""
3230
+ localizedEstimates: (e) => e?.shippingEstimate ? Pn(e.shippingEstimate) : ""
3229
3231
  }, Je = "skuvariation";
3230
3232
  function Ke(e, n) {
3231
3233
  const t = `${Je}${n}`.toLowerCase(), r = e.find(
@@ -3333,21 +3335,21 @@ const Di = {
3333
3335
  );
3334
3336
  },
3335
3337
  allVariantProducts: (e) => e.isVariantOf.items.map((n) => N(n, e.isVariantOf))
3336
- }, Ai = {
3338
+ }, Pi = {
3337
3339
  "pickup-in-point": "Pickup",
3338
3340
  delivery: "Delivery",
3339
3341
  pickup: "Pickup",
3340
3342
  "take-away": "Take away",
3341
3343
  "": ""
3342
- }, Pi = {
3344
+ }, Ai = {
3343
3345
  deliveryOptionsData: (e) => {
3344
3346
  const { shippingData: n, items: t } = e, r = n?.logisticsInfo || [], i = n?.selectedAddresses || n?.availableAddresses || [n?.address], a = r.reduce(
3345
3347
  (l, p) => {
3346
- const u = p?.selectedSla || "", h = p?.selectedDeliveryChannel || p?.deliveryChannel || "", f = p?.deliveryCompany || "", v = p?.deliveryWindow, d = p?.pickupStoreInfo, g = p?.shippingEstimate || "", m = p?.shippingEstimate ? An(p?.shippingEstimate) : "", y = p?.shippingEstimateDate || "", O = p?.addressId || "", w = p?.itemIndex ?? 0, C = t?.[w], P = C?.seller || "", S = `${u}|${h}|${f}|${P}|${g}|${y}|${O}|${v?.startDateUtc}|${v?.endDateUtc}`, D = i?.find(
3347
- (_) => _?.addressId === O
3348
- ), A = `${Ai[h] || ""} ${m} ${D?.neighborhood ? `to ${D?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: U, taxPriceTags: b } = Ui(
3348
+ const u = p?.selectedSla || "", h = p?.selectedDeliveryChannel || p?.deliveryChannel || "", f = p?.deliveryCompany || "", v = p?.deliveryWindow, d = p?.pickupStoreInfo, g = p?.shippingEstimate || "", m = p?.shippingEstimate ? Pn(p?.shippingEstimate) : "", y = p?.shippingEstimateDate || "", O = p?.addressId || "", w = p?.itemIndex ?? 0, C = t?.[w], A = C?.seller || "", S = `${u}|${h}|${f}|${A}|${g}|${y}|${O}|${v?.startDateUtc}|${v?.endDateUtc}`, D = i?.find(
3349
+ (T) => T?.addressId === O
3350
+ ), P = `${Pi[h] || ""} ${m} ${D?.neighborhood ? `to ${D?.neighborhood}` : ""}`.trim(), { taxPriceTagsTotal: k, taxPriceTags: b } = ki(
3349
3351
  C?.priceTags ?? []
3350
- ), k = (C?.sellingPrice ?? 0) * (C?.quantity ?? 0) + (C?.tax ?? 0) + (U ?? 0);
3352
+ ), U = (C?.sellingPrice ?? 0) * (C?.quantity ?? 0) + (C?.tax ?? 0) + (k ?? 0);
3351
3353
  return l[S] || (l[S] = {
3352
3354
  // static fields
3353
3355
  selectedSla: u,
@@ -3356,9 +3358,9 @@ const Di = {
3356
3358
  deliveryWindow: v,
3357
3359
  shippingEstimate: g,
3358
3360
  shippingEstimateDate: y,
3359
- seller: P,
3361
+ seller: A,
3360
3362
  friendlyShippingEstimate: m,
3361
- friendlyDeliveryOptionName: A,
3363
+ friendlyDeliveryOptionName: P,
3362
3364
  address: D,
3363
3365
  pickupStoreInfo: d,
3364
3366
  // dynamic fields
@@ -3374,10 +3376,10 @@ const Di = {
3374
3376
  sellingPrice: C?.sellingPrice || 0,
3375
3377
  imageUrl: C?.imageUrl || "",
3376
3378
  taxPriceTags: b ?? [],
3377
- taxPriceTagsTotal: U ?? 0,
3379
+ taxPriceTagsTotal: k ?? 0,
3378
3380
  tax: C?.tax || 0,
3379
- total: k
3380
- }), l[S].quantityOfDifferentItems = (l[S].quantityOfDifferentItems ?? 0) + 1, l[S].total = (l[S].total ?? 0) + k), l;
3381
+ total: U
3382
+ }), l[S].quantityOfDifferentItems = (l[S].quantityOfDifferentItems ?? 0) + 1, l[S].total = (l[S].total ?? 0) + U), l;
3381
3383
  },
3382
3384
  {}
3383
3385
  ), o = Object.values(a), s = n?.contactInformation?.[0], c = {
@@ -3403,7 +3405,7 @@ const Di = {
3403
3405
  ) || [];
3404
3406
  }
3405
3407
  };
3406
- function Ui(e) {
3408
+ function ki(e) {
3407
3409
  const t = e.filter(
3408
3410
  (i) => i?.name?.includes("TAX")
3409
3411
  ), r = t.reduce(
@@ -3415,7 +3417,7 @@ function Ui(e) {
3415
3417
  taxPriceTagsTotal: r
3416
3418
  };
3417
3419
  }
3418
- const ki = {
3420
+ const Ui = {
3419
3421
  StoreCollection: dn,
3420
3422
  StoreAggregateOffer: er,
3421
3423
  StoreProduct: Zr,
@@ -3432,11 +3434,11 @@ const ki = {
3432
3434
  StorePropertyValue: ti,
3433
3435
  SkuVariants: Di,
3434
3436
  ShippingSLA: Ii,
3435
- UserOrderResult: Pi,
3437
+ UserOrderResult: Ai,
3436
3438
  ObjectOrString: Gr,
3437
3439
  Query: ui,
3438
3440
  Mutation: qr
3439
- }, _i = () => ki, Ti = `"""
3441
+ }, Ti = () => Ui, _i = `"""
3440
3442
  Address information.
3441
3443
  """
3442
3444
  type Address {
@@ -3984,6 +3986,12 @@ type StoreOffer {
3984
3986
  Whether this offer is a gift (e.g. free promotional item).
3985
3987
  """
3986
3988
  isGift: Boolean
3989
+ """
3990
+ Signed price token (JWT) used by the Pricing Fallback feature. When present, it should be
3991
+ forwarded to Checkout on add-to-cart so the platform can trust the offer's price even if
3992
+ the Pricing System is unavailable. May be null when the signing step fails or the feature is disabled.
3993
+ """
3994
+ priceToken: String
3987
3995
  }
3988
3996
 
3989
3997
  """
@@ -4010,6 +4018,10 @@ input IStoreOffer {
4010
4018
  Number of items offered.
4011
4019
  """
4012
4020
  quantity: Int!
4021
+ """
4022
+ Signed price token (JWT) from the Pricing Fallback feature, forwarded to Checkout on add-to-cart.
4023
+ """
4024
+ priceToken: String
4013
4025
  }
4014
4026
  `, Hi = `"""
4015
4027
  Information of a specific order.
@@ -7317,7 +7329,7 @@ type UserOrderBudgetAllocationLinkedEntity {
7317
7329
  id: String
7318
7330
  }
7319
7331
  `, ha = /* @__PURE__ */ Object.assign({
7320
- "./address.graphql": Ti,
7332
+ "./address.graphql": _i,
7321
7333
  "./advertisement.graphql": Ei,
7322
7334
  "./aggregateOffer.graphql": Ri,
7323
7335
  "./aggregateRating.graphql": Fi,
@@ -7355,7 +7367,7 @@ type UserOrderBudgetAllocationLinkedEntity {
7355
7367
  "./skuVariants.graphql": pa,
7356
7368
  "./status.graphql": ga,
7357
7369
  "./userOrder.graphql": ma
7358
- }), fa = Tn(
7370
+ }), fa = _n(
7359
7371
  Object.values(ha).map((e) => En(e)).reduce(
7360
7372
  (e, n) => Ze([e, n], { sort: !0 })
7361
7373
  )
@@ -7369,7 +7381,7 @@ type UserOrderBudgetAllocationLinkedEntity {
7369
7381
  }, n.account = e.account, n.OTEL = e.OTEL, n.discoveryConfig = e.discoveryConfig, n.clients = zt(e, n), n.loaders = Jt(e, n), n)
7370
7382
  );
7371
7383
  function ya() {
7372
- const e = _i(), n = {};
7384
+ const e = Ti(), n = {};
7373
7385
  for (const [t, r] of Object.entries(e))
7374
7386
  n[t] = Object.fromEntries(
7375
7387
  Object.entries(r).map(([i, a]) => typeof a != "function" ? [i, a] : [i, Kn(a, `${t}(${i})`)])
@@ -7381,13 +7393,13 @@ function La(e) {
7381
7393
  Yn,
7382
7394
  Gn
7383
7395
  ])(ya(), Sa);
7384
- return e && Rn(e) ? kn({
7396
+ return e && Rn(e) ? Un({
7385
7397
  schemas: [t, e]
7386
7398
  }) : t;
7387
7399
  }
7388
7400
  export {
7389
7401
  Gn as AuthDirective,
7390
- T as BadRequestError,
7402
+ _ as BadRequestError,
7391
7403
  Yn as CacheControlDirective,
7392
7404
  Bn as CommercialAuthorizationStatus,
7393
7405
  ee as FastStoreError,
@@ -7406,7 +7418,7 @@ export {
7406
7418
  Qn as isForbiddenError,
7407
7419
  X as isNotFoundError,
7408
7420
  Fa as isUnauthorizedError,
7409
- Ta as stringifyCacheControl,
7421
+ _a as stringifyCacheControl,
7410
7422
  Sa as typeDefs,
7411
7423
  Jn as withDirectives
7412
7424
  };