@spiffcommerce/core 27.2.1-beta.ae298b7a-12de-50ab-9392-03d35fbf8fb6 → 27.2.1-beta.ba9aed1e-3075-5c0b-8797-fad18911dd7e

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
@@ -21,7 +21,7 @@ import { split as Ze } from "unicode-default-word-boundary";
21
21
  import ln from "lodash.debounce";
22
22
  import "fs";
23
23
  import "path";
24
- var Ce = /* @__PURE__ */ ((r) => (r.Data = "Data", r.Font = "Font", r.Frame = "Frame", r.Illustration = "Illustration", r.Image = "Image", r.Model = "Model", r.Material = "Material", r.Color = "Color", r.QuestionnaireCollateral = "QuestionnaireCollateral", r.RequestCollateral = "RequestCollateral", r.SignupCollateral = "SignupCollateral", r.Video = "Video", r.ColorProfile = "ColorProfile", r.Environment = "Environment", r))(Ce || {}), G = /* @__PURE__ */ ((r) => (r.FileUpload = "FileUpload", r.Option = "Option", r.ColorOption = "ColorOption", r.Text = "Text", r))(G || {}), P = /* @__PURE__ */ ((r) => (r.Information = "Information", r.Bulk = "Bulk", r.DigitalContent = "DigitalContent", r.Finish = "Finish", r.Frame = "Frame", r.Illustration = "Illustration", r.Introduction = "Introduction", r.Material = "Material", r.Model = "Model", r.Module = "Module", r.Picture = "Picture", r.Photo = "Photo", r.ProductOverlay = "ProductOverlay", r.Question = "Question", r.Shape = "Shape", r.SilentIllustration = "SilentIllustration", r.Text = "Text", r))(P || {}), wr = /* @__PURE__ */ ((r) => (r.Color = "Color", r.Colors = "Colors", r.Selection = "Selection", r.Selections = "Selections", r.Text = "Text", r.Upload = "Upload", r))(wr || {}), Ht = /* @__PURE__ */ ((r) => (r.ThreeD = "ThreeD", r.FreeDesign = "FreeDesign", r.Print = "Print", r))(Ht || {}), M = /* @__PURE__ */ ((r) => (r.Frame = "frame", r.Group = "group", r.Image = "image", r.Pattern = "pattern", r.Illustration = "illustration", r.Textbox = "textbox", r))(M || {}), yr = /* @__PURE__ */ ((r) => (r.Default = "Default", r.FirstTransaction = "FirstTransaction", r.OneToOne = "OneToOne", r))(yr || {}), Sr = /* @__PURE__ */ ((r) => (r.Hyperlink = "Hyperlink", r.Edit = "Edit", r.Approve = "Approve", r))(Sr || {}), vr = /* @__PURE__ */ ((r) => (r.Hub = "Hub", r.Shopify = "Shopify", r))(vr || {}), ua = /* @__PURE__ */ ((r) => (r.BackgroundRemover = "BackgroundRemover", r.ConversionAccelerator = "Conversion Accelerator", r.ProcessBuilder = "ProcessBuilder", r))(ua || {}), Er = /* @__PURE__ */ ((r) => (r[r.Orbit = 0] = "Orbit", r[r.Pan = 1] = "Pan", r))(Er || {}), we = /* @__PURE__ */ ((r) => (r.Owner = "Owner", r.Approver = "Approver", r.Editor = "Editor", r.Viewer = "Viewer", r))(we || {}), Mt = /* @__PURE__ */ ((r) => (r.Autosize = "Autosize", r.Traditional = "Traditional", r))(Mt || {}), q = /* @__PURE__ */ ((r) => (r[r.North = 0] = "North", r[r.Northeast = 1] = "Northeast", r[r.East = 2] = "East", r[r.Southeast = 3] = "Southeast", r[r.South = 4] = "South", r[r.Southwest = 5] = "Southwest", r[r.West = 6] = "West", r[r.Northwest = 7] = "Northwest", r))(q || {}), Br = /* @__PURE__ */ ((r) => (r.Pixel = "px", r.Millimeter = "mm", r.Centimeter = "cm", r))(Br || {});
24
+ var Ce = /* @__PURE__ */ ((r) => (r.Data = "Data", r.Font = "Font", r.Frame = "Frame", r.Illustration = "Illustration", r.Image = "Image", r.Model = "Model", r.Material = "Material", r.Color = "Color", r.QuestionnaireCollateral = "QuestionnaireCollateral", r.RequestCollateral = "RequestCollateral", r.SignupCollateral = "SignupCollateral", r.Video = "Video", r.ColorProfile = "ColorProfile", r.Environment = "Environment", r))(Ce || {}), G = /* @__PURE__ */ ((r) => (r.FileUpload = "FileUpload", r.Option = "Option", r.ColorOption = "ColorOption", r.Text = "Text", r))(G || {}), P = /* @__PURE__ */ ((r) => (r.Information = "Information", r.Bulk = "Bulk", r.DigitalContent = "DigitalContent", r.Finish = "Finish", r.Frame = "Frame", r.Illustration = "Illustration", r.Introduction = "Introduction", r.Material = "Material", r.Model = "Model", r.Module = "Module", r.Picture = "Picture", r.Photo = "Photo", r.ProductOverlay = "ProductOverlay", r.Question = "Question", r.Shape = "Shape", r.SilentIllustration = "SilentIllustration", r.Text = "Text", r))(P || {}), wr = /* @__PURE__ */ ((r) => (r.Color = "Color", r.Colors = "Colors", r.Selection = "Selection", r.Selections = "Selections", r.Text = "Text", r.Upload = "Upload", r))(wr || {}), qt = /* @__PURE__ */ ((r) => (r.ThreeD = "ThreeD", r.FreeDesign = "FreeDesign", r.Print = "Print", r))(qt || {}), M = /* @__PURE__ */ ((r) => (r.Frame = "frame", r.Group = "group", r.Image = "image", r.Pattern = "pattern", r.Illustration = "illustration", r.Textbox = "textbox", r))(M || {}), yr = /* @__PURE__ */ ((r) => (r.Default = "Default", r.FirstTransaction = "FirstTransaction", r.OneToOne = "OneToOne", r))(yr || {}), Sr = /* @__PURE__ */ ((r) => (r.Hyperlink = "Hyperlink", r.Edit = "Edit", r.Approve = "Approve", r))(Sr || {}), vr = /* @__PURE__ */ ((r) => (r.Hub = "Hub", r.Shopify = "Shopify", r))(vr || {}), ua = /* @__PURE__ */ ((r) => (r.BackgroundRemover = "BackgroundRemover", r.ConversionAccelerator = "Conversion Accelerator", r.ProcessBuilder = "ProcessBuilder", r))(ua || {}), Er = /* @__PURE__ */ ((r) => (r[r.Orbit = 0] = "Orbit", r[r.Pan = 1] = "Pan", r))(Er || {}), we = /* @__PURE__ */ ((r) => (r.Owner = "Owner", r.Approver = "Approver", r.Editor = "Editor", r.Viewer = "Viewer", r))(we || {}), Mt = /* @__PURE__ */ ((r) => (r.Autosize = "Autosize", r.Traditional = "Traditional", r))(Mt || {}), H = /* @__PURE__ */ ((r) => (r[r.North = 0] = "North", r[r.Northeast = 1] = "Northeast", r[r.East = 2] = "East", r[r.Southeast = 3] = "Southeast", r[r.South = 4] = "South", r[r.Southwest = 5] = "Southwest", r[r.West = 6] = "West", r[r.Northwest = 7] = "Northwest", r))(H || {}), Br = /* @__PURE__ */ ((r) => (r.Pixel = "px", r.Millimeter = "mm", r.Centimeter = "cm", r))(Br || {});
25
25
  class cn extends Error {
26
26
  constructor(t) {
27
27
  super(t), this.name = this.constructor.name;
@@ -47,7 +47,7 @@ class vt extends _t {
47
47
  super(`Asset not found for variant: ${t.name}`), this.variant = t;
48
48
  }
49
49
  }
50
- class qt extends _t {
50
+ class Ht extends _t {
51
51
  constructor(t) {
52
52
  super(`Resource not found for asset: ${t.name}`), this.asset = t;
53
53
  }
@@ -427,7 +427,7 @@ const zr = (r) => new Promise((t) => {
427
427
  }, jr = (r) => {
428
428
  const e = r.naturalWidth / r.naturalHeight;
429
429
  return r.naturalHeight <= 8192 && r.naturalWidth <= 8192 ? [r.naturalWidth, r.naturalHeight] : r.naturalHeight > r.naturalWidth ? [e * 8192, 8192] : [8192, 8192 / e];
430
- }, Hr = async (r) => {
430
+ }, qr = async (r) => {
431
431
  var A;
432
432
  const t = await Tr(r), e = await Zt(t), [a, n] = jr(e);
433
433
  if (!await Wr()) {
@@ -460,7 +460,7 @@ const zr = (r) => new Promise((t) => {
460
460
  }
461
461
  return d.drawImage(e, 0, 0, o, l), c;
462
462
  }, Me = async (r) => {
463
- const t = await Hr(r);
463
+ const t = await qr(r);
464
464
  return ke(r) === "image/jpeg" ? {
465
465
  dataUrl: t.toDataURL("image/jpeg", 1),
466
466
  height: t.height,
@@ -3163,12 +3163,12 @@ function Ic(r) {
3163
3163
  const t = Yt.indexOf(r);
3164
3164
  return t >= 0 ? Ft[t] : "";
3165
3165
  }
3166
- function qr(r) {
3166
+ function Hr(r) {
3167
3167
  const t = Ft.indexOf(r);
3168
3168
  return t >= 0 ? Yt[t] : "";
3169
3169
  }
3170
3170
  function Pc(r, t = 64) {
3171
- const e = [], a = [], n = qr(r);
3171
+ const e = [], a = [], n = Hr(r);
3172
3172
  n && e.push({
3173
3173
  pms: n,
3174
3174
  hex: r,
@@ -5317,7 +5317,7 @@ const Q = () => {
5317
5317
  width: u
5318
5318
  }) => {
5319
5319
  var E;
5320
- const h = e || 0, g = 2 * ((l == null ? void 0 : l.scale) || 1), m = A || { x: 0, y: 0, width: u, height: i }, p = `${m.x} ${m.y} ${m.width} ${m.height}`, f = Q(), C = a.purpose === Ht.FreeDesign && /* @__PURE__ */ F("defs", { children: /* @__PURE__ */ F("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ F("rect", { width: m.width, height: m.height, rx: h }) }) }), w = (E = a.colorProfiles) == null ? void 0 : E.map((B, I) => (
5320
+ const h = e || 0, g = 2 * ((l == null ? void 0 : l.scale) || 1), m = A || { x: 0, y: 0, width: u, height: i }, p = `${m.x} ${m.y} ${m.width} ${m.height}`, f = Q(), C = a.purpose === qt.FreeDesign && /* @__PURE__ */ F("defs", { children: /* @__PURE__ */ F("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ F("rect", { width: m.width, height: m.height, rx: h }) }) }), w = (E = a.colorProfiles) == null ? void 0 : E.map((B, I) => (
5321
5321
  /* @ts-ignore */
5322
5322
  /* @__PURE__ */ F("color-profile", { name: B.name, xlinkHref: B.key, children: " " }, I)
5323
5323
  )), S = n.map((B) => ({
@@ -5360,7 +5360,7 @@ const Q = () => {
5360
5360
  "g",
5361
5361
  {
5362
5362
  id: "element-group",
5363
- clipPath: a.purpose === Ht.FreeDesign ? "url(#viewboxClip)" : void 0,
5363
+ clipPath: a.purpose === qt.FreeDesign ? "url(#viewboxClip)" : void 0,
5364
5364
  children: y.map((B) => Qn(B)).filter((B) => !!B)
5365
5365
  }
5366
5366
  ),
@@ -5433,22 +5433,22 @@ const Q = () => {
5433
5433
  y: r.y + ((t == null ? void 0 : t.y) + (t == null ? void 0 : t.height)) * a
5434
5434
  }), Pt = (r) => {
5435
5435
  switch (r) {
5436
- case q.North:
5437
- return q.East;
5438
- case q.East:
5439
- return q.South;
5440
- case q.South:
5441
- return q.West;
5442
- case q.West:
5443
- return q.North;
5444
- case q.Northwest:
5445
- return q.Northeast;
5446
- case q.Northeast:
5447
- return q.Southeast;
5448
- case q.Southeast:
5449
- return q.Southwest;
5450
- case q.Southwest:
5451
- return q.Northwest;
5436
+ case H.North:
5437
+ return H.East;
5438
+ case H.East:
5439
+ return H.South;
5440
+ case H.South:
5441
+ return H.West;
5442
+ case H.West:
5443
+ return H.North;
5444
+ case H.Northwest:
5445
+ return H.Northeast;
5446
+ case H.Northeast:
5447
+ return H.Southeast;
5448
+ case H.Southeast:
5449
+ return H.Southwest;
5450
+ case H.Southwest:
5451
+ return H.Northwest;
5452
5452
  }
5453
5453
  }, Oc = (r, t) => t > 45 && t <= 135 ? Pt(r) : t > 135 && t <= 225 ? Pt(Pt(r)) : t > 225 && t <= 315 ? Pt(Pt(Pt(r))) : r, $c = (r, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
5454
5454
  const a = pt(r.rotation), n = {
@@ -5677,14 +5677,14 @@ class ji {
5677
5677
  }), a - n;
5678
5678
  }
5679
5679
  }
5680
- const Hi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ue = /* @__PURE__ */ new Map(), Nt = async (r) => {
5680
+ const qi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ue = /* @__PURE__ */ new Map(), Nt = async (r) => {
5681
5681
  if (Ue.has(r))
5682
5682
  return Ue.get(r);
5683
5683
  const e = (async () => {
5684
5684
  try {
5685
5685
  return Et(r).getFont();
5686
5686
  } catch {
5687
- if (Hi(r)) {
5687
+ if (qi(r)) {
5688
5688
  const a = hn(r), n = Xe(a);
5689
5689
  return ra(r, n), n;
5690
5690
  } else {
@@ -5694,7 +5694,7 @@ const Hi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ue = /* @_
5694
5694
  }
5695
5695
  })();
5696
5696
  return Ue.set(r, e), e;
5697
- }, qi = (r) => {
5697
+ }, Hi = (r) => {
5698
5698
  const t = hn(r), e = Xe(t);
5699
5699
  return ra(r, e), e;
5700
5700
  }, Et = (r) => {
@@ -6967,7 +6967,7 @@ class ds extends O {
6967
6967
  };
6968
6968
  }
6969
6969
  }
6970
- class Hc extends O {
6970
+ class qc extends O {
6971
6971
  constructor(t, e) {
6972
6972
  super(), this.id = t, this.src = e;
6973
6973
  }
@@ -7086,7 +7086,7 @@ class us extends O {
7086
7086
  };
7087
7087
  }
7088
7088
  }
7089
- class qc extends O {
7089
+ class Hc extends O {
7090
7090
  /**
7091
7091
  * @param id The targeted element to bring to the front.
7092
7092
  */
@@ -7367,7 +7367,7 @@ class gs {
7367
7367
  async () => {
7368
7368
  const m = await i();
7369
7369
  if (!m.link || !m.link)
7370
- throw new qt(m.asset);
7370
+ throw new Ht(m.asset);
7371
7371
  h({
7372
7372
  rel: "mpeg4",
7373
7373
  href: m.link
@@ -7442,7 +7442,7 @@ class be {
7442
7442
  const n = a.fileLink;
7443
7443
  if (n)
7444
7444
  return at(n, !0);
7445
- throw new qt(a);
7445
+ throw new Ht(a);
7446
7446
  };
7447
7447
  }
7448
7448
  async init(t, e, a) {
@@ -7786,7 +7786,7 @@ class be {
7786
7786
  const a = t.fileLink;
7787
7787
  if (a)
7788
7788
  return a;
7789
- throw new qt(t);
7789
+ throw new Ht(t);
7790
7790
  }
7791
7791
  async loadPatternFromAsset(t, e, a, n) {
7792
7792
  var c, d;
@@ -7991,7 +7991,7 @@ class ms {
7991
7991
  throw new vt(e);
7992
7992
  const l = o.fileLink;
7993
7993
  if (!l)
7994
- throw new qt(o);
7994
+ throw new Ht(o);
7995
7995
  const c = await lt(await this.getIllustrationBody(l)), d = await Kt(c.svg), A = (C) => {
7996
7996
  const w = i.getLayouts().find((y) => y.panelId === C.panelId);
7997
7997
  if (!w)
@@ -8472,31 +8472,31 @@ class ys {
8472
8472
  }
8473
8473
  }
8474
8474
  async selectVariant(t, e, a) {
8475
- await a.getInitializationPromise();
8475
+ console.log("LOG: q select variant"), await a.getInitializationPromise();
8476
8476
  const n = await this.selectVariantLambda(t, e, a);
8477
- n && (n.command && a.getCommandDispatcher()(n.command), n.followup && await n.followup());
8477
+ n && (console.log("LOG: q select variant result"), n.command && a.getCommandDispatcher()(n.command), n.followup && await n.followup());
8478
8478
  }
8479
8479
  async selectVariantLambda(t, e, a) {
8480
8480
  const n = t.option;
8481
8481
  if (!n)
8482
- return null;
8482
+ return console.log("LOG: q select variant no option"), null;
8483
8483
  const i = n.variants;
8484
8484
  if (!i)
8485
- return null;
8485
+ return console.log("LOG: q select variant no variants"), null;
8486
8486
  const s = i.length > 1 ? i.find((o) => o.id === e) : i[0];
8487
8487
  if (!s)
8488
- throw new Error(`Failed to find selected variant ${e} in option ${n.id} of step ${t.stepName} (${t.stepTitle})`);
8488
+ throw console.log("LOG: q select variant no variant"), new Error(`Failed to find selected variant ${e} in option ${n.id} of step ${t.stepName} (${t.stepTitle})`);
8489
8489
  return {
8490
8490
  command: void 0,
8491
8491
  followup: async () => {
8492
- await a.setSelectionsAndElements(t.stepName, [s], [], async () => {
8492
+ console.log("LOG: q select variant follow up"), await a.setSelectionsAndElements(t.stepName, [s], [], async () => {
8493
8493
  a.setMandatoryFulfilled(t.stepName, !0);
8494
8494
  });
8495
8495
  }
8496
8496
  };
8497
8497
  }
8498
8498
  }
8499
- const Hn = new ys();
8499
+ const qn = new ys();
8500
8500
  class Ss {
8501
8501
  constructor() {
8502
8502
  this.shapeFillId = "spiff-fill-shape";
@@ -8695,7 +8695,7 @@ class vs {
8695
8695
  );
8696
8696
  }
8697
8697
  }
8698
- const Es = new vs(), He = (r, t, e, a, n) => {
8698
+ const Es = new vs(), qe = (r, t, e, a, n) => {
8699
8699
  if (t.some((d) => d == null))
8700
8700
  throw new Error(`Failed to autosize lines: ${t.join(", ")}`);
8701
8701
  let i = t.map((d) => d.split(`
@@ -8727,19 +8727,19 @@ const Es = new vs(), He = (r, t, e, a, n) => {
8727
8727
  const o = Et(t.assetUrl), l = o.getFont();
8728
8728
  if (n.size) {
8729
8729
  const u = r / l.unitsPerEm;
8730
- return [i, s] = He(e, a, r, u, o), [n.size, i, s];
8730
+ return [i, s] = qe(e, a, r, u, o), [n.size, i, s];
8731
8731
  }
8732
8732
  const c = 6;
8733
8733
  let d = c - Ve;
8734
8734
  if (a.length > 0) {
8735
8735
  let u = a, h = 0;
8736
8736
  for (; (!n.maxSize || d <= n.maxSize) && u; )
8737
- d += Ve, h = d / l.unitsPerEm, [u, s] = He(e, a, d, h, o);
8737
+ d += Ve, h = d / l.unitsPerEm, [u, s] = qe(e, a, d, h, o);
8738
8738
  }
8739
8739
  d > c && (d -= Ve), n.minSize && d < n.minSize && (d = n.minSize);
8740
8740
  const A = d / l.unitsPerEm;
8741
- return [i, s] = He(e, a, d, A, o), [d, i, s];
8742
- }, qe = 30;
8741
+ return [i, s] = qe(e, a, d, A, o), [d, i, s];
8742
+ }, He = 30;
8743
8743
  class Ie extends Error {
8744
8744
  constructor(t) {
8745
8745
  super(t), Object.setPrototypeOf(this, new.target.prototype), this.name = Ie.name;
@@ -9042,10 +9042,12 @@ class bs {
9042
9042
  a.serializableWorkflow.steps
9043
9043
  ), o = Object.values(a.layouts).map((g) => g.elements).flat().filter((g) => g.stepName === t.stepName), l = t.option;
9044
9044
  if (n != null && n.selectedVariants) {
9045
+ console.log("LOG: text reload selections");
9045
9046
  const g = n.selectedVariants[0].id;
9046
9047
  if (l && g) {
9047
9048
  const m = (c = l.variants) == null ? void 0 : c.find((p) => p.id === g);
9048
9049
  if (m) {
9050
+ console.log("LOG: text reload selections variant");
9049
9051
  const p = await this.fontDataFromVariant(m), f = o.map((y) => ({ id: y.id, region: y.stepRegion })), C = (d = n.storage) == null ? void 0 : d.color;
9050
9052
  let w = (A = n.storage) == null ? void 0 : A.text;
9051
9053
  const S = e.getWorkflowExperience().getBundle();
@@ -9069,8 +9071,10 @@ class bs {
9069
9071
  e.getCommandDispatcher()(E);
9070
9072
  }
9071
9073
  ), o.length === 0 && l) {
9074
+ console.log("LOG: text reload cond");
9072
9075
  const y = Y.getDefaultVariant(l);
9073
9076
  if (y) {
9077
+ console.log("LOG: text reload cond default");
9074
9078
  const E = await this.selectVariantCommand(
9075
9079
  t,
9076
9080
  y,
@@ -9085,6 +9089,7 @@ class bs {
9085
9089
  e.getCommandDispatcher()(E.command);
9086
9090
  }
9087
9091
  } else {
9092
+ console.log("LOG: text reload noncond");
9088
9093
  const { command: y } = j.updateInputText(
9089
9094
  w || "",
9090
9095
  o,
@@ -9096,6 +9101,7 @@ class bs {
9096
9101
  }
9097
9102
  }
9098
9103
  } else {
9104
+ console.log("LOG: text reload else");
9099
9105
  const g = e.getWorkflowExperience().getBundle();
9100
9106
  if (g && t.globalPropertyAspectConfigurations) {
9101
9107
  const m = (h = g.getGlobalPropertyConfiguration()) == null ? void 0 : h.aspects, p = m == null ? void 0 : m.find((f) => {
@@ -9103,9 +9109,11 @@ class bs {
9103
9109
  return f.type === G.Text && ((C = t.globalPropertyAspectConfigurations) == null ? void 0 : C.map((w) => w.aspectName).includes(f.name));
9104
9110
  });
9105
9111
  if (p) {
9112
+ console.log("LOG: text reload else aspect");
9106
9113
  const C = g.getGlobalPropertyStateManager().getAspect(p.name);
9107
9114
  if (C)
9108
9115
  if (o.length === 0 && l) {
9116
+ console.log("LOG: text reload else aspect text a");
9109
9117
  const w = Y.getDefaultVariant(l);
9110
9118
  if (w) {
9111
9119
  const S = await this.selectVariantCommand(
@@ -9122,6 +9130,7 @@ class bs {
9122
9130
  e.getCommandDispatcher()(S.command);
9123
9131
  }
9124
9132
  } else {
9133
+ console.log("LOG: text reload else aspect text b");
9125
9134
  const { command: w } = j.updateInputText(
9126
9135
  C,
9127
9136
  o,
@@ -9162,7 +9171,7 @@ class bs {
9162
9171
  throw new vt(t);
9163
9172
  const a = e.fileLink;
9164
9173
  if (!a)
9165
- throw new qt(e);
9174
+ throw new Ht(e);
9166
9175
  const n = await Nt(a);
9167
9176
  return {
9168
9177
  assetUrl: a,
@@ -9186,7 +9195,7 @@ class bs {
9186
9195
  }
9187
9196
  const g = await this.changeInputTextWithRegion(
9188
9197
  t,
9189
- t.data.size || qe,
9198
+ t.data.size || He,
9190
9199
  A,
9191
9200
  a.text || "",
9192
9201
  a,
@@ -9211,7 +9220,7 @@ class bs {
9211
9220
  i
9212
9221
  ), g = await this.changeInputTextWithRegion(
9213
9222
  t,
9214
- t.data.size || qe,
9223
+ t.data.size || He,
9215
9224
  A,
9216
9225
  ((u = h[0]) == null ? void 0 : u.newElement.input) || a.text || t.data.defaultText || "",
9217
9226
  a,
@@ -9273,7 +9282,7 @@ class bs {
9273
9282
  stepName: t,
9274
9283
  align: this.textAlign(a),
9275
9284
  fill: i.color ? i.color : w,
9276
- fontSize: a.size || qe,
9285
+ fontSize: a.size || He,
9277
9286
  fontData: n,
9278
9287
  id: g,
9279
9288
  layer: A.layer,
@@ -9438,7 +9447,7 @@ function Ms(r, t, e, a) {
9438
9447
  const n = e / r, i = a / t;
9439
9448
  return n > 1 && i > 1 ? Math.min(n, i) : n > 1 && i < 1 ? i : n < 1 && i > 1 ? n : Math.min(n, i);
9440
9449
  }
9441
- const Ha = {
9450
+ const qa = {
9442
9451
  m: ["x", "y"],
9443
9452
  z: [],
9444
9453
  l: ["x", "y"],
@@ -9468,7 +9477,7 @@ class Ts {
9468
9477
  const n = (i) => {
9469
9478
  const s = [], o = i.relative ? i.type : i.type.toUpperCase();
9470
9479
  let l = e !== o;
9471
- const c = Ha[i.type];
9480
+ const c = qa[i.type];
9472
9481
  l && (s.push(o), e = o);
9473
9482
  for (const d of c) {
9474
9483
  const A = i[d];
@@ -9493,7 +9502,7 @@ class Ts {
9493
9502
  const e = /([mzlhvcsqta])([^mzlhvcsqta]*)/gi, a = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi, n = [];
9494
9503
  let i;
9495
9504
  for (e.lastIndex = 0; i = e.exec(t); ) {
9496
- const s = i[1].toLowerCase(), o = (i[2].match(a) || []).map(parseFloat), l = s === i[1], c = Ha[s];
9505
+ const s = i[1].toLowerCase(), o = (i[2].match(a) || []).map(parseFloat), l = s === i[1], c = qa[s];
9497
9506
  if (o.length < c.length)
9498
9507
  throw new xt(
9499
9508
  `Path type "${s}" given ${o.length} arguments, expected ${c.length}.`
@@ -9559,7 +9568,7 @@ class Ns extends Is {
9559
9568
  return this.svgElement(t, e);
9560
9569
  }
9561
9570
  svgElement(t, e) {
9562
- const a = qi(Ps), i = t !== "" ? ((w) => w.charAt(0).toUpperCase() + w.substr(1).toLowerCase())(t) : "", s = a.getPath(i, 0, 72, 72), o = s.toSVG(2), l = s.getBoundingBox(), c = l.x2 - l.x1, d = s.toPathData(3), A = () => {
9571
+ const a = Hi(Ps), i = t !== "" ? ((w) => w.charAt(0).toUpperCase() + w.substr(1).toLowerCase())(t) : "", s = a.getPath(i, 0, 72, 72), o = s.toSVG(2), l = s.getBoundingBox(), c = l.x2 - l.x1, d = s.toPathData(3), A = () => {
9563
9572
  const w = et("g");
9564
9573
  w.classList.add("module-text-group");
9565
9574
  const S = et("defs");
@@ -9590,7 +9599,7 @@ class Ns extends Is {
9590
9599
  return ks(p, C, e.height, e.width, 0.35, 0.65), Fs(u.outerHTML);
9591
9600
  }
9592
9601
  }
9593
- async function qn(r) {
9602
+ async function Hn(r) {
9594
9603
  if (r === "Vegemite")
9595
9604
  return new Ns();
9596
9605
  throw new z(`Failed to resolve Module, Module ${r} not found`);
@@ -9811,7 +9820,7 @@ const ne = v`
9811
9820
  quoteId
9812
9821
  }
9813
9822
  }
9814
- `, qa = v`
9823
+ `, Ha = v`
9815
9824
  query GetBundleStakeholders($id: String!) {
9816
9825
  bundles(ids: [$id]) {
9817
9826
  id
@@ -10017,7 +10026,7 @@ const ne = v`
10017
10026
  }
10018
10027
  }
10019
10028
  }
10020
- `, Hs = v`
10029
+ `, qs = v`
10021
10030
  mutation UpdateBundle(
10022
10031
  $id: String!
10023
10032
  $name: String
@@ -10037,7 +10046,7 @@ const ne = v`
10037
10046
  id
10038
10047
  }
10039
10048
  }
10040
- `, qs = v`
10049
+ `, Hs = v`
10041
10050
  mutation BundleAddTransaction($id: String!, $transactionId: String!) {
10042
10051
  bundleAddTransaction(id: $id, transactionId: $transactionId) {
10043
10052
  id
@@ -10896,8 +10905,9 @@ class go {
10896
10905
  }
10897
10906
  async ensureStepsAreLoaded() {
10898
10907
  const e = Dt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
10908
+ console.log(`LOG: ensure ${n.length} steps loaded`);
10899
10909
  for (const l of n)
10900
- if (!this.stepInitialised[l.stepName])
10910
+ if (console.log(`LOG: is ${l.stepTitle} (${l.stepName}) inited? ${this.stepInitialised[l.stepName]}`), !this.stepInitialised[l.stepName])
10901
10911
  switch (this.stepInitialised[l.stepName] = !0, l.type) {
10902
10912
  case P.DigitalContent:
10903
10913
  a.push(
@@ -10926,7 +10936,7 @@ class go {
10926
10936
  break;
10927
10937
  case P.Module:
10928
10938
  this.stepSpecificServices[l.stepName] = {
10929
- module: await qn(l.data.module)
10939
+ module: await Hn(l.data.module)
10930
10940
  }, a.push(
10931
10941
  Wn.init(l, this, this.reloadedState)
10932
10942
  );
@@ -10938,14 +10948,14 @@ class go {
10938
10948
  break;
10939
10949
  case P.Question:
10940
10950
  a.push(
10941
- Hn.init(l, this, this.reloadedState)
10951
+ qn.init(l, this, this.reloadedState)
10942
10952
  );
10943
10953
  break;
10944
10954
  case P.Shape:
10945
10955
  a.push(Gt.init(l, this, this.reloadedState));
10946
10956
  break;
10947
10957
  case P.Text:
10948
- a.push(j.init(l, this, this.reloadedState));
10958
+ console.log("LOG: ensure text loaded"), a.push(j.init(l, this, this.reloadedState));
10949
10959
  break;
10950
10960
  }
10951
10961
  const i = (await Promise.allSettled(a)).map((l) => {
@@ -11353,7 +11363,7 @@ class wo extends it {
11353
11363
  async selectVariant(t) {
11354
11364
  if (!t.getId())
11355
11365
  throw new Error("Unable to select variant with a null ID");
11356
- await Hn.selectVariant(this.step, t.getId(), this.manager);
11366
+ await qn.selectVariant(this.step, t.getId(), this.manager);
11357
11367
  }
11358
11368
  /**
11359
11369
  * The way that this step expects to be rendered.
@@ -11986,22 +11996,22 @@ const Po = async (r, t) => {
11986
11996
  for (const T of Object.keys(i)) {
11987
11997
  const nt = i[T], R = t.steps.find((tt) => tt.stepName === T);
11988
11998
  for (let tt = 0; tt < nt.selections.length; ++tt) {
11989
- const H = nt.selections[tt];
11999
+ const q = nt.selections[tt];
11990
12000
  if (R && (!D || R.option && (R.option.variants || []).length > 1 && !R.data.hideSelectionInCart && !R.data.hideSelectionsInCart)) {
11991
12001
  const ft = R.stepTitle;
11992
12002
  x[ft] ? x[ft].push({
11993
- id: H.id || "",
11994
- name: H.name,
11995
- priceModifier: H.priceModifier
12003
+ id: q.id || "",
12004
+ name: q.name,
12005
+ priceModifier: q.priceModifier
11996
12006
  }) : x[ft] = [
11997
12007
  {
11998
- id: H.id || "",
11999
- name: H.name,
12000
- priceModifier: H.priceModifier
12008
+ id: q.id || "",
12009
+ name: q.name,
12010
+ priceModifier: q.priceModifier
12001
12011
  }
12002
12012
  ];
12003
12013
  }
12004
- k += H.priceModifier;
12014
+ k += q.priceModifier;
12005
12015
  }
12006
12016
  }
12007
12017
  return [x, k];
@@ -12374,7 +12384,7 @@ class Oo {
12374
12384
  throw new xe("Failed to obtain 2D context for preview image creation");
12375
12385
  const g = Sa(u.layoutState.layout, u.layoutState.elements, {
12376
12386
  renderingConfiguration: {
12377
- purpose: Ht.Print,
12387
+ purpose: qt.Print,
12378
12388
  region: { left: A.x, top: A.y, width: A.width, height: A.height },
12379
12389
  templatingContext: this.workflowManager.getTemplatingContext()
12380
12390
  }
@@ -12839,7 +12849,7 @@ const $o = [
12839
12849
  return console.error(B), [];
12840
12850
  }
12841
12851
  }, Go = async (r, t, e) => {
12842
- const a = await qn(e.data.module), n = t.data, i = (o, l) => {
12852
+ const a = await Hn(e.data.module), n = t.data, i = (o, l) => {
12843
12853
  const c = r.find((A) => A.panelId === l.panelId);
12844
12854
  if (!c)
12845
12855
  throw new J(l);
@@ -13034,7 +13044,7 @@ const $o = [
13034
13044
  });
13035
13045
  }
13036
13046
  return a;
13037
- }, Ho = async (r, t, e, a) => {
13047
+ }, qo = async (r, t, e, a) => {
13038
13048
  const n = [], i = e.data, s = 30, o = (p) => p.vertical ? "center" : p.textAlign || "center", l = () => {
13039
13049
  var w;
13040
13050
  const p = a.option;
@@ -13123,7 +13133,7 @@ const $o = [
13123
13133
  n.push(new W(C, f));
13124
13134
  }
13125
13135
  return n;
13126
- }, qo = (r, t) => r.conditions ? r.conditions.every((e) => {
13136
+ }, Ho = (r, t) => r.conditions ? r.conditions.every((e) => {
13127
13137
  const a = t[e.targetStepName];
13128
13138
  if (a && a.selectedVariants) {
13129
13139
  const n = a.selectedVariants;
@@ -13174,13 +13184,13 @@ const $o = [
13174
13184
  break;
13175
13185
  case P.Text:
13176
13186
  n.push(
13177
- ...await Ho(e, i, s, o)
13187
+ ...await qo(e, i, s, o)
13178
13188
  );
13179
13189
  break;
13180
13190
  }
13181
13191
  }
13182
13192
  for (const s of t.steps)
13183
- s.type !== P.SilentIllustration && s.type !== P.ProductOverlay || qo(s, i) && n.push(
13193
+ s.type !== P.SilentIllustration && s.type !== P.ProductOverlay || Ho(s, i) && n.push(
13184
13194
  ...await jo(e, s, a)
13185
13195
  );
13186
13196
  return n;
@@ -13348,7 +13358,7 @@ class Zo extends Dn {
13348
13358
  l = i.width, c = i.height;
13349
13359
  const d = Sa(t.layoutState.layout, e, {
13350
13360
  renderingConfiguration: {
13351
- purpose: Ht.ThreeD,
13361
+ purpose: qt.ThreeD,
13352
13362
  templatingContext: (g = (h = this.getWorkflowManager) == null ? void 0 : h.call(this)) == null ? void 0 : g.getTemplatingContext()
13353
13363
  }
13354
13364
  }), A = un(d), u = await Aa.from(this.ctx, A, {
@@ -14991,7 +15001,7 @@ class Je {
14991
15001
  throw new Error("Unable to add transaction to bundle - Already Exists!");
14992
15002
  const s = (N.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(a);
14993
15003
  await b.getShadowGraphqlClient().mutate({
14994
- mutation: qs,
15004
+ mutation: Hs,
14995
15005
  variables: {
14996
15006
  id: this.id,
14997
15007
  transactionId: a
@@ -15174,7 +15184,7 @@ class Je {
15174
15184
  }
15175
15185
  async getAllStakeholders() {
15176
15186
  const t = await b.getShadowGraphqlClient().query({
15177
- query: qa,
15187
+ query: Ha,
15178
15188
  errorPolicy: "all",
15179
15189
  fetchPolicy: "no-cache",
15180
15190
  variables: {
@@ -15191,7 +15201,7 @@ class Je {
15191
15201
  }
15192
15202
  async getCurrentStakeholder() {
15193
15203
  const t = await b.getShadowGraphqlClient().query({
15194
- query: qa,
15204
+ query: Ha,
15195
15205
  errorPolicy: "all",
15196
15206
  fetchPolicy: "no-cache",
15197
15207
  variables: {
@@ -15346,7 +15356,7 @@ class Je {
15346
15356
  async updateBundle() {
15347
15357
  var e;
15348
15358
  if (!((e = (await b.getShadowGraphqlClient().mutate({
15349
- mutation: Hs,
15359
+ mutation: qs,
15350
15360
  variables: {
15351
15361
  id: this.id,
15352
15362
  name: this.name,
@@ -15912,7 +15922,7 @@ class rd {
15912
15922
  } catch (a) {
15913
15923
  throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
15914
15924
  }
15915
- }, this.options = t, this.options.applicationKey && Rr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 27.2.1-beta.31456104-bd13-593d-93cf-06c301698749"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15925
+ }, this.options = t, this.options.applicationKey && Rr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 27.2.1-beta.f9f891fb-9e3d-52fc-8c9a-0382e6e1afa4"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15916
15926
  }
15917
15927
  configure(t) {
15918
15928
  gt.setHubUrl(t.hubUrl), gt.setServerUrl(t.serverUrl), gt.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 && $r(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Ut.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
@@ -16465,8 +16475,8 @@ class rd {
16465
16475
  singleVariantsRenderable: (tt = k == null ? void 0 : k.workflowConfiguration) == null ? void 0 : tt.singleVariantsRenderable,
16466
16476
  stateMutationFunc: I ? async () => {
16467
16477
  throw new z("State mutation is forbidden in read only mode!");
16468
- } : async (H) => this.updateTransactionState({
16469
- ...H,
16478
+ } : async (q) => this.updateTransactionState({
16479
+ ...q,
16470
16480
  context: { transactionOwnerId: T, bundleOwnerId: e == null ? void 0 : e.bundleOwnerId }
16471
16481
  }),
16472
16482
  graphQlClient: () => nt,
@@ -16475,11 +16485,11 @@ class rd {
16475
16485
  isReloadedTransaction: k.type === "transaction"
16476
16486
  };
16477
16487
  if (k.type === "transaction" && E.workflowState) {
16478
- const H = JSON.parse(E.workflowState);
16479
- R.layouts = Object.values(H.layouts || {}).map((ft) => ft.layout), await Ga(H), R.reloadedState = H;
16488
+ const q = JSON.parse(E.workflowState);
16489
+ R.layouts = Object.values(q.layouts || {}).map((ft) => ft.layout), await Ga(q), R.reloadedState = q;
16480
16490
  } else if (!I && k.workflowState) {
16481
- const H = JSON.parse(k.workflowState);
16482
- R.layouts = Object.values(H.layouts || {}).map((ft) => ft.layout), await Ga(H), R.reloadedState = H;
16491
+ const q = JSON.parse(k.workflowState);
16492
+ R.layouts = Object.values(q.layouts || {}).map((ft) => ft.layout), await Ga(q), R.reloadedState = q;
16483
16493
  } else
16484
16494
  R.layouts = Fl(
16485
16495
  R.transaction,
@@ -17466,7 +17476,7 @@ _ = { __e: function(r, t, e, a) {
17466
17476
  throw r;
17467
17477
  } }, typeof Promise == "function" && Promise.prototype.then.bind(Promise.resolve());
17468
17478
  var ot, Ke, _a, ar = [], _e = [], Xa = _.__b, Za = _.__r, tn = _.diffed, en = _.__c, an = _.unmount;
17469
- function Hl() {
17479
+ function ql() {
17470
17480
  for (var r; r = ar.shift(); )
17471
17481
  if (r.__P && r.__H)
17472
17482
  try {
@@ -17486,7 +17496,7 @@ _.__b = function(r) {
17486
17496
  }, _.diffed = function(r) {
17487
17497
  tn && tn(r);
17488
17498
  var t = r.__c;
17489
- t && t.__H && (t.__H.__h.length && (ar.push(t) !== 1 && _a === _.requestAnimationFrame || ((_a = _.requestAnimationFrame) || ql)(Hl)), t.__H.__.forEach(function(e) {
17499
+ t && t.__H && (t.__H.__h.length && (ar.push(t) !== 1 && _a === _.requestAnimationFrame || ((_a = _.requestAnimationFrame) || Hl)(ql)), t.__H.__.forEach(function(e) {
17490
17500
  e.i && (e.__H = e.i), e.__V !== _e && (e.__ = e.__V), e.i = void 0, e.__V = _e;
17491
17501
  })), Ke = ot = null;
17492
17502
  }, _.__c = function(r, t) {
@@ -17513,7 +17523,7 @@ _.__b = function(r) {
17513
17523
  }), e.__H = void 0, t && _.__e(t, e.__v));
17514
17524
  };
17515
17525
  var nn = typeof requestAnimationFrame == "function";
17516
- function ql(r) {
17526
+ function Hl(r) {
17517
17527
  var t, e = function() {
17518
17528
  clearTimeout(a), nn && cancelAnimationFrame(t), setTimeout(r);
17519
17529
  }, a = setTimeout(e, 100);
@@ -17661,7 +17671,7 @@ export {
17661
17671
  Ce as AssetType,
17662
17672
  Jc as BringForwardCommand,
17663
17673
  Yc as BringToBackCommand,
17664
- qc as BringToFrontCommand,
17674
+ Hc as BringToFrontCommand,
17665
17675
  yr as BundleDesignCreationCartAddMode,
17666
17676
  O as CanvasCommand,
17667
17677
  de as CollectionProduct,
@@ -17694,7 +17704,7 @@ export {
17694
17704
  Gc as LayoutElementFactory,
17695
17705
  M as LayoutElementType,
17696
17706
  J as LayoutNotFoundError,
17697
- Ht as LayoutRenderingPurpose,
17707
+ qt as LayoutRenderingPurpose,
17698
17708
  po as MaterialStepHandle,
17699
17709
  Se as MisconfigurationError,
17700
17710
  cd as MockWorkflowManager,
@@ -17716,9 +17726,9 @@ export {
17716
17726
  wo as QuestionStepHandle,
17717
17727
  Dn as QueueablePromise,
17718
17728
  jc as ResizeCommand,
17719
- qt as ResourceNotFoundError,
17729
+ Ht as ResourceNotFoundError,
17720
17730
  Wc as RotateCommand,
17721
- q as ScaleAxis,
17731
+ H as ScaleAxis,
17722
17732
  Kc as SendBackwardsCommand,
17723
17733
  yo as ShapeStepHandle,
17724
17734
  Sr as ShareActionType,
@@ -17736,7 +17746,7 @@ export {
17736
17746
  Al as TransformCollection,
17737
17747
  z as UnhandledBehaviorError,
17738
17748
  Br as UnitOfMeasurement,
17739
- Hc as UpdateImageSourceCommand,
17749
+ qc as UpdateImageSourceCommand,
17740
17750
  st as Variant,
17741
17751
  Ro as WorkflowExperienceEventType,
17742
17752
  Oo as WorkflowExperienceImpl,
@@ -17810,11 +17820,11 @@ export {
17810
17820
  N as persistenceService,
17811
17821
  jn as pictureStepService,
17812
17822
  Ic as pmsToRgb,
17813
- Hn as questionStepService,
17823
+ qn as questionStepService,
17814
17824
  Bc as registerFetchImplementation,
17815
17825
  Ec as registerWindowImplementation,
17816
17826
  Ga as rehydrateSerializedLayout,
17817
- qr as rgbToPms,
17827
+ Hr as rgbToPms,
17818
17828
  le as rotateAroundPoint,
17819
17829
  pa as sanitizeSvgTree,
17820
17830
  $r as setBearerAuthenticationToken,