@spiffcommerce/core 40.3.0 → 40.3.1

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
@@ -8,7 +8,7 @@ import { parse as Bn } from "css";
8
8
  import Vi from "fuse.js";
9
9
  import { Pith as Ia } from "pith";
10
10
  import ca from "lodash.chunk";
11
- import It from "lodash.clonedeep";
11
+ import wt from "lodash.clonedeep";
12
12
  import { jsx as F, jsxs as ut, Fragment as Wt } from "preact/jsx-runtime";
13
13
  import { parse as da } from "opentype.js";
14
14
  import { decode as Li } from "html-entities";
@@ -162,7 +162,7 @@ class nr {
162
162
  this.serverUrlCallbacks.push(t);
163
163
  }
164
164
  }
165
- const wt = new nr();
165
+ const yt = new nr();
166
166
  let Aa, ha;
167
167
  function Ad(i) {
168
168
  Aa = i;
@@ -297,7 +297,7 @@ let Rn;
297
297
  const gr = (i) => {
298
298
  Rn = i;
299
299
  }, mr = () => new Promise((i) => {
300
- const t = wt.getHubUrl(), e = (a) => {
300
+ const t = yt.getHubUrl(), e = (a) => {
301
301
  a.origin === t && (window.removeEventListener("message", e), i(a.data));
302
302
  };
303
303
  window.parent !== window && (window.addEventListener("message", e, !1), window.parent.postMessage("ready", t));
@@ -310,13 +310,13 @@ const gr = (i) => {
310
310
  return typeof window < "u" && (window.location.href.includes("/workflows/product/") || window.location.href.includes("hub=true")) ? { ...await mr(), ...i } : i;
311
311
  };
312
312
  async function fr(i, t) {
313
- const e = wt.getServerUrl(), a = e.includes(".aumelbdev.spiffcommerce.com") ? "https://moonlight.aumelbdev.spiffcommerce.com" : e.includes(".us.spiffcommerce.com") ? "https://moonlight.us.spiffcommerce.com" : "https://moonlight.au.spiffcommerce.com";
313
+ const e = yt.getServerUrl(), a = e.includes(".aumelbdev.spiffcommerce.com") ? "https://moonlight.aumelbdev.spiffcommerce.com" : e.includes(".us.spiffcommerce.com") ? "https://moonlight.us.spiffcommerce.com" : "https://moonlight.au.spiffcommerce.com";
314
314
  let n = await nt(i, { ...t, redirect: "manual" });
315
315
  return (n.type === "opaqueredirect" || n.status === 307) && (typeof i != "string" && "url" in i ? n = await nt({ ...i, url: `${a}/graphql` }, t) : n = await nt(`${a}/graphql`, t)), n;
316
316
  }
317
317
  class Cr {
318
318
  constructor() {
319
- this.shadowGraphqlClient = this.constructShadowGraphqlClient(), wt.addServerUrlCallback(() => {
319
+ this.shadowGraphqlClient = this.constructShadowGraphqlClient(), yt.addServerUrlCallback(() => {
320
320
  this.shadowGraphqlClient = this.constructShadowGraphqlClient();
321
321
  });
322
322
  }
@@ -328,7 +328,7 @@ class Cr {
328
328
  }
329
329
  constructShadowGraphqlClient() {
330
330
  const t = ki({
331
- uri: `${wt.getServerUrl()}/graphql`,
331
+ uri: `${yt.getServerUrl()}/graphql`,
332
332
  fetch: fr
333
333
  }), e = Qi(async (r, s) => {
334
334
  const { headers: o } = s, l = o || {}, c = await pr();
@@ -372,7 +372,7 @@ class Cr {
372
372
  }
373
373
  const S = new Cr();
374
374
  let ga, ma;
375
- const yt = (i, t, e) => {
375
+ const St = (i, t, e) => {
376
376
  if (ga !== void 0)
377
377
  return ga(i, t, e);
378
378
  try {
@@ -433,10 +433,10 @@ const wr = (i) => new Promise((t) => {
433
433
  }, vr = async (i) => {
434
434
  const t = await cr(i), e = await ne(t), [a, n] = Sr(e);
435
435
  if (!await yr()) {
436
- const u = yt(a, n);
436
+ const u = St(a, n);
437
437
  return u.getContext("2d")?.drawImage(e, 0, 0, a, n), u;
438
438
  }
439
- const s = await wr(i), [o, l] = s > 4 ? [n, a] : [a, n], c = yt(o, l), d = c.getContext("2d");
439
+ const s = await wr(i), [o, l] = s > 4 ? [n, a] : [a, n], c = St(o, l), d = c.getContext("2d");
440
440
  switch (s) {
441
441
  case 2:
442
442
  d.translate(o, 0), d.scale(-1, 1);
@@ -5437,7 +5437,7 @@ const N = () => {
5437
5437
  }
5438
5438
  );
5439
5439
  }, Cd = (i, t, e, a, n) => {
5440
- const r = St(n), s = e / 2, o = a / 2, l = i + s, c = t + o, d = Math.sin(r), u = Math.cos(r), A = s, h = s, g = -o, p = o, m = A * u - g * d, f = h * u - p * d, y = A * d + g * u, w = h * d + p * u, x = Math.max(Math.abs(m), Math.abs(f)), b = Math.max(Math.abs(y), Math.abs(w));
5440
+ const r = vt(n), s = e / 2, o = a / 2, l = i + s, c = t + o, d = Math.sin(r), u = Math.cos(r), A = s, h = s, g = -o, p = o, m = A * u - g * d, f = h * u - p * d, y = A * d + g * u, w = h * d + p * u, x = Math.max(Math.abs(m), Math.abs(f)), b = Math.max(Math.abs(y), Math.abs(w));
5441
5441
  return {
5442
5442
  minX: l - x,
5443
5443
  maxX: l + x,
@@ -5447,8 +5447,8 @@ const N = () => {
5447
5447
  }, wd = (i, t, e) => {
5448
5448
  const a = Math.sqrt(Math.pow(t.x - i.x, 2) + Math.pow(t.y - i.y, 2)), n = Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)), r = Math.sqrt(Math.pow(e.x - i.x, 2) + Math.pow(e.y - i.y, 2));
5449
5449
  return Math.acos((n * n + a * a - r * r) / (2 * n * a)) * (180 / Math.PI);
5450
- }, St = (i) => i * (Math.PI / 180), yd = (i, t, e) => Math.abs(i - t) < e, Sd = (i, t, e) => {
5451
- const a = Math.sin(St(e)), n = Math.cos(St(e));
5450
+ }, vt = (i) => i * (Math.PI / 180), yd = (i, t, e) => Math.abs(i - t) < e, Sd = (i, t, e) => {
5451
+ const a = Math.sin(vt(e)), n = Math.cos(vt(e));
5452
5452
  return {
5453
5453
  x: (i.x - t.x) * n - (i.y - t.y) * a + t.x,
5454
5454
  y: (i.x - t.x) * a + (i.y - t.y) * n + t.y
@@ -5485,7 +5485,7 @@ const N = () => {
5485
5485
  return Y.Northwest;
5486
5486
  }
5487
5487
  }, Bd = (i, t) => t > 45 && t <= 135 ? Ft(i) : t > 135 && t <= 225 ? Ft(Ft(i)) : t > 225 && t <= 315 ? Ft(Ft(Ft(i))) : i, Pd = (i, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
5488
- const a = St(i.rotation), n = {
5488
+ const a = vt(i.rotation), n = {
5489
5489
  x: t.x + i.x * e.x,
5490
5490
  y: t.x + i.y * e.y
5491
5491
  }, r = {
@@ -5515,7 +5515,7 @@ const N = () => {
5515
5515
  y: (i.x - t.x) * a + (i.y - t.y) * n + t.y
5516
5516
  };
5517
5517
  }, Fd = 0.352778, xd = 0.035277, Xn = (i) => {
5518
- const t = i.rotation || 0, e = St(t), a = Math.cos(e), n = -Math.sin(e);
5518
+ const t = i.rotation || 0, e = vt(t), a = Math.cos(e), n = -Math.sin(e);
5519
5519
  return /* @__PURE__ */ F("g", { mask: i.stepName || i.productOverlay ? void 0 : i.mask, children: /* @__PURE__ */ F(
5520
5520
  "g",
5521
5521
  {
@@ -5537,7 +5537,7 @@ const N = () => {
5537
5537
  }
5538
5538
  ) });
5539
5539
  }, Zn = (i) => {
5540
- const t = `spiff-group-clip-${i.id}`, e = i.rotation || 0, a = St(e), n = Math.cos(a), r = -Math.sin(a), s = Ra(i.children);
5540
+ const t = `spiff-group-clip-${i.id}`, e = i.rotation || 0, a = vt(e), n = Math.cos(a), r = -Math.sin(a), s = Ra(i.children);
5541
5541
  return /* @__PURE__ */ ut(Wt, { children: [
5542
5542
  /* @__PURE__ */ F("defs", { children: /* @__PURE__ */ F("clipPath", { id: t, preserveAspectRatio: "none", children: i.clipPath ? /* @__PURE__ */ F("path", { d: i.clipPath }) : /* @__PURE__ */ F("rect", { x: 0, y: 0, width: i.width, height: i.height }) }) }),
5543
5543
  /* @__PURE__ */ ut(
@@ -5598,7 +5598,7 @@ const N = () => {
5598
5598
  /* @__PURE__ */ F("feFuncG", { type: "discrete", tableValues: n() }),
5599
5599
  /* @__PURE__ */ F("feFuncB", { type: "discrete", tableValues: n() })
5600
5600
  ] })
5601
- ] }) }) }), s = i.rotation || 0, o = St(s), l = Math.cos(o), c = -Math.sin(o), d = () => {
5601
+ ] }) }) }), s = i.rotation || 0, o = vt(s), l = Math.cos(o), c = -Math.sin(o), d = () => {
5602
5602
  const u = i.pattern?.x || 0, A = i.pattern?.y || 0, h = i.pattern?.width || 0, g = i.pattern?.height || 0, p = i.pattern?.scaleX || 1, m = i.pattern?.scaleY || 1, f = i.pattern?.rotation || 0;
5603
5603
  return [i.pattern?.svg ? {
5604
5604
  id: `${t}-contents`,
@@ -5713,7 +5713,7 @@ const Is = (i) => i.substring(0, 5).toLowerCase().trim() === "data:", _e = /* @_
5713
5713
  return _e.get(i);
5714
5714
  const e = (async () => {
5715
5715
  try {
5716
- return vt(i).getFont();
5716
+ return Et(i).getFont();
5717
5717
  } catch {
5718
5718
  if (Is(i)) {
5719
5719
  const a = On(i), n = da(a);
@@ -5728,7 +5728,7 @@ const Is = (i) => i.substring(0, 5).toLowerCase().trim() === "data:", _e = /* @_
5728
5728
  }, Bs = (i) => {
5729
5729
  const t = On(i), e = da(t);
5730
5730
  return pa(i, e), e;
5731
- }, vt = (i) => {
5731
+ }, Et = (i) => {
5732
5732
  const t = ti.get(i);
5733
5733
  if (t)
5734
5734
  return t;
@@ -5826,7 +5826,7 @@ const Is = (i) => i.substring(0, 5).toLowerCase().trim() === "data:", _e = /* @_
5826
5826
  const s = (r ?? ni) * t.getApproximateHeight(), o = 1 / e.unitsPerEm, l = ei(i, o, t), c = i.length * s * o, d = a / l, u = n / c;
5827
5827
  return Math.min(u, d);
5828
5828
  }, Fs = (i, t, e, a) => {
5829
- const n = vt(t.fontData.assetUrl), r = n.getFont(), s = t.fontSize / r.unitsPerEm;
5829
+ const n = Et(t.fontData.assetUrl), r = n.getFont(), s = t.fontSize / r.unitsPerEm;
5830
5830
  if (!e)
5831
5831
  return an(t, i, t.fontSize, s, n, a);
5832
5832
  let o;
@@ -5847,9 +5847,9 @@ const Is = (i) => i.substring(0, 5).toLowerCase().trim() === "data:", _e = /* @_
5847
5847
  fontSize: Ps(o, n, r, t.width, t.height, a)
5848
5848
  } : an(t, i, t.fontSize, s, n, a);
5849
5849
  }, xs = (i, t, e, a, n) => {
5850
- const s = vt(t.assetUrl).getFont();
5850
+ const s = Et(t.assetUrl).getFont();
5851
5851
  let o = { ...i };
5852
- const l = { ...i }, c = ei(a, e / s.unitsPerEm, vt(t.assetUrl));
5852
+ const l = { ...i }, c = ei(a, e / s.unitsPerEm, Et(t.assetUrl));
5853
5853
  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 && ks(a, a).every(([d, u]) => d === u) && (o = l)), o;
5854
5854
  }, Xe = 1, Ct = (i, t, e) => {
5855
5855
  let a = 0;
@@ -5997,7 +5997,7 @@ const Ts = (i) => {
5997
5997
  const t = () => {
5998
5998
  if (i.lineHeight !== void 0)
5999
5999
  return i.lineHeight * i.fontSize;
6000
- const n = vt(i.fontData.assetUrl), r = n.getFont(), s = i.fontSize / r.unitsPerEm;
6000
+ const n = Et(i.fontData.assetUrl), r = n.getFont(), s = i.fontSize / r.unitsPerEm;
6001
6001
  return n.getApproximateHeight() * s;
6002
6002
  }, e = () => i.align === "left" ? -i.textboxWidth / 2 : i.align === "right" ? i.textboxWidth / 2 : 0, a = () => {
6003
6003
  const n = t(), r = i.textboxHeight / 2;
@@ -6040,7 +6040,7 @@ const Ts = (i) => {
6040
6040
  mask: i.stepName ? void 0 : i.mask
6041
6041
  }
6042
6042
  );
6043
- const t = i.rotation || 0, e = St(t), a = Math.cos(e), n = -Math.sin(e), r = `
6043
+ const t = i.rotation || 0, e = vt(t), a = Math.cos(e), n = -Math.sin(e), r = `
6044
6044
  matrix(1, 0, 0, 1, ${i.x}, ${i.y})
6045
6045
  matrix(1, 0, 0, 1, ${i.width / 2}, ${i.height / 2})
6046
6046
  matrix(${a}, ${-n}, ${n}, ${a}, 0, 0)
@@ -6334,10 +6334,10 @@ const mt = /* @__PURE__ */ new Map(), qt = /* @__PURE__ */ new Map(), Ze = /* @_
6334
6334
  const s = ht().parseFromString(i, "image/svg+xml").firstElementChild;
6335
6335
  if (!s)
6336
6336
  throw new Error("Failed to read SVG");
6337
- const l = Pt().serializeToString(s), c = yt(), d = c.getContext("2d"), u = await Ia.from(d, l, {
6337
+ const l = Pt().serializeToString(s), c = St(), d = c.getContext("2d"), u = await Ia.from(d, l, {
6338
6338
  anonymousCrossOrigin: !0,
6339
6339
  ignoreDimensions: !1,
6340
- createCanvas: yt,
6340
+ createCanvas: St,
6341
6341
  createImage: ne,
6342
6342
  DOMParser: xa(),
6343
6343
  fetch: nt
@@ -6376,7 +6376,7 @@ const mt = /* @__PURE__ */ new Map(), qt = /* @__PURE__ */ new Map(), Ze = /* @_
6376
6376
  }
6377
6377
  if (e && t === D.Textbox && a?.text && a?.fontScale) {
6378
6378
  await Qt(e);
6379
- const l = vt(e), c = Ct(a.text, a?.fontScale, l);
6379
+ const l = Et(e), c = Ct(a.text, a?.fontScale, l);
6380
6380
  o.width = Math.min(c, n.width * 0.85), o.left = n.x + n.width / 2 - o.width / 2;
6381
6381
  }
6382
6382
  return o;
@@ -7314,7 +7314,7 @@ class cn {
7314
7314
  }
7315
7315
  }
7316
7316
  const Ws = async (i) => {
7317
- const t = `${wt.getServicesApiUrl()}/shortener`;
7317
+ const t = `${yt.getServicesApiUrl()}/shortener`;
7318
7318
  try {
7319
7319
  return (await (await nt(t, {
7320
7320
  method: "POST",
@@ -7820,7 +7820,7 @@ class De {
7820
7820
  ), this.validateColorCount(e, a);
7821
7821
  }
7822
7822
  }
7823
- const bt = new De();
7823
+ const It = new De();
7824
7824
  class Ys {
7825
7825
  async getIllustrationBody(t) {
7826
7826
  return new Promise((e) => {
@@ -8701,7 +8701,7 @@ const ao = new eo(), na = (i, t, e, a, n) => {
8701
8701
  return [null, null];
8702
8702
  }, Se = (i, t, e, a, n) => {
8703
8703
  let r, s;
8704
- const o = vt(t.assetUrl), l = o.getFont();
8704
+ const o = Et(t.assetUrl), l = o.getFont();
8705
8705
  if (n.size) {
8706
8706
  const A = i / l.unitsPerEm;
8707
8707
  return [r, s] = na(e, a, i, A, o), [n.size, r, s];
@@ -8736,7 +8736,7 @@ class io {
8736
8736
  /(\r\n|\r|(\u2665|\u00a9|\u00ae|[\u2000-\u2017]|[\u201E-\u3300]]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]))/gm,
8737
8737
  ""
8738
8738
  );
8739
- const n = [], r = e ? vt(e.assetUrl) : void 0;
8739
+ const n = [], r = e ? Et(e.assetUrl) : void 0;
8740
8740
  if (r) {
8741
8741
  const s = a.split("").filter((l) => !no.includes(l)).join(""), o = s.split("").map((l) => r.getFont().charToGlyph(l));
8742
8742
  for (let l = 0; l < o.length; l++)
@@ -10097,7 +10097,7 @@ class Io {
10097
10097
  }
10098
10098
  const Bo = () => new Promise((i, t) => {
10099
10099
  try {
10100
- const a = yt().getContext("webgl2");
10100
+ const a = St().getContext("webgl2");
10101
10101
  i(!!a);
10102
10102
  } catch {
10103
10103
  i(!1);
@@ -10151,7 +10151,7 @@ class Fo {
10151
10151
  * Actions to perform when a static render event is fired for this canvas.
10152
10152
  */
10153
10153
  async render(t) {
10154
- const e = It(t);
10154
+ const e = wt(t);
10155
10155
  this.lastRequestedRenderArguments = e;
10156
10156
  const a = this.getStaticContext();
10157
10157
  if (!a) {
@@ -10234,7 +10234,7 @@ class xo extends Na {
10234
10234
  ignoreClear: !0,
10235
10235
  ignoreMouse: !0,
10236
10236
  enableRedraw: !1,
10237
- createCanvas: yt,
10237
+ createCanvas: St,
10238
10238
  createImage: ne,
10239
10239
  DOMParser: xa(),
10240
10240
  fetch
@@ -11494,7 +11494,7 @@ const ul = (i) => i.sort((t, e) => t.index - e.index).map((t) => ({
11494
11494
  const t = this.getCommandContext().getState();
11495
11495
  if (!t)
11496
11496
  throw new O("Attempted to serialize state before it was initialized.");
11497
- const e = It(t.transaction), a = cl(e);
11497
+ const e = wt(t.transaction), a = cl(e);
11498
11498
  return JSON.stringify(a, ll, void 0);
11499
11499
  }
11500
11500
  async getStateHash() {
@@ -11701,7 +11701,7 @@ const ul = (i) => i.sort((t, e) => t.index - e.index).map((t) => ({
11701
11701
  );
11702
11702
  break;
11703
11703
  case E.Frame:
11704
- a.push(bt.init(l, this, this.reloadedState));
11704
+ a.push(It.init(l, this, this.reloadedState));
11705
11705
  break;
11706
11706
  case E.Illustration:
11707
11707
  a.push(
@@ -12719,12 +12719,12 @@ const Il = async (i, t) => {
12719
12719
  if (T) {
12720
12720
  const X = await I.getOptionForStep(T);
12721
12721
  if (!v || X && (X.variants || []).length > 1 && !T.data.hideSelectionInCart && !T.data.hideSelectionsInCart) {
12722
- const Et = T.stepTitle;
12723
- B[Et] ? B[Et].push({
12722
+ const bt = T.stepTitle;
12723
+ B[bt] ? B[bt].push({
12724
12724
  id: k.id || "",
12725
12725
  name: k.name,
12726
12726
  priceModifier: k.priceModifier
12727
- }) : B[Et] = [
12727
+ }) : B[bt] = [
12728
12728
  {
12729
12729
  id: k.id || "",
12730
12730
  name: k.name,
@@ -13211,7 +13211,7 @@ class Tl {
13211
13211
  }
13212
13212
  let r = 2048;
13213
13213
  e && e <= 2048 && (r = e);
13214
- const s = yt(r, r), o = this.workflowManager.getCommandContext().getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((w) => w.layoutState?.layout.panelId === c?.name) || o[0], u = d.layoutState.layout.previewRegion ? {
13214
+ const s = St(r, r), o = this.workflowManager.getCommandContext().getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((w) => w.layoutState?.layout.panelId === c?.name) || o[0], u = d.layoutState.layout.previewRegion ? {
13215
13215
  x: d.layoutState.layout.previewRegion.left,
13216
13216
  y: d.layoutState.layout.previewRegion.top,
13217
13217
  width: d.layoutState.layout.previewRegion.width,
@@ -13234,7 +13234,7 @@ class Tl {
13234
13234
  await (await Ia.from(h, m, {
13235
13235
  anonymousCrossOrigin: !0,
13236
13236
  ignoreDimensions: !1,
13237
- createCanvas: yt,
13237
+ createCanvas: St,
13238
13238
  createImage: ne,
13239
13239
  DOMParser: xa(),
13240
13240
  fetch
@@ -13412,7 +13412,7 @@ class Tl {
13412
13412
  return await ra.addDesign(s), s;
13413
13413
  }
13414
13414
  async copy() {
13415
- const t = It(this.getCommandContext().getState());
13415
+ const t = wt(this.getCommandContext().getState());
13416
13416
  if (!t) throw new O("Internal state is undefined! Cannot copy experience!");
13417
13417
  const e = JSON.stringify(t.transaction), a = this.getWorkflow();
13418
13418
  if (!a) throw new O("Workflow is undefined! Cannot copy experience!");
@@ -14230,7 +14230,7 @@ class ql {
14230
14230
  }
14231
14231
  async setGlobalPropertyState(t) {
14232
14232
  this.globalPropertyState || await this.initPromise;
14233
- const e = It(this.globalPropertyState);
14233
+ const e = wt(this.globalPropertyState);
14234
14234
  this.globalPropertyState = { ...sa(t), id: e.id }, this.recalculateMandatoryStates(), this.queueGlobalPropertyStateUpdate(), await this.onGlobalPropertyStateChange(e, this.globalPropertyState);
14235
14235
  }
14236
14236
  getAspectMandatoryFulfilled(t) {
@@ -14262,7 +14262,7 @@ class ql {
14262
14262
  if (!s)
14263
14263
  throw new Error(`Failed to find configuration aspect with name: ${t}`);
14264
14264
  this.mandatoryFulfilledAspects.set(t, e !== "");
14265
- const o = It(this.globalPropertyState), l = this.globalPropertyState.aspects.filter((c) => c.name === t);
14265
+ const o = wt(this.globalPropertyState), l = this.globalPropertyState.aspects.filter((c) => c.name === t);
14266
14266
  if (l.length > 0)
14267
14267
  if (n) {
14268
14268
  const c = l.find((d) => d.channel === n);
@@ -14308,7 +14308,7 @@ class ql {
14308
14308
  const n = this.configuration.aspects.find((o) => o.name === t);
14309
14309
  if (!n)
14310
14310
  throw new Error(`Failed to find configuration aspect with name: ${t}`);
14311
- const r = It(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((o) => o.name === t);
14311
+ const r = wt(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((o) => o.name === t);
14312
14312
  if (s.length > 0)
14313
14313
  if (a) {
14314
14314
  const o = s.find((l) => l.channel === a);
@@ -14666,7 +14666,7 @@ class Ei {
14666
14666
  if (h || p.partial && (!p.data.productCollections || p.data.productCollections.length === 0 || !p.data.productCollections[0].productCollectionProductsFeed?.items || p.data.productCollections[0].productCollectionProductsFeed?.items.length === 0))
14667
14667
  return;
14668
14668
  c.abort(), h = !0, g.unsubscribe();
14669
- const m = p.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((f) => !!f.product).map((f) => new me(It(f))) || [];
14669
+ const m = p.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((f) => !!f.product).map((f) => new me(wt(f))) || [];
14670
14670
  A({
14671
14671
  items: m,
14672
14672
  // Clone items because it could be cached data (immutable)
@@ -16237,9 +16237,9 @@ const uc = async (i, t) => {
16237
16237
  throw e.error;
16238
16238
  if (e.errors)
16239
16239
  throw e.errors.forEach((n) => console.error(n)), new Error("Unable to read workflows. Consult GraphQL errors.");
16240
- const a = e.data.workflows;
16241
- if (a === void 0 || a.length !== i.length)
16240
+ if (e.data.workflows === void 0 || e.data.workflows.length !== i.length)
16242
16241
  throw new Error(`Unable to read workflows: ${e.errors ?? "Length mismatch in response"}`);
16242
+ const a = wt(e.data.workflows);
16243
16243
  return a.forEach((n) => {
16244
16244
  n.finalizeStepConfig || (n.finalizeStepConfig = {}), n.finalizeStepConfig.termsMarkdown = n.finalizeStepConfig.termsMarkdown || n.partner.termsMarkdown;
16245
16245
  }), a;
@@ -16278,10 +16278,10 @@ class Wd {
16278
16278
  } catch (a) {
16279
16279
  throw console.error(a), new pt("Critical - Unable to synchronize workflow state with server.");
16280
16280
  }
16281
- }, this.options = t, this.options.applicationKey && Ar(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 40.3.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16281
+ }, this.options = t, this.options.applicationKey && Ar(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 40.3.1"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16282
16282
  }
16283
16283
  configure(t) {
16284
- wt.setHubUrl(t.hubUrl), wt.setServerUrl(t.serverUrl), wt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, this.userPoolClientId = t.userPoolClientId, this.userPoolRegion = t.userPoolRegion, this.spiffRegion = t.spiffRegion, t.bearerAuthenticationToken && gr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Gt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
16284
+ yt.setHubUrl(t.hubUrl), yt.setServerUrl(t.serverUrl), yt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, this.userPoolClientId = t.userPoolClientId, this.userPoolRegion = t.userPoolRegion, this.spiffRegion = t.spiffRegion, t.bearerAuthenticationToken && gr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Gt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
16285
16285
  }
16286
16286
  /**
16287
16287
  * @returns The asset manager allows for common operations related to assets
@@ -16680,11 +16680,11 @@ class Wd {
16680
16680
  const X = V.errors?.[0]?.message || "Unknown error";
16681
16681
  throw new pt(`Not all transactions were found: ${X}`);
16682
16682
  }
16683
- return !this.activeIntegration && k[0].integrationProduct?.integration && (this.activeIntegration = Promise.resolve(k[0].integrationProduct.integration)), k.map((X, Et) => ({
16683
+ return !this.activeIntegration && k[0].integrationProduct?.integration && (this.activeIntegration = Promise.resolve(k[0].integrationProduct.integration)), k.map((X, bt) => ({
16684
16684
  transaction: X,
16685
16685
  workflowId: X.workflowId,
16686
16686
  readOnly: P.find((gt) => gt.option.transactionId === X.id)?.option.readOnly ?? !1,
16687
- index: P[Et].index
16687
+ index: P[bt].index
16688
16688
  }));
16689
16689
  }, g = async (P) => {
16690
16690
  if (P.length === 0)
@@ -16729,7 +16729,7 @@ class Wd {
16729
16729
  (async () => m.length > 0 ? await gc(m) : [])(),
16730
16730
  (async () => f.length > 0 ? await Ii(f, e) : [])()
16731
16731
  ]), x = new Map(y.map((P) => [P.id, P])), b = new Map(w.map((P) => [P.id, P])), v = p.map(async (P) => {
16732
- const { transaction: T, workflowId: V, readOnly: k, index: X } = P, Et = V ? b.get(V) : void 0, gt = t[X];
16732
+ const { transaction: T, workflowId: V, readOnly: k, index: X } = P, bt = V ? b.get(V) : void 0, gt = t[X];
16733
16733
  if (T.integrationProductId) {
16734
16734
  const it = x.get(T.integrationProductId);
16735
16735
  T.integrationProduct = it, T.product = it?.product, T.integrationProduct || console.error("failed to find transaction's product");
@@ -16740,7 +16740,7 @@ class Wd {
16740
16740
  onMutate: () => ({ context: { transactionOwnerId: He, bundleOwnerId: e?.bundleOwnerId } }),
16741
16741
  onQuery: () => ({ context: { transactionOwnerId: He, bundleOwnerId: e?.bundleOwnerId } })
16742
16742
  }), le = {
16743
- workflow: Et,
16743
+ workflow: bt,
16744
16744
  transaction: T,
16745
16745
  singleVariantsRenderable: gt?.workflowConfiguration?.singleVariantsRenderable,
16746
16746
  stateMutationFunc: k ? async () => {
@@ -17345,7 +17345,7 @@ class yc extends tt {
17345
17345
  }
17346
17346
  selectVariant(t) {
17347
17347
  const e = this.manager.getRegionElements(this.step.stepName);
17348
- return bt.selectVariant(
17348
+ return It.selectVariant(
17349
17349
  this.step,
17350
17350
  t.getResource(),
17351
17351
  e,
@@ -17365,7 +17365,7 @@ class yc extends tt {
17365
17365
  * @param [recalculateOffsets=true] Optional: Recalculates the offsets of the image inside the frame. Default: `true`.
17366
17366
  */
17367
17367
  async selectImage(t, e = !0, a = !0) {
17368
- if (await bt.selectImage(this.step, t, this.manager, a), e) {
17368
+ if (await It.selectImage(this.step, t, this.manager, a), e) {
17369
17369
  const n = this.manager.getStepStorage(this.step.stepName)?.framePatternData || {};
17370
17370
  this.manager.updateStorage(this.step.stepName, {
17371
17371
  framePatternData: {
@@ -17403,7 +17403,7 @@ class yc extends tt {
17403
17403
  if (!e)
17404
17404
  throw new Error("You must supply an image selection before attempting to remove the background.");
17405
17405
  const a = await H.removeBackgroundFromAsset(e);
17406
- t && await bt.selectImage(this.step, a, this.manager, !1);
17406
+ t && await It.selectImage(this.step, a, this.manager, !1);
17407
17407
  const n = this.manager.getStepStorage(this.step.stepName)?.framePatternData || {};
17408
17408
  return this.manager.updateStorage(this.step.stepName, {
17409
17409
  framePatternData: {
@@ -17453,7 +17453,7 @@ class yc extends tt {
17453
17453
  return !!this.getFrameStepStorage()?.framePatternData?.vectorizedAssetKey;
17454
17454
  }
17455
17455
  async changeColors(t) {
17456
- await bt.changeColors(this.step, this.manager, t);
17456
+ await It.changeColors(this.step, this.manager, t);
17457
17457
  }
17458
17458
  getImageData() {
17459
17459
  if (this.frameService)
@@ -17463,7 +17463,7 @@ class yc extends tt {
17463
17463
  return await I.ensureFullOption(this.step.data.colorOption);
17464
17464
  }
17465
17465
  getAvailableColors() {
17466
- return this.step.data.colorPickerEnabled ? bt.availableColors(this.step, this.manager) : Promise.resolve([]);
17466
+ return this.step.data.colorPickerEnabled ? It.availableColors(this.step, this.manager) : Promise.resolve([]);
17467
17467
  }
17468
17468
  isColorPickerEnabled() {
17469
17469
  return this.step.data.colorPickerEnabled ?? !1;
@@ -17482,7 +17482,7 @@ class yc extends tt {
17482
17482
  return this.step.data.maxColors;
17483
17483
  }
17484
17484
  getUniqueColorCount() {
17485
- return bt.getUniqueColorCount(this.step, this.manager);
17485
+ return It.getUniqueColorCount(this.step, this.manager);
17486
17486
  }
17487
17487
  getCurrentFrameStep(t, e, a, n) {
17488
17488
  return n && n.length > 1 && t === void 0 ? "SelectFrame" : e || a || this.getImageData() ? "Position" : "SelectImage";
@@ -18112,7 +18112,7 @@ export {
18112
18112
  L as findElement,
18113
18113
  fd as findPmsColors,
18114
18114
  qt as frameDataCache,
18115
- bt as frameStepService,
18115
+ It as frameStepService,
18116
18116
  N as generate,
18117
18117
  bo as generateCommands,
18118
18118
  ot as generateSVGWithUnknownColors,
@@ -18180,7 +18180,7 @@ export {
18180
18180
  $n as setCanvasModule,
18181
18181
  Ht as shapeStepService,
18182
18182
  Ws as shortenUrl,
18183
- wt as spiffCoreConfiguration,
18183
+ yt as spiffCoreConfiguration,
18184
18184
  Vd as stepAspectValuesToDesignInputSteps,
18185
18185
  Xa as svgColorValueToDefinition,
18186
18186
  oi as svgStringDimensions,