@spiffcommerce/core 18.1.0-beta.1 → 18.2.0-beta.0

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createHttpLink as ct, InMemoryCache as gt, ApolloClient as lt, from as Bt, gql as M } from "@apollo/client/core";
2
- import { fetch as qA, getAttributesFromArrayBuffer as pe, AssetType as re, StepType as f, getFrameData as ZA, frameDataCache as dt, GroupCommand as R, UpdateFramePattern as De, UpdateFrameThresholdSettingsCommand as wt, calculateOffsets as $A, LayoutElementType as U, generate as k, CreateElementCommand as b, generateSVGWithUnknownColors as fe, svgObjectURL as pA, fetchAsString as q, DeleteElementCommand as Z, generateDefaultRectangleFrameSvg as ce, GetSVGDimensions as Et, patternImageDataCache as ge, fetchAsArrayBuffer as ht, findElement as DA, modifySVGWithElementProperties as Ct, IllustrationColorCommand as OA, IllustrationCacheCommand as Qt, getFontMetrics as ut, getPatternImageData as zA, FontAlignmentCommand as mt, FontColorCommand as It, FontImageFillCommand as kA, applyTextTransformations as KA, determineCorrectFontSizeAndLines as uA, FontSourceCommand as le, loadFont as _A, TextChangeCommand as pt, FontSizeCommand as Dt, createElementNS as ft, createElement as lA, _loadFontExternalDataURL as Ae, UpdateWorkflowStateCommand as Be, CommandContext as Ft, createCanvas as fA, getSvgElement as Fe, LayoutRenderingPurpose as Me, renderPapyrusComponentAsString as ye, loadImage as Ye, getDomParser as Se, toBase64 as de, getVariant as Mt, generateFrameSVG as yt, getDefaultVariant as PA, domParser as xe, sanitizeSvgTree as Ne, traverse as Yt, xmlSerializer as Pe, CreateLayoutCommand as St, AspectType as mA, rehydrateSerializedLayout as _ } from "@spiffcommerce/papyrus";
3
- import { AssetType as Ps, BringForwardCommand as Hs, BringToBackCommand as Rs, BringToFrontCommand as Us, CanvasCommand as Gs, CommandContext as vs, CreateElementCommand as ks, CreateLayoutCommand as Js, DeleteElementCommand as bs, FontAlignmentCommand as Ls, FontColorCommand as Ts, FontSizeCommand as Os, FontSourceCommand as zs, GroupCommand as Ks, LayoutElementFactory as js, LayoutElementType as Vs, MoveCommand as Ws, ResizeCommand as Xs, RotateCommand as qs, SendBackwardsCommand as Zs, StepAspectType as $s, StepType as _s, TextChangeCommand as Ai, UnitOfMeasurement as ei, dataUrlFromExternalUrl as ti, determineCorrectFontSizeAndLines as ai, findElement as ni, frameDataCache as si, generate as ii, generateSVGWithUnknownColors as oi, getAttributesFromArrayBuffer as ri, getAxisAlignedBoundingBox as ci, getFrameData as gi, getSvgElement as li, loadFont as Bi, patternImageDataCache as di, registerFetchImplementation as wi, registerWindowImplementation as Ei, rehydrateSerializedLayout as hi, setCanvasModule as Ci } from "@spiffcommerce/papyrus";
2
+ import { fetch as qA, getAttributesFromArrayBuffer as pe, AssetType as re, StepType as f, getFrameData as ZA, frameDataCache as dt, GroupCommand as R, UpdateFramePattern as De, UpdateFrameThresholdSettingsCommand as wt, calculateOffsets as $A, LayoutElementType as U, generate as k, CreateElementCommand as b, generateSVGWithUnknownColors as fe, svgObjectURL as pA, fetchAsString as q, DeleteElementCommand as Z, generateDefaultRectangleFrameSvg as ce, GetSVGDimensions as Et, patternImageDataCache as ge, fetchAsArrayBuffer as ht, findElement as DA, modifySVGWithElementProperties as Ct, IllustrationColorCommand as TA, IllustrationCacheCommand as Qt, getFontMetrics as ut, getPatternImageData as zA, FontAlignmentCommand as mt, FontColorCommand as It, FontImageFillCommand as kA, applyTextTransformations as KA, determineCorrectFontSizeAndLines as uA, FontSourceCommand as le, loadFont as _A, TextChangeCommand as pt, FontSizeCommand as Dt, createElementNS as ft, createElement as lA, _loadFontExternalDataURL as Ae, UpdateWorkflowStateCommand as Be, CommandContext as Ft, createCanvas as fA, getSvgElement as Fe, LayoutRenderingPurpose as Me, renderPapyrusComponentAsString as ye, loadImage as Ye, getDomParser as Se, toBase64 as de, getVariant as Mt, generateFrameSVG as yt, getDefaultVariant as PA, domParser as xe, sanitizeSvgTree as Ne, traverse as Yt, xmlSerializer as Pe, CreateLayoutCommand as St, AspectType as mA, rehydrateSerializedLayout as _ } from "@spiffcommerce/papyrus";
3
+ import { AssetType as Ps, BringForwardCommand as Hs, BringToBackCommand as Rs, BringToFrontCommand as Us, CanvasCommand as Gs, CommandContext as vs, CreateElementCommand as ks, CreateLayoutCommand as Js, DeleteElementCommand as bs, FontAlignmentCommand as Ls, FontColorCommand as Os, FontSizeCommand as Ts, FontSourceCommand as zs, GroupCommand as Ks, LayoutElementFactory as js, LayoutElementType as Vs, MoveCommand as Ws, ResizeCommand as Xs, RotateCommand as qs, SendBackwardsCommand as Zs, StepAspectType as $s, StepType as _s, TextChangeCommand as Ai, UnitOfMeasurement as ei, dataUrlFromExternalUrl as ti, determineCorrectFontSizeAndLines as ai, findElement as ni, frameDataCache as si, generate as ii, generateSVGWithUnknownColors as oi, getAttributesFromArrayBuffer as ri, getAxisAlignedBoundingBox as ci, getFrameData as gi, getSvgElement as li, loadFont as Bi, patternImageDataCache as di, registerFetchImplementation as wi, registerWindowImplementation as Ei, rehydrateSerializedLayout as hi, setCanvasModule as Ci } from "@spiffcommerce/papyrus";
4
4
  import { setContext as xt } from "@apollo/client/link/context";
5
5
  import { onError as Nt } from "@apollo/client/link/error";
6
6
  import { Pith as He } from "pith";
@@ -25,7 +25,7 @@ class FA extends cA {
25
25
  super(`Option not Configured: ${A.stepTitle}`), this.optionId = (A == null ? void 0 : A.optionId) || "N/A";
26
26
  }
27
27
  }
28
- class T extends cA {
28
+ class O extends cA {
29
29
  constructor(A) {
30
30
  super(`Panel not Found: ${A.panelId}`), this.panelId = (A == null ? void 0 : A.panelId) || "N/A";
31
31
  }
@@ -185,8 +185,8 @@ class kt {
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
  }
@@ -333,7 +333,7 @@ const N = new kt(), Jt = M`
333
333
  ...MaterialFields
334
334
  }
335
335
  }
336
- `, Tt = M`
336
+ `, Ot = M`
337
337
  mutation CreateAsset($name: String!, $type: String!, $mimeType: String!, $anonymous: Boolean, $temporary: Boolean) {
338
338
  assetCreate(name: $name, type: $type, mimeType: $mimeType, anonymous: $anonymous, temporary: $temporary) {
339
339
  uploadUrl
@@ -354,7 +354,7 @@ const N = new kt(), Jt = M`
354
354
  variables: {
355
355
  keys: c
356
356
  }
357
- })).data.assets, Ot = async (c) => (await N.getShadowGraphqlClient().query({
357
+ })).data.assets, Tt = async (c) => (await N.getShadowGraphqlClient().query({
358
358
  query: Lt,
359
359
  errorPolicy: "all",
360
360
  fetchPolicy: "no-cache",
@@ -364,7 +364,7 @@ const N = new kt(), Jt = M`
364
364
  })).data.materials, zt = async (c, A, e, t, a) => {
365
365
  var s;
366
366
  return (s = (await N.getShadowGraphqlClient().mutate({
367
- mutation: Tt,
367
+ mutation: Ot,
368
368
  errorPolicy: "all",
369
369
  fetchPolicy: "no-cache",
370
370
  variables: {
@@ -427,7 +427,7 @@ class Kt {
427
427
  async getMaterialLocalOrFromServer(A) {
428
428
  if (this.materialCache.has(A))
429
429
  return this.materialCache.get(A);
430
- const t = (async () => (await Ot([A]))[0])();
430
+ const t = (async () => (await Tt([A]))[0])();
431
431
  return this.materialCache.set(A, t), t;
432
432
  }
433
433
  /**
@@ -692,18 +692,21 @@ class Zt {
692
692
  const K = new Zt();
693
693
  var $t = /* @__PURE__ */ ((c) => (c.Hub = "Hub", c.Shopify = "Shopify", c))($t || {}), _t = /* @__PURE__ */ ((c) => (c[c.Orbit = 0] = "Orbit", c[c.Pan = 1] = "Pan", c))(_t || {}), Aa = /* @__PURE__ */ ((c) => (c.Manual = "Manual", c.OnStart = "OnStart", c.OnQuit = "OnQuit", c.OnEnd = "OnEnd", c))(Aa || {}), ea = /* @__PURE__ */ ((c) => (c.Email = "Email", c.FirstName = "FirstName", c.LastName = "LastName", c.Phone = "Phone", c))(ea || {}), YA = /* @__PURE__ */ ((c) => (c.Owner = "Owner", c.Approver = "Approver", c.Editor = "Editor", c.Viewer = "Viewer", c))(YA || {});
694
694
  const gA = M`
695
- fragment AdditionalProductFields on Product {
695
+ fragment AdditionalIntegrationProductFields on IntegrationProduct {
696
696
  id
697
- basePrice
698
- enabled
699
- name
700
- sku
701
- skuCode
702
- weight
703
- imageUrl
704
- modelUrl
705
- overlayImageUrl
706
- preloadImageUrl
697
+ product {
698
+ id
699
+ basePrice
700
+ enabled
701
+ name
702
+ sku
703
+ skuCode
704
+ weight
705
+ imageUrl
706
+ modelUrl
707
+ overlayImageUrl
708
+ preloadImageUrl
709
+ }
707
710
  }
708
711
  `, he = M`
709
712
  ${gA}
@@ -783,8 +786,8 @@ const gA = M`
783
786
  externalVariantId
784
787
  additionalExternalProductId
785
788
  additionalExternalVariantId
786
- additionalProduct {
787
- ...AdditionalProductFields
789
+ additionalIntegrationProduct {
790
+ ...AdditionalIntegrationProductFields
788
791
  }
789
792
  }
790
793
  }
@@ -855,8 +858,8 @@ const gA = M`
855
858
  externalVariantId
856
859
  additionalExternalProductId
857
860
  additionalExternalVariantId
858
- additionalProduct {
859
- ...AdditionalProductFields
861
+ additionalIntegrationProduct {
862
+ ...AdditionalIntegrationProductFields
860
863
  }
861
864
  }
862
865
  }
@@ -927,8 +930,8 @@ const gA = M`
927
930
  externalVariantId
928
931
  additionalExternalProductId
929
932
  additionalExternalVariantId
930
- additionalProduct {
931
- ...AdditionalProductFields
933
+ additionalIntegrationProduct {
934
+ ...AdditionalIntegrationProductFields
932
935
  }
933
936
  }
934
937
  }
@@ -1006,8 +1009,8 @@ const gA = M`
1006
1009
  externalVariantId
1007
1010
  additionalExternalProductId
1008
1011
  additionalExternalVariantId
1009
- additionalProduct {
1010
- ...AdditionalProductFields
1012
+ additionalIntegrationProduct {
1013
+ ...AdditionalIntegrationProductFields
1011
1014
  }
1012
1015
  }
1013
1016
  }
@@ -1065,7 +1068,7 @@ M`
1065
1068
  }
1066
1069
  }
1067
1070
  `;
1068
- const Te = M`
1071
+ const Oe = M`
1069
1072
  query ReadWorkflowStates($ids: [String]!) {
1070
1073
  transactions(ids: $ids) {
1071
1074
  id
@@ -1161,7 +1164,7 @@ const Te = M`
1161
1164
  );
1162
1165
  return n;
1163
1166
  };
1164
- class Oe {
1167
+ class Te {
1165
1168
  constructor() {
1166
1169
  this.timestamp = Date.now();
1167
1170
  }
@@ -1430,7 +1433,7 @@ class Ce {
1430
1433
  var o, r, g, B;
1431
1434
  const n = this.layouts.find((l) => l.panelId === a.panelId);
1432
1435
  if (!n)
1433
- throw new T(a);
1436
+ throw new O(a);
1434
1437
  let s = "";
1435
1438
  if (this.configuration.type === f.ProductOverlay) {
1436
1439
  let l = "";
@@ -1514,7 +1517,7 @@ class Ce {
1514
1517
  return this.configuration.type === f.ProductOverlay ? Promise.all(
1515
1518
  this.configuration.data.regions.map((A) => {
1516
1519
  if (!this.layouts.find((t) => A.panelId === t.panelId))
1517
- throw new T(A);
1520
+ throw new O(A);
1518
1521
  return this.processRegion(A);
1519
1522
  })
1520
1523
  ) : Promise.reject("Unknown silent step. This is a bug");
@@ -1584,9 +1587,9 @@ class da {
1584
1587
  if (!e && t !== "" && a === "") {
1585
1588
  const g = async () => {
1586
1589
  var u, D;
1587
- const h = (await be([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;
1588
- return { asset: h, link: I };
1589
- }, B = await new Promise((h, I) => {
1590
+ const h = (await be([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;
1591
+ return { asset: h, link: m };
1592
+ }, B = await new Promise((h, m) => {
1590
1593
  new Ke(
1591
1594
  async () => !!(await g()).link,
1592
1595
  async () => {
@@ -1599,7 +1602,7 @@ class da {
1599
1602
  });
1600
1603
  },
1601
1604
  () => {
1602
- I("Poller timed out with 40 attempts @ 3 second interval");
1605
+ m("Poller timed out with 40 attempts @ 3 second interval");
1603
1606
  },
1604
1607
  3e3,
1605
1608
  40
@@ -1632,7 +1635,7 @@ class da {
1632
1635
  const n = t.getLayouts(), i = `data:image/svg+xml;base64,${btoa(await Ge(A, { type: "svg" }))}`, o = e.map((r) => {
1633
1636
  const g = r.region, B = n.find((l) => l.panelId === (g == null ? void 0 : g.panelId));
1634
1637
  if (!B && g)
1635
- throw new T(g);
1638
+ throw new O(g);
1636
1639
  if (B && !g)
1637
1640
  throw new Error("Region not found");
1638
1641
  if (!B || !g)
@@ -1838,7 +1841,7 @@ class Ea {
1838
1841
  n && n(!0);
1839
1842
  const r = await Promise.all(
1840
1843
  A.data.regions.map(async (d, w) => {
1841
- const C = await ZA(o[w]), E = i.getImageData(), Q = t.map((m) => new Z(m.id)), h = E ? $A(E, C) : void 0, I = E ? {
1844
+ const C = await ZA(o[w]), E = i.getImageData(), Q = t.map((I) => new Z(I.id)), h = E ? $A(E, C) : void 0, m = E ? {
1842
1845
  id: k(),
1843
1846
  src: E.src,
1844
1847
  x: (h == null ? void 0 : h.x) || 0,
@@ -1848,13 +1851,13 @@ class Ea {
1848
1851
  scaleX: (h == null ? void 0 : h.zoom) || 1,
1849
1852
  scaleY: (h == null ? void 0 : h.zoom) || 1,
1850
1853
  rotation: 0
1851
- } : void 0, u = k(), p = a.getLayouts().find((m) => m.panelId === d.panelId);
1854
+ } : void 0, u = k(), p = a.getLayouts().find((I) => I.panelId === d.panelId);
1852
1855
  if (!p)
1853
- throw new T(d);
1856
+ throw new O(d);
1854
1857
  return {
1855
1858
  command: this.getCreateElementCommand(u, d, p, {
1856
1859
  frameData: C,
1857
- pattern: I,
1860
+ pattern: m,
1858
1861
  disablePlaceholder: A.data.disablePlaceholder,
1859
1862
  focalBlur: A.data.focalBlur,
1860
1863
  focalBlurStrength: A.data.focalBlurStrength,
@@ -2019,7 +2022,7 @@ class ha {
2019
2022
  const i = Ct(A, e, t, s), o = await pA(i), r = [];
2020
2023
  for (const B of a) {
2021
2024
  for (const [l, d] of n.entries())
2022
- r.push(new OA(B, l, d));
2025
+ r.push(new TA(B, l, d));
2023
2026
  r.push(new Qt(B, i, o));
2024
2027
  }
2025
2028
  return new R(r);
@@ -2080,13 +2083,13 @@ class ha {
2080
2083
  if (!o)
2081
2084
  throw new oA(i);
2082
2085
  const r = await fe(await this.getIllustrationBody(o)), g = await pA(r.svg), B = (h) => {
2083
- const I = n.getLayouts().find((D) => D.panelId === h.panelId);
2084
- if (!I)
2085
- throw new T(h);
2086
+ const m = n.getLayouts().find((D) => D.panelId === h.panelId);
2087
+ if (!m)
2088
+ throw new O(h);
2086
2089
  const u = k();
2087
2090
  return {
2088
2091
  regionElement: { id: u, region: h },
2089
- command: this.getCreateElementCommand(u, h, I, {
2092
+ command: this.getCreateElementCommand(u, h, m, {
2090
2093
  stepName: A.stepName,
2091
2094
  src: o,
2092
2095
  objectURL: g,
@@ -2097,9 +2100,9 @@ class ha {
2097
2100
  let C = Array.from(Object.values(r.colors)).map((h) => h.browserValue);
2098
2101
  const E = A.data.colorOption;
2099
2102
  return E && ((Q = E.variants) == null || Q.forEach((h) => {
2100
- C = C.map((I) => {
2103
+ C = C.map((m) => {
2101
2104
  var u;
2102
- return I.toLowerCase() === ((u = h.color) == null ? void 0 : u.toLowerCase()) ? h.name : I;
2105
+ return m.toLowerCase() === ((u = h.color) == null ? void 0 : u.toLowerCase()) ? h.name : m;
2103
2106
  });
2104
2107
  })), n.updateMetadata(A.stepName, { colors: C }), {
2105
2108
  command: new R(w),
@@ -2107,11 +2110,22 @@ class ha {
2107
2110
  await n.setSelectionsAndElements(
2108
2111
  A.stepName,
2109
2112
  [e],
2110
- l.map((h) => h.regionElement),
2113
+ l.map((u) => u.regionElement),
2111
2114
  async () => {
2112
2115
  n.setMandatoryFulfilled(A.stepName, !0), a(!1);
2113
2116
  }
2114
2117
  );
2118
+ const h = await this.availableColors(A, n) || [], m = Object.keys(r.colors);
2119
+ if (A.data.colorPickerEnabled && h.length === 1 && m.length === 1) {
2120
+ const u = h[0], D = m[0];
2121
+ await this.changeColors(
2122
+ A,
2123
+ l.map((p) => p.regionElement),
2124
+ n,
2125
+ () => n.getCommandContext().getAllLayouts(),
2126
+ /* @__PURE__ */ new Map([[D, u.variant.color]])
2127
+ );
2128
+ }
2115
2129
  }
2116
2130
  };
2117
2131
  }
@@ -2441,7 +2455,7 @@ class Ia {
2441
2455
  const o = t.getRegionElements(A.stepName).map((B) => new Z(B.id)), r = (B) => {
2442
2456
  const d = t.getLayouts().find((C) => C.panelId === B.panelId);
2443
2457
  if (!d)
2444
- throw new T(B);
2458
+ throw new O(B);
2445
2459
  const w = k();
2446
2460
  return {
2447
2461
  regionElement: { id: w, region: B },
@@ -2559,8 +2573,8 @@ class Da {
2559
2573
  const a = t.getLayouts(), s = (t.getRegionElements(e.stepName) || []).map((i) => {
2560
2574
  const o = i.region;
2561
2575
  if (!a.find((g) => g.panelId === (o == null ? void 0 : o.panelId)))
2562
- throw new T(o);
2563
- return new OA(i.id, this.shapeFillId, A);
2576
+ throw new O(o);
2577
+ return new TA(i.id, this.shapeFillId, A);
2564
2578
  }).filter((i) => !!i);
2565
2579
  t.getCommandDispatcher()(new R(s)), t.updateStorage(e.stepName, { colour: A });
2566
2580
  }
@@ -2630,9 +2644,9 @@ class Da {
2630
2644
  const r = (B) => {
2631
2645
  const l = B.region;
2632
2646
  if (!n.find((C) => C.panelId === (l == null ? void 0 : l.panelId)))
2633
- throw new T(l);
2647
+ throw new O(l);
2634
2648
  const w = i();
2635
- return new OA(B.id, this.shapeFillId, w);
2649
+ return new TA(B.id, this.shapeFillId, w);
2636
2650
  }, g = t.map(r).filter((B) => !!B);
2637
2651
  return {
2638
2652
  command: new R(g),
@@ -2646,9 +2660,9 @@ class Da {
2646
2660
  };
2647
2661
  } else {
2648
2662
  const r = (d) => {
2649
- const w = n.find((I) => I.panelId === d.panelId);
2663
+ const w = n.find((m) => m.panelId === d.panelId);
2650
2664
  if (!w)
2651
- throw new T(d);
2665
+ throw new O(d);
2652
2666
  const C = i(), E = `
2653
2667
  <svg
2654
2668
  xmlns="http://www.w3.org/2000/svg"
@@ -2984,14 +2998,14 @@ class ya {
2984
2998
  if (o && l) {
2985
2999
  const d = (r = o.variants) == null ? void 0 : r.find((w) => w.id === l);
2986
3000
  if (d) {
2987
- const w = await this.fontDataFromVariant(d), 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;
3001
+ const w = await this.fontDataFromVariant(d), 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;
2988
3002
  await e.setSelectionsAndElements(
2989
3003
  A.stepName,
2990
3004
  [d],
2991
3005
  C,
2992
3006
  async () => {
2993
3007
  e.updateMetadata(A.stepName, { color: E, text: Q }), e.updateStorage(A.stepName, { text: Q, inputText: Q });
2994
- const I = i.map((D) => new le(D.id, w)), u = new R(I);
3008
+ const m = i.map((D) => new le(D.id, w)), u = new R(m);
2995
3009
  e.getCommandDispatcher()(u), e.setMandatoryFulfilled(A.stepName, !0);
2996
3010
  }
2997
3011
  );
@@ -3116,18 +3130,18 @@ class ya {
3116
3130
  let Q;
3117
3131
  if (E && E.variants) {
3118
3132
  const S = E.variants.find((J) => {
3119
- var O;
3120
- return J.id === ((O = E.defaultVariant) == null ? void 0 : O.id);
3133
+ var T;
3134
+ return J.id === ((T = E.defaultVariant) == null ? void 0 : T.id);
3121
3135
  }) || E.variants[0];
3122
3136
  Q = this.createTextFillSpotColor(E, S), s.updateStorage(A, {
3123
3137
  colorProfileAssetKey: (C = E.colorProfile) == null ? void 0 : C.key
3124
3138
  });
3125
3139
  }
3126
- const h = await this.getDefaultColor(t), I = h || "#000000", u = {
3140
+ const h = await this.getDefaultColor(t), m = h || "#000000", u = {
3127
3141
  stepRegion: B,
3128
3142
  stepName: A,
3129
3143
  align: this.textAlign(t),
3130
- fill: n.color ? n.color : I,
3144
+ fill: n.color ? n.color : m,
3131
3145
  fontSize: t.size || bA,
3132
3146
  fontData: a,
3133
3147
  id: w,
@@ -3147,7 +3161,7 @@ class ya {
3147
3161
  curved: t.curved,
3148
3162
  paths: t.paths,
3149
3163
  fillSpotColorDefinition: Q
3150
- }, D = [], p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
3164
+ }, D = [], p = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
3151
3165
  if (!u.fontData)
3152
3166
  throw new v("Failed to resolve font data for text.");
3153
3167
  const [F, Y] = uA(
@@ -3164,7 +3178,7 @@ class ya {
3164
3178
  [o],
3165
3179
  { size: t.size, minSize: t.minSize, maxSize: t.maxSize }
3166
3180
  );
3167
- p.set(u.id, F), m.set(u.id, Y);
3181
+ p.set(u.id, F), I.set(u.id, Y);
3168
3182
  const y = t.curved || t.vertical ? o : (Y || []).join(`
3169
3183
  `);
3170
3184
  D.push(
@@ -3225,13 +3239,13 @@ class ya {
3225
3239
  return g && g(!0), { info: "0" };
3226
3240
  const u = s.getProfanities(), D = jA(l.toLowerCase());
3227
3241
  for (const p of D)
3228
- for (const m in u) {
3229
- const F = u[m].toLowerCase().replace(/\s/g, "");
3242
+ for (const I in u) {
3243
+ const F = u[I].toLowerCase().replace(/\s/g, "");
3230
3244
  if (p === F)
3231
3245
  return o(!0), { error: "Blocked profanity." };
3232
3246
  }
3233
3247
  return !A.data.vertical && !A.data.allowNewlines && (l.includes(`
3234
- `) || 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() });
3248
+ `) || 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() });
3235
3249
  })();
3236
3250
  if (Q.error) {
3237
3251
  r(Q.error);
@@ -4701,8 +4715,8 @@ class Ra extends ae {
4701
4715
  const t = A.toSVG(2), a = A.getBoundingBox(), n = a.x2 - a.x1, s = A.toPathData(3), i = () => {
4702
4716
  const D = P("g"), p = P("defs");
4703
4717
  D.appendChild(p), p.appendChild($e(3, 7, 4, "shadow"));
4704
- const m = P("g");
4705
- D.appendChild(m), m.setAttribute("filter", "url(#shadow)"), m.innerHTML = t;
4718
+ const I = P("g");
4719
+ D.appendChild(I), I.setAttribute("filter", "url(#shadow)"), I.innerHTML = t;
4706
4720
  const F = P("g");
4707
4721
  D.appendChild(F), F.setAttribute("fill", "red"), F.setAttribute("stroke", "red"), F.setAttribute("stroke-width", "9"), F.innerHTML = t;
4708
4722
  const Y = P("g");
@@ -4720,8 +4734,8 @@ class Ra extends ae {
4720
4734
  Q.setAttribute("opacity", "0"), E.appendChild(Q);
4721
4735
  const h = P("g");
4722
4736
  E.appendChild(h);
4723
- const I = i();
4724
- h.appendChild(I);
4737
+ const m = i();
4738
+ h.appendChild(m);
4725
4739
  const u = ee(s);
4726
4740
  return se(h, u, l, d), _e(o.outerHTML);
4727
4741
  }
@@ -4743,17 +4757,17 @@ class Ga extends ae {
4743
4757
  }
4744
4758
  brandSvg(A, e, t) {
4745
4759
  const a = A.toSVG(2), n = A.getBoundingBox(), s = n.y2 - n.y1, i = n.x2 - n.x1, o = A.toPathData(3), r = () => {
4746
- const m = P("g"), F = P("g");
4747
- m.appendChild(F), F.setAttribute("stroke", "#5C1A0D"), F.setAttribute("stroke-width", "4"), F.setAttribute("transform", "translate(1,1)"), F.innerHTML = a;
4760
+ const I = P("g"), F = P("g");
4761
+ I.appendChild(F), F.setAttribute("stroke", "#5C1A0D"), F.setAttribute("stroke-width", "4"), F.setAttribute("transform", "translate(1,1)"), F.innerHTML = a;
4748
4762
  const Y = P("g");
4749
- m.appendChild(Y), Y.setAttribute("fill", "#FFE386"), Y.setAttribute("transform", "translate(1,1)"), Y.innerHTML = a;
4763
+ I.appendChild(Y), Y.setAttribute("fill", "#FFE386"), Y.setAttribute("transform", "translate(1,1)"), Y.innerHTML = a;
4750
4764
  const y = P("g");
4751
- m.appendChild(y), y.setAttribute("fill", "white"), y.innerHTML = a;
4752
- const G = new ie(m);
4765
+ I.appendChild(y), y.setAttribute("fill", "white"), y.innerHTML = a;
4766
+ const G = new ie(I);
4753
4767
  return G.transform(([S, J]) => [S, J + ((i - S) * J) ** 2 / (i * 5e4)]), G.transform(([S, J]) => [
4754
4768
  S,
4755
4769
  J + (i / 3 - S) ** 2 / i * this.indicator(S < i / 3)
4756
- ]), G.transform(([S, J]) => [S - (s - J) * (i - S) / 800, J]), m;
4770
+ ]), G.transform(([S, J]) => [S - (s - J) * (i - S) / 800, J]), I;
4757
4771
  }, [g, B, l] = qe(e);
4758
4772
  if (!g)
4759
4773
  return "";
@@ -4763,8 +4777,8 @@ class Ga extends ae {
4763
4777
  t ? (w = B * 0.25 * (1 + 0.1), C = l / 2 * (1 + 0.1), E = l * 0.22, Q = B * 0.32) : (w = B * 0.22 * (1 + 0.1), C = l * 0.8, E = l * 0.067, Q = B * 0.33);
4764
4778
  const h = P("g");
4765
4779
  g.appendChild(h), h.setAttribute("transform", `translate(${E} ${Q}) rotate(-10)`);
4766
- const I = ne(w, C);
4767
- I.setAttribute("opacity", "0"), h.appendChild(I);
4780
+ const m = ne(w, C);
4781
+ m.setAttribute("opacity", "0"), h.appendChild(m);
4768
4782
  const u = P("g");
4769
4783
  h.appendChild(u);
4770
4784
  const D = r();
@@ -4786,21 +4800,21 @@ class ka extends ae {
4786
4800
  return this.svgElement(A, e);
4787
4801
  }
4788
4802
  svgElement(A, e) {
4789
- const t = Ae(va), 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 = () => {
4790
- const I = P("g");
4791
- I.classList.add("module-text-group");
4803
+ const t = Ae(va), 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 = () => {
4804
+ const m = P("g");
4805
+ m.classList.add("module-text-group");
4792
4806
  const u = P("defs");
4793
- I.appendChild(u), u.appendChild($e(0, 2, 2, "shadow"));
4807
+ m.appendChild(u), u.appendChild($e(0, 2, 2, "shadow"));
4794
4808
  const D = P("path");
4795
4809
  D.setAttribute("d", g), D.setAttribute("stroke", "black"), D.setAttribute("stroke-width", "3"), u.appendChild(D);
4796
4810
  const p = P("g");
4797
- p.classList.add("module-layer0"), I.appendChild(p), p.setAttribute("filter", "url(#shadow)"), p.innerHTML = D.outerHTML;
4798
- const m = P("g");
4799
- 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;
4811
+ p.classList.add("module-layer0"), m.appendChild(p), p.setAttribute("filter", "url(#shadow)"), p.innerHTML = D.outerHTML;
4812
+ const I = P("g");
4813
+ 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;
4800
4814
  const F = P("g");
4801
- 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;
4815
+ 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;
4802
4816
  const Y = P("g");
4803
- return Y.classList.add("module-layer3"), I.appendChild(Y), Y.setAttribute("fill", "white"), Y.innerHTML = i, new ie(I).transform(([G, S]) => [G, S + (r / 2 - G) ** 2 / (r * 6)]), I;
4817
+ return Y.classList.add("module-layer3"), m.appendChild(Y), Y.setAttribute("fill", "white"), Y.innerHTML = i, new ie(m).transform(([G, S]) => [G, S + (r / 2 - G) ** 2 / (r * 6)]), m;
4804
4818
  }, l = P("g");
4805
4819
  l.classList.add("module-root");
4806
4820
  const d = P("defs");
@@ -4830,7 +4844,7 @@ async function At(c) {
4830
4844
  }
4831
4845
  var NA = /* @__PURE__ */ ((c) => (c.Error = "Error", c.Warning = "Warning", c.Info = "Info", c))(NA || {});
4832
4846
  const Ja = 1e3;
4833
- class ue extends Oe {
4847
+ class ue extends Te {
4834
4848
  constructor(A) {
4835
4849
  super(), this.createdAt = /* @__PURE__ */ new Date(), this.update = A;
4836
4850
  }
@@ -5244,11 +5258,11 @@ class ba {
5244
5258
  this.stepSelections = {
5245
5259
  ...this.stepSelections,
5246
5260
  [A]: { selectedVariants: e }
5247
- }, 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) => {
5261
+ }, 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) => {
5248
5262
  tA(p, this.stepSelections) || (this.stepInitialised[p.stepName] = !1, delete this.stepMetadata[p.stepName], delete this.stepSelections[p.stepName], delete this.storage[p.stepName]);
5249
5263
  });
5250
5264
  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(
5251
- (p) => !r.some((m) => m.stepName === p.stepName)
5265
+ (p) => !r.some((I) => I.stepName === p.stepName)
5252
5266
  );
5253
5267
  r.forEach((p) => {
5254
5268
  tA(p, this.stepSelections) || (this.stepInitialised[p.stepName] = !1);
@@ -5262,15 +5276,15 @@ class ba {
5262
5276
  const C = this.workflow.steps.find((p) => p.stepName === A);
5263
5277
  if ((C == null ? void 0 : C.type) === f.Frame) {
5264
5278
  const p = this.getStepSpecificServices(A);
5265
- (D = p == null ? void 0 : p.frameService) == null || D.setTargetElements(t.map((m) => m.id));
5279
+ (D = p == null ? void 0 : p.frameService) == null || D.setTargetElements(t.map((I) => I.id));
5266
5280
  }
5267
5281
  const E = l.map((p) => new Z(p.id)), Q = new Be(this.constructSerializableWorkflow()), h = [...w, ...E, Q];
5268
5282
  h.length > 0 && this.commandContext.apply(new R(h), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
5269
- const I = this.getInvalidModelVariants(), u = this.modelContainer;
5283
+ const m = this.getInvalidModelVariants(), u = this.modelContainer;
5270
5284
  if (u) {
5271
- const p = I.map(
5272
- (m) => u.applyModelVariant(
5273
- m,
5285
+ const p = m.map(
5286
+ (I) => u.applyModelVariant(
5287
+ I,
5274
5288
  {
5275
5289
  contextService: this.getLayoutPreviewService()
5276
5290
  },
@@ -5635,7 +5649,7 @@ class La extends j {
5635
5649
  return this.step.data.colorPickerEnabled;
5636
5650
  }
5637
5651
  }
5638
- class Ta extends j {
5652
+ class Oa extends j {
5639
5653
  constructor(A, e) {
5640
5654
  super(A, e);
5641
5655
  }
@@ -5648,7 +5662,7 @@ class Ta extends j {
5648
5662
  );
5649
5663
  }
5650
5664
  }
5651
- class Oa extends j {
5665
+ class Ta extends j {
5652
5666
  constructor(A, e) {
5653
5667
  super(A, e);
5654
5668
  }
@@ -5959,9 +5973,9 @@ class wA {
5959
5973
  case f.Shape:
5960
5974
  return new ja(A, e);
5961
5975
  case f.Material:
5962
- return new Ta(A, e);
5963
- case f.Model:
5964
5976
  return new Oa(A, e);
5977
+ case f.Model:
5978
+ return new Ta(A, e);
5965
5979
  case f.Frame:
5966
5980
  return new Es(A, e);
5967
5981
  default:
@@ -6164,19 +6178,19 @@ const tt = M`
6164
6178
  }, nt = async (c, A, e, t, a, n, s, i, o, r) => {
6165
6179
  var F;
6166
6180
  await (async () => {
6167
- var O;
6181
+ var T;
6168
6182
  if (r !== void 0)
6169
6183
  return r;
6170
6184
  await c.outstandingRequestsPromise();
6171
6185
  const y = (x.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(a.id), S = await N.getShadowGraphqlClient().query({
6172
- query: Te,
6186
+ query: Oe,
6173
6187
  variables: { ids: [a.id] },
6174
6188
  fetchPolicy: "no-cache",
6175
6189
  errorPolicy: "all",
6176
6190
  context: {
6177
6191
  transactionOwnerId: y
6178
6192
  }
6179
- }), J = (O = S.data) == null ? void 0 : O.transactions[0].workflowState;
6193
+ }), J = (T = S.data) == null ? void 0 : T.transactions[0].workflowState;
6180
6194
  return S.errors ? (S.errors.forEach((W) => {
6181
6195
  S.errors && console.log("Server Error:", W.message);
6182
6196
  }), null) : J ?? null;
@@ -6186,11 +6200,11 @@ const tt = M`
6186
6200
  let G = 0;
6187
6201
  if (Object.keys(n).length > 0)
6188
6202
  for (const S of Object.keys(n)) {
6189
- const J = n[S], O = A.steps.find((W) => W.stepName === S);
6203
+ const J = n[S], T = A.steps.find((W) => W.stepName === S);
6190
6204
  for (let W = 0; W < J.selections.length; ++W) {
6191
6205
  const X = J.selections[W];
6192
- if (O && (!Y || O.option && (O.option.variants || []).length > 1 && !O.data.hideSelectionInCart && !O.data.hideSelectionsInCart)) {
6193
- const vA = O.stepTitle;
6206
+ if (T && (!Y || T.option && (T.option.variants || []).length > 1 && !T.data.hideSelectionInCart && !T.data.hideSelectionsInCart)) {
6207
+ const vA = T.stepTitle;
6194
6208
  y[vA] ? y[vA].push({
6195
6209
  id: X.id || "",
6196
6210
  name: X.name,
@@ -6207,7 +6221,7 @@ const tt = M`
6207
6221
  }
6208
6222
  }
6209
6223
  return [y, G];
6210
- }, [h] = await Q(!0), I = Object.fromEntries(
6224
+ }, [h] = await Q(!0), m = Object.fromEntries(
6211
6225
  Object.keys(h).map((Y) => [Y, h[Y].map((y) => y.id)])
6212
6226
  ), [u] = await Q(!1), D = Object.fromEntries(
6213
6227
  Object.keys(u).map((Y) => [
@@ -6234,7 +6248,7 @@ const tt = M`
6234
6248
  y.push({ key: G, value: S });
6235
6249
  Y.metadata = y;
6236
6250
  }
6237
- if (I) {
6251
+ if (m) {
6238
6252
  const y = [];
6239
6253
  for (const [G, S] of Object.entries(D))
6240
6254
  y.push({ key: G, ids: S });
@@ -6284,7 +6298,7 @@ const tt = M`
6284
6298
  const a = await (async () => {
6285
6299
  var r;
6286
6300
  const o = await N.getShadowGraphqlClient().query({
6287
- query: Te,
6301
+ query: Oe,
6288
6302
  variables: { ids: c.map((g) => g.transaction.id) },
6289
6303
  fetchPolicy: "no-cache",
6290
6304
  errorPolicy: "all"
@@ -6479,12 +6493,12 @@ class EA {
6479
6493
  return this.workflowManager;
6480
6494
  }
6481
6495
  async createPreviewImage(A, e) {
6482
- var h, I;
6496
+ var h, m;
6483
6497
  const t = this.workflowManager.getWorkflow(), a = (h = t == null ? void 0 : t.finalizeStepConfig) == null ? void 0 : h.lookAtAnimation;
6484
6498
  if (A) {
6485
6499
  if (!a)
6486
6500
  throw new Error("Failed to generate cart preview image!");
6487
- return await ((I = this.workflowManager.getPreviewService()) == null ? void 0 : I.renderSceneScreenshot(e ?? 512, a)) || "";
6501
+ return await ((m = this.workflowManager.getPreviewService()) == null ? void 0 : m.renderSceneScreenshot(e ?? 512, a)) || "";
6488
6502
  }
6489
6503
  let n = 2048;
6490
6504
  e && e <= 2048 && (n = e);
@@ -6711,7 +6725,7 @@ const nn = [
6711
6725
  const o = i.toString(), g = `data:image/svg+xml;base64,${de(await Ge(o, { type: "svg" }))}`, B = (d) => {
6712
6726
  const w = c.find((E) => E.panelId === d.panelId);
6713
6727
  if (!w)
6714
- throw new T(d);
6728
+ throw new O(d);
6715
6729
  const C = k();
6716
6730
  return new b(
6717
6731
  {
@@ -6747,7 +6761,7 @@ const nn = [
6747
6761
  (C = i == null ? void 0 : i.asset) == null ? void 0 : C.fileLink
6748
6762
  ), B = await ZA(g), l = k(), d = c.find((E) => E.panelId === r.panelId);
6749
6763
  if (!d)
6750
- throw new T(r);
6764
+ throw new O(r);
6751
6765
  const w = $A(s, B, {
6752
6766
  scale: a.scale,
6753
6767
  left: a.x,
@@ -6790,7 +6804,7 @@ const nn = [
6790
6804
  const a = e.data, n = t.option;
6791
6805
  if (!n)
6792
6806
  return console.error(`No option for step ${t.stepName}.`), [];
6793
- const s = ((D = n.variants) == null ? void 0 : D.find((m) => m.id === a.illustrationVariantId)) || PA(n);
6807
+ const s = ((D = n.variants) == null ? void 0 : D.find((I) => I.id === a.illustrationVariantId)) || PA(n);
6794
6808
  if (!s)
6795
6809
  return console.error(`No variant with ID: ${a.illustrationVariantId}`), [];
6796
6810
  if (!s.asset)
@@ -6804,32 +6818,32 @@ const nn = [
6804
6818
  return console.error("Failed to read SVG."), [];
6805
6819
  Ne(w);
6806
6820
  const C = {};
6807
- Yt(w, (m) => {
6808
- nn.includes(m.tagName) && !m.attributes.getNamedItem("fill") && m.setAttribute("fill", "#000000");
6809
- const F = m.attributes.getNamedItem("fill");
6821
+ Yt(w, (I) => {
6822
+ nn.includes(I.tagName) && !I.attributes.getNamedItem("fill") && I.setAttribute("fill", "#000000");
6823
+ const F = I.attributes.getNamedItem("fill");
6810
6824
  if (F && F.value !== "none") {
6811
6825
  const y = F.value, S = `spiff-fill-${y.replace(/\W/g, "")}`;
6812
- m.classList.add(S), C[S] = { browserValue: y };
6826
+ I.classList.add(S), C[S] = { browserValue: y };
6813
6827
  }
6814
- const Y = m.attributes.getNamedItem("stroke");
6828
+ const Y = I.attributes.getNamedItem("stroke");
6815
6829
  if (Y && Y.value !== "none") {
6816
6830
  const y = Y.value, S = `spiff-stroke-${y.replace(/\W/g, "")}`;
6817
- m.classList.add(S), C[S] = { browserValue: y };
6831
+ I.classList.add(S), C[S] = { browserValue: y };
6818
6832
  }
6819
6833
  });
6820
6834
  const Q = Pe().serializeToString(w), h = a.colors;
6821
6835
  if (h) {
6822
- for (const [m, F] of Object.entries(C))
6836
+ for (const [I, F] of Object.entries(C))
6823
6837
  for (const Y of Object.keys(h))
6824
6838
  if (F.browserValue === Y) {
6825
- C[m] = { browserValue: h[Y] };
6839
+ C[I] = { browserValue: h[Y] };
6826
6840
  break;
6827
6841
  }
6828
6842
  }
6829
- const I = (m) => {
6830
- const F = c.find((y) => y.panelId === m.panelId);
6843
+ const m = (I) => {
6844
+ const F = c.find((y) => y.panelId === I.panelId);
6831
6845
  if (!F)
6832
- throw new T(m);
6846
+ throw new O(I);
6833
6847
  const Y = k();
6834
6848
  return new b(
6835
6849
  {
@@ -6837,28 +6851,28 @@ const nn = [
6837
6851
  id: Y,
6838
6852
  svg: Q,
6839
6853
  type: U.Illustration,
6840
- y: m.top,
6841
- x: m.left,
6842
- rotation: m.rotation,
6843
- width: m.width,
6844
- height: m.height,
6845
- layer: m.layer,
6846
- layerIndex: m.layerIndex,
6847
- immutable: m.immutable
6854
+ y: I.top,
6855
+ x: I.left,
6856
+ rotation: I.rotation,
6857
+ width: I.width,
6858
+ height: I.height,
6859
+ layer: I.layer,
6860
+ layerIndex: I.layerIndex,
6861
+ immutable: I.immutable
6848
6862
  },
6849
6863
  F
6850
6864
  );
6851
6865
  }, u = t.data.regions;
6852
6866
  try {
6853
- return u.map(I);
6854
- } catch (m) {
6855
- return console.error(m), [];
6867
+ return u.map(m);
6868
+ } catch (I) {
6869
+ return console.error(I), [];
6856
6870
  }
6857
6871
  }, cn = async (c, A, e) => {
6858
6872
  const t = await At(e.data.module), a = A.data, n = (i, o) => {
6859
6873
  const r = c.find((B) => B.panelId === o.panelId);
6860
6874
  if (!r)
6861
- throw new T(o);
6875
+ throw new O(o);
6862
6876
  const g = k();
6863
6877
  return new b(
6864
6878
  {
@@ -6901,7 +6915,7 @@ const nn = [
6901
6915
  const o = (l) => {
6902
6916
  const d = c.find((C) => C.panelId === l.panelId);
6903
6917
  if (!d)
6904
- throw new T(l);
6918
+ throw new O(l);
6905
6919
  const w = k();
6906
6920
  return new b(
6907
6921
  {
@@ -6938,7 +6952,7 @@ const nn = [
6938
6952
  const i = (g) => {
6939
6953
  const B = c.find((E) => E.panelId === g.panelId);
6940
6954
  if (!B)
6941
- throw new T(g);
6955
+ throw new O(g);
6942
6956
  const l = `
6943
6957
  <svg
6944
6958
  xmlns="http://www.w3.org/2000/svg"
@@ -6993,7 +7007,7 @@ const nn = [
6993
7007
  o.forEach((r) => {
6994
7008
  const g = c.find((l) => l.panelId === r.panelId);
6995
7009
  if (!g)
6996
- throw new T(r);
7010
+ throw new O(r);
6997
7011
  const B = {
6998
7012
  id: k(),
6999
7013
  src: n,
@@ -7026,7 +7040,7 @@ const nn = [
7026
7040
  o.forEach((B) => {
7027
7041
  const l = c.find((w) => w.panelId === B.panelId);
7028
7042
  if (!l)
7029
- throw new T(B);
7043
+ throw new O(B);
7030
7044
  const d = {
7031
7045
  id: k(),
7032
7046
  src: n,
@@ -7052,11 +7066,11 @@ const nn = [
7052
7066
  return t;
7053
7067
  }, dn = async (c, A, e, t) => {
7054
7068
  const a = [], n = e.data, s = 30, i = (E) => E.vertical ? "center" : E.textAlign || "center", o = () => {
7055
- var I;
7069
+ var m;
7056
7070
  const E = t.option;
7057
7071
  if (!E)
7058
7072
  return;
7059
- const Q = ((I = E.variants) == null ? void 0 : I.find((u) => u.id === n.fontVariantId)) || PA(E);
7073
+ const Q = ((m = E.variants) == null ? void 0 : m.find((u) => u.id === n.fontVariantId)) || PA(E);
7060
7074
  if (!Q || !Q.asset)
7061
7075
  return;
7062
7076
  A[t.stepName] = { selectedVariants: [Q] };
@@ -7083,7 +7097,7 @@ const nn = [
7083
7097
  return h == null ? void 0 : h.color;
7084
7098
  }, w = n.color || await d(t.data), C = t.data.regions;
7085
7099
  for (const E of C) {
7086
- const Q = c.find((I) => I.panelId === E.panelId);
7100
+ const Q = c.find((m) => m.panelId === E.panelId);
7087
7101
  if (!Q)
7088
7102
  continue;
7089
7103
  const h = {
@@ -7108,7 +7122,7 @@ const nn = [
7108
7122
  y: E.top
7109
7123
  };
7110
7124
  if (g) {
7111
- const [I, u] = uA(
7125
+ const [m, u] = uA(
7112
7126
  t.data.size || s,
7113
7127
  g,
7114
7128
  E,
@@ -7128,7 +7142,7 @@ const nn = [
7128
7142
  new b(
7129
7143
  {
7130
7144
  ...h,
7131
- fontSize: I,
7145
+ fontSize: m,
7132
7146
  text: h.curved ? h.text : (u || []).join(`
7133
7147
  `)
7134
7148
  },
@@ -7298,7 +7312,7 @@ class Qn {
7298
7312
  );
7299
7313
  }
7300
7314
  }
7301
- class un extends Oe {
7315
+ class un extends Te {
7302
7316
  constructor(A, e, t, a, n, s, i) {
7303
7317
  super(), this.layoutId = A, this.ctx = e, this.nonPOTSupport = t, this.onRender = a, this.workflow = n, this.layouts = s, this.productOverlayImageUrl = i;
7304
7318
  }
@@ -7396,8 +7410,8 @@ const ys = (c, A) => {
7396
7410
  externalVariantId
7397
7411
  additionalExternalProductId
7398
7412
  additionalExternalVariantId
7399
- additionalProduct {
7400
- ...AdditionalProductFields
7413
+ additionalIntegrationProduct {
7414
+ ...AdditionalIntegrationProductFields
7401
7415
  }
7402
7416
  integration {
7403
7417
  enabled
@@ -8007,7 +8021,7 @@ class Ln {
8007
8021
  throw new Error(`Unable to create global property state for bundle: ${this.bundleId}`);
8008
8022
  }
8009
8023
  }
8010
- class Tn {
8024
+ class On {
8011
8025
  constructor(A) {
8012
8026
  this.setState(A);
8013
8027
  }
@@ -8078,7 +8092,7 @@ class Tn {
8078
8092
  };
8079
8093
  }
8080
8094
  }
8081
- class On {
8095
+ class Tn {
8082
8096
  constructor(A) {
8083
8097
  this.collection = A;
8084
8098
  }
@@ -8201,7 +8215,7 @@ class zn {
8201
8215
  var i;
8202
8216
  return ((i = s.integration) == null ? void 0 : i.externalIntegrationId) === A.externalId;
8203
8217
  }
8204
- ) : t = this.getIntegrationByType(A.integrationType), !t || !t.additionalProduct ? e : e + (t.additionalProduct.basePrice || 0);
8218
+ ) : t = this.getIntegrationByType(A.integrationType), !t || !t.additionalIntegrationProduct || !t.additionalIntegrationProduct.product ? e : e + (t.additionalIntegrationProduct.product.basePrice || 0);
8205
8219
  }
8206
8220
  }
8207
8221
  class me {
@@ -8281,7 +8295,7 @@ class jn {
8281
8295
  class Ie {
8282
8296
  constructor(A, e, t, a, n) {
8283
8297
  var s, i, o;
8284
- this.eventListeners = /* @__PURE__ */ new Map(), this.workflowExperiences = [], this.client = A, this.id = e.id, this.name = e.name || "", this.ownerId = n, this.metadata = new Map(((s = e.metadata) == null ? void 0 : s.map((r) => [r.key, r.value])) || []), this.productCollection = e.productCollection, this.bundleStateManager = new Tn(e.bundleStateData), this.globalConfiguration = (i = this.productCollection) == null ? void 0 : i.globalPropertyConfiguration, this.globalPropertyStateManager = new Ln(
8298
+ this.eventListeners = /* @__PURE__ */ new Map(), this.workflowExperiences = [], this.client = A, this.id = e.id, this.name = e.name || "", this.ownerId = n, this.metadata = new Map(((s = e.metadata) == null ? void 0 : s.map((r) => [r.key, r.value])) || []), this.productCollection = e.productCollection, this.bundleStateManager = new On(e.bundleStateData), this.globalConfiguration = (i = this.productCollection) == null ? void 0 : i.globalPropertyConfiguration, this.globalPropertyStateManager = new Ln(
8285
8299
  this.id,
8286
8300
  this.ownerId,
8287
8301
  this.checkConditionalHandlesChanged.bind(this)
@@ -8343,7 +8357,7 @@ class Ie {
8343
8357
  return this.workflowExperiences.map((A) => A.getTotalPriceSubunits()).reduce((A, e) => A + e, 0);
8344
8358
  }
8345
8359
  getProductCollection() {
8346
- return this.productCollection ? new On(this.productCollection) : void 0;
8360
+ return this.productCollection ? new Tn(this.productCollection) : void 0;
8347
8361
  }
8348
8362
  async addWorkflowExperience(A) {
8349
8363
  await this.appendWorkflowExperience(A), await this.injectExperienceIntoPreviewService(A);
@@ -9546,7 +9560,7 @@ const $n = M`
9546
9560
  previewRegion: A.previewRegion,
9547
9561
  useEditableArea: A.useEditableArea,
9548
9562
  editableArea: A.editableArea
9549
- })), TA = (c, A) => {
9563
+ })), OA = (c, A) => {
9550
9564
  const e = c.workflowState, t = e ? JSON.parse(e) : void 0;
9551
9565
  return t ? Object.values(t.layouts).map((a) => a.layout) : Bs(A.panels);
9552
9566
  };
@@ -9645,14 +9659,14 @@ class ds {
9645
9659
  const E = i.get(A);
9646
9660
  if (E && await this.authenticateCustomerId(E)) {
9647
9661
  const h = ((d = (l = this.customer) == null ? void 0 : l.bundleStakeholders) == null ? void 0 : d.find(
9648
- (I) => {
9662
+ (m) => {
9649
9663
  var u, D;
9650
- return (D = (u = I.bundle) == null ? void 0 : u.transactions) == null ? void 0 : D.some((p) => p.id === A);
9664
+ return (D = (u = m.bundle) == null ? void 0 : u.transactions) == null ? void 0 : D.some((p) => p.id === A);
9651
9665
  }
9652
9666
  )) || ((C = (w = this.customer) == null ? void 0 : w.stakeholders) == null ? void 0 : C.find(
9653
- (I) => {
9667
+ (m) => {
9654
9668
  var u;
9655
- return ((u = I.transaction) == null ? void 0 : u.id) === A;
9669
+ return ((u = m.transaction) == null ? void 0 : u.id) === A;
9656
9670
  }
9657
9671
  ));
9658
9672
  if (h)
@@ -9875,10 +9889,10 @@ class ds {
9875
9889
  var Q, h;
9876
9890
  const E = N.getShadowGraphqlClient();
9877
9891
  if (a.type === "transaction") {
9878
- const { transactionId: I, readOnly: u } = a, D = await E.query({
9892
+ const { transactionId: m, readOnly: u } = a, D = await E.query({
9879
9893
  query: BA,
9880
9894
  variables: {
9881
- ids: [I]
9895
+ ids: [m]
9882
9896
  },
9883
9897
  errorPolicy: "all",
9884
9898
  fetchPolicy: "no-cache"
@@ -9888,20 +9902,20 @@ class ds {
9888
9902
  const p = (h = D.data) == null ? void 0 : h.transactions[0];
9889
9903
  if (!p.workflowId)
9890
9904
  throw new H("Existing transaction has no workflow ID.");
9891
- const m = await QA(p.workflowId);
9905
+ const I = await QA(p.workflowId);
9892
9906
  if (!p.product)
9893
9907
  throw new H("Failed to load transaction, product not available.");
9894
- return { transaction: p, workflow: m, readOnly: u };
9908
+ return { transaction: p, workflow: I, readOnly: u };
9895
9909
  }
9896
9910
  if (a.type === "integration" || a.type === "external") {
9897
- const I = async () => {
9898
- const m = a.type === "integration" ? { integrationProductId: a.integrationProductId } : {
9911
+ const m = async () => {
9912
+ const I = a.type === "integration" ? { integrationProductId: a.integrationProductId } : {
9899
9913
  externalIntegrationId: a.externalIntegrationId,
9900
9914
  externalProductId: a.externalProductId
9901
9915
  }, F = await E.mutate({
9902
9916
  mutation: he,
9903
9917
  variables: {
9904
- ...m,
9918
+ ...I,
9905
9919
  workflowId: a.workflowId,
9906
9920
  claim: !0
9907
9921
  },
@@ -9916,7 +9930,7 @@ class ds {
9916
9930
  if (!Y.product)
9917
9931
  throw new H("Failed to create transaction, product not available.");
9918
9932
  return Y;
9919
- }, u = QA(a.workflowId, a == null ? void 0 : a.graphql), [D, p] = await Promise.all([I(), u]);
9933
+ }, u = QA(a.workflowId, a == null ? void 0 : a.graphql), [D, p] = await Promise.all([m(), u]);
9920
9934
  return { transaction: D, workflow: p };
9921
9935
  }
9922
9936
  throw new H("No workflow ID provided.");
@@ -9943,7 +9957,7 @@ class ds {
9943
9957
  const E = JSON.parse(a.workflowState);
9944
9958
  r.layouts = Object.values(E.layouts).map((Q) => Q.layout), await _(E), await AA(E), r.reloadedState = E;
9945
9959
  } else
9946
- r.layouts = TA(
9960
+ r.layouts = OA(
9947
9961
  r.transaction,
9948
9962
  r.workflow
9949
9963
  );
@@ -9974,30 +9988,30 @@ class ds {
9974
9988
  async getWorkflowExperiences(A, e) {
9975
9989
  if (A.length === 0)
9976
9990
  throw new H("No options provided!");
9977
- const t = N.getShadowGraphqlClient(), a = A.map((h, I) => ({ option: h, index: I })), n = a.filter((h) => h.option.type === "transaction"), s = a.filter(
9991
+ const t = N.getShadowGraphqlClient(), a = A.map((h, m) => ({ option: h, index: m })), n = a.filter((h) => h.option.type === "transaction"), s = a.filter(
9978
9992
  (h) => h.option.type === "integration" || h.option.type === "external"
9979
9993
  ), i = async () => {
9980
9994
  var D, p;
9981
9995
  if (n.length === 0)
9982
9996
  return [];
9983
- const h = n.map((m) => m.option.transactionId), I = await t.query({
9997
+ const h = n.map((I) => I.option.transactionId), m = await t.query({
9984
9998
  query: BA,
9985
9999
  variables: {
9986
10000
  ids: h
9987
10001
  },
9988
10002
  errorPolicy: "all",
9989
10003
  fetchPolicy: "no-cache"
9990
- }), u = I.data.transactions;
10004
+ }), u = m.data.transactions;
9991
10005
  if (u.length !== n.length) {
9992
- const m = ((p = (D = I.errors) == null ? void 0 : D[0]) == null ? void 0 : p.message) || "Unknown error";
9993
- throw new H(`Not all transactions were found: ${m}`);
10006
+ const I = ((p = (D = m.errors) == null ? void 0 : D[0]) == null ? void 0 : p.message) || "Unknown error";
10007
+ throw new H(`Not all transactions were found: ${I}`);
9994
10008
  }
9995
- return u.map((m, F) => {
10009
+ return u.map((I, F) => {
9996
10010
  var Y;
9997
10011
  return {
9998
- transaction: m,
9999
- workflowId: m.workflowId,
10000
- readOnly: ((Y = n.find((y) => y.option.transactionId === m.id)) == null ? void 0 : Y.option.readOnly) ?? !1,
10012
+ transaction: I,
10013
+ workflowId: I.workflowId,
10014
+ readOnly: ((Y = n.find((y) => y.option.transactionId === I.id)) == null ? void 0 : Y.option.readOnly) ?? !1,
10001
10015
  index: n[F].index
10002
10016
  };
10003
10017
  });
@@ -10008,51 +10022,51 @@ class ds {
10008
10022
  const h = await t.mutate({
10009
10023
  mutation: ta,
10010
10024
  variables: {
10011
- inputs: s.map((m) => ({
10012
- integrationProductId: m.option.type === "integration" ? m.option.integrationProductId : void 0,
10013
- externalIntegrationId: m.option.type === "external" ? m.option.externalIntegrationId : void 0,
10014
- externalProductId: m.option.type === "external" ? m.option.externalProductId : void 0,
10015
- workflowId: m.option.workflowId,
10025
+ inputs: s.map((I) => ({
10026
+ integrationProductId: I.option.type === "integration" ? I.option.integrationProductId : void 0,
10027
+ externalIntegrationId: I.option.type === "external" ? I.option.externalIntegrationId : void 0,
10028
+ externalProductId: I.option.type === "external" ? I.option.externalProductId : void 0,
10029
+ workflowId: I.option.workflowId,
10016
10030
  claim: !0
10017
10031
  }))
10018
10032
  },
10019
10033
  errorPolicy: "all",
10020
10034
  fetchPolicy: "no-cache"
10021
- }), I = (u = h.data) == null ? void 0 : u.transactionCreateMany;
10022
- if (!I || I.length === 0) {
10023
- const m = ((p = (D = h.errors) == null ? void 0 : D[0]) == null ? void 0 : p.message) || "Unknown error";
10024
- throw new H(`Failed to create transactions: ${m}`);
10035
+ }), m = (u = h.data) == null ? void 0 : u.transactionCreateMany;
10036
+ if (!m || m.length === 0) {
10037
+ const I = ((p = (D = h.errors) == null ? void 0 : D[0]) == null ? void 0 : p.message) || "Unknown error";
10038
+ throw new H(`Failed to create transactions: ${I}`);
10025
10039
  }
10026
- return I.map((m, F) => ({
10027
- transaction: m,
10028
- workflowId: m.workflowId,
10040
+ return m.map((I, F) => ({
10041
+ transaction: I,
10042
+ workflowId: I.workflowId,
10029
10043
  readOnly: !1,
10030
10044
  index: s[F].index
10031
10045
  }));
10032
10046
  }, r = (await Promise.all([i(), o()])).flat(), g = [...new Set(r.map((h) => h.workflowId))], B = await rt(g, e), l = new Map(B.map((h) => [h.id, h])), d = x.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), w = r.map(async (h) => {
10033
10047
  var G;
10034
- const { transaction: I, workflowId: u, readOnly: D, index: p } = h, m = l.get(u), F = A[p];
10035
- !d.get(I.id) && I.transactionOwnerId && d.set(I.id, I.transactionOwnerId);
10036
- const Y = d.get(I.id) || void 0, y = {
10037
- product: I.product,
10038
- transaction: I,
10048
+ const { transaction: m, workflowId: u, readOnly: D, index: p } = h, I = l.get(u), F = A[p];
10049
+ !d.get(m.id) && m.transactionOwnerId && d.set(m.id, m.transactionOwnerId);
10050
+ const Y = d.get(m.id) || void 0, y = {
10051
+ product: m.product,
10052
+ transaction: m,
10039
10053
  layouts: [],
10040
10054
  singleVariantsRenderable: (G = F == null ? void 0 : F.workflowConfiguration) == null ? void 0 : G.singleVariantsRenderable,
10041
10055
  stateMutationFunc: D ? async () => {
10042
10056
  throw new v("State mutation is forbidden in read only mode!");
10043
10057
  } : async (S) => this.updateTransactionState({ ...S, context: { transactionOwnerId: Y } }),
10044
10058
  readOnly: D,
10045
- workflow: m,
10059
+ workflow: I,
10046
10060
  isReloadedTransaction: F.type === "transaction"
10047
10061
  };
10048
- if (F.type === "transaction" && I.workflowState) {
10049
- const S = JSON.parse(I.workflowState);
10062
+ if (F.type === "transaction" && m.workflowState) {
10063
+ const S = JSON.parse(m.workflowState);
10050
10064
  y.layouts = Object.values(S.layouts).map((J) => J.layout), await _(S), await AA(S), y.reloadedState = S;
10051
10065
  } else if (!D && F.workflowState) {
10052
10066
  const S = JSON.parse(F.workflowState);
10053
10067
  y.layouts = Object.values(S.layouts).map((J) => J.layout), await _(S), await AA(S), y.reloadedState = S;
10054
10068
  } else
10055
- y.layouts = TA(
10069
+ y.layouts = OA(
10056
10070
  y.transaction,
10057
10071
  y.workflow
10058
10072
  );
@@ -10061,8 +10075,8 @@ class ds {
10061
10075
  ), this.initialized = !0, this.experienceOptions = y, { experienceOptions: y, index: p, options: F };
10062
10076
  });
10063
10077
  x.setMap("transactionOwnerIds", d);
10064
- const Q = (await Promise.all(w)).sort((h, I) => h.index - I.index).map(async (h) => {
10065
- const { experienceOptions: I, options: u } = h, D = new EA(this, I);
10078
+ const Q = (await Promise.all(w)).sort((h, m) => h.index - m.index).map(async (h) => {
10079
+ const { experienceOptions: m, options: u } = h, D = new EA(this, m);
10066
10080
  return await D.getWorkflowManager().getInitializationPromise(), u.type !== "transaction" && this.customer && await D.attachCustomerDetails({ email: this.customer.emailAddress }), D;
10067
10081
  });
10068
10082
  return await Promise.all(Q);
@@ -10213,7 +10227,7 @@ class ds {
10213
10227
  const d = JSON.parse(e);
10214
10228
  this.experienceOptions.layouts = Object.values(d.layouts).map((w) => w.layout), await _(d), await AA(d), this.experienceOptions.reloadedState = d;
10215
10229
  } else
10216
- this.experienceOptions.layouts = TA(
10230
+ this.experienceOptions.layouts = OA(
10217
10231
  this.experienceOptions.transaction,
10218
10232
  this.experienceOptions.workflow
10219
10233
  );
@@ -10439,8 +10453,8 @@ export {
10439
10453
  Xn as FlowExecutionResult,
10440
10454
  Wn as FlowService,
10441
10455
  Ls as FontAlignmentCommand,
10442
- Ts as FontColorCommand,
10443
- Os as FontSizeCommand,
10456
+ Os as FontColorCommand,
10457
+ Ts as FontSizeCommand,
10444
10458
  zs as FontSourceCommand,
10445
10459
  la as FrameService,
10446
10460
  ws as FrameStep,
@@ -10453,11 +10467,11 @@ export {
10453
10467
  $t as IntegrationType,
10454
10468
  js as LayoutElementFactory,
10455
10469
  Vs as LayoutElementType,
10456
- T as LayoutNotFoundError,
10457
- Ta as MaterialStepHandle,
10470
+ O as LayoutNotFoundError,
10471
+ Oa as MaterialStepHandle,
10458
10472
  MA as MisconfigurationError,
10459
10473
  Ss as MockWorkflowManager,
10460
- Oa as ModelStepHandle,
10474
+ Ta as ModelStepHandle,
10461
10475
  Ws as MoveCommand,
10462
10476
  ot as ObjectInput,
10463
10477
  Zn as ObjectInputType,
@@ -10465,12 +10479,12 @@ export {
10465
10479
  sA as ParseError,
10466
10480
  za as PictureStepHandle,
10467
10481
  _t as ProductCameraRig,
10468
- On as ProductCollection,
10482
+ Tn as ProductCollection,
10469
10483
  me as ProductWorkflow,
10470
10484
  rA as PromiseCache,
10471
10485
  ze as PromiseQueue,
10472
10486
  Ka as QuestionStepHandle,
10473
- Oe as QueueablePromise,
10487
+ Te as QueueablePromise,
10474
10488
  Xs as ResizeCommand,
10475
10489
  oA as ResourceNotFoundError,
10476
10490
  qs as RotateCommand,