@spiffcommerce/core 18.0.1 → 18.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2357,7 +2357,7 @@ declare class IllustrationStepService implements StepService<IllustrationStepDat
2357
2357
  };
2358
2358
  init(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2359
2359
  private reload;
2360
- availableColors(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager): Promise<{
2360
+ availableColors(stepData: Step<IllustrationStepData>, _workflowManager: WorkflowManager): Promise<{
2361
2361
  fill: string | undefined;
2362
2362
  stroke: string | undefined;
2363
2363
  variant: VariantResource;
package/dist/index.js CHANGED
@@ -185,8 +185,8 @@ class vt {
185
185
  if (window && window.__SENTRY__) {
186
186
  const h = window.__SENTRY__.hub;
187
187
  if (h) {
188
- const I = h.traceHeaders();
189
- Object.entries(I).forEach(([u, D]) => {
188
+ const m = h.traceHeaders();
189
+ Object.entries(m).forEach(([u, D]) => {
190
190
  r[u] = D;
191
191
  });
192
192
  }
@@ -1554,9 +1554,9 @@ class Ba {
1554
1554
  if (!e && t !== "" && a === "") {
1555
1555
  const g = async () => {
1556
1556
  var u, D;
1557
- const h = (await Je([t]))[0], I = (D = (u = h == null ? void 0 : h.versions) == null ? void 0 : u.find((p) => p.name === "mpeg4")) == null ? void 0 : D.link;
1558
- return { asset: h, link: I };
1559
- }, B = await new Promise((h, I) => {
1557
+ const h = (await Je([t]))[0], m = (D = (u = h == null ? void 0 : h.versions) == null ? void 0 : u.find((p) => p.name === "mpeg4")) == null ? void 0 : D.link;
1558
+ return { asset: h, link: m };
1559
+ }, B = await new Promise((h, m) => {
1560
1560
  new ze(
1561
1561
  async () => !!(await g()).link,
1562
1562
  async () => {
@@ -1569,7 +1569,7 @@ class Ba {
1569
1569
  });
1570
1570
  },
1571
1571
  () => {
1572
- I("Poller timed out with 40 attempts @ 3 second interval");
1572
+ m("Poller timed out with 40 attempts @ 3 second interval");
1573
1573
  },
1574
1574
  3e3,
1575
1575
  40
@@ -1808,7 +1808,7 @@ class da {
1808
1808
  n && n(!0);
1809
1809
  const r = await Promise.all(
1810
1810
  A.data.regions.map(async (w, d) => {
1811
- const C = await qA(o[d]), E = i.getImageData(), Q = t.map((m) => new Z(m.id)), h = E ? ZA(E, C) : void 0, I = E ? {
1811
+ const C = await qA(o[d]), E = i.getImageData(), Q = t.map((I) => new Z(I.id)), h = E ? ZA(E, C) : void 0, m = E ? {
1812
1812
  id: k(),
1813
1813
  src: E.src,
1814
1814
  x: (h == null ? void 0 : h.x) || 0,
@@ -1818,13 +1818,13 @@ class da {
1818
1818
  scaleX: (h == null ? void 0 : h.zoom) || 1,
1819
1819
  scaleY: (h == null ? void 0 : h.zoom) || 1,
1820
1820
  rotation: 0
1821
- } : void 0, u = k(), p = a.getLayouts().find((m) => m.panelId === w.panelId);
1821
+ } : void 0, u = k(), p = a.getLayouts().find((I) => I.panelId === w.panelId);
1822
1822
  if (!p)
1823
1823
  throw new O(w);
1824
1824
  return {
1825
1825
  command: this.getCreateElementCommand(u, w, p, {
1826
1826
  frameData: C,
1827
- pattern: I,
1827
+ pattern: m,
1828
1828
  disablePlaceholder: A.data.disablePlaceholder,
1829
1829
  focalBlur: A.data.focalBlur,
1830
1830
  focalBlurStrength: A.data.focalBlurStrength,
@@ -2050,13 +2050,13 @@ class Ea {
2050
2050
  if (!o)
2051
2051
  throw new oA(i);
2052
2052
  const r = await De(await this.getIllustrationBody(o)), g = await IA(r.svg), B = (h) => {
2053
- const I = n.getLayouts().find((D) => D.panelId === h.panelId);
2054
- if (!I)
2053
+ const m = n.getLayouts().find((D) => D.panelId === h.panelId);
2054
+ if (!m)
2055
2055
  throw new O(h);
2056
2056
  const u = k();
2057
2057
  return {
2058
2058
  regionElement: { id: u, region: h },
2059
- command: this.getCreateElementCommand(u, h, I, {
2059
+ command: this.getCreateElementCommand(u, h, m, {
2060
2060
  stepName: A.stepName,
2061
2061
  src: o,
2062
2062
  objectURL: g,
@@ -2067,9 +2067,9 @@ class Ea {
2067
2067
  let C = Array.from(Object.values(r.colors)).map((h) => h.browserValue);
2068
2068
  const E = A.data.colorOption;
2069
2069
  return E && ((Q = E.variants) == null || Q.forEach((h) => {
2070
- C = C.map((I) => {
2070
+ C = C.map((m) => {
2071
2071
  var u;
2072
- return I.toLowerCase() === ((u = h.color) == null ? void 0 : u.toLowerCase()) ? h.name : I;
2072
+ return m.toLowerCase() === ((u = h.color) == null ? void 0 : u.toLowerCase()) ? h.name : m;
2073
2073
  });
2074
2074
  })), n.updateMetadata(A.stepName, { colors: C }), {
2075
2075
  command: new R(d),
@@ -2077,11 +2077,22 @@ class Ea {
2077
2077
  await n.setSelectionsAndElements(
2078
2078
  A.stepName,
2079
2079
  [e],
2080
- l.map((h) => h.regionElement),
2080
+ l.map((u) => u.regionElement),
2081
2081
  async () => {
2082
2082
  n.setMandatoryFulfilled(A.stepName, !0), a(!1);
2083
2083
  }
2084
2084
  );
2085
+ const h = await this.availableColors(A, n) || [], m = Object.keys(r.colors);
2086
+ if (h.length === 1 && m.length === 1) {
2087
+ const u = h[0], D = m[0];
2088
+ await this.changeColors(
2089
+ A,
2090
+ t,
2091
+ n,
2092
+ () => n.getCommandContext().getAllLayouts(),
2093
+ /* @__PURE__ */ new Map([[D, u.variant.color]])
2094
+ );
2095
+ }
2085
2096
  }
2086
2097
  };
2087
2098
  }
@@ -2616,7 +2627,7 @@ class pa {
2616
2627
  };
2617
2628
  } else {
2618
2629
  const r = (w) => {
2619
- const d = n.find((I) => I.panelId === w.panelId);
2630
+ const d = n.find((m) => m.panelId === w.panelId);
2620
2631
  if (!d)
2621
2632
  throw new O(w);
2622
2633
  const C = i(), E = `
@@ -2954,14 +2965,14 @@ class Ma {
2954
2965
  if (o && l) {
2955
2966
  const w = (r = o.variants) == null ? void 0 : r.find((d) => d.id === l);
2956
2967
  if (w) {
2957
- const d = await this.fontDataFromVariant(w), C = i.map((I) => ({ id: I.id, region: I.stepRegion })), E = (g = a.storage) == null ? void 0 : g.color, Q = (B = a.storage) == null ? void 0 : B.text;
2968
+ const d = await this.fontDataFromVariant(w), C = i.map((m) => ({ id: m.id, region: m.stepRegion })), E = (g = a.storage) == null ? void 0 : g.color, Q = (B = a.storage) == null ? void 0 : B.text;
2958
2969
  await e.setSelectionsAndElements(
2959
2970
  A.stepName,
2960
2971
  [w],
2961
2972
  C,
2962
2973
  async () => {
2963
2974
  e.updateMetadata(A.stepName, { color: E, text: Q }), e.updateStorage(A.stepName, { text: Q, inputText: Q });
2964
- const I = i.map((D) => new ge(D.id, d)), u = new R(I);
2975
+ const m = i.map((D) => new ge(D.id, d)), u = new R(m);
2965
2976
  e.getCommandDispatcher()(u), e.setMandatoryFulfilled(A.stepName, !0);
2966
2977
  }
2967
2978
  );
@@ -3093,11 +3104,11 @@ class Ma {
3093
3104
  colorProfileAssetKey: (C = E.colorProfile) == null ? void 0 : C.key
3094
3105
  });
3095
3106
  }
3096
- const h = await this.getDefaultColor(t), I = h || "#000000", u = {
3107
+ const h = await this.getDefaultColor(t), m = h || "#000000", u = {
3097
3108
  stepRegion: B,
3098
3109
  stepName: A,
3099
3110
  align: this.textAlign(t),
3100
- fill: n.color ? n.color : I,
3111
+ fill: n.color ? n.color : m,
3101
3112
  fontSize: t.size || JA,
3102
3113
  fontData: a,
3103
3114
  id: d,
@@ -3117,7 +3128,7 @@ class Ma {
3117
3128
  curved: t.curved,
3118
3129
  paths: t.paths,
3119
3130
  fillSpotColorDefinition: Q
3120
- }, D = [], p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
3131
+ }, D = [], p = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
3121
3132
  if (!u.fontData)
3122
3133
  throw new v("Failed to resolve font data for text.");
3123
3134
  const [F, Y] = QA(
@@ -3134,7 +3145,7 @@ class Ma {
3134
3145
  [o],
3135
3146
  { size: t.size, minSize: t.minSize, maxSize: t.maxSize }
3136
3147
  );
3137
- p.set(u.id, F), m.set(u.id, Y);
3148
+ p.set(u.id, F), I.set(u.id, Y);
3138
3149
  const M = t.curved || t.vertical ? o : (Y || []).join(`
3139
3150
  `);
3140
3151
  D.push(
@@ -3195,13 +3206,13 @@ class Ma {
3195
3206
  return g && g(!0), { info: "0" };
3196
3207
  const u = s.getProfanities(), D = KA(l.toLowerCase());
3197
3208
  for (const p of D)
3198
- for (const m in u) {
3199
- const F = u[m].toLowerCase().replace(/\s/g, "");
3209
+ for (const I in u) {
3210
+ const F = u[I].toLowerCase().replace(/\s/g, "");
3200
3211
  if (p === F)
3201
3212
  return o(!0), { error: "Blocked profanity." };
3202
3213
  }
3203
3214
  return !A.data.vertical && !A.data.allowNewlines && (l.includes(`
3204
- `) || l.includes("\r")) ? (o(!0), { error: "Cannot span multiple lines." }) : !A.data.curved && !Array.from(C.values()).every((m) => m) ? (o(!0), { error: "Does not fit." }) : (o(!1), { info: (A.data.maxLength - l.length).toString() });
3215
+ `) || l.includes("\r")) ? (o(!0), { error: "Cannot span multiple lines." }) : !A.data.curved && !Array.from(C.values()).every((I) => I) ? (o(!0), { error: "Does not fit." }) : (o(!1), { info: (A.data.maxLength - l.length).toString() });
3205
3216
  })();
3206
3217
  if (Q.error) {
3207
3218
  r(Q.error);
@@ -4671,8 +4682,8 @@ class Ha extends te {
4671
4682
  const t = A.toSVG(2), a = A.getBoundingBox(), n = a.x2 - a.x1, s = A.toPathData(3), i = () => {
4672
4683
  const D = P("g"), p = P("defs");
4673
4684
  D.appendChild(p), p.appendChild(Ze(3, 7, 4, "shadow"));
4674
- const m = P("g");
4675
- D.appendChild(m), m.setAttribute("filter", "url(#shadow)"), m.innerHTML = t;
4685
+ const I = P("g");
4686
+ D.appendChild(I), I.setAttribute("filter", "url(#shadow)"), I.innerHTML = t;
4676
4687
  const F = P("g");
4677
4688
  D.appendChild(F), F.setAttribute("fill", "red"), F.setAttribute("stroke", "red"), F.setAttribute("stroke-width", "9"), F.innerHTML = t;
4678
4689
  const Y = P("g");
@@ -4690,8 +4701,8 @@ class Ha extends te {
4690
4701
  Q.setAttribute("opacity", "0"), E.appendChild(Q);
4691
4702
  const h = P("g");
4692
4703
  E.appendChild(h);
4693
- const I = i();
4694
- h.appendChild(I);
4704
+ const m = i();
4705
+ h.appendChild(m);
4695
4706
  const u = Ae(s);
4696
4707
  return ne(h, u, l, w), $e(o.outerHTML);
4697
4708
  }
@@ -4713,17 +4724,17 @@ class Ua extends te {
4713
4724
  }
4714
4725
  brandSvg(A, e, t) {
4715
4726
  const a = A.toSVG(2), n = A.getBoundingBox(), s = n.y2 - n.y1, i = n.x2 - n.x1, o = A.toPathData(3), r = () => {
4716
- const m = P("g"), F = P("g");
4717
- m.appendChild(F), F.setAttribute("stroke", "#5C1A0D"), F.setAttribute("stroke-width", "4"), F.setAttribute("transform", "translate(1,1)"), F.innerHTML = a;
4727
+ const I = P("g"), F = P("g");
4728
+ I.appendChild(F), F.setAttribute("stroke", "#5C1A0D"), F.setAttribute("stroke-width", "4"), F.setAttribute("transform", "translate(1,1)"), F.innerHTML = a;
4718
4729
  const Y = P("g");
4719
- m.appendChild(Y), Y.setAttribute("fill", "#FFE386"), Y.setAttribute("transform", "translate(1,1)"), Y.innerHTML = a;
4730
+ I.appendChild(Y), Y.setAttribute("fill", "#FFE386"), Y.setAttribute("transform", "translate(1,1)"), Y.innerHTML = a;
4720
4731
  const M = P("g");
4721
- m.appendChild(M), M.setAttribute("fill", "white"), M.innerHTML = a;
4722
- const G = new se(m);
4732
+ I.appendChild(M), M.setAttribute("fill", "white"), M.innerHTML = a;
4733
+ const G = new se(I);
4723
4734
  return G.transform(([S, J]) => [S, J + ((i - S) * J) ** 2 / (i * 5e4)]), G.transform(([S, J]) => [
4724
4735
  S,
4725
4736
  J + (i / 3 - S) ** 2 / i * this.indicator(S < i / 3)
4726
- ]), G.transform(([S, J]) => [S - (s - J) * (i - S) / 800, J]), m;
4737
+ ]), G.transform(([S, J]) => [S - (s - J) * (i - S) / 800, J]), I;
4727
4738
  }, [g, B, l] = Xe(e);
4728
4739
  if (!g)
4729
4740
  return "";
@@ -4733,8 +4744,8 @@ class Ua extends te {
4733
4744
  t ? (d = B * 0.25 * (1 + 0.1), C = l / 2 * (1 + 0.1), E = l * 0.22, Q = B * 0.32) : (d = B * 0.22 * (1 + 0.1), C = l * 0.8, E = l * 0.067, Q = B * 0.33);
4734
4745
  const h = P("g");
4735
4746
  g.appendChild(h), h.setAttribute("transform", `translate(${E} ${Q}) rotate(-10)`);
4736
- const I = ae(d, C);
4737
- I.setAttribute("opacity", "0"), h.appendChild(I);
4747
+ const m = ae(d, C);
4748
+ m.setAttribute("opacity", "0"), h.appendChild(m);
4738
4749
  const u = P("g");
4739
4750
  h.appendChild(u);
4740
4751
  const D = r();
@@ -4756,21 +4767,21 @@ class va extends te {
4756
4767
  return this.svgElement(A, e);
4757
4768
  }
4758
4769
  svgElement(A, e) {
4759
- const t = _A(Ga), n = A !== "" ? ((I) => I.charAt(0).toUpperCase() + I.substr(1).toLowerCase())(A) : "", s = t.getPath(n, 0, 72, 72), i = s.toSVG(2), o = s.getBoundingBox(), r = o.x2 - o.x1, g = s.toPathData(3), B = () => {
4760
- const I = P("g");
4761
- I.classList.add("module-text-group");
4770
+ const t = _A(Ga), n = A !== "" ? ((m) => m.charAt(0).toUpperCase() + m.substr(1).toLowerCase())(A) : "", s = t.getPath(n, 0, 72, 72), i = s.toSVG(2), o = s.getBoundingBox(), r = o.x2 - o.x1, g = s.toPathData(3), B = () => {
4771
+ const m = P("g");
4772
+ m.classList.add("module-text-group");
4762
4773
  const u = P("defs");
4763
- I.appendChild(u), u.appendChild(Ze(0, 2, 2, "shadow"));
4774
+ m.appendChild(u), u.appendChild(Ze(0, 2, 2, "shadow"));
4764
4775
  const D = P("path");
4765
4776
  D.setAttribute("d", g), D.setAttribute("stroke", "black"), D.setAttribute("stroke-width", "3"), u.appendChild(D);
4766
4777
  const p = P("g");
4767
- p.classList.add("module-layer0"), I.appendChild(p), p.setAttribute("filter", "url(#shadow)"), p.innerHTML = D.outerHTML;
4768
- const m = P("g");
4769
- m.classList.add("module-layer1"), I.appendChild(m), m.setAttribute("stroke-width", "3"), m.setAttribute("stroke", "rgb(45,41,38)"), m.setAttribute("fill", "rgb(45,41,38)"), m.setAttribute("transform", "translate(0.5,0)"), m.innerHTML = i;
4778
+ p.classList.add("module-layer0"), m.appendChild(p), p.setAttribute("filter", "url(#shadow)"), p.innerHTML = D.outerHTML;
4779
+ const I = P("g");
4780
+ I.classList.add("module-layer1"), m.appendChild(I), I.setAttribute("stroke-width", "3"), I.setAttribute("stroke", "rgb(45,41,38)"), I.setAttribute("fill", "rgb(45,41,38)"), I.setAttribute("transform", "translate(0.5,0)"), I.innerHTML = i;
4770
4781
  const F = P("g");
4771
- F.classList.add("module-layer2"), I.appendChild(F), F.setAttribute("fill", "rgb(255,209,0)"), F.setAttribute("transform", "translate(1,-0.1)"), F.innerHTML = i;
4782
+ F.classList.add("module-layer2"), m.appendChild(F), F.setAttribute("fill", "rgb(255,209,0)"), F.setAttribute("transform", "translate(1,-0.1)"), F.innerHTML = i;
4772
4783
  const Y = P("g");
4773
- return Y.classList.add("module-layer3"), I.appendChild(Y), Y.setAttribute("fill", "white"), Y.innerHTML = i, new se(I).transform(([G, S]) => [G, S + (r / 2 - G) ** 2 / (r * 6)]), I;
4784
+ return Y.classList.add("module-layer3"), m.appendChild(Y), Y.setAttribute("fill", "white"), Y.innerHTML = i, new se(m).transform(([G, S]) => [G, S + (r / 2 - G) ** 2 / (r * 6)]), m;
4774
4785
  }, l = P("g");
4775
4786
  l.classList.add("module-root");
4776
4787
  const w = P("defs");
@@ -5214,11 +5225,11 @@ class Ja {
5214
5225
  this.stepSelections = {
5215
5226
  ...this.stepSelections,
5216
5227
  [A]: { selectedVariants: e }
5217
- }, this.selectionCost = Object.values(this.stepSelections).reduce((p, m) => p + m.selectedVariants.map((F) => F.priceModifier || 0).reduce((F, Y) => F + Y, 0), 0), this.workflow.steps.forEach((p) => {
5228
+ }, this.selectionCost = Object.values(this.stepSelections).reduce((p, I) => p + I.selectedVariants.map((F) => F.priceModifier || 0).reduce((F, Y) => F + Y, 0), 0), this.workflow.steps.forEach((p) => {
5218
5229
  tA(p, this.stepSelections) || (this.stepInitialised[p.stepName] = !1, delete this.stepMetadata[p.stepName], delete this.stepSelections[p.stepName], delete this.storage[p.stepName]);
5219
5230
  });
5220
5231
  const s = this.allScenes, i = eA(s, n), o = eA(s, this.stepSelections), r = i.map((p) => p.silentSteps).flat(), B = o.map((p) => p.silentSteps).flat().filter(
5221
- (p) => !r.some((m) => m.stepName === p.stepName)
5232
+ (p) => !r.some((I) => I.stepName === p.stepName)
5222
5233
  );
5223
5234
  r.forEach((p) => {
5224
5235
  tA(p, this.stepSelections) || (this.stepInitialised[p.stepName] = !1);
@@ -5232,15 +5243,15 @@ class Ja {
5232
5243
  const C = this.workflow.steps.find((p) => p.stepName === A);
5233
5244
  if ((C == null ? void 0 : C.type) === f.Frame) {
5234
5245
  const p = this.getStepSpecificServices(A);
5235
- (D = p == null ? void 0 : p.frameService) == null || D.setTargetElements(t.map((m) => m.id));
5246
+ (D = p == null ? void 0 : p.frameService) == null || D.setTargetElements(t.map((I) => I.id));
5236
5247
  }
5237
5248
  const E = l.map((p) => new Z(p.id)), Q = new le(this.constructSerializableWorkflow()), h = [...d, ...E, Q];
5238
5249
  h.length > 0 && this.commandContext.apply(new R(h), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
5239
- const I = this.getInvalidModelVariants(), u = this.modelContainer;
5250
+ const m = this.getInvalidModelVariants(), u = this.modelContainer;
5240
5251
  if (u) {
5241
- const p = I.map(
5242
- (m) => u.applyModelVariant(
5243
- m,
5252
+ const p = m.map(
5253
+ (I) => u.applyModelVariant(
5254
+ I,
5244
5255
  {
5245
5256
  contextService: this.getLayoutPreviewService()
5246
5257
  },
@@ -6177,7 +6188,7 @@ const et = y`
6177
6188
  }
6178
6189
  }
6179
6190
  return [M, G];
6180
- }, [h] = await Q(!0), I = Object.fromEntries(
6191
+ }, [h] = await Q(!0), m = Object.fromEntries(
6181
6192
  Object.keys(h).map((Y) => [Y, h[Y].map((M) => M.id)])
6182
6193
  ), [u] = await Q(!1), D = Object.fromEntries(
6183
6194
  Object.keys(u).map((Y) => [
@@ -6204,7 +6215,7 @@ const et = y`
6204
6215
  M.push({ key: G, value: S });
6205
6216
  Y.metadata = M;
6206
6217
  }
6207
- if (I) {
6218
+ if (m) {
6208
6219
  const M = [];
6209
6220
  for (const [G, S] of Object.entries(D))
6210
6221
  M.push({ key: G, ids: S });
@@ -6449,12 +6460,12 @@ class dA {
6449
6460
  return this.workflowManager;
6450
6461
  }
6451
6462
  async createPreviewImage(A, e) {
6452
- var h, I;
6463
+ var h, m;
6453
6464
  const t = this.workflowManager.getWorkflow(), a = (h = t == null ? void 0 : t.finalizeStepConfig) == null ? void 0 : h.lookAtAnimation;
6454
6465
  if (A) {
6455
6466
  if (!a)
6456
6467
  throw new Error("Failed to generate cart preview image!");
6457
- return await ((I = this.workflowManager.getPreviewService()) == null ? void 0 : I.renderSceneScreenshot(e ?? 512, a)) || "";
6468
+ return await ((m = this.workflowManager.getPreviewService()) == null ? void 0 : m.renderSceneScreenshot(e ?? 512, a)) || "";
6458
6469
  }
6459
6470
  let n = 2048;
6460
6471
  e && e <= 2048 && (n = e);
@@ -6760,7 +6771,7 @@ const an = [
6760
6771
  const a = e.data, n = t.option;
6761
6772
  if (!n)
6762
6773
  return console.error(`No option for step ${t.stepName}.`), [];
6763
- const s = ((D = n.variants) == null ? void 0 : D.find((m) => m.id === a.illustrationVariantId)) || NA(n);
6774
+ const s = ((D = n.variants) == null ? void 0 : D.find((I) => I.id === a.illustrationVariantId)) || NA(n);
6764
6775
  if (!s)
6765
6776
  return console.error(`No variant with ID: ${a.illustrationVariantId}`), [];
6766
6777
  if (!s.asset)
@@ -6774,32 +6785,32 @@ const an = [
6774
6785
  return console.error("Failed to read SVG."), [];
6775
6786
  xe(d);
6776
6787
  const C = {};
6777
- yt(d, (m) => {
6778
- an.includes(m.tagName) && !m.attributes.getNamedItem("fill") && m.setAttribute("fill", "#000000");
6779
- const F = m.attributes.getNamedItem("fill");
6788
+ yt(d, (I) => {
6789
+ an.includes(I.tagName) && !I.attributes.getNamedItem("fill") && I.setAttribute("fill", "#000000");
6790
+ const F = I.attributes.getNamedItem("fill");
6780
6791
  if (F && F.value !== "none") {
6781
6792
  const M = F.value, S = `spiff-fill-${M.replace(/\W/g, "")}`;
6782
- m.classList.add(S), C[S] = { browserValue: M };
6793
+ I.classList.add(S), C[S] = { browserValue: M };
6783
6794
  }
6784
- const Y = m.attributes.getNamedItem("stroke");
6795
+ const Y = I.attributes.getNamedItem("stroke");
6785
6796
  if (Y && Y.value !== "none") {
6786
6797
  const M = Y.value, S = `spiff-stroke-${M.replace(/\W/g, "")}`;
6787
- m.classList.add(S), C[S] = { browserValue: M };
6798
+ I.classList.add(S), C[S] = { browserValue: M };
6788
6799
  }
6789
6800
  });
6790
6801
  const Q = Ne().serializeToString(d), h = a.colors;
6791
6802
  if (h) {
6792
- for (const [m, F] of Object.entries(C))
6803
+ for (const [I, F] of Object.entries(C))
6793
6804
  for (const Y of Object.keys(h))
6794
6805
  if (F.browserValue === Y) {
6795
- C[m] = { browserValue: h[Y] };
6806
+ C[I] = { browserValue: h[Y] };
6796
6807
  break;
6797
6808
  }
6798
6809
  }
6799
- const I = (m) => {
6800
- const F = c.find((M) => M.panelId === m.panelId);
6810
+ const m = (I) => {
6811
+ const F = c.find((M) => M.panelId === I.panelId);
6801
6812
  if (!F)
6802
- throw new O(m);
6813
+ throw new O(I);
6803
6814
  const Y = k();
6804
6815
  return new b(
6805
6816
  {
@@ -6807,22 +6818,22 @@ const an = [
6807
6818
  id: Y,
6808
6819
  svg: Q,
6809
6820
  type: U.Illustration,
6810
- y: m.top,
6811
- x: m.left,
6812
- rotation: m.rotation,
6813
- width: m.width,
6814
- height: m.height,
6815
- layer: m.layer,
6816
- layerIndex: m.layerIndex,
6817
- immutable: m.immutable
6821
+ y: I.top,
6822
+ x: I.left,
6823
+ rotation: I.rotation,
6824
+ width: I.width,
6825
+ height: I.height,
6826
+ layer: I.layer,
6827
+ layerIndex: I.layerIndex,
6828
+ immutable: I.immutable
6818
6829
  },
6819
6830
  F
6820
6831
  );
6821
6832
  }, u = t.data.regions;
6822
6833
  try {
6823
- return u.map(I);
6824
- } catch (m) {
6825
- return console.error(m), [];
6834
+ return u.map(m);
6835
+ } catch (I) {
6836
+ return console.error(I), [];
6826
6837
  }
6827
6838
  }, rn = async (c, A, e) => {
6828
6839
  const t = await _e(e.data.module), a = A.data, n = (i, o) => {
@@ -7022,11 +7033,11 @@ const an = [
7022
7033
  return t;
7023
7034
  }, Bn = async (c, A, e, t) => {
7024
7035
  const a = [], n = e.data, s = 30, i = (E) => E.vertical ? "center" : E.textAlign || "center", o = () => {
7025
- var I;
7036
+ var m;
7026
7037
  const E = t.option;
7027
7038
  if (!E)
7028
7039
  return;
7029
- const Q = ((I = E.variants) == null ? void 0 : I.find((u) => u.id === n.fontVariantId)) || NA(E);
7040
+ const Q = ((m = E.variants) == null ? void 0 : m.find((u) => u.id === n.fontVariantId)) || NA(E);
7030
7041
  if (!Q || !Q.asset)
7031
7042
  return;
7032
7043
  A[t.stepName] = { selectedVariants: [Q] };
@@ -7053,7 +7064,7 @@ const an = [
7053
7064
  return h == null ? void 0 : h.color;
7054
7065
  }, d = n.color || await w(t.data), C = t.data.regions;
7055
7066
  for (const E of C) {
7056
- const Q = c.find((I) => I.panelId === E.panelId);
7067
+ const Q = c.find((m) => m.panelId === E.panelId);
7057
7068
  if (!Q)
7058
7069
  continue;
7059
7070
  const h = {
@@ -7078,7 +7089,7 @@ const an = [
7078
7089
  y: E.top
7079
7090
  };
7080
7091
  if (g) {
7081
- const [I, u] = QA(
7092
+ const [m, u] = QA(
7082
7093
  t.data.size || s,
7083
7094
  g,
7084
7095
  E,
@@ -7098,7 +7109,7 @@ const an = [
7098
7109
  new b(
7099
7110
  {
7100
7111
  ...h,
7101
- fontSize: I,
7112
+ fontSize: m,
7102
7113
  text: h.curved ? h.text : (u || []).join(`
7103
7114
  `)
7104
7115
  },
@@ -9584,14 +9595,14 @@ class Bs {
9584
9595
  const E = i.get(A);
9585
9596
  if (E && await this.authenticateCustomerId(E)) {
9586
9597
  const h = ((w = (l = this.customer) == null ? void 0 : l.bundleStakeholders) == null ? void 0 : w.find(
9587
- (I) => {
9598
+ (m) => {
9588
9599
  var u, D;
9589
- return (D = (u = I.bundle) == null ? void 0 : u.transactions) == null ? void 0 : D.some((p) => p.id === A);
9600
+ return (D = (u = m.bundle) == null ? void 0 : u.transactions) == null ? void 0 : D.some((p) => p.id === A);
9590
9601
  }
9591
9602
  )) || ((C = (d = this.customer) == null ? void 0 : d.stakeholders) == null ? void 0 : C.find(
9592
- (I) => {
9603
+ (m) => {
9593
9604
  var u;
9594
- return ((u = I.transaction) == null ? void 0 : u.id) === A;
9605
+ return ((u = m.transaction) == null ? void 0 : u.id) === A;
9595
9606
  }
9596
9607
  ));
9597
9608
  if (h)
@@ -9814,10 +9825,10 @@ class Bs {
9814
9825
  var Q, h;
9815
9826
  const E = N.getShadowGraphqlClient();
9816
9827
  if (a.type === "transaction") {
9817
- const { transactionId: I, readOnly: u } = a, D = await E.query({
9828
+ const { transactionId: m, readOnly: u } = a, D = await E.query({
9818
9829
  query: lA,
9819
9830
  variables: {
9820
- ids: [I]
9831
+ ids: [m]
9821
9832
  },
9822
9833
  errorPolicy: "all",
9823
9834
  fetchPolicy: "no-cache"
@@ -9827,20 +9838,20 @@ class Bs {
9827
9838
  const p = (h = D.data) == null ? void 0 : h.transactions[0];
9828
9839
  if (!p.workflowId)
9829
9840
  throw new H("Existing transaction has no workflow ID.");
9830
- const m = await CA(p.workflowId);
9841
+ const I = await CA(p.workflowId);
9831
9842
  if (!p.product)
9832
9843
  throw new H("Failed to load transaction, product not available.");
9833
- return { transaction: p, workflow: m, readOnly: u };
9844
+ return { transaction: p, workflow: I, readOnly: u };
9834
9845
  }
9835
9846
  if (a.type === "integration" || a.type === "external") {
9836
- const I = async () => {
9837
- const m = a.type === "integration" ? { integrationProductId: a.integrationProductId } : {
9847
+ const m = async () => {
9848
+ const I = a.type === "integration" ? { integrationProductId: a.integrationProductId } : {
9838
9849
  externalIntegrationId: a.externalIntegrationId,
9839
9850
  externalProductId: a.externalProductId
9840
9851
  }, F = await E.mutate({
9841
9852
  mutation: Ee,
9842
9853
  variables: {
9843
- ...m,
9854
+ ...I,
9844
9855
  workflowId: a.workflowId,
9845
9856
  claim: !0
9846
9857
  },
@@ -9855,7 +9866,7 @@ class Bs {
9855
9866
  if (!Y.product)
9856
9867
  throw new H("Failed to create transaction, product not available.");
9857
9868
  return Y;
9858
- }, u = CA(a.workflowId, a == null ? void 0 : a.graphql), [D, p] = await Promise.all([I(), u]);
9869
+ }, u = CA(a.workflowId, a == null ? void 0 : a.graphql), [D, p] = await Promise.all([m(), u]);
9859
9870
  return { transaction: D, workflow: p };
9860
9871
  }
9861
9872
  throw new H("No workflow ID provided.");
@@ -9913,30 +9924,30 @@ class Bs {
9913
9924
  async getWorkflowExperiences(A, e) {
9914
9925
  if (A.length === 0)
9915
9926
  throw new H("No options provided!");
9916
- const t = N.getShadowGraphqlClient(), a = A.map((h, I) => ({ option: h, index: I })), n = a.filter((h) => h.option.type === "transaction"), s = a.filter(
9927
+ const t = N.getShadowGraphqlClient(), a = A.map((h, m) => ({ option: h, index: m })), n = a.filter((h) => h.option.type === "transaction"), s = a.filter(
9917
9928
  (h) => h.option.type === "integration" || h.option.type === "external"
9918
9929
  ), i = async () => {
9919
9930
  var D, p;
9920
9931
  if (n.length === 0)
9921
9932
  return [];
9922
- const h = n.map((m) => m.option.transactionId), I = await t.query({
9933
+ const h = n.map((I) => I.option.transactionId), m = await t.query({
9923
9934
  query: lA,
9924
9935
  variables: {
9925
9936
  ids: h
9926
9937
  },
9927
9938
  errorPolicy: "all",
9928
9939
  fetchPolicy: "no-cache"
9929
- }), u = I.data.transactions;
9940
+ }), u = m.data.transactions;
9930
9941
  if (u.length !== n.length) {
9931
- const m = ((p = (D = I.errors) == null ? void 0 : D[0]) == null ? void 0 : p.message) || "Unknown error";
9932
- throw new H(`Not all transactions were found: ${m}`);
9942
+ const I = ((p = (D = m.errors) == null ? void 0 : D[0]) == null ? void 0 : p.message) || "Unknown error";
9943
+ throw new H(`Not all transactions were found: ${I}`);
9933
9944
  }
9934
- return u.map((m, F) => {
9945
+ return u.map((I, F) => {
9935
9946
  var Y;
9936
9947
  return {
9937
- transaction: m,
9938
- workflowId: m.workflowId,
9939
- readOnly: ((Y = n.find((M) => M.option.transactionId === m.id)) == null ? void 0 : Y.option.readOnly) ?? !1,
9948
+ transaction: I,
9949
+ workflowId: I.workflowId,
9950
+ readOnly: ((Y = n.find((M) => M.option.transactionId === I.id)) == null ? void 0 : Y.option.readOnly) ?? !1,
9940
9951
  index: n[F].index
9941
9952
  };
9942
9953
  });
@@ -9947,45 +9958,45 @@ class Bs {
9947
9958
  const h = await t.mutate({
9948
9959
  mutation: ea,
9949
9960
  variables: {
9950
- inputs: s.map((m) => ({
9951
- integrationProductId: m.option.type === "integration" ? m.option.integrationProductId : void 0,
9952
- externalIntegrationId: m.option.type === "external" ? m.option.externalIntegrationId : void 0,
9953
- externalProductId: m.option.type === "external" ? m.option.externalProductId : void 0,
9954
- workflowId: m.option.workflowId,
9961
+ inputs: s.map((I) => ({
9962
+ integrationProductId: I.option.type === "integration" ? I.option.integrationProductId : void 0,
9963
+ externalIntegrationId: I.option.type === "external" ? I.option.externalIntegrationId : void 0,
9964
+ externalProductId: I.option.type === "external" ? I.option.externalProductId : void 0,
9965
+ workflowId: I.option.workflowId,
9955
9966
  claim: !0
9956
9967
  }))
9957
9968
  },
9958
9969
  errorPolicy: "all",
9959
9970
  fetchPolicy: "no-cache"
9960
- }), I = (u = h.data) == null ? void 0 : u.transactionCreateMany;
9961
- if (!I || I.length === 0) {
9962
- const m = ((p = (D = h.errors) == null ? void 0 : D[0]) == null ? void 0 : p.message) || "Unknown error";
9963
- throw new H(`Failed to create transactions: ${m}`);
9971
+ }), m = (u = h.data) == null ? void 0 : u.transactionCreateMany;
9972
+ if (!m || m.length === 0) {
9973
+ const I = ((p = (D = h.errors) == null ? void 0 : D[0]) == null ? void 0 : p.message) || "Unknown error";
9974
+ throw new H(`Failed to create transactions: ${I}`);
9964
9975
  }
9965
- return I.map((m, F) => ({
9966
- transaction: m,
9967
- workflowId: m.workflowId,
9976
+ return m.map((I, F) => ({
9977
+ transaction: I,
9978
+ workflowId: I.workflowId,
9968
9979
  readOnly: !1,
9969
9980
  index: s[F].index
9970
9981
  }));
9971
9982
  }, r = (await Promise.all([i(), o()])).flat(), g = [...new Set(r.map((h) => h.workflowId))], B = await ot(g, e), l = new Map(B.map((h) => [h.id, h])), w = x.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), d = r.map(async (h) => {
9972
9983
  var G;
9973
- const { transaction: I, workflowId: u, readOnly: D, index: p } = h, m = l.get(u), F = A[p];
9974
- !w.get(I.id) && I.transactionOwnerId && w.set(I.id, I.transactionOwnerId);
9975
- const Y = w.get(I.id) || void 0, M = {
9976
- product: I.product,
9977
- transaction: I,
9984
+ const { transaction: m, workflowId: u, readOnly: D, index: p } = h, I = l.get(u), F = A[p];
9985
+ !w.get(m.id) && m.transactionOwnerId && w.set(m.id, m.transactionOwnerId);
9986
+ const Y = w.get(m.id) || void 0, M = {
9987
+ product: m.product,
9988
+ transaction: m,
9978
9989
  layouts: [],
9979
9990
  singleVariantsRenderable: (G = F == null ? void 0 : F.workflowConfiguration) == null ? void 0 : G.singleVariantsRenderable,
9980
9991
  stateMutationFunc: D ? async () => {
9981
9992
  throw new v("State mutation is forbidden in read only mode!");
9982
9993
  } : async (S) => this.updateTransactionState({ ...S, context: { transactionOwnerId: Y } }),
9983
9994
  readOnly: D,
9984
- workflow: m,
9995
+ workflow: I,
9985
9996
  isReloadedTransaction: F.type === "transaction"
9986
9997
  };
9987
- if (F.type === "transaction" && I.workflowState) {
9988
- const S = JSON.parse(I.workflowState);
9998
+ if (F.type === "transaction" && m.workflowState) {
9999
+ const S = JSON.parse(m.workflowState);
9989
10000
  M.layouts = Object.values(S.layouts).map((J) => J.layout), await _(S), await AA(S), M.reloadedState = S;
9990
10001
  } else if (!D && F.workflowState) {
9991
10002
  const S = JSON.parse(F.workflowState);
@@ -10000,8 +10011,8 @@ class Bs {
10000
10011
  ), this.initialized = !0, this.experienceOptions = M, { experienceOptions: M, index: p, options: F };
10001
10012
  });
10002
10013
  x.setMap("transactionOwnerIds", w);
10003
- const Q = (await Promise.all(d)).sort((h, I) => h.index - I.index).map(async (h) => {
10004
- const { experienceOptions: I, options: u } = h, D = new dA(this, I);
10014
+ const Q = (await Promise.all(d)).sort((h, m) => h.index - m.index).map(async (h) => {
10015
+ const { experienceOptions: m, options: u } = h, D = new dA(this, m);
10005
10016
  return await D.getWorkflowManager().getInitializationPromise(), u.type !== "transaction" && this.customer && await D.attachCustomerDetails({ email: this.customer.emailAddress }), D;
10006
10017
  });
10007
10018
  return await Promise.all(Q);