@spiffcommerce/core 26.38.0 → 26.39.0-beta.2c2804ed-43ba-521e-bcb3-7dbf982a6283

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/index.mjs CHANGED
@@ -7,7 +7,7 @@ import { orientation as ur } from "exifr/dist/mini.umd.cjs";
7
7
  import { parse as nn } from "css";
8
8
  import hr from "fuse.js";
9
9
  import { Pith as ca } from "pith";
10
- import Ft from "lodash.clonedeep";
10
+ import St from "lodash.clonedeep";
11
11
  import { toString as rn } from "qrcode";
12
12
  import mr from "svg-path-bbox";
13
13
  import { parse as Je } from "opentype.js";
@@ -40,7 +40,7 @@ class q extends Jt {
40
40
  super(`Panel not Found: ${t.panelId}`), this.panelId = (t == null ? void 0 : t.panelId) || "N/A";
41
41
  }
42
42
  }
43
- class St extends Jt {
43
+ class vt extends Jt {
44
44
  constructor(t) {
45
45
  super(`Asset not found for variant: ${t.name}`), this.variant = t;
46
46
  }
@@ -65,7 +65,7 @@ class z extends be {
65
65
  super(`Unhandled Behavior Encountered: ${t}`);
66
66
  }
67
67
  }
68
- class Pt extends be {
68
+ class Ft extends be {
69
69
  constructor(t) {
70
70
  super(`Parsing Error: ${t}`);
71
71
  }
@@ -224,7 +224,7 @@ const cn = /* @__PURE__ */ new Map(), xa = /* @__PURE__ */ new Map(), ka = /* @_
224
224
  const n = a.load();
225
225
  return Qe.set(t, n), n;
226
226
  }
227
- }, Bt = () => {
227
+ }, bt = () => {
228
228
  if (Tt([typeof XMLSerializer]))
229
229
  return new XMLSerializer();
230
230
  const r = Kt();
@@ -347,8 +347,9 @@ class $r {
347
347
  headers: l
348
348
  };
349
349
  }), a = cr(({ operation: i, graphQLErrors: s, networkError: o }) => {
350
- const l = s || [];
351
- o && console.log("GraphQL Network error"), l.forEach(() => console.log("GraphQL Error: " + i.operationName));
350
+ var d, A;
351
+ const l = s || [], c = i.getContext();
352
+ o && !((A = (d = c == null ? void 0 : c.fetchOptions) == null ? void 0 : d.signal) != null && A.aborted) && console.log("GraphQL Network error"), l.forEach(() => console.log("GraphQL Error: " + i.operationName));
352
353
  }), n = Ar();
353
354
  return new ir({
354
355
  link: sr([n, a, e, t]),
@@ -3328,7 +3329,7 @@ const ie = (r) => {
3328
3329
  }
3329
3330
  });
3330
3331
  });
3331
- }, yn = (r) => Bt().serializeToString(r), ga = (r, t, e, a, n) => {
3332
+ }, yn = (r) => bt().serializeToString(r), ga = (r, t, e, a, n) => {
3332
3333
  const i = Cn(r);
3333
3334
  if (!i)
3334
3335
  throw new Error("Failed to read SVG.");
@@ -3360,7 +3361,7 @@ const ie = (r) => {
3360
3361
  s.classList.add(A), s.setAttribute("stroke", c.browserValue), a[d] = c;
3361
3362
  }
3362
3363
  });
3363
- const i = Bt().serializeToString(e);
3364
+ const i = bt().serializeToString(e);
3364
3365
  return {
3365
3366
  colors: a,
3366
3367
  svg: i
@@ -3609,7 +3610,7 @@ class si {
3609
3610
  d.lengthComputable && a(d.loaded * 100 / d.total);
3610
3611
  }, c.onload = () => {
3611
3612
  const d = s.assetResponse.asset;
3612
- bt.add(s.assetResponse.asset), o(d);
3613
+ It.add(s.assetResponse.asset), o(d);
3613
3614
  }, c.onerror = l, this.postProcessFileUpload(t, s.mimeType).then((d) => c.send(d.blob)).catch(l);
3614
3615
  }), this.cacheAsset(s.assetResponse.asset), s.assetResponse.asset;
3615
3616
  }
@@ -3641,7 +3642,7 @@ class si {
3641
3642
  });
3642
3643
  if (this.bgrmProcessCache.delete(e), !((o = (s = i.data) == null ? void 0 : s.assetRemoveBackground) != null && o.key))
3643
3644
  throw new Error("Failed to remove background from image");
3644
- return bt.add(i.data.assetRemoveBackground), Y.add(e, i.data.assetRemoveBackground.key), this.cache.set(
3645
+ return It.add(i.data.assetRemoveBackground), Y.add(e, i.data.assetRemoveBackground.key), this.cache.set(
3645
3646
  i.data.assetRemoveBackground.key,
3646
3647
  Promise.resolve(i.data.assetRemoveBackground)
3647
3648
  ), i.data.assetRemoveBackground;
@@ -3649,16 +3650,16 @@ class si {
3649
3650
  return this.bgrmProcessCache.set(e, n), n;
3650
3651
  }
3651
3652
  removePersistedAsset(t) {
3652
- bt.remove(t), Y.delete(t), Y.deleteForBgRemovedKey(t);
3653
+ It.remove(t), Y.delete(t), Y.deleteForBgRemovedKey(t);
3653
3654
  }
3654
3655
  getPersistedAssets() {
3655
- return bt.list();
3656
+ return It.list();
3656
3657
  }
3657
3658
  registerPersistedAssetListener(t) {
3658
- bt.addCallback(t);
3659
+ It.addCallback(t);
3659
3660
  }
3660
3661
  unRegisterPersistedAssetListener(t) {
3661
- bt.removeCallback(t);
3662
+ It.removeCallback(t);
3662
3663
  }
3663
3664
  isRaster(t) {
3664
3665
  return !(t.type === "image/svg+xml" || t.type === "application/pdf" || t.type === "application/postscript");
@@ -3667,9 +3668,9 @@ class si {
3667
3668
  if (e === "image/svg+xml") {
3668
3669
  const a = await t.blob.text(), s = new window.DOMParser().parseFromString(a, "image/svg+xml").documentElement;
3669
3670
  if (!s)
3670
- throw new Pt("Failed to read SVG.");
3671
+ throw new Ft("Failed to read SVG.");
3671
3672
  Kr(s);
3672
- const l = Bt().serializeToString(s);
3673
+ const l = bt().serializeToString(s);
3673
3674
  return {
3674
3675
  name: t.name,
3675
3676
  blob: new Blob([l], { type: "image/svg+xml" })
@@ -3756,7 +3757,7 @@ const Rt = "persistentAssets", Sn = class Ct {
3756
3757
  }
3757
3758
  };
3758
3759
  Sn.callbacks = [];
3759
- let bt = Sn;
3760
+ let It = Sn;
3760
3761
  const Ra = "bgrmPersistentAssets";
3761
3762
  class Y {
3762
3763
  static has(t) {
@@ -5197,9 +5198,9 @@ const _ = new ui(), En = y`
5197
5198
  silentSteps: r.silentSteps.filter((a) => yt(a, t))
5198
5199
  };
5199
5200
  return e.silentSteps.length === 0 && e.renderableSteps.length === 0 ? null : e;
5200
- }, Dt = (r, t) => r.map((e) => Oi(e, t)).filter((e) => e !== null), $i = async (r, t, e = !1) => {
5201
+ }, Pt = (r, t) => r.map((e) => Oi(e, t)).filter((e) => e !== null), $i = async (r, t, e = !1) => {
5201
5202
  var s;
5202
- const a = Dt(r, t), n = [];
5203
+ const a = Pt(r, t), n = [];
5203
5204
  for (const o of a)
5204
5205
  for (const l of o.renderableSteps) {
5205
5206
  const c = (((s = l.option) == null ? void 0 : s.variants) || []).length;
@@ -5422,7 +5423,7 @@ const N = () => {
5422
5423
  }), xc = (r, t, e, a) => ({
5423
5424
  x: r.x + ((t == null ? void 0 : t.x) + (t == null ? void 0 : t.width)) * e,
5424
5425
  y: r.y + ((t == null ? void 0 : t.y) + (t == null ? void 0 : t.height)) * a
5425
- }), It = (r) => {
5426
+ }), Dt = (r) => {
5426
5427
  switch (r) {
5427
5428
  case j.North:
5428
5429
  return j.East;
@@ -5441,7 +5442,7 @@ const N = () => {
5441
5442
  case j.Southwest:
5442
5443
  return j.Northwest;
5443
5444
  }
5444
- }, kc = (r, t) => t > 45 && t <= 135 ? It(r) : t > 135 && t <= 225 ? It(It(r)) : t > 225 && t <= 315 ? It(It(It(r))) : r, Mc = (r, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
5445
+ }, kc = (r, t) => t > 45 && t <= 135 ? Dt(r) : t > 135 && t <= 225 ? Dt(Dt(r)) : t > 225 && t <= 315 ? Dt(Dt(Dt(r))) : r, Mc = (r, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
5445
5446
  const a = pt(r.rotation), n = {
5446
5447
  x: t.x + r.x * e.x,
5447
5448
  y: t.x + r.y * e.y
@@ -5673,7 +5674,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
5673
5674
  return Oe.get(r);
5674
5675
  const e = (async () => {
5675
5676
  try {
5676
- return vt(r).getFont();
5677
+ return Et(r).getFont();
5677
5678
  } catch {
5678
5679
  if (zi(r)) {
5679
5680
  const a = un(r), n = Je(a);
@@ -5688,7 +5689,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
5688
5689
  }, Gi = (r) => {
5689
5690
  const t = un(r), e = Je(t);
5690
5691
  return aa(r, e), e;
5691
- }, vt = (r) => {
5692
+ }, Et = (r) => {
5692
5693
  const t = Mn.get(r);
5693
5694
  if (t)
5694
5695
  return t;
@@ -5731,7 +5732,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
5731
5732
  const I = B.toSVG(2), F = t.parseFromString(I, "image/svg+xml").firstElementChild;
5732
5733
  h.appendChild(F);
5733
5734
  }
5734
- return e.querySelectorAll("text").forEach((d) => d.remove()), Bt().serializeToString(a);
5735
+ return e.querySelectorAll("text").forEach((d) => d.remove()), bt().serializeToString(a);
5735
5736
  }, we = (r, t, e, a) => Math.max(qi(r.join(`
5736
5737
  `), e, a), t), Oa = (r, t, e, a, n, i) => {
5737
5738
  const s = (i || Ca) * n.getApproximateHeight(), o = t.split(`
@@ -5789,7 +5790,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
5789
5790
  return Math.min(A, d);
5790
5791
  }, ji = (r, t, e, a) => {
5791
5792
  var c;
5792
- const n = vt(t.fontData.assetUrl), i = n.getFont(), s = t.fontSize / i.unitsPerEm;
5793
+ const n = Et(t.fontData.assetUrl), i = n.getFont(), s = t.fontSize / i.unitsPerEm;
5793
5794
  if (!e)
5794
5795
  return Oa(t, r, t.fontSize, s, n, a);
5795
5796
  let o;
@@ -5810,9 +5811,9 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
5810
5811
  fontSize: Wi(o, n, i, t.width, t.height, a)
5811
5812
  } : Oa(t, r, t.fontSize, s, n, a);
5812
5813
  }, Hi = (r, t, e, a, n) => {
5813
- const s = vt(t.assetUrl).getFont();
5814
+ const s = Et(t.assetUrl).getFont();
5814
5815
  let o = { ...r };
5815
- const l = { ...r }, c = Tn(a, e / s.unitsPerEm, vt(t.assetUrl));
5816
+ const l = { ...r }, c = Tn(a, e / s.unitsPerEm, Et(t.assetUrl));
5816
5817
  return c && c < o.width && (l.width = c, n === "left" ? (l.left += Math.sin(o.rotation * Math.PI / 360) * (o.width - c), l.top += Math.sin(o.rotation * Math.PI / 180) * (c - o.width) / 2) : n === "right" ? l.left += o.width - c : l.left += (o.width - c) / 2, a && Yi(a, a).every(([d, A]) => d === A) && (o = l)), o;
5817
5818
  }, $e = 1, ht = (r, t, e) => {
5818
5819
  let a = 0;
@@ -6300,7 +6301,7 @@ const te = (r) => {
6300
6301
  const s = dt().parseFromString(r, "image/svg+xml").firstElementChild;
6301
6302
  if (!s)
6302
6303
  throw new Error("Failed to read SVG");
6303
- const l = Bt().serializeToString(s), c = gt(), d = c.getContext("2d"), A = await ca.from(d, l, {
6304
+ const l = bt().serializeToString(s), c = gt(), d = c.getContext("2d"), A = await ca.from(d, l, {
6304
6305
  anonymousCrossOrigin: !0,
6305
6306
  ignoreDimensions: !1,
6306
6307
  createCanvas: gt,
@@ -6343,7 +6344,7 @@ const te = (r) => {
6343
6344
  }
6344
6345
  if (e && t === T.Textbox && (a != null && a.text) && (a != null && a.fontScale)) {
6345
6346
  await Qt(e);
6346
- const l = vt(e), c = ht(a.text, a == null ? void 0 : a.fontScale, l);
6347
+ const l = Et(e), c = ht(a.text, a == null ? void 0 : a.fontScale, l);
6347
6348
  o.width = Math.min(c, n.width * 0.85), o.left = n.x + n.width / 2 - o.width / 2;
6348
6349
  }
6349
6350
  return o;
@@ -6756,7 +6757,7 @@ class G extends O {
6756
6757
  return a !== void 0 ? a + 1 : 0;
6757
6758
  }
6758
6759
  }
6759
- class Et extends O {
6760
+ class Bt extends O {
6760
6761
  constructor(t) {
6761
6762
  super(), this.id = t;
6762
6763
  }
@@ -7364,7 +7365,7 @@ class ds {
7364
7365
  40
7365
7366
  );
7366
7367
  });
7367
- t.forEach((h) => a.getCommandDispatcher()(new Et(h.id)));
7368
+ t.forEach((h) => a.getCommandDispatcher()(new Bt(h.id)));
7368
7369
  const o = n.data.baseUrl.slice(0, 4) === "http" ? "" : "https://", l = new URL(o + n.data.baseUrl);
7369
7370
  l.searchParams.append("video", btoa(JSON.stringify([s]))), l.pathname = l.pathname + (l.pathname.slice(-1) === "/" ? "" : "/");
7370
7371
  const c = l.toString();
@@ -7422,7 +7423,7 @@ class Se {
7422
7423
  return na(e);
7423
7424
  const a = t.asset;
7424
7425
  if (!a)
7425
- throw new St(t);
7426
+ throw new vt(t);
7426
7427
  const n = a.fileLink;
7427
7428
  if (n)
7428
7429
  return at(n, !0);
@@ -7706,7 +7707,7 @@ class Se {
7706
7707
  i && i(!0);
7707
7708
  const c = t.data.initialZoomLevel, d = await Promise.all(
7708
7709
  t.data.regions.map(async (m, g) => {
7709
- const p = await Me(l[g]), f = o.getImageData(), C = a.map((I) => new Et(I.id)), w = f ? Sa(
7710
+ const p = await Me(l[g]), f = o.getImageData(), C = a.map((I) => new Bt(I.id)), w = f ? Sa(
7710
7711
  f,
7711
7712
  p,
7712
7713
  c && !t.data.forceImageCover ? { scale: c } : void 0,
@@ -7968,11 +7969,11 @@ class As {
7968
7969
  if (!t.data || !t.data.regions)
7969
7970
  throw new Ce(t, "Missing regions.");
7970
7971
  n(!0);
7971
- const s = a.map((C) => new Et(C.id));
7972
+ const s = a.map((C) => new Bt(C.id));
7972
7973
  t.mandatory && i.setMandatoryFulfilled(t.stepName, !1);
7973
7974
  const o = e.asset;
7974
7975
  if (!o)
7975
- throw new St(e);
7976
+ throw new vt(e);
7976
7977
  const l = o.fileLink;
7977
7978
  if (!l)
7978
7979
  throw new jt(o);
@@ -8110,7 +8111,7 @@ class us {
8110
8111
  n(!0);
8111
8112
  const s = e.material;
8112
8113
  if (!s)
8113
- throw n(!1), new St(e);
8114
+ throw n(!1), new vt(e);
8114
8115
  return {
8115
8116
  command: void 0,
8116
8117
  followup: async () => {
@@ -8165,7 +8166,7 @@ class hs {
8165
8166
  if (h && t.option) {
8166
8167
  const g = (m = A.asset) == null ? void 0 : m.fileLink;
8167
8168
  if (!g)
8168
- throw new St(A);
8169
+ throw new vt(A);
8169
8170
  await h.applyModelVariant(
8170
8171
  t.stepName || "",
8171
8172
  {
@@ -8190,7 +8191,7 @@ class hs {
8190
8191
  n(!0);
8191
8192
  const i = (s = e.asset) == null ? void 0 : s.fileLink;
8192
8193
  if (!i)
8193
- throw new St(e);
8194
+ throw new vt(e);
8194
8195
  return {
8195
8196
  command: void 0,
8196
8197
  followup: async () => {
@@ -8253,7 +8254,7 @@ class ms {
8253
8254
  if (!p)
8254
8255
  return console.error(`Can not find layout for region: ${u.panelId}`), null;
8255
8256
  const f = [];
8256
- return h && f.push(new Et(m)), f.push(
8257
+ return h && f.push(new Bt(m)), f.push(
8257
8258
  new G(
8258
8259
  {
8259
8260
  stepRegion: u,
@@ -8370,12 +8371,12 @@ class gs {
8370
8371
  async selectVariantCommand(t, e, a, n) {
8371
8372
  const i = e.asset;
8372
8373
  if (!i)
8373
- throw new St(e);
8374
+ throw new vt(e);
8374
8375
  const s = i == null ? void 0 : i.fileLink;
8375
8376
  if (!s)
8376
8377
  return console.error("No URL for picture!"), null;
8377
8378
  n(!0), t.mandatory && a.setMandatoryFulfilled(t.stepName, !1);
8378
- const l = a.getRegionElements(t.stepName).map((A) => new Et(A.id)), c = (A) => {
8379
+ const l = a.getRegionElements(t.stepName).map((A) => new Bt(A.id)), c = (A) => {
8379
8380
  const h = a.getLayouts().find((g) => g.panelId === A.panelId);
8380
8381
  if (!h)
8381
8382
  throw new q(A);
@@ -8705,7 +8706,7 @@ const ws = new Cs(), Ge = (r, t, e, a, n) => {
8705
8706
  return [null, null];
8706
8707
  }, he = (r, t, e, a, n) => {
8707
8708
  let i, s;
8708
- const o = vt(t.assetUrl), l = o.getFont();
8709
+ const o = Et(t.assetUrl), l = o.getFont();
8709
8710
  if (n.size) {
8710
8711
  const u = r / l.unitsPerEm;
8711
8712
  return [i, s] = Ge(e, a, r, u, o), [n.size, i, s];
@@ -8740,7 +8741,7 @@ class Ss {
8740
8741
  /(\r\n|\r|(\u2665|\u00a9|\u00ae|[\u2000-\u2017]|[\u201E-\u3300]]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]))/gm,
8741
8742
  ""
8742
8743
  );
8743
- const n = [], i = e ? vt(e.assetUrl) : void 0;
8744
+ const n = [], i = e ? Et(e.assetUrl) : void 0;
8744
8745
  if (i) {
8745
8746
  const s = a.split("").filter((l) => !ys.includes(l)).join(""), o = s.split("").map((l) => i.getFont().charToGlyph(l));
8746
8747
  for (let l = 0; l < o.length; l++)
@@ -9060,7 +9061,7 @@ class Ss {
9060
9061
  async fontDataFromVariant(t) {
9061
9062
  const e = t.asset;
9062
9063
  if (!e)
9063
- throw new St(t);
9064
+ throw new vt(t);
9064
9065
  const a = e.fileLink;
9065
9066
  if (!a)
9066
9067
  throw new jt(e);
@@ -9382,7 +9383,7 @@ class Fs {
9382
9383
  u = (A * 100 | 0) / 100;
9383
9384
  break;
9384
9385
  default:
9385
- throw new Pt("Failed to encode path.");
9386
+ throw new Ft("Failed to encode path.");
9386
9387
  }
9387
9388
  l || s.push(" "), s.push(u), l = !1;
9388
9389
  }
@@ -9396,12 +9397,12 @@ class Fs {
9396
9397
  for (e.lastIndex = 0; i = e.exec(t); ) {
9397
9398
  const s = i[1].toLowerCase(), o = (i[2].match(a) || []).map(parseFloat), l = s === i[1], c = Wa[s];
9398
9399
  if (o.length < c.length)
9399
- throw new Pt(
9400
+ throw new Ft(
9400
9401
  `Path type "${s}" given ${o.length} arguments, expected ${c.length}.`
9401
9402
  );
9402
9403
  if (c.length > 0) {
9403
9404
  if (o.length % c.length !== 0)
9404
- throw new Pt(
9405
+ throw new Ft(
9405
9406
  `Path type "${s}" given ${o.length} arguments, not divisible by ${c.length}`
9406
9407
  );
9407
9408
  for (let d = 0; d < o.length / c.length; d++) {
@@ -9426,7 +9427,7 @@ class Fs {
9426
9427
  if (o in i && l in i) {
9427
9428
  const c = [i[o], i[l]], d = e(c);
9428
9429
  if (d.length < 2)
9429
- throw new Pt("Transformer must return at least 2 points.");
9430
+ throw new Ft("Transformer must return at least 2 points.");
9430
9431
  i[o] = d[0], i[l] = d[1];
9431
9432
  }
9432
9433
  }
@@ -9675,6 +9676,8 @@ const Ts = y`
9675
9676
  }
9676
9677
  bundles(ids: [$id]) {
9677
9678
  id
9679
+ dispatchDate
9680
+ purchaseOrder
9678
9681
  completed
9679
9682
  workflowViewerLink
9680
9683
  workflowViewerAmendLink
@@ -9708,6 +9711,8 @@ const Ts = y`
9708
9711
  query GetBundleStakeholders($id: String!) {
9709
9712
  bundles(ids: [$id]) {
9710
9713
  id
9714
+ dispatchDate
9715
+ purchaseOrder
9711
9716
  completed
9712
9717
  workflowViewerLink
9713
9718
  workflowViewerAmendLink
@@ -9758,6 +9763,8 @@ const Ts = y`
9758
9763
  type
9759
9764
  bundle {
9760
9765
  id
9766
+ dispatchDate
9767
+ purchaseOrder
9761
9768
  completed
9762
9769
  workflowViewerLink
9763
9770
  workflowViewerAmendLink
@@ -9906,8 +9913,8 @@ const Ts = y`
9906
9913
  }
9907
9914
  }
9908
9915
  `, Vs = y`
9909
- mutation UpdateBundle($id: String!, $name: String, $metadata: [MetadataInput!], $bundleStateData: String) {
9910
- bundleUpdate(id: $id, name: $name, metadata: $metadata, bundleStateData: $bundleStateData) {
9916
+ mutation UpdateBundle($id: String!, $name: String, $metadata: [MetadataInput!], $bundleStateData: String, $dispatchDate: String, $purchaseOrder: String) {
9917
+ bundleUpdate(id: $id, name: $name, metadata: $metadata, bundleStateData: $bundleStateData, dispatchDate: $dispatchDate, purchaseOrder: $purchaseOrder) {
9911
9918
  id
9912
9919
  }
9913
9920
  }
@@ -10026,6 +10033,8 @@ const Ts = y`
10026
10033
  customerBundlesFeed(id: $id, limit: $limit, offset: $offset, template: $template, templateStatus: $templateStatus, ordered: $ordered) {
10027
10034
  items {
10028
10035
  id
10036
+ dispatchDate
10037
+ purchaseOrder
10029
10038
  name
10030
10039
  template
10031
10040
  templateStatus
@@ -10261,7 +10270,7 @@ class lo {
10261
10270
  this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((o) => {
10262
10271
  this.storage[o.stepName] = o.storage || {};
10263
10272
  }), this.allScenes = await Ni(t);
10264
- const n = Dt(this.allScenes, this.stepSelections).map((o) => o.silentSteps).flat(), { stepElements: i, commands: s } = await this.stepElementsForIntroducedSilentSteps(n, !!this.reloadedState);
10273
+ const n = Pt(this.allScenes, this.stepSelections).map((o) => o.silentSteps).flat(), { stepElements: i, commands: s } = await this.stepElementsForIntroducedSilentSteps(n, !!this.reloadedState);
10265
10274
  this.commandContext.apply(new $(s), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
10266
10275
  }
10267
10276
  getWorkflowExperience() {
@@ -10467,7 +10476,7 @@ class lo {
10467
10476
  },
10468
10477
  { refocusCamera: e }
10469
10478
  );
10470
- this.setModelContainer(a), Dt(this.allScenes, this.stepSelections).filter((s) => s).map((s) => s.renderableSteps).flat().filter((s) => s.type === D.Model || s.type === D.Material).forEach((s) => {
10479
+ this.setModelContainer(a), Pt(this.allScenes, this.stepSelections).filter((s) => s).map((s) => s.renderableSteps).flat().filter((s) => s.type === D.Model || s.type === D.Material).forEach((s) => {
10471
10480
  var c, d, A;
10472
10481
  if (!((c = s.option) != null && c.id)) {
10473
10482
  console.error(`Failed to read option id from step: ${s.stepName}`);
@@ -10579,7 +10588,7 @@ class lo {
10579
10588
  const t = this.getCommandContext().getState();
10580
10589
  if (!t)
10581
10590
  throw new z("Attempted to serialize state before it was initialized.");
10582
- const e = Ft(t.transaction), a = this.dehydrateState(e);
10591
+ const e = St(t.transaction), a = this.dehydrateState(e);
10583
10592
  return JSON.stringify(a);
10584
10593
  }
10585
10594
  /**
@@ -10712,7 +10721,7 @@ class lo {
10712
10721
  async reset() {
10713
10722
  this.commandContext.getAllLayouts().forEach(
10714
10723
  (e) => e.layoutState.elements.forEach((a) => {
10715
- this.getCommandDispatcher()(new Et(a.id));
10724
+ this.getCommandDispatcher()(new Bt(a.id));
10716
10725
  })
10717
10726
  ), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
10718
10727
  }
@@ -10725,7 +10734,7 @@ class lo {
10725
10734
  }, this.selectionCost = Object.values(this.stepSelections).reduce((E, B) => E + B.selectedVariants.map((I) => I.priceModifier || 0).reduce((I, P) => I + P, 0), 0), this.workflow.steps.forEach((E) => {
10726
10735
  yt(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1, delete this.stepMetadata[E.stepName], delete this.stepSelections[E.stepName], delete this.storage[E.stepName]);
10727
10736
  });
10728
- const s = this.allScenes, o = Dt(s, i), l = Dt(s, this.stepSelections), c = o.map((E) => E.silentSteps).flat(), A = l.map((E) => E.silentSteps).flat().filter(
10737
+ const s = this.allScenes, o = Pt(s, i), l = Pt(s, this.stepSelections), c = o.map((E) => E.silentSteps).flat(), A = l.map((E) => E.silentSteps).flat().filter(
10729
10738
  (E) => !c.some((B) => B.stepName === E.stepName)
10730
10739
  );
10731
10740
  c.forEach((E) => {
@@ -10742,7 +10751,7 @@ class lo {
10742
10751
  const E = (S = this.getWorkflowExperience().getStepById(g.stepName)) == null ? void 0 : S.frameService;
10743
10752
  E == null || E.setTargetElements(a.map((B) => B.id));
10744
10753
  }
10745
- const p = u.map((E) => new Et(E.id)), f = new Va(this.constructSerializableWorkflow()), C = [...m, ...p, f];
10754
+ const p = u.map((E) => new Bt(E.id)), f = new Va(this.constructSerializableWorkflow()), C = [...m, ...p, f];
10746
10755
  C.length > 0 && this.commandContext.apply(new $(C), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
10747
10756
  const w = this.getInvalidModelVariants(), v = this.modelContainer;
10748
10757
  if (v) {
@@ -10760,7 +10769,7 @@ class lo {
10760
10769
  await this.onSelectionChange(), n && await n();
10761
10770
  }
10762
10771
  async ensureStepsAreLoaded() {
10763
- const e = Dt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
10772
+ const e = Pt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
10764
10773
  for (const l of n)
10765
10774
  if (!this.stepInitialised[l.stepName])
10766
10775
  switch (this.stepInitialised[l.stepName] = !0, l.type) {
@@ -12410,7 +12419,7 @@ class Mo {
12410
12419
  }
12411
12420
  async copy() {
12412
12421
  var s;
12413
- const t = Ft(this.getCommandContext().getState());
12422
+ const t = St(this.getCommandContext().getState());
12414
12423
  if (!t)
12415
12424
  throw new z("Internal state is undefined! Cannot copy experience!");
12416
12425
  const e = JSON.stringify(t.transaction), a = this.getWorkflowManager().getWorkflow(), n = (s = this.getWorkflowManager().getTransaction().integrationProduct) == null ? void 0 : s.id;
@@ -12643,7 +12652,7 @@ const To = [
12643
12652
  B.classList.add(Q), g[Q] = { browserValue: F };
12644
12653
  }
12645
12654
  });
12646
- const f = Bt().serializeToString(m), C = n.colors;
12655
+ const f = bt().serializeToString(m), C = n.colors;
12647
12656
  if (C) {
12648
12657
  for (const [B, I] of Object.entries(g))
12649
12658
  for (const P of Object.keys(C))
@@ -12846,8 +12855,8 @@ const To = [
12846
12855
  const c = await at(i, !0), d = (A) => {
12847
12856
  const u = /<svg.*?<\/svg>/s, h = A.match(u) || [], m = (h == null ? void 0 : h.length) > 0 ? h[0] : "", f = dt().parseFromString(m, "image/svg+xml").firstElementChild;
12848
12857
  if (!f)
12849
- throw new Pt("Failed to read SVG.");
12850
- return ma(f), Bt().serializeToString(f);
12858
+ throw new Ft("Failed to read SVG.");
12859
+ return ma(f), bt().serializeToString(f);
12851
12860
  };
12852
12861
  l.forEach((A) => {
12853
12862
  const u = r.find((m) => m.panelId === A.panelId);
@@ -13104,7 +13113,7 @@ class qo {
13104
13113
  * Actions to perform when a static render event is fired for this canvas.
13105
13114
  */
13106
13115
  async render(t) {
13107
- const e = Ft(t);
13116
+ const e = St(t);
13108
13117
  this.lastRequestedRenderArguments = e;
13109
13118
  const a = this.getStaticContext();
13110
13119
  if (!a) {
@@ -13772,7 +13781,7 @@ class tl {
13772
13781
  }
13773
13782
  async setGlobalPropertyState(t) {
13774
13783
  this.globalPropertyState || await this.initPromise;
13775
- const e = Ft(this.globalPropertyState);
13784
+ const e = St(this.globalPropertyState);
13776
13785
  this.globalPropertyState = { ...t, id: e.id }, await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(e, this.globalPropertyState);
13777
13786
  }
13778
13787
  getAspect(t, e) {
@@ -13796,7 +13805,7 @@ class tl {
13796
13805
  const i = this.configuration.aspects.find((l) => l.name === t);
13797
13806
  if (!i)
13798
13807
  throw new Error(`Failed to find configuration aspect with name: ${t}`);
13799
- const s = Ft(this.globalPropertyState), o = this.globalPropertyState.aspects.filter((l) => l.name === t);
13808
+ const s = St(this.globalPropertyState), o = this.globalPropertyState.aspects.filter((l) => l.name === t);
13800
13809
  if (o.length > 0)
13801
13810
  if (n) {
13802
13811
  const l = o.find((c) => c.channel === n);
@@ -13837,7 +13846,7 @@ class tl {
13837
13846
  const n = this.configuration.aspects.find((o) => o.name === t);
13838
13847
  if (!n)
13839
13848
  throw new Error(`Failed to find configuration aspect with name: ${t}`);
13840
- const i = Ft(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((o) => o.name === t);
13849
+ const i = St(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((o) => o.name === t);
13841
13850
  if (s.length > 0)
13842
13851
  if (a) {
13843
13852
  const o = s.find((l) => l.channel === a);
@@ -14180,15 +14189,14 @@ class Zn {
14180
14189
  * @returns
14181
14190
  */
14182
14191
  async fetchProductsFeed(t, e, a, n, i, s) {
14183
- var c, d, A, u, h, m;
14184
14192
  if (this.fullFetched) {
14185
- const g = await (a ? this.filterProducts(a) : this.fetchProducts());
14193
+ const d = await (a ? this.filterProducts(a) : this.fetchProducts());
14186
14194
  return {
14187
- total: g.length,
14188
- items: g.slice(t, t + e)
14195
+ total: d.length,
14196
+ items: d.slice(t, t + e)
14189
14197
  };
14190
14198
  }
14191
- const o = await b.getShadowGraphqlClient().query({
14199
+ const o = new AbortController(), { signal: l } = o, c = b.getShadowGraphqlClient().watchQuery({
14192
14200
  query: $s,
14193
14201
  variables: {
14194
14202
  id: this.getId(),
@@ -14205,12 +14213,35 @@ class Zn {
14205
14213
  sortKey: i,
14206
14214
  sortDescending: s
14207
14215
  },
14208
- errorPolicy: "all"
14216
+ errorPolicy: "all",
14217
+ fetchPolicy: "cache-first",
14218
+ returnPartialData: !0,
14219
+ context: {
14220
+ fetchOptions: {
14221
+ signal: l
14222
+ }
14223
+ }
14224
+ });
14225
+ return new Promise((d) => {
14226
+ let A = !1;
14227
+ const u = c.subscribe({
14228
+ next(h) {
14229
+ var g, p, f, C, w, v;
14230
+ if (A || h.partial && (!h.data.productCollections || h.data.productCollections.length === 0 || !((g = h.data.productCollections[0].productCollectionProductsFeed) != null && g.items) || ((p = h.data.productCollections[0].productCollectionProductsFeed) == null ? void 0 : p.items.length) === 0))
14231
+ return;
14232
+ o.abort(), A = !0, u.unsubscribe();
14233
+ const m = ((C = (f = h.data.productCollections) == null ? void 0 : f[0].productCollectionProductsFeed) == null ? void 0 : C.items.filter((S) => !!S.product).map((S) => new le(St(S)))) || [];
14234
+ d({
14235
+ items: m,
14236
+ // Clone items because it could be cached data (immutable)
14237
+ total: ((v = (w = h.data.productCollections) == null ? void 0 : w[0].productCollectionProductsFeed) == null ? void 0 : v.total) ?? 0
14238
+ });
14239
+ },
14240
+ error() {
14241
+ A || (A = !0, u.unsubscribe(), d({ items: [], total: 0 }));
14242
+ }
14243
+ });
14209
14244
  });
14210
- return {
14211
- items: ((A = (d = (c = o == null ? void 0 : o.data) == null ? void 0 : c.productCollections) == null ? void 0 : d[0].productCollectionProductsFeed) == null ? void 0 : A.items.filter((g) => !!g.product).map((g) => new le(g))) || [],
14212
- total: ((m = (h = (u = o == null ? void 0 : o.data) == null ? void 0 : u.productCollections) == null ? void 0 : h[0].productCollectionProductsFeed) == null ? void 0 : m.total) ?? 0
14213
- };
14214
14245
  }
14215
14246
  getTransformCollection() {
14216
14247
  if (this.collection.transformCollection)
@@ -14621,6 +14652,18 @@ class He {
14621
14652
  setName(t) {
14622
14653
  return this.name = t, this.updateBundle();
14623
14654
  }
14655
+ getDispatchDate() {
14656
+ return this.dispatchDate;
14657
+ }
14658
+ setDispatchDate(t) {
14659
+ return this.dispatchDate = t, this.updateBundle();
14660
+ }
14661
+ getPurchaseOrder() {
14662
+ return this.purchaseOrder;
14663
+ }
14664
+ setPurchaseOrder(t) {
14665
+ return this.purchaseOrder = t, this.updateBundle();
14666
+ }
14624
14667
  getMetadata() {
14625
14668
  return new Map(this.metadata);
14626
14669
  }
@@ -15095,7 +15138,9 @@ class He {
15095
15138
  id: this.id,
15096
15139
  name: this.name,
15097
15140
  metadata: Array.from(this.metadata.entries()).map(([a, n]) => ({ key: a, value: n })),
15098
- bundleStateData: this.bundleStateManager.getSerializedState()
15141
+ bundleStateData: this.bundleStateManager.getSerializedState(),
15142
+ dispatchDate: this.dispatchDate,
15143
+ purchaseOrder: this.purchaseOrder
15099
15144
  },
15100
15145
  context: {
15101
15146
  bundleOwnerId: this.ownerId
@@ -15598,7 +15643,7 @@ class _c {
15598
15643
  } catch (a) {
15599
15644
  throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
15600
15645
  }
15601
- }, this.options = t, this.options.applicationKey && Mr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.38.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15646
+ }, this.options = t, this.options.applicationKey && Mr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.39.0-beta.846d7786-3d02-5e5c-9469-78a469329aee"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15602
15647
  }
15603
15648
  configure(t) {
15604
15649
  mt.setHubUrl(t.hubUrl), mt.setServerUrl(t.serverUrl), mt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, t.bearerAuthenticationToken && Qr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration();
@@ -16905,6 +16950,8 @@ const Ml = y`
16905
16950
  id
16906
16951
  workflowViewerLink
16907
16952
  createdAt
16953
+ dispatchDate
16954
+ purchaseOrder
16908
16955
  name
16909
16956
  ordered
16910
16957
  }
@@ -17307,7 +17354,7 @@ export {
17307
17354
  Yl as AddressValidationResultConfirmationLevel,
17308
17355
  Jc as ArrayInput,
17309
17356
  et as AspectType,
17310
- St as AssetNotFoundError,
17357
+ vt as AssetNotFoundError,
17311
17358
  ge as AssetType,
17312
17359
  Gc as BringForwardCommand,
17313
17360
  zc as BringToBackCommand,
@@ -17321,7 +17368,7 @@ export {
17321
17368
  Ll as ConversionLocation,
17322
17369
  G as CreateElementCommand,
17323
17370
  Un as CreateLayoutCommand,
17324
- Et as DeleteElementCommand,
17371
+ Bt as DeleteElementCommand,
17325
17372
  Co as DigitalContentStepHandle,
17326
17373
  Ko as FileUploadGlobalPropertyHandle,
17327
17374
  ce as FlowExecutionNodeResult,
@@ -17355,7 +17402,7 @@ export {
17355
17402
  pl as ObjectInputType,
17356
17403
  Xn as OptionGlobalPropertyHandle,
17357
17404
  fe as OptionNotFoundError,
17358
- Pt as ParseError,
17405
+ Ft as ParseError,
17359
17406
  ho as PictureStepHandle,
17360
17407
  yr as ProductCameraRig,
17361
17408
  Zn as ProductCollection,
@@ -17479,6 +17526,6 @@ export {
17479
17526
  ws as toast,
17480
17527
  pd as validateWorkflowExperienceRecipient,
17481
17528
  fd as validateWorkflowExperienceRecipients,
17482
- Bt as xmlSerializer
17529
+ bt as xmlSerializer
17483
17530
  };
17484
17531
  //# sourceMappingURL=index.mjs.map