@spiffcommerce/core 28.0.1-beta.29d7ea3f-e4d3-5c03-bd48-b02b5e782f5a → 28.0.1-beta.2bb92e7d-b050-5d55-9e14-866d5d3029a3

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
@@ -5327,10 +5327,10 @@ const Q = () => {
5327
5327
  viewBox: A,
5328
5328
  width: u
5329
5329
  }) => {
5330
- var E;
5331
- const h = e || 0, m = 2 * ((l == null ? void 0 : l.scale) || 1), g = A || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = Q(), C = a.purpose === Ht.FreeDesign && /* @__PURE__ */ x("defs", { children: /* @__PURE__ */ x("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ x("rect", { width: g.width, height: g.height, rx: h }) }) }), w = (E = a.colorProfiles) == null ? void 0 : E.map((b, I) => (
5330
+ var I;
5331
+ const h = e || 0, m = 2 * ((l == null ? void 0 : l.scale) || 1), g = A || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = Q(), C = a.purpose === Ht.FreeDesign && /* @__PURE__ */ x("defs", { children: /* @__PURE__ */ x("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ x("rect", { width: g.width, height: g.height, rx: h }) }) }), w = (I = a.colorProfiles) == null ? void 0 : I.map((b, E) => (
5332
5332
  /* @ts-ignore */
5333
- /* @__PURE__ */ x("color-profile", { name: b.name, xlinkHref: b.key, children: " " }, I)
5333
+ /* @__PURE__ */ x("color-profile", { name: b.name, xlinkHref: b.key, children: " " }, E)
5334
5334
  )), S = n.map((b) => ({
5335
5335
  ...b,
5336
5336
  _renderingConfiguration: a,
@@ -5577,8 +5577,8 @@ const Q = () => {
5577
5577
  /* @__PURE__ */ x("feFuncB", { type: "discrete", tableValues: n() })
5578
5578
  ] })
5579
5579
  ] }) }) }), s = r.rotation || 0, o = pt(s), l = Math.cos(o), c = -Math.sin(o), d = () => {
5580
- var w, S, y, E, b, I, D, F, k, T;
5581
- const A = ((w = r.pattern) == null ? void 0 : w.x) || 0, u = ((S = r.pattern) == null ? void 0 : S.y) || 0, h = ((y = r.pattern) == null ? void 0 : y.width) || 0, m = ((E = r.pattern) == null ? void 0 : E.height) || 0, g = ((b = r.pattern) == null ? void 0 : b.scaleX) || 1, p = ((I = r.pattern) == null ? void 0 : I.scaleY) || 1, f = ((D = r.pattern) == null ? void 0 : D.rotation) || 0;
5580
+ var w, S, y, I, b, E, D, F, k, T;
5581
+ const A = ((w = r.pattern) == null ? void 0 : w.x) || 0, u = ((S = r.pattern) == null ? void 0 : S.y) || 0, h = ((y = r.pattern) == null ? void 0 : y.width) || 0, m = ((I = r.pattern) == null ? void 0 : I.height) || 0, g = ((b = r.pattern) == null ? void 0 : b.scaleX) || 1, p = ((E = r.pattern) == null ? void 0 : E.scaleY) || 1, f = ((D = r.pattern) == null ? void 0 : D.rotation) || 0;
5582
5582
  return [(F = r.pattern) != null && F.svg ? {
5583
5583
  id: `${t}-contents`,
5584
5584
  type: M.Illustration,
@@ -5739,8 +5739,8 @@ const Ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
5739
5739
  parseInt(u.getAttribute("font-size") ?? "72")
5740
5740
  ), S = w.getBoundingBox().x2 - w.getBoundingBox().x1;
5741
5741
  let y = 0;
5742
- const E = A.getAttribute("text-anchor");
5743
- E === "middle" ? y = S / 2 : E === "end" && (y = S);
5742
+ const I = A.getAttribute("text-anchor");
5743
+ I === "middle" ? y = S / 2 : I === "end" && (y = S);
5744
5744
  const b = g.getPath(
5745
5745
  A.innerHTML,
5746
5746
  parseFloat(A.getAttribute("x") ?? "0") - y,
@@ -5748,7 +5748,7 @@ const Ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
5748
5748
  parseInt(u.getAttribute("font-size") ?? "72")
5749
5749
  );
5750
5750
  b.fill = p, b.stroke = f, b.strokeWidth = parseFloat(C ?? "0");
5751
- const I = b.toSVG(2), F = t.parseFromString(I, "image/svg+xml").firstElementChild;
5751
+ const E = b.toSVG(2), F = t.parseFromString(E, "image/svg+xml").firstElementChild;
5752
5752
  h.appendChild(F);
5753
5753
  }
5754
5754
  return e.querySelectorAll("text").forEach((d) => d.remove()), bt().serializeToString(a);
@@ -7733,7 +7733,7 @@ class Be {
7733
7733
  i && i(!0);
7734
7734
  const c = t.data.initialZoomLevel, d = await Promise.all(
7735
7735
  t.data.regions.map(async (m, g) => {
7736
- const p = await Qe(l[g]), f = o.getImageData(), C = a.map((I) => new Et(I.id)), w = f ? Ea(
7736
+ const p = await Qe(l[g]), f = o.getImageData(), C = a.map((E) => new Et(E.id)), w = f ? Ea(
7737
7737
  f,
7738
7738
  p,
7739
7739
  c && !t.data.forceImageCover ? { scale: c } : void 0,
@@ -7748,7 +7748,7 @@ class Be {
7748
7748
  scaleX: (w == null ? void 0 : w.zoom) || 1,
7749
7749
  scaleY: (w == null ? void 0 : w.zoom) || 1,
7750
7750
  rotation: 0
7751
- } : void 0, y = Q(), b = n.getLayouts().find((I) => I.panelId === m.panelId);
7751
+ } : void 0, y = Q(), b = n.getLayouts().find((E) => E.panelId === m.panelId);
7752
7752
  if (!b)
7753
7753
  throw new Y(m);
7754
7754
  return {
@@ -8042,8 +8042,8 @@ class ws {
8042
8042
  const y = {};
8043
8043
  (((S = o.assetConfiguration) == null ? void 0 : S.channelNumbers) || []).forEach((b) => {
8044
8044
  var D;
8045
- const I = C.find((F) => F.channelNumber === b.number);
8046
- I && (y[`${b.id.replace(/\W/g, "")}`] = { browserValue: ((D = I == null ? void 0 : I.variant) == null ? void 0 : D.color) || "" });
8045
+ const E = C.find((F) => F.channelNumber === b.number);
8046
+ E && (y[`${b.id.replace(/\W/g, "")}`] = { browserValue: ((D = E == null ? void 0 : E.variant) == null ? void 0 : D.color) || "" });
8047
8047
  }), await this.changeColors(
8048
8048
  t,
8049
8049
  u.map((b) => b.regionElement),
@@ -8053,20 +8053,20 @@ class ws {
8053
8053
  );
8054
8054
  }
8055
8055
  if (t.data.colorPickerEnabled) {
8056
- const y = await this.availableColors(t, i) || [], E = Object.keys(c.colors), b = y.length === 1 && E.length === 1;
8056
+ const y = await this.availableColors(t, i) || [], I = Object.keys(c.colors), b = y.length === 1 && I.length === 1;
8057
8057
  if (b) {
8058
- const I = y[0], D = E[0];
8058
+ const E = y[0], D = I[0];
8059
8059
  await this.changeColors(
8060
8060
  t,
8061
8061
  u.map((F) => F.regionElement),
8062
8062
  i,
8063
8063
  () => i.getCommandContext().getAllLayouts(),
8064
- /* @__PURE__ */ new Map([[D, I.variant.color]])
8064
+ /* @__PURE__ */ new Map([[D, E.variant.color]])
8065
8065
  );
8066
8066
  }
8067
8067
  !b && C.length === 0 && await this.changeColors(
8068
8068
  t,
8069
- u.map((I) => I.regionElement),
8069
+ u.map((E) => E.regionElement),
8070
8070
  i,
8071
8071
  () => i.getCommandContext().getAllLayouts(),
8072
8072
  /* @__PURE__ */ new Map()
@@ -8814,7 +8814,7 @@ class Fs {
8814
8814
  if (p && t.globalPropertyAspectConfigurations) {
8815
8815
  const C = (s = p.getGlobalPropertyConfiguration()) == null ? void 0 : s.aspects, w = C == null ? void 0 : C.find((S) => {
8816
8816
  var y;
8817
- return S.type === z.Text && ((y = t.globalPropertyAspectConfigurations) == null ? void 0 : y.map((E) => E.aspectName).includes(S.name));
8817
+ return S.type === z.Text && ((y = t.globalPropertyAspectConfigurations) == null ? void 0 : y.map((I) => I.aspectName).includes(S.name));
8818
8818
  });
8819
8819
  if (w) {
8820
8820
  const y = p.getGlobalPropertyStateManager().getAspect(w.name);
@@ -9056,13 +9056,13 @@ class Fs {
9056
9056
  let w = (A = n.storage) == null ? void 0 : A.text;
9057
9057
  const S = e.getWorkflowExperience().getBundle();
9058
9058
  if (S && t.globalPropertyAspectConfigurations) {
9059
- const y = (u = S.getGlobalPropertyConfiguration()) == null ? void 0 : u.aspects, E = y == null ? void 0 : y.find((b) => {
9060
- var I;
9061
- return b.type === z.Text && ((I = t.globalPropertyAspectConfigurations) == null ? void 0 : I.map((D) => D.aspectName).includes(b.name));
9059
+ const y = (u = S.getGlobalPropertyConfiguration()) == null ? void 0 : u.aspects, I = y == null ? void 0 : y.find((b) => {
9060
+ var E;
9061
+ return b.type === z.Text && ((E = t.globalPropertyAspectConfigurations) == null ? void 0 : E.map((D) => D.aspectName).includes(b.name));
9062
9062
  });
9063
- if (E) {
9064
- const I = S.getGlobalPropertyStateManager().getAspect(E.name);
9065
- I && (w = I);
9063
+ if (I) {
9064
+ const E = S.getGlobalPropertyStateManager().getAspect(I.name);
9065
+ E && (w = E);
9066
9066
  }
9067
9067
  }
9068
9068
  if (await e.setSelectionsAndElements(
@@ -9071,13 +9071,13 @@ class Fs {
9071
9071
  f,
9072
9072
  async () => {
9073
9073
  e.updateMetadata(t.stepName, { color: C, text: w }), e.updateStorage(t.stepName, { text: w, inputText: w });
9074
- const y = o.map((b) => new Wa(b.id, p)), E = new $(y);
9075
- e.getCommandDispatcher()(E);
9074
+ const y = o.map((b) => new Wa(b.id, p)), I = new $(y);
9075
+ e.getCommandDispatcher()(I);
9076
9076
  }
9077
9077
  ), o.length === 0 && l) {
9078
9078
  const y = q.getDefaultVariant(l);
9079
9079
  if (y) {
9080
- const E = await this.selectVariantCommand(
9080
+ const I = await this.selectVariantCommand(
9081
9081
  t,
9082
9082
  y,
9083
9083
  { text: w },
@@ -9088,7 +9088,7 @@ class Fs {
9088
9088
  () => {
9089
9089
  }
9090
9090
  );
9091
- e.getCommandDispatcher()(E.command);
9091
+ e.getCommandDispatcher()(I.command);
9092
9092
  }
9093
9093
  } else {
9094
9094
  const { command: y } = j.updateInputText(
@@ -9298,10 +9298,10 @@ class Fs {
9298
9298
  curved: a.curved,
9299
9299
  paths: a.paths,
9300
9300
  fillSpotColorDefinition: f
9301
- }, y = [], E = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
9301
+ }, y = [], I = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
9302
9302
  if (!S.fontData)
9303
9303
  throw new G("Failed to resolve font data for text.");
9304
- const [I, D] = pe(
9304
+ const [E, D] = pe(
9305
9305
  S.fontSize,
9306
9306
  S.fontData,
9307
9307
  {
@@ -9315,11 +9315,11 @@ class Fs {
9315
9315
  [l],
9316
9316
  { size: a.size, minSize: a.minSize, maxSize: a.maxSize }
9317
9317
  );
9318
- E.set(S.id, I), b.set(S.id, D);
9318
+ I.set(S.id, E), b.set(S.id, D);
9319
9319
  const F = a.curved || a.vertical ? l : (D || []).join(`
9320
9320
  `);
9321
9321
  y.push(
9322
- this.generateTextChangeCommandsForRegion(I, a, S.id, F)
9322
+ this.generateTextChangeCommandsForRegion(E, a, S.id, F)
9323
9323
  );
9324
9324
  const k = new W(S, h);
9325
9325
  return {
@@ -9362,23 +9362,23 @@ class Fs {
9362
9362
  const A = (n || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = this.getProcessedInput(A, t.data, o), h = s.getRegionElements(t.stepName), m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
9363
9363
  for (const S of h)
9364
9364
  if (S.region) {
9365
- const [y, E] = pe(
9365
+ const [y, I] = pe(
9366
9366
  e,
9367
9367
  a,
9368
9368
  S.region,
9369
9369
  [u],
9370
9370
  { size: t.data.size, minSize: t.data.minSize, maxSize: t.data.maxSize }
9371
9371
  );
9372
- m.set(S.id, y), g.set(S.id, E);
9372
+ m.set(S.id, y), g.set(S.id, I);
9373
9373
  }
9374
9374
  const f = (() => {
9375
9375
  if (t.data && t.data.maxLength && u.length > t.data.maxLength)
9376
9376
  return d && d(!0), { info: "0" };
9377
9377
  const S = s.getProfanities(), y = Ze(u.toLowerCase());
9378
- for (const E of y)
9378
+ for (const I of y)
9379
9379
  for (const b in S) {
9380
- const I = S[b].toLowerCase().replace(/\s/g, "");
9381
- if (E === I)
9380
+ const E = S[b].toLowerCase().replace(/\s/g, "");
9381
+ if (I === E)
9382
9382
  return l(!0), { error: "Blocked profanity." };
9383
9383
  }
9384
9384
  return !t.data.vertical && !t.data.allowNewlines && (u.includes(`
@@ -9572,12 +9572,12 @@ class $s extends xs {
9572
9572
  w.appendChild(S), S.appendChild(Ts(0, 2, 2, "shadow"));
9573
9573
  const y = et("path");
9574
9574
  y.setAttribute("d", d), y.setAttribute("stroke", "black"), y.setAttribute("stroke-width", "3"), S.appendChild(y);
9575
- const E = et("g");
9576
- E.classList.add("module-layer0"), w.appendChild(E), E.setAttribute("filter", "url(#shadow)"), E.innerHTML = y.outerHTML;
9575
+ const I = et("g");
9576
+ I.classList.add("module-layer0"), w.appendChild(I), I.setAttribute("filter", "url(#shadow)"), I.innerHTML = y.outerHTML;
9577
9577
  const b = et("g");
9578
9578
  b.classList.add("module-layer1"), w.appendChild(b), b.setAttribute("stroke-width", "3"), b.setAttribute("stroke", "rgb(45,41,38)"), b.setAttribute("fill", "rgb(45,41,38)"), b.setAttribute("transform", "translate(0.5,0)"), b.innerHTML = o;
9579
- const I = et("g");
9580
- I.classList.add("module-layer2"), w.appendChild(I), I.setAttribute("fill", "rgb(255,209,0)"), I.setAttribute("transform", "translate(1,-0.1)"), I.innerHTML = o;
9579
+ const E = et("g");
9580
+ E.classList.add("module-layer2"), w.appendChild(E), E.setAttribute("fill", "rgb(255,209,0)"), E.setAttribute("transform", "translate(1,-0.1)"), E.innerHTML = o;
9581
9581
  const D = et("g");
9582
9582
  return D.classList.add("module-layer3"), w.appendChild(D), D.setAttribute("fill", "white"), D.innerHTML = o, new Os(w).transform(([k, T]) => [k, T + (c / 2 - k) ** 2 / (c * 6)]), w;
9583
9583
  }, u = et("g");
@@ -10290,10 +10290,10 @@ class Co {
10290
10290
  constructor(t, e, a, n, i, s, o, l, c, d, A, u, h, m = !1, g, p = !1, f = !1, C = !1) {
10291
10291
  var w;
10292
10292
  this.workflowStatePromiseQueue = new xn(1), this.initialized = !1, this.readOnly = !1, this.isReloadedTransaction = !1, this.singleVariantsRenderable = !1, this.stepTags = {}, this.renderLayouts = () => {
10293
- var E;
10293
+ var I;
10294
10294
  if (!this.previewService)
10295
10295
  return;
10296
- const S = this.getCommandContext().getAllLayouts(), y = (E = this.getLayoutPreviewService()) == null ? void 0 : E.getAll();
10296
+ const S = this.getCommandContext().getAllLayouts(), y = (I = this.getLayoutPreviewService()) == null ? void 0 : I.getAll();
10297
10297
  if (y)
10298
10298
  for (const [, b] of y)
10299
10299
  b.render(S);
@@ -10403,7 +10403,7 @@ class Co {
10403
10403
  this.storage[o.stepName] = o.storage || {};
10404
10404
  }), this.allScenes = await zi(t);
10405
10405
  const n = Pt(this.allScenes, this.stepSelections).map((o) => o.silentSteps).flat(), { stepElements: i, commands: s } = await this.stepElementsForIntroducedSilentSteps(n, !!this.reloadedState);
10406
- this.commandContext.apply(new $(s), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
10406
+ this.commandContext.apply(new $(s), !0), this.stepElements = { ...this.stepElements, ...i }, !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
10407
10407
  }
10408
10408
  getWorkflowExperience() {
10409
10409
  return this.experience;
@@ -10851,26 +10851,27 @@ class Co {
10851
10851
  });
10852
10852
  }
10853
10853
  async reset() {
10854
- this.commandContext.getAllLayouts().forEach(
10854
+ console.log("LOG: reset?"), this.commandContext.getAllLayouts().forEach(
10855
10855
  (e) => e.layoutState.elements.forEach((a) => {
10856
10856
  this.getCommandDispatcher()(new Et(a.id));
10857
10857
  })
10858
10858
  ), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
10859
10859
  }
10860
10860
  async setSelectionsAndElements(t, e, a, n) {
10861
- var y;
10861
+ var y, I, b;
10862
+ console.log(`LOG: set selection of step ${t} to variant ${(y = e == null ? void 0 : e[0]) == null ? void 0 : y.name} (${(I = e == null ? void 0 : e[0]) == null ? void 0 : I.id})`), console.trace();
10862
10863
  const i = this.stepSelections;
10863
10864
  this.stepSelections = {
10864
10865
  ...this.stepSelections,
10865
10866
  [t]: { selectedVariants: e }
10866
- }, this.selectionCost = Object.values(this.stepSelections).reduce((E, b) => E + b.selectedVariants.map((I) => I.priceModifier || 0).reduce((I, D) => I + D, 0), 0), this.workflow.steps.forEach((E) => {
10867
- wt(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1, delete this.stepMetadata[E.stepName], delete this.stepSelections[E.stepName], delete this.storage[E.stepName]);
10867
+ }, this.selectionCost = Object.values(this.stepSelections).reduce((E, D) => E + D.selectedVariants.map((F) => F.priceModifier || 0).reduce((F, k) => F + k, 0), 0), this.workflow.steps.forEach((E) => {
10868
+ wt(E, this.stepSelections) || (console.log(`LOG: uniniting step ${E.stepTitle} (${E.stepName})`), this.stepInitialised[E.stepName] = !1, delete this.stepMetadata[E.stepName], delete this.stepSelections[E.stepName], delete this.storage[E.stepName]);
10868
10869
  });
10869
10870
  const s = this.allScenes, o = Pt(s, i), l = Pt(s, this.stepSelections), c = o.map((E) => E.silentSteps).flat(), A = l.map((E) => E.silentSteps).flat().filter(
10870
- (E) => !c.some((b) => b.stepName === E.stepName)
10871
+ (E) => !c.some((D) => D.stepName === E.stepName)
10871
10872
  );
10872
10873
  c.forEach((E) => {
10873
- wt(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1);
10874
+ wt(E, this.stepSelections) || (console.log(`LOG: uniniting silent step ${E.stepTitle} (${E.stepName})`), this.stepInitialised[E.stepName] = !1);
10874
10875
  });
10875
10876
  const u = this.getInvalidCanvasRegions(), { stepElements: h, commands: m } = await this.stepElementsForIntroducedSilentSteps(A, !1);
10876
10877
  this.stepElements = {
@@ -10880,16 +10881,16 @@ class Co {
10880
10881
  }, this.removeElements(u);
10881
10882
  const g = this.workflow.steps.find((E) => E.stepName === t);
10882
10883
  if ((g == null ? void 0 : g.type) === P.Frame) {
10883
- const E = (y = this.getWorkflowExperience().getStepById(g.stepName)) == null ? void 0 : y.frameService;
10884
- E == null || E.setTargetElements(a.map((b) => b.id));
10884
+ const E = (b = this.getWorkflowExperience().getStepById(g.stepName)) == null ? void 0 : b.frameService;
10885
+ E == null || E.setTargetElements(a.map((D) => D.id));
10885
10886
  }
10886
10887
  const p = u.map((E) => new Et(E.id)), f = new Ga(this.constructSerializableWorkflow()), C = [...m, ...p, f];
10887
10888
  C.length > 0 && this.commandContext.apply(new $(C), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
10888
10889
  const w = this.getInvalidModelVariants(), S = this.modelContainer;
10889
10890
  if (S) {
10890
10891
  const E = w.map(
10891
- (b) => S.applyModelVariant(
10892
- b,
10892
+ (D) => S.applyModelVariant(
10893
+ D,
10893
10894
  {
10894
10895
  contextService: this.getLayoutPreviewService()
10895
10896
  },
@@ -10901,10 +10902,11 @@ class Co {
10901
10902
  await this.onSelectionChange(), n && await n();
10902
10903
  }
10903
10904
  async ensureStepsAreLoaded() {
10905
+ console.log("LOG: ensure steps loaded");
10904
10906
  const e = Pt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
10905
10907
  for (const l of n)
10906
10908
  if (!this.stepInitialised[l.stepName])
10907
- switch (this.stepInitialised[l.stepName] = !0, l.type) {
10909
+ switch (console.log(`LOG: step ${l.stepTitle} (${l.stepName}) was not inited`), this.stepInitialised[l.stepName] = !0, l.type) {
10908
10910
  case P.DigitalContent:
10909
10911
  a.push(
10910
10912
  zn.init(
@@ -11468,7 +11470,7 @@ class Bo extends it {
11468
11470
  */
11469
11471
  async setFillColor(t) {
11470
11472
  const e = this.manager.getRegionElements(this.step.stepName);
11471
- await j.changeFillColor(this.step, t, e, this.manager);
11473
+ console.log(`LOG: changing fill color of step ${this.step.stepTitle} (${this.step.stepName}) with ${e.length} elements to ${t}`), await j.changeFillColor(this.step, t, e, this.manager);
11472
11474
  }
11473
11475
  /**
11474
11476
  * Gets the color currently applied to the element.
@@ -11516,7 +11518,6 @@ class Bo extends it {
11516
11518
  */
11517
11519
  setText(t) {
11518
11520
  var d;
11519
- console.log("LOG: attempting to set text in handle"), console.trace();
11520
11521
  const e = {
11521
11522
  input: t,
11522
11523
  helperData: {}
@@ -11965,7 +11966,7 @@ const ko = async (r, t) => {
11965
11966
  };
11966
11967
  return i && (h.metadata = i), a && (h.selectedVariants = a), n && (h.sku = n), h;
11967
11968
  }, Xn = async (r, t, e, a, n, i, s, o, l, c) => {
11968
- var I;
11969
+ var E;
11969
11970
  await (async () => {
11970
11971
  var R;
11971
11972
  if (c !== void 0)
@@ -11984,7 +11985,7 @@ const ko = async (r, t) => {
11984
11985
  T.errors && console.log("Server Error:", tt.message);
11985
11986
  }), null) : nt ?? null;
11986
11987
  })() || (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(a())), await r.updateStateWithServerImmediate(a), console.log("Server state is undefined @ Workflow completion"));
11987
- const u = r.getPreviewService(), h = (I = t == null ? void 0 : t.finalizeStepConfig) == null ? void 0 : I.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h, g = l && ca(l, t, !0), p = l && ca(l, t, !1), f = async (D) => {
11988
+ const u = r.getPreviewService(), h = (E = t == null ? void 0 : t.finalizeStepConfig) == null ? void 0 : E.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h, g = l && ca(l, t, !0), p = l && ca(l, t, !1), f = async (D) => {
11988
11989
  const F = {};
11989
11990
  let k = 0;
11990
11991
  if (Object.keys(i).length > 0)
@@ -12018,10 +12019,10 @@ const ko = async (r, t) => {
12018
12019
  S[D].map((F) => F.id)
12019
12020
  ])
12020
12021
  );
12021
- let E = await o(m, n.id);
12022
- if (E) {
12023
- const D = await (await rt(E)).blob();
12024
- E = (await U.uploadAsset(
12022
+ let I = await o(m, n.id);
12023
+ if (I) {
12024
+ const D = await (await rt(I)).blob();
12025
+ I = (await U.uploadAsset(
12025
12026
  { name: `${n.id}-preview-image.png`, blob: D },
12026
12027
  Ce.Image,
12027
12028
  !0,
@@ -12039,7 +12040,7 @@ const ko = async (r, t) => {
12039
12040
  workflowId: t.id,
12040
12041
  transactionId: n.id,
12041
12042
  useThreeDimPreview: !!m,
12042
- previewImage: E
12043
+ previewImage: I
12043
12044
  };
12044
12045
  if (p) {
12045
12046
  const F = [];
@@ -12775,7 +12776,7 @@ const zo = [
12775
12776
  return console.error(o), [];
12776
12777
  }
12777
12778
  }, jo = async (r, t, e, a) => {
12778
- var y, E;
12779
+ var y, I;
12779
12780
  const n = e.data, i = a.option;
12780
12781
  if (!i)
12781
12782
  return console.error(`No option for step ${a.stepName}.`), [];
@@ -12785,7 +12786,7 @@ const zo = [
12785
12786
  if (!s.asset)
12786
12787
  return console.error(`No asset for variant with ID: ${n.illustrationVariantId}`), [];
12787
12788
  t[a.stepName] = { selectedVariants: [s] };
12788
- const o = (E = s.asset) == null ? void 0 : E.fileLink;
12789
+ const o = (I = s.asset) == null ? void 0 : I.fileLink;
12789
12790
  if (!o)
12790
12791
  return console.error(`No asset link for variant with ID: ${n.illustrationVariantId}`), [];
12791
12792
  const l = await at(o, !0), c = /<svg.*?<\/svg>/s, d = l.match(c) || [], A = (d == null ? void 0 : d.length) > 0 ? d[0] : "", m = dt().parseFromString(A, "image/svg+xml").firstElementChild;
@@ -12795,9 +12796,9 @@ const zo = [
12795
12796
  const g = {};
12796
12797
  xt(m, (b) => {
12797
12798
  zo.includes(b.tagName) && !b.attributes.getNamedItem("fill") && b.setAttribute("fill", "#000000");
12798
- const I = b.attributes.getNamedItem("fill");
12799
- if (I && I.value !== "none") {
12800
- const F = I.value, T = `spiff-fill-${F.replace(/\W/g, "")}`;
12799
+ const E = b.attributes.getNamedItem("fill");
12800
+ if (E && E.value !== "none") {
12801
+ const F = E.value, T = `spiff-fill-${F.replace(/\W/g, "")}`;
12801
12802
  b.classList.add(T), g[T] = { browserValue: F };
12802
12803
  }
12803
12804
  const D = b.attributes.getNamedItem("stroke");
@@ -12808,16 +12809,16 @@ const zo = [
12808
12809
  });
12809
12810
  const f = bt().serializeToString(m), C = n.colors;
12810
12811
  if (C) {
12811
- for (const [b, I] of Object.entries(g))
12812
+ for (const [b, E] of Object.entries(g))
12812
12813
  for (const D of Object.keys(C))
12813
- if (I.browserValue === D) {
12814
+ if (E.browserValue === D) {
12814
12815
  g[b] = { browserValue: C[D] };
12815
12816
  break;
12816
12817
  }
12817
12818
  }
12818
12819
  const w = (b) => {
12819
- const I = r.find((F) => F.panelId === b.panelId);
12820
- if (!I)
12820
+ const E = r.find((F) => F.panelId === b.panelId);
12821
+ if (!E)
12821
12822
  throw new Y(b);
12822
12823
  const D = Q();
12823
12824
  return new W(
@@ -12835,7 +12836,7 @@ const zo = [
12835
12836
  layerIndex: b.layerIndex,
12836
12837
  immutable: b.immutable
12837
12838
  },
12838
- I
12839
+ E
12839
12840
  );
12840
12841
  }, S = a.data.regions;
12841
12842
  try {
@@ -13493,17 +13494,15 @@ class Ia {
13493
13494
  * @param targetExperiences Optionally filter the steps to only those in the given experiences.
13494
13495
  */
13495
13496
  getSharedSteps(t) {
13496
- return (t ?? this.bundle.getWorkflowExperiences()).flatMap(
13497
- (n) => n.getStepsConditionallyActive().filter((i) => {
13498
- var s;
13499
- return i.getOverrideGlobalPropertyConfiguration(this.property.type) ? !1 : (s = i.getRaw().globalPropertyAspectConfigurations) == null ? void 0 : s.some(
13500
- (o) => {
13501
- var l, c;
13502
- return o.globalPropertyConfigurationId === ((c = (l = this.bundle.getProductCollection()) == null ? void 0 : l.getResource().globalPropertyConfiguration) == null ? void 0 : c.id) && o.aspectName === this.property.name;
13503
- }
13504
- );
13505
- })
13506
- );
13497
+ return (t ?? this.bundle.getWorkflowExperiences()).flatMap((n) => n.getSteps().filter((s) => {
13498
+ var o;
13499
+ return s.getOverrideGlobalPropertyConfiguration(this.property.type) ? !1 : (o = s.getRaw().globalPropertyAspectConfigurations) == null ? void 0 : o.some(
13500
+ (l) => {
13501
+ var c, d;
13502
+ return l.globalPropertyConfigurationId === ((d = (c = this.bundle.getProductCollection()) == null ? void 0 : c.getResource().globalPropertyConfiguration) == null ? void 0 : d.id) && l.aspectName === this.property.name;
13503
+ }
13504
+ );
13505
+ }));
13507
13506
  }
13508
13507
  getStateValue() {
13509
13508
  return this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);
@@ -13788,14 +13787,13 @@ class Zn extends Ia {
13788
13787
  */
13789
13788
  async initDefaultVariant() {
13790
13789
  var e, a;
13791
- console.log(`LOG: attempting to init default variant for property ${this.property.name}`);
13792
13790
  const t = (a = (e = this.optionResource) == null ? void 0 : e.variants) == null ? void 0 : a.find(
13793
13791
  (n) => {
13794
13792
  var i, s;
13795
13793
  return n.id === ((s = (i = this.optionResource) == null ? void 0 : i.defaultVariant) == null ? void 0 : s.id);
13796
13794
  }
13797
13795
  );
13798
- t && (console.log("LOG: found one"), await this.selectVariant(new st(t)));
13796
+ t && await this.selectVariant(new st(t));
13799
13797
  }
13800
13798
  /**
13801
13799
  * Gets the currently selected variant, or undefined if no variant is selected.
@@ -13837,7 +13835,7 @@ class Zn extends Ia {
13837
13835
  * @param variant The variant to select.
13838
13836
  */
13839
13837
  async selectVariant(t, e) {
13840
- console.log(`LOG: selecting variant ${t.getName()} (${t.getId()}) for property ${this.property.name}`), console.trace(), await Promise.all([
13838
+ await Promise.all([
13841
13839
  this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name, t.getId(), void 0, e),
13842
13840
  this.applyVariantSelection(t)
13843
13841
  ]);
@@ -13864,13 +13862,14 @@ class Ja extends Zn {
13864
13862
  * @param variant The variant to select.
13865
13863
  */
13866
13864
  async selectVariant(t, e) {
13867
- console.log(`LOG: selecting color variant ${t.getName()} (${t.getId()}) for property ${this.property.name}`), console.trace(), await Promise.all([
13865
+ await Promise.all([
13868
13866
  this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name, t.getId(), void 0, e),
13869
13867
  this.applyColorVariant(t, void 0, e)
13870
13868
  ]);
13871
13869
  }
13872
13870
  async applyGlobalState(t) {
13873
13871
  var i, s, o;
13872
+ console.log(`LOG: applying global state for color ${this.property.name}`);
13874
13873
  const e = this.getStateValue();
13875
13874
  if (!e)
13876
13875
  return Promise.resolve();
@@ -13879,11 +13878,13 @@ class Ja extends Zn {
13879
13878
  return Promise.resolve();
13880
13879
  await this.applyColorVariant(new st(a), t);
13881
13880
  const n = (o = this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)) == null ? void 0 : o.customColor;
13882
- n && this.setCustomColor(n);
13881
+ console.log(`LOG: end of apply global state for color ${this.property.name}`), n && this.setCustomColor(n);
13883
13882
  }
13884
13883
  async applyColorVariant(t, e, a) {
13885
- const i = this.getSharedSteps(e).map((s) => {
13886
- switch (s.getType()) {
13884
+ const n = this.getSharedSteps(e);
13885
+ console.log(`LOG: applying color variant ${t.getName()} for ${n.length} shared steps`);
13886
+ const i = n.map((s) => {
13887
+ switch (console.log(`LOG: applying to step type ${s.getType()}`), s.getType()) {
13887
13888
  case P.Shape:
13888
13889
  return s.selectVariant(t);
13889
13890
  case P.Text:
@@ -15994,7 +15995,7 @@ class Ad {
15994
15995
  } catch (a) {
15995
15996
  throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
15996
15997
  }
15997
- }, this.options = t, this.options.applicationKey && $r(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 28.0.1-beta.f5df4b3f-ec7b-542e-84ca-48ed7f2a1458"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15998
+ }, this.options = t, this.options.applicationKey && $r(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 28.0.1-beta.bfc4858f-0e0f-569a-aec4-7fcae31d702c"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15998
15999
  }
15999
16000
  configure(t) {
16000
16001
  mt.setHubUrl(t.hubUrl), mt.setServerUrl(t.serverUrl), mt.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 && Lr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
@@ -16103,7 +16104,7 @@ class Ad {
16103
16104
  const C = ((h = (u = this.customer) == null ? void 0 : u.bundleStakeholders) == null ? void 0 : h.find(
16104
16105
  (w) => {
16105
16106
  var S, y;
16106
- return (y = (S = w.bundle) == null ? void 0 : S.transactions) == null ? void 0 : y.some((E) => E.id === t);
16107
+ return (y = (S = w.bundle) == null ? void 0 : S.transactions) == null ? void 0 : y.some((I) => I.id === t);
16107
16108
  }
16108
16109
  )) || ((g = (m = this.customer) == null ? void 0 : m.stakeholders) == null ? void 0 : g.find(
16109
16110
  (w) => {
@@ -16330,11 +16331,11 @@ class Ad {
16330
16331
  * @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
16331
16332
  */
16332
16333
  async getExistingBundle(t, e, a, n) {
16333
- var h, m, g, p, f, C, w, S, y, E, b;
16334
+ var h, m, g, p, f, C, w, S, y, I, b;
16334
16335
  const i = N.getMap("bundleOwnerIds"), s = i == null ? void 0 : i.get(t), o = {};
16335
16336
  try {
16336
- const I = await this.loggedInBearerToken();
16337
- o.Authorization = `Bearer ${I}`;
16337
+ const E = await this.loggedInBearerToken();
16338
+ o.Authorization = `Bearer ${E}`;
16338
16339
  } catch {
16339
16340
  const F = ((h = Object.entries(localStorage).find(([T, nt]) => T.startsWith("CognitoIdentityServiceProvider") && T.endsWith("idToken"))) == null ? void 0 : h[0]) || "", k = localStorage.getItem(F);
16340
16341
  k && !Wt(k) && (o.Authorization = `Bearer ${k}`);
@@ -16359,7 +16360,7 @@ class Ad {
16359
16360
  A.set(d.id, d.partner.id), N.setMap("bundlePartnerIds", A);
16360
16361
  const u = new Je(this, d, e, a, s, {
16361
16362
  additionalHeaders: (y = n == null ? void 0 : n.graphql) == null ? void 0 : y.additionalHeaders,
16362
- eagerFetchProducts: (b = (E = n == null ? void 0 : n.graphql) == null ? void 0 : E.productCollection) == null ? void 0 : b.eagerFetchProducts,
16363
+ eagerFetchProducts: (b = (I = n == null ? void 0 : n.graphql) == null ? void 0 : I.productCollection) == null ? void 0 : b.eagerFetchProducts,
16363
16364
  existingGlobalPropertyState: c.data.globalPropertyState,
16364
16365
  readonly: n == null ? void 0 : n.readonly
16365
16366
  });
@@ -16378,7 +16379,7 @@ class Ad {
16378
16379
  const C = await this.loggedInBearerToken();
16379
16380
  s.Authorization = `Bearer ${C}`;
16380
16381
  } catch {
16381
- const S = ((h = Object.entries(localStorage).find(([E, b]) => E.startsWith("CognitoIdentityServiceProvider") && E.endsWith("idToken"))) == null ? void 0 : h[0]) || "", y = localStorage.getItem(S);
16382
+ const S = ((h = Object.entries(localStorage).find(([I, b]) => I.startsWith("CognitoIdentityServiceProvider") && I.endsWith("idToken"))) == null ? void 0 : h[0]) || "", y = localStorage.getItem(S);
16382
16383
  y && !Wt(y) && (s.Authorization = `Bearer ${y}`);
16383
16384
  }
16384
16385
  const o = {
@@ -16485,19 +16486,19 @@ class Ad {
16485
16486
  var D, F, k;
16486
16487
  if (y.length === 0)
16487
16488
  return [];
16488
- const E = y.map((T) => T.option.transactionId), b = await a.query({
16489
+ const I = y.map((T) => T.option.transactionId), b = await a.query({
16489
16490
  query: yi,
16490
16491
  variables: {
16491
- ids: E
16492
+ ids: I
16492
16493
  },
16493
16494
  errorPolicy: "all",
16494
16495
  fetchPolicy: "no-cache"
16495
- }), I = b.data.transactions;
16496
- if (I.length !== y.length) {
16496
+ }), E = b.data.transactions;
16497
+ if (E.length !== y.length) {
16497
16498
  const T = ((F = (D = b.errors) == null ? void 0 : D[0]) == null ? void 0 : F.message) || "Unknown error";
16498
16499
  throw new ut(`Not all transactions were found: ${T}`);
16499
16500
  }
16500
- return !this.activeIntegration && ((k = I[0].integrationProduct) != null && k.integration) && (this.activeIntegration = Promise.resolve(I[0].integrationProduct.integration)), I.map((T, nt) => {
16501
+ return !this.activeIntegration && ((k = E[0].integrationProduct) != null && k.integration) && (this.activeIntegration = Promise.resolve(E[0].integrationProduct.integration)), E.map((T, nt) => {
16501
16502
  var R;
16502
16503
  return {
16503
16504
  transaction: T,
@@ -16507,10 +16508,10 @@ class Ad {
16507
16508
  };
16508
16509
  });
16509
16510
  }, i = async (y) => {
16510
- var I, D, F;
16511
+ var E, D, F;
16511
16512
  if (y.length === 0)
16512
16513
  return [];
16513
- const E = await a.mutate({
16514
+ const I = await a.mutate({
16514
16515
  mutation: wi,
16515
16516
  variables: {
16516
16517
  inputs: y.map((k) => ({
@@ -16526,9 +16527,9 @@ class Ad {
16526
16527
  },
16527
16528
  errorPolicy: "all",
16528
16529
  fetchPolicy: "no-cache"
16529
- }), b = (I = E.data) == null ? void 0 : I.transactionCreateMany;
16530
+ }), b = (E = I.data) == null ? void 0 : E.transactionCreateMany;
16530
16531
  if (!b || b.length === 0) {
16531
- const k = ((F = (D = E.errors) == null ? void 0 : D[0]) == null ? void 0 : F.message) || "Unknown error";
16532
+ const k = ((F = (D = I.errors) == null ? void 0 : D[0]) == null ? void 0 : F.message) || "Unknown error";
16532
16533
  throw new ut(`Failed to create transactions: ${k}`);
16533
16534
  }
16534
16535
  return b.map((k, T) => ({
@@ -16537,35 +16538,35 @@ class Ad {
16537
16538
  readOnly: !1,
16538
16539
  index: y[T].index
16539
16540
  }));
16540
- }, s = t.map((y, E) => ({ option: y, index: E })), o = s.filter((y) => y.option.type === "transaction"), l = s.filter(
16541
+ }, s = t.map((y, I) => ({ option: y, index: I })), o = s.filter((y) => y.option.type === "transaction"), l = s.filter(
16541
16542
  (y) => y.option.type === "integration" || y.option.type === "external"
16542
16543
  ), c = xa(o, 10), d = xa(l, 10), A = (await Promise.all([
16543
16544
  ...c.map(n),
16544
16545
  ...d.map(i)
16545
16546
  ])).flat(), u = [...new Set(A.map((y) => y.workflowId))], h = await ar(u, e), m = new Map(h.map((y) => [y.id, y])), g = N.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), p = A.map(async (y) => {
16546
16547
  var tt;
16547
- const { transaction: E, workflowId: b, readOnly: I, index: D } = y, F = m.get(b), k = t[D];
16548
- !g.get(E.id) && E.transactionOwnerId && g.set(E.id, E.transactionOwnerId);
16549
- const T = g.get(E.id) || void 0, nt = new Fl({
16548
+ const { transaction: I, workflowId: b, readOnly: E, index: D } = y, F = m.get(b), k = t[D];
16549
+ !g.get(I.id) && I.transactionOwnerId && g.set(I.id, I.transactionOwnerId);
16550
+ const T = g.get(I.id) || void 0, nt = new Fl({
16550
16551
  onMutate: () => ({ context: { transactionOwnerId: T, bundleOwnerId: e == null ? void 0 : e.bundleOwnerId } }),
16551
16552
  onQuery: () => ({ context: { transactionOwnerId: T, bundleOwnerId: e == null ? void 0 : e.bundleOwnerId } })
16552
16553
  }), R = {
16553
- product: E.product,
16554
- transaction: E,
16554
+ product: I.product,
16555
+ transaction: I,
16555
16556
  layouts: [],
16556
16557
  singleVariantsRenderable: (tt = k == null ? void 0 : k.workflowConfiguration) == null ? void 0 : tt.singleVariantsRenderable,
16557
- stateMutationFunc: I ? async () => {
16558
+ stateMutationFunc: E ? async () => {
16558
16559
  throw new G("State mutation is forbidden in read only mode!");
16559
- } : async (Z) => this.updateTransactionState({
16560
+ } : async (Z) => (console.log("LOG: updating transaction"), this.updateTransactionState({
16560
16561
  ...Z,
16561
16562
  context: { transactionOwnerId: T, bundleOwnerId: e == null ? void 0 : e.bundleOwnerId }
16562
- }),
16563
+ })),
16563
16564
  graphQlClient: () => nt,
16564
- readOnly: I,
16565
+ readOnly: E,
16565
16566
  workflow: F,
16566
16567
  isReloadedTransaction: k.type === "transaction"
16567
16568
  };
16568
- if (!I && k.workflowState) {
16569
+ if (!E && k.workflowState) {
16569
16570
  const Z = JSON.parse(k.workflowState);
16570
16571
  R.layouts = Object.values(Z.layouts || {}).map((Nt) => Nt.layout), await cs(Z), R.reloadedState = Z;
16571
16572
  } else
@@ -16578,9 +16579,9 @@ class Ad {
16578
16579
  ), R.delayWorkflowStateSync = !0, { experienceOptions: R, index: D, options: k };
16579
16580
  }), f = await Promise.all(p);
16580
16581
  N.setMap("transactionOwnerIds", g);
16581
- const w = f.sort((y, E) => y.index - E.index).map(async (y) => {
16582
- const { experienceOptions: E, options: b } = y, I = new Vo(this, E);
16583
- return await I.getWorkflowManager().getInitializationPromise(), b.type !== "transaction" && this.customer && await I.attachCustomerDetails({ email: this.customer.emailAddress }), I;
16582
+ const w = f.sort((y, I) => y.index - I.index).map(async (y) => {
16583
+ const { experienceOptions: I, options: b } = y, E = new Vo(this, I);
16584
+ return await E.getWorkflowManager().getInitializationPromise(), b.type !== "transaction" && this.customer && await E.attachCustomerDetails({ email: this.customer.emailAddress }), E;
16584
16585
  }), S = await Promise.all(w);
16585
16586
  return S.forEach((y) => y.getWorkflowManager().setWorkflowStateSyncEnabled(!0)), S;
16586
16587
  }