@spiffcommerce/core 35.0.0 → 35.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import { orientation as kr } from "exifr/dist/mini.umd.cjs";
7
7
  import { parse as wn } from "css";
8
8
  import Mr from "fuse.js";
9
9
  import { Pith as va } from "pith";
10
- import Et from "lodash.clonedeep";
10
+ import pt from "lodash.clonedeep";
11
11
  import jt from "lodash.isequal";
12
12
  import { jsx as P, jsxs as ct, Fragment as Gt } from "preact/jsx-runtime";
13
13
  import { parse as sa } from "opentype.js";
@@ -162,7 +162,7 @@ class Jr {
162
162
  this.serverUrlCallbacks.push(t);
163
163
  }
164
164
  }
165
- const pt = new Jr();
165
+ const ft = new Jr();
166
166
  let da, Aa;
167
167
  function sd(n) {
168
168
  da = n;
@@ -297,7 +297,7 @@ let Dn;
297
297
  const oi = (n) => {
298
298
  Dn = n;
299
299
  }, si = () => new Promise((n) => {
300
- const t = pt.getHubUrl(), e = (a) => {
300
+ const t = ft.getHubUrl(), e = (a) => {
301
301
  a.origin === t && (window.removeEventListener("message", e), n(a.data));
302
302
  };
303
303
  window.parent !== window && (window.addEventListener("message", e, !1), window.parent.postMessage("ready", t));
@@ -310,13 +310,13 @@ const oi = (n) => {
310
310
  return typeof window < "u" && (window.location.href.includes("/workflows/product/") || window.location.href.includes("hub=true")) ? { ...await si(), ...n } : n;
311
311
  };
312
312
  async function ci(n, t) {
313
- const e = pt.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 = ft.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 r = await nt(n, { ...t, redirect: "manual" });
315
315
  return (r.type === "opaqueredirect" || r.status === 307) && (typeof n != "string" && "url" in n ? r = await nt({ ...n, url: `${a}/graphql` }, t) : r = await nt(`${a}/graphql`, t)), r;
316
316
  }
317
317
  class di {
318
318
  constructor() {
319
- this.shadowGraphqlClient = this.constructShadowGraphqlClient(), pt.addServerUrlCallback(() => {
319
+ this.shadowGraphqlClient = this.constructShadowGraphqlClient(), ft.addServerUrlCallback(() => {
320
320
  this.shadowGraphqlClient = this.constructShadowGraphqlClient();
321
321
  });
322
322
  }
@@ -328,7 +328,7 @@ class di {
328
328
  }
329
329
  constructShadowGraphqlClient() {
330
330
  const t = Er({
331
- uri: `${pt.getServerUrl()}/graphql`,
331
+ uri: `${ft.getServerUrl()}/graphql`,
332
332
  fetch: ci
333
333
  }), e = Pr(async (i, o) => {
334
334
  const { headers: s } = o, l = s || {}, c = await li();
@@ -372,7 +372,7 @@ class di {
372
372
  }
373
373
  const S = new di();
374
374
  let ua, ha;
375
- const ft = (n, t, e) => {
375
+ const Ct = (n, t, e) => {
376
376
  if (ua !== void 0)
377
377
  return ua(n, t, e);
378
378
  try {
@@ -433,10 +433,10 @@ const Ai = (n) => new Promise((t) => {
433
433
  }, gi = async (n) => {
434
434
  const t = await ei(n), e = await te(t), [a, r] = hi(e);
435
435
  if (!await ui()) {
436
- const A = ft(a, r);
436
+ const A = Ct(a, r);
437
437
  return A.getContext("2d")?.drawImage(e, 0, 0, a, r), A;
438
438
  }
439
- const o = await Ai(n), [s, l] = o > 4 ? [r, a] : [a, r], c = ft(s, l), d = c.getContext("2d");
439
+ const o = await Ai(n), [s, l] = o > 4 ? [r, a] : [a, r], c = Ct(s, l), d = c.getContext("2d");
440
440
  switch (o) {
441
441
  case 2:
442
442
  d.translate(s, 0), d.scale(-1, 1);
@@ -5190,7 +5190,7 @@ const O = new $i(), $n = C`
5190
5190
  ],
5191
5191
  silentSteps: []
5192
5192
  }), t;
5193
- }, go = (n, t) => t.find((e) => e.stepNames.includes(n)), vt = (n, t) => (n.conditions || []).every((e) => {
5193
+ }, go = (n, t) => t.find((e) => e.stepNames.includes(n)), Et = (n, t) => (n.conditions || []).every((e) => {
5194
5194
  const a = t[e.targetStepName];
5195
5195
  if (a && a.selectedVariants) {
5196
5196
  const r = a.selectedVariants;
@@ -5203,12 +5203,12 @@ const O = new $i(), $n = C`
5203
5203
  const e = {
5204
5204
  name: n.name,
5205
5205
  title: n.title,
5206
- renderableSteps: n.renderableSteps.filter((a) => vt(a, t)),
5207
- silentSteps: n.silentSteps.filter((a) => vt(a, t))
5206
+ renderableSteps: n.renderableSteps.filter((a) => Et(a, t)),
5207
+ silentSteps: n.silentSteps.filter((a) => Et(a, t))
5208
5208
  };
5209
5209
  return e.silentSteps.length === 0 && e.renderableSteps.length === 0 ? null : e;
5210
- }, yt = (n, t) => n.map((e) => mo(e, t)).filter((e) => e !== null), po = async (n, t, e = !1) => {
5211
- const a = yt(n, t), r = [];
5210
+ }, St = (n, t) => n.map((e) => mo(e, t)).filter((e) => e !== null), po = async (n, t, e = !1) => {
5211
+ const a = St(n, t), r = [];
5212
5212
  for (const o of a)
5213
5213
  for (const s of o.renderableSteps) {
5214
5214
  const l = (s.option?.variants || []).length;
@@ -5402,7 +5402,7 @@ const N = () => {
5402
5402
  }
5403
5403
  );
5404
5404
  }, hd = (n, t, e, a, r) => {
5405
- const i = Ct(r), o = e / 2, s = a / 2, l = n + o, c = t + s, d = Math.sin(i), A = Math.cos(i), u = o, h = o, g = -s, m = s, p = u * A - g * d, f = h * A - m * d, y = u * d + g * A, w = h * d + m * A, x = Math.max(Math.abs(p), Math.abs(f)), v = Math.max(Math.abs(y), Math.abs(w));
5405
+ const i = wt(r), o = e / 2, s = a / 2, l = n + o, c = t + s, d = Math.sin(i), A = Math.cos(i), u = o, h = o, g = -s, m = s, p = u * A - g * d, f = h * A - m * d, y = u * d + g * A, w = h * d + m * A, x = Math.max(Math.abs(p), Math.abs(f)), v = Math.max(Math.abs(y), Math.abs(w));
5406
5406
  return {
5407
5407
  minX: l - x,
5408
5408
  maxX: l + x,
@@ -5412,8 +5412,8 @@ const N = () => {
5412
5412
  }, gd = (n, t, e) => {
5413
5413
  const a = Math.sqrt(Math.pow(t.x - n.x, 2) + Math.pow(t.y - n.y, 2)), r = Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)), i = Math.sqrt(Math.pow(e.x - n.x, 2) + Math.pow(e.y - n.y, 2));
5414
5414
  return Math.acos((r * r + a * a - i * i) / (2 * r * a)) * (180 / Math.PI);
5415
- }, Ct = (n) => n * (Math.PI / 180), md = (n, t, e) => Math.abs(n - t) < e, pd = (n, t, e) => {
5416
- const a = Math.sin(Ct(e)), r = Math.cos(Ct(e));
5415
+ }, wt = (n) => n * (Math.PI / 180), md = (n, t, e) => Math.abs(n - t) < e, pd = (n, t, e) => {
5416
+ const a = Math.sin(wt(e)), r = Math.cos(wt(e));
5417
5417
  return {
5418
5418
  x: (n.x - t.x) * r - (n.y - t.y) * a + t.x,
5419
5419
  y: (n.x - t.x) * a + (n.y - t.y) * r + t.y
@@ -5450,7 +5450,7 @@ const N = () => {
5450
5450
  return H.Northwest;
5451
5451
  }
5452
5452
  }, Sd = (n, t) => t > 45 && t <= 135 ? Bt(n) : t > 135 && t <= 225 ? Bt(Bt(n)) : t > 225 && t <= 315 ? Bt(Bt(Bt(n))) : n, vd = (n, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
5453
- const a = Ct(n.rotation), r = {
5453
+ const a = wt(n.rotation), r = {
5454
5454
  x: t.x + n.x * e.x,
5455
5455
  y: t.x + n.y * e.y
5456
5456
  }, i = {
@@ -5480,7 +5480,7 @@ const N = () => {
5480
5480
  y: (n.x - t.x) * a + (n.y - t.y) * r + t.y
5481
5481
  };
5482
5482
  }, Ed = 0.352778, bd = 0.035277, qn = (n) => {
5483
- const t = n.rotation || 0, e = Ct(t), a = Math.cos(e), r = -Math.sin(e);
5483
+ const t = n.rotation || 0, e = wt(t), a = Math.cos(e), r = -Math.sin(e);
5484
5484
  return /* @__PURE__ */ P("g", { mask: n.stepName || n.productOverlay ? void 0 : n.mask, children: /* @__PURE__ */ P(
5485
5485
  "g",
5486
5486
  {
@@ -5502,7 +5502,7 @@ const N = () => {
5502
5502
  }
5503
5503
  ) });
5504
5504
  }, Hn = (n) => {
5505
- const t = `spiff-group-clip-${n.id}`, e = n.rotation || 0, a = Ct(e), r = Math.cos(a), i = -Math.sin(a), o = Ma(n.children);
5505
+ const t = `spiff-group-clip-${n.id}`, e = n.rotation || 0, a = wt(e), r = Math.cos(a), i = -Math.sin(a), o = Ma(n.children);
5506
5506
  return /* @__PURE__ */ ct(Gt, { children: [
5507
5507
  /* @__PURE__ */ P("defs", { children: /* @__PURE__ */ P("clipPath", { id: t, preserveAspectRatio: "none", children: n.clipPath ? /* @__PURE__ */ P("path", { d: n.clipPath }) : /* @__PURE__ */ P("rect", { x: 0, y: 0, width: n.width, height: n.height }) }) }),
5508
5508
  /* @__PURE__ */ ct(
@@ -5563,7 +5563,7 @@ const N = () => {
5563
5563
  /* @__PURE__ */ P("feFuncG", { type: "discrete", tableValues: r() }),
5564
5564
  /* @__PURE__ */ P("feFuncB", { type: "discrete", tableValues: r() })
5565
5565
  ] })
5566
- ] }) }) }), o = n.rotation || 0, s = Ct(o), l = Math.cos(s), c = -Math.sin(s), d = () => {
5566
+ ] }) }) }), o = n.rotation || 0, s = wt(o), l = Math.cos(s), c = -Math.sin(s), d = () => {
5567
5567
  const A = n.pattern?.x || 0, u = n.pattern?.y || 0, h = n.pattern?.width || 0, g = n.pattern?.height || 0, m = n.pattern?.scaleX || 1, p = n.pattern?.scaleY || 1, f = n.pattern?.rotation || 0;
5568
5568
  return [n.pattern?.svg ? {
5569
5569
  id: `${t}-contents`,
@@ -5678,7 +5678,7 @@ const yo = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", Je = /* @_
5678
5678
  return Je.get(n);
5679
5679
  const e = (async () => {
5680
5680
  try {
5681
- return wt(n).getFont();
5681
+ return yt(n).getFont();
5682
5682
  } catch {
5683
5683
  if (yo(n)) {
5684
5684
  const a = xn(n), r = sa(a);
@@ -5693,7 +5693,7 @@ const yo = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", Je = /* @_
5693
5693
  }, So = (n) => {
5694
5694
  const t = xn(n), e = sa(t);
5695
5695
  return ga(n, e), e;
5696
- }, wt = (n) => {
5696
+ }, yt = (n) => {
5697
5697
  const t = jn.get(n);
5698
5698
  if (t)
5699
5699
  return t;
@@ -5791,7 +5791,7 @@ const yo = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", Je = /* @_
5791
5791
  const o = (i ?? Kn) * t.getApproximateHeight(), s = 1 / e.unitsPerEm, l = Yn(n, s, t), c = n.length * o * s, d = a / l, A = r / c;
5792
5792
  return Math.min(A, d);
5793
5793
  }, Eo = (n, t, e, a) => {
5794
- const r = wt(t.fontData.assetUrl), i = r.getFont(), o = t.fontSize / i.unitsPerEm;
5794
+ const r = yt(t.fontData.assetUrl), i = r.getFont(), o = t.fontSize / i.unitsPerEm;
5795
5795
  if (!e)
5796
5796
  return Ja(t, n, t.fontSize, o, r, a);
5797
5797
  let s;
@@ -5812,9 +5812,9 @@ const yo = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", Je = /* @_
5812
5812
  fontSize: vo(s, r, i, t.width, t.height, a)
5813
5813
  } : Ja(t, n, t.fontSize, o, r, a);
5814
5814
  }, bo = (n, t, e, a, r) => {
5815
- const o = wt(t.assetUrl).getFont();
5815
+ const o = yt(t.assetUrl).getFont();
5816
5816
  let s = { ...n };
5817
- const l = { ...n }, c = Yn(a, e / o.unitsPerEm, wt(t.assetUrl));
5817
+ const l = { ...n }, c = Yn(a, e / o.unitsPerEm, yt(t.assetUrl));
5818
5818
  return c && c < s.width && (l.width = c, r === "left" ? (l.left += Math.sin(s.rotation * Math.PI / 360) * (s.width - c), l.top += Math.sin(s.rotation * Math.PI / 180) * (c - s.width) / 2) : r === "right" ? l.left += s.width - c : l.left += (s.width - c) / 2, a && Bo(a, a).every(([d, A]) => d === A) && (s = l)), s;
5819
5819
  }, Ke = 1, mt = (n, t, e) => {
5820
5820
  let a = 0;
@@ -5962,7 +5962,7 @@ const xo = (n) => {
5962
5962
  const t = () => {
5963
5963
  if (n.lineHeight !== void 0)
5964
5964
  return n.lineHeight * n.fontSize;
5965
- const r = wt(n.fontData.assetUrl), i = r.getFont(), o = n.fontSize / i.unitsPerEm;
5965
+ const r = yt(n.fontData.assetUrl), i = r.getFont(), o = n.fontSize / i.unitsPerEm;
5966
5966
  return r.getApproximateHeight() * o;
5967
5967
  }, e = () => n.align === "left" ? -n.textboxWidth / 2 : n.align === "right" ? n.textboxWidth / 2 : 0, a = () => {
5968
5968
  const r = t(), i = n.textboxHeight / 2;
@@ -6005,7 +6005,7 @@ const xo = (n) => {
6005
6005
  mask: n.stepName ? void 0 : n.mask
6006
6006
  }
6007
6007
  );
6008
- const t = n.rotation || 0, e = Ct(t), a = Math.cos(e), r = -Math.sin(e), i = `
6008
+ const t = n.rotation || 0, e = wt(t), a = Math.cos(e), r = -Math.sin(e), i = `
6009
6009
  matrix(1, 0, 0, 1, ${n.x}, ${n.y})
6010
6010
  matrix(1, 0, 0, 1, ${n.width / 2}, ${n.height / 2})
6011
6011
  matrix(${a}, ${-r}, ${r}, ${a}, 0, 0)
@@ -6299,10 +6299,10 @@ const ht = /* @__PURE__ */ new Map(), Vt = /* @__PURE__ */ new Map(), _e = /* @_
6299
6299
  const o = dt().parseFromString(n, "image/svg+xml").firstElementChild;
6300
6300
  if (!o)
6301
6301
  throw new Error("Failed to read SVG");
6302
- const l = It().serializeToString(o), c = ft(), d = c.getContext("2d"), A = await va.from(d, l, {
6302
+ const l = It().serializeToString(o), c = Ct(), d = c.getContext("2d"), A = await va.from(d, l, {
6303
6303
  anonymousCrossOrigin: !0,
6304
6304
  ignoreDimensions: !1,
6305
- createCanvas: ft,
6305
+ createCanvas: Ct,
6306
6306
  createImage: te,
6307
6307
  DOMParser: Ba(),
6308
6308
  fetch: nt
@@ -6341,7 +6341,7 @@ const ht = /* @__PURE__ */ new Map(), Vt = /* @__PURE__ */ new Map(), _e = /* @_
6341
6341
  }
6342
6342
  if (e && t === D.Textbox && a?.text && a?.fontScale) {
6343
6343
  await Tt(e);
6344
- const l = wt(e), c = mt(a.text, a?.fontScale, l);
6344
+ const l = yt(e), c = mt(a.text, a?.fontScale, l);
6345
6345
  s.width = Math.min(c, r.width * 0.85), s.left = r.x + r.width / 2 - s.width / 2;
6346
6346
  }
6347
6347
  return s;
@@ -7279,7 +7279,7 @@ class en {
7279
7279
  }
7280
7280
  }
7281
7281
  const Vo = async (n) => {
7282
- const t = `${pt.getServicesApiUrl()}/shortener`;
7282
+ const t = `${ft.getServicesApiUrl()}/shortener`;
7283
7283
  try {
7284
7284
  return (await (await nt(t, {
7285
7285
  method: "POST",
@@ -7782,7 +7782,7 @@ class De {
7782
7782
  ), this.validateColorCount(e, a);
7783
7783
  }
7784
7784
  }
7785
- const St = new De();
7785
+ const vt = new De();
7786
7786
  class Go {
7787
7787
  async getIllustrationBody(t) {
7788
7788
  return new Promise((e) => {
@@ -8676,7 +8676,7 @@ const _o = new Ko(), ea = (n, t, e, a, r) => {
8676
8676
  return [null, null];
8677
8677
  }, Ce = (n, t, e, a, r) => {
8678
8678
  let i, o;
8679
- const s = wt(t.assetUrl), l = s.getFont();
8679
+ const s = yt(t.assetUrl), l = s.getFont();
8680
8680
  if (r.size) {
8681
8681
  const u = n / l.unitsPerEm;
8682
8682
  return [i, o] = ea(e, a, n, u, s), [r.size, i, o];
@@ -8711,7 +8711,7 @@ class Zo {
8711
8711
  /(\r\n|\r|(\u2665|\u00a9|\u00ae|[\u2000-\u2017]|[\u201E-\u3300]]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]))/gm,
8712
8712
  ""
8713
8713
  );
8714
- const r = [], i = e ? wt(e.assetUrl) : void 0;
8714
+ const r = [], i = e ? yt(e.assetUrl) : void 0;
8715
8715
  if (i) {
8716
8716
  const o = a.split("").filter((l) => !Xo.includes(l)).join(""), s = o.split("").map((l) => i.getFont().charToGlyph(l));
8717
8717
  for (let l = 0; l < s.length; l++)
@@ -10081,7 +10081,7 @@ class ys {
10081
10081
  }
10082
10082
  const Ss = () => new Promise((n, t) => {
10083
10083
  try {
10084
- const a = ft().getContext("webgl2");
10084
+ const a = Ct().getContext("webgl2");
10085
10085
  n(!!a);
10086
10086
  } catch {
10087
10087
  n(!1);
@@ -10135,7 +10135,7 @@ class Es {
10135
10135
  * Actions to perform when a static render event is fired for this canvas.
10136
10136
  */
10137
10137
  async render(t) {
10138
- const e = Et(t);
10138
+ const e = pt(t);
10139
10139
  this.lastRequestedRenderArguments = e;
10140
10140
  const a = this.getStaticContext();
10141
10141
  if (!a) {
@@ -10218,7 +10218,7 @@ class bs extends Gn {
10218
10218
  ignoreClear: !0,
10219
10219
  ignoreMouse: !0,
10220
10220
  enableRedraw: !1,
10221
- createCanvas: ft,
10221
+ createCanvas: Ct,
10222
10222
  createImage: te,
10223
10223
  DOMParser: Ba(),
10224
10224
  fetch
@@ -11162,7 +11162,7 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11162
11162
  this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((s) => {
11163
11163
  this.storage[s.stepName] = s.storage || {};
11164
11164
  }), await this.fetchConversionConfiguration(), this.allScenes = await ho(t);
11165
- const r = yt(this.allScenes, this.stepSelections).map((s) => s.silentSteps).flat(), { stepElements: i, commands: o } = await this.stepElementsForIntroducedSilentSteps(r, !!this.reloadedState);
11165
+ const r = St(this.allScenes, this.stepSelections).map((s) => s.silentSteps).flat(), { stepElements: i, commands: o } = await this.stepElementsForIntroducedSilentSteps(r, !!this.reloadedState);
11166
11166
  this.commandContext.apply(new U(o), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(), this.isReloadedTransaction || this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
11167
11167
  }
11168
11168
  getWorkflowExperience() {
@@ -11315,7 +11315,7 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11315
11315
  this.mandatorySteps[t] !== e && (this.mandatorySteps = { ...this.mandatorySteps, [t]: e }, this.onMandatoryChange());
11316
11316
  }
11317
11317
  getMandatoryUnfulfilledSteps() {
11318
- return yt(this.allScenes, this.stepSelections).flatMap((i) => i.renderableSteps).filter((i) => i.mandatory).filter((i) => !this.mandatorySteps[i.stepName]).map((i) => i.stepName);
11318
+ return St(this.allScenes, this.stepSelections).flatMap((i) => i.renderableSteps).filter((i) => i.mandatory).filter((i) => !this.mandatorySteps[i.stepName]).map((i) => i.stepName);
11319
11319
  }
11320
11320
  setStepError(t, e, a) {
11321
11321
  let r = !1;
@@ -11352,7 +11352,7 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11352
11352
  },
11353
11353
  { refocusCamera: e }
11354
11354
  );
11355
- this.setModelContainer(r), yt(this.allScenes, this.stepSelections).filter((s) => s).map((s) => s.renderableSteps).flat().filter((s) => s.type === b.Model || s.type === b.Material).forEach((s) => {
11355
+ this.setModelContainer(r), St(this.allScenes, this.stepSelections).filter((s) => s).map((s) => s.renderableSteps).flat().filter((s) => s.type === b.Model || s.type === b.Material).forEach((s) => {
11356
11356
  if (!s.option?.id) {
11357
11357
  console.error(`Failed to read option id from step: ${s.stepName}`);
11358
11358
  return;
@@ -11459,7 +11459,7 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11459
11459
  const t = this.getCommandContext().getState();
11460
11460
  if (!t)
11461
11461
  throw new Q("Attempted to serialize state before it was initialized.");
11462
- const e = Et(t.transaction), a = this.dehydrateState(e);
11462
+ const e = pt(t.transaction), a = this.dehydrateState(e);
11463
11463
  return JSON.stringify(a, this.sortKeysReplacer, void 0);
11464
11464
  }
11465
11465
  async getStateHash() {
@@ -11507,12 +11507,12 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11507
11507
  this.stepElements = e(this.stepElements, t);
11508
11508
  }
11509
11509
  getInvalidCanvasRegions() {
11510
- return this.experience.getWorkflow()?.steps.reduce((t, e) => (vt(e, this.stepSelections) || this.stepElements[e.stepName] && this.stepElements[e.stepName].forEach(
11510
+ return this.experience.getWorkflow()?.steps.reduce((t, e) => (Et(e, this.stepSelections) || this.stepElements[e.stepName] && this.stepElements[e.stepName].forEach(
11511
11511
  (a) => t.push(a)
11512
11512
  ), t), []) || [];
11513
11513
  }
11514
11514
  getInvalidModelVariants() {
11515
- return this.experience.getWorkflow()?.steps.reduce((t, e) => (e.type === b.Model && !vt(e, this.stepSelections) && t.push(e.stepName), t), []) || [];
11515
+ return this.experience.getWorkflow()?.steps.reduce((t, e) => (e.type === b.Model && !Et(e, this.stepSelections) && t.push(e.stepName), t), []) || [];
11516
11516
  }
11517
11517
  async stepElementsForIntroducedSilentSteps(t, e) {
11518
11518
  const a = this.experience.getProduct();
@@ -11610,13 +11610,13 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11610
11610
  ...this.stepSelections,
11611
11611
  [t]: { selectedVariants: e }
11612
11612
  }, this.selectionCost = Object.values(this.stepSelections).reduce((E, I) => E + I.selectedVariants.map((T) => T.priceModifier || 0).reduce((T, R) => T + R, 0), 0), i.steps.forEach((E) => {
11613
- vt(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1, delete this.stepMetadata[E.stepName], delete this.stepSelections[E.stepName], delete this.storage[E.stepName]);
11613
+ Et(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1, delete this.stepMetadata[E.stepName], delete this.stepSelections[E.stepName], delete this.storage[E.stepName]);
11614
11614
  });
11615
- const s = this.allScenes, l = yt(s, o), c = yt(s, this.stepSelections), d = l.map((E) => E.silentSteps).flat(), u = c.map((E) => E.silentSteps).flat().filter(
11615
+ const s = this.allScenes, l = St(s, o), c = St(s, this.stepSelections), d = l.map((E) => E.silentSteps).flat(), u = c.map((E) => E.silentSteps).flat().filter(
11616
11616
  (E) => !d.some((I) => I.stepName === E.stepName)
11617
11617
  );
11618
11618
  d.forEach((E) => {
11619
- vt(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1);
11619
+ Et(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1);
11620
11620
  });
11621
11621
  const h = this.getInvalidCanvasRegions(), { stepElements: g, commands: m } = await this.stepElementsForIntroducedSilentSteps(u, !1);
11622
11622
  this.stepElements = {
@@ -11657,7 +11657,7 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11657
11657
  * @returns {Promise<void>}
11658
11658
  */
11659
11659
  async ensureStepsAreLoaded() {
11660
- const e = yt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], r = e.flat();
11660
+ const e = St(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], r = e.flat();
11661
11661
  for (const l of r)
11662
11662
  if (!this.stepInitialised[l.stepName])
11663
11663
  switch (this.stepInitialised[l.stepName] = !0, l.type) {
@@ -11671,7 +11671,7 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11671
11671
  );
11672
11672
  break;
11673
11673
  case b.Frame:
11674
- a.push(St.init(l, this, this.reloadedState));
11674
+ a.push(vt.init(l, this, this.reloadedState));
11675
11675
  break;
11676
11676
  case b.Illustration:
11677
11677
  a.push(
@@ -13147,7 +13147,7 @@ class Bl {
13147
13147
  }
13148
13148
  let i = 2048;
13149
13149
  e && e <= 2048 && (i = e);
13150
- const o = ft(i, i), s = this.workflowManager.getCommandContext().getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = s.find((w) => w.layoutState?.layout.panelId === c?.name) || s[0], A = d.layoutState.layout.previewRegion ? {
13150
+ const o = Ct(i, i), s = this.workflowManager.getCommandContext().getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = s.find((w) => w.layoutState?.layout.panelId === c?.name) || s[0], A = d.layoutState.layout.previewRegion ? {
13151
13151
  x: d.layoutState.layout.previewRegion.left,
13152
13152
  y: d.layoutState.layout.previewRegion.top,
13153
13153
  width: d.layoutState.layout.previewRegion.width,
@@ -13170,7 +13170,7 @@ class Bl {
13170
13170
  await (await va.from(h, p, {
13171
13171
  anonymousCrossOrigin: !0,
13172
13172
  ignoreDimensions: !1,
13173
- createCanvas: ft,
13173
+ createCanvas: Ct,
13174
13174
  createImage: te,
13175
13175
  DOMParser: Ba(),
13176
13176
  fetch
@@ -13193,7 +13193,7 @@ class Bl {
13193
13193
  getStepsConditionallyActive() {
13194
13194
  return this.getScenes().flatMap(
13195
13195
  (t) => this.getStepsByScene(t).filter(
13196
- (e) => vt(e.getRaw(), this.getWorkflowManager().getStepSelections())
13196
+ (e) => Et(e.getRaw(), this.getWorkflowManager().getStepSelections())
13197
13197
  )
13198
13198
  );
13199
13199
  }
@@ -13341,7 +13341,7 @@ class Bl {
13341
13341
  return await ra.addDesign(o), o;
13342
13342
  }
13343
13343
  async copy() {
13344
- const t = Et(this.getCommandContext().getState());
13344
+ const t = pt(this.getCommandContext().getState());
13345
13345
  if (!t) throw new Q("Internal state is undefined! Cannot copy experience!");
13346
13346
  const e = JSON.stringify(t.transaction), a = this.getWorkflow();
13347
13347
  if (!a) throw new Q("Workflow is undefined! Cannot copy experience!");
@@ -14100,7 +14100,7 @@ class Rl {
14100
14100
  }
14101
14101
  async setGlobalPropertyState(t) {
14102
14102
  this.globalPropertyState || await this.initPromise;
14103
- const e = Et(this.globalPropertyState);
14103
+ const e = pt(this.globalPropertyState);
14104
14104
  this.globalPropertyState = { ...Ae(t), id: e.id }, this.recalculateMandatoryStates(), await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(e, this.globalPropertyState);
14105
14105
  }
14106
14106
  getAspectMandatoryFulfilled(t) {
@@ -14127,7 +14127,7 @@ class Rl {
14127
14127
  if (!i)
14128
14128
  throw new Error(`Failed to find configuration aspect with name: ${t}`);
14129
14129
  this.mandatoryFulfilledAspects.set(t, e !== "");
14130
- const o = Et(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((l) => l.name === t);
14130
+ const o = pt(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((l) => l.name === t);
14131
14131
  if (s.length > 0)
14132
14132
  if (r) {
14133
14133
  const l = s.find((c) => c.channel === r);
@@ -14170,7 +14170,7 @@ class Rl {
14170
14170
  const r = this.configuration.aspects.find((s) => s.name === t);
14171
14171
  if (!r)
14172
14172
  throw new Error(`Failed to find configuration aspect with name: ${t}`);
14173
- const i = Et(this.globalPropertyState), o = this.globalPropertyState.aspects.filter((s) => s.name === t);
14173
+ const i = pt(this.globalPropertyState), o = this.globalPropertyState.aspects.filter((s) => s.name === t);
14174
14174
  if (o.length > 0)
14175
14175
  if (a) {
14176
14176
  const s = o.find((l) => l.channel === a);
@@ -14575,7 +14575,7 @@ class mr {
14575
14575
  if (h || m.partial && (!m.data.productCollections || m.data.productCollections.length === 0 || !m.data.productCollections[0].productCollectionProductsFeed?.items || m.data.productCollections[0].productCollectionProductsFeed?.items.length === 0))
14576
14576
  return;
14577
14577
  c.abort(), h = !0, g.unsubscribe();
14578
- const p = m.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((f) => !!f.product).map((f) => new ue(Et(f))) || [];
14578
+ const p = m.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((f) => !!f.product).map((f) => new ue(pt(f))) || [];
14579
14579
  u({
14580
14580
  items: p,
14581
14581
  // Clone items because it could be cached data (immutable)
@@ -16165,7 +16165,7 @@ const oc = async (n, t) => {
16165
16165
  throw e.error;
16166
16166
  if (e.errors)
16167
16167
  throw e.errors.forEach((r) => console.error(r)), new Error("Unable to read workflows. Consult GraphQL errors.");
16168
- const a = e.data.workflows;
16168
+ const a = pt(e.data.workflows);
16169
16169
  if (a === void 0 || a.length !== n.length)
16170
16170
  throw new Error(`Unable to read workflows: ${e.errors ?? "Length mismatch in response"}`);
16171
16171
  return a.forEach((r) => {
@@ -16206,10 +16206,10 @@ class Vd {
16206
16206
  } catch (a) {
16207
16207
  throw console.error(a), new gt("Critical - Unable to synchronize workflow state with server.");
16208
16208
  }
16209
- }, this.options = t, this.options.applicationKey && ri(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 35.0.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16209
+ }, this.options = t, this.options.applicationKey && ri(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 35.0.2"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16210
16210
  }
16211
16211
  configure(t) {
16212
- pt.setHubUrl(t.hubUrl), pt.setServerUrl(t.serverUrl), pt.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 && oi(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
16212
+ ft.setHubUrl(t.hubUrl), ft.setServerUrl(t.serverUrl), ft.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 && oi(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
16213
16213
  }
16214
16214
  /**
16215
16215
  * @returns The asset manager allows for common operations related to assets
@@ -17345,7 +17345,7 @@ class mc extends tt {
17345
17345
  }
17346
17346
  selectVariant(t) {
17347
17347
  const e = this.manager.getRegionElements(this.step.stepName);
17348
- return St.selectVariant(
17348
+ return vt.selectVariant(
17349
17349
  this.step,
17350
17350
  t.getResource(),
17351
17351
  e,
@@ -17365,7 +17365,7 @@ class mc 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 St.selectImage(this.step, t, this.manager, a), e) {
17368
+ if (await vt.selectImage(this.step, t, this.manager, a), e) {
17369
17369
  const r = this.manager.getStepStorage(this.step.stepName)?.framePatternData || {};
17370
17370
  this.manager.updateStorage(this.step.stepName, {
17371
17371
  framePatternData: {
@@ -17403,7 +17403,7 @@ class mc 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 j.removeBackgroundFromAsset(e);
17406
- t && await St.selectImage(this.step, a, this.manager, !1);
17406
+ t && await vt.selectImage(this.step, a, this.manager, !1);
17407
17407
  const r = this.manager.getStepStorage(this.step.stepName)?.framePatternData || {};
17408
17408
  return this.manager.updateStorage(this.step.stepName, {
17409
17409
  framePatternData: {
@@ -17414,7 +17414,7 @@ class mc extends tt {
17414
17414
  }), a;
17415
17415
  }
17416
17416
  changeColors(t) {
17417
- St.changeColors(this.step, this.manager, t);
17417
+ vt.changeColors(this.step, this.manager, t);
17418
17418
  }
17419
17419
  getImageData() {
17420
17420
  if (this.frameService)
@@ -17424,7 +17424,7 @@ class mc extends tt {
17424
17424
  return this.step.data.colorOption;
17425
17425
  }
17426
17426
  getAvailableColors() {
17427
- return this.step.data.colorPickerEnabled ? St.availableColors(this.step, this.manager) : Promise.resolve([]);
17427
+ return this.step.data.colorPickerEnabled ? vt.availableColors(this.step, this.manager) : Promise.resolve([]);
17428
17428
  }
17429
17429
  isColorPickerEnabled() {
17430
17430
  return this.step.data.colorPickerEnabled ?? !1;
@@ -17437,7 +17437,7 @@ class mc extends tt {
17437
17437
  return this.step.data.maxColors;
17438
17438
  }
17439
17439
  getUniqueColorCount() {
17440
- return St.getUniqueColorCount(this.step, this.manager);
17440
+ return vt.getUniqueColorCount(this.step, this.manager);
17441
17441
  }
17442
17442
  getCurrentFrameStep(t, e, a, r) {
17443
17443
  return r && r.length > 1 && t === void 0 ? "SelectFrame" : e || a || this.getImageData() ? "Position" : "SelectImage";
@@ -18075,7 +18075,7 @@ export {
18075
18075
  V as findElement,
18076
18076
  ud as findPmsColors,
18077
18077
  Vt as frameDataCache,
18078
- St as frameStepService,
18078
+ vt as frameStepService,
18079
18079
  N as generate,
18080
18080
  ws as generateCommands,
18081
18081
  st as generateSVGWithUnknownColors,
@@ -18142,7 +18142,7 @@ export {
18142
18142
  Fn as setCanvasModule,
18143
18143
  zt as shapeStepService,
18144
18144
  Vo as shortenUrl,
18145
- pt as spiffCoreConfiguration,
18145
+ ft as spiffCoreConfiguration,
18146
18146
  Qd as stepAspectValuesToDesignInputSteps,
18147
18147
  ja as svgColorValueToDefinition,
18148
18148
  tr as svgStringDimensions,