@spiffcommerce/core 26.38.0-beta.f1ade417-8ebc-5b59-89d7-49e43b4ff28f → 26.38.0-beta.f8c7765d-9b97-5bb1-b23f-04f257a5f0da

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
  }
@@ -10261,7 +10262,7 @@ class lo {
10261
10262
  this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((o) => {
10262
10263
  this.storage[o.stepName] = o.storage || {};
10263
10264
  }), 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);
10265
+ const n = Pt(this.allScenes, this.stepSelections).map((o) => o.silentSteps).flat(), { stepElements: i, commands: s } = await this.stepElementsForIntroducedSilentSteps(n, !!this.reloadedState);
10265
10266
  this.commandContext.apply(new $(s), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
10266
10267
  }
10267
10268
  getWorkflowExperience() {
@@ -10467,7 +10468,7 @@ class lo {
10467
10468
  },
10468
10469
  { refocusCamera: e }
10469
10470
  );
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) => {
10471
+ 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
10472
  var c, d, A;
10472
10473
  if (!((c = s.option) != null && c.id)) {
10473
10474
  console.error(`Failed to read option id from step: ${s.stepName}`);
@@ -10579,7 +10580,7 @@ class lo {
10579
10580
  const t = this.getCommandContext().getState();
10580
10581
  if (!t)
10581
10582
  throw new z("Attempted to serialize state before it was initialized.");
10582
- const e = Ft(t.transaction), a = this.dehydrateState(e);
10583
+ const e = St(t.transaction), a = this.dehydrateState(e);
10583
10584
  return JSON.stringify(a);
10584
10585
  }
10585
10586
  /**
@@ -10712,7 +10713,7 @@ class lo {
10712
10713
  async reset() {
10713
10714
  this.commandContext.getAllLayouts().forEach(
10714
10715
  (e) => e.layoutState.elements.forEach((a) => {
10715
- this.getCommandDispatcher()(new Et(a.id));
10716
+ this.getCommandDispatcher()(new Bt(a.id));
10716
10717
  })
10717
10718
  ), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
10718
10719
  }
@@ -10725,7 +10726,7 @@ class lo {
10725
10726
  }, 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
10727
  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
10728
  });
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(
10729
+ 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
10730
  (E) => !c.some((B) => B.stepName === E.stepName)
10730
10731
  );
10731
10732
  c.forEach((E) => {
@@ -10742,7 +10743,7 @@ class lo {
10742
10743
  const E = (S = this.getWorkflowExperience().getStepById(g.stepName)) == null ? void 0 : S.frameService;
10743
10744
  E == null || E.setTargetElements(a.map((B) => B.id));
10744
10745
  }
10745
- const p = u.map((E) => new Et(E.id)), f = new Va(this.constructSerializableWorkflow()), C = [...m, ...p, f];
10746
+ const p = u.map((E) => new Bt(E.id)), f = new Va(this.constructSerializableWorkflow()), C = [...m, ...p, f];
10746
10747
  C.length > 0 && this.commandContext.apply(new $(C), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
10747
10748
  const w = this.getInvalidModelVariants(), v = this.modelContainer;
10748
10749
  if (v) {
@@ -10760,7 +10761,7 @@ class lo {
10760
10761
  await this.onSelectionChange(), n && await n();
10761
10762
  }
10762
10763
  async ensureStepsAreLoaded() {
10763
- const e = Dt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
10764
+ const e = Pt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
10764
10765
  for (const l of n)
10765
10766
  if (!this.stepInitialised[l.stepName])
10766
10767
  switch (this.stepInitialised[l.stepName] = !0, l.type) {
@@ -12410,7 +12411,7 @@ class Mo {
12410
12411
  }
12411
12412
  async copy() {
12412
12413
  var s;
12413
- const t = Ft(this.getCommandContext().getState());
12414
+ const t = St(this.getCommandContext().getState());
12414
12415
  if (!t)
12415
12416
  throw new z("Internal state is undefined! Cannot copy experience!");
12416
12417
  const e = JSON.stringify(t.transaction), a = this.getWorkflowManager().getWorkflow(), n = (s = this.getWorkflowManager().getTransaction().integrationProduct) == null ? void 0 : s.id;
@@ -12643,7 +12644,7 @@ const To = [
12643
12644
  B.classList.add(Q), g[Q] = { browserValue: F };
12644
12645
  }
12645
12646
  });
12646
- const f = Bt().serializeToString(m), C = n.colors;
12647
+ const f = bt().serializeToString(m), C = n.colors;
12647
12648
  if (C) {
12648
12649
  for (const [B, I] of Object.entries(g))
12649
12650
  for (const P of Object.keys(C))
@@ -12846,8 +12847,8 @@ const To = [
12846
12847
  const c = await at(i, !0), d = (A) => {
12847
12848
  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
12849
  if (!f)
12849
- throw new Pt("Failed to read SVG.");
12850
- return ma(f), Bt().serializeToString(f);
12850
+ throw new Ft("Failed to read SVG.");
12851
+ return ma(f), bt().serializeToString(f);
12851
12852
  };
12852
12853
  l.forEach((A) => {
12853
12854
  const u = r.find((m) => m.panelId === A.panelId);
@@ -13104,7 +13105,7 @@ class qo {
13104
13105
  * Actions to perform when a static render event is fired for this canvas.
13105
13106
  */
13106
13107
  async render(t) {
13107
- const e = Ft(t);
13108
+ const e = St(t);
13108
13109
  this.lastRequestedRenderArguments = e;
13109
13110
  const a = this.getStaticContext();
13110
13111
  if (!a) {
@@ -13772,7 +13773,7 @@ class tl {
13772
13773
  }
13773
13774
  async setGlobalPropertyState(t) {
13774
13775
  this.globalPropertyState || await this.initPromise;
13775
- const e = Ft(this.globalPropertyState);
13776
+ const e = St(this.globalPropertyState);
13776
13777
  this.globalPropertyState = { ...t, id: e.id }, await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(e, this.globalPropertyState);
13777
13778
  }
13778
13779
  getAspect(t, e) {
@@ -13796,7 +13797,7 @@ class tl {
13796
13797
  const i = this.configuration.aspects.find((l) => l.name === t);
13797
13798
  if (!i)
13798
13799
  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);
13800
+ const s = St(this.globalPropertyState), o = this.globalPropertyState.aspects.filter((l) => l.name === t);
13800
13801
  if (o.length > 0)
13801
13802
  if (n) {
13802
13803
  const l = o.find((c) => c.channel === n);
@@ -13837,7 +13838,7 @@ class tl {
13837
13838
  const n = this.configuration.aspects.find((o) => o.name === t);
13838
13839
  if (!n)
13839
13840
  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);
13841
+ const i = St(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((o) => o.name === t);
13841
13842
  if (s.length > 0)
13842
13843
  if (a) {
13843
13844
  const o = s.find((l) => l.channel === a);
@@ -14180,15 +14181,14 @@ class Zn {
14180
14181
  * @returns
14181
14182
  */
14182
14183
  async fetchProductsFeed(t, e, a, n, i, s) {
14183
- var c, d, A, u, h, m;
14184
14184
  if (this.fullFetched) {
14185
- const g = await (a ? this.filterProducts(a) : this.fetchProducts());
14185
+ const d = await (a ? this.filterProducts(a) : this.fetchProducts());
14186
14186
  return {
14187
- total: g.length,
14188
- items: g.slice(t, t + e)
14187
+ total: d.length,
14188
+ items: d.slice(t, t + e)
14189
14189
  };
14190
14190
  }
14191
- const o = await b.getShadowGraphqlClient().query({
14191
+ const o = new AbortController(), { signal: l } = o, c = b.getShadowGraphqlClient().watchQuery({
14192
14192
  query: $s,
14193
14193
  variables: {
14194
14194
  id: this.getId(),
@@ -14207,12 +14207,33 @@ class Zn {
14207
14207
  },
14208
14208
  errorPolicy: "all",
14209
14209
  fetchPolicy: "cache-first",
14210
- returnPartialData: !0
14210
+ returnPartialData: !0,
14211
+ context: {
14212
+ fetchOptions: {
14213
+ signal: l
14214
+ }
14215
+ }
14216
+ });
14217
+ return new Promise((d) => {
14218
+ let A = !1;
14219
+ const u = c.subscribe({
14220
+ next(h) {
14221
+ var g, p, f, C, w, v;
14222
+ if (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))
14223
+ return;
14224
+ o.abort(), A = !0, u.unsubscribe();
14225
+ 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(S))) || [];
14226
+ d({
14227
+ items: St(m),
14228
+ // Clone items because it could be cached data (immutable)
14229
+ total: ((v = (w = h.data.productCollections) == null ? void 0 : w[0].productCollectionProductsFeed) == null ? void 0 : v.total) ?? 0
14230
+ });
14231
+ },
14232
+ error() {
14233
+ A || (A = !0, u.unsubscribe(), d({ items: [], total: 0 }));
14234
+ }
14235
+ });
14211
14236
  });
14212
- return {
14213
- 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))) || [],
14214
- 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
14215
- };
14216
14237
  }
14217
14238
  getTransformCollection() {
14218
14239
  if (this.collection.transformCollection)
@@ -15600,7 +15621,7 @@ class _c {
15600
15621
  } catch (a) {
15601
15622
  throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
15602
15623
  }
15603
- }, this.options = t, this.options.applicationKey && Mr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.38.0-beta.086120bb-2716-5d55-859d-f71980f25fb6"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15624
+ }, this.options = t, this.options.applicationKey && Mr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.38.0-beta.95db9919-4320-51f8-986e-5467ea068975"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15604
15625
  }
15605
15626
  configure(t) {
15606
15627
  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();
@@ -17309,7 +17330,7 @@ export {
17309
17330
  Yl as AddressValidationResultConfirmationLevel,
17310
17331
  Jc as ArrayInput,
17311
17332
  et as AspectType,
17312
- St as AssetNotFoundError,
17333
+ vt as AssetNotFoundError,
17313
17334
  ge as AssetType,
17314
17335
  Gc as BringForwardCommand,
17315
17336
  zc as BringToBackCommand,
@@ -17323,7 +17344,7 @@ export {
17323
17344
  Ll as ConversionLocation,
17324
17345
  G as CreateElementCommand,
17325
17346
  Un as CreateLayoutCommand,
17326
- Et as DeleteElementCommand,
17347
+ Bt as DeleteElementCommand,
17327
17348
  Co as DigitalContentStepHandle,
17328
17349
  Ko as FileUploadGlobalPropertyHandle,
17329
17350
  ce as FlowExecutionNodeResult,
@@ -17357,7 +17378,7 @@ export {
17357
17378
  pl as ObjectInputType,
17358
17379
  Xn as OptionGlobalPropertyHandle,
17359
17380
  fe as OptionNotFoundError,
17360
- Pt as ParseError,
17381
+ Ft as ParseError,
17361
17382
  ho as PictureStepHandle,
17362
17383
  yr as ProductCameraRig,
17363
17384
  Zn as ProductCollection,
@@ -17481,6 +17502,6 @@ export {
17481
17502
  ws as toast,
17482
17503
  pd as validateWorkflowExperienceRecipient,
17483
17504
  fd as validateWorkflowExperienceRecipients,
17484
- Bt as xmlSerializer
17505
+ bt as xmlSerializer
17485
17506
  };
17486
17507
  //# sourceMappingURL=index.mjs.map